From 4e26bcf957665524a0de49c2bed0eed558c93c15 Mon Sep 17 00:00:00 2001 From: jordangarcia Date: Wed, 21 Sep 2016 11:00:51 -0700 Subject: [PATCH] Prep for 1.4.0 release --- CHANGELOG.md | 47 + dist/nuclear.js | 4412 +++++++++++++++++++++------------------ dist/nuclear.js.map | 1 + dist/nuclear.min.js | 6 +- dist/nuclear.min.js.map | 1 + src/logging.js | 2 +- src/main.js | 2 + src/reactor/fns.js | 2 +- 8 files changed, 2420 insertions(+), 2053 deletions(-) create mode 100644 dist/nuclear.js.map create mode 100644 dist/nuclear.min.js.map diff --git a/CHANGELOG.md b/CHANGELOG.md index efa3dcd..eaa9211 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,50 @@ +## 1.4.0 (September 21, 2015) + + +- **[NEW]** Added ability to switch out the default caching strategy for caching getter values. Also expose an LRU cache that can be swapped in for the basic cache +- **[NEW]** Add ability to supply your own logger and override the default console group logger in NuclearJS +- **[UPGRADE]** Upgrade `immutable` to `3.8.1` + + +### Cache Configuration + +``` +import * as Nuclear from 'nuclear-js'; + +const MAX_ITEMS = 1000 // (optional, default = 1000) how many items to keep in the LRU cache before evicting +const EVICT_COUNT = 10 // (optional, default = 1) how many items to throw out when the cache fills up + +new Nuclear.Reactor({ + debug: false, + cache: new Nuclear.LRUCache(MAX_ITEMS, EVICT_COUNT), +}); +``` + +### Using your own Logger + +``` +import * as Nuclear from 'nuclear-js'; + +new Nuclear.Reactor({ + logger: { + dispatchStart(reactorState, actionType, payload) { + console.log(`dispatch: actionType=${actionTypes}`, payload) + }, + dispatchError(reactorState, error) { + // useful if you need to close a console.group if an error is thrown during dispatch + }, + dispatchEnd(reactorState, state, dirtyStores, previousState) { + const prevStateChanges = previousState.filter((val, key) => dirtyStores.contains(key)).toJS() + const stateChanges = state.filter((val, key) => dirtyStores.contains(key)).toJS() + + console.log('prev state: ', prevStateChanges) + console.log('new state: ', stateChanges) + }, + }, +}); +``` + + ## 1.3.0 (December 31, 2015) - **[NEW]** Store hot-reloading via `reactor.replaceStores(stores)` which replaces the implementation of a store without resetting its underlying state value. See [hot reloading example](https://github.com/optimizely/nuclear-js/tree/master/examples/hot-reloading). diff --git a/dist/nuclear.js b/dist/nuclear.js index 68a25ed..2397005 100644 --- a/dist/nuclear.js +++ b/dist/nuclear.js @@ -82,6 +82,8 @@ return /******/ (function(modules) { // webpackBootstrap var _getter = __webpack_require__(10); + var _reactorCache = __webpack_require__(9); + var _createReactMixin = __webpack_require__(7); var _createReactMixin2 = _interopRequireDefault(_createReactMixin); @@ -95,7 +97,8 @@ return /******/ (function(modules) { // webpackBootstrap toJS: _immutableHelpers.toJS, toImmutable: _immutableHelpers.toImmutable, isImmutable: _immutableHelpers.isImmutable, - createReactMixin: _createReactMixin2['default'] + createReactMixin: _createReactMixin2['default'], + LRUCache: _reactorCache.LRUCache }; module.exports = exports['default']; @@ -106,7 +109,9 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; try { + /* eslint-disable no-console */ if (!(window.console && console.log)) { + /* eslint-enable no-console */ console = { log: function log() {}, debug: function debug() {}, @@ -115,7 +120,9 @@ return /******/ (function(modules) { // webpackBootstrap error: function error() {} }; } - } catch (e) {} + } catch (e) { + // ignored + } /***/ }, /* 2 */ @@ -265,10 +272,11 @@ return /******/ (function(modules) { // webpackBootstrap * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ + (function (global, factory) { true ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : - global.Immutable = factory() + (global.Immutable = factory()); }(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice; function createClass(ctor, superClass) { @@ -278,6 +286,66 @@ return /******/ (function(modules) { // webpackBootstrap ctor.prototype.constructor = ctor; } + function Iterable(value) { + return isIterable(value) ? value : Seq(value); + } + + + createClass(KeyedIterable, Iterable); + function KeyedIterable(value) { + return isKeyed(value) ? value : KeyedSeq(value); + } + + + createClass(IndexedIterable, Iterable); + function IndexedIterable(value) { + return isIndexed(value) ? value : IndexedSeq(value); + } + + + createClass(SetIterable, Iterable); + function SetIterable(value) { + return isIterable(value) && !isAssociative(value) ? value : SetSeq(value); + } + + + + function isIterable(maybeIterable) { + return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]); + } + + function isKeyed(maybeKeyed) { + return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]); + } + + function isIndexed(maybeIndexed) { + return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]); + } + + function isAssociative(maybeAssociative) { + return isKeyed(maybeAssociative) || isIndexed(maybeAssociative); + } + + function isOrdered(maybeOrdered) { + return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]); + } + + Iterable.isIterable = isIterable; + Iterable.isKeyed = isKeyed; + Iterable.isIndexed = isIndexed; + Iterable.isAssociative = isAssociative; + Iterable.isOrdered = isOrdered; + + Iterable.Keyed = KeyedIterable; + Iterable.Indexed = IndexedIterable; + Iterable.Set = SetIterable; + + + var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; + var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; + var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@'; + var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; + // Used for setting prototype methods that IE8 chokes on. var DELETE = 'delete'; @@ -328,18 +396,18 @@ return /******/ (function(modules) { // webpackBootstrap function wrapIndex(iter, index) { // This implements "is array index" which the ECMAString spec defines as: + // // A String property name P is an array index if and only if // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal // to 2^32−1. - // However note that we're currently calling ToNumber() instead of ToUint32() - // which should be improved in the future, as floating point numbers should - // not be accepted as an array index. + // + // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects if (typeof index !== 'number') { - var numIndex = +index; - if ('' + numIndex !== index) { + var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32 + if ('' + uint32Index !== index || uint32Index === 4294967295) { return NaN; } - index = numIndex; + index = uint32Index; } return index < 0 ? ensureSize(iter) + index : index; } @@ -371,66 +439,6 @@ return /******/ (function(modules) { // webpackBootstrap Math.min(size, index); } - function Iterable(value) { - return isIterable(value) ? value : Seq(value); - } - - - createClass(KeyedIterable, Iterable); - function KeyedIterable(value) { - return isKeyed(value) ? value : KeyedSeq(value); - } - - - createClass(IndexedIterable, Iterable); - function IndexedIterable(value) { - return isIndexed(value) ? value : IndexedSeq(value); - } - - - createClass(SetIterable, Iterable); - function SetIterable(value) { - return isIterable(value) && !isAssociative(value) ? value : SetSeq(value); - } - - - - function isIterable(maybeIterable) { - return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]); - } - - function isKeyed(maybeKeyed) { - return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]); - } - - function isIndexed(maybeIndexed) { - return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]); - } - - function isAssociative(maybeAssociative) { - return isKeyed(maybeAssociative) || isIndexed(maybeAssociative); - } - - function isOrdered(maybeOrdered) { - return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]); - } - - Iterable.isIterable = isIterable; - Iterable.isKeyed = isKeyed; - Iterable.isIndexed = isIndexed; - Iterable.isAssociative = isAssociative; - Iterable.isOrdered = isOrdered; - - Iterable.Keyed = KeyedIterable; - Iterable.Indexed = IndexedIterable; - Iterable.Set = SetIterable; - - - var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; - var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; - var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@'; - var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; - /* global Symbol */ var ITERATE_KEYS = 0; @@ -443,22 +451,22 @@ return /******/ (function(modules) { // webpackBootstrap var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL; - function src_Iterator__Iterator(next) { + function Iterator(next) { this.next = next; } - src_Iterator__Iterator.prototype.toString = function() { + Iterator.prototype.toString = function() { return '[Iterator]'; }; - src_Iterator__Iterator.KEYS = ITERATE_KEYS; - src_Iterator__Iterator.VALUES = ITERATE_VALUES; - src_Iterator__Iterator.ENTRIES = ITERATE_ENTRIES; + Iterator.KEYS = ITERATE_KEYS; + Iterator.VALUES = ITERATE_VALUES; + Iterator.ENTRIES = ITERATE_ENTRIES; - src_Iterator__Iterator.prototype.inspect = - src_Iterator__Iterator.prototype.toSource = function () { return this.toString(); } - src_Iterator__Iterator.prototype[ITERATOR_SYMBOL] = function () { + Iterator.prototype.inspect = + Iterator.prototype.toSource = function () { return this.toString(); } + Iterator.prototype[ITERATOR_SYMBOL] = function () { return this; }; @@ -616,8 +624,6 @@ return /******/ (function(modules) { // webpackBootstrap - // #pragma Root Sequences - createClass(ArraySeq, IndexedSeq); function ArraySeq(array) { this._array = array; @@ -643,7 +649,7 @@ return /******/ (function(modules) { // webpackBootstrap var array = this._array; var maxIndex = array.length - 1; var ii = 0; - return new src_Iterator__Iterator(function() + return new Iterator(function() {return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])} @@ -689,7 +695,7 @@ return /******/ (function(modules) { // webpackBootstrap var keys = this._keys; var maxIndex = keys.length - 1; var ii = 0; - return new src_Iterator__Iterator(function() { + return new Iterator(function() { var key = keys[reverse ? maxIndex - ii : ii]; return ii++ > maxIndex ? iteratorDone() : @@ -731,10 +737,10 @@ return /******/ (function(modules) { // webpackBootstrap var iterable = this._iterable; var iterator = getIterator(iterable); if (!isIterator(iterator)) { - return new src_Iterator__Iterator(iteratorDone); + return new Iterator(iteratorDone); } var iterations = 0; - return new src_Iterator__Iterator(function() { + return new Iterator(function() { var step = iterator.next(); return step.done ? step : iteratorValue(type, iterations++, step.value); }); @@ -778,7 +784,7 @@ return /******/ (function(modules) { // webpackBootstrap var iterator = this._iterator; var cache = this._iteratorCache; var iterations = 0; - return new src_Iterator__Iterator(function() { + return new Iterator(function() { if (iterations >= cache.length) { var step = iterator.next(); if (step.done) { @@ -871,7 +877,7 @@ return /******/ (function(modules) { // webpackBootstrap if (cache) { var maxIndex = cache.length - 1; var ii = 0; - return new src_Iterator__Iterator(function() { + return new Iterator(function() { var entry = cache[reverse ? maxIndex - ii : ii]; return ii++ > maxIndex ? iteratorDone() : @@ -881,22 +887,35 @@ return /******/ (function(modules) { // webpackBootstrap return seq.__iteratorUncached(type, reverse); } - createClass(Collection, Iterable); - function Collection() { - throw TypeError('Abstract'); - } - - - createClass(KeyedCollection, Collection);function KeyedCollection() {} - - createClass(IndexedCollection, Collection);function IndexedCollection() {} + function fromJS(json, converter) { + return converter ? + fromJSWith(converter, json, '', {'': json}) : + fromJSDefault(json); + } - createClass(SetCollection, Collection);function SetCollection() {} + function fromJSWith(converter, json, key, parentJSON) { + if (Array.isArray(json)) { + return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)})); + } + if (isPlainObj(json)) { + return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)})); + } + return json; + } + function fromJSDefault(json) { + if (Array.isArray(json)) { + return IndexedSeq(json).map(fromJSDefault).toList(); + } + if (isPlainObj(json)) { + return KeyedSeq(json).map(fromJSDefault).toMap(); + } + return json; + } - Collection.Keyed = KeyedCollection; - Collection.Indexed = IndexedCollection; - Collection.Set = SetCollection; + function isPlainObj(value) { + return value && (value.constructor === Object || value.constructor === undefined); + } /** * An extension of the "same-value" algorithm as [described for use by ES6 Map @@ -978,1121 +997,548 @@ return /******/ (function(modules) { // webpackBootstrap return false; } - function fromJS(json, converter) { - return converter ? - fromJSWith(converter, json, '', {'': json}) : - fromJSDefault(json); - } - - function fromJSWith(converter, json, key, parentJSON) { - if (Array.isArray(json)) { - return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)})); - } - if (isPlainObj(json)) { - return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)})); + function deepEqual(a, b) { + if (a === b) { + return true; } - return json; - } - function fromJSDefault(json) { - if (Array.isArray(json)) { - return IndexedSeq(json).map(fromJSDefault).toList(); + if ( + !isIterable(b) || + a.size !== undefined && b.size !== undefined && a.size !== b.size || + a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash || + isKeyed(a) !== isKeyed(b) || + isIndexed(a) !== isIndexed(b) || + isOrdered(a) !== isOrdered(b) + ) { + return false; } - if (isPlainObj(json)) { - return KeyedSeq(json).map(fromJSDefault).toMap(); + + if (a.size === 0 && b.size === 0) { + return true; } - return json; - } - function isPlainObj(value) { - return value && (value.constructor === Object || value.constructor === undefined); - } + var notAssociative = !isAssociative(a); - var src_Math__imul = - typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ? - Math.imul : - function imul(a, b) { - a = a | 0; // int - b = b | 0; // int - var c = a & 0xffff; - var d = b & 0xffff; - // Shift by 0 fixes the sign on the high part. - return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int - }; + if (isOrdered(a)) { + var entries = a.entries(); + return b.every(function(v, k) { + var entry = entries.next().value; + return entry && is(entry[1], v) && (notAssociative || is(entry[0], k)); + }) && entries.next().done; + } - // v8 has an optimization for storing 31-bit signed numbers. - // Values which have either 00 or 11 as the high order bits qualify. - // This function drops the highest order bit in a signed number, maintaining - // the sign bit. - function smi(i32) { - return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF); - } + var flipped = false; - function hash(o) { - if (o === false || o === null || o === undefined) { - return 0; - } - if (typeof o.valueOf === 'function') { - o = o.valueOf(); - if (o === false || o === null || o === undefined) { - return 0; + if (a.size === undefined) { + if (b.size === undefined) { + if (typeof a.cacheResult === 'function') { + a.cacheResult(); + } + } else { + flipped = true; + var _ = a; + a = b; + b = _; } } - if (o === true) { - return 1; - } - var type = typeof o; - if (type === 'number') { - var h = o | 0; - if (h !== o) { - h ^= o * 0xFFFFFFFF; - } - while (o > 0xFFFFFFFF) { - o /= 0xFFFFFFFF; - h ^= o; - } - return smi(h); - } - if (type === 'string') { - return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o); - } - if (typeof o.hashCode === 'function') { - return o.hashCode(); - } - return hashJSObj(o); - } - function cachedHashString(string) { - var hash = stringHashCache[string]; - if (hash === undefined) { - hash = hashString(string); - if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) { - STRING_HASH_CACHE_SIZE = 0; - stringHashCache = {}; + var allEqual = true; + var bSize = b.__iterate(function(v, k) { + if (notAssociative ? !a.has(v) : + flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) { + allEqual = false; + return false; } - STRING_HASH_CACHE_SIZE++; - stringHashCache[string] = hash; - } - return hash; - } + }); - // http://jsperf.com/hashing-strings - function hashString(string) { - // This is the hash from JVM - // The hash code for a string is computed as - // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1], - // where s[i] is the ith character of the string and n is the length of - // the string. We "mod" the result to make it between 0 (inclusive) and 2^31 - // (exclusive) by dropping high bits. - var hash = 0; - for (var ii = 0; ii < string.length; ii++) { - hash = 31 * hash + string.charCodeAt(ii) | 0; - } - return smi(hash); + return allEqual && a.size === bSize; } - function hashJSObj(obj) { - var hash; - if (usingWeakMap) { - hash = weakMap.get(obj); - if (hash !== undefined) { - return hash; - } - } - - hash = obj[UID_HASH_KEY]; - if (hash !== undefined) { - return hash; - } + createClass(Repeat, IndexedSeq); - if (!canDefineProperty) { - hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY]; - if (hash !== undefined) { - return hash; + function Repeat(value, times) { + if (!(this instanceof Repeat)) { + return new Repeat(value, times); } - - hash = getIENodeHash(obj); - if (hash !== undefined) { - return hash; + this._value = value; + this.size = times === undefined ? Infinity : Math.max(0, times); + if (this.size === 0) { + if (EMPTY_REPEAT) { + return EMPTY_REPEAT; + } + EMPTY_REPEAT = this; } } - hash = ++objHashUID; - if (objHashUID & 0x40000000) { - objHashUID = 0; - } - - if (usingWeakMap) { - weakMap.set(obj, hash); - } else if (isExtensible !== undefined && isExtensible(obj) === false) { - throw new Error('Non-extensible objects are not allowed as keys.'); - } else if (canDefineProperty) { - Object.defineProperty(obj, UID_HASH_KEY, { - 'enumerable': false, - 'configurable': false, - 'writable': false, - 'value': hash - }); - } else if (obj.propertyIsEnumerable !== undefined && - obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) { - // Since we can't define a non-enumerable property on the object - // we'll hijack one of the less-used non-enumerable properties to - // save our hash on it. Since this is a function it will not show up in - // `JSON.stringify` which is what we want. - obj.propertyIsEnumerable = function() { - return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments); - }; - obj.propertyIsEnumerable[UID_HASH_KEY] = hash; - } else if (obj.nodeType !== undefined) { - // At this point we couldn't get the IE `uniqueID` to use as a hash - // and we couldn't use a non-enumerable property to exploit the - // dontEnum bug so we simply add the `UID_HASH_KEY` on the node - // itself. - obj[UID_HASH_KEY] = hash; - } else { - throw new Error('Unable to set a non-enumerable property on object.'); - } - - return hash; - } - - // Get references to ES5 object methods. - var isExtensible = Object.isExtensible; - - // True if Object.defineProperty works as expected. IE8 fails this test. - var canDefineProperty = (function() { - try { - Object.defineProperty({}, '@', {}); - return true; - } catch (e) { - return false; - } - }()); - - // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it - // and avoid memory leaks from the IE cloneNode bug. - function getIENodeHash(node) { - if (node && node.nodeType > 0) { - switch (node.nodeType) { - case 1: // Element - return node.uniqueID; - case 9: // Document - return node.documentElement && node.documentElement.uniqueID; + Repeat.prototype.toString = function() { + if (this.size === 0) { + return 'Repeat []'; } - } - } - - // If possible, use a WeakMap. - var usingWeakMap = typeof WeakMap === 'function'; - var weakMap; - if (usingWeakMap) { - weakMap = new WeakMap(); - } - - var objHashUID = 0; - - var UID_HASH_KEY = '__immutablehash__'; - if (typeof Symbol === 'function') { - UID_HASH_KEY = Symbol(UID_HASH_KEY); - } - - var STRING_HASH_CACHE_MIN_STRLEN = 16; - var STRING_HASH_CACHE_MAX_SIZE = 255; - var STRING_HASH_CACHE_SIZE = 0; - var stringHashCache = {}; - - function invariant(condition, error) { - if (!condition) throw new Error(error); - } + return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]'; + }; - function assertNotInfinite(size) { - invariant( - size !== Infinity, - 'Cannot perform this action with an infinite size.' - ); - } + Repeat.prototype.get = function(index, notSetValue) { + return this.has(index) ? this._value : notSetValue; + }; - createClass(ToKeyedSequence, KeyedSeq); - function ToKeyedSequence(indexed, useKeys) { - this._iter = indexed; - this._useKeys = useKeys; - this.size = indexed.size; - } + Repeat.prototype.includes = function(searchValue) { + return is(this._value, searchValue); + }; - ToKeyedSequence.prototype.get = function(key, notSetValue) { - return this._iter.get(key, notSetValue); + Repeat.prototype.slice = function(begin, end) { + var size = this.size; + return wholeSlice(begin, end, size) ? this : + new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size)); }; - ToKeyedSequence.prototype.has = function(key) { - return this._iter.has(key); + Repeat.prototype.reverse = function() { + return this; }; - ToKeyedSequence.prototype.valueSeq = function() { - return this._iter.valueSeq(); + Repeat.prototype.indexOf = function(searchValue) { + if (is(this._value, searchValue)) { + return 0; + } + return -1; }; - ToKeyedSequence.prototype.reverse = function() {var this$0 = this; - var reversedSequence = reverseFactory(this, true); - if (!this._useKeys) { - reversedSequence.valueSeq = function() {return this$0._iter.toSeq().reverse()}; + Repeat.prototype.lastIndexOf = function(searchValue) { + if (is(this._value, searchValue)) { + return this.size; } - return reversedSequence; + return -1; }; - ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this; - var mappedSequence = mapFactory(this, mapper, context); - if (!this._useKeys) { - mappedSequence.valueSeq = function() {return this$0._iter.toSeq().map(mapper, context)}; + Repeat.prototype.__iterate = function(fn, reverse) { + for (var ii = 0; ii < this.size; ii++) { + if (fn(this._value, ii, this) === false) { + return ii + 1; + } } - return mappedSequence; + return ii; }; - ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - var ii; - return this._iter.__iterate( - this._useKeys ? - function(v, k) {return fn(v, k, this$0)} : - ((ii = reverse ? resolveSize(this) : 0), - function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}), - reverse + Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this; + var ii = 0; + return new Iterator(function() + {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()} ); }; - ToKeyedSequence.prototype.__iterator = function(type, reverse) { - if (this._useKeys) { - return this._iter.__iterator(type, reverse); - } - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - var ii = reverse ? resolveSize(this) : 0; - return new src_Iterator__Iterator(function() { - var step = iterator.next(); - return step.done ? step : - iteratorValue(type, reverse ? --ii : ii++, step.value, step); - }); + Repeat.prototype.equals = function(other) { + return other instanceof Repeat ? + is(this._value, other._value) : + deepEqual(other); }; - ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true; - - createClass(ToIndexedSequence, IndexedSeq); - function ToIndexedSequence(iter) { - this._iter = iter; - this.size = iter.size; - } + var EMPTY_REPEAT; - ToIndexedSequence.prototype.includes = function(value) { - return this._iter.includes(value); - }; + function invariant(condition, error) { + if (!condition) throw new Error(error); + } - ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - var iterations = 0; - return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse); + createClass(Range, IndexedSeq); + + function Range(start, end, step) { + if (!(this instanceof Range)) { + return new Range(start, end, step); + } + invariant(step !== 0, 'Cannot step a Range by 0'); + start = start || 0; + if (end === undefined) { + end = Infinity; + } + step = step === undefined ? 1 : Math.abs(step); + if (end < start) { + step = -step; + } + this._start = start; + this._end = end; + this._step = step; + this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1); + if (this.size === 0) { + if (EMPTY_RANGE) { + return EMPTY_RANGE; + } + EMPTY_RANGE = this; + } + } + + Range.prototype.toString = function() { + if (this.size === 0) { + return 'Range []'; + } + return 'Range [ ' + + this._start + '...' + this._end + + (this._step !== 1 ? ' by ' + this._step : '') + + ' ]'; }; - ToIndexedSequence.prototype.__iterator = function(type, reverse) { - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - var iterations = 0; - return new src_Iterator__Iterator(function() { - var step = iterator.next(); - return step.done ? step : - iteratorValue(type, iterations++, step.value, step) - }); + Range.prototype.get = function(index, notSetValue) { + return this.has(index) ? + this._start + wrapIndex(this, index) * this._step : + notSetValue; }; + Range.prototype.includes = function(searchValue) { + var possibleIndex = (searchValue - this._start) / this._step; + return possibleIndex >= 0 && + possibleIndex < this.size && + possibleIndex === Math.floor(possibleIndex); + }; + Range.prototype.slice = function(begin, end) { + if (wholeSlice(begin, end, this.size)) { + return this; + } + begin = resolveBegin(begin, this.size); + end = resolveEnd(end, this.size); + if (end <= begin) { + return new Range(0, 0); + } + return new Range(this.get(begin, this._end), this.get(end, this._end), this._step); + }; - createClass(ToSetSequence, SetSeq); - function ToSetSequence(iter) { - this._iter = iter; - this.size = iter.size; - } + Range.prototype.indexOf = function(searchValue) { + var offsetValue = searchValue - this._start; + if (offsetValue % this._step === 0) { + var index = offsetValue / this._step; + if (index >= 0 && index < this.size) { + return index + } + } + return -1; + }; - ToSetSequence.prototype.has = function(key) { - return this._iter.includes(key); + Range.prototype.lastIndexOf = function(searchValue) { + return this.indexOf(searchValue); }; - ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse); + Range.prototype.__iterate = function(fn, reverse) { + var maxIndex = this.size - 1; + var step = this._step; + var value = reverse ? this._start + maxIndex * step : this._start; + for (var ii = 0; ii <= maxIndex; ii++) { + if (fn(value, ii, this) === false) { + return ii + 1; + } + value += reverse ? -step : step; + } + return ii; }; - ToSetSequence.prototype.__iterator = function(type, reverse) { - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - return new src_Iterator__Iterator(function() { - var step = iterator.next(); - return step.done ? step : - iteratorValue(type, step.value, step.value, step); + Range.prototype.__iterator = function(type, reverse) { + var maxIndex = this.size - 1; + var step = this._step; + var value = reverse ? this._start + maxIndex * step : this._start; + var ii = 0; + return new Iterator(function() { + var v = value; + value += reverse ? -step : step; + return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v); }); }; + Range.prototype.equals = function(other) { + return other instanceof Range ? + this._start === other._start && + this._end === other._end && + this._step === other._step : + deepEqual(this, other); + }; - createClass(FromEntriesSequence, KeyedSeq); - function FromEntriesSequence(entries) { - this._iter = entries; - this.size = entries.size; + var EMPTY_RANGE; + + createClass(Collection, Iterable); + function Collection() { + throw TypeError('Abstract'); } - FromEntriesSequence.prototype.entrySeq = function() { - return this._iter.toSeq(); - }; - FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._iter.__iterate(function(entry ) { - // Check if entry exists first so array access doesn't throw for holes - // in the parent iteration. - if (entry) { - validateEntry(entry); - var indexedIterable = isIterable(entry); - return fn( - indexedIterable ? entry.get(1) : entry[1], - indexedIterable ? entry.get(0) : entry[0], - this$0 - ); - } - }, reverse); - }; + createClass(KeyedCollection, Collection);function KeyedCollection() {} - FromEntriesSequence.prototype.__iterator = function(type, reverse) { - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - return new src_Iterator__Iterator(function() { - while (true) { - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - // Check if entry exists first so array access doesn't throw for holes - // in the parent iteration. - if (entry) { - validateEntry(entry); - var indexedIterable = isIterable(entry); - return iteratorValue( - type, - indexedIterable ? entry.get(0) : entry[0], - indexedIterable ? entry.get(1) : entry[1], - step - ); - } - } - }); - }; + createClass(IndexedCollection, Collection);function IndexedCollection() {} + createClass(SetCollection, Collection);function SetCollection() {} - ToIndexedSequence.prototype.cacheResult = - ToKeyedSequence.prototype.cacheResult = - ToSetSequence.prototype.cacheResult = - FromEntriesSequence.prototype.cacheResult = - cacheResultThrough; + Collection.Keyed = KeyedCollection; + Collection.Indexed = IndexedCollection; + Collection.Set = SetCollection; - function flipFactory(iterable) { - var flipSequence = makeSequence(iterable); - flipSequence._iter = iterable; - flipSequence.size = iterable.size; - flipSequence.flip = function() {return iterable}; - flipSequence.reverse = function () { - var reversedSequence = iterable.reverse.apply(this); // super.reverse() - reversedSequence.flip = function() {return iterable.reverse()}; - return reversedSequence; + var imul = + typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ? + Math.imul : + function imul(a, b) { + a = a | 0; // int + b = b | 0; // int + var c = a & 0xffff; + var d = b & 0xffff; + // Shift by 0 fixes the sign on the high part. + return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int }; - flipSequence.has = function(key ) {return iterable.includes(key)}; - flipSequence.includes = function(key ) {return iterable.has(key)}; - flipSequence.cacheResult = cacheResultThrough; - flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - return iterable.__iterate(function(v, k) {return fn(k, v, this$0) !== false}, reverse); - } - flipSequence.__iteratorUncached = function(type, reverse) { - if (type === ITERATE_ENTRIES) { - var iterator = iterable.__iterator(type, reverse); - return new src_Iterator__Iterator(function() { - var step = iterator.next(); - if (!step.done) { - var k = step.value[0]; - step.value[0] = step.value[1]; - step.value[1] = k; - } - return step; - }); - } - return iterable.__iterator( - type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES, - reverse - ); - } - return flipSequence; - } + // v8 has an optimization for storing 31-bit signed numbers. + // Values which have either 00 or 11 as the high order bits qualify. + // This function drops the highest order bit in a signed number, maintaining + // the sign bit. + function smi(i32) { + return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF); + } - function mapFactory(iterable, mapper, context) { - var mappedSequence = makeSequence(iterable); - mappedSequence.size = iterable.size; - mappedSequence.has = function(key ) {return iterable.has(key)}; - mappedSequence.get = function(key, notSetValue) { - var v = iterable.get(key, NOT_SET); - return v === NOT_SET ? - notSetValue : - mapper.call(context, v, key, iterable); - }; - mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - return iterable.__iterate( - function(v, k, c) {return fn(mapper.call(context, v, k, c), k, this$0) !== false}, - reverse - ); + function hash(o) { + if (o === false || o === null || o === undefined) { + return 0; } - mappedSequence.__iteratorUncached = function (type, reverse) { - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - return new src_Iterator__Iterator(function() { - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - var key = entry[0]; - return iteratorValue( - type, - key, - mapper.call(context, entry[1], key, iterable), - step - ); - }); + if (typeof o.valueOf === 'function') { + o = o.valueOf(); + if (o === false || o === null || o === undefined) { + return 0; + } } - return mappedSequence; - } - - - function reverseFactory(iterable, useKeys) { - var reversedSequence = makeSequence(iterable); - reversedSequence._iter = iterable; - reversedSequence.size = iterable.size; - reversedSequence.reverse = function() {return iterable}; - if (iterable.flip) { - reversedSequence.flip = function () { - var flipSequence = flipFactory(iterable); - flipSequence.reverse = function() {return iterable.flip()}; - return flipSequence; - }; + if (o === true) { + return 1; } - reversedSequence.get = function(key, notSetValue) - {return iterable.get(useKeys ? key : -1 - key, notSetValue)}; - reversedSequence.has = function(key ) - {return iterable.has(useKeys ? key : -1 - key)}; - reversedSequence.includes = function(value ) {return iterable.includes(value)}; - reversedSequence.cacheResult = cacheResultThrough; - reversedSequence.__iterate = function (fn, reverse) {var this$0 = this; - return iterable.__iterate(function(v, k) {return fn(v, k, this$0)}, !reverse); - }; - reversedSequence.__iterator = - function(type, reverse) {return iterable.__iterator(type, !reverse)}; - return reversedSequence; - } - - - function filterFactory(iterable, predicate, context, useKeys) { - var filterSequence = makeSequence(iterable); - if (useKeys) { - filterSequence.has = function(key ) { - var v = iterable.get(key, NOT_SET); - return v !== NOT_SET && !!predicate.call(context, v, key, iterable); - }; - filterSequence.get = function(key, notSetValue) { - var v = iterable.get(key, NOT_SET); - return v !== NOT_SET && predicate.call(context, v, key, iterable) ? - v : notSetValue; - }; + var type = typeof o; + if (type === 'number') { + if (o !== o || o === Infinity) { + return 0; + } + var h = o | 0; + if (h !== o) { + h ^= o * 0xFFFFFFFF; + } + while (o > 0xFFFFFFFF) { + o /= 0xFFFFFFFF; + h ^= o; + } + return smi(h); } - filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - var iterations = 0; - iterable.__iterate(function(v, k, c) { - if (predicate.call(context, v, k, c)) { - iterations++; - return fn(v, useKeys ? k : iterations - 1, this$0); - } - }, reverse); - return iterations; - }; - filterSequence.__iteratorUncached = function (type, reverse) { - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - var iterations = 0; - return new src_Iterator__Iterator(function() { - while (true) { - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - var key = entry[0]; - var value = entry[1]; - if (predicate.call(context, value, key, iterable)) { - return iteratorValue(type, useKeys ? key : iterations++, value, step); - } - } - }); + if (type === 'string') { + return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o); } - return filterSequence; + if (typeof o.hashCode === 'function') { + return o.hashCode(); + } + if (type === 'object') { + return hashJSObj(o); + } + if (typeof o.toString === 'function') { + return hashString(o.toString()); + } + throw new Error('Value type ' + type + ' cannot be hashed.'); } - - function countByFactory(iterable, grouper, context) { - var groups = src_Map__Map().asMutable(); - iterable.__iterate(function(v, k) { - groups.update( - grouper.call(context, v, k, iterable), - 0, - function(a ) {return a + 1} - ); - }); - return groups.asImmutable(); + function cachedHashString(string) { + var hash = stringHashCache[string]; + if (hash === undefined) { + hash = hashString(string); + if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) { + STRING_HASH_CACHE_SIZE = 0; + stringHashCache = {}; + } + STRING_HASH_CACHE_SIZE++; + stringHashCache[string] = hash; + } + return hash; } - - function groupByFactory(iterable, grouper, context) { - var isKeyedIter = isKeyed(iterable); - var groups = (isOrdered(iterable) ? OrderedMap() : src_Map__Map()).asMutable(); - iterable.__iterate(function(v, k) { - groups.update( - grouper.call(context, v, k, iterable), - function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)} - ); - }); - var coerce = iterableClass(iterable); - return groups.map(function(arr ) {return reify(iterable, coerce(arr))}); + // http://jsperf.com/hashing-strings + function hashString(string) { + // This is the hash from JVM + // The hash code for a string is computed as + // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1], + // where s[i] is the ith character of the string and n is the length of + // the string. We "mod" the result to make it between 0 (inclusive) and 2^31 + // (exclusive) by dropping high bits. + var hash = 0; + for (var ii = 0; ii < string.length; ii++) { + hash = 31 * hash + string.charCodeAt(ii) | 0; + } + return smi(hash); } - - function sliceFactory(iterable, begin, end, useKeys) { - var originalSize = iterable.size; - - // Sanitize begin & end using this shorthand for ToInt32(argument) - // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 - if (begin !== undefined) { - begin = begin | 0; - } - if (end !== undefined) { - end = end | 0; + function hashJSObj(obj) { + var hash; + if (usingWeakMap) { + hash = weakMap.get(obj); + if (hash !== undefined) { + return hash; + } } - if (wholeSlice(begin, end, originalSize)) { - return iterable; + hash = obj[UID_HASH_KEY]; + if (hash !== undefined) { + return hash; } - var resolvedBegin = resolveBegin(begin, originalSize); - var resolvedEnd = resolveEnd(end, originalSize); + if (!canDefineProperty) { + hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY]; + if (hash !== undefined) { + return hash; + } - // begin or end will be NaN if they were provided as negative numbers and - // this iterable's size is unknown. In that case, cache first so there is - // a known size and these do not resolve to NaN. - if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) { - return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys); + hash = getIENodeHash(obj); + if (hash !== undefined) { + return hash; + } } - // Note: resolvedEnd is undefined when the original sequence's length is - // unknown and this slice did not supply an end and should contain all - // elements after resolvedBegin. - // In that case, resolvedSize will be NaN and sliceSize will remain undefined. - var resolvedSize = resolvedEnd - resolvedBegin; - var sliceSize; - if (resolvedSize === resolvedSize) { - sliceSize = resolvedSize < 0 ? 0 : resolvedSize; + hash = ++objHashUID; + if (objHashUID & 0x40000000) { + objHashUID = 0; } - var sliceSeq = makeSequence(iterable); + if (usingWeakMap) { + weakMap.set(obj, hash); + } else if (isExtensible !== undefined && isExtensible(obj) === false) { + throw new Error('Non-extensible objects are not allowed as keys.'); + } else if (canDefineProperty) { + Object.defineProperty(obj, UID_HASH_KEY, { + 'enumerable': false, + 'configurable': false, + 'writable': false, + 'value': hash + }); + } else if (obj.propertyIsEnumerable !== undefined && + obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) { + // Since we can't define a non-enumerable property on the object + // we'll hijack one of the less-used non-enumerable properties to + // save our hash on it. Since this is a function it will not show up in + // `JSON.stringify` which is what we want. + obj.propertyIsEnumerable = function() { + return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments); + }; + obj.propertyIsEnumerable[UID_HASH_KEY] = hash; + } else if (obj.nodeType !== undefined) { + // At this point we couldn't get the IE `uniqueID` to use as a hash + // and we couldn't use a non-enumerable property to exploit the + // dontEnum bug so we simply add the `UID_HASH_KEY` on the node + // itself. + obj[UID_HASH_KEY] = hash; + } else { + throw new Error('Unable to set a non-enumerable property on object.'); + } - // If iterable.size is undefined, the size of the realized sliceSeq is - // unknown at this point unless the number of items to slice is 0 - sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined; + return hash; + } - if (!useKeys && isSeq(iterable) && sliceSize >= 0) { - sliceSeq.get = function (index, notSetValue) { - index = wrapIndex(this, index); - return index >= 0 && index < sliceSize ? - iterable.get(index + resolvedBegin, notSetValue) : - notSetValue; - } - } + // Get references to ES5 object methods. + var isExtensible = Object.isExtensible; - sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this; - if (sliceSize === 0) { - return 0; - } - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var skipped = 0; - var isSkipping = true; - var iterations = 0; - iterable.__iterate(function(v, k) { - if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) { - iterations++; - return fn(v, useKeys ? k : iterations - 1, this$0) !== false && - iterations !== sliceSize; - } - }); - return iterations; - }; + // True if Object.defineProperty works as expected. IE8 fails this test. + var canDefineProperty = (function() { + try { + Object.defineProperty({}, '@', {}); + return true; + } catch (e) { + return false; + } + }()); - sliceSeq.__iteratorUncached = function(type, reverse) { - if (sliceSize !== 0 && reverse) { - return this.cacheResult().__iterator(type, reverse); + // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it + // and avoid memory leaks from the IE cloneNode bug. + function getIENodeHash(node) { + if (node && node.nodeType > 0) { + switch (node.nodeType) { + case 1: // Element + return node.uniqueID; + case 9: // Document + return node.documentElement && node.documentElement.uniqueID; } - // Don't bother instantiating parent iterator if taking 0. - var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse); - var skipped = 0; - var iterations = 0; - return new src_Iterator__Iterator(function() { - while (skipped++ < resolvedBegin) { - iterator.next(); - } - if (++iterations > sliceSize) { - return iteratorDone(); - } - var step = iterator.next(); - if (useKeys || type === ITERATE_VALUES) { - return step; - } else if (type === ITERATE_KEYS) { - return iteratorValue(type, iterations - 1, undefined, step); - } else { - return iteratorValue(type, iterations - 1, step.value[1], step); - } - }); } + } - return sliceSeq; + // If possible, use a WeakMap. + var usingWeakMap = typeof WeakMap === 'function'; + var weakMap; + if (usingWeakMap) { + weakMap = new WeakMap(); } + var objHashUID = 0; - function takeWhileFactory(iterable, predicate, context) { - var takeSequence = makeSequence(iterable); - takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this; - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var iterations = 0; - iterable.__iterate(function(v, k, c) - {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)} - ); - return iterations; - }; - takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this; - if (reverse) { - return this.cacheResult().__iterator(type, reverse); - } - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - var iterating = true; - return new src_Iterator__Iterator(function() { - if (!iterating) { - return iteratorDone(); - } - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - var k = entry[0]; - var v = entry[1]; - if (!predicate.call(context, v, k, this$0)) { - iterating = false; - return iteratorDone(); - } - return type === ITERATE_ENTRIES ? step : - iteratorValue(type, k, v, step); - }); - }; - return takeSequence; + var UID_HASH_KEY = '__immutablehash__'; + if (typeof Symbol === 'function') { + UID_HASH_KEY = Symbol(UID_HASH_KEY); } + var STRING_HASH_CACHE_MIN_STRLEN = 16; + var STRING_HASH_CACHE_MAX_SIZE = 255; + var STRING_HASH_CACHE_SIZE = 0; + var stringHashCache = {}; - function skipWhileFactory(iterable, predicate, context, useKeys) { - var skipSequence = makeSequence(iterable); - skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var isSkipping = true; - var iterations = 0; - iterable.__iterate(function(v, k, c) { - if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) { - iterations++; - return fn(v, useKeys ? k : iterations - 1, this$0); - } - }); - return iterations; - }; - skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this; - if (reverse) { - return this.cacheResult().__iterator(type, reverse); - } - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - var skipping = true; - var iterations = 0; - return new src_Iterator__Iterator(function() { - var step, k, v; - do { - step = iterator.next(); - if (step.done) { - if (useKeys || type === ITERATE_VALUES) { - return step; - } else if (type === ITERATE_KEYS) { - return iteratorValue(type, iterations++, undefined, step); - } else { - return iteratorValue(type, iterations++, step.value[1], step); - } - } - var entry = step.value; - k = entry[0]; - v = entry[1]; - skipping && (skipping = predicate.call(context, v, k, this$0)); - } while (skipping); - return type === ITERATE_ENTRIES ? step : - iteratorValue(type, k, v, step); - }); - }; - return skipSequence; + function assertNotInfinite(size) { + invariant( + size !== Infinity, + 'Cannot perform this action with an infinite size.' + ); } + createClass(Map, KeyedCollection); - function concatFactory(iterable, values) { - var isKeyedIterable = isKeyed(iterable); - var iters = [iterable].concat(values).map(function(v ) { - if (!isIterable(v)) { - v = isKeyedIterable ? - keyedSeqFromValue(v) : - indexedSeqFromValue(Array.isArray(v) ? v : [v]); - } else if (isKeyedIterable) { - v = KeyedIterable(v); - } - return v; - }).filter(function(v ) {return v.size !== 0}); - - if (iters.length === 0) { - return iterable; - } + // @pragma Construction - if (iters.length === 1) { - var singleton = iters[0]; - if (singleton === iterable || - isKeyedIterable && isKeyed(singleton) || - isIndexed(iterable) && isIndexed(singleton)) { - return singleton; - } + function Map(value) { + return value === null || value === undefined ? emptyMap() : + isMap(value) && !isOrdered(value) ? value : + emptyMap().withMutations(function(map ) { + var iter = KeyedIterable(value); + assertNotInfinite(iter.size); + iter.forEach(function(v, k) {return map.set(k, v)}); + }); } - var concatSeq = new ArraySeq(iters); - if (isKeyedIterable) { - concatSeq = concatSeq.toKeyedSeq(); - } else if (!isIndexed(iterable)) { - concatSeq = concatSeq.toSetSeq(); - } - concatSeq = concatSeq.flatten(true); - concatSeq.size = iters.reduce( - function(sum, seq) { - if (sum !== undefined) { - var size = seq.size; - if (size !== undefined) { - return sum + size; + Map.of = function() {var keyValues = SLICE$0.call(arguments, 0); + return emptyMap().withMutations(function(map ) { + for (var i = 0; i < keyValues.length; i += 2) { + if (i + 1 >= keyValues.length) { + throw new Error('Missing value for key: ' + keyValues[i]); } + map.set(keyValues[i], keyValues[i + 1]); } - }, - 0 - ); - return concatSeq; - } + }); + }; + Map.prototype.toString = function() { + return this.__toString('Map {', '}'); + }; - function flattenFactory(iterable, depth, useKeys) { - var flatSequence = makeSequence(iterable); - flatSequence.__iterateUncached = function(fn, reverse) { - var iterations = 0; - var stopped = false; - function flatDeep(iter, currentDepth) {var this$0 = this; - iter.__iterate(function(v, k) { - if ((!depth || currentDepth < depth) && isIterable(v)) { - flatDeep(v, currentDepth + 1); - } else if (fn(v, useKeys ? k : iterations++, this$0) === false) { - stopped = true; - } - return !stopped; - }, reverse); - } - flatDeep(iterable, 0); - return iterations; - } - flatSequence.__iteratorUncached = function(type, reverse) { - var iterator = iterable.__iterator(type, reverse); - var stack = []; - var iterations = 0; - return new src_Iterator__Iterator(function() { - while (iterator) { - var step = iterator.next(); - if (step.done !== false) { - iterator = stack.pop(); - continue; - } - var v = step.value; - if (type === ITERATE_ENTRIES) { - v = v[1]; - } - if ((!depth || stack.length < depth) && isIterable(v)) { - stack.push(iterator); - iterator = v.__iterator(type, reverse); - } else { - return useKeys ? step : iteratorValue(type, iterations++, v, step); - } - } - return iteratorDone(); - }); - } - return flatSequence; - } + // @pragma Access - - function flatMapFactory(iterable, mapper, context) { - var coerce = iterableClass(iterable); - return iterable.toSeq().map( - function(v, k) {return coerce(mapper.call(context, v, k, iterable))} - ).flatten(true); - } - - - function interposeFactory(iterable, separator) { - var interposedSequence = makeSequence(iterable); - interposedSequence.size = iterable.size && iterable.size * 2 -1; - interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this; - var iterations = 0; - iterable.__iterate(function(v, k) - {return (!iterations || fn(separator, iterations++, this$0) !== false) && - fn(v, iterations++, this$0) !== false}, - reverse - ); - return iterations; - }; - interposedSequence.__iteratorUncached = function(type, reverse) { - var iterator = iterable.__iterator(ITERATE_VALUES, reverse); - var iterations = 0; - var step; - return new src_Iterator__Iterator(function() { - if (!step || iterations % 2) { - step = iterator.next(); - if (step.done) { - return step; - } - } - return iterations % 2 ? - iteratorValue(type, iterations++, separator) : - iteratorValue(type, iterations++, step.value, step); - }); - }; - return interposedSequence; - } - - - function sortFactory(iterable, comparator, mapper) { - if (!comparator) { - comparator = defaultComparator; - } - var isKeyedIterable = isKeyed(iterable); - var index = 0; - var entries = iterable.toSeq().map( - function(v, k) {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]} - ).toArray(); - entries.sort(function(a, b) {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach( - isKeyedIterable ? - function(v, i) { entries[i].length = 2; } : - function(v, i) { entries[i] = v[1]; } - ); - return isKeyedIterable ? KeyedSeq(entries) : - isIndexed(iterable) ? IndexedSeq(entries) : - SetSeq(entries); - } - - - function maxFactory(iterable, comparator, mapper) { - if (!comparator) { - comparator = defaultComparator; - } - if (mapper) { - var entry = iterable.toSeq() - .map(function(v, k) {return [v, mapper(v, k, iterable)]}) - .reduce(function(a, b) {return maxCompare(comparator, a[1], b[1]) ? b : a}); - return entry && entry[0]; - } else { - return iterable.reduce(function(a, b) {return maxCompare(comparator, a, b) ? b : a}); - } - } - - function maxCompare(comparator, a, b) { - var comp = comparator(b, a); - // b is considered the new max if the comparator declares them equal, but - // they are not equal and b is in fact a nullish value. - return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0; - } - - - function zipWithFactory(keyIter, zipper, iters) { - var zipSequence = makeSequence(keyIter); - zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min(); - // Note: this a generic base implementation of __iterate in terms of - // __iterator which may be more generically useful in the future. - zipSequence.__iterate = function(fn, reverse) { - /* generic: - var iterator = this.__iterator(ITERATE_ENTRIES, reverse); - var step; - var iterations = 0; - while (!(step = iterator.next()).done) { - iterations++; - if (fn(step.value[1], step.value[0], this) === false) { - break; - } - } - return iterations; - */ - // indexed: - var iterator = this.__iterator(ITERATE_VALUES, reverse); - var step; - var iterations = 0; - while (!(step = iterator.next()).done) { - if (fn(step.value, iterations++, this) === false) { - break; - } - } - return iterations; - }; - zipSequence.__iteratorUncached = function(type, reverse) { - var iterators = iters.map(function(i ) - {return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))} - ); - var iterations = 0; - var isDone = false; - return new src_Iterator__Iterator(function() { - var steps; - if (!isDone) { - steps = iterators.map(function(i ) {return i.next()}); - isDone = steps.some(function(s ) {return s.done}); - } - if (isDone) { - return iteratorDone(); - } - return iteratorValue( - type, - iterations++, - zipper.apply(null, steps.map(function(s ) {return s.value})) - ); - }); - }; - return zipSequence - } - - - // #pragma Helper Functions - - function reify(iter, seq) { - return isSeq(iter) ? seq : iter.constructor(seq); - } - - function validateEntry(entry) { - if (entry !== Object(entry)) { - throw new TypeError('Expected [K, V] tuple: ' + entry); - } - } - - function resolveSize(iter) { - assertNotInfinite(iter.size); - return ensureSize(iter); - } - - function iterableClass(iterable) { - return isKeyed(iterable) ? KeyedIterable : - isIndexed(iterable) ? IndexedIterable : - SetIterable; - } - - function makeSequence(iterable) { - return Object.create( - ( - isKeyed(iterable) ? KeyedSeq : - isIndexed(iterable) ? IndexedSeq : - SetSeq - ).prototype - ); - } - - function cacheResultThrough() { - if (this._iter.cacheResult) { - this._iter.cacheResult(); - this.size = this._iter.size; - return this; - } else { - return Seq.prototype.cacheResult.call(this); - } - } - - function defaultComparator(a, b) { - return a > b ? 1 : a < b ? -1 : 0; - } - - function forceIterator(keyPath) { - var iter = getIterator(keyPath); - if (!iter) { - // Array might not be iterable in this environment, so we need a fallback - // to our wrapped type. - if (!isArrayLike(keyPath)) { - throw new TypeError('Expected iterable or array-like: ' + keyPath); - } - iter = getIterator(Iterable(keyPath)); - } - return iter; - } - - createClass(src_Map__Map, KeyedCollection); - - // @pragma Construction - - function src_Map__Map(value) { - return value === null || value === undefined ? emptyMap() : - isMap(value) && !isOrdered(value) ? value : - emptyMap().withMutations(function(map ) { - var iter = KeyedIterable(value); - assertNotInfinite(iter.size); - iter.forEach(function(v, k) {return map.set(k, v)}); - }); - } - - src_Map__Map.prototype.toString = function() { - return this.__toString('Map {', '}'); - }; - - // @pragma Access - - src_Map__Map.prototype.get = function(k, notSetValue) { - return this._root ? - this._root.get(0, undefined, k, notSetValue) : - notSetValue; - }; + Map.prototype.get = function(k, notSetValue) { + return this._root ? + this._root.get(0, undefined, k, notSetValue) : + notSetValue; + }; // @pragma Modification - src_Map__Map.prototype.set = function(k, v) { + Map.prototype.set = function(k, v) { return updateMap(this, k, v); }; - src_Map__Map.prototype.setIn = function(keyPath, v) { + Map.prototype.setIn = function(keyPath, v) { return this.updateIn(keyPath, NOT_SET, function() {return v}); }; - src_Map__Map.prototype.remove = function(k) { + Map.prototype.remove = function(k) { return updateMap(this, k, NOT_SET); }; - src_Map__Map.prototype.deleteIn = function(keyPath) { + Map.prototype.deleteIn = function(keyPath) { return this.updateIn(keyPath, function() {return NOT_SET}); }; - src_Map__Map.prototype.update = function(k, notSetValue, updater) { + Map.prototype.update = function(k, notSetValue, updater) { return arguments.length === 1 ? k(this) : this.updateIn([k], notSetValue, updater); }; - src_Map__Map.prototype.updateIn = function(keyPath, notSetValue, updater) { + Map.prototype.updateIn = function(keyPath, notSetValue, updater) { if (!updater) { updater = notSetValue; notSetValue = undefined; @@ -2106,7 +1552,7 @@ return /******/ (function(modules) { // webpackBootstrap return updatedValue === NOT_SET ? undefined : updatedValue; }; - src_Map__Map.prototype.clear = function() { + Map.prototype.clear = function() { if (this.size === 0) { return this; } @@ -2122,15 +1568,15 @@ return /******/ (function(modules) { // webpackBootstrap // @pragma Composition - src_Map__Map.prototype.merge = function(/*...iters*/) { + Map.prototype.merge = function(/*...iters*/) { return mergeIntoMapWith(this, undefined, arguments); }; - src_Map__Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); + Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); return mergeIntoMapWith(this, merger, iters); }; - src_Map__Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1); + Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1); return this.updateIn( keyPath, emptyMap(), @@ -2140,15 +1586,15 @@ return /******/ (function(modules) { // webpackBootstrap ); }; - src_Map__Map.prototype.mergeDeep = function(/*...iters*/) { - return mergeIntoMapWith(this, deepMerger(undefined), arguments); + Map.prototype.mergeDeep = function(/*...iters*/) { + return mergeIntoMapWith(this, deepMerger, arguments); }; - src_Map__Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return mergeIntoMapWith(this, deepMerger(merger), iters); + Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1); + return mergeIntoMapWith(this, deepMergerWith(merger), iters); }; - src_Map__Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1); + Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1); return this.updateIn( keyPath, emptyMap(), @@ -2158,41 +1604,41 @@ return /******/ (function(modules) { // webpackBootstrap ); }; - src_Map__Map.prototype.sort = function(comparator) { + Map.prototype.sort = function(comparator) { // Late binding return OrderedMap(sortFactory(this, comparator)); }; - src_Map__Map.prototype.sortBy = function(mapper, comparator) { + Map.prototype.sortBy = function(mapper, comparator) { // Late binding return OrderedMap(sortFactory(this, comparator, mapper)); }; // @pragma Mutability - src_Map__Map.prototype.withMutations = function(fn) { + Map.prototype.withMutations = function(fn) { var mutable = this.asMutable(); fn(mutable); return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this; }; - src_Map__Map.prototype.asMutable = function() { + Map.prototype.asMutable = function() { return this.__ownerID ? this : this.__ensureOwner(new OwnerID()); }; - src_Map__Map.prototype.asImmutable = function() { + Map.prototype.asImmutable = function() { return this.__ensureOwner(); }; - src_Map__Map.prototype.wasAltered = function() { + Map.prototype.wasAltered = function() { return this.__altered; }; - src_Map__Map.prototype.__iterator = function(type, reverse) { + Map.prototype.__iterator = function(type, reverse) { return new MapIterator(this, type, reverse); }; - src_Map__Map.prototype.__iterate = function(fn, reverse) {var this$0 = this; + Map.prototype.__iterate = function(fn, reverse) {var this$0 = this; var iterations = 0; this._root && this._root.iterate(function(entry ) { iterations++; @@ -2201,7 +1647,7 @@ return /******/ (function(modules) { // webpackBootstrap return iterations; }; - src_Map__Map.prototype.__ensureOwner = function(ownerID) { + Map.prototype.__ensureOwner = function(ownerID) { if (ownerID === this.__ownerID) { return this; } @@ -2218,11 +1664,11 @@ return /******/ (function(modules) { // webpackBootstrap return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]); } - src_Map__Map.isMap = isMap; + Map.isMap = isMap; var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@'; - var MapPrototype = src_Map__Map.prototype; + var MapPrototype = Map.prototype; MapPrototype[IS_MAP_SENTINEL] = true; MapPrototype[DELETE] = MapPrototype.remove; MapPrototype.removeIn = MapPrototype.deleteIn; @@ -2566,7 +2012,7 @@ return /******/ (function(modules) { // webpackBootstrap return fn(this.entry); } - createClass(MapIterator, src_Iterator__Iterator); + createClass(MapIterator, Iterator); function MapIterator(map, type, reverse) { this._type = type; @@ -2745,11 +2191,20 @@ return /******/ (function(modules) { // webpackBootstrap return mergeIntoCollectionWith(map, merger, iters); } - function deepMerger(merger) { - return function(existing, value, key) - {return existing && existing.mergeDeepWith && isIterable(value) ? - existing.mergeDeepWith(merger, value) : - merger ? merger(existing, value, key) : value}; + function deepMerger(existing, value, key) { + return existing && existing.mergeDeep && isIterable(value) ? + existing.mergeDeep(value) : + is(existing, value) ? existing : value; + } + + function deepMergerWith(merger) { + return function(existing, value, key) { + if (existing && existing.mergeDeepWith && isIterable(value)) { + return existing.mergeDeepWith(merger, value); + } + var nextValue = merger(existing, value, key); + return is(existing, nextValue) ? existing : nextValue; + }; } function mergeIntoCollectionWith(collection, merger, iters) { @@ -2916,6 +2371,10 @@ return /******/ (function(modules) { // webpackBootstrap this.splice(index, 1); }; + List.prototype.insert = function(index, value) { + return this.splice(index, 0, value); + }; + List.prototype.clear = function() { if (this.size === 0) { return this; @@ -2971,11 +2430,11 @@ return /******/ (function(modules) { // webpackBootstrap }; List.prototype.mergeDeep = function(/*...iters*/) { - return mergeIntoListWith(this, deepMerger(undefined), arguments); + return mergeIntoListWith(this, deepMerger, arguments); }; List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return mergeIntoListWith(this, deepMerger(merger), iters); + return mergeIntoListWith(this, deepMergerWith(merger), iters); }; List.prototype.setSize = function(size) { @@ -2999,7 +2458,7 @@ return /******/ (function(modules) { // webpackBootstrap List.prototype.__iterator = function(type, reverse) { var index = 0; var values = iterateList(this, reverse); - return new src_Iterator__Iterator(function() { + return new Iterator(function() { var value = values(); return value === DONE ? iteratorDone() : @@ -3440,386 +2899,1166 @@ return /******/ (function(modules) { // webpackBootstrap if (maxSize > list.size) { list = list.setSize(maxSize); } - return mergeIntoCollectionWith(list, merger, iters); - } - - function getTailOffset(size) { - return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT); + return mergeIntoCollectionWith(list, merger, iters); + } + + function getTailOffset(size) { + return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT); + } + + createClass(OrderedMap, Map); + + // @pragma Construction + + function OrderedMap(value) { + return value === null || value === undefined ? emptyOrderedMap() : + isOrderedMap(value) ? value : + emptyOrderedMap().withMutations(function(map ) { + var iter = KeyedIterable(value); + assertNotInfinite(iter.size); + iter.forEach(function(v, k) {return map.set(k, v)}); + }); + } + + OrderedMap.of = function(/*...values*/) { + return this(arguments); + }; + + OrderedMap.prototype.toString = function() { + return this.__toString('OrderedMap {', '}'); + }; + + // @pragma Access + + OrderedMap.prototype.get = function(k, notSetValue) { + var index = this._map.get(k); + return index !== undefined ? this._list.get(index)[1] : notSetValue; + }; + + // @pragma Modification + + OrderedMap.prototype.clear = function() { + if (this.size === 0) { + return this; + } + if (this.__ownerID) { + this.size = 0; + this._map.clear(); + this._list.clear(); + return this; + } + return emptyOrderedMap(); + }; + + OrderedMap.prototype.set = function(k, v) { + return updateOrderedMap(this, k, v); + }; + + OrderedMap.prototype.remove = function(k) { + return updateOrderedMap(this, k, NOT_SET); + }; + + OrderedMap.prototype.wasAltered = function() { + return this._map.wasAltered() || this._list.wasAltered(); + }; + + OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this; + return this._list.__iterate( + function(entry ) {return entry && fn(entry[1], entry[0], this$0)}, + reverse + ); + }; + + OrderedMap.prototype.__iterator = function(type, reverse) { + return this._list.fromEntrySeq().__iterator(type, reverse); + }; + + OrderedMap.prototype.__ensureOwner = function(ownerID) { + if (ownerID === this.__ownerID) { + return this; + } + var newMap = this._map.__ensureOwner(ownerID); + var newList = this._list.__ensureOwner(ownerID); + if (!ownerID) { + this.__ownerID = ownerID; + this._map = newMap; + this._list = newList; + return this; + } + return makeOrderedMap(newMap, newList, ownerID, this.__hash); + }; + + + function isOrderedMap(maybeOrderedMap) { + return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap); + } + + OrderedMap.isOrderedMap = isOrderedMap; + + OrderedMap.prototype[IS_ORDERED_SENTINEL] = true; + OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove; + + + + function makeOrderedMap(map, list, ownerID, hash) { + var omap = Object.create(OrderedMap.prototype); + omap.size = map ? map.size : 0; + omap._map = map; + omap._list = list; + omap.__ownerID = ownerID; + omap.__hash = hash; + return omap; + } + + var EMPTY_ORDERED_MAP; + function emptyOrderedMap() { + return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList())); + } + + function updateOrderedMap(omap, k, v) { + var map = omap._map; + var list = omap._list; + var i = map.get(k); + var has = i !== undefined; + var newMap; + var newList; + if (v === NOT_SET) { // removed + if (!has) { + return omap; + } + if (list.size >= SIZE && list.size >= map.size * 2) { + newList = list.filter(function(entry, idx) {return entry !== undefined && i !== idx}); + newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap(); + if (omap.__ownerID) { + newMap.__ownerID = newList.__ownerID = omap.__ownerID; + } + } else { + newMap = map.remove(k); + newList = i === list.size - 1 ? list.pop() : list.set(i, undefined); + } + } else { + if (has) { + if (v === list.get(i)[1]) { + return omap; + } + newMap = map; + newList = list.set(i, [k, v]); + } else { + newMap = map.set(k, list.size); + newList = list.set(list.size, [k, v]); + } + } + if (omap.__ownerID) { + omap.size = newMap.size; + omap._map = newMap; + omap._list = newList; + omap.__hash = undefined; + return omap; + } + return makeOrderedMap(newMap, newList); + } + + createClass(ToKeyedSequence, KeyedSeq); + function ToKeyedSequence(indexed, useKeys) { + this._iter = indexed; + this._useKeys = useKeys; + this.size = indexed.size; + } + + ToKeyedSequence.prototype.get = function(key, notSetValue) { + return this._iter.get(key, notSetValue); + }; + + ToKeyedSequence.prototype.has = function(key) { + return this._iter.has(key); + }; + + ToKeyedSequence.prototype.valueSeq = function() { + return this._iter.valueSeq(); + }; + + ToKeyedSequence.prototype.reverse = function() {var this$0 = this; + var reversedSequence = reverseFactory(this, true); + if (!this._useKeys) { + reversedSequence.valueSeq = function() {return this$0._iter.toSeq().reverse()}; + } + return reversedSequence; + }; + + ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this; + var mappedSequence = mapFactory(this, mapper, context); + if (!this._useKeys) { + mappedSequence.valueSeq = function() {return this$0._iter.toSeq().map(mapper, context)}; + } + return mappedSequence; + }; + + ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; + var ii; + return this._iter.__iterate( + this._useKeys ? + function(v, k) {return fn(v, k, this$0)} : + ((ii = reverse ? resolveSize(this) : 0), + function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}), + reverse + ); + }; + + ToKeyedSequence.prototype.__iterator = function(type, reverse) { + if (this._useKeys) { + return this._iter.__iterator(type, reverse); + } + var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); + var ii = reverse ? resolveSize(this) : 0; + return new Iterator(function() { + var step = iterator.next(); + return step.done ? step : + iteratorValue(type, reverse ? --ii : ii++, step.value, step); + }); + }; + + ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true; + + + createClass(ToIndexedSequence, IndexedSeq); + function ToIndexedSequence(iter) { + this._iter = iter; + this.size = iter.size; + } + + ToIndexedSequence.prototype.includes = function(value) { + return this._iter.includes(value); + }; + + ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; + var iterations = 0; + return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse); + }; + + ToIndexedSequence.prototype.__iterator = function(type, reverse) { + var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); + var iterations = 0; + return new Iterator(function() { + var step = iterator.next(); + return step.done ? step : + iteratorValue(type, iterations++, step.value, step) + }); + }; + + + + createClass(ToSetSequence, SetSeq); + function ToSetSequence(iter) { + this._iter = iter; + this.size = iter.size; + } + + ToSetSequence.prototype.has = function(key) { + return this._iter.includes(key); + }; + + ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; + return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse); + }; + + ToSetSequence.prototype.__iterator = function(type, reverse) { + var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); + return new Iterator(function() { + var step = iterator.next(); + return step.done ? step : + iteratorValue(type, step.value, step.value, step); + }); + }; + + + + createClass(FromEntriesSequence, KeyedSeq); + function FromEntriesSequence(entries) { + this._iter = entries; + this.size = entries.size; + } + + FromEntriesSequence.prototype.entrySeq = function() { + return this._iter.toSeq(); + }; + + FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; + return this._iter.__iterate(function(entry ) { + // Check if entry exists first so array access doesn't throw for holes + // in the parent iteration. + if (entry) { + validateEntry(entry); + var indexedIterable = isIterable(entry); + return fn( + indexedIterable ? entry.get(1) : entry[1], + indexedIterable ? entry.get(0) : entry[0], + this$0 + ); + } + }, reverse); + }; + + FromEntriesSequence.prototype.__iterator = function(type, reverse) { + var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); + return new Iterator(function() { + while (true) { + var step = iterator.next(); + if (step.done) { + return step; + } + var entry = step.value; + // Check if entry exists first so array access doesn't throw for holes + // in the parent iteration. + if (entry) { + validateEntry(entry); + var indexedIterable = isIterable(entry); + return iteratorValue( + type, + indexedIterable ? entry.get(0) : entry[0], + indexedIterable ? entry.get(1) : entry[1], + step + ); + } + } + }); + }; + + + ToIndexedSequence.prototype.cacheResult = + ToKeyedSequence.prototype.cacheResult = + ToSetSequence.prototype.cacheResult = + FromEntriesSequence.prototype.cacheResult = + cacheResultThrough; + + + function flipFactory(iterable) { + var flipSequence = makeSequence(iterable); + flipSequence._iter = iterable; + flipSequence.size = iterable.size; + flipSequence.flip = function() {return iterable}; + flipSequence.reverse = function () { + var reversedSequence = iterable.reverse.apply(this); // super.reverse() + reversedSequence.flip = function() {return iterable.reverse()}; + return reversedSequence; + }; + flipSequence.has = function(key ) {return iterable.includes(key)}; + flipSequence.includes = function(key ) {return iterable.has(key)}; + flipSequence.cacheResult = cacheResultThrough; + flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; + return iterable.__iterate(function(v, k) {return fn(k, v, this$0) !== false}, reverse); + } + flipSequence.__iteratorUncached = function(type, reverse) { + if (type === ITERATE_ENTRIES) { + var iterator = iterable.__iterator(type, reverse); + return new Iterator(function() { + var step = iterator.next(); + if (!step.done) { + var k = step.value[0]; + step.value[0] = step.value[1]; + step.value[1] = k; + } + return step; + }); + } + return iterable.__iterator( + type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES, + reverse + ); + } + return flipSequence; + } + + + function mapFactory(iterable, mapper, context) { + var mappedSequence = makeSequence(iterable); + mappedSequence.size = iterable.size; + mappedSequence.has = function(key ) {return iterable.has(key)}; + mappedSequence.get = function(key, notSetValue) { + var v = iterable.get(key, NOT_SET); + return v === NOT_SET ? + notSetValue : + mapper.call(context, v, key, iterable); + }; + mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; + return iterable.__iterate( + function(v, k, c) {return fn(mapper.call(context, v, k, c), k, this$0) !== false}, + reverse + ); + } + mappedSequence.__iteratorUncached = function (type, reverse) { + var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); + return new Iterator(function() { + var step = iterator.next(); + if (step.done) { + return step; + } + var entry = step.value; + var key = entry[0]; + return iteratorValue( + type, + key, + mapper.call(context, entry[1], key, iterable), + step + ); + }); + } + return mappedSequence; + } + + + function reverseFactory(iterable, useKeys) { + var reversedSequence = makeSequence(iterable); + reversedSequence._iter = iterable; + reversedSequence.size = iterable.size; + reversedSequence.reverse = function() {return iterable}; + if (iterable.flip) { + reversedSequence.flip = function () { + var flipSequence = flipFactory(iterable); + flipSequence.reverse = function() {return iterable.flip()}; + return flipSequence; + }; + } + reversedSequence.get = function(key, notSetValue) + {return iterable.get(useKeys ? key : -1 - key, notSetValue)}; + reversedSequence.has = function(key ) + {return iterable.has(useKeys ? key : -1 - key)}; + reversedSequence.includes = function(value ) {return iterable.includes(value)}; + reversedSequence.cacheResult = cacheResultThrough; + reversedSequence.__iterate = function (fn, reverse) {var this$0 = this; + return iterable.__iterate(function(v, k) {return fn(v, k, this$0)}, !reverse); + }; + reversedSequence.__iterator = + function(type, reverse) {return iterable.__iterator(type, !reverse)}; + return reversedSequence; + } + + + function filterFactory(iterable, predicate, context, useKeys) { + var filterSequence = makeSequence(iterable); + if (useKeys) { + filterSequence.has = function(key ) { + var v = iterable.get(key, NOT_SET); + return v !== NOT_SET && !!predicate.call(context, v, key, iterable); + }; + filterSequence.get = function(key, notSetValue) { + var v = iterable.get(key, NOT_SET); + return v !== NOT_SET && predicate.call(context, v, key, iterable) ? + v : notSetValue; + }; + } + filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; + var iterations = 0; + iterable.__iterate(function(v, k, c) { + if (predicate.call(context, v, k, c)) { + iterations++; + return fn(v, useKeys ? k : iterations - 1, this$0); + } + }, reverse); + return iterations; + }; + filterSequence.__iteratorUncached = function (type, reverse) { + var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); + var iterations = 0; + return new Iterator(function() { + while (true) { + var step = iterator.next(); + if (step.done) { + return step; + } + var entry = step.value; + var key = entry[0]; + var value = entry[1]; + if (predicate.call(context, value, key, iterable)) { + return iteratorValue(type, useKeys ? key : iterations++, value, step); + } + } + }); + } + return filterSequence; + } + + + function countByFactory(iterable, grouper, context) { + var groups = Map().asMutable(); + iterable.__iterate(function(v, k) { + groups.update( + grouper.call(context, v, k, iterable), + 0, + function(a ) {return a + 1} + ); + }); + return groups.asImmutable(); + } + + + function groupByFactory(iterable, grouper, context) { + var isKeyedIter = isKeyed(iterable); + var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable(); + iterable.__iterate(function(v, k) { + groups.update( + grouper.call(context, v, k, iterable), + function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)} + ); + }); + var coerce = iterableClass(iterable); + return groups.map(function(arr ) {return reify(iterable, coerce(arr))}); + } + + + function sliceFactory(iterable, begin, end, useKeys) { + var originalSize = iterable.size; + + // Sanitize begin & end using this shorthand for ToInt32(argument) + // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 + if (begin !== undefined) { + begin = begin | 0; + } + if (end !== undefined) { + if (end === Infinity) { + end = originalSize; + } else { + end = end | 0; + } + } + + if (wholeSlice(begin, end, originalSize)) { + return iterable; + } + + var resolvedBegin = resolveBegin(begin, originalSize); + var resolvedEnd = resolveEnd(end, originalSize); + + // begin or end will be NaN if they were provided as negative numbers and + // this iterable's size is unknown. In that case, cache first so there is + // a known size and these do not resolve to NaN. + if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) { + return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys); + } + + // Note: resolvedEnd is undefined when the original sequence's length is + // unknown and this slice did not supply an end and should contain all + // elements after resolvedBegin. + // In that case, resolvedSize will be NaN and sliceSize will remain undefined. + var resolvedSize = resolvedEnd - resolvedBegin; + var sliceSize; + if (resolvedSize === resolvedSize) { + sliceSize = resolvedSize < 0 ? 0 : resolvedSize; + } + + var sliceSeq = makeSequence(iterable); + + // If iterable.size is undefined, the size of the realized sliceSeq is + // unknown at this point unless the number of items to slice is 0 + sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined; + + if (!useKeys && isSeq(iterable) && sliceSize >= 0) { + sliceSeq.get = function (index, notSetValue) { + index = wrapIndex(this, index); + return index >= 0 && index < sliceSize ? + iterable.get(index + resolvedBegin, notSetValue) : + notSetValue; + } + } + + sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this; + if (sliceSize === 0) { + return 0; + } + if (reverse) { + return this.cacheResult().__iterate(fn, reverse); + } + var skipped = 0; + var isSkipping = true; + var iterations = 0; + iterable.__iterate(function(v, k) { + if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) { + iterations++; + return fn(v, useKeys ? k : iterations - 1, this$0) !== false && + iterations !== sliceSize; + } + }); + return iterations; + }; + + sliceSeq.__iteratorUncached = function(type, reverse) { + if (sliceSize !== 0 && reverse) { + return this.cacheResult().__iterator(type, reverse); + } + // Don't bother instantiating parent iterator if taking 0. + var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse); + var skipped = 0; + var iterations = 0; + return new Iterator(function() { + while (skipped++ < resolvedBegin) { + iterator.next(); + } + if (++iterations > sliceSize) { + return iteratorDone(); + } + var step = iterator.next(); + if (useKeys || type === ITERATE_VALUES) { + return step; + } else if (type === ITERATE_KEYS) { + return iteratorValue(type, iterations - 1, undefined, step); + } else { + return iteratorValue(type, iterations - 1, step.value[1], step); + } + }); + } + + return sliceSeq; + } + + + function takeWhileFactory(iterable, predicate, context) { + var takeSequence = makeSequence(iterable); + takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this; + if (reverse) { + return this.cacheResult().__iterate(fn, reverse); + } + var iterations = 0; + iterable.__iterate(function(v, k, c) + {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)} + ); + return iterations; + }; + takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this; + if (reverse) { + return this.cacheResult().__iterator(type, reverse); + } + var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); + var iterating = true; + return new Iterator(function() { + if (!iterating) { + return iteratorDone(); + } + var step = iterator.next(); + if (step.done) { + return step; + } + var entry = step.value; + var k = entry[0]; + var v = entry[1]; + if (!predicate.call(context, v, k, this$0)) { + iterating = false; + return iteratorDone(); + } + return type === ITERATE_ENTRIES ? step : + iteratorValue(type, k, v, step); + }); + }; + return takeSequence; + } + + + function skipWhileFactory(iterable, predicate, context, useKeys) { + var skipSequence = makeSequence(iterable); + skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; + if (reverse) { + return this.cacheResult().__iterate(fn, reverse); + } + var isSkipping = true; + var iterations = 0; + iterable.__iterate(function(v, k, c) { + if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) { + iterations++; + return fn(v, useKeys ? k : iterations - 1, this$0); + } + }); + return iterations; + }; + skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this; + if (reverse) { + return this.cacheResult().__iterator(type, reverse); + } + var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); + var skipping = true; + var iterations = 0; + return new Iterator(function() { + var step, k, v; + do { + step = iterator.next(); + if (step.done) { + if (useKeys || type === ITERATE_VALUES) { + return step; + } else if (type === ITERATE_KEYS) { + return iteratorValue(type, iterations++, undefined, step); + } else { + return iteratorValue(type, iterations++, step.value[1], step); + } + } + var entry = step.value; + k = entry[0]; + v = entry[1]; + skipping && (skipping = predicate.call(context, v, k, this$0)); + } while (skipping); + return type === ITERATE_ENTRIES ? step : + iteratorValue(type, k, v, step); + }); + }; + return skipSequence; + } + + + function concatFactory(iterable, values) { + var isKeyedIterable = isKeyed(iterable); + var iters = [iterable].concat(values).map(function(v ) { + if (!isIterable(v)) { + v = isKeyedIterable ? + keyedSeqFromValue(v) : + indexedSeqFromValue(Array.isArray(v) ? v : [v]); + } else if (isKeyedIterable) { + v = KeyedIterable(v); + } + return v; + }).filter(function(v ) {return v.size !== 0}); + + if (iters.length === 0) { + return iterable; + } + + if (iters.length === 1) { + var singleton = iters[0]; + if (singleton === iterable || + isKeyedIterable && isKeyed(singleton) || + isIndexed(iterable) && isIndexed(singleton)) { + return singleton; + } + } + + var concatSeq = new ArraySeq(iters); + if (isKeyedIterable) { + concatSeq = concatSeq.toKeyedSeq(); + } else if (!isIndexed(iterable)) { + concatSeq = concatSeq.toSetSeq(); + } + concatSeq = concatSeq.flatten(true); + concatSeq.size = iters.reduce( + function(sum, seq) { + if (sum !== undefined) { + var size = seq.size; + if (size !== undefined) { + return sum + size; + } + } + }, + 0 + ); + return concatSeq; + } + + + function flattenFactory(iterable, depth, useKeys) { + var flatSequence = makeSequence(iterable); + flatSequence.__iterateUncached = function(fn, reverse) { + var iterations = 0; + var stopped = false; + function flatDeep(iter, currentDepth) {var this$0 = this; + iter.__iterate(function(v, k) { + if ((!depth || currentDepth < depth) && isIterable(v)) { + flatDeep(v, currentDepth + 1); + } else if (fn(v, useKeys ? k : iterations++, this$0) === false) { + stopped = true; + } + return !stopped; + }, reverse); + } + flatDeep(iterable, 0); + return iterations; + } + flatSequence.__iteratorUncached = function(type, reverse) { + var iterator = iterable.__iterator(type, reverse); + var stack = []; + var iterations = 0; + return new Iterator(function() { + while (iterator) { + var step = iterator.next(); + if (step.done !== false) { + iterator = stack.pop(); + continue; + } + var v = step.value; + if (type === ITERATE_ENTRIES) { + v = v[1]; + } + if ((!depth || stack.length < depth) && isIterable(v)) { + stack.push(iterator); + iterator = v.__iterator(type, reverse); + } else { + return useKeys ? step : iteratorValue(type, iterations++, v, step); + } + } + return iteratorDone(); + }); + } + return flatSequence; } - createClass(OrderedMap, src_Map__Map); - - // @pragma Construction - function OrderedMap(value) { - return value === null || value === undefined ? emptyOrderedMap() : - isOrderedMap(value) ? value : - emptyOrderedMap().withMutations(function(map ) { - var iter = KeyedIterable(value); - assertNotInfinite(iter.size); - iter.forEach(function(v, k) {return map.set(k, v)}); - }); - } + function flatMapFactory(iterable, mapper, context) { + var coerce = iterableClass(iterable); + return iterable.toSeq().map( + function(v, k) {return coerce(mapper.call(context, v, k, iterable))} + ).flatten(true); + } - OrderedMap.of = function(/*...values*/) { - return this(arguments); - }; - OrderedMap.prototype.toString = function() { - return this.__toString('OrderedMap {', '}'); + function interposeFactory(iterable, separator) { + var interposedSequence = makeSequence(iterable); + interposedSequence.size = iterable.size && iterable.size * 2 -1; + interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this; + var iterations = 0; + iterable.__iterate(function(v, k) + {return (!iterations || fn(separator, iterations++, this$0) !== false) && + fn(v, iterations++, this$0) !== false}, + reverse + ); + return iterations; }; - - // @pragma Access - - OrderedMap.prototype.get = function(k, notSetValue) { - var index = this._map.get(k); - return index !== undefined ? this._list.get(index)[1] : notSetValue; + interposedSequence.__iteratorUncached = function(type, reverse) { + var iterator = iterable.__iterator(ITERATE_VALUES, reverse); + var iterations = 0; + var step; + return new Iterator(function() { + if (!step || iterations % 2) { + step = iterator.next(); + if (step.done) { + return step; + } + } + return iterations % 2 ? + iteratorValue(type, iterations++, separator) : + iteratorValue(type, iterations++, step.value, step); + }); }; + return interposedSequence; + } - // @pragma Modification - - OrderedMap.prototype.clear = function() { - if (this.size === 0) { - return this; - } - if (this.__ownerID) { - this.size = 0; - this._map.clear(); - this._list.clear(); - return this; - } - return emptyOrderedMap(); - }; - OrderedMap.prototype.set = function(k, v) { - return updateOrderedMap(this, k, v); - }; + function sortFactory(iterable, comparator, mapper) { + if (!comparator) { + comparator = defaultComparator; + } + var isKeyedIterable = isKeyed(iterable); + var index = 0; + var entries = iterable.toSeq().map( + function(v, k) {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]} + ).toArray(); + entries.sort(function(a, b) {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach( + isKeyedIterable ? + function(v, i) { entries[i].length = 2; } : + function(v, i) { entries[i] = v[1]; } + ); + return isKeyedIterable ? KeyedSeq(entries) : + isIndexed(iterable) ? IndexedSeq(entries) : + SetSeq(entries); + } - OrderedMap.prototype.remove = function(k) { - return updateOrderedMap(this, k, NOT_SET); - }; - OrderedMap.prototype.wasAltered = function() { - return this._map.wasAltered() || this._list.wasAltered(); - }; + function maxFactory(iterable, comparator, mapper) { + if (!comparator) { + comparator = defaultComparator; + } + if (mapper) { + var entry = iterable.toSeq() + .map(function(v, k) {return [v, mapper(v, k, iterable)]}) + .reduce(function(a, b) {return maxCompare(comparator, a[1], b[1]) ? b : a}); + return entry && entry[0]; + } else { + return iterable.reduce(function(a, b) {return maxCompare(comparator, a, b) ? b : a}); + } + } - OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._list.__iterate( - function(entry ) {return entry && fn(entry[1], entry[0], this$0)}, - reverse - ); - }; + function maxCompare(comparator, a, b) { + var comp = comparator(b, a); + // b is considered the new max if the comparator declares them equal, but + // they are not equal and b is in fact a nullish value. + return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0; + } - OrderedMap.prototype.__iterator = function(type, reverse) { - return this._list.fromEntrySeq().__iterator(type, reverse); - }; - OrderedMap.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; + function zipWithFactory(keyIter, zipper, iters) { + var zipSequence = makeSequence(keyIter); + zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min(); + // Note: this a generic base implementation of __iterate in terms of + // __iterator which may be more generically useful in the future. + zipSequence.__iterate = function(fn, reverse) { + /* generic: + var iterator = this.__iterator(ITERATE_ENTRIES, reverse); + var step; + var iterations = 0; + while (!(step = iterator.next()).done) { + iterations++; + if (fn(step.value[1], step.value[0], this) === false) { + break; + } } - var newMap = this._map.__ensureOwner(ownerID); - var newList = this._list.__ensureOwner(ownerID); - if (!ownerID) { - this.__ownerID = ownerID; - this._map = newMap; - this._list = newList; - return this; + return iterations; + */ + // indexed: + var iterator = this.__iterator(ITERATE_VALUES, reverse); + var step; + var iterations = 0; + while (!(step = iterator.next()).done) { + if (fn(step.value, iterations++, this) === false) { + break; + } } - return makeOrderedMap(newMap, newList, ownerID, this.__hash); + return iterations; }; - - - function isOrderedMap(maybeOrderedMap) { - return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap); + zipSequence.__iteratorUncached = function(type, reverse) { + var iterators = iters.map(function(i ) + {return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))} + ); + var iterations = 0; + var isDone = false; + return new Iterator(function() { + var steps; + if (!isDone) { + steps = iterators.map(function(i ) {return i.next()}); + isDone = steps.some(function(s ) {return s.done}); + } + if (isDone) { + return iteratorDone(); + } + return iteratorValue( + type, + iterations++, + zipper.apply(null, steps.map(function(s ) {return s.value})) + ); + }); + }; + return zipSequence } - OrderedMap.isOrderedMap = isOrderedMap; - OrderedMap.prototype[IS_ORDERED_SENTINEL] = true; - OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove; + // #pragma Helper Functions + function reify(iter, seq) { + return isSeq(iter) ? seq : iter.constructor(seq); + } + function validateEntry(entry) { + if (entry !== Object(entry)) { + throw new TypeError('Expected [K, V] tuple: ' + entry); + } + } - function makeOrderedMap(map, list, ownerID, hash) { - var omap = Object.create(OrderedMap.prototype); - omap.size = map ? map.size : 0; - omap._map = map; - omap._list = list; - omap.__ownerID = ownerID; - omap.__hash = hash; - return omap; + function resolveSize(iter) { + assertNotInfinite(iter.size); + return ensureSize(iter); } - var EMPTY_ORDERED_MAP; - function emptyOrderedMap() { - return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList())); + function iterableClass(iterable) { + return isKeyed(iterable) ? KeyedIterable : + isIndexed(iterable) ? IndexedIterable : + SetIterable; } - function updateOrderedMap(omap, k, v) { - var map = omap._map; - var list = omap._list; - var i = map.get(k); - var has = i !== undefined; - var newMap; - var newList; - if (v === NOT_SET) { // removed - if (!has) { - return omap; - } - if (list.size >= SIZE && list.size >= map.size * 2) { - newList = list.filter(function(entry, idx) {return entry !== undefined && i !== idx}); - newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap(); - if (omap.__ownerID) { - newMap.__ownerID = newList.__ownerID = omap.__ownerID; - } - } else { - newMap = map.remove(k); - newList = i === list.size - 1 ? list.pop() : list.set(i, undefined); - } + function makeSequence(iterable) { + return Object.create( + ( + isKeyed(iterable) ? KeyedSeq : + isIndexed(iterable) ? IndexedSeq : + SetSeq + ).prototype + ); + } + + function cacheResultThrough() { + if (this._iter.cacheResult) { + this._iter.cacheResult(); + this.size = this._iter.size; + return this; } else { - if (has) { - if (v === list.get(i)[1]) { - return omap; - } - newMap = map; - newList = list.set(i, [k, v]); - } else { - newMap = map.set(k, list.size); - newList = list.set(list.size, [k, v]); - } + return Seq.prototype.cacheResult.call(this); } - if (omap.__ownerID) { - omap.size = newMap.size; - omap._map = newMap; - omap._list = newList; - omap.__hash = undefined; - return omap; + } + + function defaultComparator(a, b) { + return a > b ? 1 : a < b ? -1 : 0; + } + + function forceIterator(keyPath) { + var iter = getIterator(keyPath); + if (!iter) { + // Array might not be iterable in this environment, so we need a fallback + // to our wrapped type. + if (!isArrayLike(keyPath)) { + throw new TypeError('Expected iterable or array-like: ' + keyPath); + } + iter = getIterator(Iterable(keyPath)); } - return makeOrderedMap(newMap, newList); + return iter; } - createClass(Stack, IndexedCollection); + createClass(Record, KeyedCollection); - // @pragma Construction + function Record(defaultValues, name) { + var hasInitialized; - function Stack(value) { - return value === null || value === undefined ? emptyStack() : - isStack(value) ? value : - emptyStack().unshiftAll(value); - } + var RecordType = function Record(values) { + if (values instanceof RecordType) { + return values; + } + if (!(this instanceof RecordType)) { + return new RecordType(values); + } + if (!hasInitialized) { + hasInitialized = true; + var keys = Object.keys(defaultValues); + setProps(RecordTypePrototype, keys); + RecordTypePrototype.size = keys.length; + RecordTypePrototype._name = name; + RecordTypePrototype._keys = keys; + RecordTypePrototype._defaultValues = defaultValues; + } + this._map = Map(values); + }; - Stack.of = function(/*...values*/) { - return this(arguments); - }; + var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype); + RecordTypePrototype.constructor = RecordType; - Stack.prototype.toString = function() { - return this.__toString('Stack [', ']'); + return RecordType; + } + + Record.prototype.toString = function() { + return this.__toString(recordName(this) + ' {', '}'); }; // @pragma Access - Stack.prototype.get = function(index, notSetValue) { - var head = this._head; - index = wrapIndex(this, index); - while (head && index--) { - head = head.next; - } - return head ? head.value : notSetValue; + Record.prototype.has = function(k) { + return this._defaultValues.hasOwnProperty(k); }; - Stack.prototype.peek = function() { - return this._head && this._head.value; + Record.prototype.get = function(k, notSetValue) { + if (!this.has(k)) { + return notSetValue; + } + var defaultVal = this._defaultValues[k]; + return this._map ? this._map.get(k, defaultVal) : defaultVal; }; // @pragma Modification - Stack.prototype.push = function(/*...values*/) { - if (arguments.length === 0) { - return this; - } - var newSize = this.size + arguments.length; - var head = this._head; - for (var ii = arguments.length - 1; ii >= 0; ii--) { - head = { - value: arguments[ii], - next: head - }; - } + Record.prototype.clear = function() { if (this.__ownerID) { - this.size = newSize; - this._head = head; - this.__hash = undefined; - this.__altered = true; + this._map && this._map.clear(); return this; } - return makeStack(newSize, head); + var RecordType = this.constructor; + return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap())); }; - Stack.prototype.pushAll = function(iter) { - iter = IndexedIterable(iter); - if (iter.size === 0) { - return this; + Record.prototype.set = function(k, v) { + if (!this.has(k)) { + throw new Error('Cannot set unknown key "' + k + '" on ' + recordName(this)); } - assertNotInfinite(iter.size); - var newSize = this.size; - var head = this._head; - iter.reverse().forEach(function(value ) { - newSize++; - head = { - value: value, - next: head - }; - }); - if (this.__ownerID) { - this.size = newSize; - this._head = head; - this.__hash = undefined; - this.__altered = true; + if (this._map && !this._map.has(k)) { + var defaultVal = this._defaultValues[k]; + if (v === defaultVal) { + return this; + } + } + var newMap = this._map && this._map.set(k, v); + if (this.__ownerID || newMap === this._map) { return this; } - return makeStack(newSize, head); - }; - - Stack.prototype.pop = function() { - return this.slice(1); - }; - - Stack.prototype.unshift = function(/*...values*/) { - return this.push.apply(this, arguments); - }; - - Stack.prototype.unshiftAll = function(iter) { - return this.pushAll(iter); - }; - - Stack.prototype.shift = function() { - return this.pop.apply(this, arguments); + return makeRecord(this, newMap); }; - Stack.prototype.clear = function() { - if (this.size === 0) { + Record.prototype.remove = function(k) { + if (!this.has(k)) { return this; } - if (this.__ownerID) { - this.size = 0; - this._head = undefined; - this.__hash = undefined; - this.__altered = true; + var newMap = this._map && this._map.remove(k); + if (this.__ownerID || newMap === this._map) { return this; } - return emptyStack(); + return makeRecord(this, newMap); }; - Stack.prototype.slice = function(begin, end) { - if (wholeSlice(begin, end, this.size)) { - return this; - } - var resolvedBegin = resolveBegin(begin, this.size); - var resolvedEnd = resolveEnd(end, this.size); - if (resolvedEnd !== this.size) { - // super.slice(begin, end); - return IndexedCollection.prototype.slice.call(this, begin, end); - } - var newSize = this.size - resolvedBegin; - var head = this._head; - while (resolvedBegin--) { - head = head.next; - } - if (this.__ownerID) { - this.size = newSize; - this._head = head; - this.__hash = undefined; - this.__altered = true; - return this; - } - return makeStack(newSize, head); + Record.prototype.wasAltered = function() { + return this._map.wasAltered(); }; - // @pragma Mutability + Record.prototype.__iterator = function(type, reverse) {var this$0 = this; + return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterator(type, reverse); + }; - Stack.prototype.__ensureOwner = function(ownerID) { + Record.prototype.__iterate = function(fn, reverse) {var this$0 = this; + return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterate(fn, reverse); + }; + + Record.prototype.__ensureOwner = function(ownerID) { if (ownerID === this.__ownerID) { return this; } + var newMap = this._map && this._map.__ensureOwner(ownerID); if (!ownerID) { this.__ownerID = ownerID; - this.__altered = false; + this._map = newMap; return this; } - return makeStack(this.size, this._head, ownerID, this.__hash); - }; - - // @pragma Iteration - - Stack.prototype.__iterate = function(fn, reverse) { - if (reverse) { - return this.reverse().__iterate(fn); - } - var iterations = 0; - var node = this._head; - while (node) { - if (fn(node.value, iterations++, this) === false) { - break; - } - node = node.next; - } - return iterations; - }; - - Stack.prototype.__iterator = function(type, reverse) { - if (reverse) { - return this.reverse().__iterator(type); - } - var iterations = 0; - var node = this._head; - return new src_Iterator__Iterator(function() { - if (node) { - var value = node.value; - node = node.next; - return iteratorValue(type, iterations++, value); - } - return iteratorDone(); - }); + return makeRecord(this, newMap, ownerID); }; - function isStack(maybeStack) { - return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]); - } - - Stack.isStack = isStack; - - var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@'; + var RecordPrototype = Record.prototype; + RecordPrototype[DELETE] = RecordPrototype.remove; + RecordPrototype.deleteIn = + RecordPrototype.removeIn = MapPrototype.removeIn; + RecordPrototype.merge = MapPrototype.merge; + RecordPrototype.mergeWith = MapPrototype.mergeWith; + RecordPrototype.mergeIn = MapPrototype.mergeIn; + RecordPrototype.mergeDeep = MapPrototype.mergeDeep; + RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith; + RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn; + RecordPrototype.setIn = MapPrototype.setIn; + RecordPrototype.update = MapPrototype.update; + RecordPrototype.updateIn = MapPrototype.updateIn; + RecordPrototype.withMutations = MapPrototype.withMutations; + RecordPrototype.asMutable = MapPrototype.asMutable; + RecordPrototype.asImmutable = MapPrototype.asImmutable; - var StackPrototype = Stack.prototype; - StackPrototype[IS_STACK_SENTINEL] = true; - StackPrototype.withMutations = MapPrototype.withMutations; - StackPrototype.asMutable = MapPrototype.asMutable; - StackPrototype.asImmutable = MapPrototype.asImmutable; - StackPrototype.wasAltered = MapPrototype.wasAltered; + function makeRecord(likeRecord, map, ownerID) { + var record = Object.create(Object.getPrototypeOf(likeRecord)); + record._map = map; + record.__ownerID = ownerID; + return record; + } - function makeStack(size, head, ownerID, hash) { - var map = Object.create(StackPrototype); - map.size = size; - map._head = head; - map.__ownerID = ownerID; - map.__hash = hash; - map.__altered = false; - return map; + function recordName(record) { + return record._name || record.constructor.name || 'Record'; } - var EMPTY_STACK; - function emptyStack() { - return EMPTY_STACK || (EMPTY_STACK = makeStack(0)); + function setProps(prototype, names) { + try { + names.forEach(setProp.bind(undefined, prototype)); + } catch (error) { + // Object.defineProperty failed. Probably IE8. + } + } + + function setProp(prototype, name) { + Object.defineProperty(prototype, name, { + get: function() { + return this.get(name); + }, + set: function(value) { + invariant(this.__ownerID, 'Cannot set on an immutable record.'); + this.set(name, value); + } + }); } - createClass(src_Set__Set, SetCollection); + createClass(Set, SetCollection); // @pragma Construction - function src_Set__Set(value) { + function Set(value) { return value === null || value === undefined ? emptySet() : isSet(value) && !isOrdered(value) ? value : emptySet().withMutations(function(set ) { @@ -3829,41 +4068,41 @@ return /******/ (function(modules) { // webpackBootstrap }); } - src_Set__Set.of = function(/*...values*/) { + Set.of = function(/*...values*/) { return this(arguments); }; - src_Set__Set.fromKeys = function(value) { + Set.fromKeys = function(value) { return this(KeyedIterable(value).keySeq()); }; - src_Set__Set.prototype.toString = function() { + Set.prototype.toString = function() { return this.__toString('Set {', '}'); }; // @pragma Access - src_Set__Set.prototype.has = function(value) { + Set.prototype.has = function(value) { return this._map.has(value); }; // @pragma Modification - src_Set__Set.prototype.add = function(value) { + Set.prototype.add = function(value) { return updateSet(this, this._map.set(value, true)); }; - src_Set__Set.prototype.remove = function(value) { + Set.prototype.remove = function(value) { return updateSet(this, this._map.remove(value)); }; - src_Set__Set.prototype.clear = function() { + Set.prototype.clear = function() { return updateSet(this, this._map.clear()); }; // @pragma Composition - src_Set__Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0); + Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0); iters = iters.filter(function(x ) {return x.size !== 0}); if (iters.length === 0) { return this; @@ -3878,7 +4117,7 @@ return /******/ (function(modules) { // webpackBootstrap }); }; - src_Set__Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0); + Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0); if (iters.length === 0) { return this; } @@ -3893,7 +4132,7 @@ return /******/ (function(modules) { // webpackBootstrap }); }; - src_Set__Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0); + Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0); if (iters.length === 0) { return this; } @@ -3908,551 +4147,361 @@ return /******/ (function(modules) { // webpackBootstrap }); }; - src_Set__Set.prototype.merge = function() { + Set.prototype.merge = function() { return this.union.apply(this, arguments); }; - src_Set__Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); + Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); return this.union.apply(this, iters); }; - src_Set__Set.prototype.sort = function(comparator) { + Set.prototype.sort = function(comparator) { // Late binding return OrderedSet(sortFactory(this, comparator)); }; - src_Set__Set.prototype.sortBy = function(mapper, comparator) { + Set.prototype.sortBy = function(mapper, comparator) { // Late binding return OrderedSet(sortFactory(this, comparator, mapper)); }; - src_Set__Set.prototype.wasAltered = function() { - return this._map.wasAltered(); - }; - - src_Set__Set.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._map.__iterate(function(_, k) {return fn(k, k, this$0)}, reverse); - }; - - src_Set__Set.prototype.__iterator = function(type, reverse) { - return this._map.map(function(_, k) {return k}).__iterator(type, reverse); - }; - - src_Set__Set.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - var newMap = this._map.__ensureOwner(ownerID); - if (!ownerID) { - this.__ownerID = ownerID; - this._map = newMap; - return this; - } - return this.__make(newMap, ownerID); - }; - - - function isSet(maybeSet) { - return !!(maybeSet && maybeSet[IS_SET_SENTINEL]); - } - - src_Set__Set.isSet = isSet; - - var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@'; - - var SetPrototype = src_Set__Set.prototype; - SetPrototype[IS_SET_SENTINEL] = true; - SetPrototype[DELETE] = SetPrototype.remove; - SetPrototype.mergeDeep = SetPrototype.merge; - SetPrototype.mergeDeepWith = SetPrototype.mergeWith; - SetPrototype.withMutations = MapPrototype.withMutations; - SetPrototype.asMutable = MapPrototype.asMutable; - SetPrototype.asImmutable = MapPrototype.asImmutable; - - SetPrototype.__empty = emptySet; - SetPrototype.__make = makeSet; - - function updateSet(set, newMap) { - if (set.__ownerID) { - set.size = newMap.size; - set._map = newMap; - return set; - } - return newMap === set._map ? set : - newMap.size === 0 ? set.__empty() : - set.__make(newMap); - } - - function makeSet(map, ownerID) { - var set = Object.create(SetPrototype); - set.size = map ? map.size : 0; - set._map = map; - set.__ownerID = ownerID; - return set; - } - - var EMPTY_SET; - function emptySet() { - return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap())); - } - - createClass(OrderedSet, src_Set__Set); - - // @pragma Construction - - function OrderedSet(value) { - return value === null || value === undefined ? emptyOrderedSet() : - isOrderedSet(value) ? value : - emptyOrderedSet().withMutations(function(set ) { - var iter = SetIterable(value); - assertNotInfinite(iter.size); - iter.forEach(function(v ) {return set.add(v)}); - }); - } - - OrderedSet.of = function(/*...values*/) { - return this(arguments); - }; - - OrderedSet.fromKeys = function(value) { - return this(KeyedIterable(value).keySeq()); - }; - - OrderedSet.prototype.toString = function() { - return this.__toString('OrderedSet {', '}'); - }; - - - function isOrderedSet(maybeOrderedSet) { - return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet); - } - - OrderedSet.isOrderedSet = isOrderedSet; - - var OrderedSetPrototype = OrderedSet.prototype; - OrderedSetPrototype[IS_ORDERED_SENTINEL] = true; - - OrderedSetPrototype.__empty = emptyOrderedSet; - OrderedSetPrototype.__make = makeOrderedSet; - - function makeOrderedSet(map, ownerID) { - var set = Object.create(OrderedSetPrototype); - set.size = map ? map.size : 0; - set._map = map; - set.__ownerID = ownerID; - return set; - } - - var EMPTY_ORDERED_SET; - function emptyOrderedSet() { - return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap())); - } - - createClass(Record, KeyedCollection); - - function Record(defaultValues, name) { - var hasInitialized; - - var RecordType = function Record(values) { - if (values instanceof RecordType) { - return values; - } - if (!(this instanceof RecordType)) { - return new RecordType(values); - } - if (!hasInitialized) { - hasInitialized = true; - var keys = Object.keys(defaultValues); - setProps(RecordTypePrototype, keys); - RecordTypePrototype.size = keys.length; - RecordTypePrototype._name = name; - RecordTypePrototype._keys = keys; - RecordTypePrototype._defaultValues = defaultValues; - } - this._map = src_Map__Map(values); - }; - - var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype); - RecordTypePrototype.constructor = RecordType; - - return RecordType; - } - - Record.prototype.toString = function() { - return this.__toString(recordName(this) + ' {', '}'); - }; - - // @pragma Access - - Record.prototype.has = function(k) { - return this._defaultValues.hasOwnProperty(k); - }; - - Record.prototype.get = function(k, notSetValue) { - if (!this.has(k)) { - return notSetValue; - } - var defaultVal = this._defaultValues[k]; - return this._map ? this._map.get(k, defaultVal) : defaultVal; - }; - - // @pragma Modification - - Record.prototype.clear = function() { - if (this.__ownerID) { - this._map && this._map.clear(); - return this; - } - var RecordType = this.constructor; - return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap())); - }; - - Record.prototype.set = function(k, v) { - if (!this.has(k)) { - throw new Error('Cannot set unknown key "' + k + '" on ' + recordName(this)); - } - var newMap = this._map && this._map.set(k, v); - if (this.__ownerID || newMap === this._map) { - return this; - } - return makeRecord(this, newMap); - }; - - Record.prototype.remove = function(k) { - if (!this.has(k)) { - return this; - } - var newMap = this._map && this._map.remove(k); - if (this.__ownerID || newMap === this._map) { - return this; - } - return makeRecord(this, newMap); - }; - - Record.prototype.wasAltered = function() { + Set.prototype.wasAltered = function() { return this._map.wasAltered(); }; - Record.prototype.__iterator = function(type, reverse) {var this$0 = this; - return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterator(type, reverse); + Set.prototype.__iterate = function(fn, reverse) {var this$0 = this; + return this._map.__iterate(function(_, k) {return fn(k, k, this$0)}, reverse); }; - Record.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterate(fn, reverse); + Set.prototype.__iterator = function(type, reverse) { + return this._map.map(function(_, k) {return k}).__iterator(type, reverse); }; - Record.prototype.__ensureOwner = function(ownerID) { + Set.prototype.__ensureOwner = function(ownerID) { if (ownerID === this.__ownerID) { return this; } - var newMap = this._map && this._map.__ensureOwner(ownerID); + var newMap = this._map.__ensureOwner(ownerID); if (!ownerID) { this.__ownerID = ownerID; this._map = newMap; return this; } - return makeRecord(this, newMap, ownerID); + return this.__make(newMap, ownerID); }; - var RecordPrototype = Record.prototype; - RecordPrototype[DELETE] = RecordPrototype.remove; - RecordPrototype.deleteIn = - RecordPrototype.removeIn = MapPrototype.removeIn; - RecordPrototype.merge = MapPrototype.merge; - RecordPrototype.mergeWith = MapPrototype.mergeWith; - RecordPrototype.mergeIn = MapPrototype.mergeIn; - RecordPrototype.mergeDeep = MapPrototype.mergeDeep; - RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith; - RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn; - RecordPrototype.setIn = MapPrototype.setIn; - RecordPrototype.update = MapPrototype.update; - RecordPrototype.updateIn = MapPrototype.updateIn; - RecordPrototype.withMutations = MapPrototype.withMutations; - RecordPrototype.asMutable = MapPrototype.asMutable; - RecordPrototype.asImmutable = MapPrototype.asImmutable; + function isSet(maybeSet) { + return !!(maybeSet && maybeSet[IS_SET_SENTINEL]); + } + Set.isSet = isSet; - function makeRecord(likeRecord, map, ownerID) { - var record = Object.create(Object.getPrototypeOf(likeRecord)); - record._map = map; - record.__ownerID = ownerID; - return record; - } + var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@'; - function recordName(record) { - return record._name || record.constructor.name || 'Record'; - } + var SetPrototype = Set.prototype; + SetPrototype[IS_SET_SENTINEL] = true; + SetPrototype[DELETE] = SetPrototype.remove; + SetPrototype.mergeDeep = SetPrototype.merge; + SetPrototype.mergeDeepWith = SetPrototype.mergeWith; + SetPrototype.withMutations = MapPrototype.withMutations; + SetPrototype.asMutable = MapPrototype.asMutable; + SetPrototype.asImmutable = MapPrototype.asImmutable; - function setProps(prototype, names) { - try { - names.forEach(setProp.bind(undefined, prototype)); - } catch (error) { - // Object.defineProperty failed. Probably IE8. + SetPrototype.__empty = emptySet; + SetPrototype.__make = makeSet; + + function updateSet(set, newMap) { + if (set.__ownerID) { + set.size = newMap.size; + set._map = newMap; + return set; } + return newMap === set._map ? set : + newMap.size === 0 ? set.__empty() : + set.__make(newMap); } - function setProp(prototype, name) { - Object.defineProperty(prototype, name, { - get: function() { - return this.get(name); - }, - set: function(value) { - invariant(this.__ownerID, 'Cannot set on an immutable record.'); - this.set(name, value); - } - }); + function makeSet(map, ownerID) { + var set = Object.create(SetPrototype); + set.size = map ? map.size : 0; + set._map = map; + set.__ownerID = ownerID; + return set; } - function deepEqual(a, b) { - if (a === b) { - return true; - } - - if ( - !isIterable(b) || - a.size !== undefined && b.size !== undefined && a.size !== b.size || - a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash || - isKeyed(a) !== isKeyed(b) || - isIndexed(a) !== isIndexed(b) || - isOrdered(a) !== isOrdered(b) - ) { - return false; - } + var EMPTY_SET; + function emptySet() { + return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap())); + } - if (a.size === 0 && b.size === 0) { - return true; - } + createClass(OrderedSet, Set); - var notAssociative = !isAssociative(a); + // @pragma Construction - if (isOrdered(a)) { - var entries = a.entries(); - return b.every(function(v, k) { - var entry = entries.next().value; - return entry && is(entry[1], v) && (notAssociative || is(entry[0], k)); - }) && entries.next().done; + function OrderedSet(value) { + return value === null || value === undefined ? emptyOrderedSet() : + isOrderedSet(value) ? value : + emptyOrderedSet().withMutations(function(set ) { + var iter = SetIterable(value); + assertNotInfinite(iter.size); + iter.forEach(function(v ) {return set.add(v)}); + }); } - var flipped = false; + OrderedSet.of = function(/*...values*/) { + return this(arguments); + }; - if (a.size === undefined) { - if (b.size === undefined) { - if (typeof a.cacheResult === 'function') { - a.cacheResult(); - } - } else { - flipped = true; - var _ = a; - a = b; - b = _; - } - } + OrderedSet.fromKeys = function(value) { + return this(KeyedIterable(value).keySeq()); + }; - var allEqual = true; - var bSize = b.__iterate(function(v, k) { - if (notAssociative ? !a.has(v) : - flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) { - allEqual = false; - return false; - } - }); + OrderedSet.prototype.toString = function() { + return this.__toString('OrderedSet {', '}'); + }; - return allEqual && a.size === bSize; - } - createClass(Range, IndexedSeq); + function isOrderedSet(maybeOrderedSet) { + return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet); + } - function Range(start, end, step) { - if (!(this instanceof Range)) { - return new Range(start, end, step); - } - invariant(step !== 0, 'Cannot step a Range by 0'); - start = start || 0; - if (end === undefined) { - end = Infinity; - } - step = step === undefined ? 1 : Math.abs(step); - if (end < start) { - step = -step; - } - this._start = start; - this._end = end; - this._step = step; - this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1); - if (this.size === 0) { - if (EMPTY_RANGE) { - return EMPTY_RANGE; - } - EMPTY_RANGE = this; - } - } + OrderedSet.isOrderedSet = isOrderedSet; - Range.prototype.toString = function() { - if (this.size === 0) { - return 'Range []'; - } - return 'Range [ ' + - this._start + '...' + this._end + - (this._step > 1 ? ' by ' + this._step : '') + - ' ]'; - }; + var OrderedSetPrototype = OrderedSet.prototype; + OrderedSetPrototype[IS_ORDERED_SENTINEL] = true; - Range.prototype.get = function(index, notSetValue) { - return this.has(index) ? - this._start + wrapIndex(this, index) * this._step : - notSetValue; - }; + OrderedSetPrototype.__empty = emptyOrderedSet; + OrderedSetPrototype.__make = makeOrderedSet; - Range.prototype.includes = function(searchValue) { - var possibleIndex = (searchValue - this._start) / this._step; - return possibleIndex >= 0 && - possibleIndex < this.size && - possibleIndex === Math.floor(possibleIndex); - }; + function makeOrderedSet(map, ownerID) { + var set = Object.create(OrderedSetPrototype); + set.size = map ? map.size : 0; + set._map = map; + set.__ownerID = ownerID; + return set; + } - Range.prototype.slice = function(begin, end) { - if (wholeSlice(begin, end, this.size)) { - return this; - } - begin = resolveBegin(begin, this.size); - end = resolveEnd(end, this.size); - if (end <= begin) { - return new Range(0, 0); - } - return new Range(this.get(begin, this._end), this.get(end, this._end), this._step); - }; + var EMPTY_ORDERED_SET; + function emptyOrderedSet() { + return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap())); + } - Range.prototype.indexOf = function(searchValue) { - var offsetValue = searchValue - this._start; - if (offsetValue % this._step === 0) { - var index = offsetValue / this._step; - if (index >= 0 && index < this.size) { - return index - } - } - return -1; - }; + createClass(Stack, IndexedCollection); - Range.prototype.lastIndexOf = function(searchValue) { - return this.indexOf(searchValue); - }; + // @pragma Construction - Range.prototype.__iterate = function(fn, reverse) { - var maxIndex = this.size - 1; - var step = this._step; - var value = reverse ? this._start + maxIndex * step : this._start; - for (var ii = 0; ii <= maxIndex; ii++) { - if (fn(value, ii, this) === false) { - return ii + 1; - } - value += reverse ? -step : step; - } - return ii; - }; + function Stack(value) { + return value === null || value === undefined ? emptyStack() : + isStack(value) ? value : + emptyStack().unshiftAll(value); + } - Range.prototype.__iterator = function(type, reverse) { - var maxIndex = this.size - 1; - var step = this._step; - var value = reverse ? this._start + maxIndex * step : this._start; - var ii = 0; - return new src_Iterator__Iterator(function() { - var v = value; - value += reverse ? -step : step; - return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v); - }); + Stack.of = function(/*...values*/) { + return this(arguments); }; - Range.prototype.equals = function(other) { - return other instanceof Range ? - this._start === other._start && - this._end === other._end && - this._step === other._step : - deepEqual(this, other); + Stack.prototype.toString = function() { + return this.__toString('Stack [', ']'); }; + // @pragma Access - var EMPTY_RANGE; + Stack.prototype.get = function(index, notSetValue) { + var head = this._head; + index = wrapIndex(this, index); + while (head && index--) { + head = head.next; + } + return head ? head.value : notSetValue; + }; - createClass(Repeat, IndexedSeq); + Stack.prototype.peek = function() { + return this._head && this._head.value; + }; - function Repeat(value, times) { - if (!(this instanceof Repeat)) { - return new Repeat(value, times); + // @pragma Modification + + Stack.prototype.push = function(/*...values*/) { + if (arguments.length === 0) { + return this; } - this._value = value; - this.size = times === undefined ? Infinity : Math.max(0, times); - if (this.size === 0) { - if (EMPTY_REPEAT) { - return EMPTY_REPEAT; - } - EMPTY_REPEAT = this; + var newSize = this.size + arguments.length; + var head = this._head; + for (var ii = arguments.length - 1; ii >= 0; ii--) { + head = { + value: arguments[ii], + next: head + }; } - } + if (this.__ownerID) { + this.size = newSize; + this._head = head; + this.__hash = undefined; + this.__altered = true; + return this; + } + return makeStack(newSize, head); + }; - Repeat.prototype.toString = function() { - if (this.size === 0) { - return 'Repeat []'; + Stack.prototype.pushAll = function(iter) { + iter = IndexedIterable(iter); + if (iter.size === 0) { + return this; } - return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]'; + assertNotInfinite(iter.size); + var newSize = this.size; + var head = this._head; + iter.reverse().forEach(function(value ) { + newSize++; + head = { + value: value, + next: head + }; + }); + if (this.__ownerID) { + this.size = newSize; + this._head = head; + this.__hash = undefined; + this.__altered = true; + return this; + } + return makeStack(newSize, head); }; - Repeat.prototype.get = function(index, notSetValue) { - return this.has(index) ? this._value : notSetValue; + Stack.prototype.pop = function() { + return this.slice(1); }; - Repeat.prototype.includes = function(searchValue) { - return is(this._value, searchValue); + Stack.prototype.unshift = function(/*...values*/) { + return this.push.apply(this, arguments); }; - Repeat.prototype.slice = function(begin, end) { - var size = this.size; - return wholeSlice(begin, end, size) ? this : - new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size)); + Stack.prototype.unshiftAll = function(iter) { + return this.pushAll(iter); }; - Repeat.prototype.reverse = function() { - return this; + Stack.prototype.shift = function() { + return this.pop.apply(this, arguments); }; - Repeat.prototype.indexOf = function(searchValue) { - if (is(this._value, searchValue)) { - return 0; + Stack.prototype.clear = function() { + if (this.size === 0) { + return this; } - return -1; + if (this.__ownerID) { + this.size = 0; + this._head = undefined; + this.__hash = undefined; + this.__altered = true; + return this; + } + return emptyStack(); }; - Repeat.prototype.lastIndexOf = function(searchValue) { - if (is(this._value, searchValue)) { - return this.size; + Stack.prototype.slice = function(begin, end) { + if (wholeSlice(begin, end, this.size)) { + return this; } - return -1; + var resolvedBegin = resolveBegin(begin, this.size); + var resolvedEnd = resolveEnd(end, this.size); + if (resolvedEnd !== this.size) { + // super.slice(begin, end); + return IndexedCollection.prototype.slice.call(this, begin, end); + } + var newSize = this.size - resolvedBegin; + var head = this._head; + while (resolvedBegin--) { + head = head.next; + } + if (this.__ownerID) { + this.size = newSize; + this._head = head; + this.__hash = undefined; + this.__altered = true; + return this; + } + return makeStack(newSize, head); }; - Repeat.prototype.__iterate = function(fn, reverse) { - for (var ii = 0; ii < this.size; ii++) { - if (fn(this._value, ii, this) === false) { - return ii + 1; - } + // @pragma Mutability + + Stack.prototype.__ensureOwner = function(ownerID) { + if (ownerID === this.__ownerID) { + return this; } - return ii; + if (!ownerID) { + this.__ownerID = ownerID; + this.__altered = false; + return this; + } + return makeStack(this.size, this._head, ownerID, this.__hash); }; - Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this; - var ii = 0; - return new src_Iterator__Iterator(function() - {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()} - ); + // @pragma Iteration + + Stack.prototype.__iterate = function(fn, reverse) { + if (reverse) { + return this.reverse().__iterate(fn); + } + var iterations = 0; + var node = this._head; + while (node) { + if (fn(node.value, iterations++, this) === false) { + break; + } + node = node.next; + } + return iterations; }; - Repeat.prototype.equals = function(other) { - return other instanceof Repeat ? - is(this._value, other._value) : - deepEqual(other); + Stack.prototype.__iterator = function(type, reverse) { + if (reverse) { + return this.reverse().__iterator(type); + } + var iterations = 0; + var node = this._head; + return new Iterator(function() { + if (node) { + var value = node.value; + node = node.next; + return iteratorValue(type, iterations++, value); + } + return iteratorDone(); + }); }; - var EMPTY_REPEAT; + function isStack(maybeStack) { + return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]); + } + + Stack.isStack = isStack; + + var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@'; + + var StackPrototype = Stack.prototype; + StackPrototype[IS_STACK_SENTINEL] = true; + StackPrototype.withMutations = MapPrototype.withMutations; + StackPrototype.asMutable = MapPrototype.asMutable; + StackPrototype.asImmutable = MapPrototype.asImmutable; + StackPrototype.wasAltered = MapPrototype.wasAltered; + + + function makeStack(size, head, ownerID, hash) { + var map = Object.create(StackPrototype); + map.size = size; + map._head = head; + map.__ownerID = ownerID; + map.__hash = hash; + map.__altered = false; + return map; + } + + var EMPTY_STACK; + function emptyStack() { + return EMPTY_STACK || (EMPTY_STACK = makeStack(0)); + } /** * Contributes additional methods to a constructor @@ -4465,7 +4514,7 @@ return /******/ (function(modules) { // webpackBootstrap return ctor; } - Iterable.Iterator = src_Iterator__Iterator; + Iterable.Iterator = Iterator; mixin(Iterable, { @@ -4500,7 +4549,7 @@ return /******/ (function(modules) { // webpackBootstrap toMap: function() { // Use Late Binding here to solve the circular dependency. - return src_Map__Map(this.toKeyedSeq()); + return Map(this.toKeyedSeq()); }, toObject: function() { @@ -4522,7 +4571,7 @@ return /******/ (function(modules) { // webpackBootstrap toSet: function() { // Use Late Binding here to solve the circular dependency. - return src_Set__Set(isKeyed(this) ? this.valueSeq() : this); + return Set(isKeyed(this) ? this.valueSeq() : this); }, toSetSeq: function() { @@ -4595,21 +4644,6 @@ return /******/ (function(modules) { // webpackBootstrap return entry ? entry[1] : notSetValue; }, - findEntry: function(predicate, context) { - var found; - this.__iterate(function(v, k, c) { - if (predicate.call(context, v, k, c)) { - found = [k, v]; - return false; - } - }); - return found; - }, - - findLastEntry: function(predicate, context) { - return this.toSeq().reverse().findEntry(predicate, context); - }, - forEach: function(sideEffect, context) { assertNotInfinite(this.size); return this.__iterate(context ? sideEffect.bind(context) : sideEffect); @@ -4720,10 +4754,34 @@ return /******/ (function(modules) { // webpackBootstrap return this.filter(not(predicate), context); }, + findEntry: function(predicate, context, notSetValue) { + var found = notSetValue; + this.__iterate(function(v, k, c) { + if (predicate.call(context, v, k, c)) { + found = [k, v]; + return false; + } + }); + return found; + }, + + findKey: function(predicate, context) { + var entry = this.findEntry(predicate, context); + return entry && entry[0]; + }, + findLast: function(predicate, context, notSetValue) { return this.toKeyedSeq().reverse().find(predicate, context, notSetValue); }, + findLastEntry: function(predicate, context, notSetValue) { + return this.toKeyedSeq().reverse().findEntry(predicate, context, notSetValue); + }, + + findLastKey: function(predicate, context) { + return this.toKeyedSeq().reverse().findKey(predicate, context); + }, + first: function() { return this.find(returnTrue); }, @@ -4782,6 +4840,10 @@ return /******/ (function(modules) { // webpackBootstrap return iter.isSubset(this); }, + keyOf: function(searchValue) { + return this.findKey(function(value ) {return is(value, searchValue)}); + }, + keySeq: function() { return this.toSeq().map(keyMapper).toIndexedSeq(); }, @@ -4790,6 +4852,10 @@ return /******/ (function(modules) { // webpackBootstrap return this.toSeq().reverse().first(); }, + lastKeyOf: function(searchValue) { + return this.toKeyedSeq().reverse().keyOf(searchValue); + }, + max: function(comparator) { return maxFactory(this, comparator); }, @@ -4880,35 +4946,6 @@ return /******/ (function(modules) { // webpackBootstrap IterablePrototype.chain = IterablePrototype.flatMap; IterablePrototype.contains = IterablePrototype.includes; - // Temporary warning about using length - (function () { - try { - Object.defineProperty(IterablePrototype, 'length', { - get: function () { - if (!Iterable.noLengthWarning) { - var stack; - try { - throw new Error(); - } catch (error) { - stack = error.stack; - } - if (stack.indexOf('_wrapObject') === -1) { - console && console.warn && console.warn( - 'iterable.length has been deprecated, '+ - 'use iterable.size or iterable.count(). '+ - 'This warning will become a silent error in a future version. ' + - stack - ); - return this.size; - } - } - } - }); - } catch (e) {} - })(); - - - mixin(KeyedIterable, { // ### More sequential methods @@ -4917,23 +4954,6 @@ return /******/ (function(modules) { // webpackBootstrap return reify(this, flipFactory(this)); }, - findKey: function(predicate, context) { - var entry = this.findEntry(predicate, context); - return entry && entry[0]; - }, - - findLastKey: function(predicate, context) { - return this.toSeq().reverse().findKey(predicate, context); - }, - - keyOf: function(searchValue) { - return this.findKey(function(value ) {return is(value, searchValue)}); - }, - - lastKeyOf: function(searchValue) { - return this.findLastKey(function(value ) {return is(value, searchValue)}); - }, - mapEntries: function(mapper, context) {var this$0 = this; var iterations = 0; return reify(this, @@ -4982,12 +5002,13 @@ return /******/ (function(modules) { // webpackBootstrap }, indexOf: function(searchValue) { - var key = this.toKeyedSeq().keyOf(searchValue); + var key = this.keyOf(searchValue); return key === undefined ? -1 : key; }, lastIndexOf: function(searchValue) { - return this.toSeq().reverse().indexOf(searchValue); + var key = this.lastKeyOf(searchValue); + return key === undefined ? -1 : key; }, reverse: function() { @@ -5021,8 +5042,8 @@ return /******/ (function(modules) { // webpackBootstrap // ### More collection methods findLastIndex: function(predicate, context) { - var key = this.toKeyedSeq().findLastKey(predicate, context); - return key === undefined ? -1 : key; + var entry = this.findLastEntry(predicate, context); + return entry ? entry[0] : -1; }, first: function() { @@ -5063,6 +5084,10 @@ return /******/ (function(modules) { // webpackBootstrap return reify(this, interleaved); }, + keySeq: function() { + return Range(0, this.size); + }, + last: function() { return this.get(-1); }, @@ -5111,6 +5136,7 @@ return /******/ (function(modules) { // webpackBootstrap }); SetIterable.prototype.has = IterablePrototype.includes; + SetIterable.prototype.contains = SetIterable.prototype.includes; // Mixin subclasses @@ -5147,7 +5173,7 @@ return /******/ (function(modules) { // webpackBootstrap } function quoteString(value) { - return typeof value === 'string' ? JSON.stringify(value) : value; + return typeof value === 'string' ? JSON.stringify(value) : String(value); } function defaultZipper() { @@ -5178,12 +5204,12 @@ return /******/ (function(modules) { // webpackBootstrap } function murmurHashOfSize(size, h) { - h = src_Math__imul(h, 0xCC9E2D51); - h = src_Math__imul(h << 15 | h >>> -15, 0x1B873593); - h = src_Math__imul(h << 13 | h >>> -13, 5); + h = imul(h, 0xCC9E2D51); + h = imul(h << 15 | h >>> -15, 0x1B873593); + h = imul(h << 13 | h >>> -13, 5); h = (h + 0xE6546B64 | 0) ^ size; - h = src_Math__imul(h ^ h >>> 16, 0x85EBCA6B); - h = src_Math__imul(h ^ h >>> 13, 0xC2B2AE35); + h = imul(h ^ h >>> 16, 0x85EBCA6B); + h = imul(h ^ h >>> 13, 0xC2B2AE35); h = smi(h ^ h >>> 16); return h; } @@ -5198,11 +5224,11 @@ return /******/ (function(modules) { // webpackBootstrap Seq: Seq, Collection: Collection, - Map: src_Map__Map, + Map: Map, OrderedMap: OrderedMap, List: List, Stack: Stack, - Set: src_Set__Set, + Set: Set, OrderedSet: OrderedSet, Record: Record, @@ -5507,6 +5533,10 @@ return /******/ (function(modules) { // webpackBootstrap var fns = _interopRequireWildcard(_reactorFns); + var _reactorCache = __webpack_require__(9); + + var _logging = __webpack_require__(12); + var _keyPath = __webpack_require__(11); var _getter = __webpack_require__(10); @@ -5515,7 +5545,7 @@ return /******/ (function(modules) { // webpackBootstrap var _utils = __webpack_require__(4); - var _reactorRecords = __webpack_require__(12); + var _reactorRecords = __webpack_require__(13); /** * State is stored in NuclearJS Reactors. Reactors @@ -5535,8 +5565,16 @@ return /******/ (function(modules) { // webpackBootstrap var debug = !!config.debug; var baseOptions = debug ? _reactorRecords.DEBUG_OPTIONS : _reactorRecords.PROD_OPTIONS; + // if defined, merge the custom implementation over the noop logger to avoid undefined lookups, + // otherwise, just use the built-in console group logger + var logger = config.logger ? (0, _utils.extend)({}, _logging.NoopLogger, config.logger) : _logging.NoopLogger; + if (!config.logger && debug) { + logger = _logging.ConsoleGroupLogger; + } var initialReactorState = new _reactorRecords.ReactorState({ debug: debug, + cache: config.cache || (0, _reactorCache.DefaultCache)(), + logger: logger, // merge config options with the defaults options: baseOptions.merge(config.options || {}) }); @@ -5931,9 +5969,7 @@ return /******/ (function(modules) { // webpackBootstrap var _immutable2 = _interopRequireDefault(_immutable); - var _logging = __webpack_require__(9); - - var _logging2 = _interopRequireDefault(_logging); + var _cache = __webpack_require__(9); var _immutableHelpers = __webpack_require__(5); @@ -6019,6 +6055,8 @@ return /******/ (function(modules) { // webpackBootstrap */ function dispatch(reactorState, actionType, payload) { + var logging = reactorState.get('logger'); + if (actionType === undefined && getOption(reactorState, 'throwOnUndefinedActionType')) { throw new Error('`dispatch` cannot be called with an `undefined` action type.'); } @@ -6027,7 +6065,7 @@ return /******/ (function(modules) { // webpackBootstrap var dirtyStores = reactorState.get('dirtyStores'); var nextState = currState.withMutations(function (state) { - _logging2['default'].dispatchStart(reactorState, actionType, payload); + logging.dispatchStart(reactorState, actionType, payload); // let each store handle the message reactorState.get('stores').forEach(function (store, id) { @@ -6038,13 +6076,13 @@ return /******/ (function(modules) { // webpackBootstrap newState = store.handle(currState, actionType, payload); } catch (e) { // ensure console.group is properly closed - _logging2['default'].dispatchError(reactorState, e.message); + logging.dispatchError(reactorState, e.message); throw e; } if (newState === undefined && getOption(reactorState, 'throwOnUndefinedStoreReturnValue')) { var errorMsg = 'Store handler must return a value, did you forget a return statement'; - _logging2['default'].dispatchError(reactorState, errorMsg); + logging.dispatchError(reactorState, errorMsg); throw new Error(errorMsg); } @@ -6056,7 +6094,7 @@ return /******/ (function(modules) { // webpackBootstrap } }); - _logging2['default'].dispatchEnd(reactorState, state, dirtyStores); + logging.dispatchEnd(reactorState, state, dirtyStores, currState); }); var nextReactorState = reactorState.set('state', nextState).set('dirtyStores', dirtyStores).update('storeStates', function (storeStates) { @@ -6290,19 +6328,17 @@ return /******/ (function(modules) { // webpackBootstrap } // Must be a Getter - // if the value is cached for this dispatch cycle, return the cached value - if (isCached(reactorState, keyPathOrGetter)) { - // Cache hit - return evaluateResult(getCachedValue(reactorState, keyPathOrGetter), reactorState); - } - // evaluate dependencies - var args = (0, _getter.getDeps)(keyPathOrGetter).map(function (dep) { - return evaluate(reactorState, dep).result; - }); - var evaluatedValue = (0, _getter.getComputeFn)(keyPathOrGetter).apply(null, args); + var cache = reactorState.get('cache'); + var cacheEntry = cache.lookup(keyPathOrGetter); + var isCacheMiss = !cacheEntry || isDirtyCacheEntry(reactorState, cacheEntry); + if (isCacheMiss) { + cacheEntry = createCacheEntry(reactorState, keyPathOrGetter); + } - return evaluateResult(evaluatedValue, cacheValue(reactorState, keyPathOrGetter, evaluatedValue)); + return evaluateResult(cacheEntry.get('value'), reactorState.update('cache', function (cache) { + return isCacheMiss ? cache.miss(keyPathOrGetter, cacheEntry) : cache.hit(keyPathOrGetter); + })); } /** @@ -6333,57 +6369,33 @@ return /******/ (function(modules) { // webpackBootstrap return reactorState.set('dirtyStores', _immutable2['default'].Set()); } - /** - * Currently cache keys are always getters by reference - * @param {Getter} getter - * @return {Getter} - */ - function getCacheKey(getter) { - return getter; - } - - /** - * @param {ReactorState} reactorState - * @param {Getter|KeyPath} keyPathOrGetter - * @return {Immutable.Map} - */ - function getCacheEntry(reactorState, keyPathOrGetter) { - var key = getCacheKey(keyPathOrGetter); - return reactorState.getIn(['cache', key]); - } - /** * @param {ReactorState} reactorState - * @param {Getter} getter - * @return {Boolean} + * @param {CacheEntry} cacheEntry + * @return {boolean} */ - function isCached(reactorState, keyPathOrGetter) { - var entry = getCacheEntry(reactorState, keyPathOrGetter); - if (!entry) { - return false; - } - - var storeStates = entry.get('storeStates'); - if (storeStates.size === 0) { - // if there are no store states for this entry then it was never cached before - return false; - } + function isDirtyCacheEntry(reactorState, cacheEntry) { + var storeStates = cacheEntry.get('storeStates'); - return storeStates.every(function (stateId, storeId) { - return reactorState.getIn(['storeStates', storeId]) === stateId; + // if there are no store states for this entry then it was never cached before + return !storeStates.size || storeStates.some(function (stateId, storeId) { + return reactorState.getIn(['storeStates', storeId]) !== stateId; }); } /** - * Caches the value of a getter given state, getter, args, value + * Evaluates getter for given reactorState and returns CacheEntry * @param {ReactorState} reactorState * @param {Getter} getter - * @param {*} value - * @return {ReactorState} + * @return {CacheEntry} */ - function cacheValue(reactorState, getter, value) { - var cacheKey = getCacheKey(getter); - var dispatchId = reactorState.get('dispatchId'); + function createCacheEntry(reactorState, getter) { + // evaluate dependencies + var args = (0, _getter.getDeps)(getter).map(function (dep) { + return evaluate(reactorState, dep).result; + }); + var value = (0, _getter.getComputeFn)(getter).apply(null, args); + var storeDeps = (0, _getter.getStoreDeps)(getter); var storeStates = (0, _immutableHelpers.toImmutable)({}).withMutations(function (map) { storeDeps.forEach(function (storeId) { @@ -6392,19 +6404,11 @@ return /******/ (function(modules) { // webpackBootstrap }); }); - return reactorState.setIn(['cache', cacheKey], _immutable2['default'].Map({ + return (0, _cache.CacheEntry)({ value: value, storeStates: storeStates, - dispatchId: dispatchId - })); - } - - /** - * Pulls out the cached value for a getter - */ - function getCachedValue(reactorState, getter) { - var key = getCacheKey(getter); - return reactorState.getIn(['cache', key, 'value']); + dispatchId: reactorState.get('dispatchId') + }); } /** @@ -6437,56 +6441,268 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var _reactorFns = __webpack_require__(8); + Object.defineProperty(exports, '__esModule', { + value: true + }); + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + exports.DefaultCache = DefaultCache; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + var _immutable = __webpack_require__(3); + + var CacheEntry = (0, _immutable.Record)({ + value: null, + storeStates: (0, _immutable.Map)(), + dispatchId: null + }); + + exports.CacheEntry = CacheEntry; + /******************************************************************************* + * interface PersistentCache { + * has(item) + * lookup(item, notFoundValue) + * hit(item) + * miss(item, entry) + * evict(item) + * asMap() + * } + * + * Inspired by clojure.core.cache/CacheProtocol + *******************************************************************************/ - /* eslint-disable no-console */ /** - * Wraps a Reactor.react invocation in a console.group - * @param {ReactorState} reactorState - * @param {String} type - * @param {*} payload - */ - exports.dispatchStart = function (reactorState, type, payload) { - if (!(0, _reactorFns.getOption)(reactorState, 'logDispatches')) { - return; - } + * Plain map-based cache + */ - if (console.group) { - console.groupCollapsed('Dispatch: %s', type); - console.group('payload'); - console.debug(payload); - console.groupEnd(); - } - }; + var BasicCache = (function () { - exports.dispatchError = function (reactorState, error) { - if (!(0, _reactorFns.getOption)(reactorState, 'logDispatches')) { - return; - } + /** + * @param {Immutable.Map} cache + */ - if (console.group) { - console.debug('Dispatch error: ' + error); - console.groupEnd(); - } - }; + function BasicCache() { + var cache = arguments.length <= 0 || arguments[0] === undefined ? (0, _immutable.Map)() : arguments[0]; - exports.dispatchEnd = function (reactorState, state, dirtyStores) { - if (!(0, _reactorFns.getOption)(reactorState, 'logDispatches')) { - return; + _classCallCheck(this, BasicCache); + + this.cache = cache; } - if (console.group) { - if ((0, _reactorFns.getOption)(reactorState, 'logDirtyStores')) { - console.log('Stores updated:', dirtyStores.toList().toJS()); + /** + * Retrieve the associated value, if it exists in this cache, otherwise + * returns notFoundValue (or undefined if not provided) + * @param {Object} item + * @param {Object?} notFoundValue + * @return {CacheEntry?} + */ + + _createClass(BasicCache, [{ + key: 'lookup', + value: function lookup(item, notFoundValue) { + return this.cache.get(item, notFoundValue); + } + + /** + * Checks if this cache contains an associated value + * @param {Object} item + * @return {boolean} + */ + }, { + key: 'has', + value: function has(item) { + return this.cache.has(item); + } + + /** + * Return cached items as map + * @return {Immutable.Map} + */ + }, { + key: 'asMap', + value: function asMap() { + return this.cache; + } + + /** + * Updates this cache when it is determined to contain the associated value + * @param {Object} item + * @return {BasicCache} + */ + }, { + key: 'hit', + value: function hit(item) { + return this; + } + + /** + * Updates this cache when it is determined to **not** contain the associated value + * @param {Object} item + * @param {CacheEntry} entry + * @return {BasicCache} + */ + }, { + key: 'miss', + value: function miss(item, entry) { + return new BasicCache(this.cache.update(item, function (existingEntry) { + if (existingEntry && existingEntry.dispatchId > entry.dispatchId) { + throw new Error('Refusing to cache older value'); + } + return entry; + })); } - if ((0, _reactorFns.getOption)(reactorState, 'logAppState')) { - console.debug('Dispatch done, new state: ', state.toJS()); + /** + * Removes entry from cache + * @param {Object} item + * @return {BasicCache} + */ + }, { + key: 'evict', + value: function evict(item) { + return new BasicCache(this.cache.remove(item)); } - console.groupEnd(); + }]); + + return BasicCache; + })(); + + exports.BasicCache = BasicCache; + + var DEFAULT_LRU_LIMIT = 1000; + var DEFAULT_LRU_EVICT_COUNT = 1; + + /** + * Implements caching strategy that evicts least-recently-used items in cache + * when an item is being added to a cache that has reached a configured size + * limit. + */ + + var LRUCache = (function () { + function LRUCache() { + var limit = arguments.length <= 0 || arguments[0] === undefined ? DEFAULT_LRU_LIMIT : arguments[0]; + var evictCount = arguments.length <= 1 || arguments[1] === undefined ? DEFAULT_LRU_EVICT_COUNT : arguments[1]; + var cache = arguments.length <= 2 || arguments[2] === undefined ? new BasicCache() : arguments[2]; + var lru = arguments.length <= 3 || arguments[3] === undefined ? (0, _immutable.OrderedSet)() : arguments[3]; + + _classCallCheck(this, LRUCache); + + console.log("using LRU"); + this.limit = limit; + this.evictCount = evictCount; + this.cache = cache; + this.lru = lru; } - }; - /* eslint-enable no-console */ + + /** + * Returns default cache strategy + * @return {BasicCache} + */ + + /** + * Retrieve the associated value, if it exists in this cache, otherwise + * returns notFoundValue (or undefined if not provided) + * @param {Object} item + * @param {Object?} notFoundValue + * @return {CacheEntry} + */ + + _createClass(LRUCache, [{ + key: 'lookup', + value: function lookup(item, notFoundValue) { + return this.cache.lookup(item, notFoundValue); + } + + /** + * Checks if this cache contains an associated value + * @param {Object} item + * @return {boolean} + */ + }, { + key: 'has', + value: function has(item) { + return this.cache.has(item); + } + + /** + * Return cached items as map + * @return {Immutable.Map} + */ + }, { + key: 'asMap', + value: function asMap() { + return this.cache.asMap(); + } + + /** + * Updates this cache when it is determined to contain the associated value + * @param {Object} item + * @return {LRUCache} + */ + }, { + key: 'hit', + value: function hit(item) { + if (!this.cache.has(item)) { + return this; + } + + // remove it first to reorder in lru OrderedSet + return new LRUCache(this.limit, this.evictCount, this.cache, this.lru.remove(item).add(item)); + } + + /** + * Updates this cache when it is determined to **not** contain the associated value + * If cache has reached size limit, the LRU item is evicted. + * @param {Object} item + * @param {CacheEntry} entry + * @return {LRUCache} + */ + }, { + key: 'miss', + value: function miss(item, entry) { + var lruCache; + if (this.lru.size >= this.limit) { + if (this.has(item)) { + return new LRUCache(this.limit, this.evictCount, this.cache.miss(item, entry), this.lru.remove(item).add(item)); + } + + var cache = this.lru.take(this.evictCount).reduce(function (c, evictItem) { + return c.evict(evictItem); + }, this.cache).miss(item, entry); + + lruCache = new LRUCache(this.limit, this.evictCount, cache, this.lru.skip(this.evictCount).add(item)); + } else { + lruCache = new LRUCache(this.limit, this.evictCount, this.cache.miss(item, entry), this.lru.add(item)); + } + return lruCache; + } + + /** + * Removes entry from cache + * @param {Object} item + * @return {LRUCache} + */ + }, { + key: 'evict', + value: function evict(item) { + if (!this.cache.has(item)) { + return this; + } + + return new LRUCache(this.limit, this.evictCount, this.cache.evict(item), this.lru.remove(item)); + } + }]); + + return LRUCache; + })(); + + exports.LRUCache = LRUCache; + + function DefaultCache() { + return new BasicCache(); + } /***/ }, /* 10 */ @@ -6675,8 +6891,107 @@ return /******/ (function(modules) { // webpackBootstrap value: true }); + var _reactorFns = __webpack_require__(8); + + /* eslint-disable no-console */ + /** + * Wraps a Reactor.react invocation in a console.group + */ + var ConsoleGroupLogger = { + /** + * @param {ReactorState} reactorState + * @param {String} type + * @param {*} payload + */ + dispatchStart: function dispatchStart(reactorState, type, payload) { + if (!(0, _reactorFns.getOption)(reactorState, 'logDispatches')) { + return; + } + + if (console.group) { + console.groupCollapsed('Dispatch: %s', type); + console.group('payload'); + console.debug(payload); + console.groupEnd(); + } + }, + /** + * @param {ReactorState} reactorState + * @param {Error} error + */ + dispatchError: function dispatchError(reactorState, error) { + if (!(0, _reactorFns.getOption)(reactorState, 'logDispatches')) { + return; + } + + if (console.group) { + console.debug('Dispatch error: ' + error); + console.groupEnd(); + } + }, + /** + * @param {ReactorState} reactorState + * @param {Map} state + * @param {Set} dirtyStores + */ + dispatchEnd: function dispatchEnd(reactorState, state, dirtyStores, previousState) { + if (!(0, _reactorFns.getOption)(reactorState, 'logDispatches')) { + return; + } + + if (console.group) { + if ((0, _reactorFns.getOption)(reactorState, 'logDirtyStores')) { + console.log('Stores updated:', dirtyStores.toList().toJS()); + } + + if ((0, _reactorFns.getOption)(reactorState, 'logAppState')) { + console.debug('Dispatch done, new state: ', state.toJS()); + } + console.groupEnd(); + } + } + }; + + exports.ConsoleGroupLogger = ConsoleGroupLogger; + /* eslint-enable no-console */ + + var NoopLogger = { + /** + * @param {ReactorState} reactorState + * @param {String} type + * @param {*} payload + */ + dispatchStart: function dispatchStart(reactorState, type, payload) {}, + /** + * @param {ReactorState} reactorState + * @param {Error} error + */ + dispatchError: function dispatchError(reactorState, error) {}, + /** + * @param {ReactorState} reactorState + * @param {Map} state + * @param {Set} dirtyStores + */ + dispatchEnd: function dispatchEnd(reactorState, state, dirtyStores) {} + }; + exports.NoopLogger = NoopLogger; + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + var _immutable = __webpack_require__(3); + var _cache = __webpack_require__(9); + + var _logging = __webpack_require__(12); + var PROD_OPTIONS = (0, _immutable.Map)({ // logs information for each dispatch logDispatches: false, @@ -6717,7 +7032,8 @@ return /******/ (function(modules) { // webpackBootstrap dispatchId: 0, state: (0, _immutable.Map)(), stores: (0, _immutable.Map)(), - cache: (0, _immutable.Map)(), + cache: (0, _cache.DefaultCache)(), + logger: _logging.NoopLogger, // maintains a mapping of storeId => state id (monotomically increasing integer whenever store state changes) storeStates: (0, _immutable.Map)(), dirtyStores: (0, _immutable.Set)(), diff --git a/dist/nuclear.js.map b/dist/nuclear.js.map new file mode 100644 index 0000000..6882d7b --- /dev/null +++ b/dist/nuclear.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap be96e192894739a21c61","webpack:///./src/main.js","webpack:///./src/console-polyfill.js","webpack:///./src/store.js","webpack:///./~/immutable/dist/immutable.js","webpack:///./src/utils.js","webpack:///./src/immutable-helpers.js","webpack:///./src/reactor.js","webpack:///./src/create-react-mixin.js","webpack:///./src/reactor/fns.js","webpack:///./src/reactor/cache.js","webpack:///./src/getter.js","webpack:///./src/key-path.js","webpack:///./src/logging.js","webpack:///./src/reactor/records.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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ACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAoB,UAAU;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA,8CAA6C,wBAAwB;AACrE;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA,aAAY;AACZ;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,oCAAmC,KAAK;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;;AAEA;;AAEA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAsB,gBAAgB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAsB,gBAAgB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;;;;AAKA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAsB,gBAAgB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;;AAEA;AACA;AACA,wCAAuC,SAAS;AAChD;AACA;;AAEA;AACA;AACA,oFAAmF,yCAAyC;AAC5H;AACA;AACA,kFAAiF,yCAAyC;AAC1H;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C;AAC7C;AACA,0BAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAsB,gBAAgB;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA,4DAA2D;AAC3D;AACA;AACA,UAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAsB,gBAAgB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;;;AAGA,4CAA2C;;AAE3C,8CAA6C;;AAE7C,0CAAyC;;;AAGzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAgB;AAChB,iBAAgB;AAChB;AACA;AACA;AACA,8EAA6E;AAC7E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAoB,oBAAoB;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA,QAAO;AACP,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,+BAA8B,SAAS;AACvC;AACA,MAAK;AACL;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAwC,qBAAqB;AAC7D,UAAS;AACT;;AAEA,0BAAyB;AACzB;AACA,wBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA,oCAAmC,KAAK;AACxC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,2DAA0D,SAAS;AACnE;;AAEA;AACA;AACA;;AAEA;AACA,kDAAiD,eAAe;AAChE;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,iDAAgD;AAChD;AACA;;AAEA,gDAA+C;AAC/C;AACA;AACA;AACA,uBAAsB;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qDAAoD;AACpD;AACA;;AAEA,oDAAmD;AACnD;AACA;AACA;AACA,uBAAsB;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sDAAqD;AACrD;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA;;;;AAIA;AACA;AACA;AACA;;AAEA;AACA;AACA,6CAA4C,UAAU;AACtD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qCAAoC,WAAW;AAC/C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,gBAAe;AACf;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA,QAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6CAA4C,UAAU;AACtD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAoC,WAAW;AAC/C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA,QAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,gBAAe;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;AAIA;;AAEA;AACA;AACA;AACA,oDAAmD,gBAAgB;AACnE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kDAAiD,gBAAgB;AACjE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,qBAAoB,qBAAqB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kDAAiD,UAAU;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAoB,cAAc;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,qBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA,uCAAsC,iBAAiB;AACvD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wCAAuC,oBAAoB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA,UAAS;AACT;AACA;AACA;AACA,uBAAsB,mBAAmB;AACzC;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAoB,aAAa;AACjC;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAoB,aAAa;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAsC,sBAAsB;AAC5D,QAAO;AACP;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yBAAwB,oBAAoB;AAC5C;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yBAAwB,oBAAoB;AAC5C;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,kDAAiD;AACjD;AACA;;AAEA;AACA;AACA;;AAEA,sDAAqD;AACrD;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAwB,kBAAkB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iCAAgC,eAAe;AAC/C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,uCAAsC,iBAAiB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAwC,qBAAqB;AAC7D,UAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA,2CAA0C,KAAK;AAC/C;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,6DAA4D;AAC5D;AACA,2BAA0B,+CAA+C;AACzE;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAwB;AACxB;AACA;AACA;AACA;AACA,sDAAqD,wCAAwC;AAC7F,6DAA4D,gBAAgB;AAC5E;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qDAAoD;AACpD;AACA;AACA,kDAAiD;AACjD;AACA;AACA;;AAEA,gEAA+D;AAC/D;AACA;AACA,gDAA+C;AAC/C;AACA;AACA;;AAEA,kEAAiE;AACjE;AACA;AACA;AACA,4BAA2B,wBAAwB;AACnD;AACA,2BAA0B,4CAA4C;AACtE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,oEAAmE;AACnE;AACA,iDAAgD,mCAAmC;AACnF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gEAA+D;AAC/D,iDAAgD,wBAAwB;AACxE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sEAAqE;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;;AAGA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,sCAAqC;AACrC;AACA,2DAA0D;AAC1D,4CAA2C;AAC3C;AACA;AACA,wCAAuC;AACvC,6CAA4C;AAC5C;AACA,8DAA6D;AAC7D,kDAAiD,kCAAkC;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA,0CAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,gEAA+D;AAC/D;AACA,6BAA4B,8DAA8D;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,6CAA4C;AAC5C;AACA;AACA;AACA,6CAA4C;AAC5C;AACA;AACA;AACA;AACA,QAAO;AACP;AACA,QAAO;AACP,mDAAkD;AAClD;AACA,0DAAyD;AACzD,kDAAiD,wBAAwB;AACzE;AACA;AACA,iCAAgC;AAChC;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAsB;AACtB;AACA,MAAK;AACL;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAsB;AACtB;AACA,MAAK;AACL;AACA,uCAAsC,oCAAoC;AAC1E;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yDAAwD;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA,UAAS;AACT;AACA;AACA,QAAO;AACP;;AAEA;AACA;;;AAGA;AACA;AACA,6DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,gEAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;;;AAGA;AACA;AACA,8DAA6D;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA,gEAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA,cAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA,QAAO;AACP;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA,MAAK,uBAAuB,oBAAoB;;AAEhD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,8CAA6C;AAC7C;AACA;AACA;AACA,YAAW;AACX;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;;;AAGA;AACA;AACA;AACA,wBAAuB;AACvB;AACA;;;AAGA;AACA;AACA;AACA,mEAAkE;AAClE;AACA;AACA,UAAS;AACT,+CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAuB;AACvB;AACA,mCAAkC,6CAA6C;AAC/E;AACA,wBAAuB,uBAAuB,EAAE;AAChD,wBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA8B,mCAAmC;AACjE,kCAAiC,kDAAkD;AACnF;AACA,MAAK;AACL,+CAA8C,4CAA4C;AAC1F;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA,8DAA6D,cAAc;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,+CAA8C,gBAAgB;AAC9D,6CAA4C,cAAc;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAqD,eAAe;AACpE;AACA,QAAO;AACP;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,oDAAmD,KAAK;AACxD;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,4DAA2D;AAC3D,sEAAqE,qBAAqB;AAC1F;;AAEA,yDAAwD;AACxD,sEAAqE,qBAAqB;AAC1F;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAqC,kBAAkB;AACvD,UAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,oCAAmC,KAAK;AACxC;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,uCAAsC;AACtC,0CAAyC,oBAAoB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAwB,mBAAmB;AAC3C,4DAA2D,sBAAsB;AACjF;AACA,QAAO;AACP;;AAEA,2CAA0C;AAC1C;AACA;AACA;AACA,0CAAyC,yBAAyB;AAClE;AACA;AACA;AACA,6CAA4C,4BAA4B;AACxE;AACA;AACA,UAAS;AACT,QAAO;AACP;;AAEA,0CAAyC;AACzC;AACA;AACA;AACA,0CAAyC,yBAAyB;AAClE;AACA;AACA;AACA,2CAA0C,4BAA4B;AACtE;AACA;AACA,UAAS;AACT,QAAO;AACP;;AAEA;AACA;AACA;;AAEA,iDAAgD;AAChD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sDAAqD;AACrD,mDAAkD,wBAAwB;AAC1E;;AAEA;AACA,6CAA4C,SAAS;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAqC,kBAAkB;AACvD,UAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,2CAA0C,KAAK;AAC/C;;;AAGA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0CAAyC,SAAS;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;;AAGA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qCAAoC,oCAAoC;AACxE;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,kDAAiD,cAAc,EAAE;AACjE;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,2BAA0B;AAC1B;AACA,MAAK;;AAEL;AACA;AACA,2BAA0B;AAC1B;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,uCAAsC,eAAe,EAAE;AACvD;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;;AAGL;;AAEA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,MAAK;;;AAGL;;AAEA,yBAAwB;AACxB;AACA,MAAK;;AAEL;AACA,0CAAyC,8BAA8B;AACvE,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA,QAAO;AACP;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;;AAGL;;AAEA;AACA;AACA,MAAK;;AAEL;AACA,kFAAiF,YAAY;AAC7F,MAAK;;AAEL;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAkD;AAClD;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA,2CAA0C,0BAA0B;AACpE,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,2CAA0C,4BAA4B;AACtE,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;AAEL;AACA,6CAA4C,8BAA8B;AAC1E,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;;AAGL;;AAEA;AACA;AACA;;;AAGA;;AAEA;;AAEA;AACA,IAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA2C,wBAAwB;AACnE;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,MAAK;;AAEL,4CAA2C;AAC3C;AACA;AACA;AACA,4BAA2B;AAC3B;AACA;AACA,MAAK;;AAEL,yCAAwC;AACxC;AACA;AACA,4BAA2B;AAC3B;AACA;AACA;;AAEA,IAAG;;AAEH;AACA;AACA;AACA;AACA,8DAA6D;;;;AAI7D;;AAEA;;AAEA;AACA;AACA,MAAK;;;AAGL;;AAEA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;;AAGL;;AAEA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,sCAAqC,qBAAqB;AAC1D,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,IAAG;;AAEH;AACA;;;;AAIA;;AAEA;;AAEA;AACA;A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,EAAE,uBAAS,YAAY,EAAE,KAAK,EAAE,EAC5C;;;;;;AAMD,cAAW,EAAE,qBAAS,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,EACvD;EACF;;;;;;;;;;;;;;;;sCCpFgC,kBAAW;;kCACf,gBAAS;;oCACX,oBAAY;;AAEhC,KAAM,YAAY,GAAG,oBAAI;;AAE9B,gBAAa,EAAE,KAAK;;AAEpB,cAAW,EAAE,KAAK;;AAElB,iBAAc,EAAE,KAAK;;AAErB,6BAA0B,EAAE,KAAK;;AAEjC,mCAAgC,EAAE,KAAK;;AAEvC,2BAAwB,EAAE,KAAK;;AAE/B,4BAAyB,EAAE,KAAK;EACjC,CAAC;;;AAEK,KAAM,aAAa,GAAG,oBAAI;;AAE/B,gBAAa,EAAE,IAAI;;AAEnB,cAAW,EAAE,IAAI;;AAEjB,iBAAc,EAAE,IAAI;;AAEpB,6BAA0B,EAAE,IAAI;;AAEhC,mCAAgC,EAAE,IAAI;;AAEtC,2BAAwB,EAAE,IAAI;;AAE9B,4BAAyB,EAAE,IAAI;EAChC,CAAC;;;AAEK,KAAM,YAAY,GAAG,uBAAO;AACjC,aAAU,EAAE,CAAC;AACb,QAAK,EAAE,qBAAK;AACZ,SAAM,EAAE,qBAAK;AACb,QAAK,EAAE,0BAAc;AACrB,SAAM,qBAAY;;AAElB,cAAW,EAAE,qBAAK;AAClB,cAAW,EAAE,qBAAK;AAClB,QAAK,EAAE,KAAK;;AAEZ,UAAO,EAAE,YAAY;EACtB,CAAC;;;AAEK,KAAM,aAAa,GAAG,uBAAO;;AAElC,MAAG,EAAE,qBAAK;;AAEV,SAAM,EAAE,oBAAI,EAAE,CAAC;;AAEf,eAAY,EAAE,oBAAI,EAAE,CAAC;;AAErB,SAAM,EAAE,CAAC;EACV,CAAC","file":"./dist/nuclear.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Nuclear\"] = factory();\n\telse\n\t\troot[\"Nuclear\"] = factory();\n})(this, function() {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap be96e192894739a21c61\n **/","import './console-polyfill'\nimport Store from './store'\nimport Reactor from './reactor'\nimport Immutable from 'immutable'\nimport { toJS, toImmutable, isImmutable } from './immutable-helpers'\nimport { isKeyPath } from './key-path'\nimport { isGetter } from './getter'\nimport { LRUCache } from './reactor/cache'\nimport createReactMixin from './create-react-mixin'\n\nexport default {\n Reactor,\n Store,\n Immutable,\n isKeyPath,\n isGetter,\n toJS,\n toImmutable,\n isImmutable,\n createReactMixin,\n LRUCache,\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/main.js\n **/","try {\n /* eslint-disable no-console */\n if (!(window.console && console.log)) {\n /* eslint-enable no-console */\n console = {\n log: function() {},\n debug: function() {},\n info: function() {},\n warn: function() {},\n error: function() {},\n }\n }\n} catch(e) {\n // ignored\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/console-polyfill.js\n **/","import { Map } from 'immutable'\nimport { toFactory, extend } from './utils'\nimport { toJS, toImmutable } from './immutable-helpers'\n\n/**\n * Stores define how a certain domain of the application should respond to actions\n * taken on the whole system. They manage their own section of the entire app state\n * and have no knowledge about the other parts of the application state.\n */\nclass Store {\n constructor(config) {\n this.__handlers = Map({})\n\n if (config) {\n // allow `MyStore extends Store` syntax without throwing error\n extend(this, config)\n }\n\n this.initialize()\n }\n\n /**\n * This method is overridden by extending classes to setup message handlers\n * via `this.on` and to set up the initial state\n *\n * Anything returned from this function will be coerced into an ImmutableJS value\n * and set as the initial state for the part of the ReactorCore\n */\n initialize() {\n // extending classes implement to setup action handlers\n }\n\n /**\n * Overridable method to get the initial state for this type of store\n */\n getInitialState() {\n return Map()\n }\n\n /**\n * Takes a current reactor state, action type and payload\n * does the reaction and returns the new state\n */\n handle(state, type, payload) {\n const handler = this.__handlers.get(type)\n\n if (typeof handler === 'function') {\n return handler.call(this, state, payload, type)\n }\n\n return state\n }\n\n /**\n * Pure function taking the current state of store and returning\n * the new state after a NuclearJS reactor has been reset\n *\n * Overridable\n */\n handleReset(state) {\n return this.getInitialState()\n }\n\n /**\n * Binds an action type => handler\n */\n on(actionType, handler) {\n this.__handlers = this.__handlers.set(actionType, handler)\n }\n\n /**\n * Serializes store state to plain JSON serializable JavaScript\n * Overridable\n * @param {*}\n * @return {*}\n */\n serialize(state) {\n return toJS(state)\n }\n\n /**\n * Deserializes plain JavaScript to store state\n * Overridable\n * @param {*}\n * @return {*}\n */\n deserialize(state) {\n return toImmutable(state)\n }\n}\n\nexport function isStore(toTest) {\n return (toTest instanceof Store)\n}\n\nexport default toFactory(Store)\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/store.js\n **/","/**\n * Copyright (c) 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.Immutable = factory());\n}(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice;\n\n function createClass(ctor, superClass) {\n if (superClass) {\n ctor.prototype = Object.create(superClass.prototype);\n }\n ctor.prototype.constructor = ctor;\n }\n\n function Iterable(value) {\n return isIterable(value) ? value : Seq(value);\n }\n\n\n createClass(KeyedIterable, Iterable);\n function KeyedIterable(value) {\n return isKeyed(value) ? value : KeyedSeq(value);\n }\n\n\n createClass(IndexedIterable, Iterable);\n function IndexedIterable(value) {\n return isIndexed(value) ? value : IndexedSeq(value);\n }\n\n\n createClass(SetIterable, Iterable);\n function SetIterable(value) {\n return isIterable(value) && !isAssociative(value) ? value : SetSeq(value);\n }\n\n\n\n function isIterable(maybeIterable) {\n return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]);\n }\n\n function isKeyed(maybeKeyed) {\n return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]);\n }\n\n function isIndexed(maybeIndexed) {\n return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]);\n }\n\n function isAssociative(maybeAssociative) {\n return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);\n }\n\n function isOrdered(maybeOrdered) {\n return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]);\n }\n\n Iterable.isIterable = isIterable;\n Iterable.isKeyed = isKeyed;\n Iterable.isIndexed = isIndexed;\n Iterable.isAssociative = isAssociative;\n Iterable.isOrdered = isOrdered;\n\n Iterable.Keyed = KeyedIterable;\n Iterable.Indexed = IndexedIterable;\n Iterable.Set = SetIterable;\n\n\n var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n // Used for setting prototype methods that IE8 chokes on.\n var DELETE = 'delete';\n\n // Constants describing the size of trie nodes.\n var SHIFT = 5; // Resulted in best performance after ______?\n var SIZE = 1 << SHIFT;\n var MASK = SIZE - 1;\n\n // A consistent shared value representing \"not set\" which equals nothing other\n // than itself, and nothing that could be provided externally.\n var NOT_SET = {};\n\n // Boolean references, Rough equivalent of `bool &`.\n var CHANGE_LENGTH = { value: false };\n var DID_ALTER = { value: false };\n\n function MakeRef(ref) {\n ref.value = false;\n return ref;\n }\n\n function SetRef(ref) {\n ref && (ref.value = true);\n }\n\n // A function which returns a value representing an \"owner\" for transient writes\n // to tries. The return value will only ever equal itself, and will not equal\n // the return of any subsequent call of this function.\n function OwnerID() {}\n\n // http://jsperf.com/copy-array-inline\n function arrCopy(arr, offset) {\n offset = offset || 0;\n var len = Math.max(0, arr.length - offset);\n var newArr = new Array(len);\n for (var ii = 0; ii < len; ii++) {\n newArr[ii] = arr[ii + offset];\n }\n return newArr;\n }\n\n function ensureSize(iter) {\n if (iter.size === undefined) {\n iter.size = iter.__iterate(returnTrue);\n }\n return iter.size;\n }\n\n function wrapIndex(iter, index) {\n // This implements \"is array index\" which the ECMAString spec defines as:\n //\n // A String property name P is an array index if and only if\n // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal\n // to 2^32−1.\n //\n // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects\n if (typeof index !== 'number') {\n var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32\n if ('' + uint32Index !== index || uint32Index === 4294967295) {\n return NaN;\n }\n index = uint32Index;\n }\n return index < 0 ? ensureSize(iter) + index : index;\n }\n\n function returnTrue() {\n return true;\n }\n\n function wholeSlice(begin, end, size) {\n return (begin === 0 || (size !== undefined && begin <= -size)) &&\n (end === undefined || (size !== undefined && end >= size));\n }\n\n function resolveBegin(begin, size) {\n return resolveIndex(begin, size, 0);\n }\n\n function resolveEnd(end, size) {\n return resolveIndex(end, size, size);\n }\n\n function resolveIndex(index, size, defaultIndex) {\n return index === undefined ?\n defaultIndex :\n index < 0 ?\n Math.max(0, size + index) :\n size === undefined ?\n index :\n Math.min(size, index);\n }\n\n /* global Symbol */\n\n var ITERATE_KEYS = 0;\n var ITERATE_VALUES = 1;\n var ITERATE_ENTRIES = 2;\n\n var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n var FAUX_ITERATOR_SYMBOL = '@@iterator';\n\n var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;\n\n\n function Iterator(next) {\n this.next = next;\n }\n\n Iterator.prototype.toString = function() {\n return '[Iterator]';\n };\n\n\n Iterator.KEYS = ITERATE_KEYS;\n Iterator.VALUES = ITERATE_VALUES;\n Iterator.ENTRIES = ITERATE_ENTRIES;\n\n Iterator.prototype.inspect =\n Iterator.prototype.toSource = function () { return this.toString(); }\n Iterator.prototype[ITERATOR_SYMBOL] = function () {\n return this;\n };\n\n\n function iteratorValue(type, k, v, iteratorResult) {\n var value = type === 0 ? k : type === 1 ? v : [k, v];\n iteratorResult ? (iteratorResult.value = value) : (iteratorResult = {\n value: value, done: false\n });\n return iteratorResult;\n }\n\n function iteratorDone() {\n return { value: undefined, done: true };\n }\n\n function hasIterator(maybeIterable) {\n return !!getIteratorFn(maybeIterable);\n }\n\n function isIterator(maybeIterator) {\n return maybeIterator && typeof maybeIterator.next === 'function';\n }\n\n function getIterator(iterable) {\n var iteratorFn = getIteratorFn(iterable);\n return iteratorFn && iteratorFn.call(iterable);\n }\n\n function getIteratorFn(iterable) {\n var iteratorFn = iterable && (\n (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) ||\n iterable[FAUX_ITERATOR_SYMBOL]\n );\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n }\n\n function isArrayLike(value) {\n return value && typeof value.length === 'number';\n }\n\n createClass(Seq, Iterable);\n function Seq(value) {\n return value === null || value === undefined ? emptySequence() :\n isIterable(value) ? value.toSeq() : seqFromValue(value);\n }\n\n Seq.of = function(/*...values*/) {\n return Seq(arguments);\n };\n\n Seq.prototype.toSeq = function() {\n return this;\n };\n\n Seq.prototype.toString = function() {\n return this.__toString('Seq {', '}');\n };\n\n Seq.prototype.cacheResult = function() {\n if (!this._cache && this.__iterateUncached) {\n this._cache = this.entrySeq().toArray();\n this.size = this._cache.length;\n }\n return this;\n };\n\n // abstract __iterateUncached(fn, reverse)\n\n Seq.prototype.__iterate = function(fn, reverse) {\n return seqIterate(this, fn, reverse, true);\n };\n\n // abstract __iteratorUncached(type, reverse)\n\n Seq.prototype.__iterator = function(type, reverse) {\n return seqIterator(this, type, reverse, true);\n };\n\n\n\n createClass(KeyedSeq, Seq);\n function KeyedSeq(value) {\n return value === null || value === undefined ?\n emptySequence().toKeyedSeq() :\n isIterable(value) ?\n (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) :\n keyedSeqFromValue(value);\n }\n\n KeyedSeq.prototype.toKeyedSeq = function() {\n return this;\n };\n\n\n\n createClass(IndexedSeq, Seq);\n function IndexedSeq(value) {\n return value === null || value === undefined ? emptySequence() :\n !isIterable(value) ? indexedSeqFromValue(value) :\n isKeyed(value) ? value.entrySeq() : value.toIndexedSeq();\n }\n\n IndexedSeq.of = function(/*...values*/) {\n return IndexedSeq(arguments);\n };\n\n IndexedSeq.prototype.toIndexedSeq = function() {\n return this;\n };\n\n IndexedSeq.prototype.toString = function() {\n return this.__toString('Seq [', ']');\n };\n\n IndexedSeq.prototype.__iterate = function(fn, reverse) {\n return seqIterate(this, fn, reverse, false);\n };\n\n IndexedSeq.prototype.__iterator = function(type, reverse) {\n return seqIterator(this, type, reverse, false);\n };\n\n\n\n createClass(SetSeq, Seq);\n function SetSeq(value) {\n return (\n value === null || value === undefined ? emptySequence() :\n !isIterable(value) ? indexedSeqFromValue(value) :\n isKeyed(value) ? value.entrySeq() : value\n ).toSetSeq();\n }\n\n SetSeq.of = function(/*...values*/) {\n return SetSeq(arguments);\n };\n\n SetSeq.prototype.toSetSeq = function() {\n return this;\n };\n\n\n\n Seq.isSeq = isSeq;\n Seq.Keyed = KeyedSeq;\n Seq.Set = SetSeq;\n Seq.Indexed = IndexedSeq;\n\n var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';\n\n Seq.prototype[IS_SEQ_SENTINEL] = true;\n\n\n\n createClass(ArraySeq, IndexedSeq);\n function ArraySeq(array) {\n this._array = array;\n this.size = array.length;\n }\n\n ArraySeq.prototype.get = function(index, notSetValue) {\n return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;\n };\n\n ArraySeq.prototype.__iterate = function(fn, reverse) {\n var array = this._array;\n var maxIndex = array.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n ArraySeq.prototype.__iterator = function(type, reverse) {\n var array = this._array;\n var maxIndex = array.length - 1;\n var ii = 0;\n return new Iterator(function() \n {return ii > maxIndex ?\n iteratorDone() :\n iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])}\n );\n };\n\n\n\n createClass(ObjectSeq, KeyedSeq);\n function ObjectSeq(object) {\n var keys = Object.keys(object);\n this._object = object;\n this._keys = keys;\n this.size = keys.length;\n }\n\n ObjectSeq.prototype.get = function(key, notSetValue) {\n if (notSetValue !== undefined && !this.has(key)) {\n return notSetValue;\n }\n return this._object[key];\n };\n\n ObjectSeq.prototype.has = function(key) {\n return this._object.hasOwnProperty(key);\n };\n\n ObjectSeq.prototype.__iterate = function(fn, reverse) {\n var object = this._object;\n var keys = this._keys;\n var maxIndex = keys.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n var key = keys[reverse ? maxIndex - ii : ii];\n if (fn(object[key], key, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n ObjectSeq.prototype.__iterator = function(type, reverse) {\n var object = this._object;\n var keys = this._keys;\n var maxIndex = keys.length - 1;\n var ii = 0;\n return new Iterator(function() {\n var key = keys[reverse ? maxIndex - ii : ii];\n return ii++ > maxIndex ?\n iteratorDone() :\n iteratorValue(type, key, object[key]);\n });\n };\n\n ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n createClass(IterableSeq, IndexedSeq);\n function IterableSeq(iterable) {\n this._iterable = iterable;\n this.size = iterable.length || iterable.size;\n }\n\n IterableSeq.prototype.__iterateUncached = function(fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterable = this._iterable;\n var iterator = getIterator(iterable);\n var iterations = 0;\n if (isIterator(iterator)) {\n var step;\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n }\n return iterations;\n };\n\n IterableSeq.prototype.__iteratorUncached = function(type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterable = this._iterable;\n var iterator = getIterator(iterable);\n if (!isIterator(iterator)) {\n return new Iterator(iteratorDone);\n }\n var iterations = 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step : iteratorValue(type, iterations++, step.value);\n });\n };\n\n\n\n createClass(IteratorSeq, IndexedSeq);\n function IteratorSeq(iterator) {\n this._iterator = iterator;\n this._iteratorCache = [];\n }\n\n IteratorSeq.prototype.__iterateUncached = function(fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterator = this._iterator;\n var cache = this._iteratorCache;\n var iterations = 0;\n while (iterations < cache.length) {\n if (fn(cache[iterations], iterations++, this) === false) {\n return iterations;\n }\n }\n var step;\n while (!(step = iterator.next()).done) {\n var val = step.value;\n cache[iterations] = val;\n if (fn(val, iterations++, this) === false) {\n break;\n }\n }\n return iterations;\n };\n\n IteratorSeq.prototype.__iteratorUncached = function(type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = this._iterator;\n var cache = this._iteratorCache;\n var iterations = 0;\n return new Iterator(function() {\n if (iterations >= cache.length) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n cache[iterations] = step.value;\n }\n return iteratorValue(type, iterations, cache[iterations++]);\n });\n };\n\n\n\n\n // # pragma Helper functions\n\n function isSeq(maybeSeq) {\n return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]);\n }\n\n var EMPTY_SEQ;\n\n function emptySequence() {\n return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));\n }\n\n function keyedSeqFromValue(value) {\n var seq =\n Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() :\n isIterator(value) ? new IteratorSeq(value).fromEntrySeq() :\n hasIterator(value) ? new IterableSeq(value).fromEntrySeq() :\n typeof value === 'object' ? new ObjectSeq(value) :\n undefined;\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of [k, v] entries, '+\n 'or keyed object: ' + value\n );\n }\n return seq;\n }\n\n function indexedSeqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value);\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of values: ' + value\n );\n }\n return seq;\n }\n\n function seqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value) ||\n (typeof value === 'object' && new ObjectSeq(value));\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of values, or keyed object: ' + value\n );\n }\n return seq;\n }\n\n function maybeIndexedSeqFromValue(value) {\n return (\n isArrayLike(value) ? new ArraySeq(value) :\n isIterator(value) ? new IteratorSeq(value) :\n hasIterator(value) ? new IterableSeq(value) :\n undefined\n );\n }\n\n function seqIterate(seq, fn, reverse, useKeys) {\n var cache = seq._cache;\n if (cache) {\n var maxIndex = cache.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n var entry = cache[reverse ? maxIndex - ii : ii];\n if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) {\n return ii + 1;\n }\n }\n return ii;\n }\n return seq.__iterateUncached(fn, reverse);\n }\n\n function seqIterator(seq, type, reverse, useKeys) {\n var cache = seq._cache;\n if (cache) {\n var maxIndex = cache.length - 1;\n var ii = 0;\n return new Iterator(function() {\n var entry = cache[reverse ? maxIndex - ii : ii];\n return ii++ > maxIndex ?\n iteratorDone() :\n iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]);\n });\n }\n return seq.__iteratorUncached(type, reverse);\n }\n\n function fromJS(json, converter) {\n return converter ?\n fromJSWith(converter, json, '', {'': json}) :\n fromJSDefault(json);\n }\n\n function fromJSWith(converter, json, key, parentJSON) {\n if (Array.isArray(json)) {\n return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)}));\n }\n if (isPlainObj(json)) {\n return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)}));\n }\n return json;\n }\n\n function fromJSDefault(json) {\n if (Array.isArray(json)) {\n return IndexedSeq(json).map(fromJSDefault).toList();\n }\n if (isPlainObj(json)) {\n return KeyedSeq(json).map(fromJSDefault).toMap();\n }\n return json;\n }\n\n function isPlainObj(value) {\n return value && (value.constructor === Object || value.constructor === undefined);\n }\n\n /**\n * An extension of the \"same-value\" algorithm as [described for use by ES6 Map\n * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)\n *\n * NaN is considered the same as NaN, however -0 and 0 are considered the same\n * value, which is different from the algorithm described by\n * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n *\n * This is extended further to allow Objects to describe the values they\n * represent, by way of `valueOf` or `equals` (and `hashCode`).\n *\n * Note: because of this extension, the key equality of Immutable.Map and the\n * value equality of Immutable.Set will differ from ES6 Map and Set.\n *\n * ### Defining custom values\n *\n * The easiest way to describe the value an object represents is by implementing\n * `valueOf`. For example, `Date` represents a value by returning a unix\n * timestamp for `valueOf`:\n *\n * var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...\n * var date2 = new Date(1234567890000);\n * date1.valueOf(); // 1234567890000\n * assert( date1 !== date2 );\n * assert( Immutable.is( date1, date2 ) );\n *\n * Note: overriding `valueOf` may have other implications if you use this object\n * where JavaScript expects a primitive, such as implicit string coercion.\n *\n * For more complex types, especially collections, implementing `valueOf` may\n * not be performant. An alternative is to implement `equals` and `hashCode`.\n *\n * `equals` takes another object, presumably of similar type, and returns true\n * if the it is equal. Equality is symmetrical, so the same result should be\n * returned if this and the argument are flipped.\n *\n * assert( a.equals(b) === b.equals(a) );\n *\n * `hashCode` returns a 32bit integer number representing the object which will\n * be used to determine how to store the value object in a Map or Set. You must\n * provide both or neither methods, one must not exist without the other.\n *\n * Also, an important relationship between these methods must be upheld: if two\n * values are equal, they *must* return the same hashCode. If the values are not\n * equal, they might have the same hashCode; this is called a hash collision,\n * and while undesirable for performance reasons, it is acceptable.\n *\n * if (a.equals(b)) {\n * assert( a.hashCode() === b.hashCode() );\n * }\n *\n * All Immutable collections implement `equals` and `hashCode`.\n *\n */\n function is(valueA, valueB) {\n if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n return true;\n }\n if (!valueA || !valueB) {\n return false;\n }\n if (typeof valueA.valueOf === 'function' &&\n typeof valueB.valueOf === 'function') {\n valueA = valueA.valueOf();\n valueB = valueB.valueOf();\n if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n return true;\n }\n if (!valueA || !valueB) {\n return false;\n }\n }\n if (typeof valueA.equals === 'function' &&\n typeof valueB.equals === 'function' &&\n valueA.equals(valueB)) {\n return true;\n }\n return false;\n }\n\n function deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (\n !isIterable(b) ||\n a.size !== undefined && b.size !== undefined && a.size !== b.size ||\n a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash ||\n isKeyed(a) !== isKeyed(b) ||\n isIndexed(a) !== isIndexed(b) ||\n isOrdered(a) !== isOrdered(b)\n ) {\n return false;\n }\n\n if (a.size === 0 && b.size === 0) {\n return true;\n }\n\n var notAssociative = !isAssociative(a);\n\n if (isOrdered(a)) {\n var entries = a.entries();\n return b.every(function(v, k) {\n var entry = entries.next().value;\n return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));\n }) && entries.next().done;\n }\n\n var flipped = false;\n\n if (a.size === undefined) {\n if (b.size === undefined) {\n if (typeof a.cacheResult === 'function') {\n a.cacheResult();\n }\n } else {\n flipped = true;\n var _ = a;\n a = b;\n b = _;\n }\n }\n\n var allEqual = true;\n var bSize = b.__iterate(function(v, k) {\n if (notAssociative ? !a.has(v) :\n flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) {\n allEqual = false;\n return false;\n }\n });\n\n return allEqual && a.size === bSize;\n }\n\n createClass(Repeat, IndexedSeq);\n\n function Repeat(value, times) {\n if (!(this instanceof Repeat)) {\n return new Repeat(value, times);\n }\n this._value = value;\n this.size = times === undefined ? Infinity : Math.max(0, times);\n if (this.size === 0) {\n if (EMPTY_REPEAT) {\n return EMPTY_REPEAT;\n }\n EMPTY_REPEAT = this;\n }\n }\n\n Repeat.prototype.toString = function() {\n if (this.size === 0) {\n return 'Repeat []';\n }\n return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';\n };\n\n Repeat.prototype.get = function(index, notSetValue) {\n return this.has(index) ? this._value : notSetValue;\n };\n\n Repeat.prototype.includes = function(searchValue) {\n return is(this._value, searchValue);\n };\n\n Repeat.prototype.slice = function(begin, end) {\n var size = this.size;\n return wholeSlice(begin, end, size) ? this :\n new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size));\n };\n\n Repeat.prototype.reverse = function() {\n return this;\n };\n\n Repeat.prototype.indexOf = function(searchValue) {\n if (is(this._value, searchValue)) {\n return 0;\n }\n return -1;\n };\n\n Repeat.prototype.lastIndexOf = function(searchValue) {\n if (is(this._value, searchValue)) {\n return this.size;\n }\n return -1;\n };\n\n Repeat.prototype.__iterate = function(fn, reverse) {\n for (var ii = 0; ii < this.size; ii++) {\n if (fn(this._value, ii, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this;\n var ii = 0;\n return new Iterator(function() \n {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()}\n );\n };\n\n Repeat.prototype.equals = function(other) {\n return other instanceof Repeat ?\n is(this._value, other._value) :\n deepEqual(other);\n };\n\n\n var EMPTY_REPEAT;\n\n function invariant(condition, error) {\n if (!condition) throw new Error(error);\n }\n\n createClass(Range, IndexedSeq);\n\n function Range(start, end, step) {\n if (!(this instanceof Range)) {\n return new Range(start, end, step);\n }\n invariant(step !== 0, 'Cannot step a Range by 0');\n start = start || 0;\n if (end === undefined) {\n end = Infinity;\n }\n step = step === undefined ? 1 : Math.abs(step);\n if (end < start) {\n step = -step;\n }\n this._start = start;\n this._end = end;\n this._step = step;\n this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);\n if (this.size === 0) {\n if (EMPTY_RANGE) {\n return EMPTY_RANGE;\n }\n EMPTY_RANGE = this;\n }\n }\n\n Range.prototype.toString = function() {\n if (this.size === 0) {\n return 'Range []';\n }\n return 'Range [ ' +\n this._start + '...' + this._end +\n (this._step !== 1 ? ' by ' + this._step : '') +\n ' ]';\n };\n\n Range.prototype.get = function(index, notSetValue) {\n return this.has(index) ?\n this._start + wrapIndex(this, index) * this._step :\n notSetValue;\n };\n\n Range.prototype.includes = function(searchValue) {\n var possibleIndex = (searchValue - this._start) / this._step;\n return possibleIndex >= 0 &&\n possibleIndex < this.size &&\n possibleIndex === Math.floor(possibleIndex);\n };\n\n Range.prototype.slice = function(begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n begin = resolveBegin(begin, this.size);\n end = resolveEnd(end, this.size);\n if (end <= begin) {\n return new Range(0, 0);\n }\n return new Range(this.get(begin, this._end), this.get(end, this._end), this._step);\n };\n\n Range.prototype.indexOf = function(searchValue) {\n var offsetValue = searchValue - this._start;\n if (offsetValue % this._step === 0) {\n var index = offsetValue / this._step;\n if (index >= 0 && index < this.size) {\n return index\n }\n }\n return -1;\n };\n\n Range.prototype.lastIndexOf = function(searchValue) {\n return this.indexOf(searchValue);\n };\n\n Range.prototype.__iterate = function(fn, reverse) {\n var maxIndex = this.size - 1;\n var step = this._step;\n var value = reverse ? this._start + maxIndex * step : this._start;\n for (var ii = 0; ii <= maxIndex; ii++) {\n if (fn(value, ii, this) === false) {\n return ii + 1;\n }\n value += reverse ? -step : step;\n }\n return ii;\n };\n\n Range.prototype.__iterator = function(type, reverse) {\n var maxIndex = this.size - 1;\n var step = this._step;\n var value = reverse ? this._start + maxIndex * step : this._start;\n var ii = 0;\n return new Iterator(function() {\n var v = value;\n value += reverse ? -step : step;\n return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v);\n });\n };\n\n Range.prototype.equals = function(other) {\n return other instanceof Range ?\n this._start === other._start &&\n this._end === other._end &&\n this._step === other._step :\n deepEqual(this, other);\n };\n\n\n var EMPTY_RANGE;\n\n createClass(Collection, Iterable);\n function Collection() {\n throw TypeError('Abstract');\n }\n\n\n createClass(KeyedCollection, Collection);function KeyedCollection() {}\n\n createClass(IndexedCollection, Collection);function IndexedCollection() {}\n\n createClass(SetCollection, Collection);function SetCollection() {}\n\n\n Collection.Keyed = KeyedCollection;\n Collection.Indexed = IndexedCollection;\n Collection.Set = SetCollection;\n\n var imul =\n typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ?\n Math.imul :\n function imul(a, b) {\n a = a | 0; // int\n b = b | 0; // int\n var c = a & 0xffff;\n var d = b & 0xffff;\n // Shift by 0 fixes the sign on the high part.\n return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int\n };\n\n // v8 has an optimization for storing 31-bit signed numbers.\n // Values which have either 00 or 11 as the high order bits qualify.\n // This function drops the highest order bit in a signed number, maintaining\n // the sign bit.\n function smi(i32) {\n return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF);\n }\n\n function hash(o) {\n if (o === false || o === null || o === undefined) {\n return 0;\n }\n if (typeof o.valueOf === 'function') {\n o = o.valueOf();\n if (o === false || o === null || o === undefined) {\n return 0;\n }\n }\n if (o === true) {\n return 1;\n }\n var type = typeof o;\n if (type === 'number') {\n if (o !== o || o === Infinity) {\n return 0;\n }\n var h = o | 0;\n if (h !== o) {\n h ^= o * 0xFFFFFFFF;\n }\n while (o > 0xFFFFFFFF) {\n o /= 0xFFFFFFFF;\n h ^= o;\n }\n return smi(h);\n }\n if (type === 'string') {\n return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o);\n }\n if (typeof o.hashCode === 'function') {\n return o.hashCode();\n }\n if (type === 'object') {\n return hashJSObj(o);\n }\n if (typeof o.toString === 'function') {\n return hashString(o.toString());\n }\n throw new Error('Value type ' + type + ' cannot be hashed.');\n }\n\n function cachedHashString(string) {\n var hash = stringHashCache[string];\n if (hash === undefined) {\n hash = hashString(string);\n if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {\n STRING_HASH_CACHE_SIZE = 0;\n stringHashCache = {};\n }\n STRING_HASH_CACHE_SIZE++;\n stringHashCache[string] = hash;\n }\n return hash;\n }\n\n // http://jsperf.com/hashing-strings\n function hashString(string) {\n // This is the hash from JVM\n // The hash code for a string is computed as\n // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],\n // where s[i] is the ith character of the string and n is the length of\n // the string. We \"mod\" the result to make it between 0 (inclusive) and 2^31\n // (exclusive) by dropping high bits.\n var hash = 0;\n for (var ii = 0; ii < string.length; ii++) {\n hash = 31 * hash + string.charCodeAt(ii) | 0;\n }\n return smi(hash);\n }\n\n function hashJSObj(obj) {\n var hash;\n if (usingWeakMap) {\n hash = weakMap.get(obj);\n if (hash !== undefined) {\n return hash;\n }\n }\n\n hash = obj[UID_HASH_KEY];\n if (hash !== undefined) {\n return hash;\n }\n\n if (!canDefineProperty) {\n hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];\n if (hash !== undefined) {\n return hash;\n }\n\n hash = getIENodeHash(obj);\n if (hash !== undefined) {\n return hash;\n }\n }\n\n hash = ++objHashUID;\n if (objHashUID & 0x40000000) {\n objHashUID = 0;\n }\n\n if (usingWeakMap) {\n weakMap.set(obj, hash);\n } else if (isExtensible !== undefined && isExtensible(obj) === false) {\n throw new Error('Non-extensible objects are not allowed as keys.');\n } else if (canDefineProperty) {\n Object.defineProperty(obj, UID_HASH_KEY, {\n 'enumerable': false,\n 'configurable': false,\n 'writable': false,\n 'value': hash\n });\n } else if (obj.propertyIsEnumerable !== undefined &&\n obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) {\n // Since we can't define a non-enumerable property on the object\n // we'll hijack one of the less-used non-enumerable properties to\n // save our hash on it. Since this is a function it will not show up in\n // `JSON.stringify` which is what we want.\n obj.propertyIsEnumerable = function() {\n return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments);\n };\n obj.propertyIsEnumerable[UID_HASH_KEY] = hash;\n } else if (obj.nodeType !== undefined) {\n // At this point we couldn't get the IE `uniqueID` to use as a hash\n // and we couldn't use a non-enumerable property to exploit the\n // dontEnum bug so we simply add the `UID_HASH_KEY` on the node\n // itself.\n obj[UID_HASH_KEY] = hash;\n } else {\n throw new Error('Unable to set a non-enumerable property on object.');\n }\n\n return hash;\n }\n\n // Get references to ES5 object methods.\n var isExtensible = Object.isExtensible;\n\n // True if Object.defineProperty works as expected. IE8 fails this test.\n var canDefineProperty = (function() {\n try {\n Object.defineProperty({}, '@', {});\n return true;\n } catch (e) {\n return false;\n }\n }());\n\n // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it\n // and avoid memory leaks from the IE cloneNode bug.\n function getIENodeHash(node) {\n if (node && node.nodeType > 0) {\n switch (node.nodeType) {\n case 1: // Element\n return node.uniqueID;\n case 9: // Document\n return node.documentElement && node.documentElement.uniqueID;\n }\n }\n }\n\n // If possible, use a WeakMap.\n var usingWeakMap = typeof WeakMap === 'function';\n var weakMap;\n if (usingWeakMap) {\n weakMap = new WeakMap();\n }\n\n var objHashUID = 0;\n\n var UID_HASH_KEY = '__immutablehash__';\n if (typeof Symbol === 'function') {\n UID_HASH_KEY = Symbol(UID_HASH_KEY);\n }\n\n var STRING_HASH_CACHE_MIN_STRLEN = 16;\n var STRING_HASH_CACHE_MAX_SIZE = 255;\n var STRING_HASH_CACHE_SIZE = 0;\n var stringHashCache = {};\n\n function assertNotInfinite(size) {\n invariant(\n size !== Infinity,\n 'Cannot perform this action with an infinite size.'\n );\n }\n\n createClass(Map, KeyedCollection);\n\n // @pragma Construction\n\n function Map(value) {\n return value === null || value === undefined ? emptyMap() :\n isMap(value) && !isOrdered(value) ? value :\n emptyMap().withMutations(function(map ) {\n var iter = KeyedIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v, k) {return map.set(k, v)});\n });\n }\n\n Map.of = function() {var keyValues = SLICE$0.call(arguments, 0);\n return emptyMap().withMutations(function(map ) {\n for (var i = 0; i < keyValues.length; i += 2) {\n if (i + 1 >= keyValues.length) {\n throw new Error('Missing value for key: ' + keyValues[i]);\n }\n map.set(keyValues[i], keyValues[i + 1]);\n }\n });\n };\n\n Map.prototype.toString = function() {\n return this.__toString('Map {', '}');\n };\n\n // @pragma Access\n\n Map.prototype.get = function(k, notSetValue) {\n return this._root ?\n this._root.get(0, undefined, k, notSetValue) :\n notSetValue;\n };\n\n // @pragma Modification\n\n Map.prototype.set = function(k, v) {\n return updateMap(this, k, v);\n };\n\n Map.prototype.setIn = function(keyPath, v) {\n return this.updateIn(keyPath, NOT_SET, function() {return v});\n };\n\n Map.prototype.remove = function(k) {\n return updateMap(this, k, NOT_SET);\n };\n\n Map.prototype.deleteIn = function(keyPath) {\n return this.updateIn(keyPath, function() {return NOT_SET});\n };\n\n Map.prototype.update = function(k, notSetValue, updater) {\n return arguments.length === 1 ?\n k(this) :\n this.updateIn([k], notSetValue, updater);\n };\n\n Map.prototype.updateIn = function(keyPath, notSetValue, updater) {\n if (!updater) {\n updater = notSetValue;\n notSetValue = undefined;\n }\n var updatedValue = updateInDeepMap(\n this,\n forceIterator(keyPath),\n notSetValue,\n updater\n );\n return updatedValue === NOT_SET ? undefined : updatedValue;\n };\n\n Map.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._root = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyMap();\n };\n\n // @pragma Composition\n\n Map.prototype.merge = function(/*...iters*/) {\n return mergeIntoMapWith(this, undefined, arguments);\n };\n\n Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoMapWith(this, merger, iters);\n };\n\n Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n return this.updateIn(\n keyPath,\n emptyMap(),\n function(m ) {return typeof m.merge === 'function' ?\n m.merge.apply(m, iters) :\n iters[iters.length - 1]}\n );\n };\n\n Map.prototype.mergeDeep = function(/*...iters*/) {\n return mergeIntoMapWith(this, deepMerger, arguments);\n };\n\n Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoMapWith(this, deepMergerWith(merger), iters);\n };\n\n Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n return this.updateIn(\n keyPath,\n emptyMap(),\n function(m ) {return typeof m.mergeDeep === 'function' ?\n m.mergeDeep.apply(m, iters) :\n iters[iters.length - 1]}\n );\n };\n\n Map.prototype.sort = function(comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator));\n };\n\n Map.prototype.sortBy = function(mapper, comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator, mapper));\n };\n\n // @pragma Mutability\n\n Map.prototype.withMutations = function(fn) {\n var mutable = this.asMutable();\n fn(mutable);\n return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;\n };\n\n Map.prototype.asMutable = function() {\n return this.__ownerID ? this : this.__ensureOwner(new OwnerID());\n };\n\n Map.prototype.asImmutable = function() {\n return this.__ensureOwner();\n };\n\n Map.prototype.wasAltered = function() {\n return this.__altered;\n };\n\n Map.prototype.__iterator = function(type, reverse) {\n return new MapIterator(this, type, reverse);\n };\n\n Map.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n this._root && this._root.iterate(function(entry ) {\n iterations++;\n return fn(entry[1], entry[0], this$0);\n }, reverse);\n return iterations;\n };\n\n Map.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n return makeMap(this.size, this._root, ownerID, this.__hash);\n };\n\n\n function isMap(maybeMap) {\n return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]);\n }\n\n Map.isMap = isMap;\n\n var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';\n\n var MapPrototype = Map.prototype;\n MapPrototype[IS_MAP_SENTINEL] = true;\n MapPrototype[DELETE] = MapPrototype.remove;\n MapPrototype.removeIn = MapPrototype.deleteIn;\n\n\n // #pragma Trie Nodes\n\n\n\n function ArrayMapNode(ownerID, entries) {\n this.ownerID = ownerID;\n this.entries = entries;\n }\n\n ArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n return notSetValue;\n };\n\n ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n\n var entries = this.entries;\n var idx = 0;\n for (var len = entries.length; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && entries.length === 1) {\n return; // undefined\n }\n\n if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {\n return createNodes(ownerID, entries, key, value);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new ArrayMapNode(ownerID, newEntries);\n };\n\n\n\n\n function BitmapIndexedNode(ownerID, bitmap, nodes) {\n this.ownerID = ownerID;\n this.bitmap = bitmap;\n this.nodes = nodes;\n }\n\n BitmapIndexedNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK));\n var bitmap = this.bitmap;\n return (bitmap & bit) === 0 ? notSetValue :\n this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue);\n };\n\n BitmapIndexedNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var bit = 1 << keyHashFrag;\n var bitmap = this.bitmap;\n var exists = (bitmap & bit) !== 0;\n\n if (!exists && value === NOT_SET) {\n return this;\n }\n\n var idx = popCount(bitmap & (bit - 1));\n var nodes = this.nodes;\n var node = exists ? nodes[idx] : undefined;\n var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n\n if (newNode === node) {\n return this;\n }\n\n if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {\n return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);\n }\n\n if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {\n return nodes[idx ^ 1];\n }\n\n if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {\n return newNode;\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;\n var newNodes = exists ? newNode ?\n setIn(nodes, idx, newNode, isEditable) :\n spliceOut(nodes, idx, isEditable) :\n spliceIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.bitmap = newBitmap;\n this.nodes = newNodes;\n return this;\n }\n\n return new BitmapIndexedNode(ownerID, newBitmap, newNodes);\n };\n\n\n\n\n function HashArrayMapNode(ownerID, count, nodes) {\n this.ownerID = ownerID;\n this.count = count;\n this.nodes = nodes;\n }\n\n HashArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var node = this.nodes[idx];\n return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue;\n };\n\n HashArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var removed = value === NOT_SET;\n var nodes = this.nodes;\n var node = nodes[idx];\n\n if (removed && !node) {\n return this;\n }\n\n var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n if (newNode === node) {\n return this;\n }\n\n var newCount = this.count;\n if (!node) {\n newCount++;\n } else if (!newNode) {\n newCount--;\n if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {\n return packNodes(ownerID, nodes, newCount, idx);\n }\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newNodes = setIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.count = newCount;\n this.nodes = newNodes;\n return this;\n }\n\n return new HashArrayMapNode(ownerID, newCount, newNodes);\n };\n\n\n\n\n function HashCollisionNode(ownerID, keyHash, entries) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entries = entries;\n }\n\n HashCollisionNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n return notSetValue;\n };\n\n HashCollisionNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var removed = value === NOT_SET;\n\n if (keyHash !== this.keyHash) {\n if (removed) {\n return this;\n }\n SetRef(didAlter);\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);\n }\n\n var entries = this.entries;\n var idx = 0;\n for (var len = entries.length; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && len === 2) {\n return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new HashCollisionNode(ownerID, this.keyHash, newEntries);\n };\n\n\n\n\n function ValueNode(ownerID, keyHash, entry) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entry = entry;\n }\n\n ValueNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n return is(key, this.entry[0]) ? this.entry[1] : notSetValue;\n };\n\n ValueNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n var keyMatch = is(key, this.entry[0]);\n if (keyMatch ? value === this.entry[1] : removed) {\n return this;\n }\n\n SetRef(didAlter);\n\n if (removed) {\n SetRef(didChangeSize);\n return; // undefined\n }\n\n if (keyMatch) {\n if (ownerID && ownerID === this.ownerID) {\n this.entry[1] = value;\n return this;\n }\n return new ValueNode(ownerID, this.keyHash, [key, value]);\n }\n\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);\n };\n\n\n\n // #pragma Iterators\n\n ArrayMapNode.prototype.iterate =\n HashCollisionNode.prototype.iterate = function (fn, reverse) {\n var entries = this.entries;\n for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {\n if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {\n return false;\n }\n }\n }\n\n BitmapIndexedNode.prototype.iterate =\n HashArrayMapNode.prototype.iterate = function (fn, reverse) {\n var nodes = this.nodes;\n for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {\n var node = nodes[reverse ? maxIndex - ii : ii];\n if (node && node.iterate(fn, reverse) === false) {\n return false;\n }\n }\n }\n\n ValueNode.prototype.iterate = function (fn, reverse) {\n return fn(this.entry);\n }\n\n createClass(MapIterator, Iterator);\n\n function MapIterator(map, type, reverse) {\n this._type = type;\n this._reverse = reverse;\n this._stack = map._root && mapIteratorFrame(map._root);\n }\n\n MapIterator.prototype.next = function() {\n var type = this._type;\n var stack = this._stack;\n while (stack) {\n var node = stack.node;\n var index = stack.index++;\n var maxIndex;\n if (node.entry) {\n if (index === 0) {\n return mapIteratorValue(type, node.entry);\n }\n } else if (node.entries) {\n maxIndex = node.entries.length - 1;\n if (index <= maxIndex) {\n return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]);\n }\n } else {\n maxIndex = node.nodes.length - 1;\n if (index <= maxIndex) {\n var subNode = node.nodes[this._reverse ? maxIndex - index : index];\n if (subNode) {\n if (subNode.entry) {\n return mapIteratorValue(type, subNode.entry);\n }\n stack = this._stack = mapIteratorFrame(subNode, stack);\n }\n continue;\n }\n }\n stack = this._stack = this._stack.__prev;\n }\n return iteratorDone();\n };\n\n\n function mapIteratorValue(type, entry) {\n return iteratorValue(type, entry[0], entry[1]);\n }\n\n function mapIteratorFrame(node, prev) {\n return {\n node: node,\n index: 0,\n __prev: prev\n };\n }\n\n function makeMap(size, root, ownerID, hash) {\n var map = Object.create(MapPrototype);\n map.size = size;\n map._root = root;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n }\n\n var EMPTY_MAP;\n function emptyMap() {\n return EMPTY_MAP || (EMPTY_MAP = makeMap(0));\n }\n\n function updateMap(map, k, v) {\n var newRoot;\n var newSize;\n if (!map._root) {\n if (v === NOT_SET) {\n return map;\n }\n newSize = 1;\n newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);\n } else {\n var didChangeSize = MakeRef(CHANGE_LENGTH);\n var didAlter = MakeRef(DID_ALTER);\n newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter);\n if (!didAlter.value) {\n return map;\n }\n newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0);\n }\n if (map.__ownerID) {\n map.size = newSize;\n map._root = newRoot;\n map.__hash = undefined;\n map.__altered = true;\n return map;\n }\n return newRoot ? makeMap(newSize, newRoot) : emptyMap();\n }\n\n function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (!node) {\n if (value === NOT_SET) {\n return node;\n }\n SetRef(didAlter);\n SetRef(didChangeSize);\n return new ValueNode(ownerID, keyHash, [key, value]);\n }\n return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter);\n }\n\n function isLeafNode(node) {\n return node.constructor === ValueNode || node.constructor === HashCollisionNode;\n }\n\n function mergeIntoNode(node, ownerID, shift, keyHash, entry) {\n if (node.keyHash === keyHash) {\n return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);\n }\n\n var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;\n var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n\n var newNode;\n var nodes = idx1 === idx2 ?\n [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] :\n ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]);\n\n return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);\n }\n\n function createNodes(ownerID, entries, key, value) {\n if (!ownerID) {\n ownerID = new OwnerID();\n }\n var node = new ValueNode(ownerID, hash(key), [key, value]);\n for (var ii = 0; ii < entries.length; ii++) {\n var entry = entries[ii];\n node = node.update(ownerID, 0, undefined, entry[0], entry[1]);\n }\n return node;\n }\n\n function packNodes(ownerID, nodes, count, excluding) {\n var bitmap = 0;\n var packedII = 0;\n var packedNodes = new Array(count);\n for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {\n var node = nodes[ii];\n if (node !== undefined && ii !== excluding) {\n bitmap |= bit;\n packedNodes[packedII++] = node;\n }\n }\n return new BitmapIndexedNode(ownerID, bitmap, packedNodes);\n }\n\n function expandNodes(ownerID, nodes, bitmap, including, node) {\n var count = 0;\n var expandedNodes = new Array(SIZE);\n for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {\n expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;\n }\n expandedNodes[including] = node;\n return new HashArrayMapNode(ownerID, count + 1, expandedNodes);\n }\n\n function mergeIntoMapWith(map, merger, iterables) {\n var iters = [];\n for (var ii = 0; ii < iterables.length; ii++) {\n var value = iterables[ii];\n var iter = KeyedIterable(value);\n if (!isIterable(value)) {\n iter = iter.map(function(v ) {return fromJS(v)});\n }\n iters.push(iter);\n }\n return mergeIntoCollectionWith(map, merger, iters);\n }\n\n function deepMerger(existing, value, key) {\n return existing && existing.mergeDeep && isIterable(value) ?\n existing.mergeDeep(value) :\n is(existing, value) ? existing : value;\n }\n\n function deepMergerWith(merger) {\n return function(existing, value, key) {\n if (existing && existing.mergeDeepWith && isIterable(value)) {\n return existing.mergeDeepWith(merger, value);\n }\n var nextValue = merger(existing, value, key);\n return is(existing, nextValue) ? existing : nextValue;\n };\n }\n\n function mergeIntoCollectionWith(collection, merger, iters) {\n iters = iters.filter(function(x ) {return x.size !== 0});\n if (iters.length === 0) {\n return collection;\n }\n if (collection.size === 0 && !collection.__ownerID && iters.length === 1) {\n return collection.constructor(iters[0]);\n }\n return collection.withMutations(function(collection ) {\n var mergeIntoMap = merger ?\n function(value, key) {\n collection.update(key, NOT_SET, function(existing )\n {return existing === NOT_SET ? value : merger(existing, value, key)}\n );\n } :\n function(value, key) {\n collection.set(key, value);\n }\n for (var ii = 0; ii < iters.length; ii++) {\n iters[ii].forEach(mergeIntoMap);\n }\n });\n }\n\n function updateInDeepMap(existing, keyPathIter, notSetValue, updater) {\n var isNotSet = existing === NOT_SET;\n var step = keyPathIter.next();\n if (step.done) {\n var existingValue = isNotSet ? notSetValue : existing;\n var newValue = updater(existingValue);\n return newValue === existingValue ? existing : newValue;\n }\n invariant(\n isNotSet || (existing && existing.set),\n 'invalid keyPath'\n );\n var key = step.value;\n var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET);\n var nextUpdated = updateInDeepMap(\n nextExisting,\n keyPathIter,\n notSetValue,\n updater\n );\n return nextUpdated === nextExisting ? existing :\n nextUpdated === NOT_SET ? existing.remove(key) :\n (isNotSet ? emptyMap() : existing).set(key, nextUpdated);\n }\n\n function popCount(x) {\n x = x - ((x >> 1) & 0x55555555);\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333);\n x = (x + (x >> 4)) & 0x0f0f0f0f;\n x = x + (x >> 8);\n x = x + (x >> 16);\n return x & 0x7f;\n }\n\n function setIn(array, idx, val, canEdit) {\n var newArray = canEdit ? array : arrCopy(array);\n newArray[idx] = val;\n return newArray;\n }\n\n function spliceIn(array, idx, val, canEdit) {\n var newLen = array.length + 1;\n if (canEdit && idx + 1 === newLen) {\n array[idx] = val;\n return array;\n }\n var newArray = new Array(newLen);\n var after = 0;\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n newArray[ii] = val;\n after = -1;\n } else {\n newArray[ii] = array[ii + after];\n }\n }\n return newArray;\n }\n\n function spliceOut(array, idx, canEdit) {\n var newLen = array.length - 1;\n if (canEdit && idx === newLen) {\n array.pop();\n return array;\n }\n var newArray = new Array(newLen);\n var after = 0;\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n after = 1;\n }\n newArray[ii] = array[ii + after];\n }\n return newArray;\n }\n\n var MAX_ARRAY_MAP_SIZE = SIZE / 4;\n var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;\n var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;\n\n createClass(List, IndexedCollection);\n\n // @pragma Construction\n\n function List(value) {\n var empty = emptyList();\n if (value === null || value === undefined) {\n return empty;\n }\n if (isList(value)) {\n return value;\n }\n var iter = IndexedIterable(value);\n var size = iter.size;\n if (size === 0) {\n return empty;\n }\n assertNotInfinite(size);\n if (size > 0 && size < SIZE) {\n return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));\n }\n return empty.withMutations(function(list ) {\n list.setSize(size);\n iter.forEach(function(v, i) {return list.set(i, v)});\n });\n }\n\n List.of = function(/*...values*/) {\n return this(arguments);\n };\n\n List.prototype.toString = function() {\n return this.__toString('List [', ']');\n };\n\n // @pragma Access\n\n List.prototype.get = function(index, notSetValue) {\n index = wrapIndex(this, index);\n if (index >= 0 && index < this.size) {\n index += this._origin;\n var node = listNodeFor(this, index);\n return node && node.array[index & MASK];\n }\n return notSetValue;\n };\n\n // @pragma Modification\n\n List.prototype.set = function(index, value) {\n return updateList(this, index, value);\n };\n\n List.prototype.remove = function(index) {\n return !this.has(index) ? this :\n index === 0 ? this.shift() :\n index === this.size - 1 ? this.pop() :\n this.splice(index, 1);\n };\n\n List.prototype.insert = function(index, value) {\n return this.splice(index, 0, value);\n };\n\n List.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = this._origin = this._capacity = 0;\n this._level = SHIFT;\n this._root = this._tail = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyList();\n };\n\n List.prototype.push = function(/*...values*/) {\n var values = arguments;\n var oldSize = this.size;\n return this.withMutations(function(list ) {\n setListBounds(list, 0, oldSize + values.length);\n for (var ii = 0; ii < values.length; ii++) {\n list.set(oldSize + ii, values[ii]);\n }\n });\n };\n\n List.prototype.pop = function() {\n return setListBounds(this, 0, -1);\n };\n\n List.prototype.unshift = function(/*...values*/) {\n var values = arguments;\n return this.withMutations(function(list ) {\n setListBounds(list, -values.length);\n for (var ii = 0; ii < values.length; ii++) {\n list.set(ii, values[ii]);\n }\n });\n };\n\n List.prototype.shift = function() {\n return setListBounds(this, 1);\n };\n\n // @pragma Composition\n\n List.prototype.merge = function(/*...iters*/) {\n return mergeIntoListWith(this, undefined, arguments);\n };\n\n List.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoListWith(this, merger, iters);\n };\n\n List.prototype.mergeDeep = function(/*...iters*/) {\n return mergeIntoListWith(this, deepMerger, arguments);\n };\n\n List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoListWith(this, deepMergerWith(merger), iters);\n };\n\n List.prototype.setSize = function(size) {\n return setListBounds(this, 0, size);\n };\n\n // @pragma Iteration\n\n List.prototype.slice = function(begin, end) {\n var size = this.size;\n if (wholeSlice(begin, end, size)) {\n return this;\n }\n return setListBounds(\n this,\n resolveBegin(begin, size),\n resolveEnd(end, size)\n );\n };\n\n List.prototype.__iterator = function(type, reverse) {\n var index = 0;\n var values = iterateList(this, reverse);\n return new Iterator(function() {\n var value = values();\n return value === DONE ?\n iteratorDone() :\n iteratorValue(type, index++, value);\n });\n };\n\n List.prototype.__iterate = function(fn, reverse) {\n var index = 0;\n var values = iterateList(this, reverse);\n var value;\n while ((value = values()) !== DONE) {\n if (fn(value, index++, this) === false) {\n break;\n }\n }\n return index;\n };\n\n List.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n return this;\n }\n return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash);\n };\n\n\n function isList(maybeList) {\n return !!(maybeList && maybeList[IS_LIST_SENTINEL]);\n }\n\n List.isList = isList;\n\n var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';\n\n var ListPrototype = List.prototype;\n ListPrototype[IS_LIST_SENTINEL] = true;\n ListPrototype[DELETE] = ListPrototype.remove;\n ListPrototype.setIn = MapPrototype.setIn;\n ListPrototype.deleteIn =\n ListPrototype.removeIn = MapPrototype.removeIn;\n ListPrototype.update = MapPrototype.update;\n ListPrototype.updateIn = MapPrototype.updateIn;\n ListPrototype.mergeIn = MapPrototype.mergeIn;\n ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n ListPrototype.withMutations = MapPrototype.withMutations;\n ListPrototype.asMutable = MapPrototype.asMutable;\n ListPrototype.asImmutable = MapPrototype.asImmutable;\n ListPrototype.wasAltered = MapPrototype.wasAltered;\n\n\n\n function VNode(array, ownerID) {\n this.array = array;\n this.ownerID = ownerID;\n }\n\n // TODO: seems like these methods are very similar\n\n VNode.prototype.removeBefore = function(ownerID, level, index) {\n if (index === level ? 1 << level : 0 || this.array.length === 0) {\n return this;\n }\n var originIndex = (index >>> level) & MASK;\n if (originIndex >= this.array.length) {\n return new VNode([], ownerID);\n }\n var removingFirst = originIndex === 0;\n var newChild;\n if (level > 0) {\n var oldChild = this.array[originIndex];\n newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);\n if (newChild === oldChild && removingFirst) {\n return this;\n }\n }\n if (removingFirst && !newChild) {\n return this;\n }\n var editable = editableVNode(this, ownerID);\n if (!removingFirst) {\n for (var ii = 0; ii < originIndex; ii++) {\n editable.array[ii] = undefined;\n }\n }\n if (newChild) {\n editable.array[originIndex] = newChild;\n }\n return editable;\n };\n\n VNode.prototype.removeAfter = function(ownerID, level, index) {\n if (index === (level ? 1 << level : 0) || this.array.length === 0) {\n return this;\n }\n var sizeIndex = ((index - 1) >>> level) & MASK;\n if (sizeIndex >= this.array.length) {\n return this;\n }\n\n var newChild;\n if (level > 0) {\n var oldChild = this.array[sizeIndex];\n newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);\n if (newChild === oldChild && sizeIndex === this.array.length - 1) {\n return this;\n }\n }\n\n var editable = editableVNode(this, ownerID);\n editable.array.splice(sizeIndex + 1);\n if (newChild) {\n editable.array[sizeIndex] = newChild;\n }\n return editable;\n };\n\n\n\n var DONE = {};\n\n function iterateList(list, reverse) {\n var left = list._origin;\n var right = list._capacity;\n var tailPos = getTailOffset(right);\n var tail = list._tail;\n\n return iterateNodeOrLeaf(list._root, list._level, 0);\n\n function iterateNodeOrLeaf(node, level, offset) {\n return level === 0 ?\n iterateLeaf(node, offset) :\n iterateNode(node, level, offset);\n }\n\n function iterateLeaf(node, offset) {\n var array = offset === tailPos ? tail && tail.array : node && node.array;\n var from = offset > left ? 0 : left - offset;\n var to = right - offset;\n if (to > SIZE) {\n to = SIZE;\n }\n return function() {\n if (from === to) {\n return DONE;\n }\n var idx = reverse ? --to : from++;\n return array && array[idx];\n };\n }\n\n function iterateNode(node, level, offset) {\n var values;\n var array = node && node.array;\n var from = offset > left ? 0 : (left - offset) >> level;\n var to = ((right - offset) >> level) + 1;\n if (to > SIZE) {\n to = SIZE;\n }\n return function() {\n do {\n if (values) {\n var value = values();\n if (value !== DONE) {\n return value;\n }\n values = null;\n }\n if (from === to) {\n return DONE;\n }\n var idx = reverse ? --to : from++;\n values = iterateNodeOrLeaf(\n array && array[idx], level - SHIFT, offset + (idx << level)\n );\n } while (true);\n };\n }\n }\n\n function makeList(origin, capacity, level, root, tail, ownerID, hash) {\n var list = Object.create(ListPrototype);\n list.size = capacity - origin;\n list._origin = origin;\n list._capacity = capacity;\n list._level = level;\n list._root = root;\n list._tail = tail;\n list.__ownerID = ownerID;\n list.__hash = hash;\n list.__altered = false;\n return list;\n }\n\n var EMPTY_LIST;\n function emptyList() {\n return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));\n }\n\n function updateList(list, index, value) {\n index = wrapIndex(list, index);\n\n if (index !== index) {\n return list;\n }\n\n if (index >= list.size || index < 0) {\n return list.withMutations(function(list ) {\n index < 0 ?\n setListBounds(list, index).set(0, value) :\n setListBounds(list, 0, index + 1).set(index, value)\n });\n }\n\n index += list._origin;\n\n var newTail = list._tail;\n var newRoot = list._root;\n var didAlter = MakeRef(DID_ALTER);\n if (index >= getTailOffset(list._capacity)) {\n newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);\n } else {\n newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter);\n }\n\n if (!didAlter.value) {\n return list;\n }\n\n if (list.__ownerID) {\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n return makeList(list._origin, list._capacity, list._level, newRoot, newTail);\n }\n\n function updateVNode(node, ownerID, level, index, value, didAlter) {\n var idx = (index >>> level) & MASK;\n var nodeHas = node && idx < node.array.length;\n if (!nodeHas && value === undefined) {\n return node;\n }\n\n var newNode;\n\n if (level > 0) {\n var lowerNode = node && node.array[idx];\n var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter);\n if (newLowerNode === lowerNode) {\n return node;\n }\n newNode = editableVNode(node, ownerID);\n newNode.array[idx] = newLowerNode;\n return newNode;\n }\n\n if (nodeHas && node.array[idx] === value) {\n return node;\n }\n\n SetRef(didAlter);\n\n newNode = editableVNode(node, ownerID);\n if (value === undefined && idx === newNode.array.length - 1) {\n newNode.array.pop();\n } else {\n newNode.array[idx] = value;\n }\n return newNode;\n }\n\n function editableVNode(node, ownerID) {\n if (ownerID && node && ownerID === node.ownerID) {\n return node;\n }\n return new VNode(node ? node.array.slice() : [], ownerID);\n }\n\n function listNodeFor(list, rawIndex) {\n if (rawIndex >= getTailOffset(list._capacity)) {\n return list._tail;\n }\n if (rawIndex < 1 << (list._level + SHIFT)) {\n var node = list._root;\n var level = list._level;\n while (node && level > 0) {\n node = node.array[(rawIndex >>> level) & MASK];\n level -= SHIFT;\n }\n return node;\n }\n }\n\n function setListBounds(list, begin, end) {\n // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n if (begin !== undefined) {\n begin = begin | 0;\n }\n if (end !== undefined) {\n end = end | 0;\n }\n var owner = list.__ownerID || new OwnerID();\n var oldOrigin = list._origin;\n var oldCapacity = list._capacity;\n var newOrigin = oldOrigin + begin;\n var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end;\n if (newOrigin === oldOrigin && newCapacity === oldCapacity) {\n return list;\n }\n\n // If it's going to end after it starts, it's empty.\n if (newOrigin >= newCapacity) {\n return list.clear();\n }\n\n var newLevel = list._level;\n var newRoot = list._root;\n\n // New origin might need creating a higher root.\n var offsetShift = 0;\n while (newOrigin + offsetShift < 0) {\n newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner);\n newLevel += SHIFT;\n offsetShift += 1 << newLevel;\n }\n if (offsetShift) {\n newOrigin += offsetShift;\n oldOrigin += offsetShift;\n newCapacity += offsetShift;\n oldCapacity += offsetShift;\n }\n\n var oldTailOffset = getTailOffset(oldCapacity);\n var newTailOffset = getTailOffset(newCapacity);\n\n // New size might need creating a higher root.\n while (newTailOffset >= 1 << (newLevel + SHIFT)) {\n newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner);\n newLevel += SHIFT;\n }\n\n // Locate or create the new tail.\n var oldTail = list._tail;\n var newTail = newTailOffset < oldTailOffset ?\n listNodeFor(list, newCapacity - 1) :\n newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail;\n\n // Merge Tail into tree.\n if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) {\n newRoot = editableVNode(newRoot, owner);\n var node = newRoot;\n for (var level = newLevel; level > SHIFT; level -= SHIFT) {\n var idx = (oldTailOffset >>> level) & MASK;\n node = node.array[idx] = editableVNode(node.array[idx], owner);\n }\n node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;\n }\n\n // If the size has been reduced, there's a chance the tail needs to be trimmed.\n if (newCapacity < oldCapacity) {\n newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);\n }\n\n // If the new origin is within the tail, then we do not need a root.\n if (newOrigin >= newTailOffset) {\n newOrigin -= newTailOffset;\n newCapacity -= newTailOffset;\n newLevel = SHIFT;\n newRoot = null;\n newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);\n\n // Otherwise, if the root has been trimmed, garbage collect.\n } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {\n offsetShift = 0;\n\n // Identify the new top root node of the subtree of the old root.\n while (newRoot) {\n var beginIndex = (newOrigin >>> newLevel) & MASK;\n if (beginIndex !== (newTailOffset >>> newLevel) & MASK) {\n break;\n }\n if (beginIndex) {\n offsetShift += (1 << newLevel) * beginIndex;\n }\n newLevel -= SHIFT;\n newRoot = newRoot.array[beginIndex];\n }\n\n // Trim the new sides of the new root.\n if (newRoot && newOrigin > oldOrigin) {\n newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);\n }\n if (newRoot && newTailOffset < oldTailOffset) {\n newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift);\n }\n if (offsetShift) {\n newOrigin -= offsetShift;\n newCapacity -= offsetShift;\n }\n }\n\n if (list.__ownerID) {\n list.size = newCapacity - newOrigin;\n list._origin = newOrigin;\n list._capacity = newCapacity;\n list._level = newLevel;\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);\n }\n\n function mergeIntoListWith(list, merger, iterables) {\n var iters = [];\n var maxSize = 0;\n for (var ii = 0; ii < iterables.length; ii++) {\n var value = iterables[ii];\n var iter = IndexedIterable(value);\n if (iter.size > maxSize) {\n maxSize = iter.size;\n }\n if (!isIterable(value)) {\n iter = iter.map(function(v ) {return fromJS(v)});\n }\n iters.push(iter);\n }\n if (maxSize > list.size) {\n list = list.setSize(maxSize);\n }\n return mergeIntoCollectionWith(list, merger, iters);\n }\n\n function getTailOffset(size) {\n return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT);\n }\n\n createClass(OrderedMap, Map);\n\n // @pragma Construction\n\n function OrderedMap(value) {\n return value === null || value === undefined ? emptyOrderedMap() :\n isOrderedMap(value) ? value :\n emptyOrderedMap().withMutations(function(map ) {\n var iter = KeyedIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v, k) {return map.set(k, v)});\n });\n }\n\n OrderedMap.of = function(/*...values*/) {\n return this(arguments);\n };\n\n OrderedMap.prototype.toString = function() {\n return this.__toString('OrderedMap {', '}');\n };\n\n // @pragma Access\n\n OrderedMap.prototype.get = function(k, notSetValue) {\n var index = this._map.get(k);\n return index !== undefined ? this._list.get(index)[1] : notSetValue;\n };\n\n // @pragma Modification\n\n OrderedMap.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._map.clear();\n this._list.clear();\n return this;\n }\n return emptyOrderedMap();\n };\n\n OrderedMap.prototype.set = function(k, v) {\n return updateOrderedMap(this, k, v);\n };\n\n OrderedMap.prototype.remove = function(k) {\n return updateOrderedMap(this, k, NOT_SET);\n };\n\n OrderedMap.prototype.wasAltered = function() {\n return this._map.wasAltered() || this._list.wasAltered();\n };\n\n OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._list.__iterate(\n function(entry ) {return entry && fn(entry[1], entry[0], this$0)},\n reverse\n );\n };\n\n OrderedMap.prototype.__iterator = function(type, reverse) {\n return this._list.fromEntrySeq().__iterator(type, reverse);\n };\n\n OrderedMap.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map.__ensureOwner(ownerID);\n var newList = this._list.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n this._list = newList;\n return this;\n }\n return makeOrderedMap(newMap, newList, ownerID, this.__hash);\n };\n\n\n function isOrderedMap(maybeOrderedMap) {\n return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);\n }\n\n OrderedMap.isOrderedMap = isOrderedMap;\n\n OrderedMap.prototype[IS_ORDERED_SENTINEL] = true;\n OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;\n\n\n\n function makeOrderedMap(map, list, ownerID, hash) {\n var omap = Object.create(OrderedMap.prototype);\n omap.size = map ? map.size : 0;\n omap._map = map;\n omap._list = list;\n omap.__ownerID = ownerID;\n omap.__hash = hash;\n return omap;\n }\n\n var EMPTY_ORDERED_MAP;\n function emptyOrderedMap() {\n return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()));\n }\n\n function updateOrderedMap(omap, k, v) {\n var map = omap._map;\n var list = omap._list;\n var i = map.get(k);\n var has = i !== undefined;\n var newMap;\n var newList;\n if (v === NOT_SET) { // removed\n if (!has) {\n return omap;\n }\n if (list.size >= SIZE && list.size >= map.size * 2) {\n newList = list.filter(function(entry, idx) {return entry !== undefined && i !== idx});\n newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap();\n if (omap.__ownerID) {\n newMap.__ownerID = newList.__ownerID = omap.__ownerID;\n }\n } else {\n newMap = map.remove(k);\n newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);\n }\n } else {\n if (has) {\n if (v === list.get(i)[1]) {\n return omap;\n }\n newMap = map;\n newList = list.set(i, [k, v]);\n } else {\n newMap = map.set(k, list.size);\n newList = list.set(list.size, [k, v]);\n }\n }\n if (omap.__ownerID) {\n omap.size = newMap.size;\n omap._map = newMap;\n omap._list = newList;\n omap.__hash = undefined;\n return omap;\n }\n return makeOrderedMap(newMap, newList);\n }\n\n createClass(ToKeyedSequence, KeyedSeq);\n function ToKeyedSequence(indexed, useKeys) {\n this._iter = indexed;\n this._useKeys = useKeys;\n this.size = indexed.size;\n }\n\n ToKeyedSequence.prototype.get = function(key, notSetValue) {\n return this._iter.get(key, notSetValue);\n };\n\n ToKeyedSequence.prototype.has = function(key) {\n return this._iter.has(key);\n };\n\n ToKeyedSequence.prototype.valueSeq = function() {\n return this._iter.valueSeq();\n };\n\n ToKeyedSequence.prototype.reverse = function() {var this$0 = this;\n var reversedSequence = reverseFactory(this, true);\n if (!this._useKeys) {\n reversedSequence.valueSeq = function() {return this$0._iter.toSeq().reverse()};\n }\n return reversedSequence;\n };\n\n ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this;\n var mappedSequence = mapFactory(this, mapper, context);\n if (!this._useKeys) {\n mappedSequence.valueSeq = function() {return this$0._iter.toSeq().map(mapper, context)};\n }\n return mappedSequence;\n };\n\n ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var ii;\n return this._iter.__iterate(\n this._useKeys ?\n function(v, k) {return fn(v, k, this$0)} :\n ((ii = reverse ? resolveSize(this) : 0),\n function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}),\n reverse\n );\n };\n\n ToKeyedSequence.prototype.__iterator = function(type, reverse) {\n if (this._useKeys) {\n return this._iter.__iterator(type, reverse);\n }\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n var ii = reverse ? resolveSize(this) : 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, reverse ? --ii : ii++, step.value, step);\n });\n };\n\n ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n createClass(ToIndexedSequence, IndexedSeq);\n function ToIndexedSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n ToIndexedSequence.prototype.includes = function(value) {\n return this._iter.includes(value);\n };\n\n ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse);\n };\n\n ToIndexedSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n var iterations = 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, iterations++, step.value, step)\n });\n };\n\n\n\n createClass(ToSetSequence, SetSeq);\n function ToSetSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n ToSetSequence.prototype.has = function(key) {\n return this._iter.includes(key);\n };\n\n ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse);\n };\n\n ToSetSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, step.value, step.value, step);\n });\n };\n\n\n\n createClass(FromEntriesSequence, KeyedSeq);\n function FromEntriesSequence(entries) {\n this._iter = entries;\n this.size = entries.size;\n }\n\n FromEntriesSequence.prototype.entrySeq = function() {\n return this._iter.toSeq();\n };\n\n FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._iter.__iterate(function(entry ) {\n // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n if (entry) {\n validateEntry(entry);\n var indexedIterable = isIterable(entry);\n return fn(\n indexedIterable ? entry.get(1) : entry[1],\n indexedIterable ? entry.get(0) : entry[0],\n this$0\n );\n }\n }, reverse);\n };\n\n FromEntriesSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n return new Iterator(function() {\n while (true) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n if (entry) {\n validateEntry(entry);\n var indexedIterable = isIterable(entry);\n return iteratorValue(\n type,\n indexedIterable ? entry.get(0) : entry[0],\n indexedIterable ? entry.get(1) : entry[1],\n step\n );\n }\n }\n });\n };\n\n\n ToIndexedSequence.prototype.cacheResult =\n ToKeyedSequence.prototype.cacheResult =\n ToSetSequence.prototype.cacheResult =\n FromEntriesSequence.prototype.cacheResult =\n cacheResultThrough;\n\n\n function flipFactory(iterable) {\n var flipSequence = makeSequence(iterable);\n flipSequence._iter = iterable;\n flipSequence.size = iterable.size;\n flipSequence.flip = function() {return iterable};\n flipSequence.reverse = function () {\n var reversedSequence = iterable.reverse.apply(this); // super.reverse()\n reversedSequence.flip = function() {return iterable.reverse()};\n return reversedSequence;\n };\n flipSequence.has = function(key ) {return iterable.includes(key)};\n flipSequence.includes = function(key ) {return iterable.has(key)};\n flipSequence.cacheResult = cacheResultThrough;\n flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(function(v, k) {return fn(k, v, this$0) !== false}, reverse);\n }\n flipSequence.__iteratorUncached = function(type, reverse) {\n if (type === ITERATE_ENTRIES) {\n var iterator = iterable.__iterator(type, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n if (!step.done) {\n var k = step.value[0];\n step.value[0] = step.value[1];\n step.value[1] = k;\n }\n return step;\n });\n }\n return iterable.__iterator(\n type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES,\n reverse\n );\n }\n return flipSequence;\n }\n\n\n function mapFactory(iterable, mapper, context) {\n var mappedSequence = makeSequence(iterable);\n mappedSequence.size = iterable.size;\n mappedSequence.has = function(key ) {return iterable.has(key)};\n mappedSequence.get = function(key, notSetValue) {\n var v = iterable.get(key, NOT_SET);\n return v === NOT_SET ?\n notSetValue :\n mapper.call(context, v, key, iterable);\n };\n mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(\n function(v, k, c) {return fn(mapper.call(context, v, k, c), k, this$0) !== false},\n reverse\n );\n }\n mappedSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var key = entry[0];\n return iteratorValue(\n type,\n key,\n mapper.call(context, entry[1], key, iterable),\n step\n );\n });\n }\n return mappedSequence;\n }\n\n\n function reverseFactory(iterable, useKeys) {\n var reversedSequence = makeSequence(iterable);\n reversedSequence._iter = iterable;\n reversedSequence.size = iterable.size;\n reversedSequence.reverse = function() {return iterable};\n if (iterable.flip) {\n reversedSequence.flip = function () {\n var flipSequence = flipFactory(iterable);\n flipSequence.reverse = function() {return iterable.flip()};\n return flipSequence;\n };\n }\n reversedSequence.get = function(key, notSetValue) \n {return iterable.get(useKeys ? key : -1 - key, notSetValue)};\n reversedSequence.has = function(key )\n {return iterable.has(useKeys ? key : -1 - key)};\n reversedSequence.includes = function(value ) {return iterable.includes(value)};\n reversedSequence.cacheResult = cacheResultThrough;\n reversedSequence.__iterate = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(function(v, k) {return fn(v, k, this$0)}, !reverse);\n };\n reversedSequence.__iterator =\n function(type, reverse) {return iterable.__iterator(type, !reverse)};\n return reversedSequence;\n }\n\n\n function filterFactory(iterable, predicate, context, useKeys) {\n var filterSequence = makeSequence(iterable);\n if (useKeys) {\n filterSequence.has = function(key ) {\n var v = iterable.get(key, NOT_SET);\n return v !== NOT_SET && !!predicate.call(context, v, key, iterable);\n };\n filterSequence.get = function(key, notSetValue) {\n var v = iterable.get(key, NOT_SET);\n return v !== NOT_SET && predicate.call(context, v, key, iterable) ?\n v : notSetValue;\n };\n }\n filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n var iterations = 0;\n iterable.__iterate(function(v, k, c) {\n if (predicate.call(context, v, k, c)) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0);\n }\n }, reverse);\n return iterations;\n };\n filterSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var iterations = 0;\n return new Iterator(function() {\n while (true) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var key = entry[0];\n var value = entry[1];\n if (predicate.call(context, value, key, iterable)) {\n return iteratorValue(type, useKeys ? key : iterations++, value, step);\n }\n }\n });\n }\n return filterSequence;\n }\n\n\n function countByFactory(iterable, grouper, context) {\n var groups = Map().asMutable();\n iterable.__iterate(function(v, k) {\n groups.update(\n grouper.call(context, v, k, iterable),\n 0,\n function(a ) {return a + 1}\n );\n });\n return groups.asImmutable();\n }\n\n\n function groupByFactory(iterable, grouper, context) {\n var isKeyedIter = isKeyed(iterable);\n var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable();\n iterable.__iterate(function(v, k) {\n groups.update(\n grouper.call(context, v, k, iterable),\n function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)}\n );\n });\n var coerce = iterableClass(iterable);\n return groups.map(function(arr ) {return reify(iterable, coerce(arr))});\n }\n\n\n function sliceFactory(iterable, begin, end, useKeys) {\n var originalSize = iterable.size;\n\n // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n if (begin !== undefined) {\n begin = begin | 0;\n }\n if (end !== undefined) {\n if (end === Infinity) {\n end = originalSize;\n } else {\n end = end | 0;\n }\n }\n\n if (wholeSlice(begin, end, originalSize)) {\n return iterable;\n }\n\n var resolvedBegin = resolveBegin(begin, originalSize);\n var resolvedEnd = resolveEnd(end, originalSize);\n\n // begin or end will be NaN if they were provided as negative numbers and\n // this iterable's size is unknown. In that case, cache first so there is\n // a known size and these do not resolve to NaN.\n if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {\n return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys);\n }\n\n // Note: resolvedEnd is undefined when the original sequence's length is\n // unknown and this slice did not supply an end and should contain all\n // elements after resolvedBegin.\n // In that case, resolvedSize will be NaN and sliceSize will remain undefined.\n var resolvedSize = resolvedEnd - resolvedBegin;\n var sliceSize;\n if (resolvedSize === resolvedSize) {\n sliceSize = resolvedSize < 0 ? 0 : resolvedSize;\n }\n\n var sliceSeq = makeSequence(iterable);\n\n // If iterable.size is undefined, the size of the realized sliceSeq is\n // unknown at this point unless the number of items to slice is 0\n sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined;\n\n if (!useKeys && isSeq(iterable) && sliceSize >= 0) {\n sliceSeq.get = function (index, notSetValue) {\n index = wrapIndex(this, index);\n return index >= 0 && index < sliceSize ?\n iterable.get(index + resolvedBegin, notSetValue) :\n notSetValue;\n }\n }\n\n sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this;\n if (sliceSize === 0) {\n return 0;\n }\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var skipped = 0;\n var isSkipping = true;\n var iterations = 0;\n iterable.__iterate(function(v, k) {\n if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0) !== false &&\n iterations !== sliceSize;\n }\n });\n return iterations;\n };\n\n sliceSeq.__iteratorUncached = function(type, reverse) {\n if (sliceSize !== 0 && reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n // Don't bother instantiating parent iterator if taking 0.\n var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse);\n var skipped = 0;\n var iterations = 0;\n return new Iterator(function() {\n while (skipped++ < resolvedBegin) {\n iterator.next();\n }\n if (++iterations > sliceSize) {\n return iteratorDone();\n }\n var step = iterator.next();\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n } else if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations - 1, undefined, step);\n } else {\n return iteratorValue(type, iterations - 1, step.value[1], step);\n }\n });\n }\n\n return sliceSeq;\n }\n\n\n function takeWhileFactory(iterable, predicate, context) {\n var takeSequence = makeSequence(iterable);\n takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterations = 0;\n iterable.__iterate(function(v, k, c) \n {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)}\n );\n return iterations;\n };\n takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var iterating = true;\n return new Iterator(function() {\n if (!iterating) {\n return iteratorDone();\n }\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var k = entry[0];\n var v = entry[1];\n if (!predicate.call(context, v, k, this$0)) {\n iterating = false;\n return iteratorDone();\n }\n return type === ITERATE_ENTRIES ? step :\n iteratorValue(type, k, v, step);\n });\n };\n return takeSequence;\n }\n\n\n function skipWhileFactory(iterable, predicate, context, useKeys) {\n var skipSequence = makeSequence(iterable);\n skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var isSkipping = true;\n var iterations = 0;\n iterable.__iterate(function(v, k, c) {\n if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0);\n }\n });\n return iterations;\n };\n skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var skipping = true;\n var iterations = 0;\n return new Iterator(function() {\n var step, k, v;\n do {\n step = iterator.next();\n if (step.done) {\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n } else if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations++, undefined, step);\n } else {\n return iteratorValue(type, iterations++, step.value[1], step);\n }\n }\n var entry = step.value;\n k = entry[0];\n v = entry[1];\n skipping && (skipping = predicate.call(context, v, k, this$0));\n } while (skipping);\n return type === ITERATE_ENTRIES ? step :\n iteratorValue(type, k, v, step);\n });\n };\n return skipSequence;\n }\n\n\n function concatFactory(iterable, values) {\n var isKeyedIterable = isKeyed(iterable);\n var iters = [iterable].concat(values).map(function(v ) {\n if (!isIterable(v)) {\n v = isKeyedIterable ?\n keyedSeqFromValue(v) :\n indexedSeqFromValue(Array.isArray(v) ? v : [v]);\n } else if (isKeyedIterable) {\n v = KeyedIterable(v);\n }\n return v;\n }).filter(function(v ) {return v.size !== 0});\n\n if (iters.length === 0) {\n return iterable;\n }\n\n if (iters.length === 1) {\n var singleton = iters[0];\n if (singleton === iterable ||\n isKeyedIterable && isKeyed(singleton) ||\n isIndexed(iterable) && isIndexed(singleton)) {\n return singleton;\n }\n }\n\n var concatSeq = new ArraySeq(iters);\n if (isKeyedIterable) {\n concatSeq = concatSeq.toKeyedSeq();\n } else if (!isIndexed(iterable)) {\n concatSeq = concatSeq.toSetSeq();\n }\n concatSeq = concatSeq.flatten(true);\n concatSeq.size = iters.reduce(\n function(sum, seq) {\n if (sum !== undefined) {\n var size = seq.size;\n if (size !== undefined) {\n return sum + size;\n }\n }\n },\n 0\n );\n return concatSeq;\n }\n\n\n function flattenFactory(iterable, depth, useKeys) {\n var flatSequence = makeSequence(iterable);\n flatSequence.__iterateUncached = function(fn, reverse) {\n var iterations = 0;\n var stopped = false;\n function flatDeep(iter, currentDepth) {var this$0 = this;\n iter.__iterate(function(v, k) {\n if ((!depth || currentDepth < depth) && isIterable(v)) {\n flatDeep(v, currentDepth + 1);\n } else if (fn(v, useKeys ? k : iterations++, this$0) === false) {\n stopped = true;\n }\n return !stopped;\n }, reverse);\n }\n flatDeep(iterable, 0);\n return iterations;\n }\n flatSequence.__iteratorUncached = function(type, reverse) {\n var iterator = iterable.__iterator(type, reverse);\n var stack = [];\n var iterations = 0;\n return new Iterator(function() {\n while (iterator) {\n var step = iterator.next();\n if (step.done !== false) {\n iterator = stack.pop();\n continue;\n }\n var v = step.value;\n if (type === ITERATE_ENTRIES) {\n v = v[1];\n }\n if ((!depth || stack.length < depth) && isIterable(v)) {\n stack.push(iterator);\n iterator = v.__iterator(type, reverse);\n } else {\n return useKeys ? step : iteratorValue(type, iterations++, v, step);\n }\n }\n return iteratorDone();\n });\n }\n return flatSequence;\n }\n\n\n function flatMapFactory(iterable, mapper, context) {\n var coerce = iterableClass(iterable);\n return iterable.toSeq().map(\n function(v, k) {return coerce(mapper.call(context, v, k, iterable))}\n ).flatten(true);\n }\n\n\n function interposeFactory(iterable, separator) {\n var interposedSequence = makeSequence(iterable);\n interposedSequence.size = iterable.size && iterable.size * 2 -1;\n interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n iterable.__iterate(function(v, k) \n {return (!iterations || fn(separator, iterations++, this$0) !== false) &&\n fn(v, iterations++, this$0) !== false},\n reverse\n );\n return iterations;\n };\n interposedSequence.__iteratorUncached = function(type, reverse) {\n var iterator = iterable.__iterator(ITERATE_VALUES, reverse);\n var iterations = 0;\n var step;\n return new Iterator(function() {\n if (!step || iterations % 2) {\n step = iterator.next();\n if (step.done) {\n return step;\n }\n }\n return iterations % 2 ?\n iteratorValue(type, iterations++, separator) :\n iteratorValue(type, iterations++, step.value, step);\n });\n };\n return interposedSequence;\n }\n\n\n function sortFactory(iterable, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n var isKeyedIterable = isKeyed(iterable);\n var index = 0;\n var entries = iterable.toSeq().map(\n function(v, k) {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]}\n ).toArray();\n entries.sort(function(a, b) {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach(\n isKeyedIterable ?\n function(v, i) { entries[i].length = 2; } :\n function(v, i) { entries[i] = v[1]; }\n );\n return isKeyedIterable ? KeyedSeq(entries) :\n isIndexed(iterable) ? IndexedSeq(entries) :\n SetSeq(entries);\n }\n\n\n function maxFactory(iterable, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n if (mapper) {\n var entry = iterable.toSeq()\n .map(function(v, k) {return [v, mapper(v, k, iterable)]})\n .reduce(function(a, b) {return maxCompare(comparator, a[1], b[1]) ? b : a});\n return entry && entry[0];\n } else {\n return iterable.reduce(function(a, b) {return maxCompare(comparator, a, b) ? b : a});\n }\n }\n\n function maxCompare(comparator, a, b) {\n var comp = comparator(b, a);\n // b is considered the new max if the comparator declares them equal, but\n // they are not equal and b is in fact a nullish value.\n return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0;\n }\n\n\n function zipWithFactory(keyIter, zipper, iters) {\n var zipSequence = makeSequence(keyIter);\n zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min();\n // Note: this a generic base implementation of __iterate in terms of\n // __iterator which may be more generically useful in the future.\n zipSequence.__iterate = function(fn, reverse) {\n /* generic:\n var iterator = this.__iterator(ITERATE_ENTRIES, reverse);\n var step;\n var iterations = 0;\n while (!(step = iterator.next()).done) {\n iterations++;\n if (fn(step.value[1], step.value[0], this) === false) {\n break;\n }\n }\n return iterations;\n */\n // indexed:\n var iterator = this.__iterator(ITERATE_VALUES, reverse);\n var step;\n var iterations = 0;\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n return iterations;\n };\n zipSequence.__iteratorUncached = function(type, reverse) {\n var iterators = iters.map(function(i )\n {return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))}\n );\n var iterations = 0;\n var isDone = false;\n return new Iterator(function() {\n var steps;\n if (!isDone) {\n steps = iterators.map(function(i ) {return i.next()});\n isDone = steps.some(function(s ) {return s.done});\n }\n if (isDone) {\n return iteratorDone();\n }\n return iteratorValue(\n type,\n iterations++,\n zipper.apply(null, steps.map(function(s ) {return s.value}))\n );\n });\n };\n return zipSequence\n }\n\n\n // #pragma Helper Functions\n\n function reify(iter, seq) {\n return isSeq(iter) ? seq : iter.constructor(seq);\n }\n\n function validateEntry(entry) {\n if (entry !== Object(entry)) {\n throw new TypeError('Expected [K, V] tuple: ' + entry);\n }\n }\n\n function resolveSize(iter) {\n assertNotInfinite(iter.size);\n return ensureSize(iter);\n }\n\n function iterableClass(iterable) {\n return isKeyed(iterable) ? KeyedIterable :\n isIndexed(iterable) ? IndexedIterable :\n SetIterable;\n }\n\n function makeSequence(iterable) {\n return Object.create(\n (\n isKeyed(iterable) ? KeyedSeq :\n isIndexed(iterable) ? IndexedSeq :\n SetSeq\n ).prototype\n );\n }\n\n function cacheResultThrough() {\n if (this._iter.cacheResult) {\n this._iter.cacheResult();\n this.size = this._iter.size;\n return this;\n } else {\n return Seq.prototype.cacheResult.call(this);\n }\n }\n\n function defaultComparator(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n }\n\n function forceIterator(keyPath) {\n var iter = getIterator(keyPath);\n if (!iter) {\n // Array might not be iterable in this environment, so we need a fallback\n // to our wrapped type.\n if (!isArrayLike(keyPath)) {\n throw new TypeError('Expected iterable or array-like: ' + keyPath);\n }\n iter = getIterator(Iterable(keyPath));\n }\n return iter;\n }\n\n createClass(Record, KeyedCollection);\n\n function Record(defaultValues, name) {\n var hasInitialized;\n\n var RecordType = function Record(values) {\n if (values instanceof RecordType) {\n return values;\n }\n if (!(this instanceof RecordType)) {\n return new RecordType(values);\n }\n if (!hasInitialized) {\n hasInitialized = true;\n var keys = Object.keys(defaultValues);\n setProps(RecordTypePrototype, keys);\n RecordTypePrototype.size = keys.length;\n RecordTypePrototype._name = name;\n RecordTypePrototype._keys = keys;\n RecordTypePrototype._defaultValues = defaultValues;\n }\n this._map = Map(values);\n };\n\n var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype);\n RecordTypePrototype.constructor = RecordType;\n\n return RecordType;\n }\n\n Record.prototype.toString = function() {\n return this.__toString(recordName(this) + ' {', '}');\n };\n\n // @pragma Access\n\n Record.prototype.has = function(k) {\n return this._defaultValues.hasOwnProperty(k);\n };\n\n Record.prototype.get = function(k, notSetValue) {\n if (!this.has(k)) {\n return notSetValue;\n }\n var defaultVal = this._defaultValues[k];\n return this._map ? this._map.get(k, defaultVal) : defaultVal;\n };\n\n // @pragma Modification\n\n Record.prototype.clear = function() {\n if (this.__ownerID) {\n this._map && this._map.clear();\n return this;\n }\n var RecordType = this.constructor;\n return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap()));\n };\n\n Record.prototype.set = function(k, v) {\n if (!this.has(k)) {\n throw new Error('Cannot set unknown key \"' + k + '\" on ' + recordName(this));\n }\n if (this._map && !this._map.has(k)) {\n var defaultVal = this._defaultValues[k];\n if (v === defaultVal) {\n return this;\n }\n }\n var newMap = this._map && this._map.set(k, v);\n if (this.__ownerID || newMap === this._map) {\n return this;\n }\n return makeRecord(this, newMap);\n };\n\n Record.prototype.remove = function(k) {\n if (!this.has(k)) {\n return this;\n }\n var newMap = this._map && this._map.remove(k);\n if (this.__ownerID || newMap === this._map) {\n return this;\n }\n return makeRecord(this, newMap);\n };\n\n Record.prototype.wasAltered = function() {\n return this._map.wasAltered();\n };\n\n Record.prototype.__iterator = function(type, reverse) {var this$0 = this;\n return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterator(type, reverse);\n };\n\n Record.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterate(fn, reverse);\n };\n\n Record.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map && this._map.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n return makeRecord(this, newMap, ownerID);\n };\n\n\n var RecordPrototype = Record.prototype;\n RecordPrototype[DELETE] = RecordPrototype.remove;\n RecordPrototype.deleteIn =\n RecordPrototype.removeIn = MapPrototype.removeIn;\n RecordPrototype.merge = MapPrototype.merge;\n RecordPrototype.mergeWith = MapPrototype.mergeWith;\n RecordPrototype.mergeIn = MapPrototype.mergeIn;\n RecordPrototype.mergeDeep = MapPrototype.mergeDeep;\n RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith;\n RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n RecordPrototype.setIn = MapPrototype.setIn;\n RecordPrototype.update = MapPrototype.update;\n RecordPrototype.updateIn = MapPrototype.updateIn;\n RecordPrototype.withMutations = MapPrototype.withMutations;\n RecordPrototype.asMutable = MapPrototype.asMutable;\n RecordPrototype.asImmutable = MapPrototype.asImmutable;\n\n\n function makeRecord(likeRecord, map, ownerID) {\n var record = Object.create(Object.getPrototypeOf(likeRecord));\n record._map = map;\n record.__ownerID = ownerID;\n return record;\n }\n\n function recordName(record) {\n return record._name || record.constructor.name || 'Record';\n }\n\n function setProps(prototype, names) {\n try {\n names.forEach(setProp.bind(undefined, prototype));\n } catch (error) {\n // Object.defineProperty failed. Probably IE8.\n }\n }\n\n function setProp(prototype, name) {\n Object.defineProperty(prototype, name, {\n get: function() {\n return this.get(name);\n },\n set: function(value) {\n invariant(this.__ownerID, 'Cannot set on an immutable record.');\n this.set(name, value);\n }\n });\n }\n\n createClass(Set, SetCollection);\n\n // @pragma Construction\n\n function Set(value) {\n return value === null || value === undefined ? emptySet() :\n isSet(value) && !isOrdered(value) ? value :\n emptySet().withMutations(function(set ) {\n var iter = SetIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v ) {return set.add(v)});\n });\n }\n\n Set.of = function(/*...values*/) {\n return this(arguments);\n };\n\n Set.fromKeys = function(value) {\n return this(KeyedIterable(value).keySeq());\n };\n\n Set.prototype.toString = function() {\n return this.__toString('Set {', '}');\n };\n\n // @pragma Access\n\n Set.prototype.has = function(value) {\n return this._map.has(value);\n };\n\n // @pragma Modification\n\n Set.prototype.add = function(value) {\n return updateSet(this, this._map.set(value, true));\n };\n\n Set.prototype.remove = function(value) {\n return updateSet(this, this._map.remove(value));\n };\n\n Set.prototype.clear = function() {\n return updateSet(this, this._map.clear());\n };\n\n // @pragma Composition\n\n Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0);\n iters = iters.filter(function(x ) {return x.size !== 0});\n if (iters.length === 0) {\n return this;\n }\n if (this.size === 0 && !this.__ownerID && iters.length === 1) {\n return this.constructor(iters[0]);\n }\n return this.withMutations(function(set ) {\n for (var ii = 0; ii < iters.length; ii++) {\n SetIterable(iters[ii]).forEach(function(value ) {return set.add(value)});\n }\n });\n };\n\n Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0);\n if (iters.length === 0) {\n return this;\n }\n iters = iters.map(function(iter ) {return SetIterable(iter)});\n var originalSet = this;\n return this.withMutations(function(set ) {\n originalSet.forEach(function(value ) {\n if (!iters.every(function(iter ) {return iter.includes(value)})) {\n set.remove(value);\n }\n });\n });\n };\n\n Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0);\n if (iters.length === 0) {\n return this;\n }\n iters = iters.map(function(iter ) {return SetIterable(iter)});\n var originalSet = this;\n return this.withMutations(function(set ) {\n originalSet.forEach(function(value ) {\n if (iters.some(function(iter ) {return iter.includes(value)})) {\n set.remove(value);\n }\n });\n });\n };\n\n Set.prototype.merge = function() {\n return this.union.apply(this, arguments);\n };\n\n Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return this.union.apply(this, iters);\n };\n\n Set.prototype.sort = function(comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator));\n };\n\n Set.prototype.sortBy = function(mapper, comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator, mapper));\n };\n\n Set.prototype.wasAltered = function() {\n return this._map.wasAltered();\n };\n\n Set.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._map.__iterate(function(_, k) {return fn(k, k, this$0)}, reverse);\n };\n\n Set.prototype.__iterator = function(type, reverse) {\n return this._map.map(function(_, k) {return k}).__iterator(type, reverse);\n };\n\n Set.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n return this.__make(newMap, ownerID);\n };\n\n\n function isSet(maybeSet) {\n return !!(maybeSet && maybeSet[IS_SET_SENTINEL]);\n }\n\n Set.isSet = isSet;\n\n var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';\n\n var SetPrototype = Set.prototype;\n SetPrototype[IS_SET_SENTINEL] = true;\n SetPrototype[DELETE] = SetPrototype.remove;\n SetPrototype.mergeDeep = SetPrototype.merge;\n SetPrototype.mergeDeepWith = SetPrototype.mergeWith;\n SetPrototype.withMutations = MapPrototype.withMutations;\n SetPrototype.asMutable = MapPrototype.asMutable;\n SetPrototype.asImmutable = MapPrototype.asImmutable;\n\n SetPrototype.__empty = emptySet;\n SetPrototype.__make = makeSet;\n\n function updateSet(set, newMap) {\n if (set.__ownerID) {\n set.size = newMap.size;\n set._map = newMap;\n return set;\n }\n return newMap === set._map ? set :\n newMap.size === 0 ? set.__empty() :\n set.__make(newMap);\n }\n\n function makeSet(map, ownerID) {\n var set = Object.create(SetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n }\n\n var EMPTY_SET;\n function emptySet() {\n return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));\n }\n\n createClass(OrderedSet, Set);\n\n // @pragma Construction\n\n function OrderedSet(value) {\n return value === null || value === undefined ? emptyOrderedSet() :\n isOrderedSet(value) ? value :\n emptyOrderedSet().withMutations(function(set ) {\n var iter = SetIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v ) {return set.add(v)});\n });\n }\n\n OrderedSet.of = function(/*...values*/) {\n return this(arguments);\n };\n\n OrderedSet.fromKeys = function(value) {\n return this(KeyedIterable(value).keySeq());\n };\n\n OrderedSet.prototype.toString = function() {\n return this.__toString('OrderedSet {', '}');\n };\n\n\n function isOrderedSet(maybeOrderedSet) {\n return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);\n }\n\n OrderedSet.isOrderedSet = isOrderedSet;\n\n var OrderedSetPrototype = OrderedSet.prototype;\n OrderedSetPrototype[IS_ORDERED_SENTINEL] = true;\n\n OrderedSetPrototype.__empty = emptyOrderedSet;\n OrderedSetPrototype.__make = makeOrderedSet;\n\n function makeOrderedSet(map, ownerID) {\n var set = Object.create(OrderedSetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n }\n\n var EMPTY_ORDERED_SET;\n function emptyOrderedSet() {\n return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()));\n }\n\n createClass(Stack, IndexedCollection);\n\n // @pragma Construction\n\n function Stack(value) {\n return value === null || value === undefined ? emptyStack() :\n isStack(value) ? value :\n emptyStack().unshiftAll(value);\n }\n\n Stack.of = function(/*...values*/) {\n return this(arguments);\n };\n\n Stack.prototype.toString = function() {\n return this.__toString('Stack [', ']');\n };\n\n // @pragma Access\n\n Stack.prototype.get = function(index, notSetValue) {\n var head = this._head;\n index = wrapIndex(this, index);\n while (head && index--) {\n head = head.next;\n }\n return head ? head.value : notSetValue;\n };\n\n Stack.prototype.peek = function() {\n return this._head && this._head.value;\n };\n\n // @pragma Modification\n\n Stack.prototype.push = function(/*...values*/) {\n if (arguments.length === 0) {\n return this;\n }\n var newSize = this.size + arguments.length;\n var head = this._head;\n for (var ii = arguments.length - 1; ii >= 0; ii--) {\n head = {\n value: arguments[ii],\n next: head\n };\n }\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pushAll = function(iter) {\n iter = IndexedIterable(iter);\n if (iter.size === 0) {\n return this;\n }\n assertNotInfinite(iter.size);\n var newSize = this.size;\n var head = this._head;\n iter.reverse().forEach(function(value ) {\n newSize++;\n head = {\n value: value,\n next: head\n };\n });\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pop = function() {\n return this.slice(1);\n };\n\n Stack.prototype.unshift = function(/*...values*/) {\n return this.push.apply(this, arguments);\n };\n\n Stack.prototype.unshiftAll = function(iter) {\n return this.pushAll(iter);\n };\n\n Stack.prototype.shift = function() {\n return this.pop.apply(this, arguments);\n };\n\n Stack.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._head = undefined;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyStack();\n };\n\n Stack.prototype.slice = function(begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n var resolvedBegin = resolveBegin(begin, this.size);\n var resolvedEnd = resolveEnd(end, this.size);\n if (resolvedEnd !== this.size) {\n // super.slice(begin, end);\n return IndexedCollection.prototype.slice.call(this, begin, end);\n }\n var newSize = this.size - resolvedBegin;\n var head = this._head;\n while (resolvedBegin--) {\n head = head.next;\n }\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n // @pragma Mutability\n\n Stack.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n return makeStack(this.size, this._head, ownerID, this.__hash);\n };\n\n // @pragma Iteration\n\n Stack.prototype.__iterate = function(fn, reverse) {\n if (reverse) {\n return this.reverse().__iterate(fn);\n }\n var iterations = 0;\n var node = this._head;\n while (node) {\n if (fn(node.value, iterations++, this) === false) {\n break;\n }\n node = node.next;\n }\n return iterations;\n };\n\n Stack.prototype.__iterator = function(type, reverse) {\n if (reverse) {\n return this.reverse().__iterator(type);\n }\n var iterations = 0;\n var node = this._head;\n return new Iterator(function() {\n if (node) {\n var value = node.value;\n node = node.next;\n return iteratorValue(type, iterations++, value);\n }\n return iteratorDone();\n });\n };\n\n\n function isStack(maybeStack) {\n return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]);\n }\n\n Stack.isStack = isStack;\n\n var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';\n\n var StackPrototype = Stack.prototype;\n StackPrototype[IS_STACK_SENTINEL] = true;\n StackPrototype.withMutations = MapPrototype.withMutations;\n StackPrototype.asMutable = MapPrototype.asMutable;\n StackPrototype.asImmutable = MapPrototype.asImmutable;\n StackPrototype.wasAltered = MapPrototype.wasAltered;\n\n\n function makeStack(size, head, ownerID, hash) {\n var map = Object.create(StackPrototype);\n map.size = size;\n map._head = head;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n }\n\n var EMPTY_STACK;\n function emptyStack() {\n return EMPTY_STACK || (EMPTY_STACK = makeStack(0));\n }\n\n /**\n * Contributes additional methods to a constructor\n */\n function mixin(ctor, methods) {\n var keyCopier = function(key ) { ctor.prototype[key] = methods[key]; };\n Object.keys(methods).forEach(keyCopier);\n Object.getOwnPropertySymbols &&\n Object.getOwnPropertySymbols(methods).forEach(keyCopier);\n return ctor;\n }\n\n Iterable.Iterator = Iterator;\n\n mixin(Iterable, {\n\n // ### Conversion to other types\n\n toArray: function() {\n assertNotInfinite(this.size);\n var array = new Array(this.size || 0);\n this.valueSeq().__iterate(function(v, i) { array[i] = v; });\n return array;\n },\n\n toIndexedSeq: function() {\n return new ToIndexedSequence(this);\n },\n\n toJS: function() {\n return this.toSeq().map(\n function(value ) {return value && typeof value.toJS === 'function' ? value.toJS() : value}\n ).__toJS();\n },\n\n toJSON: function() {\n return this.toSeq().map(\n function(value ) {return value && typeof value.toJSON === 'function' ? value.toJSON() : value}\n ).__toJS();\n },\n\n toKeyedSeq: function() {\n return new ToKeyedSequence(this, true);\n },\n\n toMap: function() {\n // Use Late Binding here to solve the circular dependency.\n return Map(this.toKeyedSeq());\n },\n\n toObject: function() {\n assertNotInfinite(this.size);\n var object = {};\n this.__iterate(function(v, k) { object[k] = v; });\n return object;\n },\n\n toOrderedMap: function() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedMap(this.toKeyedSeq());\n },\n\n toOrderedSet: function() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedSet(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toSet: function() {\n // Use Late Binding here to solve the circular dependency.\n return Set(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toSetSeq: function() {\n return new ToSetSequence(this);\n },\n\n toSeq: function() {\n return isIndexed(this) ? this.toIndexedSeq() :\n isKeyed(this) ? this.toKeyedSeq() :\n this.toSetSeq();\n },\n\n toStack: function() {\n // Use Late Binding here to solve the circular dependency.\n return Stack(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toList: function() {\n // Use Late Binding here to solve the circular dependency.\n return List(isKeyed(this) ? this.valueSeq() : this);\n },\n\n\n // ### Common JavaScript methods and properties\n\n toString: function() {\n return '[Iterable]';\n },\n\n __toString: function(head, tail) {\n if (this.size === 0) {\n return head + tail;\n }\n return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail;\n },\n\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n concat: function() {var values = SLICE$0.call(arguments, 0);\n return reify(this, concatFactory(this, values));\n },\n\n includes: function(searchValue) {\n return this.some(function(value ) {return is(value, searchValue)});\n },\n\n entries: function() {\n return this.__iterator(ITERATE_ENTRIES);\n },\n\n every: function(predicate, context) {\n assertNotInfinite(this.size);\n var returnValue = true;\n this.__iterate(function(v, k, c) {\n if (!predicate.call(context, v, k, c)) {\n returnValue = false;\n return false;\n }\n });\n return returnValue;\n },\n\n filter: function(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, true));\n },\n\n find: function(predicate, context, notSetValue) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[1] : notSetValue;\n },\n\n forEach: function(sideEffect, context) {\n assertNotInfinite(this.size);\n return this.__iterate(context ? sideEffect.bind(context) : sideEffect);\n },\n\n join: function(separator) {\n assertNotInfinite(this.size);\n separator = separator !== undefined ? '' + separator : ',';\n var joined = '';\n var isFirst = true;\n this.__iterate(function(v ) {\n isFirst ? (isFirst = false) : (joined += separator);\n joined += v !== null && v !== undefined ? v.toString() : '';\n });\n return joined;\n },\n\n keys: function() {\n return this.__iterator(ITERATE_KEYS);\n },\n\n map: function(mapper, context) {\n return reify(this, mapFactory(this, mapper, context));\n },\n\n reduce: function(reducer, initialReduction, context) {\n assertNotInfinite(this.size);\n var reduction;\n var useFirst;\n if (arguments.length < 2) {\n useFirst = true;\n } else {\n reduction = initialReduction;\n }\n this.__iterate(function(v, k, c) {\n if (useFirst) {\n useFirst = false;\n reduction = v;\n } else {\n reduction = reducer.call(context, reduction, v, k, c);\n }\n });\n return reduction;\n },\n\n reduceRight: function(reducer, initialReduction, context) {\n var reversed = this.toKeyedSeq().reverse();\n return reversed.reduce.apply(reversed, arguments);\n },\n\n reverse: function() {\n return reify(this, reverseFactory(this, true));\n },\n\n slice: function(begin, end) {\n return reify(this, sliceFactory(this, begin, end, true));\n },\n\n some: function(predicate, context) {\n return !this.every(not(predicate), context);\n },\n\n sort: function(comparator) {\n return reify(this, sortFactory(this, comparator));\n },\n\n values: function() {\n return this.__iterator(ITERATE_VALUES);\n },\n\n\n // ### More sequential methods\n\n butLast: function() {\n return this.slice(0, -1);\n },\n\n isEmpty: function() {\n return this.size !== undefined ? this.size === 0 : !this.some(function() {return true});\n },\n\n count: function(predicate, context) {\n return ensureSize(\n predicate ? this.toSeq().filter(predicate, context) : this\n );\n },\n\n countBy: function(grouper, context) {\n return countByFactory(this, grouper, context);\n },\n\n equals: function(other) {\n return deepEqual(this, other);\n },\n\n entrySeq: function() {\n var iterable = this;\n if (iterable._cache) {\n // We cache as an entries array, so we can just return the cache!\n return new ArraySeq(iterable._cache);\n }\n var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq();\n entriesSequence.fromEntrySeq = function() {return iterable.toSeq()};\n return entriesSequence;\n },\n\n filterNot: function(predicate, context) {\n return this.filter(not(predicate), context);\n },\n\n findEntry: function(predicate, context, notSetValue) {\n var found = notSetValue;\n this.__iterate(function(v, k, c) {\n if (predicate.call(context, v, k, c)) {\n found = [k, v];\n return false;\n }\n });\n return found;\n },\n\n findKey: function(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry && entry[0];\n },\n\n findLast: function(predicate, context, notSetValue) {\n return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);\n },\n\n findLastEntry: function(predicate, context, notSetValue) {\n return this.toKeyedSeq().reverse().findEntry(predicate, context, notSetValue);\n },\n\n findLastKey: function(predicate, context) {\n return this.toKeyedSeq().reverse().findKey(predicate, context);\n },\n\n first: function() {\n return this.find(returnTrue);\n },\n\n flatMap: function(mapper, context) {\n return reify(this, flatMapFactory(this, mapper, context));\n },\n\n flatten: function(depth) {\n return reify(this, flattenFactory(this, depth, true));\n },\n\n fromEntrySeq: function() {\n return new FromEntriesSequence(this);\n },\n\n get: function(searchKey, notSetValue) {\n return this.find(function(_, key) {return is(key, searchKey)}, undefined, notSetValue);\n },\n\n getIn: function(searchKeyPath, notSetValue) {\n var nested = this;\n // Note: in an ES6 environment, we would prefer:\n // for (var key of searchKeyPath) {\n var iter = forceIterator(searchKeyPath);\n var step;\n while (!(step = iter.next()).done) {\n var key = step.value;\n nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET;\n if (nested === NOT_SET) {\n return notSetValue;\n }\n }\n return nested;\n },\n\n groupBy: function(grouper, context) {\n return groupByFactory(this, grouper, context);\n },\n\n has: function(searchKey) {\n return this.get(searchKey, NOT_SET) !== NOT_SET;\n },\n\n hasIn: function(searchKeyPath) {\n return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET;\n },\n\n isSubset: function(iter) {\n iter = typeof iter.includes === 'function' ? iter : Iterable(iter);\n return this.every(function(value ) {return iter.includes(value)});\n },\n\n isSuperset: function(iter) {\n iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter);\n return iter.isSubset(this);\n },\n\n keyOf: function(searchValue) {\n return this.findKey(function(value ) {return is(value, searchValue)});\n },\n\n keySeq: function() {\n return this.toSeq().map(keyMapper).toIndexedSeq();\n },\n\n last: function() {\n return this.toSeq().reverse().first();\n },\n\n lastKeyOf: function(searchValue) {\n return this.toKeyedSeq().reverse().keyOf(searchValue);\n },\n\n max: function(comparator) {\n return maxFactory(this, comparator);\n },\n\n maxBy: function(mapper, comparator) {\n return maxFactory(this, comparator, mapper);\n },\n\n min: function(comparator) {\n return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator);\n },\n\n minBy: function(mapper, comparator) {\n return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper);\n },\n\n rest: function() {\n return this.slice(1);\n },\n\n skip: function(amount) {\n return this.slice(Math.max(0, amount));\n },\n\n skipLast: function(amount) {\n return reify(this, this.toSeq().reverse().skip(amount).reverse());\n },\n\n skipWhile: function(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, true));\n },\n\n skipUntil: function(predicate, context) {\n return this.skipWhile(not(predicate), context);\n },\n\n sortBy: function(mapper, comparator) {\n return reify(this, sortFactory(this, comparator, mapper));\n },\n\n take: function(amount) {\n return this.slice(0, Math.max(0, amount));\n },\n\n takeLast: function(amount) {\n return reify(this, this.toSeq().reverse().take(amount).reverse());\n },\n\n takeWhile: function(predicate, context) {\n return reify(this, takeWhileFactory(this, predicate, context));\n },\n\n takeUntil: function(predicate, context) {\n return this.takeWhile(not(predicate), context);\n },\n\n valueSeq: function() {\n return this.toIndexedSeq();\n },\n\n\n // ### Hashable Object\n\n hashCode: function() {\n return this.__hash || (this.__hash = hashIterable(this));\n }\n\n\n // ### Internal\n\n // abstract __iterate(fn, reverse)\n\n // abstract __iterator(type, reverse)\n });\n\n // var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n // var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n // var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n // var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n var IterablePrototype = Iterable.prototype;\n IterablePrototype[IS_ITERABLE_SENTINEL] = true;\n IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values;\n IterablePrototype.__toJS = IterablePrototype.toArray;\n IterablePrototype.__toStringMapper = quoteString;\n IterablePrototype.inspect =\n IterablePrototype.toSource = function() { return this.toString(); };\n IterablePrototype.chain = IterablePrototype.flatMap;\n IterablePrototype.contains = IterablePrototype.includes;\n\n mixin(KeyedIterable, {\n\n // ### More sequential methods\n\n flip: function() {\n return reify(this, flipFactory(this));\n },\n\n mapEntries: function(mapper, context) {var this$0 = this;\n var iterations = 0;\n return reify(this,\n this.toSeq().map(\n function(v, k) {return mapper.call(context, [k, v], iterations++, this$0)}\n ).fromEntrySeq()\n );\n },\n\n mapKeys: function(mapper, context) {var this$0 = this;\n return reify(this,\n this.toSeq().flip().map(\n function(k, v) {return mapper.call(context, k, v, this$0)}\n ).flip()\n );\n }\n\n });\n\n var KeyedIterablePrototype = KeyedIterable.prototype;\n KeyedIterablePrototype[IS_KEYED_SENTINEL] = true;\n KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries;\n KeyedIterablePrototype.__toJS = IterablePrototype.toObject;\n KeyedIterablePrototype.__toStringMapper = function(v, k) {return JSON.stringify(k) + ': ' + quoteString(v)};\n\n\n\n mixin(IndexedIterable, {\n\n // ### Conversion to other types\n\n toKeyedSeq: function() {\n return new ToKeyedSequence(this, false);\n },\n\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n filter: function(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, false));\n },\n\n findIndex: function(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[0] : -1;\n },\n\n indexOf: function(searchValue) {\n var key = this.keyOf(searchValue);\n return key === undefined ? -1 : key;\n },\n\n lastIndexOf: function(searchValue) {\n var key = this.lastKeyOf(searchValue);\n return key === undefined ? -1 : key;\n },\n\n reverse: function() {\n return reify(this, reverseFactory(this, false));\n },\n\n slice: function(begin, end) {\n return reify(this, sliceFactory(this, begin, end, false));\n },\n\n splice: function(index, removeNum /*, ...values*/) {\n var numArgs = arguments.length;\n removeNum = Math.max(removeNum | 0, 0);\n if (numArgs === 0 || (numArgs === 2 && !removeNum)) {\n return this;\n }\n // If index is negative, it should resolve relative to the size of the\n // collection. However size may be expensive to compute if not cached, so\n // only call count() if the number is in fact negative.\n index = resolveBegin(index, index < 0 ? this.count() : this.size);\n var spliced = this.slice(0, index);\n return reify(\n this,\n numArgs === 1 ?\n spliced :\n spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum))\n );\n },\n\n\n // ### More collection methods\n\n findLastIndex: function(predicate, context) {\n var entry = this.findLastEntry(predicate, context);\n return entry ? entry[0] : -1;\n },\n\n first: function() {\n return this.get(0);\n },\n\n flatten: function(depth) {\n return reify(this, flattenFactory(this, depth, false));\n },\n\n get: function(index, notSetValue) {\n index = wrapIndex(this, index);\n return (index < 0 || (this.size === Infinity ||\n (this.size !== undefined && index > this.size))) ?\n notSetValue :\n this.find(function(_, key) {return key === index}, undefined, notSetValue);\n },\n\n has: function(index) {\n index = wrapIndex(this, index);\n return index >= 0 && (this.size !== undefined ?\n this.size === Infinity || index < this.size :\n this.indexOf(index) !== -1\n );\n },\n\n interpose: function(separator) {\n return reify(this, interposeFactory(this, separator));\n },\n\n interleave: function(/*...iterables*/) {\n var iterables = [this].concat(arrCopy(arguments));\n var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables);\n var interleaved = zipped.flatten(true);\n if (zipped.size) {\n interleaved.size = zipped.size * iterables.length;\n }\n return reify(this, interleaved);\n },\n\n keySeq: function() {\n return Range(0, this.size);\n },\n\n last: function() {\n return this.get(-1);\n },\n\n skipWhile: function(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, false));\n },\n\n zip: function(/*, ...iterables */) {\n var iterables = [this].concat(arrCopy(arguments));\n return reify(this, zipWithFactory(this, defaultZipper, iterables));\n },\n\n zipWith: function(zipper/*, ...iterables */) {\n var iterables = arrCopy(arguments);\n iterables[0] = this;\n return reify(this, zipWithFactory(this, zipper, iterables));\n }\n\n });\n\n IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true;\n IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n\n mixin(SetIterable, {\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n get: function(value, notSetValue) {\n return this.has(value) ? value : notSetValue;\n },\n\n includes: function(value) {\n return this.has(value);\n },\n\n\n // ### More sequential methods\n\n keySeq: function() {\n return this.valueSeq();\n }\n\n });\n\n SetIterable.prototype.has = IterablePrototype.includes;\n SetIterable.prototype.contains = SetIterable.prototype.includes;\n\n\n // Mixin subclasses\n\n mixin(KeyedSeq, KeyedIterable.prototype);\n mixin(IndexedSeq, IndexedIterable.prototype);\n mixin(SetSeq, SetIterable.prototype);\n\n mixin(KeyedCollection, KeyedIterable.prototype);\n mixin(IndexedCollection, IndexedIterable.prototype);\n mixin(SetCollection, SetIterable.prototype);\n\n\n // #pragma Helper functions\n\n function keyMapper(v, k) {\n return k;\n }\n\n function entryMapper(v, k) {\n return [k, v];\n }\n\n function not(predicate) {\n return function() {\n return !predicate.apply(this, arguments);\n }\n }\n\n function neg(predicate) {\n return function() {\n return -predicate.apply(this, arguments);\n }\n }\n\n function quoteString(value) {\n return typeof value === 'string' ? JSON.stringify(value) : String(value);\n }\n\n function defaultZipper() {\n return arrCopy(arguments);\n }\n\n function defaultNegComparator(a, b) {\n return a < b ? 1 : a > b ? -1 : 0;\n }\n\n function hashIterable(iterable) {\n if (iterable.size === Infinity) {\n return 0;\n }\n var ordered = isOrdered(iterable);\n var keyed = isKeyed(iterable);\n var h = ordered ? 1 : 0;\n var size = iterable.__iterate(\n keyed ?\n ordered ?\n function(v, k) { h = 31 * h + hashMerge(hash(v), hash(k)) | 0; } :\n function(v, k) { h = h + hashMerge(hash(v), hash(k)) | 0; } :\n ordered ?\n function(v ) { h = 31 * h + hash(v) | 0; } :\n function(v ) { h = h + hash(v) | 0; }\n );\n return murmurHashOfSize(size, h);\n }\n\n function murmurHashOfSize(size, h) {\n h = imul(h, 0xCC9E2D51);\n h = imul(h << 15 | h >>> -15, 0x1B873593);\n h = imul(h << 13 | h >>> -13, 5);\n h = (h + 0xE6546B64 | 0) ^ size;\n h = imul(h ^ h >>> 16, 0x85EBCA6B);\n h = imul(h ^ h >>> 13, 0xC2B2AE35);\n h = smi(h ^ h >>> 16);\n return h;\n }\n\n function hashMerge(a, b) {\n return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int\n }\n\n var Immutable = {\n\n Iterable: Iterable,\n\n Seq: Seq,\n Collection: Collection,\n Map: Map,\n OrderedMap: OrderedMap,\n List: List,\n Stack: Stack,\n Set: Set,\n OrderedSet: OrderedSet,\n\n Record: Record,\n Range: Range,\n Repeat: Repeat,\n\n is: is,\n fromJS: fromJS\n\n };\n\n return Immutable;\n\n}));\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/immutable/dist/immutable.js\n ** module id = 3\n ** module chunks = 0\n **/","/**\n * Checks if the passed in value is a string\n * @param {*} val\n * @return {boolean}\n */\nexports.isString = function(val) {\n return typeof val === 'string' || objectToString(val) === '[object String]'\n}\n\n/**\n * Checks if the passed in value is an array\n * @param {*} val\n * @return {boolean}\n */\nexports.isArray = Array.isArray /* istanbul ignore next */|| function(val) {\n return objectToString(val) === '[object Array]'\n}\n\n// taken from underscore source to account for browser discrepancy\n/* istanbul ignore if */\nif (typeof /./ !== 'function' && typeof Int8Array !== 'object') {\n /**\n * Checks if the passed in value is a function\n * @param {*} val\n * @return {boolean}\n */\n exports.isFunction = function(obj) {\n return typeof obj === 'function' || false\n }\n} else {\n /**\n * Checks if the passed in value is a function\n * @param {*} val\n * @return {boolean}\n */\n exports.isFunction = function(val) {\n return toString.call(val) === '[object Function]'\n }\n}\n\n/**\n * Checks if the passed in value is of type Object\n * @param {*} val\n * @return {boolean}\n */\nexports.isObject = function(obj) {\n var type = typeof obj\n return type === 'function' || type === 'object' && !!obj\n}\n\n/**\n * Extends an object with the properties of additional objects\n * @param {object} obj\n * @param {object} objects\n * @return {object}\n */\nexports.extend = function(obj) {\n var length = arguments.length\n\n if (!obj || length < 2) {\n return obj || {}\n }\n\n for (var index = 1; index < length; index++) {\n var source = arguments[index]\n var keys = Object.keys(source)\n var l = keys.length\n\n for (var i = 0; i < l; i++) {\n var key = keys[i]\n obj[key] = source[key]\n }\n }\n\n return obj\n}\n\n/**\n * Creates a shallow clone of an object\n * @param {object} obj\n * @return {object}\n */\nexports.clone = function(obj) {\n if (!exports.isObject(obj)) {\n return obj\n }\n return exports.isArray(obj) ? obj.slice() : exports.extend({}, obj)\n}\n\n/**\n * Iterates over a collection of elements yielding each iteration to an\n * iteratee. The iteratee may be bound to the context argument and is invoked\n * each time with three arguments (value, index|key, collection). Iteration may\n * be exited early by explicitly returning false.\n * @param {array|object|string} collection\n * @param {function} iteratee\n * @param {*} context\n * @return {array|object|string}\n */\nexports.each = function(collection, iteratee, context) {\n var length = collection ? collection.length : 0\n var i = -1\n var keys\n var origIteratee\n\n if (context) {\n origIteratee = iteratee\n iteratee = function(value, index, innerCollection) {\n return origIteratee.call(context, value, index, innerCollection)\n }\n }\n\n if (isLength(length)) {\n while (++i < length) {\n if (iteratee(collection[i], i, collection) === false) {\n break\n }\n }\n } else {\n keys = Object.keys(collection)\n length = keys.length\n while (++i < length) {\n if (iteratee(collection[keys[i]], keys[i], collection) === false) {\n break\n }\n }\n }\n\n return collection\n}\n\n/**\n * Returns a new function the invokes `func` with `partialArgs` prepended to\n * any passed into the new function. Acts like `Array.prototype.bind`, except\n * it does not alter `this` context.\n * @param {function} func\n * @param {*} partialArgs\n * @return {function}\n */\nexports.partial = function(func) {\n var slice = Array.prototype.slice\n var partialArgs = slice.call(arguments, 1)\n\n return function() {\n return func.apply(this, partialArgs.concat(slice.call(arguments)))\n }\n}\n\n/**\n * Returns a factory method that allows construction with or without `new`\n */\nexports.toFactory = function(Klass) {\n var Factory = function(...args) {\n return new Klass(...args)\n }\n\n Factory.__proto__ = Klass // eslint-disable-line no-proto\n Factory.prototype = Klass.prototype\n return Factory\n}\n\n/**\n * Returns the text value representation of an object\n * @private\n * @param {*} obj\n * @return {string}\n */\nfunction objectToString(obj) {\n return obj && typeof obj === 'object' && toString.call(obj)\n}\n\n/**\n * Checks if the value is a valid array-like length.\n * @private\n * @param {*} val\n * @return {bool}\n */\nfunction isLength(val) {\n return typeof val === 'number'\n && val > -1\n && val % 1 === 0\n && val <= Number.MAX_VALUE\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils.js\n **/","import Immutable from 'immutable'\nimport { isObject } from './utils'\n\n/**\n * A collection of helpers for the ImmutableJS library\n */\n\n/**\n * @param {*} obj\n * @return {boolean}\n */\nexport function isImmutable(obj) {\n return Immutable.Iterable.isIterable(obj)\n}\n\n/**\n * Returns true if the value is an ImmutableJS data structure\n * or a JavaScript primitive that is immutable (string, number, etc)\n * @param {*} obj\n * @return {boolean}\n */\nexport function isImmutableValue(obj) {\n return (\n isImmutable(obj) ||\n !isObject(obj)\n )\n}\n\n/**\n * Converts an Immutable Sequence to JS object\n * Can be called on any type\n */\nexport function toJS(arg) {\n // arg instanceof Immutable.Sequence is unreliable\n return (isImmutable(arg))\n ? arg.toJS()\n : arg\n}\n\n/**\n * Converts a JS object to an Immutable object, if it's\n * already Immutable its a no-op\n */\nexport function toImmutable(arg) {\n return (isImmutable(arg))\n ? arg\n : Immutable.fromJS(arg)\n}\n\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/immutable-helpers.js\n **/","import Immutable from 'immutable'\nimport createReactMixin from './create-react-mixin'\nimport * as fns from './reactor/fns'\nimport { DefaultCache } from './reactor/cache'\nimport { NoopLogger, ConsoleGroupLogger } from './logging'\nimport { isKeyPath } from './key-path'\nimport { isGetter } from './getter'\nimport { toJS } from './immutable-helpers'\nimport { extend, toFactory } from './utils'\nimport {\n ReactorState,\n ObserverState,\n DEBUG_OPTIONS,\n PROD_OPTIONS,\n} from './reactor/records'\n\n/**\n * State is stored in NuclearJS Reactors. Reactors\n * contain a 'state' object which is an Immutable.Map\n *\n * The only way Reactors can change state is by reacting to\n * messages. To update state, Reactor's dispatch messages to\n * all registered cores, and the core returns it's new\n * state based on the message\n */\nclass Reactor {\n constructor(config = {}) {\n const debug = !!config.debug\n const baseOptions = debug ? DEBUG_OPTIONS : PROD_OPTIONS\n // if defined, merge the custom implementation over the noop logger to avoid undefined lookups,\n // otherwise, just use the built-in console group logger\n let logger = config.logger ? extend({}, NoopLogger, config.logger) : NoopLogger\n if (!config.logger && debug) {\n logger = ConsoleGroupLogger\n }\n const initialReactorState = new ReactorState({\n debug: debug,\n cache: config.cache || DefaultCache(),\n logger: logger,\n // merge config options with the defaults\n options: baseOptions.merge(config.options || {}),\n })\n\n this.prevReactorState = initialReactorState\n this.reactorState = initialReactorState\n this.observerState = new ObserverState()\n\n this.ReactMixin = createReactMixin(this)\n\n // keep track of the depth of batch nesting\n this.__batchDepth = 0\n\n // keep track if we are currently dispatching\n this.__isDispatching = false\n }\n\n /**\n * Evaluates a KeyPath or Getter in context of the reactor state\n * @param {KeyPath|Getter} keyPathOrGetter\n * @return {*}\n */\n evaluate(keyPathOrGetter) {\n let { result, reactorState } = fns.evaluate(this.reactorState, keyPathOrGetter)\n this.reactorState = reactorState\n return result\n }\n\n /**\n * Gets the coerced state (to JS object) of the reactor.evaluate\n * @param {KeyPath|Getter} keyPathOrGetter\n * @return {*}\n */\n evaluateToJS(keyPathOrGetter) {\n return toJS(this.evaluate(keyPathOrGetter))\n }\n\n /**\n * Adds a change observer whenever a certain part of the reactor state changes\n *\n * 1. observe(handlerFn) - 1 argument, called anytime reactor.state changes\n * 2. observe(keyPath, handlerFn) same as above\n * 3. observe(getter, handlerFn) called whenever any getter dependencies change with\n * the value of the getter\n *\n * Adds a change handler whenever certain deps change\n * If only one argument is passed invoked the handler whenever\n * the reactor state changes\n *\n * @param {KeyPath|Getter} getter\n * @param {function} handler\n * @return {function} unwatch function\n */\n observe(getter, handler) {\n if (arguments.length === 1) {\n handler = getter\n getter = []\n }\n let { observerState, entry } = fns.addObserver(this.observerState, getter, handler)\n this.observerState = observerState\n return () => {\n this.observerState = fns.removeObserverByEntry(this.observerState, entry)\n }\n }\n\n unobserve(getter, handler) {\n if (arguments.length === 0) {\n throw new Error('Must call unobserve with a Getter')\n }\n if (!isGetter(getter) && !isKeyPath(getter)) {\n throw new Error('Must call unobserve with a Getter')\n }\n\n this.observerState = fns.removeObserver(this.observerState, getter, handler)\n }\n\n /**\n * Dispatches a single message\n * @param {string} actionType\n * @param {object|undefined} payload\n */\n dispatch(actionType, payload) {\n if (this.__batchDepth === 0) {\n if (fns.getOption(this.reactorState, 'throwOnDispatchInDispatch')) {\n if (this.__isDispatching) {\n this.__isDispatching = false\n throw new Error('Dispatch may not be called while a dispatch is in progress')\n }\n }\n this.__isDispatching = true\n }\n\n try {\n this.reactorState = fns.dispatch(this.reactorState, actionType, payload)\n } catch (e) {\n this.__isDispatching = false\n throw e\n }\n\n try {\n this.__notify()\n } finally {\n this.__isDispatching = false\n }\n }\n\n /**\n * Allows batching of dispatches before notifying change observers\n * @param {Function} fn\n */\n batch(fn) {\n this.batchStart()\n fn()\n this.batchEnd()\n }\n\n /**\n * @deprecated\n * @param {String} id\n * @param {Store} store\n */\n registerStore(id, store) {\n /* eslint-disable no-console */\n console.warn('Deprecation warning: `registerStore` will no longer be supported in 1.1, use `registerStores` instead')\n /* eslint-enable no-console */\n this.registerStores({\n [id]: store,\n })\n }\n\n /**\n * @param {Object} stores\n */\n registerStores(stores) {\n this.reactorState = fns.registerStores(this.reactorState, stores)\n this.__notify()\n }\n\n /**\n * Replace store implementation (handlers) without modifying the app state or calling getInitialState\n * Useful for hot reloading\n * @param {Object} stores\n */\n replaceStores(stores) {\n this.reactorState = fns.replaceStores(this.reactorState, stores)\n }\n\n /**\n * Returns a plain object representing the application state\n * @return {Object}\n */\n serialize() {\n return fns.serialize(this.reactorState)\n }\n\n /**\n * @param {Object} state\n */\n loadState(state) {\n this.reactorState = fns.loadState(this.reactorState, state)\n this.__notify()\n }\n\n /**\n * Resets the state of a reactor and returns back to initial state\n */\n reset() {\n const newState = fns.reset(this.reactorState)\n this.reactorState = newState\n this.prevReactorState = newState\n this.observerState = new ObserverState()\n }\n\n /**\n * Notifies all change observers with the current state\n * @private\n */\n __notify() {\n if (this.__batchDepth > 0) {\n // in the middle of batch, dont notify\n return\n }\n\n const dirtyStores = this.reactorState.get('dirtyStores')\n if (dirtyStores.size === 0) {\n return\n }\n\n let observerIdsToNotify = Immutable.Set().withMutations(set => {\n // notify all observers\n set.union(this.observerState.get('any'))\n\n dirtyStores.forEach(id => {\n const entries = this.observerState.getIn(['stores', id])\n if (!entries) {\n return\n }\n set.union(entries)\n })\n })\n\n observerIdsToNotify.forEach((observerId) => {\n const entry = this.observerState.getIn(['observersMap', observerId])\n if (!entry) {\n // don't notify here in the case a handler called unobserve on another observer\n return\n }\n\n const getter = entry.get('getter')\n const handler = entry.get('handler')\n\n const prevEvaluateResult = fns.evaluate(this.prevReactorState, getter)\n const currEvaluateResult = fns.evaluate(this.reactorState, getter)\n\n this.prevReactorState = prevEvaluateResult.reactorState\n this.reactorState = currEvaluateResult.reactorState\n\n const prevValue = prevEvaluateResult.result\n const currValue = currEvaluateResult.result\n\n if (!Immutable.is(prevValue, currValue)) {\n handler.call(null, currValue)\n }\n })\n\n const nextReactorState = fns.resetDirtyStores(this.reactorState)\n\n this.prevReactorState = nextReactorState\n this.reactorState = nextReactorState\n }\n\n /**\n * Starts batching, ie pausing notifies and batching up changes\n * to be notified when batchEnd() is called\n */\n batchStart() {\n this.__batchDepth++\n }\n\n /**\n * Ends a batch cycle and will notify obsevers of all changes if\n * the batch depth is back to 0 (outer most batch completed)\n */\n batchEnd() {\n this.__batchDepth--\n\n if (this.__batchDepth <= 0) {\n // set to true to catch if dispatch called from observer\n this.__isDispatching = true\n try {\n this.__notify()\n } catch (e) {\n this.__isDispatching = false\n throw e\n }\n this.__isDispatching = false\n }\n }\n}\n\nexport default toFactory(Reactor)\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/reactor.js\n **/","import { each } from './utils'\n\n/**\n * Returns a mapping of the getDataBinding keys to\n * the reactor values\n */\nfunction getState(reactor, data) {\n let state = {}\n each(data, (value, key) => {\n state[key] = reactor.evaluate(value)\n })\n return state\n}\n\n/**\n * @param {Reactor} reactor\n */\nexport default function(reactor) {\n return {\n getInitialState() {\n return getState(reactor, this.getDataBindings())\n },\n\n componentDidMount() {\n this.__unwatchFns = []\n each(this.getDataBindings(), (getter, key) => {\n const unwatchFn = reactor.observe(getter, (val) => {\n this.setState({\n [key]: val,\n })\n })\n\n this.__unwatchFns.push(unwatchFn)\n })\n },\n\n componentWillUnmount() {\n while (this.__unwatchFns.length) {\n this.__unwatchFns.shift()()\n }\n },\n }\n}\n\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/create-react-mixin.js\n **/","import Immutable from 'immutable'\nimport { CacheEntry } from './cache'\nimport { isImmutableValue } from '../immutable-helpers'\nimport { toImmutable } from '../immutable-helpers'\nimport { fromKeyPath, getStoreDeps, getComputeFn, getDeps, isGetter } from '../getter'\nimport { isEqual, isKeyPath } from '../key-path'\nimport { each } from '../utils'\n\n/**\n * Immutable Types\n */\nconst EvaluateResult = Immutable.Record({ result: null, reactorState: null})\n\nfunction evaluateResult(result, reactorState) {\n return new EvaluateResult({\n result: result,\n reactorState: reactorState,\n })\n}\n\n/**\n * @param {ReactorState} reactorState\n * @param {Object} stores\n * @return {ReactorState}\n */\nexport function registerStores(reactorState, stores) {\n return reactorState.withMutations((reactorState) => {\n each(stores, (store, id) => {\n if (reactorState.getIn(['stores', id])) {\n /* eslint-disable no-console */\n console.warn('Store already defined for id = ' + id)\n /* eslint-enable no-console */\n }\n\n const initialState = store.getInitialState()\n\n if (initialState === undefined && getOption(reactorState, 'throwOnUndefinedStoreReturnValue')) {\n throw new Error('Store getInitialState() must return a value, did you forget a return statement')\n }\n if (getOption(reactorState, 'throwOnNonImmutableStore') && !isImmutableValue(initialState)) {\n throw new Error('Store getInitialState() must return an immutable value, did you forget to call toImmutable')\n }\n\n reactorState\n .update('stores', stores => stores.set(id, store))\n .update('state', state => state.set(id, initialState))\n .update('dirtyStores', state => state.add(id))\n .update('storeStates', storeStates => incrementStoreStates(storeStates, [id]))\n })\n incrementId(reactorState)\n })\n}\n\n/**\n * Overrides the store implementation without resetting the value of that particular part of the app state\n * this is useful when doing hot reloading of stores.\n * @param {ReactorState} reactorState\n * @param {Object} stores\n * @return {ReactorState}\n */\nexport function replaceStores(reactorState, stores) {\n return reactorState.withMutations((reactorState) => {\n each(stores, (store, id) => {\n reactorState.update('stores', stores => stores.set(id, store))\n })\n })\n}\n\n/**\n * @param {ReactorState} reactorState\n * @param {String} actionType\n * @param {*} payload\n * @return {ReactorState}\n */\nexport function dispatch(reactorState, actionType, payload) {\n let logging = reactorState.get('logger')\n\n if (actionType === undefined && getOption(reactorState, 'throwOnUndefinedActionType')) {\n throw new Error('`dispatch` cannot be called with an `undefined` action type.')\n }\n\n const currState = reactorState.get('state')\n let dirtyStores = reactorState.get('dirtyStores')\n\n const nextState = currState.withMutations(state => {\n logging.dispatchStart(reactorState, actionType, payload)\n\n // let each store handle the message\n reactorState.get('stores').forEach((store, id) => {\n const currState = state.get(id)\n let newState\n\n try {\n newState = store.handle(currState, actionType, payload)\n } catch(e) {\n // ensure console.group is properly closed\n logging.dispatchError(reactorState, e.message)\n throw e\n }\n\n if (newState === undefined && getOption(reactorState, 'throwOnUndefinedStoreReturnValue')) {\n const errorMsg = 'Store handler must return a value, did you forget a return statement'\n logging.dispatchError(reactorState, errorMsg)\n throw new Error(errorMsg)\n }\n\n state.set(id, newState)\n\n if (currState !== newState) {\n // if the store state changed add store to list of dirty stores\n dirtyStores = dirtyStores.add(id)\n }\n })\n\n logging.dispatchEnd(reactorState, state, dirtyStores, currState)\n })\n\n const nextReactorState = reactorState\n .set('state', nextState)\n .set('dirtyStores', dirtyStores)\n .update('storeStates', storeStates => incrementStoreStates(storeStates, dirtyStores))\n\n return incrementId(nextReactorState)\n}\n\n/**\n * @param {ReactorState} reactorState\n * @param {Immutable.Map} state\n * @return {ReactorState}\n */\nexport function loadState(reactorState, state) {\n let dirtyStores = []\n const stateToLoad = toImmutable({}).withMutations(stateToLoad => {\n each(state, (serializedStoreState, storeId) => {\n const store = reactorState.getIn(['stores', storeId])\n if (store) {\n const storeState = store.deserialize(serializedStoreState)\n if (storeState !== undefined) {\n stateToLoad.set(storeId, storeState)\n dirtyStores.push(storeId)\n }\n }\n })\n })\n\n const dirtyStoresSet = Immutable.Set(dirtyStores)\n return reactorState\n .update('state', state => state.merge(stateToLoad))\n .update('dirtyStores', stores => stores.union(dirtyStoresSet))\n .update('storeStates', storeStates => incrementStoreStates(storeStates, dirtyStores))\n}\n\n/**\n * Adds a change observer whenever a certain part of the reactor state changes\n *\n * 1. observe(handlerFn) - 1 argument, called anytime reactor.state changes\n * 2. observe(keyPath, handlerFn) same as above\n * 3. observe(getter, handlerFn) called whenever any getter dependencies change with\n * the value of the getter\n *\n * Adds a change handler whenever certain deps change\n * If only one argument is passed invoked the handler whenever\n * the reactor state changes\n *\n * @param {ObserverState} observerState\n * @param {KeyPath|Getter} getter\n * @param {function} handler\n * @return {ObserveResult}\n */\nexport function addObserver(observerState, getter, handler) {\n // use the passed in getter as the key so we can rely on a byreference call for unobserve\n const getterKey = getter\n if (isKeyPath(getter)) {\n getter = fromKeyPath(getter)\n }\n\n const currId = observerState.get('nextId')\n const storeDeps = getStoreDeps(getter)\n const entry = Immutable.Map({\n id: currId,\n storeDeps: storeDeps,\n getterKey: getterKey,\n getter: getter,\n handler: handler,\n })\n\n let updatedObserverState\n if (storeDeps.size === 0) {\n // no storeDeps means the observer is dependent on any of the state changing\n updatedObserverState = observerState.update('any', observerIds => observerIds.add(currId))\n } else {\n updatedObserverState = observerState.withMutations(map => {\n storeDeps.forEach(storeId => {\n let path = ['stores', storeId]\n if (!map.hasIn(path)) {\n map.setIn(path, Immutable.Set())\n }\n map.updateIn(['stores', storeId], observerIds => observerIds.add(currId))\n })\n })\n }\n\n updatedObserverState = updatedObserverState\n .set('nextId', currId + 1)\n .setIn(['observersMap', currId], entry)\n\n return {\n observerState: updatedObserverState,\n entry: entry,\n }\n}\n\n/**\n * @param {ReactorState} reactorState\n * @param {String} option\n * @return {Boolean}\n */\nexport function getOption(reactorState, option) {\n const value = reactorState.getIn(['options', option])\n if (value === undefined) {\n throw new Error('Invalid option: ' + option)\n }\n return value\n}\n\n/**\n * Use cases\n * removeObserver(observerState, [])\n * removeObserver(observerState, [], handler)\n * removeObserver(observerState, ['keyPath'])\n * removeObserver(observerState, ['keyPath'], handler)\n * removeObserver(observerState, getter)\n * removeObserver(observerState, getter, handler)\n * @param {ObserverState} observerState\n * @param {KeyPath|Getter} getter\n * @param {Function} handler\n * @return {ObserverState}\n */\nexport function removeObserver(observerState, getter, handler) {\n const entriesToRemove = observerState.get('observersMap').filter(entry => {\n // use the getterKey in the case of a keyPath is transformed to a getter in addObserver\n let entryGetter = entry.get('getterKey')\n let handlersMatch = (!handler || entry.get('handler') === handler)\n if (!handlersMatch) {\n return false\n }\n // check for a by-value equality of keypaths\n if (isKeyPath(getter) && isKeyPath(entryGetter)) {\n return isEqual(getter, entryGetter)\n }\n // we are comparing two getters do it by reference\n return (getter === entryGetter)\n })\n\n return observerState.withMutations(map => {\n entriesToRemove.forEach(entry => removeObserverByEntry(map, entry))\n })\n}\n\n/**\n * Removes an observer entry by id from the observerState\n * @param {ObserverState} observerState\n * @param {Immutable.Map} entry\n * @return {ObserverState}\n */\nexport function removeObserverByEntry(observerState, entry) {\n return observerState.withMutations(map => {\n const id = entry.get('id')\n const storeDeps = entry.get('storeDeps')\n\n if (storeDeps.size === 0) {\n map.update('any', anyObsevers => anyObsevers.remove(id))\n } else {\n storeDeps.forEach(storeId => {\n map.updateIn(['stores', storeId], observers => {\n if (observers) {\n // check for observers being present because reactor.reset() can be called before an unwatch fn\n return observers.remove(id)\n }\n return observers\n })\n })\n }\n\n map.removeIn(['observersMap', id])\n })\n}\n\n/**\n * @param {ReactorState} reactorState\n * @return {ReactorState}\n */\nexport function reset(reactorState) {\n const prevState = reactorState.get('state')\n\n return reactorState.withMutations(reactorState => {\n const storeMap = reactorState.get('stores')\n const storeIds = storeMap.keySeq().toJS()\n storeMap.forEach((store, id) => {\n const storeState = prevState.get(id)\n const resetStoreState = store.handleReset(storeState)\n if (resetStoreState === undefined && getOption(reactorState, 'throwOnUndefinedStoreReturnValue')) {\n throw new Error('Store handleReset() must return a value, did you forget a return statement')\n }\n if (getOption(reactorState, 'throwOnNonImmutableStore') && !isImmutableValue(resetStoreState)) {\n throw new Error('Store reset state must be an immutable value, did you forget to call toImmutable')\n }\n reactorState.setIn(['state', id], resetStoreState)\n })\n\n reactorState.update('storeStates', storeStates => incrementStoreStates(storeStates, storeIds))\n resetDirtyStores(reactorState)\n })\n}\n\n/**\n * @param {ReactorState} reactorState\n * @param {KeyPath|Gettter} keyPathOrGetter\n * @return {EvaluateResult}\n */\nexport function evaluate(reactorState, keyPathOrGetter) {\n const state = reactorState.get('state')\n\n if (isKeyPath(keyPathOrGetter)) {\n // if its a keyPath simply return\n return evaluateResult(\n state.getIn(keyPathOrGetter),\n reactorState\n )\n } else if (!isGetter(keyPathOrGetter)) {\n throw new Error('evaluate must be passed a keyPath or Getter')\n }\n\n // Must be a Getter\n\n const cache = reactorState.get('cache')\n var cacheEntry = cache.lookup(keyPathOrGetter)\n const isCacheMiss = !cacheEntry || isDirtyCacheEntry(reactorState, cacheEntry)\n if (isCacheMiss) {\n cacheEntry = createCacheEntry(reactorState, keyPathOrGetter)\n }\n\n return evaluateResult(\n cacheEntry.get('value'),\n reactorState.update('cache', cache => {\n return isCacheMiss ?\n cache.miss(keyPathOrGetter, cacheEntry) :\n cache.hit(keyPathOrGetter)\n })\n )\n}\n\n/**\n * Returns serialized state for all stores\n * @param {ReactorState} reactorState\n * @return {Object}\n */\nexport function serialize(reactorState) {\n let serialized = {}\n reactorState.get('stores').forEach((store, id) => {\n let storeState = reactorState.getIn(['state', id])\n let serializedState = store.serialize(storeState)\n if (serializedState !== undefined) {\n serialized[id] = serializedState\n }\n })\n return serialized\n}\n\n/**\n * Returns serialized state for all stores\n * @param {ReactorState} reactorState\n * @return {ReactorState}\n */\nexport function resetDirtyStores(reactorState) {\n return reactorState.set('dirtyStores', Immutable.Set())\n}\n\n/**\n * @param {ReactorState} reactorState\n * @param {CacheEntry} cacheEntry\n * @return {boolean}\n */\nfunction isDirtyCacheEntry(reactorState, cacheEntry) {\n const storeStates = cacheEntry.get('storeStates')\n\n // if there are no store states for this entry then it was never cached before\n return !storeStates.size || storeStates.some((stateId, storeId) => {\n return reactorState.getIn(['storeStates', storeId]) !== stateId\n })\n}\n\n/**\n * Evaluates getter for given reactorState and returns CacheEntry\n * @param {ReactorState} reactorState\n * @param {Getter} getter\n * @return {CacheEntry}\n */\nfunction createCacheEntry(reactorState, getter) {\n // evaluate dependencies\n const args = getDeps(getter).map(dep => evaluate(reactorState, dep).result)\n const value = getComputeFn(getter).apply(null, args)\n\n const storeDeps = getStoreDeps(getter)\n const storeStates = toImmutable({}).withMutations(map => {\n storeDeps.forEach(storeId => {\n const stateId = reactorState.getIn(['storeStates', storeId])\n map.set(storeId, stateId)\n })\n })\n\n return CacheEntry({\n value: value,\n storeStates: storeStates,\n dispatchId: reactorState.get('dispatchId'),\n })\n}\n\n/**\n * @param {ReactorState} reactorState\n * @return {ReactorState}\n */\nfunction incrementId(reactorState) {\n return reactorState.update('dispatchId', id => id + 1)\n}\n\n\n/**\n * @param {Immutable.Map} storeStates\n * @param {Array} storeIds\n * @return {Immutable.Map}\n */\nfunction incrementStoreStates(storeStates, storeIds) {\n return storeStates.withMutations(map => {\n storeIds.forEach(id => {\n const nextId = map.has(id) ? map.get(id) + 1 : 1\n map.set(id, nextId)\n })\n })\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/reactor/fns.js\n **/","import { Map, OrderedSet, Record } from 'immutable'\n\nexport const CacheEntry = Record({\n value: null,\n storeStates: Map(),\n dispatchId: null,\n})\n\n/*******************************************************************************\n * interface PersistentCache {\n * has(item)\n * lookup(item, notFoundValue)\n * hit(item)\n * miss(item, entry)\n * evict(item)\n * asMap()\n * }\n *\n * Inspired by clojure.core.cache/CacheProtocol\n *******************************************************************************/\n\n/**\n * Plain map-based cache\n */\nexport class BasicCache {\n\n /**\n * @param {Immutable.Map} cache\n */\n constructor(cache = Map()) {\n this.cache = cache\n }\n\n /**\n * Retrieve the associated value, if it exists in this cache, otherwise\n * returns notFoundValue (or undefined if not provided)\n * @param {Object} item\n * @param {Object?} notFoundValue\n * @return {CacheEntry?}\n */\n lookup(item, notFoundValue) {\n return this.cache.get(item, notFoundValue)\n }\n\n /**\n * Checks if this cache contains an associated value\n * @param {Object} item\n * @return {boolean}\n */\n has(item) {\n return this.cache.has(item)\n }\n\n /**\n * Return cached items as map\n * @return {Immutable.Map}\n */\n asMap() {\n return this.cache\n }\n\n /**\n * Updates this cache when it is determined to contain the associated value\n * @param {Object} item\n * @return {BasicCache}\n */\n hit(item) {\n return this\n }\n\n /**\n * Updates this cache when it is determined to **not** contain the associated value\n * @param {Object} item\n * @param {CacheEntry} entry\n * @return {BasicCache}\n */\n miss(item, entry) {\n return new BasicCache(\n this.cache.update(item, existingEntry => {\n if (existingEntry && existingEntry.dispatchId > entry.dispatchId) {\n throw new Error('Refusing to cache older value')\n }\n return entry\n })\n )\n }\n\n /**\n * Removes entry from cache\n * @param {Object} item\n * @return {BasicCache}\n */\n evict(item) {\n return new BasicCache(this.cache.remove(item))\n }\n}\n\nconst DEFAULT_LRU_LIMIT = 1000\nconst DEFAULT_LRU_EVICT_COUNT = 1\n\n/**\n * Implements caching strategy that evicts least-recently-used items in cache\n * when an item is being added to a cache that has reached a configured size\n * limit.\n */\nexport class LRUCache {\n\n constructor(limit = DEFAULT_LRU_LIMIT, evictCount = DEFAULT_LRU_EVICT_COUNT, cache = new BasicCache(), lru = OrderedSet()) {\n console.log(\"using LRU\")\n this.limit = limit\n this.evictCount = evictCount\n this.cache = cache\n this.lru = lru\n }\n\n /**\n * Retrieve the associated value, if it exists in this cache, otherwise\n * returns notFoundValue (or undefined if not provided)\n * @param {Object} item\n * @param {Object?} notFoundValue\n * @return {CacheEntry}\n */\n lookup(item, notFoundValue) {\n return this.cache.lookup(item, notFoundValue)\n }\n\n /**\n * Checks if this cache contains an associated value\n * @param {Object} item\n * @return {boolean}\n */\n has(item) {\n return this.cache.has(item)\n }\n\n /**\n * Return cached items as map\n * @return {Immutable.Map}\n */\n asMap() {\n return this.cache.asMap()\n }\n\n /**\n * Updates this cache when it is determined to contain the associated value\n * @param {Object} item\n * @return {LRUCache}\n */\n hit(item) {\n if (!this.cache.has(item)) {\n return this\n }\n\n // remove it first to reorder in lru OrderedSet\n return new LRUCache(this.limit, this.evictCount, this.cache, this.lru.remove(item).add(item))\n }\n\n /**\n * Updates this cache when it is determined to **not** contain the associated value\n * If cache has reached size limit, the LRU item is evicted.\n * @param {Object} item\n * @param {CacheEntry} entry\n * @return {LRUCache}\n */\n miss(item, entry) {\n var lruCache\n if (this.lru.size >= this.limit) {\n if (this.has(item)) {\n return new LRUCache(\n this.limit,\n this.evictCount,\n this.cache.miss(item, entry),\n this.lru.remove(item).add(item)\n )\n }\n\n const cache = (this.lru\n .take(this.evictCount)\n .reduce((c, evictItem) => c.evict(evictItem), this.cache)\n .miss(item, entry))\n\n lruCache = new LRUCache(\n this.limit,\n this.evictCount,\n cache,\n this.lru.skip(this.evictCount).add(item)\n )\n } else {\n lruCache = new LRUCache(\n this.limit,\n this.evictCount,\n this.cache.miss(item, entry),\n this.lru.add(item)\n )\n }\n return lruCache\n }\n\n /**\n * Removes entry from cache\n * @param {Object} item\n * @return {LRUCache}\n */\n evict(item) {\n if (!this.cache.has(item)) {\n return this\n }\n\n return new LRUCache(\n this.limit,\n this.evictCount,\n this.cache.evict(item),\n this.lru.remove(item)\n )\n }\n}\n\n/**\n * Returns default cache strategy\n * @return {BasicCache}\n */\nexport function DefaultCache() {\n return new BasicCache()\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/reactor/cache.js\n **/","import Immutable, { List } from 'immutable'\nimport { isFunction, isArray } from './utils'\nimport { isKeyPath } from './key-path'\n\n/**\n * Getter helper functions\n * A getter is an array with the form:\n * [, ..., ]\n */\nconst identity = (x) => x\n\n/**\n * Checks if something is a getter literal, ex: ['dep1', 'dep2', function(dep1, dep2) {...}]\n * @param {*} toTest\n * @return {boolean}\n */\nfunction isGetter(toTest) {\n return (isArray(toTest) && isFunction(toTest[toTest.length - 1]))\n}\n\n/**\n * Returns the compute function from a getter\n * @param {Getter} getter\n * @return {function}\n */\nfunction getComputeFn(getter) {\n return getter[getter.length - 1]\n}\n\n/**\n * Returns an array of deps from a getter\n * @param {Getter} getter\n * @return {function}\n */\nfunction getDeps(getter) {\n return getter.slice(0, getter.length - 1)\n}\n\n/**\n * Returns an array of deps from a getter and all its deps\n * @param {Getter} getter\n * @param {Immutable.Set} existing\n * @return {Immutable.Set}\n */\nfunction getFlattenedDeps(getter, existing) {\n if (!existing) {\n existing = Immutable.Set()\n }\n\n const toAdd = Immutable.Set().withMutations(set => {\n if (!isGetter(getter)) {\n throw new Error('getFlattenedDeps must be passed a Getter')\n }\n\n getDeps(getter).forEach(dep => {\n if (isKeyPath(dep)) {\n set.add(List(dep))\n } else if (isGetter(dep)) {\n set.union(getFlattenedDeps(dep))\n } else {\n throw new Error('Invalid getter, each dependency must be a KeyPath or Getter')\n }\n })\n })\n\n return existing.union(toAdd)\n}\n\n/**\n * @param {KeyPath}\n * @return {Getter}\n */\nfunction fromKeyPath(keyPath) {\n if (!isKeyPath(keyPath)) {\n throw new Error('Cannot create Getter from KeyPath: ' + keyPath)\n }\n\n return [keyPath, identity]\n}\n\n/**\n * Adds non enumerated __storeDeps property\n * @param {Getter}\n */\nfunction getStoreDeps(getter) {\n if (getter.hasOwnProperty('__storeDeps')) {\n return getter.__storeDeps\n }\n\n const storeDeps = getFlattenedDeps(getter)\n .map(keyPath => keyPath.first())\n .filter(x => !!x)\n\n\n Object.defineProperty(getter, '__storeDeps', {\n enumerable: false,\n configurable: false,\n writable: false,\n value: storeDeps,\n })\n\n return storeDeps\n}\n\nexport default {\n isGetter,\n getComputeFn,\n getFlattenedDeps,\n getStoreDeps,\n getDeps,\n fromKeyPath,\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/getter.js\n **/","import Immutable from 'immutable'\nimport { isArray, isFunction } from './utils'\n\n/**\n * Checks if something is simply a keyPath and not a getter\n * @param {*} toTest\n * @return {boolean}\n */\nexport function isKeyPath(toTest) {\n return (\n isArray(toTest) &&\n !isFunction(toTest[toTest.length - 1])\n )\n}\n\n/**\n * Checks if two keypaths are equal by value\n * @param {KeyPath} a\n * @param {KeyPath} a\n * @return {Boolean}\n */\nexport function isEqual(a, b) {\n const iA = Immutable.List(a)\n const iB = Immutable.List(b)\n\n return Immutable.is(iA, iB)\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/key-path.js\n **/","import { getOption } from './reactor/fns'\n\n/* eslint-disable no-console */\n/**\n * Wraps a Reactor.react invocation in a console.group\n */\nexport const ConsoleGroupLogger = {\n /**\n * @param {ReactorState} reactorState\n * @param {String} type\n * @param {*} payload\n */\n dispatchStart: function(reactorState, type, payload) {\n if (!getOption(reactorState, 'logDispatches')) {\n return\n }\n\n if (console.group) {\n console.groupCollapsed('Dispatch: %s', type)\n console.group('payload')\n console.debug(payload)\n console.groupEnd()\n }\n },\n /**\n * @param {ReactorState} reactorState\n * @param {Error} error\n */\n dispatchError: function(reactorState, error) {\n if (!getOption(reactorState, 'logDispatches')) {\n return\n }\n\n if (console.group) {\n console.debug('Dispatch error: ' + error)\n console.groupEnd()\n }\n },\n /**\n * @param {ReactorState} reactorState\n * @param {Map} state\n * @param {Set} dirtyStores\n */\n dispatchEnd: function(reactorState, state, dirtyStores, previousState) {\n if (!getOption(reactorState, 'logDispatches')) {\n return\n }\n\n if (console.group) {\n if (getOption(reactorState, 'logDirtyStores')) {\n console.log('Stores updated:', dirtyStores.toList().toJS())\n }\n\n if (getOption(reactorState, 'logAppState')) {\n console.debug('Dispatch done, new state: ', state.toJS())\n }\n console.groupEnd()\n }\n },\n}\n\n/* eslint-enable no-console */\n\nexport const NoopLogger = {\n /**\n * @param {ReactorState} reactorState\n * @param {String} type\n * @param {*} payload\n */\n dispatchStart: function(reactorState, type, payload) {\n },\n /**\n * @param {ReactorState} reactorState\n * @param {Error} error\n */\n dispatchError: function(reactorState, error) {\n },\n /**\n * @param {ReactorState} reactorState\n * @param {Map} state\n * @param {Set} dirtyStores\n */\n dispatchEnd: function(reactorState, state, dirtyStores) {\n },\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/logging.js\n **/","import { Map, Set, Record } from 'immutable'\nimport { DefaultCache } from './cache'\nimport { NoopLogger } from '../logging'\n\nexport const PROD_OPTIONS = Map({\n // logs information for each dispatch\n logDispatches: false,\n // log the entire app state after each dispatch\n logAppState: false,\n // logs what stores changed after a dispatch\n logDirtyStores: false,\n // if true, throws an error when dispatching an `undefined` actionType\n throwOnUndefinedActionType: false,\n // if true, throws an error if a store returns undefined\n throwOnUndefinedStoreReturnValue: false,\n // if true, throws an error if a store.getInitialState() returns a non immutable value\n throwOnNonImmutableStore: false,\n // if true, throws when dispatching in dispatch\n throwOnDispatchInDispatch: false,\n})\n\nexport const DEBUG_OPTIONS = Map({\n // logs information for each dispatch\n logDispatches: true,\n // log the entire app state after each dispatch\n logAppState: true,\n // logs what stores changed after a dispatch\n logDirtyStores: true,\n // if true, throws an error when dispatching an `undefined` actionType\n throwOnUndefinedActionType: true,\n // if true, throws an error if a store returns undefined\n throwOnUndefinedStoreReturnValue: true,\n // if true, throws an error if a store.getInitialState() returns a non immutable value\n throwOnNonImmutableStore: true,\n // if true, throws when dispatching in dispatch\n throwOnDispatchInDispatch: true,\n})\n\nexport const ReactorState = Record({\n dispatchId: 0,\n state: Map(),\n stores: Map(),\n cache: DefaultCache(),\n logger: NoopLogger,\n // maintains a mapping of storeId => state id (monotomically increasing integer whenever store state changes)\n storeStates: Map(),\n dirtyStores: Set(),\n debug: false,\n // production defaults\n options: PROD_OPTIONS,\n})\n\nexport const ObserverState = Record({\n // observers registered to any store change\n any: Set(),\n // observers registered to specific store changes\n stores: Map({}),\n\n observersMap: Map({}),\n\n nextId: 1,\n})\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/reactor/records.js\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/nuclear.min.js b/dist/nuclear.min.js index 68fc1f8..9692f25 100644 --- a/dist/nuclear.min.js +++ b/dist/nuclear.min.js @@ -1,3 +1,3 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Nuclear=e():t.Nuclear=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),r(1);var i=r(2),o=n(i),u=r(6),a=n(u),s=r(3),c=n(s),f=r(5),h=r(11),p=r(10),l=r(7),_=n(l);e["default"]={Reactor:a["default"],Store:o["default"],Immutable:c["default"],isKeyPath:h.isKeyPath,isGetter:p.isGetter,toJS:f.toJS,toImmutable:f.toImmutable,isImmutable:f.isImmutable,createReactMixin:_["default"]},t.exports=e["default"]},function(t,e){"use strict";try{window.console&&console.log||(console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){}})}catch(r){}},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t){return t instanceof c}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var r=0;ri;i++)n[i]=t[i+e];return n}function o(t){return void 0===t.size&&(t.size=t.__iterate(a)),t.size}function u(t,e){if("number"!=typeof e){var r=+e;if(""+r!==e)return NaN;e=r}return 0>e?o(t)+e:e}function a(){return!0}function s(t,e,r){return(0===t||void 0!==r&&-r>=t)&&(void 0===e||void 0!==r&&e>=r)}function c(t,e){return h(t,e,0)}function f(t,e){return h(t,e,e)}function h(t,e,r){return void 0===t?r:0>t?Math.max(0,e+t):void 0===e?t:Math.min(e,t)}function p(t){return d(t)?t:q(t)}function l(t){return y(t)?t:x(t)}function _(t){return g(t)?t:k(t)}function v(t){return d(t)&&!m(t)?t:A(t)}function d(t){return!(!t||!t[_r])}function y(t){return!(!t||!t[vr])}function g(t){return!(!t||!t[dr])}function m(t){return y(t)||g(t)}function S(t){return!(!t||!t[yr])}function w(t){this.next=t}function b(t,e,r,n){var i=0===t?e:1===t?r:[e,r];return n?n.value=i:n={value:i,done:!1},n}function I(){return{value:void 0,done:!0}}function z(t){return!!M(t)}function D(t){return t&&"function"==typeof t.next}function O(t){var e=M(t);return e&&e.call(t)}function M(t){var e=t&&(wr&&t[wr]||t[br]);return"function"==typeof e?e:void 0}function E(t){return t&&"number"==typeof t.length}function q(t){return null===t||void 0===t?T():d(t)?t.toSeq():J(t)}function x(t){return null===t||void 0===t?T().toKeyedSeq():d(t)?y(t)?t.toSeq():t.fromEntrySeq():L(t)}function k(t){return null===t||void 0===t?T():d(t)?y(t)?t.entrySeq():t.toIndexedSeq():B(t)}function A(t){return(null===t||void 0===t?T():d(t)?y(t)?t.entrySeq():t:B(t)).toSetSeq()}function j(t){this._array=t,this.size=t.length}function R(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length}function K(t){this._iterable=t,this.size=t.length||t.size}function U(t){this._iterator=t,this._iteratorCache=[]}function P(t){return!(!t||!t[zr])}function T(){return Dr||(Dr=new j([]))}function L(t){var e=Array.isArray(t)?new j(t).fromEntrySeq():D(t)?new U(t).fromEntrySeq():z(t)?new K(t).fromEntrySeq():"object"==typeof t?new R(t):void 0;if(!e)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+t);return e}function B(t){var e=W(t);if(!e)throw new TypeError("Expected Array or iterable object of values: "+t);return e}function J(t){var e=W(t)||"object"==typeof t&&new R(t);if(!e)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+t);return e}function W(t){return E(t)?new j(t):D(t)?new U(t):z(t)?new K(t):void 0}function N(t,e,r,n){var i=t._cache;if(i){for(var o=i.length-1,u=0;o>=u;u++){var a=i[r?o-u:u];if(e(a[1],n?a[0]:u,t)===!1)return u+1}return u}return t.__iterateUncached(e,r)}function C(t,e,r,n){var i=t._cache;if(i){var o=i.length-1,u=0;return new w(function(){var t=i[r?o-u:u];return u++>o?I():b(e,n?t[0]:u-1,t[1])})}return t.__iteratorUncached(e,r)}function F(){throw TypeError("Abstract")}function V(){}function G(){}function H(){}function X(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===e||t!==t&&e!==e)return!0;if(!t||!e)return!1}return"function"==typeof t.equals&&"function"==typeof e.equals&&t.equals(e)?!0:!1}function Y(t,e){return e?Q(e,t,"",{"":t}):Z(t)}function Q(t,e,r,n){return Array.isArray(e)?t.call(n,r,k(e).map(function(r,n){return Q(t,r,n,e)})):$(e)?t.call(n,r,x(e).map(function(r,n){return Q(t,r,n,e)})):e}function Z(t){return Array.isArray(t)?k(t).map(Z).toList():$(t)?x(t).map(Z).toMap():t}function $(t){return t&&(t.constructor===Object||void 0===t.constructor)}function tt(t){return t>>>1&1073741824|3221225471&t}function et(t){if(t===!1||null===t||void 0===t)return 0;if("function"==typeof t.valueOf&&(t=t.valueOf(),t===!1||null===t||void 0===t))return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){var r=0|t;for(r!==t&&(r^=4294967295*t);t>4294967295;)t/=4294967295,r^=t;return tt(r)}return"string"===e?t.length>jr?rt(t):nt(t):"function"==typeof t.hashCode?t.hashCode():it(t)}function rt(t){var e=Ur[t];return void 0===e&&(e=nt(t),Kr===Rr&&(Kr=0,Ur={}),Kr++,Ur[t]=e),e}function nt(t){for(var e=0,r=0;r0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function ut(t,e){if(!t)throw new Error(e)}function at(t){ut(t!==1/0,"Cannot perform this action with an infinite size.")}function st(t,e){this._iter=t,this._useKeys=e,this.size=t.size}function ct(t){this._iter=t,this.size=t.size}function ft(t){this._iter=t,this.size=t.size}function ht(t){this._iter=t,this.size=t.size}function pt(t){var e=jt(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=Rt,e.__iterateUncached=function(e,r){var n=this;return t.__iterate(function(t,r){return e(r,t,n)!==!1},r)},e.__iteratorUncached=function(e,r){if(e===Sr){var n=t.__iterator(e,r);return new w(function(){var t=n.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===mr?gr:mr,r)},e}function lt(t,e,r){var n=jt(t);return n.size=t.size,n.has=function(e){return t.has(e)},n.get=function(n,i){var o=t.get(n,hr);return o===hr?i:e.call(r,o,n,t)},n.__iterateUncached=function(n,i){var o=this;return t.__iterate(function(t,i,u){return n(e.call(r,t,i,u),i,o)!==!1},i)},n.__iteratorUncached=function(n,i){var o=t.__iterator(Sr,i);return new w(function(){var i=o.next();if(i.done)return i;var u=i.value,a=u[0];return b(n,a,e.call(r,u[1],a,t),i)})},n}function _t(t,e){var r=jt(t);return r._iter=t,r.size=t.size,r.reverse=function(){return t},t.flip&&(r.flip=function(){var e=pt(t);return e.reverse=function(){return t.flip()},e}),r.get=function(r,n){return t.get(e?r:-1-r,n)},r.has=function(r){return t.has(e?r:-1-r)},r.includes=function(e){return t.includes(e)},r.cacheResult=Rt,r.__iterate=function(e,r){var n=this;return t.__iterate(function(t,r){return e(t,r,n)},!r)},r.__iterator=function(e,r){return t.__iterator(e,!r)},r}function vt(t,e,r,n){var i=jt(t);return n&&(i.has=function(n){var i=t.get(n,hr);return i!==hr&&!!e.call(r,i,n,t)},i.get=function(n,i){var o=t.get(n,hr);return o!==hr&&e.call(r,o,n,t)?o:i}),i.__iterateUncached=function(i,o){var u=this,a=0;return t.__iterate(function(t,o,s){return e.call(r,t,o,s)?(a++,i(t,n?o:a-1,u)):void 0},o),a},i.__iteratorUncached=function(i,o){var u=t.__iterator(Sr,o),a=0;return new w(function(){for(;;){var o=u.next();if(o.done)return o;var s=o.value,c=s[0],f=s[1];if(e.call(r,f,c,t))return b(i,n?c:a++,f,o)}})},i}function dt(t,e,r){var n=Pt().asMutable();return t.__iterate(function(i,o){n.update(e.call(r,i,o,t),0,function(t){return t+1})}),n.asImmutable()}function yt(t,e,r){var n=y(t),i=(S(t)?Ie():Pt()).asMutable();t.__iterate(function(o,u){i.update(e.call(r,o,u,t),function(t){return t=t||[],t.push(n?[u,o]:o),t})});var o=At(t);return i.map(function(e){return qt(t,o(e))})}function gt(t,e,r,n){var i=t.size;if(void 0!==e&&(e=0|e),void 0!==r&&(r=0|r),s(e,r,i))return t;var o=c(e,i),a=f(r,i);if(o!==o||a!==a)return gt(t.toSeq().cacheResult(),e,r,n);var h,p=a-o;p===p&&(h=0>p?0:p);var l=jt(t);return l.size=0===h?h:t.size&&h||void 0,!n&&P(t)&&h>=0&&(l.get=function(e,r){return e=u(this,e),e>=0&&h>e?t.get(e+o,r):r}),l.__iterateUncached=function(e,r){var i=this;if(0===h)return 0;if(r)return this.cacheResult().__iterate(e,r);var u=0,a=!0,s=0;return t.__iterate(function(t,r){return a&&(a=u++h)return I();var t=i.next();return n||e===mr?t:e===gr?b(e,a-1,void 0,t):b(e,a-1,t.value[1],t)})},l}function mt(t,e,r){var n=jt(t);return n.__iterateUncached=function(n,i){var o=this;if(i)return this.cacheResult().__iterate(n,i);var u=0;return t.__iterate(function(t,i,a){return e.call(r,t,i,a)&&++u&&n(t,i,o)}),u},n.__iteratorUncached=function(n,i){var o=this;if(i)return this.cacheResult().__iterator(n,i);var u=t.__iterator(Sr,i),a=!0;return new w(function(){if(!a)return I();var t=u.next();if(t.done)return t;var i=t.value,s=i[0],c=i[1];return e.call(r,c,s,o)?n===Sr?t:b(n,s,c,t):(a=!1,I())})},n}function St(t,e,r,n){var i=jt(t);return i.__iterateUncached=function(i,o){var u=this;if(o)return this.cacheResult().__iterate(i,o);var a=!0,s=0;return t.__iterate(function(t,o,c){return a&&(a=e.call(r,t,o,c))?void 0:(s++,i(t,n?o:s-1,u))}),s},i.__iteratorUncached=function(i,o){var u=this;if(o)return this.cacheResult().__iterator(i,o);var a=t.__iterator(Sr,o),s=!0,c=0;return new w(function(){var t,o,f;do{if(t=a.next(),t.done)return n||i===mr?t:i===gr?b(i,c++,void 0,t):b(i,c++,t.value[1],t);var h=t.value;o=h[0],f=h[1],s&&(s=e.call(r,f,o,u))}while(s);return i===Sr?t:b(i,o,f,t)})},i}function wt(t,e){var r=y(t),n=[t].concat(e).map(function(t){return d(t)?r&&(t=l(t)):t=r?L(t):B(Array.isArray(t)?t:[t]),t}).filter(function(t){return 0!==t.size});if(0===n.length)return t;if(1===n.length){var i=n[0];if(i===t||r&&y(i)||g(t)&&g(i))return i}var o=new j(n);return r?o=o.toKeyedSeq():g(t)||(o=o.toSetSeq()),o=o.flatten(!0),o.size=n.reduce(function(t,e){if(void 0!==t){var r=e.size;if(void 0!==r)return t+r}},0),o}function bt(t,e,r){var n=jt(t);return n.__iterateUncached=function(n,i){function o(t,s){var c=this;t.__iterate(function(t,i){return(!e||e>s)&&d(t)?o(t,s+1):n(t,r?i:u++,c)===!1&&(a=!0),!a},i)}var u=0,a=!1;return o(t,0),u},n.__iteratorUncached=function(n,i){var o=t.__iterator(n,i),u=[],a=0;return new w(function(){for(;o;){var t=o.next();if(t.done===!1){var s=t.value;if(n===Sr&&(s=s[1]),e&&!(u.length0}function Et(t,e,r){var n=jt(t);return n.size=new j(r).map(function(t){return t.size}).min(),n.__iterate=function(t,e){for(var r,n=this.__iterator(mr,e),i=0;!(r=n.next()).done&&t(r.value,i++,this)!==!1;);return i},n.__iteratorUncached=function(t,n){var i=r.map(function(t){return t=p(t),O(n?t.reverse():t)}),o=0,u=!1;return new w(function(){var r;return u||(r=i.map(function(t){return t.next()}),u=r.some(function(t){return t.done})),u?I():b(t,o++,e.apply(null,r.map(function(t){return t.value})))})},n}function qt(t,e){return P(t)?e:t.constructor(e)}function xt(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function kt(t){return at(t.size),o(t)}function At(t){return y(t)?l:g(t)?_:v}function jt(t){return Object.create((y(t)?x:g(t)?k:A).prototype)}function Rt(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):q.prototype.cacheResult.call(this)}function Kt(t,e){return t>e?1:e>t?-1:0}function Ut(t){var e=O(t);if(!e){if(!E(t))throw new TypeError("Expected iterable or array-like: "+t);e=O(p(t))}return e}function Pt(t){return null===t||void 0===t?Ht():Tt(t)&&!S(t)?t:Ht().withMutations(function(e){var r=l(t);at(r.size),r.forEach(function(t,r){return e.set(r,t)})})}function Tt(t){return!(!t||!t[Pr])}function Lt(t,e){this.ownerID=t,this.entries=e}function Bt(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r}function Jt(t,e,r){this.ownerID=t,this.count=e,this.nodes=r}function Wt(t,e,r){this.ownerID=t,this.keyHash=e,this.entries=r}function Nt(t,e,r){this.ownerID=t,this.keyHash=e,this.entry=r}function Ct(t,e,r){this._type=e,this._reverse=r,this._stack=t._root&&Vt(t._root)}function Ft(t,e){return b(t,e[0],e[1])}function Vt(t,e){return{node:t,index:0,__prev:e}}function Gt(t,e,r,n){var i=Object.create(Tr);return i.size=t,i._root=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function Ht(){return Lr||(Lr=Gt(0))}function Xt(t,r,n){var i,o;if(t._root){var u=e(pr),a=e(lr);if(i=Yt(t._root,t.__ownerID,0,void 0,r,n,u,a),!a.value)return t;o=t.size+(u.value?n===hr?-1:1:0)}else{if(n===hr)return t;o=1,i=new Lt(t.__ownerID,[[r,n]])}return t.__ownerID?(t.size=o,t._root=i,t.__hash=void 0,t.__altered=!0,t):i?Gt(o,i):Ht()}function Yt(t,e,n,i,o,u,a,s){return t?t.update(e,n,i,o,u,a,s):u===hr?t:(r(s),r(a),new Nt(e,i,[o,u]))}function Qt(t){return t.constructor===Nt||t.constructor===Wt}function Zt(t,e,r,n,i){if(t.keyHash===n)return new Wt(e,n,[t.entry,i]);var o,u=(0===r?t.keyHash:t.keyHash>>>r)&fr,a=(0===r?n:n>>>r)&fr,s=u===a?[Zt(t,e,r+sr,n,i)]:(o=new Nt(e,n,i),a>u?[t,o]:[o,t]);return new Bt(e,1<a;a++,s<<=1){var f=e[a];void 0!==f&&a!==n&&(i|=s,u[o++]=f)}return new Bt(t,i,u)}function ee(t,e,r,n,i){for(var o=0,u=new Array(cr),a=0;0!==r;a++,r>>>=1)u[a]=1&r?e[o++]:void 0;return u[n]=i,new Jt(t,o+1,u)}function re(t,e,r){for(var n=[],i=0;i>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function ae(t,e,r,n){var o=n?t:i(t);return o[e]=r,o}function se(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var o=new Array(i),u=0,a=0;i>a;a++)a===e?(o[a]=r,u=-1):o[a]=t[a+u];return o}function ce(t,e,r){var n=t.length-1;if(r&&e===n)return t.pop(),t;for(var i=new Array(n),o=0,u=0;n>u;u++)u===e&&(o=1),i[u]=t[u+o];return i}function fe(t){var e=ve();if(null===t||void 0===t)return e;if(he(t))return t;var r=_(t),n=r.size;return 0===n?e:(at(n),n>0&&cr>n?_e(0,n,sr,null,new pe(r.toArray())):e.withMutations(function(t){t.setSize(n),r.forEach(function(e,r){return t.set(r,e)})}))}function he(t){return!(!t||!t[Nr])}function pe(t,e){this.array=t,this.ownerID=e}function le(t,e){function r(t,e,r){return 0===e?n(t,r):i(t,e,r)}function n(t,r){var n=r===a?s&&s.array:t&&t.array,i=r>o?0:o-r,c=u-r;return c>cr&&(c=cr),function(){if(i===c)return Vr;var t=e?--c:i++;return n&&n[t]}}function i(t,n,i){var a,s=t&&t.array,c=i>o?0:o-i>>n,f=(u-i>>n)+1;return f>cr&&(f=cr),function(){for(;;){if(a){var t=a();if(t!==Vr)return t;a=null}if(c===f)return Vr;var o=e?--f:c++;a=r(s&&s[o],n-sr,i+(o<=t.size||0>r)return t.withMutations(function(t){0>r?Se(t,r).set(0,n):Se(t,0,r+1).set(r,n)});r+=t._origin;var i=t._tail,o=t._root,a=e(lr);return r>=be(t._capacity)?i=ye(i,t.__ownerID,0,r,n,a):o=ye(o,t.__ownerID,t._level,r,n,a),a.value?t.__ownerID?(t._root=o,t._tail=i,t.__hash=void 0,t.__altered=!0,t):_e(t._origin,t._capacity,t._level,o,i):t}function ye(t,e,n,i,o,u){var a=i>>>n&fr,s=t&&a0){var f=t&&t.array[a],h=ye(f,e,n-sr,i,o,u);return h===f?t:(c=ge(t,e),c.array[a]=h,c)}return s&&t.array[a]===o?t:(r(u),c=ge(t,e),void 0===o&&a===c.array.length-1?c.array.pop():c.array[a]=o,c)}function ge(t,e){return e&&t&&e===t.ownerID?t:new pe(t?t.array.slice():[],e)}function me(t,e){if(e>=be(t._capacity))return t._tail;if(e<1<0;)r=r.array[e>>>n&fr],n-=sr;return r}}function Se(t,e,r){void 0!==e&&(e=0|e),void 0!==r&&(r=0|r);var i=t.__ownerID||new n,o=t._origin,u=t._capacity,a=o+e,s=void 0===r?u:0>r?u+r:o+r;if(a===o&&s===u)return t;if(a>=s)return t.clear();for(var c=t._level,f=t._root,h=0;0>a+h;)f=new pe(f&&f.array.length?[void 0,f]:[],i),c+=sr,h+=1<=1<l?me(t,s-1):l>p?new pe([],i):_;if(_&&l>p&&u>a&&_.array.length){f=ge(f,i);for(var d=f,y=c;y>sr;y-=sr){var g=p>>>y&fr;d=d.array[g]=ge(d.array[g],i)}d.array[p>>>sr&fr]=_}if(u>s&&(v=v&&v.removeAfter(i,0,s)),a>=l)a-=l,s-=l,c=sr,f=null,v=v&&v.removeBefore(i,0,a);else if(a>o||p>l){for(h=0;f;){var m=a>>>c&fr;if(m!==l>>>c&fr)break;m&&(h+=(1<o&&(f=f.removeBefore(i,c,a-h)),f&&p>l&&(f=f.removeAfter(i,c,l-h)),h&&(a-=h,s-=h)}return t.__ownerID?(t.size=s-a,t._origin=a,t._capacity=s,t._level=c,t._root=f,t._tail=v,t.__hash=void 0,t.__altered=!0,t):_e(a,s,c,f,v)}function we(t,e,r){for(var n=[],i=0,o=0;oi&&(i=a.size),d(u)||(a=a.map(function(t){return Y(t)})),n.push(a)}return i>t.size&&(t=t.setSize(i)),ie(t,e,n)}function be(t){return cr>t?0:t-1>>>sr<=cr&&u.size>=2*o.size?(i=u.filter(function(t,e){return void 0!==t&&a!==e}),n=i.toKeyedSeq().map(function(t){return t[0]}).flip().toMap(),t.__ownerID&&(n.__ownerID=i.__ownerID=t.__ownerID)):(n=o.remove(e),i=a===u.size-1?u.pop():u.set(a,void 0))}else if(s){if(r===u.get(a)[1])return t;n=o,i=u.set(a,[e,r])}else n=o.set(e,u.size),i=u.set(u.size,[e,r]);return t.__ownerID?(t.size=n.size,t._map=n,t._list=i,t.__hash=void 0,t):De(n,i)}function Ee(t){return null===t||void 0===t?ke():qe(t)?t:ke().unshiftAll(t)}function qe(t){return!(!t||!t[Hr])}function xe(t,e,r,n){var i=Object.create(Xr);return i.size=t,i._head=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function ke(){return Yr||(Yr=xe(0))}function Ae(t){return null===t||void 0===t?Ue():je(t)&&!S(t)?t:Ue().withMutations(function(e){var r=v(t);at(r.size),r.forEach(function(t){return e.add(t)})})}function je(t){return!(!t||!t[Qr])}function Re(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 Ke(t,e){var r=Object.create(Zr);return r.size=t?t.size:0,r._map=t,r.__ownerID=e,r}function Ue(){return $r||($r=Ke(Ht()))}function Pe(t){return null===t||void 0===t?Be():Te(t)?t:Be().withMutations(function(e){var r=v(t);at(r.size),r.forEach(function(t){return e.add(t)})})}function Te(t){return je(t)&&S(t)}function Le(t,e){var r=Object.create(tn);return r.size=t?t.size:0,r._map=t,r.__ownerID=e,r}function Be(){return en||(en=Le(Oe()))}function Je(t,e){var r,n=function(o){if(o instanceof n)return o;if(!(this instanceof n))return new n(o);if(!r){r=!0;var u=Object.keys(t);Ce(i,u),i.size=u.length,i._name=e,i._keys=u,i._defaultValues=t}this._map=Pt(o)},i=n.prototype=Object.create(rn);return i.constructor=n,n}function We(t,e,r){var n=Object.create(Object.getPrototypeOf(t));return n._map=e,n.__ownerID=r,n}function Ne(t){return t._name||t.constructor.name||"Record"}function Ce(t,e){try{e.forEach(Fe.bind(void 0,t))}catch(r){}}function Fe(t,e){Object.defineProperty(t,e,{get:function(){return this.get(e)},set:function(t){ut(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}function Ve(t,e){if(t===e)return!0;if(!d(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||y(t)!==y(e)||g(t)!==g(e)||S(t)!==S(e))return!1;if(0===t.size&&0===e.size)return!0;var r=!m(t);if(S(t)){var n=t.entries();return e.every(function(t,e){var i=n.next().value;return i&&X(i[1],t)&&(r||X(i[0],e))})&&n.next().done}var i=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{i=!0;var o=t;t=e,e=o}var u=!0,a=e.__iterate(function(e,n){return(r?t.has(e):i?X(e,t.get(n,hr)):X(t.get(n,hr),e))?void 0:(u=!1,!1)});return u&&t.size===a}function Ge(t,e,r){if(!(this instanceof Ge))return new Ge(t,e,r);if(ut(0!==r,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),r=void 0===r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,this.size=Math.max(0,Math.ceil((e-t)/r-1)+1),0===this.size){if(nn)return nn;nn=this}}function He(t,e){if(!(this instanceof He))return new He(t,e);if(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),0===this.size){if(on)return on;on=this}}function Xe(t,e){var r=function(r){t.prototype[r]=e[r]};return Object.keys(e).forEach(r),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(r),t}function Ye(t,e){return e}function Qe(t,e){return[e,t]}function Ze(t){return function(){return!t.apply(this,arguments)}}function $e(t){return function(){return-t.apply(this,arguments)}}function tr(t){return"string"==typeof t?JSON.stringify(t):t}function er(){return i(arguments)}function rr(t,e){return e>t?1:t>e?-1:0}function nr(t){if(t.size===1/0)return 0;var e=S(t),r=y(t),n=e?1:0,i=t.__iterate(r?e?function(t,e){n=31*n+or(et(t),et(e))|0}:function(t,e){n=n+or(et(t),et(e))|0}:e?function(t){n=31*n+et(t)|0}:function(t){n=n+et(t)|0});return ir(i,n)}function ir(t,e){return e=Mr(e,3432918353),e=Mr(e<<15|e>>>-15,461845907),e=Mr(e<<13|e>>>-13,5),e=(e+3864292196|0)^t,e=Mr(e^e>>>16,2246822507),e=Mr(e^e>>>13,3266489909),e=tt(e^e>>>16)}function or(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}var ur=Array.prototype.slice,ar="delete",sr=5,cr=1<=i;i++)if(t(r[e?n-i:i],i,this)===!1)return i+1;return i},j.prototype.__iterator=function(t,e){var r=this._array,n=r.length-1,i=0;return new w(function(){return i>n?I():b(t,i,r[e?n-i++:i++])})},t(R,x),R.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},R.prototype.has=function(t){return this._object.hasOwnProperty(t)},R.prototype.__iterate=function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,o=0;i>=o;o++){var u=n[e?i-o:o];if(t(r[u],u,this)===!1)return o+1}return o},R.prototype.__iterator=function(t,e){var r=this._object,n=this._keys,i=n.length-1,o=0;return new w(function(){var u=n[e?i-o:o];return o++>i?I():b(t,u,r[u])})},R.prototype[yr]=!0,t(K,k),K.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=O(r),i=0;if(D(n))for(var o;!(o=n.next()).done&&t(o.value,i++,this)!==!1;);return i},K.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterable,n=O(r);if(!D(n))return new w(I);var i=0;return new w(function(){var e=n.next();return e.done?e:b(t,i++,e.value)})},t(U,k),U.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var r=this._iterator,n=this._iteratorCache,i=0;i=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return b(t,i,n[i++])})};var Dr;t(F,p),t(V,F),t(G,F),t(H,F),F.Keyed=V,F.Indexed=G,F.Set=H;var Or,Mr="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,e){t=0|t,e=0|e;var r=65535&t,n=65535&e;return r*n+((t>>>16)*n+r*(e>>>16)<<16>>>0)|0},Er=Object.isExtensible,qr=function(){try{return Object.defineProperty({},"@",{}),!0}catch(t){return!1}}(),xr="function"==typeof WeakMap;xr&&(Or=new WeakMap);var kr=0,Ar="__immutablehash__";"function"==typeof Symbol&&(Ar=Symbol(Ar));var jr=16,Rr=255,Kr=0,Ur={};t(st,x),st.prototype.get=function(t,e){return this._iter.get(t,e)},st.prototype.has=function(t){return this._iter.has(t)},st.prototype.valueSeq=function(){return this._iter.valueSeq()},st.prototype.reverse=function(){var t=this,e=_t(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},st.prototype.map=function(t,e){var r=this,n=lt(this,t,e);return this._useKeys||(n.valueSeq=function(){return r._iter.toSeq().map(t,e)}),n},st.prototype.__iterate=function(t,e){var r,n=this;return this._iter.__iterate(this._useKeys?function(e,r){return t(e,r,n)}:(r=e?kt(this):0,function(i){return t(i,e?--r:r++,n)}),e)},st.prototype.__iterator=function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var r=this._iter.__iterator(mr,e),n=e?kt(this):0;return new w(function(){var i=r.next();return i.done?i:b(t,e?--n:n++,i.value,i)})},st.prototype[yr]=!0,t(ct,k),ct.prototype.includes=function(t){return this._iter.includes(t)},ct.prototype.__iterate=function(t,e){var r=this,n=0;return this._iter.__iterate(function(e){return t(e,n++,r)},e)},ct.prototype.__iterator=function(t,e){var r=this._iter.__iterator(mr,e),n=0;return new w(function(){var e=r.next();return e.done?e:b(t,n++,e.value,e)})},t(ft,A),ft.prototype.has=function(t){return this._iter.includes(t)},ft.prototype.__iterate=function(t,e){var r=this;return this._iter.__iterate(function(e){return t(e,e,r)},e)},ft.prototype.__iterator=function(t,e){var r=this._iter.__iterator(mr,e);return new w(function(){var e=r.next();return e.done?e:b(t,e.value,e.value,e)})},t(ht,x),ht.prototype.entrySeq=function(){return this._iter.toSeq()},ht.prototype.__iterate=function(t,e){var r=this;return this._iter.__iterate(function(e){if(e){xt(e);var n=d(e);return t(n?e.get(1):e[1],n?e.get(0):e[0],r)}},e)},ht.prototype.__iterator=function(t,e){var r=this._iter.__iterator(mr,e);return new w(function(){for(;;){var e=r.next();if(e.done)return e;var n=e.value; -if(n){xt(n);var i=d(n);return b(t,i?n.get(0):n[0],i?n.get(1):n[1],e)}}})},ct.prototype.cacheResult=st.prototype.cacheResult=ft.prototype.cacheResult=ht.prototype.cacheResult=Rt,t(Pt,V),Pt.prototype.toString=function(){return this.__toString("Map {","}")},Pt.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},Pt.prototype.set=function(t,e){return Xt(this,t,e)},Pt.prototype.setIn=function(t,e){return this.updateIn(t,hr,function(){return e})},Pt.prototype.remove=function(t){return Xt(this,t,hr)},Pt.prototype.deleteIn=function(t){return this.updateIn(t,function(){return hr})},Pt.prototype.update=function(t,e,r){return 1===arguments.length?t(this):this.updateIn([t],e,r)},Pt.prototype.updateIn=function(t,e,r){r||(r=e,e=void 0);var n=oe(this,Ut(t),e,r);return n===hr?void 0:n},Pt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Ht()},Pt.prototype.merge=function(){return re(this,void 0,arguments)},Pt.prototype.mergeWith=function(t){var e=ur.call(arguments,1);return re(this,t,e)},Pt.prototype.mergeIn=function(t){var e=ur.call(arguments,1);return this.updateIn(t,Ht(),function(t){return"function"==typeof t.merge?t.merge.apply(t,e):e[e.length-1]})},Pt.prototype.mergeDeep=function(){return re(this,ne(void 0),arguments)},Pt.prototype.mergeDeepWith=function(t){var e=ur.call(arguments,1);return re(this,ne(t),e)},Pt.prototype.mergeDeepIn=function(t){var e=ur.call(arguments,1);return this.updateIn(t,Ht(),function(t){return"function"==typeof t.mergeDeep?t.mergeDeep.apply(t,e):e[e.length-1]})},Pt.prototype.sort=function(t){return Ie(Dt(this,t))},Pt.prototype.sortBy=function(t,e){return Ie(Dt(this,e,t))},Pt.prototype.withMutations=function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},Pt.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new n)},Pt.prototype.asImmutable=function(){return this.__ensureOwner()},Pt.prototype.wasAltered=function(){return this.__altered},Pt.prototype.__iterator=function(t,e){return new Ct(this,t,e)},Pt.prototype.__iterate=function(t,e){var r=this,n=0;return this._root&&this._root.iterate(function(e){return n++,t(e[1],e[0],r)},e),n},Pt.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Gt(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Pt.isMap=Tt;var Pr="@@__IMMUTABLE_MAP__@@",Tr=Pt.prototype;Tr[Pr]=!0,Tr[ar]=Tr.remove,Tr.removeIn=Tr.deleteIn,Lt.prototype.get=function(t,e,r,n){for(var i=this.entries,o=0,u=i.length;u>o;o++)if(X(r,i[o][0]))return i[o][1];return n},Lt.prototype.update=function(t,e,n,o,u,a,s){for(var c=u===hr,f=this.entries,h=0,p=f.length;p>h&&!X(o,f[h][0]);h++);var l=p>h;if(l?f[h][1]===u:c)return this;if(r(s),(c||!l)&&r(a),!c||1!==f.length){if(!l&&!c&&f.length>=Br)return $t(t,f,o,u);var _=t&&t===this.ownerID,v=_?f:i(f);return l?c?h===p-1?v.pop():v[h]=v.pop():v[h]=[o,u]:v.push([o,u]),_?(this.entries=v,this):new Lt(t,v)}},Bt.prototype.get=function(t,e,r,n){void 0===e&&(e=et(r));var i=1<<((0===t?e:e>>>t)&fr),o=this.bitmap;return 0===(o&i)?n:this.nodes[ue(o&i-1)].get(t+sr,e,r,n)},Bt.prototype.update=function(t,e,r,n,i,o,u){void 0===r&&(r=et(n));var a=(0===e?r:r>>>e)&fr,s=1<=Jr)return ee(t,p,c,a,_);if(f&&!_&&2===p.length&&Qt(p[1^h]))return p[1^h];if(f&&_&&1===p.length&&Qt(_))return _;var v=t&&t===this.ownerID,d=f?_?c:c^s:c|s,y=f?_?ae(p,h,_,v):ce(p,h,v):se(p,h,_,v);return v?(this.bitmap=d,this.nodes=y,this):new Bt(t,d,y)},Jt.prototype.get=function(t,e,r,n){void 0===e&&(e=et(r));var i=(0===t?e:e>>>t)&fr,o=this.nodes[i];return o?o.get(t+sr,e,r,n):n},Jt.prototype.update=function(t,e,r,n,i,o,u){void 0===r&&(r=et(n));var a=(0===e?r:r>>>e)&fr,s=i===hr,c=this.nodes,f=c[a];if(s&&!f)return this;var h=Yt(f,t,e+sr,r,n,i,o,u);if(h===f)return this;var p=this.count;if(f){if(!h&&(p--,Wr>p))return te(t,c,p,a)}else p++;var l=t&&t===this.ownerID,_=ae(c,a,h,l);return l?(this.count=p,this.nodes=_,this):new Jt(t,p,_)},Wt.prototype.get=function(t,e,r,n){for(var i=this.entries,o=0,u=i.length;u>o;o++)if(X(r,i[o][0]))return i[o][1];return n},Wt.prototype.update=function(t,e,n,o,u,a,s){void 0===n&&(n=et(o));var c=u===hr;if(n!==this.keyHash)return c?this:(r(s),r(a),Zt(this,t,e,n,[o,u]));for(var f=this.entries,h=0,p=f.length;p>h&&!X(o,f[h][0]);h++);var l=p>h;if(l?f[h][1]===u:c)return this;if(r(s),(c||!l)&&r(a),c&&2===p)return new Nt(t,this.keyHash,f[1^h]);var _=t&&t===this.ownerID,v=_?f:i(f);return l?c?h===p-1?v.pop():v[h]=v.pop():v[h]=[o,u]:v.push([o,u]),_?(this.entries=v,this):new Wt(t,this.keyHash,v)},Nt.prototype.get=function(t,e,r,n){return X(r,this.entry[0])?this.entry[1]:n},Nt.prototype.update=function(t,e,n,i,o,u,a){var s=o===hr,c=X(i,this.entry[0]);return(c?o===this.entry[1]:s)?this:(r(a),s?void r(u):c?t&&t===this.ownerID?(this.entry[1]=o,this):new Nt(t,this.keyHash,[i,o]):(r(u),Zt(this,t,e,et(i),[i,o])))},Lt.prototype.iterate=Wt.prototype.iterate=function(t,e){for(var r=this.entries,n=0,i=r.length-1;i>=n;n++)if(t(r[e?i-n:n])===!1)return!1},Bt.prototype.iterate=Jt.prototype.iterate=function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++){var o=r[e?i-n:n];if(o&&o.iterate(t,e)===!1)return!1}},Nt.prototype.iterate=function(t,e){return t(this.entry)},t(Ct,w),Ct.prototype.next=function(){for(var t=this._type,e=this._stack;e;){var r,n=e.node,i=e.index++;if(n.entry){if(0===i)return Ft(t,n.entry)}else if(n.entries){if(r=n.entries.length-1,r>=i)return Ft(t,n.entries[this._reverse?r-i:i])}else if(r=n.nodes.length-1,r>=i){var o=n.nodes[this._reverse?r-i:i];if(o){if(o.entry)return Ft(t,o.entry);e=this._stack=Vt(o,e)}continue}e=this._stack=this._stack.__prev}return I()};var Lr,Br=cr/4,Jr=cr/2,Wr=cr/4;t(fe,G),fe.of=function(){return this(arguments)},fe.prototype.toString=function(){return this.__toString("List [","]")},fe.prototype.get=function(t,e){if(t=u(this,t),t>=0&&t>>e&fr;if(n>=this.array.length)return new pe([],t);var i,o=0===n;if(e>0){var u=this.array[n];if(i=u&&u.removeBefore(t,e-sr,r),i===u&&o)return this}if(o&&!i)return this;var a=ge(this,t);if(!o)for(var s=0;n>s;s++)a.array[s]=void 0;return i&&(a.array[n]=i),a},pe.prototype.removeAfter=function(t,e,r){if(r===(e?1<>>e&fr;if(n>=this.array.length)return this;var i;if(e>0){var o=this.array[n];if(i=o&&o.removeAfter(t,e-sr,r),i===o&&n===this.array.length-1)return this}var u=ge(this,t);return u.array.splice(n+1),i&&(u.array[n]=i),u};var Fr,Vr={};t(Ie,Pt),Ie.of=function(){return this(arguments)},Ie.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Ie.prototype.get=function(t,e){var r=this._map.get(t);return void 0!==r?this._list.get(r)[1]:e},Ie.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):Oe()},Ie.prototype.set=function(t,e){return Me(this,t,e)},Ie.prototype.remove=function(t){return Me(this,t,hr)},Ie.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Ie.prototype.__iterate=function(t,e){var r=this;return this._list.__iterate(function(e){return e&&t(e[1],e[0],r)},e)},Ie.prototype.__iterator=function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},Ie.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),r=this._list.__ensureOwner(t);return t?De(e,r,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=r,this)},Ie.isOrderedMap=ze,Ie.prototype[yr]=!0,Ie.prototype[ar]=Ie.prototype.remove;var Gr;t(Ee,G),Ee.of=function(){return this(arguments)},Ee.prototype.toString=function(){return this.__toString("Stack [","]")},Ee.prototype.get=function(t,e){var r=this._head;for(t=u(this,t);r&&t--;)r=r.next;return r?r.value:e},Ee.prototype.peek=function(){return this._head&&this._head.value},Ee.prototype.push=function(){if(0===arguments.length)return this;for(var t=this.size+arguments.length,e=this._head,r=arguments.length-1;r>=0;r--)e={value:arguments[r],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):xe(t,e)},Ee.prototype.pushAll=function(t){if(t=_(t),0===t.size)return this;at(t.size);var e=this.size,r=this._head;return t.reverse().forEach(function(t){e++,r={value:t,next:r}}),this.__ownerID?(this.size=e,this._head=r,this.__hash=void 0,this.__altered=!0,this):xe(e,r)},Ee.prototype.pop=function(){return this.slice(1)},Ee.prototype.unshift=function(){return this.push.apply(this,arguments)},Ee.prototype.unshiftAll=function(t){return this.pushAll(t)},Ee.prototype.shift=function(){return this.pop.apply(this,arguments)},Ee.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):ke()},Ee.prototype.slice=function(t,e){if(s(t,e,this.size))return this;var r=c(t,this.size),n=f(e,this.size);if(n!==this.size)return G.prototype.slice.call(this,t,e);for(var i=this.size-r,o=this._head;r--;)o=o.next;return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):xe(i,o)},Ee.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?xe(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Ee.prototype.__iterate=function(t,e){if(e)return this.reverse().__iterate(t);for(var r=0,n=this._head;n&&t(n.value,r++,this)!==!1;)n=n.next;return r},Ee.prototype.__iterator=function(t,e){if(e)return this.reverse().__iterator(t);var r=0,n=this._head;return new w(function(){if(n){var e=n.value;return n=n.next,b(t,r++,e)}return I()})},Ee.isStack=qe;var Hr="@@__IMMUTABLE_STACK__@@",Xr=Ee.prototype;Xr[Hr]=!0,Xr.withMutations=Tr.withMutations,Xr.asMutable=Tr.asMutable,Xr.asImmutable=Tr.asImmutable,Xr.wasAltered=Tr.wasAltered;var Yr;t(Ae,H),Ae.of=function(){return this(arguments)},Ae.fromKeys=function(t){return this(l(t).keySeq())},Ae.prototype.toString=function(){return this.__toString("Set {","}")},Ae.prototype.has=function(t){return this._map.has(t)},Ae.prototype.add=function(t){return Re(this,this._map.set(t,!0))},Ae.prototype.remove=function(t){return Re(this,this._map.remove(t))},Ae.prototype.clear=function(){return Re(this,this._map.clear())},Ae.prototype.union=function(){var t=ur.call(arguments,0);return t=t.filter(function(t){return 0!==t.size}),0===t.length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations(function(e){for(var r=0;r1?" by "+this._step:"")+" ]"},Ge.prototype.get=function(t,e){return this.has(t)?this._start+u(this,t)*this._step:e},Ge.prototype.includes=function(t){var e=(t-this._start)/this._step;return e>=0&&e=e?new Ge(0,0):new Ge(this.get(t,this._end),this.get(e,this._end),this._step))},Ge.prototype.indexOf=function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;if(r>=0&&r=o;o++){if(t(i,o,this)===!1)return o+1;i+=e?-n:n}return o},Ge.prototype.__iterator=function(t,e){var r=this.size-1,n=this._step,i=e?this._start+r*n:this._start,o=0;return new w(function(){var u=i;return i+=e?-n:n,o>r?I():b(t,o++,u)})},Ge.prototype.equals=function(t){return t instanceof Ge?this._start===t._start&&this._end===t._end&&this._step===t._step:Ve(this,t)};var nn;t(He,k),He.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},He.prototype.get=function(t,e){return this.has(t)?this._value:e},He.prototype.includes=function(t){return X(this._value,t)},He.prototype.slice=function(t,e){var r=this.size;return s(t,e,r)?this:new He(this._value,f(e,r)-c(t,r))},He.prototype.reverse=function(){return this},He.prototype.indexOf=function(t){return X(this._value,t)?0:-1},He.prototype.lastIndexOf=function(t){return X(this._value,t)?this.size:-1},He.prototype.__iterate=function(t,e){for(var r=0;rt?this.count():this.size);var n=this.slice(0,t);return qt(this,1===r?n:n.concat(i(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var r=this.toKeyedSeq().findLastKey(t,e);return void 0===r?-1:r},first:function(){return this.get(0)},flatten:function(t){return qt(this,bt(this,t,!1))},get:function(t,e){return t=u(this,t),0>t||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find(function(e,r){return r===t},void 0,e)},has:function(t){return t=u(this,t),t>=0&&(void 0!==this.size?this.size===1/0||t-1&&t%1===0&&t<=Number.MAX_VALUE}var i=Function.prototype.bind;e.isString=function(t){return"string"==typeof t||"[object String]"===r(t)},e.isArray=Array.isArray||function(t){return"[object Array]"===r(t)},"function"!=typeof/./&&"object"!=typeof Int8Array?e.isFunction=function(t){return"function"==typeof t||!1}:e.isFunction=function(t){return"[object Function]"===toString.call(t)},e.isObject=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},e.extend=function(t){var e=arguments.length;if(!t||2>e)return t||{};for(var r=1;e>r;r++)for(var n=arguments[r],i=Object.keys(n),o=i.length,u=0;o>u;u++){var a=i[u];t[a]=n[a]}return t},e.clone=function(t){return e.isObject(t)?e.isArray(t)?t.slice():e.extend({},t):t},e.each=function(t,e,r){var i,o,u=t?t.length:0,a=-1;if(r&&(o=e,e=function(t,e,n){return o.call(r,t,e,n)}),n(u))for(;++an;n++)r[n]=arguments[n];return new(i.apply(t,[null].concat(r)))};return e.__proto__=t,e.prototype=t.prototype,e}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t){return c["default"].Iterable.isIterable(t)}function o(t){return i(t)||!f.isObject(t)}function u(t){return i(t)?t.toJS():t}function a(t){return i(t)?t:c["default"].fromJS(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.isImmutable=i,e.isImmutableValue=o,e.toJS=u,e.toImmutable=a;var s=r(3),c=n(s),f=r(4)},function(t,e,r){"use strict";function n(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e["default"]=t,e}function i(t){return t&&t.__esModule?t:{"default":t}}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var r=0;r0)){var e=this.reactorState.get("dirtyStores");if(0!==e.size){var r=c["default"].Set().withMutations(function(r){r.union(t.observerState.get("any")),e.forEach(function(e){var n=t.observerState.getIn(["stores",e]);n&&r.union(n)})});r.forEach(function(e){var r=t.observerState.getIn(["observersMap",e]);if(r){var n=r.get("getter"),i=r.get("handler"),o=l.evaluate(t.prevReactorState,n),u=l.evaluate(t.reactorState,n);t.prevReactorState=o.reactorState, -t.reactorState=u.reactorState;var a=o.result,s=u.result;c["default"].is(a,s)||i.call(null,s)}});var n=l.resetDirtyStores(this.reactorState);this.prevReactorState=n,this.reactorState=n}}}},{key:"batchStart",value:function(){this.__batchDepth++}},{key:"batchEnd",value:function(){if(this.__batchDepth--,this.__batchDepth<=0){this.__isDispatching=!0;try{this.__notify()}catch(t){throw this.__isDispatching=!1,t}this.__isDispatching=!1}}}]),t}();e["default"]=y.toFactory(m),t.exports=e["default"]},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r={};return o.each(e,function(e,n){r[n]=t.evaluate(e)}),r}Object.defineProperty(e,"__esModule",{value:!0});var o=r(4);e["default"]=function(t){return{getInitialState:function(){return i(t,this.getDataBindings())},componentDidMount:function(){var e=this;this.__unwatchFns=[],o.each(this.getDataBindings(),function(r,i){var o=t.observe(r,function(t){e.setState(n({},i,t))});e.__unwatchFns.push(o)})},componentWillUnmount:function(){for(;this.__unwatchFns.length;)this.__unwatchFns.shift()()}}},t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){return new A({result:t,reactorState:e})}function o(t,e){return t.withMutations(function(t){k.each(e,function(e,r){t.getIn(["stores",r])&&console.warn("Store already defined for id = "+r);var n=e.getInitialState();if(void 0===n&&f(t,"throwOnUndefinedStoreReturnValue"))throw new Error("Store getInitialState() must return a value, did you forget a return statement");if(f(t,"throwOnNonImmutableStore")&&!E.isImmutableValue(n))throw new Error("Store getInitialState() must return an immutable value, did you forget to call toImmutable");t.update("stores",function(t){return t.set(r,e)}).update("state",function(t){return t.set(r,n)}).update("dirtyStores",function(t){return t.add(r)}).update("storeStates",function(t){return I(t,[r])})}),b(t)})}function u(t,e){return t.withMutations(function(t){k.each(e,function(e,r){t.update("stores",function(t){return t.set(r,e)})})})}function a(t,e,r){if(void 0===e&&f(t,"throwOnUndefinedActionType"))throw new Error("`dispatch` cannot be called with an `undefined` action type.");var n=t.get("state"),i=t.get("dirtyStores"),o=n.withMutations(function(n){M["default"].dispatchStart(t,e,r),t.get("stores").forEach(function(o,u){var a=n.get(u),s=void 0;try{s=o.handle(a,e,r)}catch(c){throw M["default"].dispatchError(t,c.message),c}if(void 0===s&&f(t,"throwOnUndefinedStoreReturnValue")){var h="Store handler must return a value, did you forget a return statement";throw M["default"].dispatchError(t,h),new Error(h)}n.set(u,s),a!==s&&(i=i.add(u))}),M["default"].dispatchEnd(t,n,i)}),u=t.set("state",o).set("dirtyStores",i).update("storeStates",function(t){return I(t,i)});return b(u)}function s(t,e){var r=[],n=E.toImmutable({}).withMutations(function(n){k.each(e,function(e,i){var o=t.getIn(["stores",i]);if(o){var u=o.deserialize(e);void 0!==u&&(n.set(i,u),r.push(i))}})}),i=D["default"].Set(r);return t.update("state",function(t){return t.merge(n)}).update("dirtyStores",function(t){return t.union(i)}).update("storeStates",function(t){return I(t,r)})}function c(t,e,r){var n=e;x.isKeyPath(e)&&(e=q.fromKeyPath(e));var i=t.get("nextId"),o=q.getStoreDeps(e),u=D["default"].Map({id:i,storeDeps:o,getterKey:n,getter:e,handler:r}),a=void 0;return a=0===o.size?t.update("any",function(t){return t.add(i)}):t.withMutations(function(t){o.forEach(function(e){var r=["stores",e];t.hasIn(r)||t.setIn(r,D["default"].Set()),t.updateIn(["stores",e],function(t){return t.add(i)})})}),a=a.set("nextId",i+1).setIn(["observersMap",i],u),{observerState:a,entry:u}}function f(t,e){var r=t.getIn(["options",e]);if(void 0===r)throw new Error("Invalid option: "+e);return r}function h(t,e,r){var n=t.get("observersMap").filter(function(t){var n=t.get("getterKey"),i=!r||t.get("handler")===r;return i?x.isKeyPath(e)&&x.isKeyPath(n)?x.isEqual(e,n):e===n:!1});return t.withMutations(function(t){n.forEach(function(e){return p(t,e)})})}function p(t,e){return t.withMutations(function(t){var r=e.get("id"),n=e.get("storeDeps");0===n.size?t.update("any",function(t){return t.remove(r)}):n.forEach(function(e){t.updateIn(["stores",e],function(t){return t?t.remove(r):t})}),t.removeIn(["observersMap",r])})}function l(t){var e=t.get("state");return t.withMutations(function(t){var r=t.get("stores"),n=r.keySeq().toJS();r.forEach(function(r,n){var i=e.get(n),o=r.handleReset(i);if(void 0===o&&f(t,"throwOnUndefinedStoreReturnValue"))throw new Error("Store handleReset() must return a value, did you forget a return statement");if(f(t,"throwOnNonImmutableStore")&&!E.isImmutableValue(o))throw new Error("Store reset state must be an immutable value, did you forget to call toImmutable");t.setIn(["state",n],o)}),t.update("storeStates",function(t){return I(t,n)}),d(t)})}function _(t,e){var r=t.get("state");if(x.isKeyPath(e))return i(r.getIn(e),t);if(!q.isGetter(e))throw new Error("evaluate must be passed a keyPath or Getter");if(m(t,e))return i(w(t,e),t);var n=q.getDeps(e).map(function(e){return _(t,e).result}),o=q.getComputeFn(e).apply(null,n);return i(o,S(t,e,o))}function v(t){var e={};return t.get("stores").forEach(function(r,n){var i=t.getIn(["state",n]),o=r.serialize(i);void 0!==o&&(e[n]=o)}),e}function d(t){return t.set("dirtyStores",D["default"].Set())}function y(t){return t}function g(t,e){var r=y(e);return t.getIn(["cache",r])}function m(t,e){var r=g(t,e);if(!r)return!1;var n=r.get("storeStates");return 0===n.size?!1:n.every(function(e,r){return t.getIn(["storeStates",r])===e})}function S(t,e,r){var n=y(e),i=t.get("dispatchId"),o=q.getStoreDeps(e),u=E.toImmutable({}).withMutations(function(e){o.forEach(function(r){var n=t.getIn(["storeStates",r]);e.set(r,n)})});return t.setIn(["cache",n],D["default"].Map({value:r,storeStates:u,dispatchId:i}))}function w(t,e){var r=y(e);return t.getIn(["cache",r,"value"])}function b(t){return t.update("dispatchId",function(t){return t+1})}function I(t,e){return t.withMutations(function(t){e.forEach(function(e){var r=t.has(e)?t.get(e)+1:1;t.set(e,r)})})}Object.defineProperty(e,"__esModule",{value:!0}),e.registerStores=o,e.replaceStores=u,e.dispatch=a,e.loadState=s,e.addObserver=c,e.getOption=f,e.removeObserver=h,e.removeObserverByEntry=p,e.reset=l,e.evaluate=_,e.serialize=v,e.resetDirtyStores=d;var z=r(3),D=n(z),O=r(9),M=n(O),E=r(5),q=r(10),x=r(11),k=r(4),A=D["default"].Record({result:null,reactorState:null})},function(t,e,r){"use strict";var n=r(8);e.dispatchStart=function(t,e,r){n.getOption(t,"logDispatches")&&console.group&&(console.groupCollapsed("Dispatch: %s",e),console.group("payload"),console.debug(r),console.groupEnd())},e.dispatchError=function(t,e){n.getOption(t,"logDispatches")&&console.group&&(console.debug("Dispatch error: "+e),console.groupEnd())},e.dispatchEnd=function(t,e,r){n.getOption(t,"logDispatches")&&console.group&&(n.getOption(t,"logDirtyStores")&&console.log("Stores updated:",r.toList().toJS()),n.getOption(t,"logAppState")&&console.debug("Dispatch done, new state: ",e.toJS()),console.groupEnd())}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t){return p.isArray(t)&&p.isFunction(t[t.length-1])}function o(t){return t[t.length-1]}function u(t){return t.slice(0,t.length-1)}function a(t,e){e||(e=h["default"].Set());var r=h["default"].Set().withMutations(function(e){if(!i(t))throw new Error("getFlattenedDeps must be passed a Getter");u(t).forEach(function(t){if(l.isKeyPath(t))e.add(f.List(t));else{if(!i(t))throw new Error("Invalid getter, each dependency must be a KeyPath or Getter");e.union(a(t))}})});return e.union(r)}function s(t){if(!l.isKeyPath(t))throw new Error("Cannot create Getter from KeyPath: "+t);return[t,_]}function c(t){if(t.hasOwnProperty("__storeDeps"))return t.__storeDeps;var e=a(t).map(function(t){return t.first()}).filter(function(t){return!!t});return Object.defineProperty(t,"__storeDeps",{enumerable:!1,configurable:!1,writable:!1,value:e}),e}Object.defineProperty(e,"__esModule",{value:!0});var f=r(3),h=n(f),p=r(4),l=r(11),_=function(t){return t};e["default"]={isGetter:i,getComputeFn:o,getFlattenedDeps:a,getStoreDeps:c,getDeps:u,fromKeyPath:s},t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t){return s.isArray(t)&&!s.isFunction(t[t.length-1])}function o(t,e){var r=a["default"].List(t),n=a["default"].List(e);return a["default"].is(r,n)}Object.defineProperty(e,"__esModule",{value:!0}),e.isKeyPath=i,e.isEqual=o;var u=r(3),a=n(u),s=r(4)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(3),i=n.Map({logDispatches:!1,logAppState:!1,logDirtyStores:!1,throwOnUndefinedActionType:!1,throwOnUndefinedStoreReturnValue:!1,throwOnNonImmutableStore:!1,throwOnDispatchInDispatch:!1});e.PROD_OPTIONS=i;var o=n.Map({logDispatches:!0,logAppState:!0,logDirtyStores:!0,throwOnUndefinedActionType:!0,throwOnUndefinedStoreReturnValue:!0,throwOnNonImmutableStore:!0,throwOnDispatchInDispatch:!0});e.DEBUG_OPTIONS=o;var u=n.Record({dispatchId:0,state:n.Map(),stores:n.Map(),cache:n.Map(),storeStates:n.Map(),dirtyStores:n.Set(),debug:!1,options:i});e.ReactorState=u;var a=n.Record({any:n.Set(),stores:n.Map({}),observersMap:n.Map({}),nextId:1});e.ObserverState=a}])}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Nuclear=e():t.Nuclear=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),r(1);var i=r(2),o=n(i),u=r(6),a=n(u),s=r(3),c=n(s),h=r(5),f=r(11),p=r(10),l=r(9),_=r(7),v=n(_);e["default"]={Reactor:a["default"],Store:o["default"],Immutable:c["default"],isKeyPath:f.isKeyPath,isGetter:p.isGetter,toJS:h.toJS,toImmutable:h.toImmutable,isImmutable:h.isImmutable,createReactMixin:v["default"],LRUCache:l.LRUCache},t.exports=e["default"]},function(t,e){"use strict";try{window.console&&console.log||(console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){}})}catch(r){}},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t){return t instanceof c}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var r=0;r>>0;if(""+r!==e||4294967295===r)return NaN;e=r}return e<0?_(t)+e:e}function d(){return!0}function y(t,e,r){return(0===t||void 0!==r&&t<=-r)&&(void 0===e||void 0!==r&&e>=r)}function g(t,e){return w(t,e,0)}function m(t,e){return w(t,e,e)}function w(t,e,r){return void 0===t?r:t<0?Math.max(0,e+t):void 0===e?t:Math.min(e,t)}function S(t){this.next=t}function b(t,e,r,n){var i=0===t?e:1===t?r:[e,r];return n?n.value=i:n={value:i,done:!1},n}function I(){return{value:void 0,done:!0}}function z(t){return!!M(t)}function D(t){return t&&"function"==typeof t.next}function O(t){var e=M(t);return e&&e.call(t)}function M(t){var e=t&&(br&&t[br]||t[Ir]);if("function"==typeof e)return e}function E(t){return t&&"number"==typeof t.length}function k(t){return null===t||void 0===t?L():o(t)?t.toSeq():B(t)}function q(t){return null===t||void 0===t?L().toKeyedSeq():o(t)?u(t)?t.toSeq():t.fromEntrySeq():C(t)}function x(t){return null===t||void 0===t?L():o(t)?u(t)?t.entrySeq():t.toIndexedSeq():T(t)}function A(t){return(null===t||void 0===t?L():o(t)?u(t)?t.entrySeq():t:T(t)).toSetSeq()}function j(t){this._array=t,this.size=t.length}function R(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length}function U(t){this._iterable=t,this.size=t.length||t.size}function K(t){this._iterator=t,this._iteratorCache=[]}function P(t){return!(!t||!t[Dr])}function L(){return Or||(Or=new j([]))}function C(t){var e=Array.isArray(t)?new j(t).fromEntrySeq():D(t)?new K(t).fromEntrySeq():z(t)?new U(t).fromEntrySeq():"object"==typeof t?new R(t):void 0;if(!e)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+t);return e}function T(t){var e=N(t);if(!e)throw new TypeError("Expected Array or iterable object of values: "+t);return e}function B(t){var e=N(t)||"object"==typeof t&&new R(t);if(!e)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+t);return e}function N(t){return E(t)?new j(t):D(t)?new K(t):z(t)?new U(t):void 0}function J(t,e,r,n){var i=t._cache;if(i){for(var o=i.length-1,u=0;u<=o;u++){var a=i[r?o-u:u];if(e(a[1],n?a[0]:u,t)===!1)return u+1}return u}return t.__iterateUncached(e,r)}function W(t,e,r,n){var i=t._cache;if(i){var o=i.length-1,u=0;return new S(function(){var t=i[r?o-u:u];return u++>o?I():b(e,n?t[0]:u-1,t[1])})}return t.__iteratorUncached(e,r)}function V(t,e){return e?F(e,t,"",{"":t}):G(t)}function F(t,e,r,n){return Array.isArray(e)?t.call(n,r,x(e).map(function(r,n){return F(t,r,n,e)})):H(e)?t.call(n,r,q(e).map(function(r,n){return F(t,r,n,e)})):e}function G(t){return Array.isArray(t)?x(t).map(G).toList():H(t)?q(t).map(G).toMap():t}function H(t){return t&&(t.constructor===Object||void 0===t.constructor)}function X(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===e||t!==t&&e!==e)return!0;if(!t||!e)return!1}return!("function"!=typeof t.equals||"function"!=typeof e.equals||!t.equals(e))}function Y(t,e){if(t===e)return!0;if(!o(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||u(t)!==u(e)||a(t)!==a(e)||c(t)!==c(e))return!1;if(0===t.size&&0===e.size)return!0;var r=!s(t);if(c(t)){var n=t.entries();return e.every(function(t,e){var i=n.next().value;return i&&X(i[1],t)&&(r||X(i[0],e))})&&n.next().done}var i=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{i=!0;var h=t;t=e,e=h}var f=!0,p=e.__iterate(function(e,n){if(r?!t.has(e):i?!X(e,t.get(n,dr)):!X(t.get(n,dr),e))return f=!1,!1});return f&&t.size===p}function Q(t,e){if(!(this instanceof Q))return new Q(t,e);if(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),0===this.size){if(Mr)return Mr;Mr=this}}function Z(t,e){if(!t)throw new Error(e)}function $(t,e,r){if(!(this instanceof $))return new $(t,e,r);if(Z(0!==r,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),r=void 0===r?1:Math.abs(r),e>>1&1073741824|3221225471&t}function ot(t){if(t===!1||null===t||void 0===t)return 0;if("function"==typeof t.valueOf&&(t=t.valueOf(),t===!1||null===t||void 0===t))return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if(t!==t||t===1/0)return 0;var r=0|t;for(r!==t&&(r^=4294967295*t);t>4294967295;)t/=4294967295,r^=t;return it(r)}if("string"===e)return t.length>Kr?ut(t):at(t);if("function"==typeof t.hashCode)return t.hashCode();if("object"===e)return st(t);if("function"==typeof t.toString)return at(t.toString());throw new Error("Value type "+e+" cannot be hashed.")}function ut(t){var e=Cr[t];return void 0===e&&(e=at(t),Lr===Pr&&(Lr=0,Cr={}),Lr++,Cr[t]=e),e}function at(t){for(var e=0,r=0;r0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function ht(t){Z(t!==1/0,"Cannot perform this action with an infinite size.")}function ft(t){return null===t||void 0===t?bt():pt(t)&&!c(t)?t:bt().withMutations(function(e){var n=r(t);ht(n.size),n.forEach(function(t,r){return e.set(r,t)})})}function pt(t){return!(!t||!t[Tr])}function lt(t,e){this.ownerID=t,this.entries=e}function _t(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r}function vt(t,e,r){this.ownerID=t,this.count=e,this.nodes=r}function dt(t,e,r){this.ownerID=t,this.keyHash=e,this.entries=r}function yt(t,e,r){this.ownerID=t,this.keyHash=e,this.entry=r}function gt(t,e,r){this._type=e,this._reverse=r,this._stack=t._root&&wt(t._root)}function mt(t,e){return b(t,e[0],e[1])}function wt(t,e){return{node:t,index:0,__prev:e}}function St(t,e,r,n){var i=Object.create(Br);return i.size=t,i._root=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function bt(){return Nr||(Nr=St(0))}function It(t,e,r){var n,i;if(t._root){var o=h(yr),u=h(gr);if(n=zt(t._root,t.__ownerID,0,void 0,e,r,o,u),!u.value)return t;i=t.size+(o.value?r===dr?-1:1:0)}else{if(r===dr)return t;i=1,n=new lt(t.__ownerID,[[e,r]])}return t.__ownerID?(t.size=i,t._root=n,t.__hash=void 0,t.__altered=!0,t):n?St(i,n):bt()}function zt(t,e,r,n,i,o,u,a){return t?t.update(e,r,n,i,o,u,a):o===dr?t:(f(a),f(u),new yt(e,n,[i,o]))}function Dt(t){return t.constructor===yt||t.constructor===dt}function Ot(t,e,r,n,i){if(t.keyHash===n)return new dt(e,n,[t.entry,i]);var o,u=(0===r?t.keyHash:t.keyHash>>>r)&vr,a=(0===r?n:n>>>r)&vr,s=u===a?[Ot(t,e,r+lr,n,i)]:(o=new yt(e,n,i),u>>=1)u[a]=1&r?e[o++]:void 0;return u[n]=i,new vt(t,o+1,u)}function qt(t,e,n){for(var i=[],u=0;u>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function Kt(t,e,r,n){var i=n?t:l(t);return i[e]=r,i}function Pt(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var o=new Array(i),u=0,a=0;a0&&i<_r?Jt(0,i,lr,null,new Bt(r.toArray())):e.withMutations(function(t){t.setSize(i),r.forEach(function(e,r){return t.set(r,e)})}))}function Tt(t){return!(!t||!t[Fr])}function Bt(t,e){this.array=t,this.ownerID=e}function Nt(t,e){function r(t,e,r){return 0===e?n(t,r):i(t,e,r)}function n(t,r){var n=r===a?s&&s.array:t&&t.array,i=r>o?0:o-r,c=u-r;return c>_r&&(c=_r),function(){if(i===c)return Xr;var t=e?--c:i++;return n&&n[t]}}function i(t,n,i){var a,s=t&&t.array,c=i>o?0:o-i>>n,h=(u-i>>n)+1;return h>_r&&(h=_r),function(){for(;;){if(a){var t=a();if(t!==Xr)return t;a=null}if(c===h)return Xr;var o=e?--h:c++;a=r(s&&s[o],n-lr,i+(o<=t.size||e<0)return t.withMutations(function(t){e<0?Xt(t,e).set(0,r):Xt(t,0,e+1).set(e,r)});e+=t._origin;var n=t._tail,i=t._root,o=h(gr);return e>=Qt(t._capacity)?n=Ft(n,t.__ownerID,0,e,r,o):i=Ft(i,t.__ownerID,t._level,e,r,o),o.value?t.__ownerID?(t._root=i,t._tail=n,t.__hash=void 0,t.__altered=!0,t):Jt(t._origin,t._capacity,t._level,i,n):t}function Ft(t,e,r,n,i,o){var u=n>>>r&vr,a=t&&u0){var c=t&&t.array[u],h=Ft(c,e,r-lr,n,i,o);return h===c?t:(s=Gt(t,e),s.array[u]=h,s)}return a&&t.array[u]===i?t:(f(o),s=Gt(t,e),void 0===i&&u===s.array.length-1?s.array.pop():s.array[u]=i,s)}function Gt(t,e){return e&&t&&e===t.ownerID?t:new Bt(t?t.array.slice():[],e)}function Ht(t,e){if(e>=Qt(t._capacity))return t._tail;if(e<1<0;)r=r.array[e>>>n&vr],n-=lr;return r}}function Xt(t,e,r){void 0!==e&&(e=0|e),void 0!==r&&(r=0|r);var n=t.__ownerID||new p,i=t._origin,o=t._capacity,u=i+e,a=void 0===r?o:r<0?o+r:i+r;if(u===i&&a===o)return t;if(u>=a)return t.clear();for(var s=t._level,c=t._root,h=0;u+h<0;)c=new Bt(c&&c.array.length?[void 0,c]:[],n),s+=lr,h+=1<=1<f?new Bt([],n):_;if(_&&l>f&&ulr;y-=lr){var g=f>>>y&vr;d=d.array[g]=Gt(d.array[g],n)}d.array[f>>>lr&vr]=_}if(a=l)u-=l,a-=l,s=lr,c=null,v=v&&v.removeBefore(n,0,u);else if(u>i||l>>s&vr;if(m!==l>>>s&vr)break;m&&(h+=(1<i&&(c=c.removeBefore(n,s,u-h)),c&&lu&&(u=c.size),o(s)||(c=c.map(function(t){return V(t)})),i.push(c)}return u>t.size&&(t=t.setSize(u)),jt(t,e,i)}function Qt(t){return t<_r?0:t-1>>>lr<=_r&&u.size>=2*o.size?(i=u.filter(function(t,e){return void 0!==t&&a!==e}),n=i.toKeyedSeq().map(function(t){return t[0]}).flip().toMap(),t.__ownerID&&(n.__ownerID=i.__ownerID=t.__ownerID)):(n=o.remove(e),i=a===u.size-1?u.pop():u.set(a,void 0))}else if(s){if(r===u.get(a)[1])return t;n=o,i=u.set(a,[e,r])}else n=o.set(e,u.size),i=u.set(u.size,[e,r]);return t.__ownerID?(t.size=n.size,t._map=n,t._list=i,t.__hash=void 0,t):te(n,i)}function ne(t,e){this._iter=t,this._useKeys=e,this.size=t.size}function ie(t){this._iter=t,this.size=t.size}function oe(t){this._iter=t,this.size=t.size}function ue(t){this._iter=t,this.size=t.size}function ae(t){var e=Ee(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=ke,e.__iterateUncached=function(e,r){var n=this;return t.__iterate(function(t,r){return e(r,t,n)!==!1},r)},e.__iteratorUncached=function(e,r){if(e===Sr){var n=t.__iterator(e,r);return new S(function(){var t=n.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===wr?mr:wr,r)},e}function se(t,e,r){var n=Ee(t);return n.size=t.size,n.has=function(e){return t.has(e)},n.get=function(n,i){var o=t.get(n,dr);return o===dr?i:e.call(r,o,n,t)},n.__iterateUncached=function(n,i){var o=this;return t.__iterate(function(t,i,u){return n(e.call(r,t,i,u),i,o)!==!1},i)},n.__iteratorUncached=function(n,i){var o=t.__iterator(Sr,i);return new S(function(){var i=o.next();if(i.done)return i;var u=i.value,a=u[0];return b(n,a,e.call(r,u[1],a,t),i)})},n}function ce(t,e){var r=Ee(t);return r._iter=t,r.size=t.size,r.reverse=function(){return t},t.flip&&(r.flip=function(){var e=ae(t);return e.reverse=function(){return t.flip()},e}),r.get=function(r,n){return t.get(e?r:-1-r,n)},r.has=function(r){return t.has(e?r:-1-r)},r.includes=function(e){return t.includes(e)},r.cacheResult=ke,r.__iterate=function(e,r){var n=this;return t.__iterate(function(t,r){return e(t,r,n)},!r)},r.__iterator=function(e,r){return t.__iterator(e,!r)},r}function he(t,e,r,n){var i=Ee(t);return n&&(i.has=function(n){var i=t.get(n,dr);return i!==dr&&!!e.call(r,i,n,t)},i.get=function(n,i){var o=t.get(n,dr);return o!==dr&&e.call(r,o,n,t)?o:i}),i.__iterateUncached=function(i,o){var u=this,a=0;return t.__iterate(function(t,o,s){if(e.call(r,t,o,s))return a++,i(t,n?o:a-1,u)},o),a},i.__iteratorUncached=function(i,o){var u=t.__iterator(Sr,o),a=0;return new S(function(){for(;;){var o=u.next();if(o.done)return o;var s=o.value,c=s[0],h=s[1];if(e.call(r,h,c,t))return b(i,n?c:a++,h,o)}})},i}function fe(t,e,r){var n=ft().asMutable();return t.__iterate(function(i,o){n.update(e.call(r,i,o,t),0,function(t){return t+1})}),n.asImmutable()}function pe(t,e,r){var n=u(t),i=(c(t)?Zt():ft()).asMutable();t.__iterate(function(o,u){i.update(e.call(r,o,u,t),function(t){return t=t||[],t.push(n?[u,o]:o),t})});var o=Me(t);return i.map(function(e){return ze(t,o(e))})}function le(t,e,r,n){var i=t.size;if(void 0!==e&&(e=0|e),void 0!==r&&(r=r===1/0?i:0|r),y(e,r,i))return t;var o=g(e,i),u=m(r,i);if(o!==o||u!==u)return le(t.toSeq().cacheResult(),e,r,n);var a,s=u-o;s===s&&(a=s<0?0:s);var c=Ee(t);return c.size=0===a?a:t.size&&a||void 0,!n&&P(t)&&a>=0&&(c.get=function(e,r){return e=v(this,e),e>=0&&ea)return I();var t=i.next();return n||e===wr?t:e===mr?b(e,s-1,void 0,t):b(e,s-1,t.value[1],t)})},c}function _e(t,e,r){var n=Ee(t);return n.__iterateUncached=function(n,i){var o=this;if(i)return this.cacheResult().__iterate(n,i);var u=0;return t.__iterate(function(t,i,a){return e.call(r,t,i,a)&&++u&&n(t,i,o)}),u},n.__iteratorUncached=function(n,i){var o=this;if(i)return this.cacheResult().__iterator(n,i);var u=t.__iterator(Sr,i),a=!0;return new S(function(){if(!a)return I();var t=u.next();if(t.done)return t;var i=t.value,s=i[0],c=i[1];return e.call(r,c,s,o)?n===Sr?t:b(n,s,c,t):(a=!1,I())})},n}function ve(t,e,r,n){var i=Ee(t);return i.__iterateUncached=function(i,o){var u=this;if(o)return this.cacheResult().__iterate(i,o);var a=!0,s=0;return t.__iterate(function(t,o,c){if(!a||!(a=e.call(r,t,o,c)))return s++,i(t,n?o:s-1,u)}),s},i.__iteratorUncached=function(i,o){var u=this;if(o)return this.cacheResult().__iterator(i,o);var a=t.__iterator(Sr,o),s=!0,c=0;return new S(function(){var t,o,h;do{if(t=a.next(),t.done)return n||i===wr?t:i===mr?b(i,c++,void 0,t):b(i,c++,t.value[1],t);var f=t.value;o=f[0],h=f[1],s&&(s=e.call(r,h,o,u))}while(s);return i===Sr?t:b(i,o,h,t)})},i}function de(t,e){var n=u(t),i=[t].concat(e).map(function(t){return o(t)?n&&(t=r(t)):t=n?C(t):T(Array.isArray(t)?t:[t]),t}).filter(function(t){return 0!==t.size});if(0===i.length)return t;if(1===i.length){var s=i[0];if(s===t||n&&u(s)||a(t)&&a(s))return s}var c=new j(i);return n?c=c.toKeyedSeq():a(t)||(c=c.toSetSeq()),c=c.flatten(!0),c.size=i.reduce(function(t,e){if(void 0!==t){var r=e.size;if(void 0!==r)return t+r}},0),c}function ye(t,e,r){var n=Ee(t);return n.__iterateUncached=function(n,i){function u(t,c){var h=this;t.__iterate(function(t,i){return(!e||c0}function Ie(t,r,n){var i=Ee(t);return i.size=new j(n).map(function(t){return t.size}).min(),i.__iterate=function(t,e){for(var r,n=this.__iterator(wr,e),i=0;!(r=n.next()).done&&t(r.value,i++,this)!==!1;);return i},i.__iteratorUncached=function(t,i){var o=n.map(function(t){return t=e(t),O(i?t.reverse():t)}),u=0,a=!1;return new S(function(){var e;return a||(e=o.map(function(t){return t.next()}),a=e.some(function(t){return t.done})),a?I():b(t,u++,r.apply(null,e.map(function(t){return t.value})))})},i}function ze(t,e){return P(t)?e:t.constructor(e)}function De(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function Oe(t){return ht(t.size),_(t)}function Me(t){return u(t)?r:a(t)?n:i}function Ee(t){return Object.create((u(t)?q:a(t)?x:A).prototype)}function ke(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):k.prototype.cacheResult.call(this)}function qe(t,e){return t>e?1:te?-1:0}function ir(t){if(t.size===1/0)return 0;var e=c(t),r=u(t),n=e?1:0,i=t.__iterate(r?e?function(t,e){n=31*n+ur(ot(t),ot(e))|0}:function(t,e){n=n+ur(ot(t),ot(e))|0}:e?function(t){n=31*n+ot(t)|0}:function(t){n=n+ot(t)|0});return or(i,n)}function or(t,e){return e=qr(e,3432918353),e=qr(e<<15|e>>>-15,461845907),e=qr(e<<13|e>>>-13,5),e=(e+3864292196|0)^t,e=qr(e^e>>>16,2246822507),e=qr(e^e>>>13,3266489909),e=it(e^e>>>16)}function ur(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}var ar=Array.prototype.slice;t(r,e),t(n,e),t(i,e),e.isIterable=o,e.isKeyed=u,e.isIndexed=a,e.isAssociative=s,e.isOrdered=c,e.Keyed=r,e.Indexed=n,e.Set=i;var sr="@@__IMMUTABLE_ITERABLE__@@",cr="@@__IMMUTABLE_KEYED__@@",hr="@@__IMMUTABLE_INDEXED__@@",fr="@@__IMMUTABLE_ORDERED__@@",pr="delete",lr=5,_r=1<n?I():b(t,i,r[e?n-i++:i++])})},t(R,q),R.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},R.prototype.has=function(t){return this._object.hasOwnProperty(t)},R.prototype.__iterate=function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,o=0;o<=i;o++){var u=n[e?i-o:o];if(t(r[u],u,this)===!1)return o+1}return o},R.prototype.__iterator=function(t,e){var r=this._object,n=this._keys,i=n.length-1,o=0;return new S(function(){var u=n[e?i-o:o];return o++>i?I():b(t,u,r[u])})},R.prototype[fr]=!0,t(U,x),U.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=O(r),i=0;if(D(n))for(var o;!(o=n.next()).done&&t(o.value,i++,this)!==!1;);return i},U.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterable,n=O(r);if(!D(n))return new S(I);var i=0;return new S(function(){var e=n.next();return e.done?e:b(t,i++,e.value)})},t(K,x),K.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var r=this._iterator,n=this._iteratorCache,i=0;i=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return b(t,i,n[i++])})};var Or;t(Q,x),Q.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},Q.prototype.get=function(t,e){return this.has(t)?this._value:e},Q.prototype.includes=function(t){return X(this._value,t)},Q.prototype.slice=function(t,e){var r=this.size;return y(t,e,r)?this:new Q(this._value,m(e,r)-g(t,r))},Q.prototype.reverse=function(){return this},Q.prototype.indexOf=function(t){return X(this._value,t)?0:-1},Q.prototype.lastIndexOf=function(t){return X(this._value,t)?this.size:-1},Q.prototype.__iterate=function(t,e){for(var r=0;r=0&&e=0&&rr?I():b(t,o++,u)})},$.prototype.equals=function(t){return t instanceof $?this._start===t._start&&this._end===t._end&&this._step===t._step:Y(this,t)};var Er;t(tt,e),t(et,tt),t(rt,tt),t(nt,tt),tt.Keyed=et,tt.Indexed=rt, +tt.Set=nt;var kr,qr="function"==typeof Math.imul&&Math.imul(4294967295,2)===-2?Math.imul:function(t,e){t=0|t,e=0|e;var r=65535&t,n=65535&e;return r*n+((t>>>16)*n+r*(e>>>16)<<16>>>0)|0},xr=Object.isExtensible,Ar=function(){try{return Object.defineProperty({},"@",{}),!0}catch(t){return!1}}(),jr="function"==typeof WeakMap;jr&&(kr=new WeakMap);var Rr=0,Ur="__immutablehash__";"function"==typeof Symbol&&(Ur=Symbol(Ur));var Kr=16,Pr=255,Lr=0,Cr={};t(ft,et),ft.of=function(){var t=ar.call(arguments,0);return bt().withMutations(function(e){for(var r=0;r=t.length)throw new Error("Missing value for key: "+t[r]);e.set(t[r],t[r+1])}})},ft.prototype.toString=function(){return this.__toString("Map {","}")},ft.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},ft.prototype.set=function(t,e){return It(this,t,e)},ft.prototype.setIn=function(t,e){return this.updateIn(t,dr,function(){return e})},ft.prototype.remove=function(t){return It(this,t,dr)},ft.prototype.deleteIn=function(t){return this.updateIn(t,function(){return dr})},ft.prototype.update=function(t,e,r){return 1===arguments.length?t(this):this.updateIn([t],e,r)},ft.prototype.updateIn=function(t,e,r){r||(r=e,e=void 0);var n=Rt(this,xe(t),e,r);return n===dr?void 0:n},ft.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):bt()},ft.prototype.merge=function(){return qt(this,void 0,arguments)},ft.prototype.mergeWith=function(t){var e=ar.call(arguments,1);return qt(this,t,e)},ft.prototype.mergeIn=function(t){var e=ar.call(arguments,1);return this.updateIn(t,bt(),function(t){return"function"==typeof t.merge?t.merge.apply(t,e):e[e.length-1]})},ft.prototype.mergeDeep=function(){return qt(this,xt,arguments)},ft.prototype.mergeDeepWith=function(t){var e=ar.call(arguments,1);return qt(this,At(t),e)},ft.prototype.mergeDeepIn=function(t){var e=ar.call(arguments,1);return this.updateIn(t,bt(),function(t){return"function"==typeof t.mergeDeep?t.mergeDeep.apply(t,e):e[e.length-1]})},ft.prototype.sort=function(t){return Zt(we(this,t))},ft.prototype.sortBy=function(t,e){return Zt(we(this,e,t))},ft.prototype.withMutations=function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},ft.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new p)},ft.prototype.asImmutable=function(){return this.__ensureOwner()},ft.prototype.wasAltered=function(){return this.__altered},ft.prototype.__iterator=function(t,e){return new gt(this,t,e)},ft.prototype.__iterate=function(t,e){var r=this,n=0;return this._root&&this._root.iterate(function(e){return n++,t(e[1],e[0],r)},e),n},ft.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?St(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},ft.isMap=pt;var Tr="@@__IMMUTABLE_MAP__@@",Br=ft.prototype;Br[Tr]=!0,Br[pr]=Br.remove,Br.removeIn=Br.deleteIn,lt.prototype.get=function(t,e,r,n){for(var i=this.entries,o=0,u=i.length;o=Jr)return Mt(t,s,n,i);var _=t&&t===this.ownerID,v=_?s:l(s);return p?a?c===h-1?v.pop():v[c]=v.pop():v[c]=[n,i]:v.push([n,i]),_?(this.entries=v,this):new lt(t,v)}},_t.prototype.get=function(t,e,r,n){void 0===e&&(e=ot(r));var i=1<<((0===t?e:e>>>t)&vr),o=this.bitmap;return 0===(o&i)?n:this.nodes[Ut(o&i-1)].get(t+lr,e,r,n)},_t.prototype.update=function(t,e,r,n,i,o,u){void 0===r&&(r=ot(n));var a=(0===e?r:r>>>e)&vr,s=1<=Wr)return kt(t,p,c,a,_);if(h&&!_&&2===p.length&&Dt(p[1^f]))return p[1^f];if(h&&_&&1===p.length&&Dt(_))return _;var v=t&&t===this.ownerID,d=h?_?c:c^s:c|s,y=h?_?Kt(p,f,_,v):Lt(p,f,v):Pt(p,f,_,v);return v?(this.bitmap=d,this.nodes=y,this):new _t(t,d,y)},vt.prototype.get=function(t,e,r,n){void 0===e&&(e=ot(r));var i=(0===t?e:e>>>t)&vr,o=this.nodes[i];return o?o.get(t+lr,e,r,n):n},vt.prototype.update=function(t,e,r,n,i,o,u){void 0===r&&(r=ot(n));var a=(0===e?r:r>>>e)&vr,s=i===dr,c=this.nodes,h=c[a];if(s&&!h)return this;var f=zt(h,t,e+lr,r,n,i,o,u);if(f===h)return this;var p=this.count;if(h){if(!f&&(p--,p=0&&t>>e&vr;if(n>=this.array.length)return new Bt([],t);var i,o=0===n;if(e>0){var u=this.array[n];if(i=u&&u.removeBefore(t,e-lr,r),i===u&&o)return this}if(o&&!i)return this;var a=Gt(this,t);if(!o)for(var s=0;s>>e&vr;if(n>=this.array.length)return this;var i;if(e>0){var o=this.array[n];if(i=o&&o.removeAfter(t,e-lr,r),i===o&&n===this.array.length-1)return this}var u=Gt(this,t);return u.array.splice(n+1),i&&(u.array[n]=i),u};var Hr,Xr={};t(Zt,ft),Zt.of=function(){return this(arguments)},Zt.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Zt.prototype.get=function(t,e){var r=this._map.get(t);return void 0!==r?this._list.get(r)[1]:e},Zt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):ee()},Zt.prototype.set=function(t,e){return re(this,t,e)},Zt.prototype.remove=function(t){return re(this,t,dr)},Zt.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Zt.prototype.__iterate=function(t,e){var r=this;return this._list.__iterate(function(e){return e&&t(e[1],e[0],r)},e)},Zt.prototype.__iterator=function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},Zt.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),r=this._list.__ensureOwner(t);return t?te(e,r,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=r,this)},Zt.isOrderedMap=$t,Zt.prototype[fr]=!0,Zt.prototype[pr]=Zt.prototype.remove;var Yr;t(ne,q),ne.prototype.get=function(t,e){return this._iter.get(t,e)},ne.prototype.has=function(t){return this._iter.has(t)},ne.prototype.valueSeq=function(){return this._iter.valueSeq()},ne.prototype.reverse=function(){var t=this,e=ce(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},ne.prototype.map=function(t,e){var r=this,n=se(this,t,e);return this._useKeys||(n.valueSeq=function(){return r._iter.toSeq().map(t,e)}),n},ne.prototype.__iterate=function(t,e){var r,n=this;return this._iter.__iterate(this._useKeys?function(e,r){return t(e,r,n)}:(r=e?Oe(this):0,function(i){return t(i,e?--r:r++,n)}),e)},ne.prototype.__iterator=function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var r=this._iter.__iterator(wr,e),n=e?Oe(this):0;return new S(function(){var i=r.next();return i.done?i:b(t,e?--n:n++,i.value,i)})},ne.prototype[fr]=!0,t(ie,x),ie.prototype.includes=function(t){return this._iter.includes(t)},ie.prototype.__iterate=function(t,e){var r=this,n=0;return this._iter.__iterate(function(e){return t(e,n++,r)},e)},ie.prototype.__iterator=function(t,e){var r=this._iter.__iterator(wr,e),n=0;return new S(function(){var e=r.next();return e.done?e:b(t,n++,e.value,e)})},t(oe,A),oe.prototype.has=function(t){return this._iter.includes(t)},oe.prototype.__iterate=function(t,e){var r=this;return this._iter.__iterate(function(e){return t(e,e,r)},e)},oe.prototype.__iterator=function(t,e){var r=this._iter.__iterator(wr,e);return new S(function(){var e=r.next();return e.done?e:b(t,e.value,e.value,e)})},t(ue,q),ue.prototype.entrySeq=function(){return this._iter.toSeq()},ue.prototype.__iterate=function(t,e){var r=this;return this._iter.__iterate(function(e){if(e){De(e);var n=o(e);return t(n?e.get(1):e[1],n?e.get(0):e[0],r)}},e)},ue.prototype.__iterator=function(t,e){var r=this._iter.__iterator(wr,e);return new S(function(){for(;;){var e=r.next();if(e.done)return e;var n=e.value;if(n){De(n);var i=o(n);return b(t,i?n.get(0):n[0],i?n.get(1):n[1],e)}}})},ie.prototype.cacheResult=ne.prototype.cacheResult=oe.prototype.cacheResult=ue.prototype.cacheResult=ke,t(Ae,et),Ae.prototype.toString=function(){return this.__toString(Re(this)+" {","}")},Ae.prototype.has=function(t){return this._defaultValues.hasOwnProperty(t)},Ae.prototype.get=function(t,e){if(!this.has(t))return e;var r=this._defaultValues[t];return this._map?this._map.get(t,r):r},Ae.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var t=this.constructor;return t._empty||(t._empty=je(this,bt()))},Ae.prototype.set=function(t,e){if(!this.has(t))throw new Error('Cannot set unknown key "'+t+'" on '+Re(this));if(this._map&&!this._map.has(t)){var r=this._defaultValues[t];if(e===r)return this}var n=this._map&&this._map.set(t,e);return this.__ownerID||n===this._map?this:je(this,n)},Ae.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:je(this,e)},Ae.prototype.wasAltered=function(){return this._map.wasAltered()},Ae.prototype.__iterator=function(t,e){var n=this;return r(this._defaultValues).map(function(t,e){return n.get(e)}).__iterator(t,e)},Ae.prototype.__iterate=function(t,e){var n=this;return r(this._defaultValues).map(function(t,e){return n.get(e)}).__iterate(t,e)},Ae.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?je(this,e,t):(this.__ownerID=t,this._map=e,this)};var Qr=Ae.prototype;Qr[pr]=Qr.remove,Qr.deleteIn=Qr.removeIn=Br.removeIn,Qr.merge=Br.merge,Qr.mergeWith=Br.mergeWith,Qr.mergeIn=Br.mergeIn,Qr.mergeDeep=Br.mergeDeep,Qr.mergeDeepWith=Br.mergeDeepWith,Qr.mergeDeepIn=Br.mergeDeepIn,Qr.setIn=Br.setIn,Qr.update=Br.update,Qr.updateIn=Br.updateIn,Qr.withMutations=Br.withMutations,Qr.asMutable=Br.asMutable,Qr.asImmutable=Br.asImmutable,t(Pe,nt),Pe.of=function(){return this(arguments)},Pe.fromKeys=function(t){return this(r(t).keySeq())},Pe.prototype.toString=function(){return this.__toString("Set {","}")},Pe.prototype.has=function(t){return this._map.has(t)},Pe.prototype.add=function(t){return Ce(this,this._map.set(t,!0))},Pe.prototype.remove=function(t){return Ce(this,this._map.remove(t))},Pe.prototype.clear=function(){return Ce(this,this._map.clear())},Pe.prototype.union=function(){var t=ar.call(arguments,0);return t=t.filter(function(t){return 0!==t.size}),0===t.length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations(function(e){for(var r=0;r=0;r--)e={value:arguments[r],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):He(t,e)},Fe.prototype.pushAll=function(t){if(t=n(t),0===t.size)return this;ht(t.size);var e=this.size,r=this._head;return t.reverse().forEach(function(t){e++,r={value:t,next:r}}),this.__ownerID?(this.size=e,this._head=r,this.__hash=void 0,this.__altered=!0,this):He(e,r)},Fe.prototype.pop=function(){return this.slice(1)},Fe.prototype.unshift=function(){return this.push.apply(this,arguments)},Fe.prototype.unshiftAll=function(t){return this.pushAll(t)},Fe.prototype.shift=function(){return this.pop.apply(this,arguments)},Fe.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):Xe()},Fe.prototype.slice=function(t,e){if(y(t,e,this.size))return this;var r=g(t,this.size),n=m(e,this.size);if(n!==this.size)return rt.prototype.slice.call(this,t,e);for(var i=this.size-r,o=this._head;r--;)o=o.next;return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):He(i,o)},Fe.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?He(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Fe.prototype.__iterate=function(t,e){if(e)return this.reverse().__iterate(t);for(var r=0,n=this._head;n&&t(n.value,r++,this)!==!1;)n=n.next;return r},Fe.prototype.__iterator=function(t,e){if(e)return this.reverse().__iterator(t);var r=0,n=this._head;return new S(function(){if(n){var e=n.value;return n=n.next,b(t,r++,e)}return I()})},Fe.isStack=Ge;var nn="@@__IMMUTABLE_STACK__@@",on=Fe.prototype;on[nn]=!0,on.withMutations=Br.withMutations,on.asMutable=Br.asMutable,on.asImmutable=Br.asImmutable,on.wasAltered=Br.wasAltered;var un;e.Iterator=S,Ye(e,{toArray:function(){ht(this.size);var t=new Array(this.size||0);return this.valueSeq().__iterate(function(e,r){t[r]=e}),t},toIndexedSeq:function(){return new ie(this)},toJS:function(){return this.toSeq().map(function(t){return t&&"function"==typeof t.toJS?t.toJS():t}).__toJS()},toJSON:function(){return this.toSeq().map(function(t){return t&&"function"==typeof t.toJSON?t.toJSON():t}).__toJS()},toKeyedSeq:function(){return new ne(this,(!0))},toMap:function(){return ft(this.toKeyedSeq())},toObject:function(){ht(this.size);var t={};return this.__iterate(function(e,r){t[r]=e}),t},toOrderedMap:function(){return Zt(this.toKeyedSeq())},toOrderedSet:function(){return Ne(u(this)?this.valueSeq():this)},toSet:function(){return Pe(u(this)?this.valueSeq():this)},toSetSeq:function(){return new oe(this)},toSeq:function(){return a(this)?this.toIndexedSeq():u(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Fe(u(this)?this.valueSeq():this)},toList:function(){return Ct(u(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(t,e){return 0===this.size?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){var t=ar.call(arguments,0);return ze(this,de(this,t))},includes:function(t){return this.some(function(e){return X(e,t)})},entries:function(){return this.__iterator(Sr)},every:function(t,e){ht(this.size);var r=!0;return this.__iterate(function(n,i,o){if(!t.call(e,n,i,o))return r=!1,!1}),r},filter:function(t,e){return ze(this,he(this,t,e,!0))},find:function(t,e,r){var n=this.findEntry(t,e);return n?n[1]:r},forEach:function(t,e){return ht(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){ht(this.size),t=void 0!==t?""+t:",";var e="",r=!0;return this.__iterate(function(n){r?r=!1:e+=t,e+=null!==n&&void 0!==n?n.toString():""}),e},keys:function(){return this.__iterator(mr)},map:function(t,e){return ze(this,se(this,t,e))},reduce:function(t,e,r){ht(this.size);var n,i;return arguments.length<2?i=!0:n=e,this.__iterate(function(e,o,u){i?(i=!1,n=e):n=t.call(r,n,e,o,u)}),n},reduceRight:function(t,e,r){var n=this.toKeyedSeq().reverse();return n.reduce.apply(n,arguments)},reverse:function(){return ze(this,ce(this,!0))},slice:function(t,e){return ze(this,le(this,t,e,!0))},some:function(t,e){return!this.every($e(t),e)},sort:function(t){return ze(this,we(this,t))},values:function(){return this.__iterator(wr)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(t,e){return _(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return fe(this,t,e)},equals:function(t){return Y(this,t)},entrySeq:function(){var t=this;if(t._cache)return new j(t._cache);var e=t.toSeq().map(Ze).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter($e(t),e)},findEntry:function(t,e,r){var n=r;return this.__iterate(function(r,i,o){if(t.call(e,r,i,o))return n=[i,r],!1}),n},findKey:function(t,e){var r=this.findEntry(t,e);return r&&r[0]},findLast:function(t,e,r){return this.toKeyedSeq().reverse().find(t,e,r)},findLastEntry:function(t,e,r){return this.toKeyedSeq().reverse().findEntry(t,e,r)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},first:function(){return this.find(d)},flatMap:function(t,e){return ze(this,ge(this,t,e))},flatten:function(t){return ze(this,ye(this,t,!0))},fromEntrySeq:function(){return new ue(this)},get:function(t,e){return this.find(function(e,r){return X(r,t)},void 0,e)},getIn:function(t,e){for(var r,n=this,i=xe(t);!(r=i.next()).done;){var o=r.value;if(n=n&&n.get?n.get(o,dr):dr,n===dr)return e}return n},groupBy:function(t,e){return pe(this,t,e)},has:function(t){return this.get(t,dr)!==dr},hasIn:function(t){return this.getIn(t,dr)!==dr},isSubset:function(t){return t="function"==typeof t.includes?t:e(t),this.every(function(e){return t.includes(e)})},isSuperset:function(t){return t="function"==typeof t.isSubset?t:e(t),t.isSubset(this)},keyOf:function(t){return this.findKey(function(e){return X(e,t)})},keySeq:function(){return this.toSeq().map(Qe).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(t){return this.toKeyedSeq().reverse().keyOf(t)},max:function(t){return Se(this,t)},maxBy:function(t,e){return Se(this,e,t)},min:function(t){return Se(this,t?tr(t):nr)},minBy:function(t,e){return Se(this,e?tr(e):nr,t)},rest:function(){return this.slice(1)},skip:function(t){return this.slice(Math.max(0,t))},skipLast:function(t){return ze(this,this.toSeq().reverse().skip(t).reverse())},skipWhile:function(t,e){return ze(this,ve(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile($e(t),e)},sortBy:function(t,e){return ze(this,we(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return ze(this,this.toSeq().reverse().take(t).reverse())},takeWhile:function(t,e){return ze(this,_e(this,t,e))},takeUntil:function(t,e){return this.takeWhile($e(t),e)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=ir(this))}});var an=e.prototype;an[sr]=!0,an[zr]=an.values,an.__toJS=an.toArray,an.__toStringMapper=er,an.inspect=an.toSource=function(){return this.toString()},an.chain=an.flatMap,an.contains=an.includes,Ye(r,{flip:function(){return ze(this,ae(this))},mapEntries:function(t,e){var r=this,n=0;return ze(this,this.toSeq().map(function(i,o){return t.call(e,[o,i],n++,r)}).fromEntrySeq())},mapKeys:function(t,e){var r=this;return ze(this,this.toSeq().flip().map(function(n,i){return t.call(e,n,i,r)}).flip())}});var sn=r.prototype;sn[cr]=!0,sn[zr]=an.entries,sn.__toJS=an.toObject,sn.__toStringMapper=function(t,e){return JSON.stringify(e)+": "+er(t)},Ye(n,{toKeyedSeq:function(){return new ne(this,(!1))},filter:function(t,e){return ze(this,he(this,t,e,!1))},findIndex:function(t,e){var r=this.findEntry(t,e);return r?r[0]:-1},indexOf:function(t){var e=this.keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return void 0===e?-1:e},reverse:function(){return ze(this,ce(this,!1))},slice:function(t,e){return ze(this,le(this,t,e,!1))},splice:function(t,e){var r=arguments.length;if(e=Math.max(0|e,0),0===r||2===r&&!e)return this;t=g(t,t<0?this.count():this.size);var n=this.slice(0,t);return ze(this,1===r?n:n.concat(l(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var r=this.findLastEntry(t,e);return r?r[0]:-1},first:function(){return this.get(0)},flatten:function(t){return ze(this,ye(this,t,!1))},get:function(t,e){return t=v(this,t),t<0||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find(function(e,r){return r===t},void 0,e)},has:function(t){return t=v(this,t),t>=0&&(void 0!==this.size?this.size===1/0||t-1&&t%1===0&&t<=Number.MAX_VALUE}var i=Function.prototype.bind;e.isString=function(t){return"string"==typeof t||"[object String]"===r(t)},e.isArray=Array.isArray||function(t){return"[object Array]"===r(t)},"function"!=typeof/./&&"object"!=typeof Int8Array?e.isFunction=function(t){return"function"==typeof t||!1}:e.isFunction=function(t){return"[object Function]"===toString.call(t)},e.isObject=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},e.extend=function(t){var e=arguments.length;if(!t||e<2)return t||{};for(var r=1;r0)){var e=this.reactorState.get("dirtyStores");if(0!==e.size){var r=c["default"].Set().withMutations(function(r){r.union(t.observerState.get("any")),e.forEach(function(e){var n=t.observerState.getIn(["stores",e]);n&&r.union(n)})});r.forEach(function(e){var r=t.observerState.getIn(["observersMap",e]);if(r){var n=r.get("getter"),i=r.get("handler"),o=l.evaluate(t.prevReactorState,n),u=l.evaluate(t.reactorState,n);t.prevReactorState=o.reactorState,t.reactorState=u.reactorState;var a=o.result,s=u.result;c["default"].is(a,s)||i.call(null,s)}});var n=l.resetDirtyStores(this.reactorState);this.prevReactorState=n,this.reactorState=n}}}},{key:"batchStart",value:function(){this.__batchDepth++}},{key:"batchEnd",value:function(){if(this.__batchDepth--,this.__batchDepth<=0){this.__isDispatching=!0;try{this.__notify()}catch(t){throw this.__isDispatching=!1,t}this.__isDispatching=!1}}}]),t}();e["default"]=(0,m.toFactory)(S),t.exports=e["default"]},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r={};return(0,o.each)(e,function(e,n){r[n]=t.evaluate(e)}),r}Object.defineProperty(e,"__esModule",{value:!0});var o=r(4);e["default"]=function(t){return{getInitialState:function(){return i(t,this.getDataBindings())},componentDidMount:function(){var e=this;this.__unwatchFns=[],(0,o.each)(this.getDataBindings(),function(r,i){var o=t.observe(r,function(t){e.setState(n({},i,t))});e.__unwatchFns.push(o)})},componentWillUnmount:function(){for(;this.__unwatchFns.length;)this.__unwatchFns.shift()()}}},t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){return new E({result:t,reactorState:e})}function o(t,e){return t.withMutations(function(t){(0,M.each)(e,function(e,r){t.getIn(["stores",r])&&console.warn("Store already defined for id = "+r);var n=e.getInitialState();if(void 0===n&&h(t,"throwOnUndefinedStoreReturnValue"))throw new Error("Store getInitialState() must return a value, did you forget a return statement");if(h(t,"throwOnNonImmutableStore")&&!(0,z.isImmutableValue)(n))throw new Error("Store getInitialState() must return an immutable value, did you forget to call toImmutable");t.update("stores",function(t){return t.set(r,e)}).update("state",function(t){return t.set(r,n)}).update("dirtyStores",function(t){return t.add(r)}).update("storeStates",function(t){return w(t,[r])})}),m(t)})}function u(t,e){return t.withMutations(function(t){(0,M.each)(e,function(e,r){t.update("stores",function(t){return t.set(r,e)})})})}function a(t,e,r){var n=t.get("logger");if(void 0===e&&h(t,"throwOnUndefinedActionType"))throw new Error("`dispatch` cannot be called with an `undefined` action type.");var i=t.get("state"),o=t.get("dirtyStores"),u=i.withMutations(function(u){n.dispatchStart(t,e,r),t.get("stores").forEach(function(i,a){var s=u.get(a),c=void 0;try{c=i.handle(s,e,r)}catch(f){throw n.dispatchError(t,f.message),f}if(void 0===c&&h(t,"throwOnUndefinedStoreReturnValue")){var p="Store handler must return a value, did you forget a return statement";throw n.dispatchError(t,p),new Error(p)}u.set(a,c),s!==c&&(o=o.add(a))}),n.dispatchEnd(t,u,o,i)}),a=t.set("state",u).set("dirtyStores",o).update("storeStates",function(t){return w(t,o)});return m(a)}function s(t,e){var r=[],n=(0,z.toImmutable)({}).withMutations(function(n){(0,M.each)(e,function(e,i){var o=t.getIn(["stores",i]);if(o){var u=o.deserialize(e);void 0!==u&&(n.set(i,u),r.push(i))}})}),i=b["default"].Set(r);return t.update("state",function(t){return t.merge(n)}).update("dirtyStores",function(t){return t.union(i)}).update("storeStates",function(t){return w(t,r)})}function c(t,e,r){var n=e;(0,O.isKeyPath)(e)&&(e=(0,D.fromKeyPath)(e));var i=t.get("nextId"),o=(0,D.getStoreDeps)(e),u=b["default"].Map({id:i,storeDeps:o,getterKey:n,getter:e,handler:r}),a=void 0;return a=0===o.size?t.update("any",function(t){return t.add(i)}):t.withMutations(function(t){o.forEach(function(e){var r=["stores",e];t.hasIn(r)||t.setIn(r,b["default"].Set()),t.updateIn(["stores",e],function(t){return t.add(i)})})}),a=a.set("nextId",i+1).setIn(["observersMap",i],u),{observerState:a,entry:u}}function h(t,e){var r=t.getIn(["options",e]);if(void 0===r)throw new Error("Invalid option: "+e);return r}function f(t,e,r){var n=t.get("observersMap").filter(function(t){var n=t.get("getterKey"),i=!r||t.get("handler")===r;return!!i&&((0,O.isKeyPath)(e)&&(0,O.isKeyPath)(n)?(0,O.isEqual)(e,n):e===n)});return t.withMutations(function(t){n.forEach(function(e){return p(t,e)})})}function p(t,e){return t.withMutations(function(t){var r=e.get("id"),n=e.get("storeDeps");0===n.size?t.update("any",function(t){return t.remove(r)}):n.forEach(function(e){t.updateIn(["stores",e],function(t){return t?t.remove(r):t})}),t.removeIn(["observersMap",r])})}function l(t){var e=t.get("state");return t.withMutations(function(t){var r=t.get("stores"),n=r.keySeq().toJS();r.forEach(function(r,n){var i=e.get(n),o=r.handleReset(i);if(void 0===o&&h(t,"throwOnUndefinedStoreReturnValue"))throw new Error("Store handleReset() must return a value, did you forget a return statement");if(h(t,"throwOnNonImmutableStore")&&!(0,z.isImmutableValue)(o))throw new Error("Store reset state must be an immutable value, did you forget to call toImmutable");t.setIn(["state",n],o)}),t.update("storeStates",function(t){return w(t,n)}),d(t)})}function _(t,e){var r=t.get("state");if((0,O.isKeyPath)(e))return i(r.getIn(e),t);if(!(0,D.isGetter)(e))throw new Error("evaluate must be passed a keyPath or Getter");var n=t.get("cache"),o=n.lookup(e),u=!o||y(t,o);return u&&(o=g(t,e)),i(o.get("value"),t.update("cache",function(t){return u?t.miss(e,o):t.hit(e)}))}function v(t){var e={};return t.get("stores").forEach(function(r,n){var i=t.getIn(["state",n]),o=r.serialize(i);void 0!==o&&(e[n]=o)}),e}function d(t){return t.set("dirtyStores",b["default"].Set())}function y(t,e){var r=e.get("storeStates");return!r.size||r.some(function(e,r){return t.getIn(["storeStates",r])!==e})}function g(t,e){var r=(0,D.getDeps)(e).map(function(e){return _(t,e).result}),n=(0,D.getComputeFn)(e).apply(null,r),i=(0,D.getStoreDeps)(e),o=(0,z.toImmutable)({}).withMutations(function(e){i.forEach(function(r){var n=t.getIn(["storeStates",r]);e.set(r,n)})});return(0,I.CacheEntry)({value:n,storeStates:o,dispatchId:t.get("dispatchId")})}function m(t){return t.update("dispatchId",function(t){return t+1})}function w(t,e){return t.withMutations(function(t){e.forEach(function(e){var r=t.has(e)?t.get(e)+1:1;t.set(e,r)})})}Object.defineProperty(e,"__esModule",{value:!0}),e.registerStores=o,e.replaceStores=u,e.dispatch=a,e.loadState=s,e.addObserver=c,e.getOption=h,e.removeObserver=f,e.removeObserverByEntry=p,e.reset=l,e.evaluate=_,e.serialize=v,e.resetDirtyStores=d;var S=r(3),b=n(S),I=r(9),z=r(5),D=r(10),O=r(11),M=r(4),E=b["default"].Record({result:null,reactorState:null})},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(){return new s}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var r=0;rr.dispatchId)throw new Error("Refusing to cache older value");return r}))}},{key:"evict",value:function(e){return new t(this.cache.remove(e))}}]),t}();e.BasicCache=s;var c=1e3,h=1,f=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?c:arguments[0],r=arguments.length<=1||void 0===arguments[1]?h:arguments[1],i=arguments.length<=2||void 0===arguments[2]?new s:arguments[2],o=arguments.length<=3||void 0===arguments[3]?(0,u.OrderedSet)():arguments[3];n(this,t),console.log("using LRU"),this.limit=e,this.evictCount=r,this.cache=i,this.lru=o}return o(t,[{key:"lookup",value:function(t,e){return this.cache.lookup(t,e)}},{key:"has",value:function(t){return this.cache.has(t)}},{key:"asMap",value:function(){return this.cache.asMap()}},{key:"hit",value:function(e){return this.cache.has(e)?new t(this.limit,this.evictCount,this.cache,this.lru.remove(e).add(e)):this}},{key:"miss",value:function(e,r){var n;if(this.lru.size>=this.limit){if(this.has(e))return new t(this.limit,this.evictCount,this.cache.miss(e,r),this.lru.remove(e).add(e));var i=this.lru.take(this.evictCount).reduce(function(t,e){return t.evict(e)},this.cache).miss(e,r);n=new t(this.limit,this.evictCount,i,this.lru.skip(this.evictCount).add(e))}else n=new t(this.limit,this.evictCount,this.cache.miss(e,r),this.lru.add(e));return n}},{key:"evict",value:function(e){return this.cache.has(e)?new t(this.limit,this.evictCount,this.cache.evict(e),this.lru.remove(e)):this}}]),t}();e.LRUCache=f},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t){return(0,p.isArray)(t)&&(0,p.isFunction)(t[t.length-1])}function o(t){return t[t.length-1]}function u(t){return t.slice(0,t.length-1)}function a(t,e){e||(e=f["default"].Set());var r=f["default"].Set().withMutations(function(e){if(!i(t))throw new Error("getFlattenedDeps must be passed a Getter");u(t).forEach(function(t){if((0,l.isKeyPath)(t))e.add((0,h.List)(t));else{if(!i(t))throw new Error("Invalid getter, each dependency must be a KeyPath or Getter");e.union(a(t))}})});return e.union(r)}function s(t){if(!(0,l.isKeyPath)(t))throw new Error("Cannot create Getter from KeyPath: "+t);return[t,_]}function c(t){if(t.hasOwnProperty("__storeDeps"))return t.__storeDeps;var e=a(t).map(function(t){return t.first()}).filter(function(t){return!!t});return Object.defineProperty(t,"__storeDeps",{enumerable:!1,configurable:!1,writable:!1,value:e}),e}Object.defineProperty(e,"__esModule",{value:!0});var h=r(3),f=n(h),p=r(4),l=r(11),_=function(t){return t};e["default"]={isGetter:i,getComputeFn:o,getFlattenedDeps:a,getStoreDeps:c,getDeps:u,fromKeyPath:s},t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t){return(0,s.isArray)(t)&&!(0,s.isFunction)(t[t.length-1])}function o(t,e){var r=a["default"].List(t),n=a["default"].List(e);return a["default"].is(r,n)}Object.defineProperty(e,"__esModule",{value:!0}),e.isKeyPath=i,e.isEqual=o;var u=r(3),a=n(u),s=r(4)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(8),i={dispatchStart:function(t,e,r){(0,n.getOption)(t,"logDispatches")&&console.group&&(console.groupCollapsed("Dispatch: %s",e),console.group("payload"),console.debug(r),console.groupEnd())},dispatchError:function(t,e){(0,n.getOption)(t,"logDispatches")&&console.group&&(console.debug("Dispatch error: "+e),console.groupEnd())},dispatchEnd:function(t,e,r,i){(0,n.getOption)(t,"logDispatches")&&console.group&&((0,n.getOption)(t,"logDirtyStores")&&console.log("Stores updated:",r.toList().toJS()),(0,n.getOption)(t,"logAppState")&&console.debug("Dispatch done, new state: ",e.toJS()),console.groupEnd())}};e.ConsoleGroupLogger=i;var o={dispatchStart:function(t,e,r){},dispatchError:function(t,e){},dispatchEnd:function(t,e,r){}};e.NoopLogger=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(3),i=r(9),o=r(12),u=(0,n.Map)({logDispatches:!1,logAppState:!1,logDirtyStores:!1,throwOnUndefinedActionType:!1,throwOnUndefinedStoreReturnValue:!1,throwOnNonImmutableStore:!1,throwOnDispatchInDispatch:!1});e.PROD_OPTIONS=u;var a=(0,n.Map)({logDispatches:!0,logAppState:!0,logDirtyStores:!0,throwOnUndefinedActionType:!0,throwOnUndefinedStoreReturnValue:!0,throwOnNonImmutableStore:!0,throwOnDispatchInDispatch:!0});e.DEBUG_OPTIONS=a;var s=(0,n.Record)({dispatchId:0,state:(0,n.Map)(),stores:(0,n.Map)(),cache:(0,i.DefaultCache)(),logger:o.NoopLogger,storeStates:(0,n.Map)(),dirtyStores:(0,n.Set)(),debug:!1,options:u});e.ReactorState=s;var c=(0,n.Record)({any:(0,n.Set)(),stores:(0,n.Map)({}),observersMap:(0,n.Map)({}),nextId:1});e.ObserverState=c}])}); \ No newline at end of file diff --git a/dist/nuclear.min.js.map b/dist/nuclear.min.js.map new file mode 100644 index 0000000..caf77ef --- /dev/null +++ b/dist/nuclear.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///dist/nuclear.min.js","webpack:///webpack/bootstrap 5101807446b00161d85d","webpack:///./src/main.js","webpack:///./src/console-polyfill.js","webpack:///./src/store.js","webpack:///./~/immutable/dist/immutable.js","webpack:///./src/utils.js","webpack:///./src/immutable-helpers.js","webpack:///./src/reactor.js","webpack:///./src/create-react-mixin.js","webpack:///./src/reactor/fns.js","webpack:///./src/reactor/cache.js","webpack:///./src/getter.js","webpack:///./src/key-path.js","webpack:///./src/logging.js","webpack:///./src/reactor/records.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","Object","defineProperty","value","_store","_store2","_reactor","_reactor2","_immutable","_immutable2","_immutableHelpers","_keyPath","_getter","_reactorCache","_createReactMixin","_createReactMixin2","Reactor","Store","Immutable","isKeyPath","isGetter","toJS","toImmutable","isImmutable","createReactMixin","LRUCache","window","console","log","debug","info","warn","error","e","_classCallCheck","instance","Constructor","TypeError","isStore","toTest","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","key","protoProps","staticProps","prototype","_utils","config","__handlers","Map","extend","initialize","state","type","payload","handler","get","getInitialState","actionType","set","toFactory","global","createClass","ctor","superClass","create","constructor","Iterable","isIterable","Seq","KeyedIterable","isKeyed","KeyedSeq","IndexedIterable","isIndexed","IndexedSeq","SetIterable","isAssociative","SetSeq","maybeIterable","IS_ITERABLE_SENTINEL","maybeKeyed","IS_KEYED_SENTINEL","maybeIndexed","IS_INDEXED_SENTINEL","maybeAssociative","isOrdered","maybeOrdered","IS_ORDERED_SENTINEL","MakeRef","ref","SetRef","OwnerID","arrCopy","arr","offset","len","Math","max","newArr","Array","ii","ensureSize","iter","undefined","size","__iterate","returnTrue","wrapIndex","index","uint32Index","NaN","wholeSlice","begin","end","resolveBegin","resolveIndex","resolveEnd","defaultIndex","min","Iterator","next","iteratorValue","k","v","iteratorResult","done","iteratorDone","hasIterator","getIteratorFn","isIterator","maybeIterator","getIterator","iterable","iteratorFn","REAL_ITERATOR_SYMBOL","FAUX_ITERATOR_SYMBOL","isArrayLike","emptySequence","toSeq","seqFromValue","toKeyedSeq","fromEntrySeq","keyedSeqFromValue","entrySeq","toIndexedSeq","indexedSeqFromValue","toSetSeq","ArraySeq","array","_array","ObjectSeq","object","keys","_object","_keys","IterableSeq","_iterable","IteratorSeq","iterator","_iterator","_iteratorCache","isSeq","maybeSeq","IS_SEQ_SENTINEL","EMPTY_SEQ","seq","isArray","maybeIndexedSeqFromValue","seqIterate","fn","reverse","useKeys","cache","_cache","maxIndex","entry","__iterateUncached","seqIterator","__iteratorUncached","fromJS","json","converter","fromJSWith","","fromJSDefault","parentJSON","map","isPlainObj","toList","toMap","is","valueA","valueB","valueOf","equals","deepEqual","a","b","__hash","notAssociative","entries","every","flipped","cacheResult","_","allEqual","bSize","has","NOT_SET","Repeat","times","_value","Infinity","EMPTY_REPEAT","invariant","condition","Error","Range","start","step","abs","_start","_end","_step","ceil","EMPTY_RANGE","Collection","KeyedCollection","IndexedCollection","SetCollection","smi","i32","hash","o","h","STRING_HASH_CACHE_MIN_STRLEN","cachedHashString","hashString","hashCode","hashJSObj","toString","string","stringHashCache","STRING_HASH_CACHE_SIZE","STRING_HASH_CACHE_MAX_SIZE","charCodeAt","usingWeakMap","weakMap","UID_HASH_KEY","canDefineProperty","propertyIsEnumerable","getIENodeHash","objHashUID","isExtensible","apply","arguments","nodeType","node","uniqueID","documentElement","assertNotInfinite","emptyMap","isMap","withMutations","forEach","maybeMap","IS_MAP_SENTINEL","ArrayMapNode","ownerID","BitmapIndexedNode","bitmap","nodes","HashArrayMapNode","count","HashCollisionNode","keyHash","ValueNode","MapIterator","_type","_reverse","_stack","_root","mapIteratorFrame","mapIteratorValue","prev","__prev","makeMap","MapPrototype","__ownerID","__altered","EMPTY_MAP","updateMap","newRoot","newSize","didChangeSize","CHANGE_LENGTH","didAlter","DID_ALTER","updateNode","shift","update","isLeafNode","mergeIntoNode","newNode","idx1","MASK","idx2","SHIFT","createNodes","packNodes","excluding","packedII","packedNodes","bit","expandNodes","including","expandedNodes","SIZE","mergeIntoMapWith","merger","iterables","iters","push","mergeIntoCollectionWith","deepMerger","existing","mergeDeep","deepMergerWith","mergeDeepWith","nextValue","collection","filter","x","mergeIntoMap","updateInDeepMap","keyPathIter","notSetValue","updater","isNotSet","existingValue","newValue","nextExisting","nextUpdated","remove","popCount","setIn","idx","val","canEdit","newArray","spliceIn","newLen","after","spliceOut","pop","List","empty","emptyList","isList","makeList","VNode","toArray","list","setSize","maybeList","IS_LIST_SENTINEL","iterateList","iterateNodeOrLeaf","level","iterateLeaf","iterateNode","tailPos","tail","from","left","to","right","DONE","values","_origin","_capacity","getTailOffset","_tail","_level","origin","capacity","ListPrototype","EMPTY_LIST","updateList","setListBounds","newTail","updateVNode","nodeHas","lowerNode","newLowerNode","editableVNode","slice","listNodeFor","rawIndex","owner","oldOrigin","oldCapacity","newOrigin","newCapacity","clear","newLevel","offsetShift","oldTailOffset","newTailOffset","oldTail","removeAfter","removeBefore","beginIndex","mergeIntoListWith","maxSize","OrderedMap","emptyOrderedMap","isOrderedMap","maybeOrderedMap","makeOrderedMap","omap","_map","_list","EMPTY_ORDERED_MAP","updateOrderedMap","newMap","newList","flip","ToKeyedSequence","indexed","_iter","_useKeys","ToIndexedSequence","ToSetSequence","FromEntriesSequence","flipFactory","flipSequence","makeSequence","reversedSequence","includes","cacheResultThrough","this$0","ITERATE_ENTRIES","__iterator","ITERATE_VALUES","ITERATE_KEYS","mapFactory","mapper","context","mappedSequence","reverseFactory","filterFactory","predicate","filterSequence","iterations","countByFactory","grouper","groups","asMutable","asImmutable","groupByFactory","isKeyedIter","coerce","iterableClass","reify","sliceFactory","originalSize","resolvedBegin","resolvedEnd","sliceSize","resolvedSize","sliceSeq","skipped","isSkipping","takeWhileFactory","takeSequence","iterating","skipWhileFactory","skipSequence","skipping","concatFactory","isKeyedIterable","concat","singleton","concatSeq","flatten","reduce","sum","flattenFactory","depth","flatSequence","flatDeep","currentDepth","stopped","stack","flatMapFactory","interposeFactory","separator","interposedSequence","sortFactory","comparator","defaultComparator","sort","maxFactory","maxCompare","comp","zipWithFactory","keyIter","zipper","zipSequence","iterators","isDone","steps","some","s","validateEntry","resolveSize","forceIterator","keyPath","Record","defaultValues","name","hasInitialized","RecordType","setProps","RecordTypePrototype","_name","_defaultValues","RecordPrototype","makeRecord","likeRecord","record","getPrototypeOf","recordName","names","setProp","bind","Set","emptySet","isSet","add","maybeSet","IS_SET_SENTINEL","updateSet","__empty","__make","makeSet","SetPrototype","EMPTY_SET","OrderedSet","emptyOrderedSet","isOrderedSet","maybeOrderedSet","makeOrderedSet","OrderedSetPrototype","EMPTY_ORDERED_SET","Stack","emptyStack","isStack","unshiftAll","maybeStack","IS_STACK_SENTINEL","makeStack","head","StackPrototype","_head","EMPTY_STACK","mixin","methods","keyCopier","getOwnPropertySymbols","keyMapper","entryMapper","not","neg","quoteString","JSON","stringify","String","defaultZipper","defaultNegComparator","hashIterable","ordered","keyed","hashMerge","murmurHashOfSize","imul","SLICE$0","Keyed","Indexed","DELETE","Symbol","ITERATOR_SYMBOL","KEYS","VALUES","ENTRIES","inspect","toSource","of","__toString","hasOwnProperty","searchValue","indexOf","lastIndexOf","other","possibleIndex","floor","offsetValue","d","WeakMap","keyValues","updateIn","deleteIn","updatedValue","merge","mergeWith","mergeIn","mergeDeepIn","sortBy","mutable","wasAltered","__ensureOwner","iterate","removeIn","removed","exists","MAX_ARRAY_MAP_SIZE","isEditable","newEntries","keyHashFrag","MAX_BITMAP_INDEXED_SIZE","newBitmap","newNodes","newCount","MIN_HASH_ARRAY_MAP_SIZE","keyMatch","subNode","splice","insert","oldSize","unshift","originIndex","newChild","removingFirst","oldChild","editable","sizeIndex","valueSeq","indexedIterable","defaultVal","_empty","fromKeys","keySeq","union","intersect","originalSet","subtract","peek","pushAll","__toJS","toJSON","toObject","toOrderedMap","toOrderedSet","toSet","toStack","__toStringMapper","join","returnValue","find","findEntry","sideEffect","joined","isFirst","reducer","initialReduction","reduction","useFirst","reduceRight","reversed","butLast","isEmpty","countBy","entriesSequence","filterNot","found","findKey","findLast","findLastEntry","findLastKey","first","flatMap","searchKey","getIn","searchKeyPath","nested","groupBy","hasIn","isSubset","isSuperset","keyOf","last","lastKeyOf","maxBy","minBy","rest","skip","amount","skipLast","skipWhile","skipUntil","take","takeLast","takeWhile","takeUntil","IterablePrototype","chain","contains","mapEntries","mapKeys","KeyedIterablePrototype","findIndex","removeNum","numArgs","spliced","findLastIndex","interpose","interleave","zipped","interleaved","zip","zipWith","objectToString","isLength","Number","MAX_VALUE","_bind","Function","isString","Int8Array","isFunction","isObject","source","l","clone","each","iteratee","origIteratee","innerCollection","partial","func","partialArgs","Klass","Factory","_len","args","_key","__proto__","isImmutableValue","arg","_interopRequireWildcard","newObj","_defineProperty","_reactorFns","fns","_logging","_reactorRecords","baseOptions","DEBUG_OPTIONS","PROD_OPTIONS","logger","NoopLogger","ConsoleGroupLogger","initialReactorState","ReactorState","DefaultCache","options","prevReactorState","reactorState","observerState","ObserverState","ReactMixin","__batchDepth","__isDispatching","keyPathOrGetter","_fns$evaluate","evaluate","result","getter","_this","_fns$addObserver","addObserver","removeObserverByEntry","removeObserver","getOption","dispatch","__notify","batchStart","batchEnd","store","registerStores","stores","replaceStores","serialize","loadState","newState","reset","_this2","dirtyStores","observerIdsToNotify","observerId","prevEvaluateResult","currEvaluateResult","prevValue","currValue","nextReactorState","resetDirtyStores","getState","reactor","data","getDataBindings","componentDidMount","__unwatchFns","unwatchFn","observe","setState","componentWillUnmount","evaluateResult","EvaluateResult","initialState","storeStates","incrementStoreStates","incrementId","logging","currState","nextState","dispatchStart","handle","dispatchError","message","errorMsg","dispatchEnd","stateToLoad","serializedStoreState","storeId","storeState","deserialize","dirtyStoresSet","getterKey","fromKeyPath","currId","storeDeps","getStoreDeps","updatedObserverState","observerIds","path","option","entriesToRemove","entryGetter","handlersMatch","isEqual","anyObsevers","observers","prevState","storeMap","storeIds","resetStoreState","handleReset","cacheEntry","lookup","isCacheMiss","isDirtyCacheEntry","createCacheEntry","miss","hit","serialized","serializedState","stateId","getDeps","dep","getComputeFn","CacheEntry","dispatchId","nextId","BasicCache","item","notFoundValue","existingEntry","DEFAULT_LRU_LIMIT","DEFAULT_LRU_EVICT_COUNT","limit","evictCount","lru","asMap","lruCache","evictItem","evict","getFlattenedDeps","toAdd","identity","__storeDeps","iA","iB","group","groupCollapsed","groupEnd","previousState","logDispatches","logAppState","logDirtyStores","throwOnUndefinedActionType","throwOnUndefinedStoreReturnValue","throwOnNonImmutableStore","throwOnDispatchInDispatch","any","observersMap"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,UAAAH,GACA,gBAAAC,SACAA,QAAA,QAAAD,IAEAD,EAAA,QAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAP,WACAS,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,QAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA;;;ADmBM,SAASL,EAAQD,EAASM,GAE/B,YAMA,SAASS,GAAuBC,GAAO,MAAOA,IAAOA,EAAIC,WAAaD,GAAQE,UAAWF,GAJzFG,OAAOC,eAAepB,EAAS,cAC7BqB,OAAO,IAKTf,2BEnEM,EFqEN,IAAIgB,GAAShB,gBEpEI,GFsEbiB,EAAUR,EAAuBO,GAEjCE,EAAWlB,kBEvEI,GFyEfmB,EAAYV,EAAuBS,GAEnCE,EAAapB,kBE1EI,GF4EjBqB,EAAcZ,EAAuBW,GAErCE,EAAoBtB,4BE7E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3NW,IAEdsxB,GAAe,EAAAlwB,EAAAiD,MAE1B21B,eAAe,EAEfC,aAAa,EAEbC,gBAAgB,EAEhBC,4BAA4B,EAE5BC,kCAAkC,EAElCC,0BAA0B,EAE1BC,2BAA2B,Gf23N5B56B,GAAQ4xB,aAAeA,Cex3NjB,IAAMD,IAAgB,EAAAjwB,EAAAiD,MAE3B21B,eAAe,EAEfC,aAAa,EAEbC,gBAAgB,EAEhBC,4BAA4B,EAE5BC,kCAAkC,EAElCC,0BAA0B,EAE1BC,2BAA2B,Gf43N5B56B,GAAQ2xB,cAAgBA,Cez3NlB,IAAMM,IAAe,EAAAvwB,EAAAwgB,SAC1B2W,WAAY,EACZ/zB,OAAO,EAAApD,EAAAiD,OACPivB,QAAQ,EAAAlyB,EAAAiD,OACR4H,OAAO,EAAAC,EAAA0lB,gBACPL,OAAML,EAAAM,WAEN2D,aAAa,EAAA/zB,EAAAiD,OACbwvB,aAAa,EAAAzyB,EAAA0hB,OACbrgB,OAAO,EAEPovB,QAASP,Gf63NV5xB,GAAQiyB,aAAeA,Ce13NjB,IAAMM,IAAgB,EAAA7wB,EAAAwgB,SAE3B2Y,KAAK,EAAAn5B,EAAA0hB,OAELwQ,QAAQ,EAAAlyB,EAAAiD,SAERm2B,cAAc,EAAAp5B,EAAAiD,SAEdm0B,OAAQ,Gf63NT94B,GAAQuyB,cAAgBA","file":"./dist/nuclear.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Nuclear\"] = factory();\n\telse\n\t\troot[\"Nuclear\"] = factory();\n})(this, function() {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Nuclear\"] = factory();\n\telse\n\t\troot[\"Nuclear\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/*!*********************!*\\\n !*** ./src/main.js ***!\n \\*********************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t__webpack_require__(/*! ./console-polyfill */ 1);\n\t\n\tvar _store = __webpack_require__(/*! ./store */ 2);\n\t\n\tvar _store2 = _interopRequireDefault(_store);\n\t\n\tvar _reactor = __webpack_require__(/*! ./reactor */ 6);\n\t\n\tvar _reactor2 = _interopRequireDefault(_reactor);\n\t\n\tvar _immutable = __webpack_require__(/*! immutable */ 3);\n\t\n\tvar _immutable2 = _interopRequireDefault(_immutable);\n\t\n\tvar _immutableHelpers = __webpack_require__(/*! ./immutable-helpers */ 5);\n\t\n\tvar _keyPath = __webpack_require__(/*! ./key-path */ 11);\n\t\n\tvar _getter = __webpack_require__(/*! ./getter */ 10);\n\t\n\tvar _reactorCache = __webpack_require__(/*! ./reactor/cache */ 9);\n\t\n\tvar _createReactMixin = __webpack_require__(/*! ./create-react-mixin */ 7);\n\t\n\tvar _createReactMixin2 = _interopRequireDefault(_createReactMixin);\n\t\n\texports['default'] = {\n\t Reactor: _reactor2['default'],\n\t Store: _store2['default'],\n\t Immutable: _immutable2['default'],\n\t isKeyPath: _keyPath.isKeyPath,\n\t isGetter: _getter.isGetter,\n\t toJS: _immutableHelpers.toJS,\n\t toImmutable: _immutableHelpers.toImmutable,\n\t isImmutable: _immutableHelpers.isImmutable,\n\t createReactMixin: _createReactMixin2['default'],\n\t LRUCache: _reactorCache.LRUCache\n\t};\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 1 */\n/*!*********************************!*\\\n !*** ./src/console-polyfill.js ***!\n \\*********************************/\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\ttry {\n\t /* eslint-disable no-console */\n\t if (!(window.console && console.log)) {\n\t /* eslint-enable no-console */\n\t console = {\n\t log: function log() {},\n\t debug: function debug() {},\n\t info: function info() {},\n\t warn: function warn() {},\n\t error: function error() {}\n\t };\n\t }\n\t} catch (e) {\n\t // ignored\n\t}\n\n/***/ },\n/* 2 */\n/*!**********************!*\\\n !*** ./src/store.js ***!\n \\**********************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\texports.isStore = isStore;\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _immutable = __webpack_require__(/*! immutable */ 3);\n\t\n\tvar _utils = __webpack_require__(/*! ./utils */ 4);\n\t\n\tvar _immutableHelpers = __webpack_require__(/*! ./immutable-helpers */ 5);\n\t\n\t/**\n\t * Stores define how a certain domain of the application should respond to actions\n\t * taken on the whole system. They manage their own section of the entire app state\n\t * and have no knowledge about the other parts of the application state.\n\t */\n\t\n\tvar Store = (function () {\n\t function Store(config) {\n\t _classCallCheck(this, Store);\n\t\n\t this.__handlers = (0, _immutable.Map)({});\n\t\n\t if (config) {\n\t // allow `MyStore extends Store` syntax without throwing error\n\t (0, _utils.extend)(this, config);\n\t }\n\t\n\t this.initialize();\n\t }\n\t\n\t /**\n\t * This method is overridden by extending classes to setup message handlers\n\t * via `this.on` and to set up the initial state\n\t *\n\t * Anything returned from this function will be coerced into an ImmutableJS value\n\t * and set as the initial state for the part of the ReactorCore\n\t */\n\t\n\t _createClass(Store, [{\n\t key: 'initialize',\n\t value: function initialize() {}\n\t // extending classes implement to setup action handlers\n\t\n\t /**\n\t * Overridable method to get the initial state for this type of store\n\t */\n\t\n\t }, {\n\t key: 'getInitialState',\n\t value: function getInitialState() {\n\t return (0, _immutable.Map)();\n\t }\n\t\n\t /**\n\t * Takes a current reactor state, action type and payload\n\t * does the reaction and returns the new state\n\t */\n\t }, {\n\t key: 'handle',\n\t value: function handle(state, type, payload) {\n\t var handler = this.__handlers.get(type);\n\t\n\t if (typeof handler === 'function') {\n\t return handler.call(this, state, payload, type);\n\t }\n\t\n\t return state;\n\t }\n\t\n\t /**\n\t * Pure function taking the current state of store and returning\n\t * the new state after a NuclearJS reactor has been reset\n\t *\n\t * Overridable\n\t */\n\t }, {\n\t key: 'handleReset',\n\t value: function handleReset(state) {\n\t return this.getInitialState();\n\t }\n\t\n\t /**\n\t * Binds an action type => handler\n\t */\n\t }, {\n\t key: 'on',\n\t value: function on(actionType, handler) {\n\t this.__handlers = this.__handlers.set(actionType, handler);\n\t }\n\t\n\t /**\n\t * Serializes store state to plain JSON serializable JavaScript\n\t * Overridable\n\t * @param {*}\n\t * @return {*}\n\t */\n\t }, {\n\t key: 'serialize',\n\t value: function serialize(state) {\n\t return (0, _immutableHelpers.toJS)(state);\n\t }\n\t\n\t /**\n\t * Deserializes plain JavaScript to store state\n\t * Overridable\n\t * @param {*}\n\t * @return {*}\n\t */\n\t }, {\n\t key: 'deserialize',\n\t value: function deserialize(state) {\n\t return (0, _immutableHelpers.toImmutable)(state);\n\t }\n\t }]);\n\t\n\t return Store;\n\t})();\n\t\n\tfunction isStore(toTest) {\n\t return toTest instanceof Store;\n\t}\n\t\n\texports['default'] = (0, _utils.toFactory)(Store);\n\n/***/ },\n/* 3 */\n/*!***************************************!*\\\n !*** ./~/immutable/dist/immutable.js ***!\n \\***************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Copyright (c) 2014-2015, Facebook, Inc.\n\t * All rights reserved.\n\t *\n\t * This source code is licensed under the BSD-style license found in the\n\t * LICENSE file in the root directory of this source tree. An additional grant\n\t * of patent rights can be found in the PATENTS file in the same directory.\n\t */\n\t\n\t(function (global, factory) {\n\t true ? module.exports = factory() :\n\t typeof define === 'function' && define.amd ? define(factory) :\n\t (global.Immutable = factory());\n\t}(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice;\n\t\n\t function createClass(ctor, superClass) {\n\t if (superClass) {\n\t ctor.prototype = Object.create(superClass.prototype);\n\t }\n\t ctor.prototype.constructor = ctor;\n\t }\n\t\n\t function Iterable(value) {\n\t return isIterable(value) ? value : Seq(value);\n\t }\n\t\n\t\n\t createClass(KeyedIterable, Iterable);\n\t function KeyedIterable(value) {\n\t return isKeyed(value) ? value : KeyedSeq(value);\n\t }\n\t\n\t\n\t createClass(IndexedIterable, Iterable);\n\t function IndexedIterable(value) {\n\t return isIndexed(value) ? value : IndexedSeq(value);\n\t }\n\t\n\t\n\t createClass(SetIterable, Iterable);\n\t function SetIterable(value) {\n\t return isIterable(value) && !isAssociative(value) ? value : SetSeq(value);\n\t }\n\t\n\t\n\t\n\t function isIterable(maybeIterable) {\n\t return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]);\n\t }\n\t\n\t function isKeyed(maybeKeyed) {\n\t return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]);\n\t }\n\t\n\t function isIndexed(maybeIndexed) {\n\t return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]);\n\t }\n\t\n\t function isAssociative(maybeAssociative) {\n\t return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);\n\t }\n\t\n\t function isOrdered(maybeOrdered) {\n\t return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]);\n\t }\n\t\n\t Iterable.isIterable = isIterable;\n\t Iterable.isKeyed = isKeyed;\n\t Iterable.isIndexed = isIndexed;\n\t Iterable.isAssociative = isAssociative;\n\t Iterable.isOrdered = isOrdered;\n\t\n\t Iterable.Keyed = KeyedIterable;\n\t Iterable.Indexed = IndexedIterable;\n\t Iterable.Set = SetIterable;\n\t\n\t\n\t var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n\t var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n\t var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n\t var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\t\n\t // Used for setting prototype methods that IE8 chokes on.\n\t var DELETE = 'delete';\n\t\n\t // Constants describing the size of trie nodes.\n\t var SHIFT = 5; // Resulted in best performance after ______?\n\t var SIZE = 1 << SHIFT;\n\t var MASK = SIZE - 1;\n\t\n\t // A consistent shared value representing \"not set\" which equals nothing other\n\t // than itself, and nothing that could be provided externally.\n\t var NOT_SET = {};\n\t\n\t // Boolean references, Rough equivalent of `bool &`.\n\t var CHANGE_LENGTH = { value: false };\n\t var DID_ALTER = { value: false };\n\t\n\t function MakeRef(ref) {\n\t ref.value = false;\n\t return ref;\n\t }\n\t\n\t function SetRef(ref) {\n\t ref && (ref.value = true);\n\t }\n\t\n\t // A function which returns a value representing an \"owner\" for transient writes\n\t // to tries. The return value will only ever equal itself, and will not equal\n\t // the return of any subsequent call of this function.\n\t function OwnerID() {}\n\t\n\t // http://jsperf.com/copy-array-inline\n\t function arrCopy(arr, offset) {\n\t offset = offset || 0;\n\t var len = Math.max(0, arr.length - offset);\n\t var newArr = new Array(len);\n\t for (var ii = 0; ii < len; ii++) {\n\t newArr[ii] = arr[ii + offset];\n\t }\n\t return newArr;\n\t }\n\t\n\t function ensureSize(iter) {\n\t if (iter.size === undefined) {\n\t iter.size = iter.__iterate(returnTrue);\n\t }\n\t return iter.size;\n\t }\n\t\n\t function wrapIndex(iter, index) {\n\t // This implements \"is array index\" which the ECMAString spec defines as:\n\t //\n\t // A String property name P is an array index if and only if\n\t // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal\n\t // to 2^32−1.\n\t //\n\t // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects\n\t if (typeof index !== 'number') {\n\t var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32\n\t if ('' + uint32Index !== index || uint32Index === 4294967295) {\n\t return NaN;\n\t }\n\t index = uint32Index;\n\t }\n\t return index < 0 ? ensureSize(iter) + index : index;\n\t }\n\t\n\t function returnTrue() {\n\t return true;\n\t }\n\t\n\t function wholeSlice(begin, end, size) {\n\t return (begin === 0 || (size !== undefined && begin <= -size)) &&\n\t (end === undefined || (size !== undefined && end >= size));\n\t }\n\t\n\t function resolveBegin(begin, size) {\n\t return resolveIndex(begin, size, 0);\n\t }\n\t\n\t function resolveEnd(end, size) {\n\t return resolveIndex(end, size, size);\n\t }\n\t\n\t function resolveIndex(index, size, defaultIndex) {\n\t return index === undefined ?\n\t defaultIndex :\n\t index < 0 ?\n\t Math.max(0, size + index) :\n\t size === undefined ?\n\t index :\n\t Math.min(size, index);\n\t }\n\t\n\t /* global Symbol */\n\t\n\t var ITERATE_KEYS = 0;\n\t var ITERATE_VALUES = 1;\n\t var ITERATE_ENTRIES = 2;\n\t\n\t var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n\t var FAUX_ITERATOR_SYMBOL = '@@iterator';\n\t\n\t var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;\n\t\n\t\n\t function Iterator(next) {\n\t this.next = next;\n\t }\n\t\n\t Iterator.prototype.toString = function() {\n\t return '[Iterator]';\n\t };\n\t\n\t\n\t Iterator.KEYS = ITERATE_KEYS;\n\t Iterator.VALUES = ITERATE_VALUES;\n\t Iterator.ENTRIES = ITERATE_ENTRIES;\n\t\n\t Iterator.prototype.inspect =\n\t Iterator.prototype.toSource = function () { return this.toString(); }\n\t Iterator.prototype[ITERATOR_SYMBOL] = function () {\n\t return this;\n\t };\n\t\n\t\n\t function iteratorValue(type, k, v, iteratorResult) {\n\t var value = type === 0 ? k : type === 1 ? v : [k, v];\n\t iteratorResult ? (iteratorResult.value = value) : (iteratorResult = {\n\t value: value, done: false\n\t });\n\t return iteratorResult;\n\t }\n\t\n\t function iteratorDone() {\n\t return { value: undefined, done: true };\n\t }\n\t\n\t function hasIterator(maybeIterable) {\n\t return !!getIteratorFn(maybeIterable);\n\t }\n\t\n\t function isIterator(maybeIterator) {\n\t return maybeIterator && typeof maybeIterator.next === 'function';\n\t }\n\t\n\t function getIterator(iterable) {\n\t var iteratorFn = getIteratorFn(iterable);\n\t return iteratorFn && iteratorFn.call(iterable);\n\t }\n\t\n\t function getIteratorFn(iterable) {\n\t var iteratorFn = iterable && (\n\t (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) ||\n\t iterable[FAUX_ITERATOR_SYMBOL]\n\t );\n\t if (typeof iteratorFn === 'function') {\n\t return iteratorFn;\n\t }\n\t }\n\t\n\t function isArrayLike(value) {\n\t return value && typeof value.length === 'number';\n\t }\n\t\n\t createClass(Seq, Iterable);\n\t function Seq(value) {\n\t return value === null || value === undefined ? emptySequence() :\n\t isIterable(value) ? value.toSeq() : seqFromValue(value);\n\t }\n\t\n\t Seq.of = function(/*...values*/) {\n\t return Seq(arguments);\n\t };\n\t\n\t Seq.prototype.toSeq = function() {\n\t return this;\n\t };\n\t\n\t Seq.prototype.toString = function() {\n\t return this.__toString('Seq {', '}');\n\t };\n\t\n\t Seq.prototype.cacheResult = function() {\n\t if (!this._cache && this.__iterateUncached) {\n\t this._cache = this.entrySeq().toArray();\n\t this.size = this._cache.length;\n\t }\n\t return this;\n\t };\n\t\n\t // abstract __iterateUncached(fn, reverse)\n\t\n\t Seq.prototype.__iterate = function(fn, reverse) {\n\t return seqIterate(this, fn, reverse, true);\n\t };\n\t\n\t // abstract __iteratorUncached(type, reverse)\n\t\n\t Seq.prototype.__iterator = function(type, reverse) {\n\t return seqIterator(this, type, reverse, true);\n\t };\n\t\n\t\n\t\n\t createClass(KeyedSeq, Seq);\n\t function KeyedSeq(value) {\n\t return value === null || value === undefined ?\n\t emptySequence().toKeyedSeq() :\n\t isIterable(value) ?\n\t (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) :\n\t keyedSeqFromValue(value);\n\t }\n\t\n\t KeyedSeq.prototype.toKeyedSeq = function() {\n\t return this;\n\t };\n\t\n\t\n\t\n\t createClass(IndexedSeq, Seq);\n\t function IndexedSeq(value) {\n\t return value === null || value === undefined ? emptySequence() :\n\t !isIterable(value) ? indexedSeqFromValue(value) :\n\t isKeyed(value) ? value.entrySeq() : value.toIndexedSeq();\n\t }\n\t\n\t IndexedSeq.of = function(/*...values*/) {\n\t return IndexedSeq(arguments);\n\t };\n\t\n\t IndexedSeq.prototype.toIndexedSeq = function() {\n\t return this;\n\t };\n\t\n\t IndexedSeq.prototype.toString = function() {\n\t return this.__toString('Seq [', ']');\n\t };\n\t\n\t IndexedSeq.prototype.__iterate = function(fn, reverse) {\n\t return seqIterate(this, fn, reverse, false);\n\t };\n\t\n\t IndexedSeq.prototype.__iterator = function(type, reverse) {\n\t return seqIterator(this, type, reverse, false);\n\t };\n\t\n\t\n\t\n\t createClass(SetSeq, Seq);\n\t function SetSeq(value) {\n\t return (\n\t value === null || value === undefined ? emptySequence() :\n\t !isIterable(value) ? indexedSeqFromValue(value) :\n\t isKeyed(value) ? value.entrySeq() : value\n\t ).toSetSeq();\n\t }\n\t\n\t SetSeq.of = function(/*...values*/) {\n\t return SetSeq(arguments);\n\t };\n\t\n\t SetSeq.prototype.toSetSeq = function() {\n\t return this;\n\t };\n\t\n\t\n\t\n\t Seq.isSeq = isSeq;\n\t Seq.Keyed = KeyedSeq;\n\t Seq.Set = SetSeq;\n\t Seq.Indexed = IndexedSeq;\n\t\n\t var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';\n\t\n\t Seq.prototype[IS_SEQ_SENTINEL] = true;\n\t\n\t\n\t\n\t createClass(ArraySeq, IndexedSeq);\n\t function ArraySeq(array) {\n\t this._array = array;\n\t this.size = array.length;\n\t }\n\t\n\t ArraySeq.prototype.get = function(index, notSetValue) {\n\t return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;\n\t };\n\t\n\t ArraySeq.prototype.__iterate = function(fn, reverse) {\n\t var array = this._array;\n\t var maxIndex = array.length - 1;\n\t for (var ii = 0; ii <= maxIndex; ii++) {\n\t if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) {\n\t return ii + 1;\n\t }\n\t }\n\t return ii;\n\t };\n\t\n\t ArraySeq.prototype.__iterator = function(type, reverse) {\n\t var array = this._array;\n\t var maxIndex = array.length - 1;\n\t var ii = 0;\n\t return new Iterator(function() \n\t {return ii > maxIndex ?\n\t iteratorDone() :\n\t iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])}\n\t );\n\t };\n\t\n\t\n\t\n\t createClass(ObjectSeq, KeyedSeq);\n\t function ObjectSeq(object) {\n\t var keys = Object.keys(object);\n\t this._object = object;\n\t this._keys = keys;\n\t this.size = keys.length;\n\t }\n\t\n\t ObjectSeq.prototype.get = function(key, notSetValue) {\n\t if (notSetValue !== undefined && !this.has(key)) {\n\t return notSetValue;\n\t }\n\t return this._object[key];\n\t };\n\t\n\t ObjectSeq.prototype.has = function(key) {\n\t return this._object.hasOwnProperty(key);\n\t };\n\t\n\t ObjectSeq.prototype.__iterate = function(fn, reverse) {\n\t var object = this._object;\n\t var keys = this._keys;\n\t var maxIndex = keys.length - 1;\n\t for (var ii = 0; ii <= maxIndex; ii++) {\n\t var key = keys[reverse ? maxIndex - ii : ii];\n\t if (fn(object[key], key, this) === false) {\n\t return ii + 1;\n\t }\n\t }\n\t return ii;\n\t };\n\t\n\t ObjectSeq.prototype.__iterator = function(type, reverse) {\n\t var object = this._object;\n\t var keys = this._keys;\n\t var maxIndex = keys.length - 1;\n\t var ii = 0;\n\t return new Iterator(function() {\n\t var key = keys[reverse ? maxIndex - ii : ii];\n\t return ii++ > maxIndex ?\n\t iteratorDone() :\n\t iteratorValue(type, key, object[key]);\n\t });\n\t };\n\t\n\t ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true;\n\t\n\t\n\t createClass(IterableSeq, IndexedSeq);\n\t function IterableSeq(iterable) {\n\t this._iterable = iterable;\n\t this.size = iterable.length || iterable.size;\n\t }\n\t\n\t IterableSeq.prototype.__iterateUncached = function(fn, reverse) {\n\t if (reverse) {\n\t return this.cacheResult().__iterate(fn, reverse);\n\t }\n\t var iterable = this._iterable;\n\t var iterator = getIterator(iterable);\n\t var iterations = 0;\n\t if (isIterator(iterator)) {\n\t var step;\n\t while (!(step = iterator.next()).done) {\n\t if (fn(step.value, iterations++, this) === false) {\n\t break;\n\t }\n\t }\n\t }\n\t return iterations;\n\t };\n\t\n\t IterableSeq.prototype.__iteratorUncached = function(type, reverse) {\n\t if (reverse) {\n\t return this.cacheResult().__iterator(type, reverse);\n\t }\n\t var iterable = this._iterable;\n\t var iterator = getIterator(iterable);\n\t if (!isIterator(iterator)) {\n\t return new Iterator(iteratorDone);\n\t }\n\t var iterations = 0;\n\t return new Iterator(function() {\n\t var step = iterator.next();\n\t return step.done ? step : iteratorValue(type, iterations++, step.value);\n\t });\n\t };\n\t\n\t\n\t\n\t createClass(IteratorSeq, IndexedSeq);\n\t function IteratorSeq(iterator) {\n\t this._iterator = iterator;\n\t this._iteratorCache = [];\n\t }\n\t\n\t IteratorSeq.prototype.__iterateUncached = function(fn, reverse) {\n\t if (reverse) {\n\t return this.cacheResult().__iterate(fn, reverse);\n\t }\n\t var iterator = this._iterator;\n\t var cache = this._iteratorCache;\n\t var iterations = 0;\n\t while (iterations < cache.length) {\n\t if (fn(cache[iterations], iterations++, this) === false) {\n\t return iterations;\n\t }\n\t }\n\t var step;\n\t while (!(step = iterator.next()).done) {\n\t var val = step.value;\n\t cache[iterations] = val;\n\t if (fn(val, iterations++, this) === false) {\n\t break;\n\t }\n\t }\n\t return iterations;\n\t };\n\t\n\t IteratorSeq.prototype.__iteratorUncached = function(type, reverse) {\n\t if (reverse) {\n\t return this.cacheResult().__iterator(type, reverse);\n\t }\n\t var iterator = this._iterator;\n\t var cache = this._iteratorCache;\n\t var iterations = 0;\n\t return new Iterator(function() {\n\t if (iterations >= cache.length) {\n\t var step = iterator.next();\n\t if (step.done) {\n\t return step;\n\t }\n\t cache[iterations] = step.value;\n\t }\n\t return iteratorValue(type, iterations, cache[iterations++]);\n\t });\n\t };\n\t\n\t\n\t\n\t\n\t // # pragma Helper functions\n\t\n\t function isSeq(maybeSeq) {\n\t return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]);\n\t }\n\t\n\t var EMPTY_SEQ;\n\t\n\t function emptySequence() {\n\t return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));\n\t }\n\t\n\t function keyedSeqFromValue(value) {\n\t var seq =\n\t Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() :\n\t isIterator(value) ? new IteratorSeq(value).fromEntrySeq() :\n\t hasIterator(value) ? new IterableSeq(value).fromEntrySeq() :\n\t typeof value === 'object' ? new ObjectSeq(value) :\n\t undefined;\n\t if (!seq) {\n\t throw new TypeError(\n\t 'Expected Array or iterable object of [k, v] entries, '+\n\t 'or keyed object: ' + value\n\t );\n\t }\n\t return seq;\n\t }\n\t\n\t function indexedSeqFromValue(value) {\n\t var seq = maybeIndexedSeqFromValue(value);\n\t if (!seq) {\n\t throw new TypeError(\n\t 'Expected Array or iterable object of values: ' + value\n\t );\n\t }\n\t return seq;\n\t }\n\t\n\t function seqFromValue(value) {\n\t var seq = maybeIndexedSeqFromValue(value) ||\n\t (typeof value === 'object' && new ObjectSeq(value));\n\t if (!seq) {\n\t throw new TypeError(\n\t 'Expected Array or iterable object of values, or keyed object: ' + value\n\t );\n\t }\n\t return seq;\n\t }\n\t\n\t function maybeIndexedSeqFromValue(value) {\n\t return (\n\t isArrayLike(value) ? new ArraySeq(value) :\n\t isIterator(value) ? new IteratorSeq(value) :\n\t hasIterator(value) ? new IterableSeq(value) :\n\t undefined\n\t );\n\t }\n\t\n\t function seqIterate(seq, fn, reverse, useKeys) {\n\t var cache = seq._cache;\n\t if (cache) {\n\t var maxIndex = cache.length - 1;\n\t for (var ii = 0; ii <= maxIndex; ii++) {\n\t var entry = cache[reverse ? maxIndex - ii : ii];\n\t if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) {\n\t return ii + 1;\n\t }\n\t }\n\t return ii;\n\t }\n\t return seq.__iterateUncached(fn, reverse);\n\t }\n\t\n\t function seqIterator(seq, type, reverse, useKeys) {\n\t var cache = seq._cache;\n\t if (cache) {\n\t var maxIndex = cache.length - 1;\n\t var ii = 0;\n\t return new Iterator(function() {\n\t var entry = cache[reverse ? maxIndex - ii : ii];\n\t return ii++ > maxIndex ?\n\t iteratorDone() :\n\t iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]);\n\t });\n\t }\n\t return seq.__iteratorUncached(type, reverse);\n\t }\n\t\n\t function fromJS(json, converter) {\n\t return converter ?\n\t fromJSWith(converter, json, '', {'': json}) :\n\t fromJSDefault(json);\n\t }\n\t\n\t function fromJSWith(converter, json, key, parentJSON) {\n\t if (Array.isArray(json)) {\n\t return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)}));\n\t }\n\t if (isPlainObj(json)) {\n\t return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)}));\n\t }\n\t return json;\n\t }\n\t\n\t function fromJSDefault(json) {\n\t if (Array.isArray(json)) {\n\t return IndexedSeq(json).map(fromJSDefault).toList();\n\t }\n\t if (isPlainObj(json)) {\n\t return KeyedSeq(json).map(fromJSDefault).toMap();\n\t }\n\t return json;\n\t }\n\t\n\t function isPlainObj(value) {\n\t return value && (value.constructor === Object || value.constructor === undefined);\n\t }\n\t\n\t /**\n\t * An extension of the \"same-value\" algorithm as [described for use by ES6 Map\n\t * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)\n\t *\n\t * NaN is considered the same as NaN, however -0 and 0 are considered the same\n\t * value, which is different from the algorithm described by\n\t * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n\t *\n\t * This is extended further to allow Objects to describe the values they\n\t * represent, by way of `valueOf` or `equals` (and `hashCode`).\n\t *\n\t * Note: because of this extension, the key equality of Immutable.Map and the\n\t * value equality of Immutable.Set will differ from ES6 Map and Set.\n\t *\n\t * ### Defining custom values\n\t *\n\t * The easiest way to describe the value an object represents is by implementing\n\t * `valueOf`. For example, `Date` represents a value by returning a unix\n\t * timestamp for `valueOf`:\n\t *\n\t * var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...\n\t * var date2 = new Date(1234567890000);\n\t * date1.valueOf(); // 1234567890000\n\t * assert( date1 !== date2 );\n\t * assert( Immutable.is( date1, date2 ) );\n\t *\n\t * Note: overriding `valueOf` may have other implications if you use this object\n\t * where JavaScript expects a primitive, such as implicit string coercion.\n\t *\n\t * For more complex types, especially collections, implementing `valueOf` may\n\t * not be performant. An alternative is to implement `equals` and `hashCode`.\n\t *\n\t * `equals` takes another object, presumably of similar type, and returns true\n\t * if the it is equal. Equality is symmetrical, so the same result should be\n\t * returned if this and the argument are flipped.\n\t *\n\t * assert( a.equals(b) === b.equals(a) );\n\t *\n\t * `hashCode` returns a 32bit integer number representing the object which will\n\t * be used to determine how to store the value object in a Map or Set. You must\n\t * provide both or neither methods, one must not exist without the other.\n\t *\n\t * Also, an important relationship between these methods must be upheld: if two\n\t * values are equal, they *must* return the same hashCode. If the values are not\n\t * equal, they might have the same hashCode; this is called a hash collision,\n\t * and while undesirable for performance reasons, it is acceptable.\n\t *\n\t * if (a.equals(b)) {\n\t * assert( a.hashCode() === b.hashCode() );\n\t * }\n\t *\n\t * All Immutable collections implement `equals` and `hashCode`.\n\t *\n\t */\n\t function is(valueA, valueB) {\n\t if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n\t return true;\n\t }\n\t if (!valueA || !valueB) {\n\t return false;\n\t }\n\t if (typeof valueA.valueOf === 'function' &&\n\t typeof valueB.valueOf === 'function') {\n\t valueA = valueA.valueOf();\n\t valueB = valueB.valueOf();\n\t if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n\t return true;\n\t }\n\t if (!valueA || !valueB) {\n\t return false;\n\t }\n\t }\n\t if (typeof valueA.equals === 'function' &&\n\t typeof valueB.equals === 'function' &&\n\t valueA.equals(valueB)) {\n\t return true;\n\t }\n\t return false;\n\t }\n\t\n\t function deepEqual(a, b) {\n\t if (a === b) {\n\t return true;\n\t }\n\t\n\t if (\n\t !isIterable(b) ||\n\t a.size !== undefined && b.size !== undefined && a.size !== b.size ||\n\t a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash ||\n\t isKeyed(a) !== isKeyed(b) ||\n\t isIndexed(a) !== isIndexed(b) ||\n\t isOrdered(a) !== isOrdered(b)\n\t ) {\n\t return false;\n\t }\n\t\n\t if (a.size === 0 && b.size === 0) {\n\t return true;\n\t }\n\t\n\t var notAssociative = !isAssociative(a);\n\t\n\t if (isOrdered(a)) {\n\t var entries = a.entries();\n\t return b.every(function(v, k) {\n\t var entry = entries.next().value;\n\t return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));\n\t }) && entries.next().done;\n\t }\n\t\n\t var flipped = false;\n\t\n\t if (a.size === undefined) {\n\t if (b.size === undefined) {\n\t if (typeof a.cacheResult === 'function') {\n\t a.cacheResult();\n\t }\n\t } else {\n\t flipped = true;\n\t var _ = a;\n\t a = b;\n\t b = _;\n\t }\n\t }\n\t\n\t var allEqual = true;\n\t var bSize = b.__iterate(function(v, k) {\n\t if (notAssociative ? !a.has(v) :\n\t flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) {\n\t allEqual = false;\n\t return false;\n\t }\n\t });\n\t\n\t return allEqual && a.size === bSize;\n\t }\n\t\n\t createClass(Repeat, IndexedSeq);\n\t\n\t function Repeat(value, times) {\n\t if (!(this instanceof Repeat)) {\n\t return new Repeat(value, times);\n\t }\n\t this._value = value;\n\t this.size = times === undefined ? Infinity : Math.max(0, times);\n\t if (this.size === 0) {\n\t if (EMPTY_REPEAT) {\n\t return EMPTY_REPEAT;\n\t }\n\t EMPTY_REPEAT = this;\n\t }\n\t }\n\t\n\t Repeat.prototype.toString = function() {\n\t if (this.size === 0) {\n\t return 'Repeat []';\n\t }\n\t return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';\n\t };\n\t\n\t Repeat.prototype.get = function(index, notSetValue) {\n\t return this.has(index) ? this._value : notSetValue;\n\t };\n\t\n\t Repeat.prototype.includes = function(searchValue) {\n\t return is(this._value, searchValue);\n\t };\n\t\n\t Repeat.prototype.slice = function(begin, end) {\n\t var size = this.size;\n\t return wholeSlice(begin, end, size) ? this :\n\t new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size));\n\t };\n\t\n\t Repeat.prototype.reverse = function() {\n\t return this;\n\t };\n\t\n\t Repeat.prototype.indexOf = function(searchValue) {\n\t if (is(this._value, searchValue)) {\n\t return 0;\n\t }\n\t return -1;\n\t };\n\t\n\t Repeat.prototype.lastIndexOf = function(searchValue) {\n\t if (is(this._value, searchValue)) {\n\t return this.size;\n\t }\n\t return -1;\n\t };\n\t\n\t Repeat.prototype.__iterate = function(fn, reverse) {\n\t for (var ii = 0; ii < this.size; ii++) {\n\t if (fn(this._value, ii, this) === false) {\n\t return ii + 1;\n\t }\n\t }\n\t return ii;\n\t };\n\t\n\t Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this;\n\t var ii = 0;\n\t return new Iterator(function() \n\t {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()}\n\t );\n\t };\n\t\n\t Repeat.prototype.equals = function(other) {\n\t return other instanceof Repeat ?\n\t is(this._value, other._value) :\n\t deepEqual(other);\n\t };\n\t\n\t\n\t var EMPTY_REPEAT;\n\t\n\t function invariant(condition, error) {\n\t if (!condition) throw new Error(error);\n\t }\n\t\n\t createClass(Range, IndexedSeq);\n\t\n\t function Range(start, end, step) {\n\t if (!(this instanceof Range)) {\n\t return new Range(start, end, step);\n\t }\n\t invariant(step !== 0, 'Cannot step a Range by 0');\n\t start = start || 0;\n\t if (end === undefined) {\n\t end = Infinity;\n\t }\n\t step = step === undefined ? 1 : Math.abs(step);\n\t if (end < start) {\n\t step = -step;\n\t }\n\t this._start = start;\n\t this._end = end;\n\t this._step = step;\n\t this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);\n\t if (this.size === 0) {\n\t if (EMPTY_RANGE) {\n\t return EMPTY_RANGE;\n\t }\n\t EMPTY_RANGE = this;\n\t }\n\t }\n\t\n\t Range.prototype.toString = function() {\n\t if (this.size === 0) {\n\t return 'Range []';\n\t }\n\t return 'Range [ ' +\n\t this._start + '...' + this._end +\n\t (this._step !== 1 ? ' by ' + this._step : '') +\n\t ' ]';\n\t };\n\t\n\t Range.prototype.get = function(index, notSetValue) {\n\t return this.has(index) ?\n\t this._start + wrapIndex(this, index) * this._step :\n\t notSetValue;\n\t };\n\t\n\t Range.prototype.includes = function(searchValue) {\n\t var possibleIndex = (searchValue - this._start) / this._step;\n\t return possibleIndex >= 0 &&\n\t possibleIndex < this.size &&\n\t possibleIndex === Math.floor(possibleIndex);\n\t };\n\t\n\t Range.prototype.slice = function(begin, end) {\n\t if (wholeSlice(begin, end, this.size)) {\n\t return this;\n\t }\n\t begin = resolveBegin(begin, this.size);\n\t end = resolveEnd(end, this.size);\n\t if (end <= begin) {\n\t return new Range(0, 0);\n\t }\n\t return new Range(this.get(begin, this._end), this.get(end, this._end), this._step);\n\t };\n\t\n\t Range.prototype.indexOf = function(searchValue) {\n\t var offsetValue = searchValue - this._start;\n\t if (offsetValue % this._step === 0) {\n\t var index = offsetValue / this._step;\n\t if (index >= 0 && index < this.size) {\n\t return index\n\t }\n\t }\n\t return -1;\n\t };\n\t\n\t Range.prototype.lastIndexOf = function(searchValue) {\n\t return this.indexOf(searchValue);\n\t };\n\t\n\t Range.prototype.__iterate = function(fn, reverse) {\n\t var maxIndex = this.size - 1;\n\t var step = this._step;\n\t var value = reverse ? this._start + maxIndex * step : this._start;\n\t for (var ii = 0; ii <= maxIndex; ii++) {\n\t if (fn(value, ii, this) === false) {\n\t return ii + 1;\n\t }\n\t value += reverse ? -step : step;\n\t }\n\t return ii;\n\t };\n\t\n\t Range.prototype.__iterator = function(type, reverse) {\n\t var maxIndex = this.size - 1;\n\t var step = this._step;\n\t var value = reverse ? this._start + maxIndex * step : this._start;\n\t var ii = 0;\n\t return new Iterator(function() {\n\t var v = value;\n\t value += reverse ? -step : step;\n\t return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v);\n\t });\n\t };\n\t\n\t Range.prototype.equals = function(other) {\n\t return other instanceof Range ?\n\t this._start === other._start &&\n\t this._end === other._end &&\n\t this._step === other._step :\n\t deepEqual(this, other);\n\t };\n\t\n\t\n\t var EMPTY_RANGE;\n\t\n\t createClass(Collection, Iterable);\n\t function Collection() {\n\t throw TypeError('Abstract');\n\t }\n\t\n\t\n\t createClass(KeyedCollection, Collection);function KeyedCollection() {}\n\t\n\t createClass(IndexedCollection, Collection);function IndexedCollection() {}\n\t\n\t createClass(SetCollection, Collection);function SetCollection() {}\n\t\n\t\n\t Collection.Keyed = KeyedCollection;\n\t Collection.Indexed = IndexedCollection;\n\t Collection.Set = SetCollection;\n\t\n\t var imul =\n\t typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ?\n\t Math.imul :\n\t function imul(a, b) {\n\t a = a | 0; // int\n\t b = b | 0; // int\n\t var c = a & 0xffff;\n\t var d = b & 0xffff;\n\t // Shift by 0 fixes the sign on the high part.\n\t return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int\n\t };\n\t\n\t // v8 has an optimization for storing 31-bit signed numbers.\n\t // Values which have either 00 or 11 as the high order bits qualify.\n\t // This function drops the highest order bit in a signed number, maintaining\n\t // the sign bit.\n\t function smi(i32) {\n\t return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF);\n\t }\n\t\n\t function hash(o) {\n\t if (o === false || o === null || o === undefined) {\n\t return 0;\n\t }\n\t if (typeof o.valueOf === 'function') {\n\t o = o.valueOf();\n\t if (o === false || o === null || o === undefined) {\n\t return 0;\n\t }\n\t }\n\t if (o === true) {\n\t return 1;\n\t }\n\t var type = typeof o;\n\t if (type === 'number') {\n\t if (o !== o || o === Infinity) {\n\t return 0;\n\t }\n\t var h = o | 0;\n\t if (h !== o) {\n\t h ^= o * 0xFFFFFFFF;\n\t }\n\t while (o > 0xFFFFFFFF) {\n\t o /= 0xFFFFFFFF;\n\t h ^= o;\n\t }\n\t return smi(h);\n\t }\n\t if (type === 'string') {\n\t return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o);\n\t }\n\t if (typeof o.hashCode === 'function') {\n\t return o.hashCode();\n\t }\n\t if (type === 'object') {\n\t return hashJSObj(o);\n\t }\n\t if (typeof o.toString === 'function') {\n\t return hashString(o.toString());\n\t }\n\t throw new Error('Value type ' + type + ' cannot be hashed.');\n\t }\n\t\n\t function cachedHashString(string) {\n\t var hash = stringHashCache[string];\n\t if (hash === undefined) {\n\t hash = hashString(string);\n\t if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {\n\t STRING_HASH_CACHE_SIZE = 0;\n\t stringHashCache = {};\n\t }\n\t STRING_HASH_CACHE_SIZE++;\n\t stringHashCache[string] = hash;\n\t }\n\t return hash;\n\t }\n\t\n\t // http://jsperf.com/hashing-strings\n\t function hashString(string) {\n\t // This is the hash from JVM\n\t // The hash code for a string is computed as\n\t // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],\n\t // where s[i] is the ith character of the string and n is the length of\n\t // the string. We \"mod\" the result to make it between 0 (inclusive) and 2^31\n\t // (exclusive) by dropping high bits.\n\t var hash = 0;\n\t for (var ii = 0; ii < string.length; ii++) {\n\t hash = 31 * hash + string.charCodeAt(ii) | 0;\n\t }\n\t return smi(hash);\n\t }\n\t\n\t function hashJSObj(obj) {\n\t var hash;\n\t if (usingWeakMap) {\n\t hash = weakMap.get(obj);\n\t if (hash !== undefined) {\n\t return hash;\n\t }\n\t }\n\t\n\t hash = obj[UID_HASH_KEY];\n\t if (hash !== undefined) {\n\t return hash;\n\t }\n\t\n\t if (!canDefineProperty) {\n\t hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];\n\t if (hash !== undefined) {\n\t return hash;\n\t }\n\t\n\t hash = getIENodeHash(obj);\n\t if (hash !== undefined) {\n\t return hash;\n\t }\n\t }\n\t\n\t hash = ++objHashUID;\n\t if (objHashUID & 0x40000000) {\n\t objHashUID = 0;\n\t }\n\t\n\t if (usingWeakMap) {\n\t weakMap.set(obj, hash);\n\t } else if (isExtensible !== undefined && isExtensible(obj) === false) {\n\t throw new Error('Non-extensible objects are not allowed as keys.');\n\t } else if (canDefineProperty) {\n\t Object.defineProperty(obj, UID_HASH_KEY, {\n\t 'enumerable': false,\n\t 'configurable': false,\n\t 'writable': false,\n\t 'value': hash\n\t });\n\t } else if (obj.propertyIsEnumerable !== undefined &&\n\t obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) {\n\t // Since we can't define a non-enumerable property on the object\n\t // we'll hijack one of the less-used non-enumerable properties to\n\t // save our hash on it. Since this is a function it will not show up in\n\t // `JSON.stringify` which is what we want.\n\t obj.propertyIsEnumerable = function() {\n\t return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments);\n\t };\n\t obj.propertyIsEnumerable[UID_HASH_KEY] = hash;\n\t } else if (obj.nodeType !== undefined) {\n\t // At this point we couldn't get the IE `uniqueID` to use as a hash\n\t // and we couldn't use a non-enumerable property to exploit the\n\t // dontEnum bug so we simply add the `UID_HASH_KEY` on the node\n\t // itself.\n\t obj[UID_HASH_KEY] = hash;\n\t } else {\n\t throw new Error('Unable to set a non-enumerable property on object.');\n\t }\n\t\n\t return hash;\n\t }\n\t\n\t // Get references to ES5 object methods.\n\t var isExtensible = Object.isExtensible;\n\t\n\t // True if Object.defineProperty works as expected. IE8 fails this test.\n\t var canDefineProperty = (function() {\n\t try {\n\t Object.defineProperty({}, '@', {});\n\t return true;\n\t } catch (e) {\n\t return false;\n\t }\n\t }());\n\t\n\t // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it\n\t // and avoid memory leaks from the IE cloneNode bug.\n\t function getIENodeHash(node) {\n\t if (node && node.nodeType > 0) {\n\t switch (node.nodeType) {\n\t case 1: // Element\n\t return node.uniqueID;\n\t case 9: // Document\n\t return node.documentElement && node.documentElement.uniqueID;\n\t }\n\t }\n\t }\n\t\n\t // If possible, use a WeakMap.\n\t var usingWeakMap = typeof WeakMap === 'function';\n\t var weakMap;\n\t if (usingWeakMap) {\n\t weakMap = new WeakMap();\n\t }\n\t\n\t var objHashUID = 0;\n\t\n\t var UID_HASH_KEY = '__immutablehash__';\n\t if (typeof Symbol === 'function') {\n\t UID_HASH_KEY = Symbol(UID_HASH_KEY);\n\t }\n\t\n\t var STRING_HASH_CACHE_MIN_STRLEN = 16;\n\t var STRING_HASH_CACHE_MAX_SIZE = 255;\n\t var STRING_HASH_CACHE_SIZE = 0;\n\t var stringHashCache = {};\n\t\n\t function assertNotInfinite(size) {\n\t invariant(\n\t size !== Infinity,\n\t 'Cannot perform this action with an infinite size.'\n\t );\n\t }\n\t\n\t createClass(Map, KeyedCollection);\n\t\n\t // @pragma Construction\n\t\n\t function Map(value) {\n\t return value === null || value === undefined ? emptyMap() :\n\t isMap(value) && !isOrdered(value) ? value :\n\t emptyMap().withMutations(function(map ) {\n\t var iter = KeyedIterable(value);\n\t assertNotInfinite(iter.size);\n\t iter.forEach(function(v, k) {return map.set(k, v)});\n\t });\n\t }\n\t\n\t Map.of = function() {var keyValues = SLICE$0.call(arguments, 0);\n\t return emptyMap().withMutations(function(map ) {\n\t for (var i = 0; i < keyValues.length; i += 2) {\n\t if (i + 1 >= keyValues.length) {\n\t throw new Error('Missing value for key: ' + keyValues[i]);\n\t }\n\t map.set(keyValues[i], keyValues[i + 1]);\n\t }\n\t });\n\t };\n\t\n\t Map.prototype.toString = function() {\n\t return this.__toString('Map {', '}');\n\t };\n\t\n\t // @pragma Access\n\t\n\t Map.prototype.get = function(k, notSetValue) {\n\t return this._root ?\n\t this._root.get(0, undefined, k, notSetValue) :\n\t notSetValue;\n\t };\n\t\n\t // @pragma Modification\n\t\n\t Map.prototype.set = function(k, v) {\n\t return updateMap(this, k, v);\n\t };\n\t\n\t Map.prototype.setIn = function(keyPath, v) {\n\t return this.updateIn(keyPath, NOT_SET, function() {return v});\n\t };\n\t\n\t Map.prototype.remove = function(k) {\n\t return updateMap(this, k, NOT_SET);\n\t };\n\t\n\t Map.prototype.deleteIn = function(keyPath) {\n\t return this.updateIn(keyPath, function() {return NOT_SET});\n\t };\n\t\n\t Map.prototype.update = function(k, notSetValue, updater) {\n\t return arguments.length === 1 ?\n\t k(this) :\n\t this.updateIn([k], notSetValue, updater);\n\t };\n\t\n\t Map.prototype.updateIn = function(keyPath, notSetValue, updater) {\n\t if (!updater) {\n\t updater = notSetValue;\n\t notSetValue = undefined;\n\t }\n\t var updatedValue = updateInDeepMap(\n\t this,\n\t forceIterator(keyPath),\n\t notSetValue,\n\t updater\n\t );\n\t return updatedValue === NOT_SET ? undefined : updatedValue;\n\t };\n\t\n\t Map.prototype.clear = function() {\n\t if (this.size === 0) {\n\t return this;\n\t }\n\t if (this.__ownerID) {\n\t this.size = 0;\n\t this._root = null;\n\t this.__hash = undefined;\n\t this.__altered = true;\n\t return this;\n\t }\n\t return emptyMap();\n\t };\n\t\n\t // @pragma Composition\n\t\n\t Map.prototype.merge = function(/*...iters*/) {\n\t return mergeIntoMapWith(this, undefined, arguments);\n\t };\n\t\n\t Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n\t return mergeIntoMapWith(this, merger, iters);\n\t };\n\t\n\t Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n\t return this.updateIn(\n\t keyPath,\n\t emptyMap(),\n\t function(m ) {return typeof m.merge === 'function' ?\n\t m.merge.apply(m, iters) :\n\t iters[iters.length - 1]}\n\t );\n\t };\n\t\n\t Map.prototype.mergeDeep = function(/*...iters*/) {\n\t return mergeIntoMapWith(this, deepMerger, arguments);\n\t };\n\t\n\t Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n\t return mergeIntoMapWith(this, deepMergerWith(merger), iters);\n\t };\n\t\n\t Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n\t return this.updateIn(\n\t keyPath,\n\t emptyMap(),\n\t function(m ) {return typeof m.mergeDeep === 'function' ?\n\t m.mergeDeep.apply(m, iters) :\n\t iters[iters.length - 1]}\n\t );\n\t };\n\t\n\t Map.prototype.sort = function(comparator) {\n\t // Late binding\n\t return OrderedMap(sortFactory(this, comparator));\n\t };\n\t\n\t Map.prototype.sortBy = function(mapper, comparator) {\n\t // Late binding\n\t return OrderedMap(sortFactory(this, comparator, mapper));\n\t };\n\t\n\t // @pragma Mutability\n\t\n\t Map.prototype.withMutations = function(fn) {\n\t var mutable = this.asMutable();\n\t fn(mutable);\n\t return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;\n\t };\n\t\n\t Map.prototype.asMutable = function() {\n\t return this.__ownerID ? this : this.__ensureOwner(new OwnerID());\n\t };\n\t\n\t Map.prototype.asImmutable = function() {\n\t return this.__ensureOwner();\n\t };\n\t\n\t Map.prototype.wasAltered = function() {\n\t return this.__altered;\n\t };\n\t\n\t Map.prototype.__iterator = function(type, reverse) {\n\t return new MapIterator(this, type, reverse);\n\t };\n\t\n\t Map.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n\t var iterations = 0;\n\t this._root && this._root.iterate(function(entry ) {\n\t iterations++;\n\t return fn(entry[1], entry[0], this$0);\n\t }, reverse);\n\t return iterations;\n\t };\n\t\n\t Map.prototype.__ensureOwner = function(ownerID) {\n\t if (ownerID === this.__ownerID) {\n\t return this;\n\t }\n\t if (!ownerID) {\n\t this.__ownerID = ownerID;\n\t this.__altered = false;\n\t return this;\n\t }\n\t return makeMap(this.size, this._root, ownerID, this.__hash);\n\t };\n\t\n\t\n\t function isMap(maybeMap) {\n\t return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]);\n\t }\n\t\n\t Map.isMap = isMap;\n\t\n\t var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';\n\t\n\t var MapPrototype = Map.prototype;\n\t MapPrototype[IS_MAP_SENTINEL] = true;\n\t MapPrototype[DELETE] = MapPrototype.remove;\n\t MapPrototype.removeIn = MapPrototype.deleteIn;\n\t\n\t\n\t // #pragma Trie Nodes\n\t\n\t\n\t\n\t function ArrayMapNode(ownerID, entries) {\n\t this.ownerID = ownerID;\n\t this.entries = entries;\n\t }\n\t\n\t ArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n\t var entries = this.entries;\n\t for (var ii = 0, len = entries.length; ii < len; ii++) {\n\t if (is(key, entries[ii][0])) {\n\t return entries[ii][1];\n\t }\n\t }\n\t return notSetValue;\n\t };\n\t\n\t ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n\t var removed = value === NOT_SET;\n\t\n\t var entries = this.entries;\n\t var idx = 0;\n\t for (var len = entries.length; idx < len; idx++) {\n\t if (is(key, entries[idx][0])) {\n\t break;\n\t }\n\t }\n\t var exists = idx < len;\n\t\n\t if (exists ? entries[idx][1] === value : removed) {\n\t return this;\n\t }\n\t\n\t SetRef(didAlter);\n\t (removed || !exists) && SetRef(didChangeSize);\n\t\n\t if (removed && entries.length === 1) {\n\t return; // undefined\n\t }\n\t\n\t if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {\n\t return createNodes(ownerID, entries, key, value);\n\t }\n\t\n\t var isEditable = ownerID && ownerID === this.ownerID;\n\t var newEntries = isEditable ? entries : arrCopy(entries);\n\t\n\t if (exists) {\n\t if (removed) {\n\t idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n\t } else {\n\t newEntries[idx] = [key, value];\n\t }\n\t } else {\n\t newEntries.push([key, value]);\n\t }\n\t\n\t if (isEditable) {\n\t this.entries = newEntries;\n\t return this;\n\t }\n\t\n\t return new ArrayMapNode(ownerID, newEntries);\n\t };\n\t\n\t\n\t\n\t\n\t function BitmapIndexedNode(ownerID, bitmap, nodes) {\n\t this.ownerID = ownerID;\n\t this.bitmap = bitmap;\n\t this.nodes = nodes;\n\t }\n\t\n\t BitmapIndexedNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n\t if (keyHash === undefined) {\n\t keyHash = hash(key);\n\t }\n\t var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK));\n\t var bitmap = this.bitmap;\n\t return (bitmap & bit) === 0 ? notSetValue :\n\t this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue);\n\t };\n\t\n\t BitmapIndexedNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n\t if (keyHash === undefined) {\n\t keyHash = hash(key);\n\t }\n\t var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n\t var bit = 1 << keyHashFrag;\n\t var bitmap = this.bitmap;\n\t var exists = (bitmap & bit) !== 0;\n\t\n\t if (!exists && value === NOT_SET) {\n\t return this;\n\t }\n\t\n\t var idx = popCount(bitmap & (bit - 1));\n\t var nodes = this.nodes;\n\t var node = exists ? nodes[idx] : undefined;\n\t var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n\t\n\t if (newNode === node) {\n\t return this;\n\t }\n\t\n\t if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {\n\t return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);\n\t }\n\t\n\t if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {\n\t return nodes[idx ^ 1];\n\t }\n\t\n\t if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {\n\t return newNode;\n\t }\n\t\n\t var isEditable = ownerID && ownerID === this.ownerID;\n\t var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;\n\t var newNodes = exists ? newNode ?\n\t setIn(nodes, idx, newNode, isEditable) :\n\t spliceOut(nodes, idx, isEditable) :\n\t spliceIn(nodes, idx, newNode, isEditable);\n\t\n\t if (isEditable) {\n\t this.bitmap = newBitmap;\n\t this.nodes = newNodes;\n\t return this;\n\t }\n\t\n\t return new BitmapIndexedNode(ownerID, newBitmap, newNodes);\n\t };\n\t\n\t\n\t\n\t\n\t function HashArrayMapNode(ownerID, count, nodes) {\n\t this.ownerID = ownerID;\n\t this.count = count;\n\t this.nodes = nodes;\n\t }\n\t\n\t HashArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n\t if (keyHash === undefined) {\n\t keyHash = hash(key);\n\t }\n\t var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n\t var node = this.nodes[idx];\n\t return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue;\n\t };\n\t\n\t HashArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n\t if (keyHash === undefined) {\n\t keyHash = hash(key);\n\t }\n\t var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n\t var removed = value === NOT_SET;\n\t var nodes = this.nodes;\n\t var node = nodes[idx];\n\t\n\t if (removed && !node) {\n\t return this;\n\t }\n\t\n\t var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n\t if (newNode === node) {\n\t return this;\n\t }\n\t\n\t var newCount = this.count;\n\t if (!node) {\n\t newCount++;\n\t } else if (!newNode) {\n\t newCount--;\n\t if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {\n\t return packNodes(ownerID, nodes, newCount, idx);\n\t }\n\t }\n\t\n\t var isEditable = ownerID && ownerID === this.ownerID;\n\t var newNodes = setIn(nodes, idx, newNode, isEditable);\n\t\n\t if (isEditable) {\n\t this.count = newCount;\n\t this.nodes = newNodes;\n\t return this;\n\t }\n\t\n\t return new HashArrayMapNode(ownerID, newCount, newNodes);\n\t };\n\t\n\t\n\t\n\t\n\t function HashCollisionNode(ownerID, keyHash, entries) {\n\t this.ownerID = ownerID;\n\t this.keyHash = keyHash;\n\t this.entries = entries;\n\t }\n\t\n\t HashCollisionNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n\t var entries = this.entries;\n\t for (var ii = 0, len = entries.length; ii < len; ii++) {\n\t if (is(key, entries[ii][0])) {\n\t return entries[ii][1];\n\t }\n\t }\n\t return notSetValue;\n\t };\n\t\n\t HashCollisionNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n\t if (keyHash === undefined) {\n\t keyHash = hash(key);\n\t }\n\t\n\t var removed = value === NOT_SET;\n\t\n\t if (keyHash !== this.keyHash) {\n\t if (removed) {\n\t return this;\n\t }\n\t SetRef(didAlter);\n\t SetRef(didChangeSize);\n\t return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);\n\t }\n\t\n\t var entries = this.entries;\n\t var idx = 0;\n\t for (var len = entries.length; idx < len; idx++) {\n\t if (is(key, entries[idx][0])) {\n\t break;\n\t }\n\t }\n\t var exists = idx < len;\n\t\n\t if (exists ? entries[idx][1] === value : removed) {\n\t return this;\n\t }\n\t\n\t SetRef(didAlter);\n\t (removed || !exists) && SetRef(didChangeSize);\n\t\n\t if (removed && len === 2) {\n\t return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);\n\t }\n\t\n\t var isEditable = ownerID && ownerID === this.ownerID;\n\t var newEntries = isEditable ? entries : arrCopy(entries);\n\t\n\t if (exists) {\n\t if (removed) {\n\t idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n\t } else {\n\t newEntries[idx] = [key, value];\n\t }\n\t } else {\n\t newEntries.push([key, value]);\n\t }\n\t\n\t if (isEditable) {\n\t this.entries = newEntries;\n\t return this;\n\t }\n\t\n\t return new HashCollisionNode(ownerID, this.keyHash, newEntries);\n\t };\n\t\n\t\n\t\n\t\n\t function ValueNode(ownerID, keyHash, entry) {\n\t this.ownerID = ownerID;\n\t this.keyHash = keyHash;\n\t this.entry = entry;\n\t }\n\t\n\t ValueNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n\t return is(key, this.entry[0]) ? this.entry[1] : notSetValue;\n\t };\n\t\n\t ValueNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n\t var removed = value === NOT_SET;\n\t var keyMatch = is(key, this.entry[0]);\n\t if (keyMatch ? value === this.entry[1] : removed) {\n\t return this;\n\t }\n\t\n\t SetRef(didAlter);\n\t\n\t if (removed) {\n\t SetRef(didChangeSize);\n\t return; // undefined\n\t }\n\t\n\t if (keyMatch) {\n\t if (ownerID && ownerID === this.ownerID) {\n\t this.entry[1] = value;\n\t return this;\n\t }\n\t return new ValueNode(ownerID, this.keyHash, [key, value]);\n\t }\n\t\n\t SetRef(didChangeSize);\n\t return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);\n\t };\n\t\n\t\n\t\n\t // #pragma Iterators\n\t\n\t ArrayMapNode.prototype.iterate =\n\t HashCollisionNode.prototype.iterate = function (fn, reverse) {\n\t var entries = this.entries;\n\t for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {\n\t if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {\n\t return false;\n\t }\n\t }\n\t }\n\t\n\t BitmapIndexedNode.prototype.iterate =\n\t HashArrayMapNode.prototype.iterate = function (fn, reverse) {\n\t var nodes = this.nodes;\n\t for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {\n\t var node = nodes[reverse ? maxIndex - ii : ii];\n\t if (node && node.iterate(fn, reverse) === false) {\n\t return false;\n\t }\n\t }\n\t }\n\t\n\t ValueNode.prototype.iterate = function (fn, reverse) {\n\t return fn(this.entry);\n\t }\n\t\n\t createClass(MapIterator, Iterator);\n\t\n\t function MapIterator(map, type, reverse) {\n\t this._type = type;\n\t this._reverse = reverse;\n\t this._stack = map._root && mapIteratorFrame(map._root);\n\t }\n\t\n\t MapIterator.prototype.next = function() {\n\t var type = this._type;\n\t var stack = this._stack;\n\t while (stack) {\n\t var node = stack.node;\n\t var index = stack.index++;\n\t var maxIndex;\n\t if (node.entry) {\n\t if (index === 0) {\n\t return mapIteratorValue(type, node.entry);\n\t }\n\t } else if (node.entries) {\n\t maxIndex = node.entries.length - 1;\n\t if (index <= maxIndex) {\n\t return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]);\n\t }\n\t } else {\n\t maxIndex = node.nodes.length - 1;\n\t if (index <= maxIndex) {\n\t var subNode = node.nodes[this._reverse ? maxIndex - index : index];\n\t if (subNode) {\n\t if (subNode.entry) {\n\t return mapIteratorValue(type, subNode.entry);\n\t }\n\t stack = this._stack = mapIteratorFrame(subNode, stack);\n\t }\n\t continue;\n\t }\n\t }\n\t stack = this._stack = this._stack.__prev;\n\t }\n\t return iteratorDone();\n\t };\n\t\n\t\n\t function mapIteratorValue(type, entry) {\n\t return iteratorValue(type, entry[0], entry[1]);\n\t }\n\t\n\t function mapIteratorFrame(node, prev) {\n\t return {\n\t node: node,\n\t index: 0,\n\t __prev: prev\n\t };\n\t }\n\t\n\t function makeMap(size, root, ownerID, hash) {\n\t var map = Object.create(MapPrototype);\n\t map.size = size;\n\t map._root = root;\n\t map.__ownerID = ownerID;\n\t map.__hash = hash;\n\t map.__altered = false;\n\t return map;\n\t }\n\t\n\t var EMPTY_MAP;\n\t function emptyMap() {\n\t return EMPTY_MAP || (EMPTY_MAP = makeMap(0));\n\t }\n\t\n\t function updateMap(map, k, v) {\n\t var newRoot;\n\t var newSize;\n\t if (!map._root) {\n\t if (v === NOT_SET) {\n\t return map;\n\t }\n\t newSize = 1;\n\t newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);\n\t } else {\n\t var didChangeSize = MakeRef(CHANGE_LENGTH);\n\t var didAlter = MakeRef(DID_ALTER);\n\t newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter);\n\t if (!didAlter.value) {\n\t return map;\n\t }\n\t newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0);\n\t }\n\t if (map.__ownerID) {\n\t map.size = newSize;\n\t map._root = newRoot;\n\t map.__hash = undefined;\n\t map.__altered = true;\n\t return map;\n\t }\n\t return newRoot ? makeMap(newSize, newRoot) : emptyMap();\n\t }\n\t\n\t function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n\t if (!node) {\n\t if (value === NOT_SET) {\n\t return node;\n\t }\n\t SetRef(didAlter);\n\t SetRef(didChangeSize);\n\t return new ValueNode(ownerID, keyHash, [key, value]);\n\t }\n\t return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter);\n\t }\n\t\n\t function isLeafNode(node) {\n\t return node.constructor === ValueNode || node.constructor === HashCollisionNode;\n\t }\n\t\n\t function mergeIntoNode(node, ownerID, shift, keyHash, entry) {\n\t if (node.keyHash === keyHash) {\n\t return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);\n\t }\n\t\n\t var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;\n\t var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n\t\n\t var newNode;\n\t var nodes = idx1 === idx2 ?\n\t [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] :\n\t ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]);\n\t\n\t return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);\n\t }\n\t\n\t function createNodes(ownerID, entries, key, value) {\n\t if (!ownerID) {\n\t ownerID = new OwnerID();\n\t }\n\t var node = new ValueNode(ownerID, hash(key), [key, value]);\n\t for (var ii = 0; ii < entries.length; ii++) {\n\t var entry = entries[ii];\n\t node = node.update(ownerID, 0, undefined, entry[0], entry[1]);\n\t }\n\t return node;\n\t }\n\t\n\t function packNodes(ownerID, nodes, count, excluding) {\n\t var bitmap = 0;\n\t var packedII = 0;\n\t var packedNodes = new Array(count);\n\t for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {\n\t var node = nodes[ii];\n\t if (node !== undefined && ii !== excluding) {\n\t bitmap |= bit;\n\t packedNodes[packedII++] = node;\n\t }\n\t }\n\t return new BitmapIndexedNode(ownerID, bitmap, packedNodes);\n\t }\n\t\n\t function expandNodes(ownerID, nodes, bitmap, including, node) {\n\t var count = 0;\n\t var expandedNodes = new Array(SIZE);\n\t for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {\n\t expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;\n\t }\n\t expandedNodes[including] = node;\n\t return new HashArrayMapNode(ownerID, count + 1, expandedNodes);\n\t }\n\t\n\t function mergeIntoMapWith(map, merger, iterables) {\n\t var iters = [];\n\t for (var ii = 0; ii < iterables.length; ii++) {\n\t var value = iterables[ii];\n\t var iter = KeyedIterable(value);\n\t if (!isIterable(value)) {\n\t iter = iter.map(function(v ) {return fromJS(v)});\n\t }\n\t iters.push(iter);\n\t }\n\t return mergeIntoCollectionWith(map, merger, iters);\n\t }\n\t\n\t function deepMerger(existing, value, key) {\n\t return existing && existing.mergeDeep && isIterable(value) ?\n\t existing.mergeDeep(value) :\n\t is(existing, value) ? existing : value;\n\t }\n\t\n\t function deepMergerWith(merger) {\n\t return function(existing, value, key) {\n\t if (existing && existing.mergeDeepWith && isIterable(value)) {\n\t return existing.mergeDeepWith(merger, value);\n\t }\n\t var nextValue = merger(existing, value, key);\n\t return is(existing, nextValue) ? existing : nextValue;\n\t };\n\t }\n\t\n\t function mergeIntoCollectionWith(collection, merger, iters) {\n\t iters = iters.filter(function(x ) {return x.size !== 0});\n\t if (iters.length === 0) {\n\t return collection;\n\t }\n\t if (collection.size === 0 && !collection.__ownerID && iters.length === 1) {\n\t return collection.constructor(iters[0]);\n\t }\n\t return collection.withMutations(function(collection ) {\n\t var mergeIntoMap = merger ?\n\t function(value, key) {\n\t collection.update(key, NOT_SET, function(existing )\n\t {return existing === NOT_SET ? value : merger(existing, value, key)}\n\t );\n\t } :\n\t function(value, key) {\n\t collection.set(key, value);\n\t }\n\t for (var ii = 0; ii < iters.length; ii++) {\n\t iters[ii].forEach(mergeIntoMap);\n\t }\n\t });\n\t }\n\t\n\t function updateInDeepMap(existing, keyPathIter, notSetValue, updater) {\n\t var isNotSet = existing === NOT_SET;\n\t var step = keyPathIter.next();\n\t if (step.done) {\n\t var existingValue = isNotSet ? notSetValue : existing;\n\t var newValue = updater(existingValue);\n\t return newValue === existingValue ? existing : newValue;\n\t }\n\t invariant(\n\t isNotSet || (existing && existing.set),\n\t 'invalid keyPath'\n\t );\n\t var key = step.value;\n\t var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET);\n\t var nextUpdated = updateInDeepMap(\n\t nextExisting,\n\t keyPathIter,\n\t notSetValue,\n\t updater\n\t );\n\t return nextUpdated === nextExisting ? existing :\n\t nextUpdated === NOT_SET ? existing.remove(key) :\n\t (isNotSet ? emptyMap() : existing).set(key, nextUpdated);\n\t }\n\t\n\t function popCount(x) {\n\t x = x - ((x >> 1) & 0x55555555);\n\t x = (x & 0x33333333) + ((x >> 2) & 0x33333333);\n\t x = (x + (x >> 4)) & 0x0f0f0f0f;\n\t x = x + (x >> 8);\n\t x = x + (x >> 16);\n\t return x & 0x7f;\n\t }\n\t\n\t function setIn(array, idx, val, canEdit) {\n\t var newArray = canEdit ? array : arrCopy(array);\n\t newArray[idx] = val;\n\t return newArray;\n\t }\n\t\n\t function spliceIn(array, idx, val, canEdit) {\n\t var newLen = array.length + 1;\n\t if (canEdit && idx + 1 === newLen) {\n\t array[idx] = val;\n\t return array;\n\t }\n\t var newArray = new Array(newLen);\n\t var after = 0;\n\t for (var ii = 0; ii < newLen; ii++) {\n\t if (ii === idx) {\n\t newArray[ii] = val;\n\t after = -1;\n\t } else {\n\t newArray[ii] = array[ii + after];\n\t }\n\t }\n\t return newArray;\n\t }\n\t\n\t function spliceOut(array, idx, canEdit) {\n\t var newLen = array.length - 1;\n\t if (canEdit && idx === newLen) {\n\t array.pop();\n\t return array;\n\t }\n\t var newArray = new Array(newLen);\n\t var after = 0;\n\t for (var ii = 0; ii < newLen; ii++) {\n\t if (ii === idx) {\n\t after = 1;\n\t }\n\t newArray[ii] = array[ii + after];\n\t }\n\t return newArray;\n\t }\n\t\n\t var MAX_ARRAY_MAP_SIZE = SIZE / 4;\n\t var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;\n\t var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;\n\t\n\t createClass(List, IndexedCollection);\n\t\n\t // @pragma Construction\n\t\n\t function List(value) {\n\t var empty = emptyList();\n\t if (value === null || value === undefined) {\n\t return empty;\n\t }\n\t if (isList(value)) {\n\t return value;\n\t }\n\t var iter = IndexedIterable(value);\n\t var size = iter.size;\n\t if (size === 0) {\n\t return empty;\n\t }\n\t assertNotInfinite(size);\n\t if (size > 0 && size < SIZE) {\n\t return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));\n\t }\n\t return empty.withMutations(function(list ) {\n\t list.setSize(size);\n\t iter.forEach(function(v, i) {return list.set(i, v)});\n\t });\n\t }\n\t\n\t List.of = function(/*...values*/) {\n\t return this(arguments);\n\t };\n\t\n\t List.prototype.toString = function() {\n\t return this.__toString('List [', ']');\n\t };\n\t\n\t // @pragma Access\n\t\n\t List.prototype.get = function(index, notSetValue) {\n\t index = wrapIndex(this, index);\n\t if (index >= 0 && index < this.size) {\n\t index += this._origin;\n\t var node = listNodeFor(this, index);\n\t return node && node.array[index & MASK];\n\t }\n\t return notSetValue;\n\t };\n\t\n\t // @pragma Modification\n\t\n\t List.prototype.set = function(index, value) {\n\t return updateList(this, index, value);\n\t };\n\t\n\t List.prototype.remove = function(index) {\n\t return !this.has(index) ? this :\n\t index === 0 ? this.shift() :\n\t index === this.size - 1 ? this.pop() :\n\t this.splice(index, 1);\n\t };\n\t\n\t List.prototype.insert = function(index, value) {\n\t return this.splice(index, 0, value);\n\t };\n\t\n\t List.prototype.clear = function() {\n\t if (this.size === 0) {\n\t return this;\n\t }\n\t if (this.__ownerID) {\n\t this.size = this._origin = this._capacity = 0;\n\t this._level = SHIFT;\n\t this._root = this._tail = null;\n\t this.__hash = undefined;\n\t this.__altered = true;\n\t return this;\n\t }\n\t return emptyList();\n\t };\n\t\n\t List.prototype.push = function(/*...values*/) {\n\t var values = arguments;\n\t var oldSize = this.size;\n\t return this.withMutations(function(list ) {\n\t setListBounds(list, 0, oldSize + values.length);\n\t for (var ii = 0; ii < values.length; ii++) {\n\t list.set(oldSize + ii, values[ii]);\n\t }\n\t });\n\t };\n\t\n\t List.prototype.pop = function() {\n\t return setListBounds(this, 0, -1);\n\t };\n\t\n\t List.prototype.unshift = function(/*...values*/) {\n\t var values = arguments;\n\t return this.withMutations(function(list ) {\n\t setListBounds(list, -values.length);\n\t for (var ii = 0; ii < values.length; ii++) {\n\t list.set(ii, values[ii]);\n\t }\n\t });\n\t };\n\t\n\t List.prototype.shift = function() {\n\t return setListBounds(this, 1);\n\t };\n\t\n\t // @pragma Composition\n\t\n\t List.prototype.merge = function(/*...iters*/) {\n\t return mergeIntoListWith(this, undefined, arguments);\n\t };\n\t\n\t List.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n\t return mergeIntoListWith(this, merger, iters);\n\t };\n\t\n\t List.prototype.mergeDeep = function(/*...iters*/) {\n\t return mergeIntoListWith(this, deepMerger, arguments);\n\t };\n\t\n\t List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n\t return mergeIntoListWith(this, deepMergerWith(merger), iters);\n\t };\n\t\n\t List.prototype.setSize = function(size) {\n\t return setListBounds(this, 0, size);\n\t };\n\t\n\t // @pragma Iteration\n\t\n\t List.prototype.slice = function(begin, end) {\n\t var size = this.size;\n\t if (wholeSlice(begin, end, size)) {\n\t return this;\n\t }\n\t return setListBounds(\n\t this,\n\t resolveBegin(begin, size),\n\t resolveEnd(end, size)\n\t );\n\t };\n\t\n\t List.prototype.__iterator = function(type, reverse) {\n\t var index = 0;\n\t var values = iterateList(this, reverse);\n\t return new Iterator(function() {\n\t var value = values();\n\t return value === DONE ?\n\t iteratorDone() :\n\t iteratorValue(type, index++, value);\n\t });\n\t };\n\t\n\t List.prototype.__iterate = function(fn, reverse) {\n\t var index = 0;\n\t var values = iterateList(this, reverse);\n\t var value;\n\t while ((value = values()) !== DONE) {\n\t if (fn(value, index++, this) === false) {\n\t break;\n\t }\n\t }\n\t return index;\n\t };\n\t\n\t List.prototype.__ensureOwner = function(ownerID) {\n\t if (ownerID === this.__ownerID) {\n\t return this;\n\t }\n\t if (!ownerID) {\n\t this.__ownerID = ownerID;\n\t return this;\n\t }\n\t return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash);\n\t };\n\t\n\t\n\t function isList(maybeList) {\n\t return !!(maybeList && maybeList[IS_LIST_SENTINEL]);\n\t }\n\t\n\t List.isList = isList;\n\t\n\t var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';\n\t\n\t var ListPrototype = List.prototype;\n\t ListPrototype[IS_LIST_SENTINEL] = true;\n\t ListPrototype[DELETE] = ListPrototype.remove;\n\t ListPrototype.setIn = MapPrototype.setIn;\n\t ListPrototype.deleteIn =\n\t ListPrototype.removeIn = MapPrototype.removeIn;\n\t ListPrototype.update = MapPrototype.update;\n\t ListPrototype.updateIn = MapPrototype.updateIn;\n\t ListPrototype.mergeIn = MapPrototype.mergeIn;\n\t ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n\t ListPrototype.withMutations = MapPrototype.withMutations;\n\t ListPrototype.asMutable = MapPrototype.asMutable;\n\t ListPrototype.asImmutable = MapPrototype.asImmutable;\n\t ListPrototype.wasAltered = MapPrototype.wasAltered;\n\t\n\t\n\t\n\t function VNode(array, ownerID) {\n\t this.array = array;\n\t this.ownerID = ownerID;\n\t }\n\t\n\t // TODO: seems like these methods are very similar\n\t\n\t VNode.prototype.removeBefore = function(ownerID, level, index) {\n\t if (index === level ? 1 << level : 0 || this.array.length === 0) {\n\t return this;\n\t }\n\t var originIndex = (index >>> level) & MASK;\n\t if (originIndex >= this.array.length) {\n\t return new VNode([], ownerID);\n\t }\n\t var removingFirst = originIndex === 0;\n\t var newChild;\n\t if (level > 0) {\n\t var oldChild = this.array[originIndex];\n\t newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);\n\t if (newChild === oldChild && removingFirst) {\n\t return this;\n\t }\n\t }\n\t if (removingFirst && !newChild) {\n\t return this;\n\t }\n\t var editable = editableVNode(this, ownerID);\n\t if (!removingFirst) {\n\t for (var ii = 0; ii < originIndex; ii++) {\n\t editable.array[ii] = undefined;\n\t }\n\t }\n\t if (newChild) {\n\t editable.array[originIndex] = newChild;\n\t }\n\t return editable;\n\t };\n\t\n\t VNode.prototype.removeAfter = function(ownerID, level, index) {\n\t if (index === (level ? 1 << level : 0) || this.array.length === 0) {\n\t return this;\n\t }\n\t var sizeIndex = ((index - 1) >>> level) & MASK;\n\t if (sizeIndex >= this.array.length) {\n\t return this;\n\t }\n\t\n\t var newChild;\n\t if (level > 0) {\n\t var oldChild = this.array[sizeIndex];\n\t newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);\n\t if (newChild === oldChild && sizeIndex === this.array.length - 1) {\n\t return this;\n\t }\n\t }\n\t\n\t var editable = editableVNode(this, ownerID);\n\t editable.array.splice(sizeIndex + 1);\n\t if (newChild) {\n\t editable.array[sizeIndex] = newChild;\n\t }\n\t return editable;\n\t };\n\t\n\t\n\t\n\t var DONE = {};\n\t\n\t function iterateList(list, reverse) {\n\t var left = list._origin;\n\t var right = list._capacity;\n\t var tailPos = getTailOffset(right);\n\t var tail = list._tail;\n\t\n\t return iterateNodeOrLeaf(list._root, list._level, 0);\n\t\n\t function iterateNodeOrLeaf(node, level, offset) {\n\t return level === 0 ?\n\t iterateLeaf(node, offset) :\n\t iterateNode(node, level, offset);\n\t }\n\t\n\t function iterateLeaf(node, offset) {\n\t var array = offset === tailPos ? tail && tail.array : node && node.array;\n\t var from = offset > left ? 0 : left - offset;\n\t var to = right - offset;\n\t if (to > SIZE) {\n\t to = SIZE;\n\t }\n\t return function() {\n\t if (from === to) {\n\t return DONE;\n\t }\n\t var idx = reverse ? --to : from++;\n\t return array && array[idx];\n\t };\n\t }\n\t\n\t function iterateNode(node, level, offset) {\n\t var values;\n\t var array = node && node.array;\n\t var from = offset > left ? 0 : (left - offset) >> level;\n\t var to = ((right - offset) >> level) + 1;\n\t if (to > SIZE) {\n\t to = SIZE;\n\t }\n\t return function() {\n\t do {\n\t if (values) {\n\t var value = values();\n\t if (value !== DONE) {\n\t return value;\n\t }\n\t values = null;\n\t }\n\t if (from === to) {\n\t return DONE;\n\t }\n\t var idx = reverse ? --to : from++;\n\t values = iterateNodeOrLeaf(\n\t array && array[idx], level - SHIFT, offset + (idx << level)\n\t );\n\t } while (true);\n\t };\n\t }\n\t }\n\t\n\t function makeList(origin, capacity, level, root, tail, ownerID, hash) {\n\t var list = Object.create(ListPrototype);\n\t list.size = capacity - origin;\n\t list._origin = origin;\n\t list._capacity = capacity;\n\t list._level = level;\n\t list._root = root;\n\t list._tail = tail;\n\t list.__ownerID = ownerID;\n\t list.__hash = hash;\n\t list.__altered = false;\n\t return list;\n\t }\n\t\n\t var EMPTY_LIST;\n\t function emptyList() {\n\t return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));\n\t }\n\t\n\t function updateList(list, index, value) {\n\t index = wrapIndex(list, index);\n\t\n\t if (index !== index) {\n\t return list;\n\t }\n\t\n\t if (index >= list.size || index < 0) {\n\t return list.withMutations(function(list ) {\n\t index < 0 ?\n\t setListBounds(list, index).set(0, value) :\n\t setListBounds(list, 0, index + 1).set(index, value)\n\t });\n\t }\n\t\n\t index += list._origin;\n\t\n\t var newTail = list._tail;\n\t var newRoot = list._root;\n\t var didAlter = MakeRef(DID_ALTER);\n\t if (index >= getTailOffset(list._capacity)) {\n\t newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);\n\t } else {\n\t newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter);\n\t }\n\t\n\t if (!didAlter.value) {\n\t return list;\n\t }\n\t\n\t if (list.__ownerID) {\n\t list._root = newRoot;\n\t list._tail = newTail;\n\t list.__hash = undefined;\n\t list.__altered = true;\n\t return list;\n\t }\n\t return makeList(list._origin, list._capacity, list._level, newRoot, newTail);\n\t }\n\t\n\t function updateVNode(node, ownerID, level, index, value, didAlter) {\n\t var idx = (index >>> level) & MASK;\n\t var nodeHas = node && idx < node.array.length;\n\t if (!nodeHas && value === undefined) {\n\t return node;\n\t }\n\t\n\t var newNode;\n\t\n\t if (level > 0) {\n\t var lowerNode = node && node.array[idx];\n\t var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter);\n\t if (newLowerNode === lowerNode) {\n\t return node;\n\t }\n\t newNode = editableVNode(node, ownerID);\n\t newNode.array[idx] = newLowerNode;\n\t return newNode;\n\t }\n\t\n\t if (nodeHas && node.array[idx] === value) {\n\t return node;\n\t }\n\t\n\t SetRef(didAlter);\n\t\n\t newNode = editableVNode(node, ownerID);\n\t if (value === undefined && idx === newNode.array.length - 1) {\n\t newNode.array.pop();\n\t } else {\n\t newNode.array[idx] = value;\n\t }\n\t return newNode;\n\t }\n\t\n\t function editableVNode(node, ownerID) {\n\t if (ownerID && node && ownerID === node.ownerID) {\n\t return node;\n\t }\n\t return new VNode(node ? node.array.slice() : [], ownerID);\n\t }\n\t\n\t function listNodeFor(list, rawIndex) {\n\t if (rawIndex >= getTailOffset(list._capacity)) {\n\t return list._tail;\n\t }\n\t if (rawIndex < 1 << (list._level + SHIFT)) {\n\t var node = list._root;\n\t var level = list._level;\n\t while (node && level > 0) {\n\t node = node.array[(rawIndex >>> level) & MASK];\n\t level -= SHIFT;\n\t }\n\t return node;\n\t }\n\t }\n\t\n\t function setListBounds(list, begin, end) {\n\t // Sanitize begin & end using this shorthand for ToInt32(argument)\n\t // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n\t if (begin !== undefined) {\n\t begin = begin | 0;\n\t }\n\t if (end !== undefined) {\n\t end = end | 0;\n\t }\n\t var owner = list.__ownerID || new OwnerID();\n\t var oldOrigin = list._origin;\n\t var oldCapacity = list._capacity;\n\t var newOrigin = oldOrigin + begin;\n\t var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end;\n\t if (newOrigin === oldOrigin && newCapacity === oldCapacity) {\n\t return list;\n\t }\n\t\n\t // If it's going to end after it starts, it's empty.\n\t if (newOrigin >= newCapacity) {\n\t return list.clear();\n\t }\n\t\n\t var newLevel = list._level;\n\t var newRoot = list._root;\n\t\n\t // New origin might need creating a higher root.\n\t var offsetShift = 0;\n\t while (newOrigin + offsetShift < 0) {\n\t newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner);\n\t newLevel += SHIFT;\n\t offsetShift += 1 << newLevel;\n\t }\n\t if (offsetShift) {\n\t newOrigin += offsetShift;\n\t oldOrigin += offsetShift;\n\t newCapacity += offsetShift;\n\t oldCapacity += offsetShift;\n\t }\n\t\n\t var oldTailOffset = getTailOffset(oldCapacity);\n\t var newTailOffset = getTailOffset(newCapacity);\n\t\n\t // New size might need creating a higher root.\n\t while (newTailOffset >= 1 << (newLevel + SHIFT)) {\n\t newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner);\n\t newLevel += SHIFT;\n\t }\n\t\n\t // Locate or create the new tail.\n\t var oldTail = list._tail;\n\t var newTail = newTailOffset < oldTailOffset ?\n\t listNodeFor(list, newCapacity - 1) :\n\t newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail;\n\t\n\t // Merge Tail into tree.\n\t if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) {\n\t newRoot = editableVNode(newRoot, owner);\n\t var node = newRoot;\n\t for (var level = newLevel; level > SHIFT; level -= SHIFT) {\n\t var idx = (oldTailOffset >>> level) & MASK;\n\t node = node.array[idx] = editableVNode(node.array[idx], owner);\n\t }\n\t node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;\n\t }\n\t\n\t // If the size has been reduced, there's a chance the tail needs to be trimmed.\n\t if (newCapacity < oldCapacity) {\n\t newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);\n\t }\n\t\n\t // If the new origin is within the tail, then we do not need a root.\n\t if (newOrigin >= newTailOffset) {\n\t newOrigin -= newTailOffset;\n\t newCapacity -= newTailOffset;\n\t newLevel = SHIFT;\n\t newRoot = null;\n\t newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);\n\t\n\t // Otherwise, if the root has been trimmed, garbage collect.\n\t } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {\n\t offsetShift = 0;\n\t\n\t // Identify the new top root node of the subtree of the old root.\n\t while (newRoot) {\n\t var beginIndex = (newOrigin >>> newLevel) & MASK;\n\t if (beginIndex !== (newTailOffset >>> newLevel) & MASK) {\n\t break;\n\t }\n\t if (beginIndex) {\n\t offsetShift += (1 << newLevel) * beginIndex;\n\t }\n\t newLevel -= SHIFT;\n\t newRoot = newRoot.array[beginIndex];\n\t }\n\t\n\t // Trim the new sides of the new root.\n\t if (newRoot && newOrigin > oldOrigin) {\n\t newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);\n\t }\n\t if (newRoot && newTailOffset < oldTailOffset) {\n\t newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift);\n\t }\n\t if (offsetShift) {\n\t newOrigin -= offsetShift;\n\t newCapacity -= offsetShift;\n\t }\n\t }\n\t\n\t if (list.__ownerID) {\n\t list.size = newCapacity - newOrigin;\n\t list._origin = newOrigin;\n\t list._capacity = newCapacity;\n\t list._level = newLevel;\n\t list._root = newRoot;\n\t list._tail = newTail;\n\t list.__hash = undefined;\n\t list.__altered = true;\n\t return list;\n\t }\n\t return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);\n\t }\n\t\n\t function mergeIntoListWith(list, merger, iterables) {\n\t var iters = [];\n\t var maxSize = 0;\n\t for (var ii = 0; ii < iterables.length; ii++) {\n\t var value = iterables[ii];\n\t var iter = IndexedIterable(value);\n\t if (iter.size > maxSize) {\n\t maxSize = iter.size;\n\t }\n\t if (!isIterable(value)) {\n\t iter = iter.map(function(v ) {return fromJS(v)});\n\t }\n\t iters.push(iter);\n\t }\n\t if (maxSize > list.size) {\n\t list = list.setSize(maxSize);\n\t }\n\t return mergeIntoCollectionWith(list, merger, iters);\n\t }\n\t\n\t function getTailOffset(size) {\n\t return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT);\n\t }\n\t\n\t createClass(OrderedMap, Map);\n\t\n\t // @pragma Construction\n\t\n\t function OrderedMap(value) {\n\t return value === null || value === undefined ? emptyOrderedMap() :\n\t isOrderedMap(value) ? value :\n\t emptyOrderedMap().withMutations(function(map ) {\n\t var iter = KeyedIterable(value);\n\t assertNotInfinite(iter.size);\n\t iter.forEach(function(v, k) {return map.set(k, v)});\n\t });\n\t }\n\t\n\t OrderedMap.of = function(/*...values*/) {\n\t return this(arguments);\n\t };\n\t\n\t OrderedMap.prototype.toString = function() {\n\t return this.__toString('OrderedMap {', '}');\n\t };\n\t\n\t // @pragma Access\n\t\n\t OrderedMap.prototype.get = function(k, notSetValue) {\n\t var index = this._map.get(k);\n\t return index !== undefined ? this._list.get(index)[1] : notSetValue;\n\t };\n\t\n\t // @pragma Modification\n\t\n\t OrderedMap.prototype.clear = function() {\n\t if (this.size === 0) {\n\t return this;\n\t }\n\t if (this.__ownerID) {\n\t this.size = 0;\n\t this._map.clear();\n\t this._list.clear();\n\t return this;\n\t }\n\t return emptyOrderedMap();\n\t };\n\t\n\t OrderedMap.prototype.set = function(k, v) {\n\t return updateOrderedMap(this, k, v);\n\t };\n\t\n\t OrderedMap.prototype.remove = function(k) {\n\t return updateOrderedMap(this, k, NOT_SET);\n\t };\n\t\n\t OrderedMap.prototype.wasAltered = function() {\n\t return this._map.wasAltered() || this._list.wasAltered();\n\t };\n\t\n\t OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n\t return this._list.__iterate(\n\t function(entry ) {return entry && fn(entry[1], entry[0], this$0)},\n\t reverse\n\t );\n\t };\n\t\n\t OrderedMap.prototype.__iterator = function(type, reverse) {\n\t return this._list.fromEntrySeq().__iterator(type, reverse);\n\t };\n\t\n\t OrderedMap.prototype.__ensureOwner = function(ownerID) {\n\t if (ownerID === this.__ownerID) {\n\t return this;\n\t }\n\t var newMap = this._map.__ensureOwner(ownerID);\n\t var newList = this._list.__ensureOwner(ownerID);\n\t if (!ownerID) {\n\t this.__ownerID = ownerID;\n\t this._map = newMap;\n\t this._list = newList;\n\t return this;\n\t }\n\t return makeOrderedMap(newMap, newList, ownerID, this.__hash);\n\t };\n\t\n\t\n\t function isOrderedMap(maybeOrderedMap) {\n\t return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);\n\t }\n\t\n\t OrderedMap.isOrderedMap = isOrderedMap;\n\t\n\t OrderedMap.prototype[IS_ORDERED_SENTINEL] = true;\n\t OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;\n\t\n\t\n\t\n\t function makeOrderedMap(map, list, ownerID, hash) {\n\t var omap = Object.create(OrderedMap.prototype);\n\t omap.size = map ? map.size : 0;\n\t omap._map = map;\n\t omap._list = list;\n\t omap.__ownerID = ownerID;\n\t omap.__hash = hash;\n\t return omap;\n\t }\n\t\n\t var EMPTY_ORDERED_MAP;\n\t function emptyOrderedMap() {\n\t return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()));\n\t }\n\t\n\t function updateOrderedMap(omap, k, v) {\n\t var map = omap._map;\n\t var list = omap._list;\n\t var i = map.get(k);\n\t var has = i !== undefined;\n\t var newMap;\n\t var newList;\n\t if (v === NOT_SET) { // removed\n\t if (!has) {\n\t return omap;\n\t }\n\t if (list.size >= SIZE && list.size >= map.size * 2) {\n\t newList = list.filter(function(entry, idx) {return entry !== undefined && i !== idx});\n\t newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap();\n\t if (omap.__ownerID) {\n\t newMap.__ownerID = newList.__ownerID = omap.__ownerID;\n\t }\n\t } else {\n\t newMap = map.remove(k);\n\t newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);\n\t }\n\t } else {\n\t if (has) {\n\t if (v === list.get(i)[1]) {\n\t return omap;\n\t }\n\t newMap = map;\n\t newList = list.set(i, [k, v]);\n\t } else {\n\t newMap = map.set(k, list.size);\n\t newList = list.set(list.size, [k, v]);\n\t }\n\t }\n\t if (omap.__ownerID) {\n\t omap.size = newMap.size;\n\t omap._map = newMap;\n\t omap._list = newList;\n\t omap.__hash = undefined;\n\t return omap;\n\t }\n\t return makeOrderedMap(newMap, newList);\n\t }\n\t\n\t createClass(ToKeyedSequence, KeyedSeq);\n\t function ToKeyedSequence(indexed, useKeys) {\n\t this._iter = indexed;\n\t this._useKeys = useKeys;\n\t this.size = indexed.size;\n\t }\n\t\n\t ToKeyedSequence.prototype.get = function(key, notSetValue) {\n\t return this._iter.get(key, notSetValue);\n\t };\n\t\n\t ToKeyedSequence.prototype.has = function(key) {\n\t return this._iter.has(key);\n\t };\n\t\n\t ToKeyedSequence.prototype.valueSeq = function() {\n\t return this._iter.valueSeq();\n\t };\n\t\n\t ToKeyedSequence.prototype.reverse = function() {var this$0 = this;\n\t var reversedSequence = reverseFactory(this, true);\n\t if (!this._useKeys) {\n\t reversedSequence.valueSeq = function() {return this$0._iter.toSeq().reverse()};\n\t }\n\t return reversedSequence;\n\t };\n\t\n\t ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this;\n\t var mappedSequence = mapFactory(this, mapper, context);\n\t if (!this._useKeys) {\n\t mappedSequence.valueSeq = function() {return this$0._iter.toSeq().map(mapper, context)};\n\t }\n\t return mappedSequence;\n\t };\n\t\n\t ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n\t var ii;\n\t return this._iter.__iterate(\n\t this._useKeys ?\n\t function(v, k) {return fn(v, k, this$0)} :\n\t ((ii = reverse ? resolveSize(this) : 0),\n\t function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}),\n\t reverse\n\t );\n\t };\n\t\n\t ToKeyedSequence.prototype.__iterator = function(type, reverse) {\n\t if (this._useKeys) {\n\t return this._iter.__iterator(type, reverse);\n\t }\n\t var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n\t var ii = reverse ? resolveSize(this) : 0;\n\t return new Iterator(function() {\n\t var step = iterator.next();\n\t return step.done ? step :\n\t iteratorValue(type, reverse ? --ii : ii++, step.value, step);\n\t });\n\t };\n\t\n\t ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true;\n\t\n\t\n\t createClass(ToIndexedSequence, IndexedSeq);\n\t function ToIndexedSequence(iter) {\n\t this._iter = iter;\n\t this.size = iter.size;\n\t }\n\t\n\t ToIndexedSequence.prototype.includes = function(value) {\n\t return this._iter.includes(value);\n\t };\n\t\n\t ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n\t var iterations = 0;\n\t return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse);\n\t };\n\t\n\t ToIndexedSequence.prototype.__iterator = function(type, reverse) {\n\t var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n\t var iterations = 0;\n\t return new Iterator(function() {\n\t var step = iterator.next();\n\t return step.done ? step :\n\t iteratorValue(type, iterations++, step.value, step)\n\t });\n\t };\n\t\n\t\n\t\n\t createClass(ToSetSequence, SetSeq);\n\t function ToSetSequence(iter) {\n\t this._iter = iter;\n\t this.size = iter.size;\n\t }\n\t\n\t ToSetSequence.prototype.has = function(key) {\n\t return this._iter.includes(key);\n\t };\n\t\n\t ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n\t return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse);\n\t };\n\t\n\t ToSetSequence.prototype.__iterator = function(type, reverse) {\n\t var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n\t return new Iterator(function() {\n\t var step = iterator.next();\n\t return step.done ? step :\n\t iteratorValue(type, step.value, step.value, step);\n\t });\n\t };\n\t\n\t\n\t\n\t createClass(FromEntriesSequence, KeyedSeq);\n\t function FromEntriesSequence(entries) {\n\t this._iter = entries;\n\t this.size = entries.size;\n\t }\n\t\n\t FromEntriesSequence.prototype.entrySeq = function() {\n\t return this._iter.toSeq();\n\t };\n\t\n\t FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n\t return this._iter.__iterate(function(entry ) {\n\t // Check if entry exists first so array access doesn't throw for holes\n\t // in the parent iteration.\n\t if (entry) {\n\t validateEntry(entry);\n\t var indexedIterable = isIterable(entry);\n\t return fn(\n\t indexedIterable ? entry.get(1) : entry[1],\n\t indexedIterable ? entry.get(0) : entry[0],\n\t this$0\n\t );\n\t }\n\t }, reverse);\n\t };\n\t\n\t FromEntriesSequence.prototype.__iterator = function(type, reverse) {\n\t var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n\t return new Iterator(function() {\n\t while (true) {\n\t var step = iterator.next();\n\t if (step.done) {\n\t return step;\n\t }\n\t var entry = step.value;\n\t // Check if entry exists first so array access doesn't throw for holes\n\t // in the parent iteration.\n\t if (entry) {\n\t validateEntry(entry);\n\t var indexedIterable = isIterable(entry);\n\t return iteratorValue(\n\t type,\n\t indexedIterable ? entry.get(0) : entry[0],\n\t indexedIterable ? entry.get(1) : entry[1],\n\t step\n\t );\n\t }\n\t }\n\t });\n\t };\n\t\n\t\n\t ToIndexedSequence.prototype.cacheResult =\n\t ToKeyedSequence.prototype.cacheResult =\n\t ToSetSequence.prototype.cacheResult =\n\t FromEntriesSequence.prototype.cacheResult =\n\t cacheResultThrough;\n\t\n\t\n\t function flipFactory(iterable) {\n\t var flipSequence = makeSequence(iterable);\n\t flipSequence._iter = iterable;\n\t flipSequence.size = iterable.size;\n\t flipSequence.flip = function() {return iterable};\n\t flipSequence.reverse = function () {\n\t var reversedSequence = iterable.reverse.apply(this); // super.reverse()\n\t reversedSequence.flip = function() {return iterable.reverse()};\n\t return reversedSequence;\n\t };\n\t flipSequence.has = function(key ) {return iterable.includes(key)};\n\t flipSequence.includes = function(key ) {return iterable.has(key)};\n\t flipSequence.cacheResult = cacheResultThrough;\n\t flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n\t return iterable.__iterate(function(v, k) {return fn(k, v, this$0) !== false}, reverse);\n\t }\n\t flipSequence.__iteratorUncached = function(type, reverse) {\n\t if (type === ITERATE_ENTRIES) {\n\t var iterator = iterable.__iterator(type, reverse);\n\t return new Iterator(function() {\n\t var step = iterator.next();\n\t if (!step.done) {\n\t var k = step.value[0];\n\t step.value[0] = step.value[1];\n\t step.value[1] = k;\n\t }\n\t return step;\n\t });\n\t }\n\t return iterable.__iterator(\n\t type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES,\n\t reverse\n\t );\n\t }\n\t return flipSequence;\n\t }\n\t\n\t\n\t function mapFactory(iterable, mapper, context) {\n\t var mappedSequence = makeSequence(iterable);\n\t mappedSequence.size = iterable.size;\n\t mappedSequence.has = function(key ) {return iterable.has(key)};\n\t mappedSequence.get = function(key, notSetValue) {\n\t var v = iterable.get(key, NOT_SET);\n\t return v === NOT_SET ?\n\t notSetValue :\n\t mapper.call(context, v, key, iterable);\n\t };\n\t mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n\t return iterable.__iterate(\n\t function(v, k, c) {return fn(mapper.call(context, v, k, c), k, this$0) !== false},\n\t reverse\n\t );\n\t }\n\t mappedSequence.__iteratorUncached = function (type, reverse) {\n\t var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n\t return new Iterator(function() {\n\t var step = iterator.next();\n\t if (step.done) {\n\t return step;\n\t }\n\t var entry = step.value;\n\t var key = entry[0];\n\t return iteratorValue(\n\t type,\n\t key,\n\t mapper.call(context, entry[1], key, iterable),\n\t step\n\t );\n\t });\n\t }\n\t return mappedSequence;\n\t }\n\t\n\t\n\t function reverseFactory(iterable, useKeys) {\n\t var reversedSequence = makeSequence(iterable);\n\t reversedSequence._iter = iterable;\n\t reversedSequence.size = iterable.size;\n\t reversedSequence.reverse = function() {return iterable};\n\t if (iterable.flip) {\n\t reversedSequence.flip = function () {\n\t var flipSequence = flipFactory(iterable);\n\t flipSequence.reverse = function() {return iterable.flip()};\n\t return flipSequence;\n\t };\n\t }\n\t reversedSequence.get = function(key, notSetValue) \n\t {return iterable.get(useKeys ? key : -1 - key, notSetValue)};\n\t reversedSequence.has = function(key )\n\t {return iterable.has(useKeys ? key : -1 - key)};\n\t reversedSequence.includes = function(value ) {return iterable.includes(value)};\n\t reversedSequence.cacheResult = cacheResultThrough;\n\t reversedSequence.__iterate = function (fn, reverse) {var this$0 = this;\n\t return iterable.__iterate(function(v, k) {return fn(v, k, this$0)}, !reverse);\n\t };\n\t reversedSequence.__iterator =\n\t function(type, reverse) {return iterable.__iterator(type, !reverse)};\n\t return reversedSequence;\n\t }\n\t\n\t\n\t function filterFactory(iterable, predicate, context, useKeys) {\n\t var filterSequence = makeSequence(iterable);\n\t if (useKeys) {\n\t filterSequence.has = function(key ) {\n\t var v = iterable.get(key, NOT_SET);\n\t return v !== NOT_SET && !!predicate.call(context, v, key, iterable);\n\t };\n\t filterSequence.get = function(key, notSetValue) {\n\t var v = iterable.get(key, NOT_SET);\n\t return v !== NOT_SET && predicate.call(context, v, key, iterable) ?\n\t v : notSetValue;\n\t };\n\t }\n\t filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n\t var iterations = 0;\n\t iterable.__iterate(function(v, k, c) {\n\t if (predicate.call(context, v, k, c)) {\n\t iterations++;\n\t return fn(v, useKeys ? k : iterations - 1, this$0);\n\t }\n\t }, reverse);\n\t return iterations;\n\t };\n\t filterSequence.__iteratorUncached = function (type, reverse) {\n\t var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n\t var iterations = 0;\n\t return new Iterator(function() {\n\t while (true) {\n\t var step = iterator.next();\n\t if (step.done) {\n\t return step;\n\t }\n\t var entry = step.value;\n\t var key = entry[0];\n\t var value = entry[1];\n\t if (predicate.call(context, value, key, iterable)) {\n\t return iteratorValue(type, useKeys ? key : iterations++, value, step);\n\t }\n\t }\n\t });\n\t }\n\t return filterSequence;\n\t }\n\t\n\t\n\t function countByFactory(iterable, grouper, context) {\n\t var groups = Map().asMutable();\n\t iterable.__iterate(function(v, k) {\n\t groups.update(\n\t grouper.call(context, v, k, iterable),\n\t 0,\n\t function(a ) {return a + 1}\n\t );\n\t });\n\t return groups.asImmutable();\n\t }\n\t\n\t\n\t function groupByFactory(iterable, grouper, context) {\n\t var isKeyedIter = isKeyed(iterable);\n\t var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable();\n\t iterable.__iterate(function(v, k) {\n\t groups.update(\n\t grouper.call(context, v, k, iterable),\n\t function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)}\n\t );\n\t });\n\t var coerce = iterableClass(iterable);\n\t return groups.map(function(arr ) {return reify(iterable, coerce(arr))});\n\t }\n\t\n\t\n\t function sliceFactory(iterable, begin, end, useKeys) {\n\t var originalSize = iterable.size;\n\t\n\t // Sanitize begin & end using this shorthand for ToInt32(argument)\n\t // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n\t if (begin !== undefined) {\n\t begin = begin | 0;\n\t }\n\t if (end !== undefined) {\n\t if (end === Infinity) {\n\t end = originalSize;\n\t } else {\n\t end = end | 0;\n\t }\n\t }\n\t\n\t if (wholeSlice(begin, end, originalSize)) {\n\t return iterable;\n\t }\n\t\n\t var resolvedBegin = resolveBegin(begin, originalSize);\n\t var resolvedEnd = resolveEnd(end, originalSize);\n\t\n\t // begin or end will be NaN if they were provided as negative numbers and\n\t // this iterable's size is unknown. In that case, cache first so there is\n\t // a known size and these do not resolve to NaN.\n\t if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {\n\t return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys);\n\t }\n\t\n\t // Note: resolvedEnd is undefined when the original sequence's length is\n\t // unknown and this slice did not supply an end and should contain all\n\t // elements after resolvedBegin.\n\t // In that case, resolvedSize will be NaN and sliceSize will remain undefined.\n\t var resolvedSize = resolvedEnd - resolvedBegin;\n\t var sliceSize;\n\t if (resolvedSize === resolvedSize) {\n\t sliceSize = resolvedSize < 0 ? 0 : resolvedSize;\n\t }\n\t\n\t var sliceSeq = makeSequence(iterable);\n\t\n\t // If iterable.size is undefined, the size of the realized sliceSeq is\n\t // unknown at this point unless the number of items to slice is 0\n\t sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined;\n\t\n\t if (!useKeys && isSeq(iterable) && sliceSize >= 0) {\n\t sliceSeq.get = function (index, notSetValue) {\n\t index = wrapIndex(this, index);\n\t return index >= 0 && index < sliceSize ?\n\t iterable.get(index + resolvedBegin, notSetValue) :\n\t notSetValue;\n\t }\n\t }\n\t\n\t sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this;\n\t if (sliceSize === 0) {\n\t return 0;\n\t }\n\t if (reverse) {\n\t return this.cacheResult().__iterate(fn, reverse);\n\t }\n\t var skipped = 0;\n\t var isSkipping = true;\n\t var iterations = 0;\n\t iterable.__iterate(function(v, k) {\n\t if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {\n\t iterations++;\n\t return fn(v, useKeys ? k : iterations - 1, this$0) !== false &&\n\t iterations !== sliceSize;\n\t }\n\t });\n\t return iterations;\n\t };\n\t\n\t sliceSeq.__iteratorUncached = function(type, reverse) {\n\t if (sliceSize !== 0 && reverse) {\n\t return this.cacheResult().__iterator(type, reverse);\n\t }\n\t // Don't bother instantiating parent iterator if taking 0.\n\t var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse);\n\t var skipped = 0;\n\t var iterations = 0;\n\t return new Iterator(function() {\n\t while (skipped++ < resolvedBegin) {\n\t iterator.next();\n\t }\n\t if (++iterations > sliceSize) {\n\t return iteratorDone();\n\t }\n\t var step = iterator.next();\n\t if (useKeys || type === ITERATE_VALUES) {\n\t return step;\n\t } else if (type === ITERATE_KEYS) {\n\t return iteratorValue(type, iterations - 1, undefined, step);\n\t } else {\n\t return iteratorValue(type, iterations - 1, step.value[1], step);\n\t }\n\t });\n\t }\n\t\n\t return sliceSeq;\n\t }\n\t\n\t\n\t function takeWhileFactory(iterable, predicate, context) {\n\t var takeSequence = makeSequence(iterable);\n\t takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n\t if (reverse) {\n\t return this.cacheResult().__iterate(fn, reverse);\n\t }\n\t var iterations = 0;\n\t iterable.__iterate(function(v, k, c) \n\t {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)}\n\t );\n\t return iterations;\n\t };\n\t takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n\t if (reverse) {\n\t return this.cacheResult().__iterator(type, reverse);\n\t }\n\t var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n\t var iterating = true;\n\t return new Iterator(function() {\n\t if (!iterating) {\n\t return iteratorDone();\n\t }\n\t var step = iterator.next();\n\t if (step.done) {\n\t return step;\n\t }\n\t var entry = step.value;\n\t var k = entry[0];\n\t var v = entry[1];\n\t if (!predicate.call(context, v, k, this$0)) {\n\t iterating = false;\n\t return iteratorDone();\n\t }\n\t return type === ITERATE_ENTRIES ? step :\n\t iteratorValue(type, k, v, step);\n\t });\n\t };\n\t return takeSequence;\n\t }\n\t\n\t\n\t function skipWhileFactory(iterable, predicate, context, useKeys) {\n\t var skipSequence = makeSequence(iterable);\n\t skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n\t if (reverse) {\n\t return this.cacheResult().__iterate(fn, reverse);\n\t }\n\t var isSkipping = true;\n\t var iterations = 0;\n\t iterable.__iterate(function(v, k, c) {\n\t if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {\n\t iterations++;\n\t return fn(v, useKeys ? k : iterations - 1, this$0);\n\t }\n\t });\n\t return iterations;\n\t };\n\t skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n\t if (reverse) {\n\t return this.cacheResult().__iterator(type, reverse);\n\t }\n\t var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n\t var skipping = true;\n\t var iterations = 0;\n\t return new Iterator(function() {\n\t var step, k, v;\n\t do {\n\t step = iterator.next();\n\t if (step.done) {\n\t if (useKeys || type === ITERATE_VALUES) {\n\t return step;\n\t } else if (type === ITERATE_KEYS) {\n\t return iteratorValue(type, iterations++, undefined, step);\n\t } else {\n\t return iteratorValue(type, iterations++, step.value[1], step);\n\t }\n\t }\n\t var entry = step.value;\n\t k = entry[0];\n\t v = entry[1];\n\t skipping && (skipping = predicate.call(context, v, k, this$0));\n\t } while (skipping);\n\t return type === ITERATE_ENTRIES ? step :\n\t iteratorValue(type, k, v, step);\n\t });\n\t };\n\t return skipSequence;\n\t }\n\t\n\t\n\t function concatFactory(iterable, values) {\n\t var isKeyedIterable = isKeyed(iterable);\n\t var iters = [iterable].concat(values).map(function(v ) {\n\t if (!isIterable(v)) {\n\t v = isKeyedIterable ?\n\t keyedSeqFromValue(v) :\n\t indexedSeqFromValue(Array.isArray(v) ? v : [v]);\n\t } else if (isKeyedIterable) {\n\t v = KeyedIterable(v);\n\t }\n\t return v;\n\t }).filter(function(v ) {return v.size !== 0});\n\t\n\t if (iters.length === 0) {\n\t return iterable;\n\t }\n\t\n\t if (iters.length === 1) {\n\t var singleton = iters[0];\n\t if (singleton === iterable ||\n\t isKeyedIterable && isKeyed(singleton) ||\n\t isIndexed(iterable) && isIndexed(singleton)) {\n\t return singleton;\n\t }\n\t }\n\t\n\t var concatSeq = new ArraySeq(iters);\n\t if (isKeyedIterable) {\n\t concatSeq = concatSeq.toKeyedSeq();\n\t } else if (!isIndexed(iterable)) {\n\t concatSeq = concatSeq.toSetSeq();\n\t }\n\t concatSeq = concatSeq.flatten(true);\n\t concatSeq.size = iters.reduce(\n\t function(sum, seq) {\n\t if (sum !== undefined) {\n\t var size = seq.size;\n\t if (size !== undefined) {\n\t return sum + size;\n\t }\n\t }\n\t },\n\t 0\n\t );\n\t return concatSeq;\n\t }\n\t\n\t\n\t function flattenFactory(iterable, depth, useKeys) {\n\t var flatSequence = makeSequence(iterable);\n\t flatSequence.__iterateUncached = function(fn, reverse) {\n\t var iterations = 0;\n\t var stopped = false;\n\t function flatDeep(iter, currentDepth) {var this$0 = this;\n\t iter.__iterate(function(v, k) {\n\t if ((!depth || currentDepth < depth) && isIterable(v)) {\n\t flatDeep(v, currentDepth + 1);\n\t } else if (fn(v, useKeys ? k : iterations++, this$0) === false) {\n\t stopped = true;\n\t }\n\t return !stopped;\n\t }, reverse);\n\t }\n\t flatDeep(iterable, 0);\n\t return iterations;\n\t }\n\t flatSequence.__iteratorUncached = function(type, reverse) {\n\t var iterator = iterable.__iterator(type, reverse);\n\t var stack = [];\n\t var iterations = 0;\n\t return new Iterator(function() {\n\t while (iterator) {\n\t var step = iterator.next();\n\t if (step.done !== false) {\n\t iterator = stack.pop();\n\t continue;\n\t }\n\t var v = step.value;\n\t if (type === ITERATE_ENTRIES) {\n\t v = v[1];\n\t }\n\t if ((!depth || stack.length < depth) && isIterable(v)) {\n\t stack.push(iterator);\n\t iterator = v.__iterator(type, reverse);\n\t } else {\n\t return useKeys ? step : iteratorValue(type, iterations++, v, step);\n\t }\n\t }\n\t return iteratorDone();\n\t });\n\t }\n\t return flatSequence;\n\t }\n\t\n\t\n\t function flatMapFactory(iterable, mapper, context) {\n\t var coerce = iterableClass(iterable);\n\t return iterable.toSeq().map(\n\t function(v, k) {return coerce(mapper.call(context, v, k, iterable))}\n\t ).flatten(true);\n\t }\n\t\n\t\n\t function interposeFactory(iterable, separator) {\n\t var interposedSequence = makeSequence(iterable);\n\t interposedSequence.size = iterable.size && iterable.size * 2 -1;\n\t interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n\t var iterations = 0;\n\t iterable.__iterate(function(v, k) \n\t {return (!iterations || fn(separator, iterations++, this$0) !== false) &&\n\t fn(v, iterations++, this$0) !== false},\n\t reverse\n\t );\n\t return iterations;\n\t };\n\t interposedSequence.__iteratorUncached = function(type, reverse) {\n\t var iterator = iterable.__iterator(ITERATE_VALUES, reverse);\n\t var iterations = 0;\n\t var step;\n\t return new Iterator(function() {\n\t if (!step || iterations % 2) {\n\t step = iterator.next();\n\t if (step.done) {\n\t return step;\n\t }\n\t }\n\t return iterations % 2 ?\n\t iteratorValue(type, iterations++, separator) :\n\t iteratorValue(type, iterations++, step.value, step);\n\t });\n\t };\n\t return interposedSequence;\n\t }\n\t\n\t\n\t function sortFactory(iterable, comparator, mapper) {\n\t if (!comparator) {\n\t comparator = defaultComparator;\n\t }\n\t var isKeyedIterable = isKeyed(iterable);\n\t var index = 0;\n\t var entries = iterable.toSeq().map(\n\t function(v, k) {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]}\n\t ).toArray();\n\t entries.sort(function(a, b) {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach(\n\t isKeyedIterable ?\n\t function(v, i) { entries[i].length = 2; } :\n\t function(v, i) { entries[i] = v[1]; }\n\t );\n\t return isKeyedIterable ? KeyedSeq(entries) :\n\t isIndexed(iterable) ? IndexedSeq(entries) :\n\t SetSeq(entries);\n\t }\n\t\n\t\n\t function maxFactory(iterable, comparator, mapper) {\n\t if (!comparator) {\n\t comparator = defaultComparator;\n\t }\n\t if (mapper) {\n\t var entry = iterable.toSeq()\n\t .map(function(v, k) {return [v, mapper(v, k, iterable)]})\n\t .reduce(function(a, b) {return maxCompare(comparator, a[1], b[1]) ? b : a});\n\t return entry && entry[0];\n\t } else {\n\t return iterable.reduce(function(a, b) {return maxCompare(comparator, a, b) ? b : a});\n\t }\n\t }\n\t\n\t function maxCompare(comparator, a, b) {\n\t var comp = comparator(b, a);\n\t // b is considered the new max if the comparator declares them equal, but\n\t // they are not equal and b is in fact a nullish value.\n\t return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0;\n\t }\n\t\n\t\n\t function zipWithFactory(keyIter, zipper, iters) {\n\t var zipSequence = makeSequence(keyIter);\n\t zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min();\n\t // Note: this a generic base implementation of __iterate in terms of\n\t // __iterator which may be more generically useful in the future.\n\t zipSequence.__iterate = function(fn, reverse) {\n\t /* generic:\n\t var iterator = this.__iterator(ITERATE_ENTRIES, reverse);\n\t var step;\n\t var iterations = 0;\n\t while (!(step = iterator.next()).done) {\n\t iterations++;\n\t if (fn(step.value[1], step.value[0], this) === false) {\n\t break;\n\t }\n\t }\n\t return iterations;\n\t */\n\t // indexed:\n\t var iterator = this.__iterator(ITERATE_VALUES, reverse);\n\t var step;\n\t var iterations = 0;\n\t while (!(step = iterator.next()).done) {\n\t if (fn(step.value, iterations++, this) === false) {\n\t break;\n\t }\n\t }\n\t return iterations;\n\t };\n\t zipSequence.__iteratorUncached = function(type, reverse) {\n\t var iterators = iters.map(function(i )\n\t {return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))}\n\t );\n\t var iterations = 0;\n\t var isDone = false;\n\t return new Iterator(function() {\n\t var steps;\n\t if (!isDone) {\n\t steps = iterators.map(function(i ) {return i.next()});\n\t isDone = steps.some(function(s ) {return s.done});\n\t }\n\t if (isDone) {\n\t return iteratorDone();\n\t }\n\t return iteratorValue(\n\t type,\n\t iterations++,\n\t zipper.apply(null, steps.map(function(s ) {return s.value}))\n\t );\n\t });\n\t };\n\t return zipSequence\n\t }\n\t\n\t\n\t // #pragma Helper Functions\n\t\n\t function reify(iter, seq) {\n\t return isSeq(iter) ? seq : iter.constructor(seq);\n\t }\n\t\n\t function validateEntry(entry) {\n\t if (entry !== Object(entry)) {\n\t throw new TypeError('Expected [K, V] tuple: ' + entry);\n\t }\n\t }\n\t\n\t function resolveSize(iter) {\n\t assertNotInfinite(iter.size);\n\t return ensureSize(iter);\n\t }\n\t\n\t function iterableClass(iterable) {\n\t return isKeyed(iterable) ? KeyedIterable :\n\t isIndexed(iterable) ? IndexedIterable :\n\t SetIterable;\n\t }\n\t\n\t function makeSequence(iterable) {\n\t return Object.create(\n\t (\n\t isKeyed(iterable) ? KeyedSeq :\n\t isIndexed(iterable) ? IndexedSeq :\n\t SetSeq\n\t ).prototype\n\t );\n\t }\n\t\n\t function cacheResultThrough() {\n\t if (this._iter.cacheResult) {\n\t this._iter.cacheResult();\n\t this.size = this._iter.size;\n\t return this;\n\t } else {\n\t return Seq.prototype.cacheResult.call(this);\n\t }\n\t }\n\t\n\t function defaultComparator(a, b) {\n\t return a > b ? 1 : a < b ? -1 : 0;\n\t }\n\t\n\t function forceIterator(keyPath) {\n\t var iter = getIterator(keyPath);\n\t if (!iter) {\n\t // Array might not be iterable in this environment, so we need a fallback\n\t // to our wrapped type.\n\t if (!isArrayLike(keyPath)) {\n\t throw new TypeError('Expected iterable or array-like: ' + keyPath);\n\t }\n\t iter = getIterator(Iterable(keyPath));\n\t }\n\t return iter;\n\t }\n\t\n\t createClass(Record, KeyedCollection);\n\t\n\t function Record(defaultValues, name) {\n\t var hasInitialized;\n\t\n\t var RecordType = function Record(values) {\n\t if (values instanceof RecordType) {\n\t return values;\n\t }\n\t if (!(this instanceof RecordType)) {\n\t return new RecordType(values);\n\t }\n\t if (!hasInitialized) {\n\t hasInitialized = true;\n\t var keys = Object.keys(defaultValues);\n\t setProps(RecordTypePrototype, keys);\n\t RecordTypePrototype.size = keys.length;\n\t RecordTypePrototype._name = name;\n\t RecordTypePrototype._keys = keys;\n\t RecordTypePrototype._defaultValues = defaultValues;\n\t }\n\t this._map = Map(values);\n\t };\n\t\n\t var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype);\n\t RecordTypePrototype.constructor = RecordType;\n\t\n\t return RecordType;\n\t }\n\t\n\t Record.prototype.toString = function() {\n\t return this.__toString(recordName(this) + ' {', '}');\n\t };\n\t\n\t // @pragma Access\n\t\n\t Record.prototype.has = function(k) {\n\t return this._defaultValues.hasOwnProperty(k);\n\t };\n\t\n\t Record.prototype.get = function(k, notSetValue) {\n\t if (!this.has(k)) {\n\t return notSetValue;\n\t }\n\t var defaultVal = this._defaultValues[k];\n\t return this._map ? this._map.get(k, defaultVal) : defaultVal;\n\t };\n\t\n\t // @pragma Modification\n\t\n\t Record.prototype.clear = function() {\n\t if (this.__ownerID) {\n\t this._map && this._map.clear();\n\t return this;\n\t }\n\t var RecordType = this.constructor;\n\t return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap()));\n\t };\n\t\n\t Record.prototype.set = function(k, v) {\n\t if (!this.has(k)) {\n\t throw new Error('Cannot set unknown key \"' + k + '\" on ' + recordName(this));\n\t }\n\t if (this._map && !this._map.has(k)) {\n\t var defaultVal = this._defaultValues[k];\n\t if (v === defaultVal) {\n\t return this;\n\t }\n\t }\n\t var newMap = this._map && this._map.set(k, v);\n\t if (this.__ownerID || newMap === this._map) {\n\t return this;\n\t }\n\t return makeRecord(this, newMap);\n\t };\n\t\n\t Record.prototype.remove = function(k) {\n\t if (!this.has(k)) {\n\t return this;\n\t }\n\t var newMap = this._map && this._map.remove(k);\n\t if (this.__ownerID || newMap === this._map) {\n\t return this;\n\t }\n\t return makeRecord(this, newMap);\n\t };\n\t\n\t Record.prototype.wasAltered = function() {\n\t return this._map.wasAltered();\n\t };\n\t\n\t Record.prototype.__iterator = function(type, reverse) {var this$0 = this;\n\t return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterator(type, reverse);\n\t };\n\t\n\t Record.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n\t return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterate(fn, reverse);\n\t };\n\t\n\t Record.prototype.__ensureOwner = function(ownerID) {\n\t if (ownerID === this.__ownerID) {\n\t return this;\n\t }\n\t var newMap = this._map && this._map.__ensureOwner(ownerID);\n\t if (!ownerID) {\n\t this.__ownerID = ownerID;\n\t this._map = newMap;\n\t return this;\n\t }\n\t return makeRecord(this, newMap, ownerID);\n\t };\n\t\n\t\n\t var RecordPrototype = Record.prototype;\n\t RecordPrototype[DELETE] = RecordPrototype.remove;\n\t RecordPrototype.deleteIn =\n\t RecordPrototype.removeIn = MapPrototype.removeIn;\n\t RecordPrototype.merge = MapPrototype.merge;\n\t RecordPrototype.mergeWith = MapPrototype.mergeWith;\n\t RecordPrototype.mergeIn = MapPrototype.mergeIn;\n\t RecordPrototype.mergeDeep = MapPrototype.mergeDeep;\n\t RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith;\n\t RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n\t RecordPrototype.setIn = MapPrototype.setIn;\n\t RecordPrototype.update = MapPrototype.update;\n\t RecordPrototype.updateIn = MapPrototype.updateIn;\n\t RecordPrototype.withMutations = MapPrototype.withMutations;\n\t RecordPrototype.asMutable = MapPrototype.asMutable;\n\t RecordPrototype.asImmutable = MapPrototype.asImmutable;\n\t\n\t\n\t function makeRecord(likeRecord, map, ownerID) {\n\t var record = Object.create(Object.getPrototypeOf(likeRecord));\n\t record._map = map;\n\t record.__ownerID = ownerID;\n\t return record;\n\t }\n\t\n\t function recordName(record) {\n\t return record._name || record.constructor.name || 'Record';\n\t }\n\t\n\t function setProps(prototype, names) {\n\t try {\n\t names.forEach(setProp.bind(undefined, prototype));\n\t } catch (error) {\n\t // Object.defineProperty failed. Probably IE8.\n\t }\n\t }\n\t\n\t function setProp(prototype, name) {\n\t Object.defineProperty(prototype, name, {\n\t get: function() {\n\t return this.get(name);\n\t },\n\t set: function(value) {\n\t invariant(this.__ownerID, 'Cannot set on an immutable record.');\n\t this.set(name, value);\n\t }\n\t });\n\t }\n\t\n\t createClass(Set, SetCollection);\n\t\n\t // @pragma Construction\n\t\n\t function Set(value) {\n\t return value === null || value === undefined ? emptySet() :\n\t isSet(value) && !isOrdered(value) ? value :\n\t emptySet().withMutations(function(set ) {\n\t var iter = SetIterable(value);\n\t assertNotInfinite(iter.size);\n\t iter.forEach(function(v ) {return set.add(v)});\n\t });\n\t }\n\t\n\t Set.of = function(/*...values*/) {\n\t return this(arguments);\n\t };\n\t\n\t Set.fromKeys = function(value) {\n\t return this(KeyedIterable(value).keySeq());\n\t };\n\t\n\t Set.prototype.toString = function() {\n\t return this.__toString('Set {', '}');\n\t };\n\t\n\t // @pragma Access\n\t\n\t Set.prototype.has = function(value) {\n\t return this._map.has(value);\n\t };\n\t\n\t // @pragma Modification\n\t\n\t Set.prototype.add = function(value) {\n\t return updateSet(this, this._map.set(value, true));\n\t };\n\t\n\t Set.prototype.remove = function(value) {\n\t return updateSet(this, this._map.remove(value));\n\t };\n\t\n\t Set.prototype.clear = function() {\n\t return updateSet(this, this._map.clear());\n\t };\n\t\n\t // @pragma Composition\n\t\n\t Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0);\n\t iters = iters.filter(function(x ) {return x.size !== 0});\n\t if (iters.length === 0) {\n\t return this;\n\t }\n\t if (this.size === 0 && !this.__ownerID && iters.length === 1) {\n\t return this.constructor(iters[0]);\n\t }\n\t return this.withMutations(function(set ) {\n\t for (var ii = 0; ii < iters.length; ii++) {\n\t SetIterable(iters[ii]).forEach(function(value ) {return set.add(value)});\n\t }\n\t });\n\t };\n\t\n\t Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0);\n\t if (iters.length === 0) {\n\t return this;\n\t }\n\t iters = iters.map(function(iter ) {return SetIterable(iter)});\n\t var originalSet = this;\n\t return this.withMutations(function(set ) {\n\t originalSet.forEach(function(value ) {\n\t if (!iters.every(function(iter ) {return iter.includes(value)})) {\n\t set.remove(value);\n\t }\n\t });\n\t });\n\t };\n\t\n\t Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0);\n\t if (iters.length === 0) {\n\t return this;\n\t }\n\t iters = iters.map(function(iter ) {return SetIterable(iter)});\n\t var originalSet = this;\n\t return this.withMutations(function(set ) {\n\t originalSet.forEach(function(value ) {\n\t if (iters.some(function(iter ) {return iter.includes(value)})) {\n\t set.remove(value);\n\t }\n\t });\n\t });\n\t };\n\t\n\t Set.prototype.merge = function() {\n\t return this.union.apply(this, arguments);\n\t };\n\t\n\t Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n\t return this.union.apply(this, iters);\n\t };\n\t\n\t Set.prototype.sort = function(comparator) {\n\t // Late binding\n\t return OrderedSet(sortFactory(this, comparator));\n\t };\n\t\n\t Set.prototype.sortBy = function(mapper, comparator) {\n\t // Late binding\n\t return OrderedSet(sortFactory(this, comparator, mapper));\n\t };\n\t\n\t Set.prototype.wasAltered = function() {\n\t return this._map.wasAltered();\n\t };\n\t\n\t Set.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n\t return this._map.__iterate(function(_, k) {return fn(k, k, this$0)}, reverse);\n\t };\n\t\n\t Set.prototype.__iterator = function(type, reverse) {\n\t return this._map.map(function(_, k) {return k}).__iterator(type, reverse);\n\t };\n\t\n\t Set.prototype.__ensureOwner = function(ownerID) {\n\t if (ownerID === this.__ownerID) {\n\t return this;\n\t }\n\t var newMap = this._map.__ensureOwner(ownerID);\n\t if (!ownerID) {\n\t this.__ownerID = ownerID;\n\t this._map = newMap;\n\t return this;\n\t }\n\t return this.__make(newMap, ownerID);\n\t };\n\t\n\t\n\t function isSet(maybeSet) {\n\t return !!(maybeSet && maybeSet[IS_SET_SENTINEL]);\n\t }\n\t\n\t Set.isSet = isSet;\n\t\n\t var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';\n\t\n\t var SetPrototype = Set.prototype;\n\t SetPrototype[IS_SET_SENTINEL] = true;\n\t SetPrototype[DELETE] = SetPrototype.remove;\n\t SetPrototype.mergeDeep = SetPrototype.merge;\n\t SetPrototype.mergeDeepWith = SetPrototype.mergeWith;\n\t SetPrototype.withMutations = MapPrototype.withMutations;\n\t SetPrototype.asMutable = MapPrototype.asMutable;\n\t SetPrototype.asImmutable = MapPrototype.asImmutable;\n\t\n\t SetPrototype.__empty = emptySet;\n\t SetPrototype.__make = makeSet;\n\t\n\t function updateSet(set, newMap) {\n\t if (set.__ownerID) {\n\t set.size = newMap.size;\n\t set._map = newMap;\n\t return set;\n\t }\n\t return newMap === set._map ? set :\n\t newMap.size === 0 ? set.__empty() :\n\t set.__make(newMap);\n\t }\n\t\n\t function makeSet(map, ownerID) {\n\t var set = Object.create(SetPrototype);\n\t set.size = map ? map.size : 0;\n\t set._map = map;\n\t set.__ownerID = ownerID;\n\t return set;\n\t }\n\t\n\t var EMPTY_SET;\n\t function emptySet() {\n\t return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));\n\t }\n\t\n\t createClass(OrderedSet, Set);\n\t\n\t // @pragma Construction\n\t\n\t function OrderedSet(value) {\n\t return value === null || value === undefined ? emptyOrderedSet() :\n\t isOrderedSet(value) ? value :\n\t emptyOrderedSet().withMutations(function(set ) {\n\t var iter = SetIterable(value);\n\t assertNotInfinite(iter.size);\n\t iter.forEach(function(v ) {return set.add(v)});\n\t });\n\t }\n\t\n\t OrderedSet.of = function(/*...values*/) {\n\t return this(arguments);\n\t };\n\t\n\t OrderedSet.fromKeys = function(value) {\n\t return this(KeyedIterable(value).keySeq());\n\t };\n\t\n\t OrderedSet.prototype.toString = function() {\n\t return this.__toString('OrderedSet {', '}');\n\t };\n\t\n\t\n\t function isOrderedSet(maybeOrderedSet) {\n\t return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);\n\t }\n\t\n\t OrderedSet.isOrderedSet = isOrderedSet;\n\t\n\t var OrderedSetPrototype = OrderedSet.prototype;\n\t OrderedSetPrototype[IS_ORDERED_SENTINEL] = true;\n\t\n\t OrderedSetPrototype.__empty = emptyOrderedSet;\n\t OrderedSetPrototype.__make = makeOrderedSet;\n\t\n\t function makeOrderedSet(map, ownerID) {\n\t var set = Object.create(OrderedSetPrototype);\n\t set.size = map ? map.size : 0;\n\t set._map = map;\n\t set.__ownerID = ownerID;\n\t return set;\n\t }\n\t\n\t var EMPTY_ORDERED_SET;\n\t function emptyOrderedSet() {\n\t return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()));\n\t }\n\t\n\t createClass(Stack, IndexedCollection);\n\t\n\t // @pragma Construction\n\t\n\t function Stack(value) {\n\t return value === null || value === undefined ? emptyStack() :\n\t isStack(value) ? value :\n\t emptyStack().unshiftAll(value);\n\t }\n\t\n\t Stack.of = function(/*...values*/) {\n\t return this(arguments);\n\t };\n\t\n\t Stack.prototype.toString = function() {\n\t return this.__toString('Stack [', ']');\n\t };\n\t\n\t // @pragma Access\n\t\n\t Stack.prototype.get = function(index, notSetValue) {\n\t var head = this._head;\n\t index = wrapIndex(this, index);\n\t while (head && index--) {\n\t head = head.next;\n\t }\n\t return head ? head.value : notSetValue;\n\t };\n\t\n\t Stack.prototype.peek = function() {\n\t return this._head && this._head.value;\n\t };\n\t\n\t // @pragma Modification\n\t\n\t Stack.prototype.push = function(/*...values*/) {\n\t if (arguments.length === 0) {\n\t return this;\n\t }\n\t var newSize = this.size + arguments.length;\n\t var head = this._head;\n\t for (var ii = arguments.length - 1; ii >= 0; ii--) {\n\t head = {\n\t value: arguments[ii],\n\t next: head\n\t };\n\t }\n\t if (this.__ownerID) {\n\t this.size = newSize;\n\t this._head = head;\n\t this.__hash = undefined;\n\t this.__altered = true;\n\t return this;\n\t }\n\t return makeStack(newSize, head);\n\t };\n\t\n\t Stack.prototype.pushAll = function(iter) {\n\t iter = IndexedIterable(iter);\n\t if (iter.size === 0) {\n\t return this;\n\t }\n\t assertNotInfinite(iter.size);\n\t var newSize = this.size;\n\t var head = this._head;\n\t iter.reverse().forEach(function(value ) {\n\t newSize++;\n\t head = {\n\t value: value,\n\t next: head\n\t };\n\t });\n\t if (this.__ownerID) {\n\t this.size = newSize;\n\t this._head = head;\n\t this.__hash = undefined;\n\t this.__altered = true;\n\t return this;\n\t }\n\t return makeStack(newSize, head);\n\t };\n\t\n\t Stack.prototype.pop = function() {\n\t return this.slice(1);\n\t };\n\t\n\t Stack.prototype.unshift = function(/*...values*/) {\n\t return this.push.apply(this, arguments);\n\t };\n\t\n\t Stack.prototype.unshiftAll = function(iter) {\n\t return this.pushAll(iter);\n\t };\n\t\n\t Stack.prototype.shift = function() {\n\t return this.pop.apply(this, arguments);\n\t };\n\t\n\t Stack.prototype.clear = function() {\n\t if (this.size === 0) {\n\t return this;\n\t }\n\t if (this.__ownerID) {\n\t this.size = 0;\n\t this._head = undefined;\n\t this.__hash = undefined;\n\t this.__altered = true;\n\t return this;\n\t }\n\t return emptyStack();\n\t };\n\t\n\t Stack.prototype.slice = function(begin, end) {\n\t if (wholeSlice(begin, end, this.size)) {\n\t return this;\n\t }\n\t var resolvedBegin = resolveBegin(begin, this.size);\n\t var resolvedEnd = resolveEnd(end, this.size);\n\t if (resolvedEnd !== this.size) {\n\t // super.slice(begin, end);\n\t return IndexedCollection.prototype.slice.call(this, begin, end);\n\t }\n\t var newSize = this.size - resolvedBegin;\n\t var head = this._head;\n\t while (resolvedBegin--) {\n\t head = head.next;\n\t }\n\t if (this.__ownerID) {\n\t this.size = newSize;\n\t this._head = head;\n\t this.__hash = undefined;\n\t this.__altered = true;\n\t return this;\n\t }\n\t return makeStack(newSize, head);\n\t };\n\t\n\t // @pragma Mutability\n\t\n\t Stack.prototype.__ensureOwner = function(ownerID) {\n\t if (ownerID === this.__ownerID) {\n\t return this;\n\t }\n\t if (!ownerID) {\n\t this.__ownerID = ownerID;\n\t this.__altered = false;\n\t return this;\n\t }\n\t return makeStack(this.size, this._head, ownerID, this.__hash);\n\t };\n\t\n\t // @pragma Iteration\n\t\n\t Stack.prototype.__iterate = function(fn, reverse) {\n\t if (reverse) {\n\t return this.reverse().__iterate(fn);\n\t }\n\t var iterations = 0;\n\t var node = this._head;\n\t while (node) {\n\t if (fn(node.value, iterations++, this) === false) {\n\t break;\n\t }\n\t node = node.next;\n\t }\n\t return iterations;\n\t };\n\t\n\t Stack.prototype.__iterator = function(type, reverse) {\n\t if (reverse) {\n\t return this.reverse().__iterator(type);\n\t }\n\t var iterations = 0;\n\t var node = this._head;\n\t return new Iterator(function() {\n\t if (node) {\n\t var value = node.value;\n\t node = node.next;\n\t return iteratorValue(type, iterations++, value);\n\t }\n\t return iteratorDone();\n\t });\n\t };\n\t\n\t\n\t function isStack(maybeStack) {\n\t return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]);\n\t }\n\t\n\t Stack.isStack = isStack;\n\t\n\t var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';\n\t\n\t var StackPrototype = Stack.prototype;\n\t StackPrototype[IS_STACK_SENTINEL] = true;\n\t StackPrototype.withMutations = MapPrototype.withMutations;\n\t StackPrototype.asMutable = MapPrototype.asMutable;\n\t StackPrototype.asImmutable = MapPrototype.asImmutable;\n\t StackPrototype.wasAltered = MapPrototype.wasAltered;\n\t\n\t\n\t function makeStack(size, head, ownerID, hash) {\n\t var map = Object.create(StackPrototype);\n\t map.size = size;\n\t map._head = head;\n\t map.__ownerID = ownerID;\n\t map.__hash = hash;\n\t map.__altered = false;\n\t return map;\n\t }\n\t\n\t var EMPTY_STACK;\n\t function emptyStack() {\n\t return EMPTY_STACK || (EMPTY_STACK = makeStack(0));\n\t }\n\t\n\t /**\n\t * Contributes additional methods to a constructor\n\t */\n\t function mixin(ctor, methods) {\n\t var keyCopier = function(key ) { ctor.prototype[key] = methods[key]; };\n\t Object.keys(methods).forEach(keyCopier);\n\t Object.getOwnPropertySymbols &&\n\t Object.getOwnPropertySymbols(methods).forEach(keyCopier);\n\t return ctor;\n\t }\n\t\n\t Iterable.Iterator = Iterator;\n\t\n\t mixin(Iterable, {\n\t\n\t // ### Conversion to other types\n\t\n\t toArray: function() {\n\t assertNotInfinite(this.size);\n\t var array = new Array(this.size || 0);\n\t this.valueSeq().__iterate(function(v, i) { array[i] = v; });\n\t return array;\n\t },\n\t\n\t toIndexedSeq: function() {\n\t return new ToIndexedSequence(this);\n\t },\n\t\n\t toJS: function() {\n\t return this.toSeq().map(\n\t function(value ) {return value && typeof value.toJS === 'function' ? value.toJS() : value}\n\t ).__toJS();\n\t },\n\t\n\t toJSON: function() {\n\t return this.toSeq().map(\n\t function(value ) {return value && typeof value.toJSON === 'function' ? value.toJSON() : value}\n\t ).__toJS();\n\t },\n\t\n\t toKeyedSeq: function() {\n\t return new ToKeyedSequence(this, true);\n\t },\n\t\n\t toMap: function() {\n\t // Use Late Binding here to solve the circular dependency.\n\t return Map(this.toKeyedSeq());\n\t },\n\t\n\t toObject: function() {\n\t assertNotInfinite(this.size);\n\t var object = {};\n\t this.__iterate(function(v, k) { object[k] = v; });\n\t return object;\n\t },\n\t\n\t toOrderedMap: function() {\n\t // Use Late Binding here to solve the circular dependency.\n\t return OrderedMap(this.toKeyedSeq());\n\t },\n\t\n\t toOrderedSet: function() {\n\t // Use Late Binding here to solve the circular dependency.\n\t return OrderedSet(isKeyed(this) ? this.valueSeq() : this);\n\t },\n\t\n\t toSet: function() {\n\t // Use Late Binding here to solve the circular dependency.\n\t return Set(isKeyed(this) ? this.valueSeq() : this);\n\t },\n\t\n\t toSetSeq: function() {\n\t return new ToSetSequence(this);\n\t },\n\t\n\t toSeq: function() {\n\t return isIndexed(this) ? this.toIndexedSeq() :\n\t isKeyed(this) ? this.toKeyedSeq() :\n\t this.toSetSeq();\n\t },\n\t\n\t toStack: function() {\n\t // Use Late Binding here to solve the circular dependency.\n\t return Stack(isKeyed(this) ? this.valueSeq() : this);\n\t },\n\t\n\t toList: function() {\n\t // Use Late Binding here to solve the circular dependency.\n\t return List(isKeyed(this) ? this.valueSeq() : this);\n\t },\n\t\n\t\n\t // ### Common JavaScript methods and properties\n\t\n\t toString: function() {\n\t return '[Iterable]';\n\t },\n\t\n\t __toString: function(head, tail) {\n\t if (this.size === 0) {\n\t return head + tail;\n\t }\n\t return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail;\n\t },\n\t\n\t\n\t // ### ES6 Collection methods (ES6 Array and Map)\n\t\n\t concat: function() {var values = SLICE$0.call(arguments, 0);\n\t return reify(this, concatFactory(this, values));\n\t },\n\t\n\t includes: function(searchValue) {\n\t return this.some(function(value ) {return is(value, searchValue)});\n\t },\n\t\n\t entries: function() {\n\t return this.__iterator(ITERATE_ENTRIES);\n\t },\n\t\n\t every: function(predicate, context) {\n\t assertNotInfinite(this.size);\n\t var returnValue = true;\n\t this.__iterate(function(v, k, c) {\n\t if (!predicate.call(context, v, k, c)) {\n\t returnValue = false;\n\t return false;\n\t }\n\t });\n\t return returnValue;\n\t },\n\t\n\t filter: function(predicate, context) {\n\t return reify(this, filterFactory(this, predicate, context, true));\n\t },\n\t\n\t find: function(predicate, context, notSetValue) {\n\t var entry = this.findEntry(predicate, context);\n\t return entry ? entry[1] : notSetValue;\n\t },\n\t\n\t forEach: function(sideEffect, context) {\n\t assertNotInfinite(this.size);\n\t return this.__iterate(context ? sideEffect.bind(context) : sideEffect);\n\t },\n\t\n\t join: function(separator) {\n\t assertNotInfinite(this.size);\n\t separator = separator !== undefined ? '' + separator : ',';\n\t var joined = '';\n\t var isFirst = true;\n\t this.__iterate(function(v ) {\n\t isFirst ? (isFirst = false) : (joined += separator);\n\t joined += v !== null && v !== undefined ? v.toString() : '';\n\t });\n\t return joined;\n\t },\n\t\n\t keys: function() {\n\t return this.__iterator(ITERATE_KEYS);\n\t },\n\t\n\t map: function(mapper, context) {\n\t return reify(this, mapFactory(this, mapper, context));\n\t },\n\t\n\t reduce: function(reducer, initialReduction, context) {\n\t assertNotInfinite(this.size);\n\t var reduction;\n\t var useFirst;\n\t if (arguments.length < 2) {\n\t useFirst = true;\n\t } else {\n\t reduction = initialReduction;\n\t }\n\t this.__iterate(function(v, k, c) {\n\t if (useFirst) {\n\t useFirst = false;\n\t reduction = v;\n\t } else {\n\t reduction = reducer.call(context, reduction, v, k, c);\n\t }\n\t });\n\t return reduction;\n\t },\n\t\n\t reduceRight: function(reducer, initialReduction, context) {\n\t var reversed = this.toKeyedSeq().reverse();\n\t return reversed.reduce.apply(reversed, arguments);\n\t },\n\t\n\t reverse: function() {\n\t return reify(this, reverseFactory(this, true));\n\t },\n\t\n\t slice: function(begin, end) {\n\t return reify(this, sliceFactory(this, begin, end, true));\n\t },\n\t\n\t some: function(predicate, context) {\n\t return !this.every(not(predicate), context);\n\t },\n\t\n\t sort: function(comparator) {\n\t return reify(this, sortFactory(this, comparator));\n\t },\n\t\n\t values: function() {\n\t return this.__iterator(ITERATE_VALUES);\n\t },\n\t\n\t\n\t // ### More sequential methods\n\t\n\t butLast: function() {\n\t return this.slice(0, -1);\n\t },\n\t\n\t isEmpty: function() {\n\t return this.size !== undefined ? this.size === 0 : !this.some(function() {return true});\n\t },\n\t\n\t count: function(predicate, context) {\n\t return ensureSize(\n\t predicate ? this.toSeq().filter(predicate, context) : this\n\t );\n\t },\n\t\n\t countBy: function(grouper, context) {\n\t return countByFactory(this, grouper, context);\n\t },\n\t\n\t equals: function(other) {\n\t return deepEqual(this, other);\n\t },\n\t\n\t entrySeq: function() {\n\t var iterable = this;\n\t if (iterable._cache) {\n\t // We cache as an entries array, so we can just return the cache!\n\t return new ArraySeq(iterable._cache);\n\t }\n\t var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq();\n\t entriesSequence.fromEntrySeq = function() {return iterable.toSeq()};\n\t return entriesSequence;\n\t },\n\t\n\t filterNot: function(predicate, context) {\n\t return this.filter(not(predicate), context);\n\t },\n\t\n\t findEntry: function(predicate, context, notSetValue) {\n\t var found = notSetValue;\n\t this.__iterate(function(v, k, c) {\n\t if (predicate.call(context, v, k, c)) {\n\t found = [k, v];\n\t return false;\n\t }\n\t });\n\t return found;\n\t },\n\t\n\t findKey: function(predicate, context) {\n\t var entry = this.findEntry(predicate, context);\n\t return entry && entry[0];\n\t },\n\t\n\t findLast: function(predicate, context, notSetValue) {\n\t return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);\n\t },\n\t\n\t findLastEntry: function(predicate, context, notSetValue) {\n\t return this.toKeyedSeq().reverse().findEntry(predicate, context, notSetValue);\n\t },\n\t\n\t findLastKey: function(predicate, context) {\n\t return this.toKeyedSeq().reverse().findKey(predicate, context);\n\t },\n\t\n\t first: function() {\n\t return this.find(returnTrue);\n\t },\n\t\n\t flatMap: function(mapper, context) {\n\t return reify(this, flatMapFactory(this, mapper, context));\n\t },\n\t\n\t flatten: function(depth) {\n\t return reify(this, flattenFactory(this, depth, true));\n\t },\n\t\n\t fromEntrySeq: function() {\n\t return new FromEntriesSequence(this);\n\t },\n\t\n\t get: function(searchKey, notSetValue) {\n\t return this.find(function(_, key) {return is(key, searchKey)}, undefined, notSetValue);\n\t },\n\t\n\t getIn: function(searchKeyPath, notSetValue) {\n\t var nested = this;\n\t // Note: in an ES6 environment, we would prefer:\n\t // for (var key of searchKeyPath) {\n\t var iter = forceIterator(searchKeyPath);\n\t var step;\n\t while (!(step = iter.next()).done) {\n\t var key = step.value;\n\t nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET;\n\t if (nested === NOT_SET) {\n\t return notSetValue;\n\t }\n\t }\n\t return nested;\n\t },\n\t\n\t groupBy: function(grouper, context) {\n\t return groupByFactory(this, grouper, context);\n\t },\n\t\n\t has: function(searchKey) {\n\t return this.get(searchKey, NOT_SET) !== NOT_SET;\n\t },\n\t\n\t hasIn: function(searchKeyPath) {\n\t return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET;\n\t },\n\t\n\t isSubset: function(iter) {\n\t iter = typeof iter.includes === 'function' ? iter : Iterable(iter);\n\t return this.every(function(value ) {return iter.includes(value)});\n\t },\n\t\n\t isSuperset: function(iter) {\n\t iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter);\n\t return iter.isSubset(this);\n\t },\n\t\n\t keyOf: function(searchValue) {\n\t return this.findKey(function(value ) {return is(value, searchValue)});\n\t },\n\t\n\t keySeq: function() {\n\t return this.toSeq().map(keyMapper).toIndexedSeq();\n\t },\n\t\n\t last: function() {\n\t return this.toSeq().reverse().first();\n\t },\n\t\n\t lastKeyOf: function(searchValue) {\n\t return this.toKeyedSeq().reverse().keyOf(searchValue);\n\t },\n\t\n\t max: function(comparator) {\n\t return maxFactory(this, comparator);\n\t },\n\t\n\t maxBy: function(mapper, comparator) {\n\t return maxFactory(this, comparator, mapper);\n\t },\n\t\n\t min: function(comparator) {\n\t return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator);\n\t },\n\t\n\t minBy: function(mapper, comparator) {\n\t return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper);\n\t },\n\t\n\t rest: function() {\n\t return this.slice(1);\n\t },\n\t\n\t skip: function(amount) {\n\t return this.slice(Math.max(0, amount));\n\t },\n\t\n\t skipLast: function(amount) {\n\t return reify(this, this.toSeq().reverse().skip(amount).reverse());\n\t },\n\t\n\t skipWhile: function(predicate, context) {\n\t return reify(this, skipWhileFactory(this, predicate, context, true));\n\t },\n\t\n\t skipUntil: function(predicate, context) {\n\t return this.skipWhile(not(predicate), context);\n\t },\n\t\n\t sortBy: function(mapper, comparator) {\n\t return reify(this, sortFactory(this, comparator, mapper));\n\t },\n\t\n\t take: function(amount) {\n\t return this.slice(0, Math.max(0, amount));\n\t },\n\t\n\t takeLast: function(amount) {\n\t return reify(this, this.toSeq().reverse().take(amount).reverse());\n\t },\n\t\n\t takeWhile: function(predicate, context) {\n\t return reify(this, takeWhileFactory(this, predicate, context));\n\t },\n\t\n\t takeUntil: function(predicate, context) {\n\t return this.takeWhile(not(predicate), context);\n\t },\n\t\n\t valueSeq: function() {\n\t return this.toIndexedSeq();\n\t },\n\t\n\t\n\t // ### Hashable Object\n\t\n\t hashCode: function() {\n\t return this.__hash || (this.__hash = hashIterable(this));\n\t }\n\t\n\t\n\t // ### Internal\n\t\n\t // abstract __iterate(fn, reverse)\n\t\n\t // abstract __iterator(type, reverse)\n\t });\n\t\n\t // var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n\t // var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n\t // var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n\t // var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\t\n\t var IterablePrototype = Iterable.prototype;\n\t IterablePrototype[IS_ITERABLE_SENTINEL] = true;\n\t IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values;\n\t IterablePrototype.__toJS = IterablePrototype.toArray;\n\t IterablePrototype.__toStringMapper = quoteString;\n\t IterablePrototype.inspect =\n\t IterablePrototype.toSource = function() { return this.toString(); };\n\t IterablePrototype.chain = IterablePrototype.flatMap;\n\t IterablePrototype.contains = IterablePrototype.includes;\n\t\n\t mixin(KeyedIterable, {\n\t\n\t // ### More sequential methods\n\t\n\t flip: function() {\n\t return reify(this, flipFactory(this));\n\t },\n\t\n\t mapEntries: function(mapper, context) {var this$0 = this;\n\t var iterations = 0;\n\t return reify(this,\n\t this.toSeq().map(\n\t function(v, k) {return mapper.call(context, [k, v], iterations++, this$0)}\n\t ).fromEntrySeq()\n\t );\n\t },\n\t\n\t mapKeys: function(mapper, context) {var this$0 = this;\n\t return reify(this,\n\t this.toSeq().flip().map(\n\t function(k, v) {return mapper.call(context, k, v, this$0)}\n\t ).flip()\n\t );\n\t }\n\t\n\t });\n\t\n\t var KeyedIterablePrototype = KeyedIterable.prototype;\n\t KeyedIterablePrototype[IS_KEYED_SENTINEL] = true;\n\t KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries;\n\t KeyedIterablePrototype.__toJS = IterablePrototype.toObject;\n\t KeyedIterablePrototype.__toStringMapper = function(v, k) {return JSON.stringify(k) + ': ' + quoteString(v)};\n\t\n\t\n\t\n\t mixin(IndexedIterable, {\n\t\n\t // ### Conversion to other types\n\t\n\t toKeyedSeq: function() {\n\t return new ToKeyedSequence(this, false);\n\t },\n\t\n\t\n\t // ### ES6 Collection methods (ES6 Array and Map)\n\t\n\t filter: function(predicate, context) {\n\t return reify(this, filterFactory(this, predicate, context, false));\n\t },\n\t\n\t findIndex: function(predicate, context) {\n\t var entry = this.findEntry(predicate, context);\n\t return entry ? entry[0] : -1;\n\t },\n\t\n\t indexOf: function(searchValue) {\n\t var key = this.keyOf(searchValue);\n\t return key === undefined ? -1 : key;\n\t },\n\t\n\t lastIndexOf: function(searchValue) {\n\t var key = this.lastKeyOf(searchValue);\n\t return key === undefined ? -1 : key;\n\t },\n\t\n\t reverse: function() {\n\t return reify(this, reverseFactory(this, false));\n\t },\n\t\n\t slice: function(begin, end) {\n\t return reify(this, sliceFactory(this, begin, end, false));\n\t },\n\t\n\t splice: function(index, removeNum /*, ...values*/) {\n\t var numArgs = arguments.length;\n\t removeNum = Math.max(removeNum | 0, 0);\n\t if (numArgs === 0 || (numArgs === 2 && !removeNum)) {\n\t return this;\n\t }\n\t // If index is negative, it should resolve relative to the size of the\n\t // collection. However size may be expensive to compute if not cached, so\n\t // only call count() if the number is in fact negative.\n\t index = resolveBegin(index, index < 0 ? this.count() : this.size);\n\t var spliced = this.slice(0, index);\n\t return reify(\n\t this,\n\t numArgs === 1 ?\n\t spliced :\n\t spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum))\n\t );\n\t },\n\t\n\t\n\t // ### More collection methods\n\t\n\t findLastIndex: function(predicate, context) {\n\t var entry = this.findLastEntry(predicate, context);\n\t return entry ? entry[0] : -1;\n\t },\n\t\n\t first: function() {\n\t return this.get(0);\n\t },\n\t\n\t flatten: function(depth) {\n\t return reify(this, flattenFactory(this, depth, false));\n\t },\n\t\n\t get: function(index, notSetValue) {\n\t index = wrapIndex(this, index);\n\t return (index < 0 || (this.size === Infinity ||\n\t (this.size !== undefined && index > this.size))) ?\n\t notSetValue :\n\t this.find(function(_, key) {return key === index}, undefined, notSetValue);\n\t },\n\t\n\t has: function(index) {\n\t index = wrapIndex(this, index);\n\t return index >= 0 && (this.size !== undefined ?\n\t this.size === Infinity || index < this.size :\n\t this.indexOf(index) !== -1\n\t );\n\t },\n\t\n\t interpose: function(separator) {\n\t return reify(this, interposeFactory(this, separator));\n\t },\n\t\n\t interleave: function(/*...iterables*/) {\n\t var iterables = [this].concat(arrCopy(arguments));\n\t var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables);\n\t var interleaved = zipped.flatten(true);\n\t if (zipped.size) {\n\t interleaved.size = zipped.size * iterables.length;\n\t }\n\t return reify(this, interleaved);\n\t },\n\t\n\t keySeq: function() {\n\t return Range(0, this.size);\n\t },\n\t\n\t last: function() {\n\t return this.get(-1);\n\t },\n\t\n\t skipWhile: function(predicate, context) {\n\t return reify(this, skipWhileFactory(this, predicate, context, false));\n\t },\n\t\n\t zip: function(/*, ...iterables */) {\n\t var iterables = [this].concat(arrCopy(arguments));\n\t return reify(this, zipWithFactory(this, defaultZipper, iterables));\n\t },\n\t\n\t zipWith: function(zipper/*, ...iterables */) {\n\t var iterables = arrCopy(arguments);\n\t iterables[0] = this;\n\t return reify(this, zipWithFactory(this, zipper, iterables));\n\t }\n\t\n\t });\n\t\n\t IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true;\n\t IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true;\n\t\n\t\n\t\n\t mixin(SetIterable, {\n\t\n\t // ### ES6 Collection methods (ES6 Array and Map)\n\t\n\t get: function(value, notSetValue) {\n\t return this.has(value) ? value : notSetValue;\n\t },\n\t\n\t includes: function(value) {\n\t return this.has(value);\n\t },\n\t\n\t\n\t // ### More sequential methods\n\t\n\t keySeq: function() {\n\t return this.valueSeq();\n\t }\n\t\n\t });\n\t\n\t SetIterable.prototype.has = IterablePrototype.includes;\n\t SetIterable.prototype.contains = SetIterable.prototype.includes;\n\t\n\t\n\t // Mixin subclasses\n\t\n\t mixin(KeyedSeq, KeyedIterable.prototype);\n\t mixin(IndexedSeq, IndexedIterable.prototype);\n\t mixin(SetSeq, SetIterable.prototype);\n\t\n\t mixin(KeyedCollection, KeyedIterable.prototype);\n\t mixin(IndexedCollection, IndexedIterable.prototype);\n\t mixin(SetCollection, SetIterable.prototype);\n\t\n\t\n\t // #pragma Helper functions\n\t\n\t function keyMapper(v, k) {\n\t return k;\n\t }\n\t\n\t function entryMapper(v, k) {\n\t return [k, v];\n\t }\n\t\n\t function not(predicate) {\n\t return function() {\n\t return !predicate.apply(this, arguments);\n\t }\n\t }\n\t\n\t function neg(predicate) {\n\t return function() {\n\t return -predicate.apply(this, arguments);\n\t }\n\t }\n\t\n\t function quoteString(value) {\n\t return typeof value === 'string' ? JSON.stringify(value) : String(value);\n\t }\n\t\n\t function defaultZipper() {\n\t return arrCopy(arguments);\n\t }\n\t\n\t function defaultNegComparator(a, b) {\n\t return a < b ? 1 : a > b ? -1 : 0;\n\t }\n\t\n\t function hashIterable(iterable) {\n\t if (iterable.size === Infinity) {\n\t return 0;\n\t }\n\t var ordered = isOrdered(iterable);\n\t var keyed = isKeyed(iterable);\n\t var h = ordered ? 1 : 0;\n\t var size = iterable.__iterate(\n\t keyed ?\n\t ordered ?\n\t function(v, k) { h = 31 * h + hashMerge(hash(v), hash(k)) | 0; } :\n\t function(v, k) { h = h + hashMerge(hash(v), hash(k)) | 0; } :\n\t ordered ?\n\t function(v ) { h = 31 * h + hash(v) | 0; } :\n\t function(v ) { h = h + hash(v) | 0; }\n\t );\n\t return murmurHashOfSize(size, h);\n\t }\n\t\n\t function murmurHashOfSize(size, h) {\n\t h = imul(h, 0xCC9E2D51);\n\t h = imul(h << 15 | h >>> -15, 0x1B873593);\n\t h = imul(h << 13 | h >>> -13, 5);\n\t h = (h + 0xE6546B64 | 0) ^ size;\n\t h = imul(h ^ h >>> 16, 0x85EBCA6B);\n\t h = imul(h ^ h >>> 13, 0xC2B2AE35);\n\t h = smi(h ^ h >>> 16);\n\t return h;\n\t }\n\t\n\t function hashMerge(a, b) {\n\t return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int\n\t }\n\t\n\t var Immutable = {\n\t\n\t Iterable: Iterable,\n\t\n\t Seq: Seq,\n\t Collection: Collection,\n\t Map: Map,\n\t OrderedMap: OrderedMap,\n\t List: List,\n\t Stack: Stack,\n\t Set: Set,\n\t OrderedSet: OrderedSet,\n\t\n\t Record: Record,\n\t Range: Range,\n\t Repeat: Repeat,\n\t\n\t is: is,\n\t fromJS: fromJS\n\t\n\t };\n\t\n\t return Immutable;\n\t\n\t}));\n\n/***/ },\n/* 4 */\n/*!**********************!*\\\n !*** ./src/utils.js ***!\n \\**********************/\n/***/ function(module, exports) {\n\n\t/**\n\t * Checks if the passed in value is a string\n\t * @param {*} val\n\t * @return {boolean}\n\t */\n\t'use strict';\n\t\n\tvar _bind = Function.prototype.bind;\n\texports.isString = function (val) {\n\t return typeof val === 'string' || objectToString(val) === '[object String]';\n\t};\n\t\n\t/**\n\t * Checks if the passed in value is an array\n\t * @param {*} val\n\t * @return {boolean}\n\t */\n\texports.isArray = Array.isArray /* istanbul ignore next */ || function (val) {\n\t return objectToString(val) === '[object Array]';\n\t};\n\t\n\t// taken from underscore source to account for browser discrepancy\n\t/* istanbul ignore if */\n\tif (typeof /./ !== 'function' && typeof Int8Array !== 'object') {\n\t /**\n\t * Checks if the passed in value is a function\n\t * @param {*} val\n\t * @return {boolean}\n\t */\n\t exports.isFunction = function (obj) {\n\t return typeof obj === 'function' || false;\n\t };\n\t} else {\n\t /**\n\t * Checks if the passed in value is a function\n\t * @param {*} val\n\t * @return {boolean}\n\t */\n\t exports.isFunction = function (val) {\n\t return toString.call(val) === '[object Function]';\n\t };\n\t}\n\t\n\t/**\n\t * Checks if the passed in value is of type Object\n\t * @param {*} val\n\t * @return {boolean}\n\t */\n\texports.isObject = function (obj) {\n\t var type = typeof obj;\n\t return type === 'function' || type === 'object' && !!obj;\n\t};\n\t\n\t/**\n\t * Extends an object with the properties of additional objects\n\t * @param {object} obj\n\t * @param {object} objects\n\t * @return {object}\n\t */\n\texports.extend = function (obj) {\n\t var length = arguments.length;\n\t\n\t if (!obj || length < 2) {\n\t return obj || {};\n\t }\n\t\n\t for (var index = 1; index < length; index++) {\n\t var source = arguments[index];\n\t var keys = Object.keys(source);\n\t var l = keys.length;\n\t\n\t for (var i = 0; i < l; i++) {\n\t var key = keys[i];\n\t obj[key] = source[key];\n\t }\n\t }\n\t\n\t return obj;\n\t};\n\t\n\t/**\n\t * Creates a shallow clone of an object\n\t * @param {object} obj\n\t * @return {object}\n\t */\n\texports.clone = function (obj) {\n\t if (!exports.isObject(obj)) {\n\t return obj;\n\t }\n\t return exports.isArray(obj) ? obj.slice() : exports.extend({}, obj);\n\t};\n\t\n\t/**\n\t * Iterates over a collection of elements yielding each iteration to an\n\t * iteratee. The iteratee may be bound to the context argument and is invoked\n\t * each time with three arguments (value, index|key, collection). Iteration may\n\t * be exited early by explicitly returning false.\n\t * @param {array|object|string} collection\n\t * @param {function} iteratee\n\t * @param {*} context\n\t * @return {array|object|string}\n\t */\n\texports.each = function (collection, iteratee, context) {\n\t var length = collection ? collection.length : 0;\n\t var i = -1;\n\t var keys;\n\t var origIteratee;\n\t\n\t if (context) {\n\t origIteratee = iteratee;\n\t iteratee = function (value, index, innerCollection) {\n\t return origIteratee.call(context, value, index, innerCollection);\n\t };\n\t }\n\t\n\t if (isLength(length)) {\n\t while (++i < length) {\n\t if (iteratee(collection[i], i, collection) === false) {\n\t break;\n\t }\n\t }\n\t } else {\n\t keys = Object.keys(collection);\n\t length = keys.length;\n\t while (++i < length) {\n\t if (iteratee(collection[keys[i]], keys[i], collection) === false) {\n\t break;\n\t }\n\t }\n\t }\n\t\n\t return collection;\n\t};\n\t\n\t/**\n\t * Returns a new function the invokes `func` with `partialArgs` prepended to\n\t * any passed into the new function. Acts like `Array.prototype.bind`, except\n\t * it does not alter `this` context.\n\t * @param {function} func\n\t * @param {*} partialArgs\n\t * @return {function}\n\t */\n\texports.partial = function (func) {\n\t var slice = Array.prototype.slice;\n\t var partialArgs = slice.call(arguments, 1);\n\t\n\t return function () {\n\t return func.apply(this, partialArgs.concat(slice.call(arguments)));\n\t };\n\t};\n\t\n\t/**\n\t * Returns a factory method that allows construction with or without `new`\n\t */\n\texports.toFactory = function (Klass) {\n\t var Factory = function Factory() {\n\t for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n\t args[_key] = arguments[_key];\n\t }\n\t\n\t return new (_bind.apply(Klass, [null].concat(args)))();\n\t };\n\t\n\t Factory.__proto__ = Klass; // eslint-disable-line no-proto\n\t Factory.prototype = Klass.prototype;\n\t return Factory;\n\t};\n\t\n\t/**\n\t * Returns the text value representation of an object\n\t * @private\n\t * @param {*} obj\n\t * @return {string}\n\t */\n\tfunction objectToString(obj) {\n\t return obj && typeof obj === 'object' && toString.call(obj);\n\t}\n\t\n\t/**\n\t * Checks if the value is a valid array-like length.\n\t * @private\n\t * @param {*} val\n\t * @return {bool}\n\t */\n\tfunction isLength(val) {\n\t return typeof val === 'number' && val > -1 && val % 1 === 0 && val <= Number.MAX_VALUE;\n\t}\n\n/***/ },\n/* 5 */\n/*!**********************************!*\\\n !*** ./src/immutable-helpers.js ***!\n \\**********************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\texports.isImmutable = isImmutable;\n\texports.isImmutableValue = isImmutableValue;\n\texports.toJS = toJS;\n\texports.toImmutable = toImmutable;\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _immutable = __webpack_require__(/*! immutable */ 3);\n\t\n\tvar _immutable2 = _interopRequireDefault(_immutable);\n\t\n\tvar _utils = __webpack_require__(/*! ./utils */ 4);\n\t\n\t/**\n\t * A collection of helpers for the ImmutableJS library\n\t */\n\t\n\t/**\n\t * @param {*} obj\n\t * @return {boolean}\n\t */\n\t\n\tfunction isImmutable(obj) {\n\t return _immutable2['default'].Iterable.isIterable(obj);\n\t}\n\t\n\t/**\n\t * Returns true if the value is an ImmutableJS data structure\n\t * or a JavaScript primitive that is immutable (string, number, etc)\n\t * @param {*} obj\n\t * @return {boolean}\n\t */\n\t\n\tfunction isImmutableValue(obj) {\n\t return isImmutable(obj) || !(0, _utils.isObject)(obj);\n\t}\n\t\n\t/**\n\t * Converts an Immutable Sequence to JS object\n\t * Can be called on any type\n\t */\n\t\n\tfunction toJS(arg) {\n\t // arg instanceof Immutable.Sequence is unreliable\n\t return isImmutable(arg) ? arg.toJS() : arg;\n\t}\n\t\n\t/**\n\t * Converts a JS object to an Immutable object, if it's\n\t * already Immutable its a no-op\n\t */\n\t\n\tfunction toImmutable(arg) {\n\t return isImmutable(arg) ? arg : _immutable2['default'].fromJS(arg);\n\t}\n\n/***/ },\n/* 6 */\n/*!************************!*\\\n !*** ./src/reactor.js ***!\n \\************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _immutable = __webpack_require__(/*! immutable */ 3);\n\t\n\tvar _immutable2 = _interopRequireDefault(_immutable);\n\t\n\tvar _createReactMixin = __webpack_require__(/*! ./create-react-mixin */ 7);\n\t\n\tvar _createReactMixin2 = _interopRequireDefault(_createReactMixin);\n\t\n\tvar _reactorFns = __webpack_require__(/*! ./reactor/fns */ 8);\n\t\n\tvar fns = _interopRequireWildcard(_reactorFns);\n\t\n\tvar _reactorCache = __webpack_require__(/*! ./reactor/cache */ 9);\n\t\n\tvar _logging = __webpack_require__(/*! ./logging */ 12);\n\t\n\tvar _keyPath = __webpack_require__(/*! ./key-path */ 11);\n\t\n\tvar _getter = __webpack_require__(/*! ./getter */ 10);\n\t\n\tvar _immutableHelpers = __webpack_require__(/*! ./immutable-helpers */ 5);\n\t\n\tvar _utils = __webpack_require__(/*! ./utils */ 4);\n\t\n\tvar _reactorRecords = __webpack_require__(/*! ./reactor/records */ 13);\n\t\n\t/**\n\t * State is stored in NuclearJS Reactors. Reactors\n\t * contain a 'state' object which is an Immutable.Map\n\t *\n\t * The only way Reactors can change state is by reacting to\n\t * messages. To update state, Reactor's dispatch messages to\n\t * all registered cores, and the core returns it's new\n\t * state based on the message\n\t */\n\t\n\tvar Reactor = (function () {\n\t function Reactor() {\n\t var config = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\t\n\t _classCallCheck(this, Reactor);\n\t\n\t var debug = !!config.debug;\n\t var baseOptions = debug ? _reactorRecords.DEBUG_OPTIONS : _reactorRecords.PROD_OPTIONS;\n\t // if defined, merge the custom implementation over the noop logger to avoid undefined lookups,\n\t // otherwise, just use the built-in console group logger\n\t var logger = config.logger ? (0, _utils.extend)({}, _logging.NoopLogger, config.logger) : _logging.NoopLogger;\n\t if (!config.logger && debug) {\n\t logger = _logging.ConsoleGroupLogger;\n\t }\n\t var initialReactorState = new _reactorRecords.ReactorState({\n\t debug: debug,\n\t cache: config.cache || (0, _reactorCache.DefaultCache)(),\n\t logger: logger,\n\t // merge config options with the defaults\n\t options: baseOptions.merge(config.options || {})\n\t });\n\t\n\t this.prevReactorState = initialReactorState;\n\t this.reactorState = initialReactorState;\n\t this.observerState = new _reactorRecords.ObserverState();\n\t\n\t this.ReactMixin = (0, _createReactMixin2['default'])(this);\n\t\n\t // keep track of the depth of batch nesting\n\t this.__batchDepth = 0;\n\t\n\t // keep track if we are currently dispatching\n\t this.__isDispatching = false;\n\t }\n\t\n\t /**\n\t * Evaluates a KeyPath or Getter in context of the reactor state\n\t * @param {KeyPath|Getter} keyPathOrGetter\n\t * @return {*}\n\t */\n\t\n\t _createClass(Reactor, [{\n\t key: 'evaluate',\n\t value: function evaluate(keyPathOrGetter) {\n\t var _fns$evaluate = fns.evaluate(this.reactorState, keyPathOrGetter);\n\t\n\t var result = _fns$evaluate.result;\n\t var reactorState = _fns$evaluate.reactorState;\n\t\n\t this.reactorState = reactorState;\n\t return result;\n\t }\n\t\n\t /**\n\t * Gets the coerced state (to JS object) of the reactor.evaluate\n\t * @param {KeyPath|Getter} keyPathOrGetter\n\t * @return {*}\n\t */\n\t }, {\n\t key: 'evaluateToJS',\n\t value: function evaluateToJS(keyPathOrGetter) {\n\t return (0, _immutableHelpers.toJS)(this.evaluate(keyPathOrGetter));\n\t }\n\t\n\t /**\n\t * Adds a change observer whenever a certain part of the reactor state changes\n\t *\n\t * 1. observe(handlerFn) - 1 argument, called anytime reactor.state changes\n\t * 2. observe(keyPath, handlerFn) same as above\n\t * 3. observe(getter, handlerFn) called whenever any getter dependencies change with\n\t * the value of the getter\n\t *\n\t * Adds a change handler whenever certain deps change\n\t * If only one argument is passed invoked the handler whenever\n\t * the reactor state changes\n\t *\n\t * @param {KeyPath|Getter} getter\n\t * @param {function} handler\n\t * @return {function} unwatch function\n\t */\n\t }, {\n\t key: 'observe',\n\t value: function observe(getter, handler) {\n\t var _this = this;\n\t\n\t if (arguments.length === 1) {\n\t handler = getter;\n\t getter = [];\n\t }\n\t\n\t var _fns$addObserver = fns.addObserver(this.observerState, getter, handler);\n\t\n\t var observerState = _fns$addObserver.observerState;\n\t var entry = _fns$addObserver.entry;\n\t\n\t this.observerState = observerState;\n\t return function () {\n\t _this.observerState = fns.removeObserverByEntry(_this.observerState, entry);\n\t };\n\t }\n\t }, {\n\t key: 'unobserve',\n\t value: function unobserve(getter, handler) {\n\t if (arguments.length === 0) {\n\t throw new Error('Must call unobserve with a Getter');\n\t }\n\t if (!(0, _getter.isGetter)(getter) && !(0, _keyPath.isKeyPath)(getter)) {\n\t throw new Error('Must call unobserve with a Getter');\n\t }\n\t\n\t this.observerState = fns.removeObserver(this.observerState, getter, handler);\n\t }\n\t\n\t /**\n\t * Dispatches a single message\n\t * @param {string} actionType\n\t * @param {object|undefined} payload\n\t */\n\t }, {\n\t key: 'dispatch',\n\t value: function dispatch(actionType, payload) {\n\t if (this.__batchDepth === 0) {\n\t if (fns.getOption(this.reactorState, 'throwOnDispatchInDispatch')) {\n\t if (this.__isDispatching) {\n\t this.__isDispatching = false;\n\t throw new Error('Dispatch may not be called while a dispatch is in progress');\n\t }\n\t }\n\t this.__isDispatching = true;\n\t }\n\t\n\t try {\n\t this.reactorState = fns.dispatch(this.reactorState, actionType, payload);\n\t } catch (e) {\n\t this.__isDispatching = false;\n\t throw e;\n\t }\n\t\n\t try {\n\t this.__notify();\n\t } finally {\n\t this.__isDispatching = false;\n\t }\n\t }\n\t\n\t /**\n\t * Allows batching of dispatches before notifying change observers\n\t * @param {Function} fn\n\t */\n\t }, {\n\t key: 'batch',\n\t value: function batch(fn) {\n\t this.batchStart();\n\t fn();\n\t this.batchEnd();\n\t }\n\t\n\t /**\n\t * @deprecated\n\t * @param {String} id\n\t * @param {Store} store\n\t */\n\t }, {\n\t key: 'registerStore',\n\t value: function registerStore(id, store) {\n\t /* eslint-disable no-console */\n\t console.warn('Deprecation warning: `registerStore` will no longer be supported in 1.1, use `registerStores` instead');\n\t /* eslint-enable no-console */\n\t this.registerStores(_defineProperty({}, id, store));\n\t }\n\t\n\t /**\n\t * @param {Object} stores\n\t */\n\t }, {\n\t key: 'registerStores',\n\t value: function registerStores(stores) {\n\t this.reactorState = fns.registerStores(this.reactorState, stores);\n\t this.__notify();\n\t }\n\t\n\t /**\n\t * Replace store implementation (handlers) without modifying the app state or calling getInitialState\n\t * Useful for hot reloading\n\t * @param {Object} stores\n\t */\n\t }, {\n\t key: 'replaceStores',\n\t value: function replaceStores(stores) {\n\t this.reactorState = fns.replaceStores(this.reactorState, stores);\n\t }\n\t\n\t /**\n\t * Returns a plain object representing the application state\n\t * @return {Object}\n\t */\n\t }, {\n\t key: 'serialize',\n\t value: function serialize() {\n\t return fns.serialize(this.reactorState);\n\t }\n\t\n\t /**\n\t * @param {Object} state\n\t */\n\t }, {\n\t key: 'loadState',\n\t value: function loadState(state) {\n\t this.reactorState = fns.loadState(this.reactorState, state);\n\t this.__notify();\n\t }\n\t\n\t /**\n\t * Resets the state of a reactor and returns back to initial state\n\t */\n\t }, {\n\t key: 'reset',\n\t value: function reset() {\n\t var newState = fns.reset(this.reactorState);\n\t this.reactorState = newState;\n\t this.prevReactorState = newState;\n\t this.observerState = new _reactorRecords.ObserverState();\n\t }\n\t\n\t /**\n\t * Notifies all change observers with the current state\n\t * @private\n\t */\n\t }, {\n\t key: '__notify',\n\t value: function __notify() {\n\t var _this2 = this;\n\t\n\t if (this.__batchDepth > 0) {\n\t // in the middle of batch, dont notify\n\t return;\n\t }\n\t\n\t var dirtyStores = this.reactorState.get('dirtyStores');\n\t if (dirtyStores.size === 0) {\n\t return;\n\t }\n\t\n\t var observerIdsToNotify = _immutable2['default'].Set().withMutations(function (set) {\n\t // notify all observers\n\t set.union(_this2.observerState.get('any'));\n\t\n\t dirtyStores.forEach(function (id) {\n\t var entries = _this2.observerState.getIn(['stores', id]);\n\t if (!entries) {\n\t return;\n\t }\n\t set.union(entries);\n\t });\n\t });\n\t\n\t observerIdsToNotify.forEach(function (observerId) {\n\t var entry = _this2.observerState.getIn(['observersMap', observerId]);\n\t if (!entry) {\n\t // don't notify here in the case a handler called unobserve on another observer\n\t return;\n\t }\n\t\n\t var getter = entry.get('getter');\n\t var handler = entry.get('handler');\n\t\n\t var prevEvaluateResult = fns.evaluate(_this2.prevReactorState, getter);\n\t var currEvaluateResult = fns.evaluate(_this2.reactorState, getter);\n\t\n\t _this2.prevReactorState = prevEvaluateResult.reactorState;\n\t _this2.reactorState = currEvaluateResult.reactorState;\n\t\n\t var prevValue = prevEvaluateResult.result;\n\t var currValue = currEvaluateResult.result;\n\t\n\t if (!_immutable2['default'].is(prevValue, currValue)) {\n\t handler.call(null, currValue);\n\t }\n\t });\n\t\n\t var nextReactorState = fns.resetDirtyStores(this.reactorState);\n\t\n\t this.prevReactorState = nextReactorState;\n\t this.reactorState = nextReactorState;\n\t }\n\t\n\t /**\n\t * Starts batching, ie pausing notifies and batching up changes\n\t * to be notified when batchEnd() is called\n\t */\n\t }, {\n\t key: 'batchStart',\n\t value: function batchStart() {\n\t this.__batchDepth++;\n\t }\n\t\n\t /**\n\t * Ends a batch cycle and will notify obsevers of all changes if\n\t * the batch depth is back to 0 (outer most batch completed)\n\t */\n\t }, {\n\t key: 'batchEnd',\n\t value: function batchEnd() {\n\t this.__batchDepth--;\n\t\n\t if (this.__batchDepth <= 0) {\n\t // set to true to catch if dispatch called from observer\n\t this.__isDispatching = true;\n\t try {\n\t this.__notify();\n\t } catch (e) {\n\t this.__isDispatching = false;\n\t throw e;\n\t }\n\t this.__isDispatching = false;\n\t }\n\t }\n\t }]);\n\t\n\t return Reactor;\n\t})();\n\t\n\texports['default'] = (0, _utils.toFactory)(Reactor);\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 7 */\n/*!***********************************!*\\\n !*** ./src/create-react-mixin.js ***!\n \\***********************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\t\n\tvar _utils = __webpack_require__(/*! ./utils */ 4);\n\t\n\t/**\n\t * Returns a mapping of the getDataBinding keys to\n\t * the reactor values\n\t */\n\tfunction getState(reactor, data) {\n\t var state = {};\n\t (0, _utils.each)(data, function (value, key) {\n\t state[key] = reactor.evaluate(value);\n\t });\n\t return state;\n\t}\n\t\n\t/**\n\t * @param {Reactor} reactor\n\t */\n\t\n\texports['default'] = function (reactor) {\n\t return {\n\t getInitialState: function getInitialState() {\n\t return getState(reactor, this.getDataBindings());\n\t },\n\t\n\t componentDidMount: function componentDidMount() {\n\t var _this = this;\n\t\n\t this.__unwatchFns = [];\n\t (0, _utils.each)(this.getDataBindings(), function (getter, key) {\n\t var unwatchFn = reactor.observe(getter, function (val) {\n\t _this.setState(_defineProperty({}, key, val));\n\t });\n\t\n\t _this.__unwatchFns.push(unwatchFn);\n\t });\n\t },\n\t\n\t componentWillUnmount: function componentWillUnmount() {\n\t while (this.__unwatchFns.length) {\n\t this.__unwatchFns.shift()();\n\t }\n\t }\n\t };\n\t};\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 8 */\n/*!****************************!*\\\n !*** ./src/reactor/fns.js ***!\n \\****************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\texports.registerStores = registerStores;\n\texports.replaceStores = replaceStores;\n\texports.dispatch = dispatch;\n\texports.loadState = loadState;\n\texports.addObserver = addObserver;\n\texports.getOption = getOption;\n\texports.removeObserver = removeObserver;\n\texports.removeObserverByEntry = removeObserverByEntry;\n\texports.reset = reset;\n\texports.evaluate = evaluate;\n\texports.serialize = serialize;\n\texports.resetDirtyStores = resetDirtyStores;\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _immutable = __webpack_require__(/*! immutable */ 3);\n\t\n\tvar _immutable2 = _interopRequireDefault(_immutable);\n\t\n\tvar _cache = __webpack_require__(/*! ./cache */ 9);\n\t\n\tvar _immutableHelpers = __webpack_require__(/*! ../immutable-helpers */ 5);\n\t\n\tvar _getter = __webpack_require__(/*! ../getter */ 10);\n\t\n\tvar _keyPath = __webpack_require__(/*! ../key-path */ 11);\n\t\n\tvar _utils = __webpack_require__(/*! ../utils */ 4);\n\t\n\t/**\n\t * Immutable Types\n\t */\n\tvar EvaluateResult = _immutable2['default'].Record({ result: null, reactorState: null });\n\t\n\tfunction evaluateResult(result, reactorState) {\n\t return new EvaluateResult({\n\t result: result,\n\t reactorState: reactorState\n\t });\n\t}\n\t\n\t/**\n\t * @param {ReactorState} reactorState\n\t * @param {Object} stores\n\t * @return {ReactorState}\n\t */\n\t\n\tfunction registerStores(reactorState, stores) {\n\t return reactorState.withMutations(function (reactorState) {\n\t (0, _utils.each)(stores, function (store, id) {\n\t if (reactorState.getIn(['stores', id])) {\n\t /* eslint-disable no-console */\n\t console.warn('Store already defined for id = ' + id);\n\t /* eslint-enable no-console */\n\t }\n\t\n\t var initialState = store.getInitialState();\n\t\n\t if (initialState === undefined && getOption(reactorState, 'throwOnUndefinedStoreReturnValue')) {\n\t throw new Error('Store getInitialState() must return a value, did you forget a return statement');\n\t }\n\t if (getOption(reactorState, 'throwOnNonImmutableStore') && !(0, _immutableHelpers.isImmutableValue)(initialState)) {\n\t throw new Error('Store getInitialState() must return an immutable value, did you forget to call toImmutable');\n\t }\n\t\n\t reactorState.update('stores', function (stores) {\n\t return stores.set(id, store);\n\t }).update('state', function (state) {\n\t return state.set(id, initialState);\n\t }).update('dirtyStores', function (state) {\n\t return state.add(id);\n\t }).update('storeStates', function (storeStates) {\n\t return incrementStoreStates(storeStates, [id]);\n\t });\n\t });\n\t incrementId(reactorState);\n\t });\n\t}\n\t\n\t/**\n\t * Overrides the store implementation without resetting the value of that particular part of the app state\n\t * this is useful when doing hot reloading of stores.\n\t * @param {ReactorState} reactorState\n\t * @param {Object} stores\n\t * @return {ReactorState}\n\t */\n\t\n\tfunction replaceStores(reactorState, stores) {\n\t return reactorState.withMutations(function (reactorState) {\n\t (0, _utils.each)(stores, function (store, id) {\n\t reactorState.update('stores', function (stores) {\n\t return stores.set(id, store);\n\t });\n\t });\n\t });\n\t}\n\t\n\t/**\n\t * @param {ReactorState} reactorState\n\t * @param {String} actionType\n\t * @param {*} payload\n\t * @return {ReactorState}\n\t */\n\t\n\tfunction dispatch(reactorState, actionType, payload) {\n\t var logging = reactorState.get('logger');\n\t\n\t if (actionType === undefined && getOption(reactorState, 'throwOnUndefinedActionType')) {\n\t throw new Error('`dispatch` cannot be called with an `undefined` action type.');\n\t }\n\t\n\t var currState = reactorState.get('state');\n\t var dirtyStores = reactorState.get('dirtyStores');\n\t\n\t var nextState = currState.withMutations(function (state) {\n\t logging.dispatchStart(reactorState, actionType, payload);\n\t\n\t // let each store handle the message\n\t reactorState.get('stores').forEach(function (store, id) {\n\t var currState = state.get(id);\n\t var newState = undefined;\n\t\n\t try {\n\t newState = store.handle(currState, actionType, payload);\n\t } catch (e) {\n\t // ensure console.group is properly closed\n\t logging.dispatchError(reactorState, e.message);\n\t throw e;\n\t }\n\t\n\t if (newState === undefined && getOption(reactorState, 'throwOnUndefinedStoreReturnValue')) {\n\t var errorMsg = 'Store handler must return a value, did you forget a return statement';\n\t logging.dispatchError(reactorState, errorMsg);\n\t throw new Error(errorMsg);\n\t }\n\t\n\t state.set(id, newState);\n\t\n\t if (currState !== newState) {\n\t // if the store state changed add store to list of dirty stores\n\t dirtyStores = dirtyStores.add(id);\n\t }\n\t });\n\t\n\t logging.dispatchEnd(reactorState, state, dirtyStores, currState);\n\t });\n\t\n\t var nextReactorState = reactorState.set('state', nextState).set('dirtyStores', dirtyStores).update('storeStates', function (storeStates) {\n\t return incrementStoreStates(storeStates, dirtyStores);\n\t });\n\t\n\t return incrementId(nextReactorState);\n\t}\n\t\n\t/**\n\t * @param {ReactorState} reactorState\n\t * @param {Immutable.Map} state\n\t * @return {ReactorState}\n\t */\n\t\n\tfunction loadState(reactorState, state) {\n\t var dirtyStores = [];\n\t var stateToLoad = (0, _immutableHelpers.toImmutable)({}).withMutations(function (stateToLoad) {\n\t (0, _utils.each)(state, function (serializedStoreState, storeId) {\n\t var store = reactorState.getIn(['stores', storeId]);\n\t if (store) {\n\t var storeState = store.deserialize(serializedStoreState);\n\t if (storeState !== undefined) {\n\t stateToLoad.set(storeId, storeState);\n\t dirtyStores.push(storeId);\n\t }\n\t }\n\t });\n\t });\n\t\n\t var dirtyStoresSet = _immutable2['default'].Set(dirtyStores);\n\t return reactorState.update('state', function (state) {\n\t return state.merge(stateToLoad);\n\t }).update('dirtyStores', function (stores) {\n\t return stores.union(dirtyStoresSet);\n\t }).update('storeStates', function (storeStates) {\n\t return incrementStoreStates(storeStates, dirtyStores);\n\t });\n\t}\n\t\n\t/**\n\t * Adds a change observer whenever a certain part of the reactor state changes\n\t *\n\t * 1. observe(handlerFn) - 1 argument, called anytime reactor.state changes\n\t * 2. observe(keyPath, handlerFn) same as above\n\t * 3. observe(getter, handlerFn) called whenever any getter dependencies change with\n\t * the value of the getter\n\t *\n\t * Adds a change handler whenever certain deps change\n\t * If only one argument is passed invoked the handler whenever\n\t * the reactor state changes\n\t *\n\t * @param {ObserverState} observerState\n\t * @param {KeyPath|Getter} getter\n\t * @param {function} handler\n\t * @return {ObserveResult}\n\t */\n\t\n\tfunction addObserver(observerState, getter, handler) {\n\t // use the passed in getter as the key so we can rely on a byreference call for unobserve\n\t var getterKey = getter;\n\t if ((0, _keyPath.isKeyPath)(getter)) {\n\t getter = (0, _getter.fromKeyPath)(getter);\n\t }\n\t\n\t var currId = observerState.get('nextId');\n\t var storeDeps = (0, _getter.getStoreDeps)(getter);\n\t var entry = _immutable2['default'].Map({\n\t id: currId,\n\t storeDeps: storeDeps,\n\t getterKey: getterKey,\n\t getter: getter,\n\t handler: handler\n\t });\n\t\n\t var updatedObserverState = undefined;\n\t if (storeDeps.size === 0) {\n\t // no storeDeps means the observer is dependent on any of the state changing\n\t updatedObserverState = observerState.update('any', function (observerIds) {\n\t return observerIds.add(currId);\n\t });\n\t } else {\n\t updatedObserverState = observerState.withMutations(function (map) {\n\t storeDeps.forEach(function (storeId) {\n\t var path = ['stores', storeId];\n\t if (!map.hasIn(path)) {\n\t map.setIn(path, _immutable2['default'].Set());\n\t }\n\t map.updateIn(['stores', storeId], function (observerIds) {\n\t return observerIds.add(currId);\n\t });\n\t });\n\t });\n\t }\n\t\n\t updatedObserverState = updatedObserverState.set('nextId', currId + 1).setIn(['observersMap', currId], entry);\n\t\n\t return {\n\t observerState: updatedObserverState,\n\t entry: entry\n\t };\n\t}\n\t\n\t/**\n\t * @param {ReactorState} reactorState\n\t * @param {String} option\n\t * @return {Boolean}\n\t */\n\t\n\tfunction getOption(reactorState, option) {\n\t var value = reactorState.getIn(['options', option]);\n\t if (value === undefined) {\n\t throw new Error('Invalid option: ' + option);\n\t }\n\t return value;\n\t}\n\t\n\t/**\n\t * Use cases\n\t * removeObserver(observerState, [])\n\t * removeObserver(observerState, [], handler)\n\t * removeObserver(observerState, ['keyPath'])\n\t * removeObserver(observerState, ['keyPath'], handler)\n\t * removeObserver(observerState, getter)\n\t * removeObserver(observerState, getter, handler)\n\t * @param {ObserverState} observerState\n\t * @param {KeyPath|Getter} getter\n\t * @param {Function} handler\n\t * @return {ObserverState}\n\t */\n\t\n\tfunction removeObserver(observerState, getter, handler) {\n\t var entriesToRemove = observerState.get('observersMap').filter(function (entry) {\n\t // use the getterKey in the case of a keyPath is transformed to a getter in addObserver\n\t var entryGetter = entry.get('getterKey');\n\t var handlersMatch = !handler || entry.get('handler') === handler;\n\t if (!handlersMatch) {\n\t return false;\n\t }\n\t // check for a by-value equality of keypaths\n\t if ((0, _keyPath.isKeyPath)(getter) && (0, _keyPath.isKeyPath)(entryGetter)) {\n\t return (0, _keyPath.isEqual)(getter, entryGetter);\n\t }\n\t // we are comparing two getters do it by reference\n\t return getter === entryGetter;\n\t });\n\t\n\t return observerState.withMutations(function (map) {\n\t entriesToRemove.forEach(function (entry) {\n\t return removeObserverByEntry(map, entry);\n\t });\n\t });\n\t}\n\t\n\t/**\n\t * Removes an observer entry by id from the observerState\n\t * @param {ObserverState} observerState\n\t * @param {Immutable.Map} entry\n\t * @return {ObserverState}\n\t */\n\t\n\tfunction removeObserverByEntry(observerState, entry) {\n\t return observerState.withMutations(function (map) {\n\t var id = entry.get('id');\n\t var storeDeps = entry.get('storeDeps');\n\t\n\t if (storeDeps.size === 0) {\n\t map.update('any', function (anyObsevers) {\n\t return anyObsevers.remove(id);\n\t });\n\t } else {\n\t storeDeps.forEach(function (storeId) {\n\t map.updateIn(['stores', storeId], function (observers) {\n\t if (observers) {\n\t // check for observers being present because reactor.reset() can be called before an unwatch fn\n\t return observers.remove(id);\n\t }\n\t return observers;\n\t });\n\t });\n\t }\n\t\n\t map.removeIn(['observersMap', id]);\n\t });\n\t}\n\t\n\t/**\n\t * @param {ReactorState} reactorState\n\t * @return {ReactorState}\n\t */\n\t\n\tfunction reset(reactorState) {\n\t var prevState = reactorState.get('state');\n\t\n\t return reactorState.withMutations(function (reactorState) {\n\t var storeMap = reactorState.get('stores');\n\t var storeIds = storeMap.keySeq().toJS();\n\t storeMap.forEach(function (store, id) {\n\t var storeState = prevState.get(id);\n\t var resetStoreState = store.handleReset(storeState);\n\t if (resetStoreState === undefined && getOption(reactorState, 'throwOnUndefinedStoreReturnValue')) {\n\t throw new Error('Store handleReset() must return a value, did you forget a return statement');\n\t }\n\t if (getOption(reactorState, 'throwOnNonImmutableStore') && !(0, _immutableHelpers.isImmutableValue)(resetStoreState)) {\n\t throw new Error('Store reset state must be an immutable value, did you forget to call toImmutable');\n\t }\n\t reactorState.setIn(['state', id], resetStoreState);\n\t });\n\t\n\t reactorState.update('storeStates', function (storeStates) {\n\t return incrementStoreStates(storeStates, storeIds);\n\t });\n\t resetDirtyStores(reactorState);\n\t });\n\t}\n\t\n\t/**\n\t * @param {ReactorState} reactorState\n\t * @param {KeyPath|Gettter} keyPathOrGetter\n\t * @return {EvaluateResult}\n\t */\n\t\n\tfunction evaluate(reactorState, keyPathOrGetter) {\n\t var state = reactorState.get('state');\n\t\n\t if ((0, _keyPath.isKeyPath)(keyPathOrGetter)) {\n\t // if its a keyPath simply return\n\t return evaluateResult(state.getIn(keyPathOrGetter), reactorState);\n\t } else if (!(0, _getter.isGetter)(keyPathOrGetter)) {\n\t throw new Error('evaluate must be passed a keyPath or Getter');\n\t }\n\t\n\t // Must be a Getter\n\t\n\t var cache = reactorState.get('cache');\n\t var cacheEntry = cache.lookup(keyPathOrGetter);\n\t var isCacheMiss = !cacheEntry || isDirtyCacheEntry(reactorState, cacheEntry);\n\t if (isCacheMiss) {\n\t cacheEntry = createCacheEntry(reactorState, keyPathOrGetter);\n\t }\n\t\n\t return evaluateResult(cacheEntry.get('value'), reactorState.update('cache', function (cache) {\n\t return isCacheMiss ? cache.miss(keyPathOrGetter, cacheEntry) : cache.hit(keyPathOrGetter);\n\t }));\n\t}\n\t\n\t/**\n\t * Returns serialized state for all stores\n\t * @param {ReactorState} reactorState\n\t * @return {Object}\n\t */\n\t\n\tfunction serialize(reactorState) {\n\t var serialized = {};\n\t reactorState.get('stores').forEach(function (store, id) {\n\t var storeState = reactorState.getIn(['state', id]);\n\t var serializedState = store.serialize(storeState);\n\t if (serializedState !== undefined) {\n\t serialized[id] = serializedState;\n\t }\n\t });\n\t return serialized;\n\t}\n\t\n\t/**\n\t * Returns serialized state for all stores\n\t * @param {ReactorState} reactorState\n\t * @return {ReactorState}\n\t */\n\t\n\tfunction resetDirtyStores(reactorState) {\n\t return reactorState.set('dirtyStores', _immutable2['default'].Set());\n\t}\n\t\n\t/**\n\t * @param {ReactorState} reactorState\n\t * @param {CacheEntry} cacheEntry\n\t * @return {boolean}\n\t */\n\tfunction isDirtyCacheEntry(reactorState, cacheEntry) {\n\t var storeStates = cacheEntry.get('storeStates');\n\t\n\t // if there are no store states for this entry then it was never cached before\n\t return !storeStates.size || storeStates.some(function (stateId, storeId) {\n\t return reactorState.getIn(['storeStates', storeId]) !== stateId;\n\t });\n\t}\n\t\n\t/**\n\t * Evaluates getter for given reactorState and returns CacheEntry\n\t * @param {ReactorState} reactorState\n\t * @param {Getter} getter\n\t * @return {CacheEntry}\n\t */\n\tfunction createCacheEntry(reactorState, getter) {\n\t // evaluate dependencies\n\t var args = (0, _getter.getDeps)(getter).map(function (dep) {\n\t return evaluate(reactorState, dep).result;\n\t });\n\t var value = (0, _getter.getComputeFn)(getter).apply(null, args);\n\t\n\t var storeDeps = (0, _getter.getStoreDeps)(getter);\n\t var storeStates = (0, _immutableHelpers.toImmutable)({}).withMutations(function (map) {\n\t storeDeps.forEach(function (storeId) {\n\t var stateId = reactorState.getIn(['storeStates', storeId]);\n\t map.set(storeId, stateId);\n\t });\n\t });\n\t\n\t return (0, _cache.CacheEntry)({\n\t value: value,\n\t storeStates: storeStates,\n\t dispatchId: reactorState.get('dispatchId')\n\t });\n\t}\n\t\n\t/**\n\t * @param {ReactorState} reactorState\n\t * @return {ReactorState}\n\t */\n\tfunction incrementId(reactorState) {\n\t return reactorState.update('dispatchId', function (id) {\n\t return id + 1;\n\t });\n\t}\n\t\n\t/**\n\t * @param {Immutable.Map} storeStates\n\t * @param {Array} storeIds\n\t * @return {Immutable.Map}\n\t */\n\tfunction incrementStoreStates(storeStates, storeIds) {\n\t return storeStates.withMutations(function (map) {\n\t storeIds.forEach(function (id) {\n\t var nextId = map.has(id) ? map.get(id) + 1 : 1;\n\t map.set(id, nextId);\n\t });\n\t });\n\t}\n\n/***/ },\n/* 9 */\n/*!******************************!*\\\n !*** ./src/reactor/cache.js ***!\n \\******************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\texports.DefaultCache = DefaultCache;\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _immutable = __webpack_require__(/*! immutable */ 3);\n\t\n\tvar CacheEntry = (0, _immutable.Record)({\n\t value: null,\n\t storeStates: (0, _immutable.Map)(),\n\t dispatchId: null\n\t});\n\t\n\texports.CacheEntry = CacheEntry;\n\t/*******************************************************************************\n\t * interface PersistentCache {\n\t * has(item)\n\t * lookup(item, notFoundValue)\n\t * hit(item)\n\t * miss(item, entry)\n\t * evict(item)\n\t * asMap()\n\t * }\n\t *\n\t * Inspired by clojure.core.cache/CacheProtocol\n\t *******************************************************************************/\n\t\n\t/**\n\t * Plain map-based cache\n\t */\n\t\n\tvar BasicCache = (function () {\n\t\n\t /**\n\t * @param {Immutable.Map} cache\n\t */\n\t\n\t function BasicCache() {\n\t var cache = arguments.length <= 0 || arguments[0] === undefined ? (0, _immutable.Map)() : arguments[0];\n\t\n\t _classCallCheck(this, BasicCache);\n\t\n\t this.cache = cache;\n\t }\n\t\n\t /**\n\t * Retrieve the associated value, if it exists in this cache, otherwise\n\t * returns notFoundValue (or undefined if not provided)\n\t * @param {Object} item\n\t * @param {Object?} notFoundValue\n\t * @return {CacheEntry?}\n\t */\n\t\n\t _createClass(BasicCache, [{\n\t key: 'lookup',\n\t value: function lookup(item, notFoundValue) {\n\t return this.cache.get(item, notFoundValue);\n\t }\n\t\n\t /**\n\t * Checks if this cache contains an associated value\n\t * @param {Object} item\n\t * @return {boolean}\n\t */\n\t }, {\n\t key: 'has',\n\t value: function has(item) {\n\t return this.cache.has(item);\n\t }\n\t\n\t /**\n\t * Return cached items as map\n\t * @return {Immutable.Map}\n\t */\n\t }, {\n\t key: 'asMap',\n\t value: function asMap() {\n\t return this.cache;\n\t }\n\t\n\t /**\n\t * Updates this cache when it is determined to contain the associated value\n\t * @param {Object} item\n\t * @return {BasicCache}\n\t */\n\t }, {\n\t key: 'hit',\n\t value: function hit(item) {\n\t return this;\n\t }\n\t\n\t /**\n\t * Updates this cache when it is determined to **not** contain the associated value\n\t * @param {Object} item\n\t * @param {CacheEntry} entry\n\t * @return {BasicCache}\n\t */\n\t }, {\n\t key: 'miss',\n\t value: function miss(item, entry) {\n\t return new BasicCache(this.cache.update(item, function (existingEntry) {\n\t if (existingEntry && existingEntry.dispatchId > entry.dispatchId) {\n\t throw new Error('Refusing to cache older value');\n\t }\n\t return entry;\n\t }));\n\t }\n\t\n\t /**\n\t * Removes entry from cache\n\t * @param {Object} item\n\t * @return {BasicCache}\n\t */\n\t }, {\n\t key: 'evict',\n\t value: function evict(item) {\n\t return new BasicCache(this.cache.remove(item));\n\t }\n\t }]);\n\t\n\t return BasicCache;\n\t})();\n\t\n\texports.BasicCache = BasicCache;\n\t\n\tvar DEFAULT_LRU_LIMIT = 1000;\n\tvar DEFAULT_LRU_EVICT_COUNT = 1;\n\t\n\t/**\n\t * Implements caching strategy that evicts least-recently-used items in cache\n\t * when an item is being added to a cache that has reached a configured size\n\t * limit.\n\t */\n\t\n\tvar LRUCache = (function () {\n\t function LRUCache() {\n\t var limit = arguments.length <= 0 || arguments[0] === undefined ? DEFAULT_LRU_LIMIT : arguments[0];\n\t var evictCount = arguments.length <= 1 || arguments[1] === undefined ? DEFAULT_LRU_EVICT_COUNT : arguments[1];\n\t var cache = arguments.length <= 2 || arguments[2] === undefined ? new BasicCache() : arguments[2];\n\t var lru = arguments.length <= 3 || arguments[3] === undefined ? (0, _immutable.OrderedSet)() : arguments[3];\n\t\n\t _classCallCheck(this, LRUCache);\n\t\n\t console.log(\"using LRU\");\n\t this.limit = limit;\n\t this.evictCount = evictCount;\n\t this.cache = cache;\n\t this.lru = lru;\n\t }\n\t\n\t /**\n\t * Returns default cache strategy\n\t * @return {BasicCache}\n\t */\n\t\n\t /**\n\t * Retrieve the associated value, if it exists in this cache, otherwise\n\t * returns notFoundValue (or undefined if not provided)\n\t * @param {Object} item\n\t * @param {Object?} notFoundValue\n\t * @return {CacheEntry}\n\t */\n\t\n\t _createClass(LRUCache, [{\n\t key: 'lookup',\n\t value: function lookup(item, notFoundValue) {\n\t return this.cache.lookup(item, notFoundValue);\n\t }\n\t\n\t /**\n\t * Checks if this cache contains an associated value\n\t * @param {Object} item\n\t * @return {boolean}\n\t */\n\t }, {\n\t key: 'has',\n\t value: function has(item) {\n\t return this.cache.has(item);\n\t }\n\t\n\t /**\n\t * Return cached items as map\n\t * @return {Immutable.Map}\n\t */\n\t }, {\n\t key: 'asMap',\n\t value: function asMap() {\n\t return this.cache.asMap();\n\t }\n\t\n\t /**\n\t * Updates this cache when it is determined to contain the associated value\n\t * @param {Object} item\n\t * @return {LRUCache}\n\t */\n\t }, {\n\t key: 'hit',\n\t value: function hit(item) {\n\t if (!this.cache.has(item)) {\n\t return this;\n\t }\n\t\n\t // remove it first to reorder in lru OrderedSet\n\t return new LRUCache(this.limit, this.evictCount, this.cache, this.lru.remove(item).add(item));\n\t }\n\t\n\t /**\n\t * Updates this cache when it is determined to **not** contain the associated value\n\t * If cache has reached size limit, the LRU item is evicted.\n\t * @param {Object} item\n\t * @param {CacheEntry} entry\n\t * @return {LRUCache}\n\t */\n\t }, {\n\t key: 'miss',\n\t value: function miss(item, entry) {\n\t var lruCache;\n\t if (this.lru.size >= this.limit) {\n\t if (this.has(item)) {\n\t return new LRUCache(this.limit, this.evictCount, this.cache.miss(item, entry), this.lru.remove(item).add(item));\n\t }\n\t\n\t var cache = this.lru.take(this.evictCount).reduce(function (c, evictItem) {\n\t return c.evict(evictItem);\n\t }, this.cache).miss(item, entry);\n\t\n\t lruCache = new LRUCache(this.limit, this.evictCount, cache, this.lru.skip(this.evictCount).add(item));\n\t } else {\n\t lruCache = new LRUCache(this.limit, this.evictCount, this.cache.miss(item, entry), this.lru.add(item));\n\t }\n\t return lruCache;\n\t }\n\t\n\t /**\n\t * Removes entry from cache\n\t * @param {Object} item\n\t * @return {LRUCache}\n\t */\n\t }, {\n\t key: 'evict',\n\t value: function evict(item) {\n\t if (!this.cache.has(item)) {\n\t return this;\n\t }\n\t\n\t return new LRUCache(this.limit, this.evictCount, this.cache.evict(item), this.lru.remove(item));\n\t }\n\t }]);\n\t\n\t return LRUCache;\n\t})();\n\t\n\texports.LRUCache = LRUCache;\n\t\n\tfunction DefaultCache() {\n\t return new BasicCache();\n\t}\n\n/***/ },\n/* 10 */\n/*!***********************!*\\\n !*** ./src/getter.js ***!\n \\***********************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _immutable = __webpack_require__(/*! immutable */ 3);\n\t\n\tvar _immutable2 = _interopRequireDefault(_immutable);\n\t\n\tvar _utils = __webpack_require__(/*! ./utils */ 4);\n\t\n\tvar _keyPath = __webpack_require__(/*! ./key-path */ 11);\n\t\n\t/**\n\t * Getter helper functions\n\t * A getter is an array with the form:\n\t * [, ..., ]\n\t */\n\tvar identity = function identity(x) {\n\t return x;\n\t};\n\t\n\t/**\n\t * Checks if something is a getter literal, ex: ['dep1', 'dep2', function(dep1, dep2) {...}]\n\t * @param {*} toTest\n\t * @return {boolean}\n\t */\n\tfunction isGetter(toTest) {\n\t return (0, _utils.isArray)(toTest) && (0, _utils.isFunction)(toTest[toTest.length - 1]);\n\t}\n\t\n\t/**\n\t * Returns the compute function from a getter\n\t * @param {Getter} getter\n\t * @return {function}\n\t */\n\tfunction getComputeFn(getter) {\n\t return getter[getter.length - 1];\n\t}\n\t\n\t/**\n\t * Returns an array of deps from a getter\n\t * @param {Getter} getter\n\t * @return {function}\n\t */\n\tfunction getDeps(getter) {\n\t return getter.slice(0, getter.length - 1);\n\t}\n\t\n\t/**\n\t * Returns an array of deps from a getter and all its deps\n\t * @param {Getter} getter\n\t * @param {Immutable.Set} existing\n\t * @return {Immutable.Set}\n\t */\n\tfunction getFlattenedDeps(getter, existing) {\n\t if (!existing) {\n\t existing = _immutable2['default'].Set();\n\t }\n\t\n\t var toAdd = _immutable2['default'].Set().withMutations(function (set) {\n\t if (!isGetter(getter)) {\n\t throw new Error('getFlattenedDeps must be passed a Getter');\n\t }\n\t\n\t getDeps(getter).forEach(function (dep) {\n\t if ((0, _keyPath.isKeyPath)(dep)) {\n\t set.add((0, _immutable.List)(dep));\n\t } else if (isGetter(dep)) {\n\t set.union(getFlattenedDeps(dep));\n\t } else {\n\t throw new Error('Invalid getter, each dependency must be a KeyPath or Getter');\n\t }\n\t });\n\t });\n\t\n\t return existing.union(toAdd);\n\t}\n\t\n\t/**\n\t * @param {KeyPath}\n\t * @return {Getter}\n\t */\n\tfunction fromKeyPath(keyPath) {\n\t if (!(0, _keyPath.isKeyPath)(keyPath)) {\n\t throw new Error('Cannot create Getter from KeyPath: ' + keyPath);\n\t }\n\t\n\t return [keyPath, identity];\n\t}\n\t\n\t/**\n\t * Adds non enumerated __storeDeps property\n\t * @param {Getter}\n\t */\n\tfunction getStoreDeps(getter) {\n\t if (getter.hasOwnProperty('__storeDeps')) {\n\t return getter.__storeDeps;\n\t }\n\t\n\t var storeDeps = getFlattenedDeps(getter).map(function (keyPath) {\n\t return keyPath.first();\n\t }).filter(function (x) {\n\t return !!x;\n\t });\n\t\n\t Object.defineProperty(getter, '__storeDeps', {\n\t enumerable: false,\n\t configurable: false,\n\t writable: false,\n\t value: storeDeps\n\t });\n\t\n\t return storeDeps;\n\t}\n\t\n\texports['default'] = {\n\t isGetter: isGetter,\n\t getComputeFn: getComputeFn,\n\t getFlattenedDeps: getFlattenedDeps,\n\t getStoreDeps: getStoreDeps,\n\t getDeps: getDeps,\n\t fromKeyPath: fromKeyPath\n\t};\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 11 */\n/*!*************************!*\\\n !*** ./src/key-path.js ***!\n \\*************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\texports.isKeyPath = isKeyPath;\n\texports.isEqual = isEqual;\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _immutable = __webpack_require__(/*! immutable */ 3);\n\t\n\tvar _immutable2 = _interopRequireDefault(_immutable);\n\t\n\tvar _utils = __webpack_require__(/*! ./utils */ 4);\n\t\n\t/**\n\t * Checks if something is simply a keyPath and not a getter\n\t * @param {*} toTest\n\t * @return {boolean}\n\t */\n\t\n\tfunction isKeyPath(toTest) {\n\t return (0, _utils.isArray)(toTest) && !(0, _utils.isFunction)(toTest[toTest.length - 1]);\n\t}\n\t\n\t/**\n\t * Checks if two keypaths are equal by value\n\t * @param {KeyPath} a\n\t * @param {KeyPath} a\n\t * @return {Boolean}\n\t */\n\t\n\tfunction isEqual(a, b) {\n\t var iA = _immutable2['default'].List(a);\n\t var iB = _immutable2['default'].List(b);\n\t\n\t return _immutable2['default'].is(iA, iB);\n\t}\n\n/***/ },\n/* 12 */\n/*!************************!*\\\n !*** ./src/logging.js ***!\n \\************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _reactorFns = __webpack_require__(/*! ./reactor/fns */ 8);\n\t\n\t/* eslint-disable no-console */\n\t/**\n\t * Wraps a Reactor.react invocation in a console.group\n\t */\n\tvar ConsoleGroupLogger = {\n\t /**\n\t * @param {ReactorState} reactorState\n\t * @param {String} type\n\t * @param {*} payload\n\t */\n\t dispatchStart: function dispatchStart(reactorState, type, payload) {\n\t if (!(0, _reactorFns.getOption)(reactorState, 'logDispatches')) {\n\t return;\n\t }\n\t\n\t if (console.group) {\n\t console.groupCollapsed('Dispatch: %s', type);\n\t console.group('payload');\n\t console.debug(payload);\n\t console.groupEnd();\n\t }\n\t },\n\t /**\n\t * @param {ReactorState} reactorState\n\t * @param {Error} error\n\t */\n\t dispatchError: function dispatchError(reactorState, error) {\n\t if (!(0, _reactorFns.getOption)(reactorState, 'logDispatches')) {\n\t return;\n\t }\n\t\n\t if (console.group) {\n\t console.debug('Dispatch error: ' + error);\n\t console.groupEnd();\n\t }\n\t },\n\t /**\n\t * @param {ReactorState} reactorState\n\t * @param {Map} state\n\t * @param {Set} dirtyStores\n\t */\n\t dispatchEnd: function dispatchEnd(reactorState, state, dirtyStores, previousState) {\n\t if (!(0, _reactorFns.getOption)(reactorState, 'logDispatches')) {\n\t return;\n\t }\n\t\n\t if (console.group) {\n\t if ((0, _reactorFns.getOption)(reactorState, 'logDirtyStores')) {\n\t console.log('Stores updated:', dirtyStores.toList().toJS());\n\t }\n\t\n\t if ((0, _reactorFns.getOption)(reactorState, 'logAppState')) {\n\t console.debug('Dispatch done, new state: ', state.toJS());\n\t }\n\t console.groupEnd();\n\t }\n\t }\n\t};\n\t\n\texports.ConsoleGroupLogger = ConsoleGroupLogger;\n\t/* eslint-enable no-console */\n\t\n\tvar NoopLogger = {\n\t /**\n\t * @param {ReactorState} reactorState\n\t * @param {String} type\n\t * @param {*} payload\n\t */\n\t dispatchStart: function dispatchStart(reactorState, type, payload) {},\n\t /**\n\t * @param {ReactorState} reactorState\n\t * @param {Error} error\n\t */\n\t dispatchError: function dispatchError(reactorState, error) {},\n\t /**\n\t * @param {ReactorState} reactorState\n\t * @param {Map} state\n\t * @param {Set} dirtyStores\n\t */\n\t dispatchEnd: function dispatchEnd(reactorState, state, dirtyStores) {}\n\t};\n\texports.NoopLogger = NoopLogger;\n\n/***/ },\n/* 13 */\n/*!********************************!*\\\n !*** ./src/reactor/records.js ***!\n \\********************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _immutable = __webpack_require__(/*! immutable */ 3);\n\t\n\tvar _cache = __webpack_require__(/*! ./cache */ 9);\n\t\n\tvar _logging = __webpack_require__(/*! ../logging */ 12);\n\t\n\tvar PROD_OPTIONS = (0, _immutable.Map)({\n\t // logs information for each dispatch\n\t logDispatches: false,\n\t // log the entire app state after each dispatch\n\t logAppState: false,\n\t // logs what stores changed after a dispatch\n\t logDirtyStores: false,\n\t // if true, throws an error when dispatching an `undefined` actionType\n\t throwOnUndefinedActionType: false,\n\t // if true, throws an error if a store returns undefined\n\t throwOnUndefinedStoreReturnValue: false,\n\t // if true, throws an error if a store.getInitialState() returns a non immutable value\n\t throwOnNonImmutableStore: false,\n\t // if true, throws when dispatching in dispatch\n\t throwOnDispatchInDispatch: false\n\t});\n\t\n\texports.PROD_OPTIONS = PROD_OPTIONS;\n\tvar DEBUG_OPTIONS = (0, _immutable.Map)({\n\t // logs information for each dispatch\n\t logDispatches: true,\n\t // log the entire app state after each dispatch\n\t logAppState: true,\n\t // logs what stores changed after a dispatch\n\t logDirtyStores: true,\n\t // if true, throws an error when dispatching an `undefined` actionType\n\t throwOnUndefinedActionType: true,\n\t // if true, throws an error if a store returns undefined\n\t throwOnUndefinedStoreReturnValue: true,\n\t // if true, throws an error if a store.getInitialState() returns a non immutable value\n\t throwOnNonImmutableStore: true,\n\t // if true, throws when dispatching in dispatch\n\t throwOnDispatchInDispatch: true\n\t});\n\t\n\texports.DEBUG_OPTIONS = DEBUG_OPTIONS;\n\tvar ReactorState = (0, _immutable.Record)({\n\t dispatchId: 0,\n\t state: (0, _immutable.Map)(),\n\t stores: (0, _immutable.Map)(),\n\t cache: (0, _cache.DefaultCache)(),\n\t logger: _logging.NoopLogger,\n\t // maintains a mapping of storeId => state id (monotomically increasing integer whenever store state changes)\n\t storeStates: (0, _immutable.Map)(),\n\t dirtyStores: (0, _immutable.Set)(),\n\t debug: false,\n\t // production defaults\n\t options: PROD_OPTIONS\n\t});\n\t\n\texports.ReactorState = ReactorState;\n\tvar ObserverState = (0, _immutable.Record)({\n\t // observers registered to any store change\n\t any: (0, _immutable.Set)(),\n\t // observers registered to specific store changes\n\t stores: (0, _immutable.Map)({}),\n\t\n\t observersMap: (0, _immutable.Map)({}),\n\t\n\t nextId: 1\n\t});\n\texports.ObserverState = ObserverState;\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** dist/nuclear.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 5101807446b00161d85d\n **/","import './console-polyfill'\nimport Store from './store'\nimport Reactor from './reactor'\nimport Immutable from 'immutable'\nimport { toJS, toImmutable, isImmutable } from './immutable-helpers'\nimport { isKeyPath } from './key-path'\nimport { isGetter } from './getter'\nimport { LRUCache } from './reactor/cache'\nimport createReactMixin from './create-react-mixin'\n\nexport default {\n Reactor,\n Store,\n Immutable,\n isKeyPath,\n isGetter,\n toJS,\n toImmutable,\n isImmutable,\n createReactMixin,\n LRUCache,\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/main.js\n **/","try {\n /* eslint-disable no-console */\n if (!(window.console && console.log)) {\n /* eslint-enable no-console */\n console = {\n log: function() {},\n debug: function() {},\n info: function() {},\n warn: function() {},\n error: function() {},\n }\n }\n} catch(e) {\n // ignored\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/console-polyfill.js\n **/","import { Map } from 'immutable'\nimport { toFactory, extend } from './utils'\nimport { toJS, toImmutable } from './immutable-helpers'\n\n/**\n * Stores define how a certain domain of the application should respond to actions\n * taken on the whole system. They manage their own section of the entire app state\n * and have no knowledge about the other parts of the application state.\n */\nclass Store {\n constructor(config) {\n this.__handlers = Map({})\n\n if (config) {\n // allow `MyStore extends Store` syntax without throwing error\n extend(this, config)\n }\n\n this.initialize()\n }\n\n /**\n * This method is overridden by extending classes to setup message handlers\n * via `this.on` and to set up the initial state\n *\n * Anything returned from this function will be coerced into an ImmutableJS value\n * and set as the initial state for the part of the ReactorCore\n */\n initialize() {\n // extending classes implement to setup action handlers\n }\n\n /**\n * Overridable method to get the initial state for this type of store\n */\n getInitialState() {\n return Map()\n }\n\n /**\n * Takes a current reactor state, action type and payload\n * does the reaction and returns the new state\n */\n handle(state, type, payload) {\n const handler = this.__handlers.get(type)\n\n if (typeof handler === 'function') {\n return handler.call(this, state, payload, type)\n }\n\n return state\n }\n\n /**\n * Pure function taking the current state of store and returning\n * the new state after a NuclearJS reactor has been reset\n *\n * Overridable\n */\n handleReset(state) {\n return this.getInitialState()\n }\n\n /**\n * Binds an action type => handler\n */\n on(actionType, handler) {\n this.__handlers = this.__handlers.set(actionType, handler)\n }\n\n /**\n * Serializes store state to plain JSON serializable JavaScript\n * Overridable\n * @param {*}\n * @return {*}\n */\n serialize(state) {\n return toJS(state)\n }\n\n /**\n * Deserializes plain JavaScript to store state\n * Overridable\n * @param {*}\n * @return {*}\n */\n deserialize(state) {\n return toImmutable(state)\n }\n}\n\nexport function isStore(toTest) {\n return (toTest instanceof Store)\n}\n\nexport default toFactory(Store)\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/store.js\n **/","/**\n * Copyright (c) 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.Immutable = factory());\n}(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice;\n\n function createClass(ctor, superClass) {\n if (superClass) {\n ctor.prototype = Object.create(superClass.prototype);\n }\n ctor.prototype.constructor = ctor;\n }\n\n function Iterable(value) {\n return isIterable(value) ? value : Seq(value);\n }\n\n\n createClass(KeyedIterable, Iterable);\n function KeyedIterable(value) {\n return isKeyed(value) ? value : KeyedSeq(value);\n }\n\n\n createClass(IndexedIterable, Iterable);\n function IndexedIterable(value) {\n return isIndexed(value) ? value : IndexedSeq(value);\n }\n\n\n createClass(SetIterable, Iterable);\n function SetIterable(value) {\n return isIterable(value) && !isAssociative(value) ? value : SetSeq(value);\n }\n\n\n\n function isIterable(maybeIterable) {\n return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]);\n }\n\n function isKeyed(maybeKeyed) {\n return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]);\n }\n\n function isIndexed(maybeIndexed) {\n return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]);\n }\n\n function isAssociative(maybeAssociative) {\n return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);\n }\n\n function isOrdered(maybeOrdered) {\n return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]);\n }\n\n Iterable.isIterable = isIterable;\n Iterable.isKeyed = isKeyed;\n Iterable.isIndexed = isIndexed;\n Iterable.isAssociative = isAssociative;\n Iterable.isOrdered = isOrdered;\n\n Iterable.Keyed = KeyedIterable;\n Iterable.Indexed = IndexedIterable;\n Iterable.Set = SetIterable;\n\n\n var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n // Used for setting prototype methods that IE8 chokes on.\n var DELETE = 'delete';\n\n // Constants describing the size of trie nodes.\n var SHIFT = 5; // Resulted in best performance after ______?\n var SIZE = 1 << SHIFT;\n var MASK = SIZE - 1;\n\n // A consistent shared value representing \"not set\" which equals nothing other\n // than itself, and nothing that could be provided externally.\n var NOT_SET = {};\n\n // Boolean references, Rough equivalent of `bool &`.\n var CHANGE_LENGTH = { value: false };\n var DID_ALTER = { value: false };\n\n function MakeRef(ref) {\n ref.value = false;\n return ref;\n }\n\n function SetRef(ref) {\n ref && (ref.value = true);\n }\n\n // A function which returns a value representing an \"owner\" for transient writes\n // to tries. The return value will only ever equal itself, and will not equal\n // the return of any subsequent call of this function.\n function OwnerID() {}\n\n // http://jsperf.com/copy-array-inline\n function arrCopy(arr, offset) {\n offset = offset || 0;\n var len = Math.max(0, arr.length - offset);\n var newArr = new Array(len);\n for (var ii = 0; ii < len; ii++) {\n newArr[ii] = arr[ii + offset];\n }\n return newArr;\n }\n\n function ensureSize(iter) {\n if (iter.size === undefined) {\n iter.size = iter.__iterate(returnTrue);\n }\n return iter.size;\n }\n\n function wrapIndex(iter, index) {\n // This implements \"is array index\" which the ECMAString spec defines as:\n //\n // A String property name P is an array index if and only if\n // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal\n // to 2^32−1.\n //\n // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects\n if (typeof index !== 'number') {\n var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32\n if ('' + uint32Index !== index || uint32Index === 4294967295) {\n return NaN;\n }\n index = uint32Index;\n }\n return index < 0 ? ensureSize(iter) + index : index;\n }\n\n function returnTrue() {\n return true;\n }\n\n function wholeSlice(begin, end, size) {\n return (begin === 0 || (size !== undefined && begin <= -size)) &&\n (end === undefined || (size !== undefined && end >= size));\n }\n\n function resolveBegin(begin, size) {\n return resolveIndex(begin, size, 0);\n }\n\n function resolveEnd(end, size) {\n return resolveIndex(end, size, size);\n }\n\n function resolveIndex(index, size, defaultIndex) {\n return index === undefined ?\n defaultIndex :\n index < 0 ?\n Math.max(0, size + index) :\n size === undefined ?\n index :\n Math.min(size, index);\n }\n\n /* global Symbol */\n\n var ITERATE_KEYS = 0;\n var ITERATE_VALUES = 1;\n var ITERATE_ENTRIES = 2;\n\n var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n var FAUX_ITERATOR_SYMBOL = '@@iterator';\n\n var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;\n\n\n function Iterator(next) {\n this.next = next;\n }\n\n Iterator.prototype.toString = function() {\n return '[Iterator]';\n };\n\n\n Iterator.KEYS = ITERATE_KEYS;\n Iterator.VALUES = ITERATE_VALUES;\n Iterator.ENTRIES = ITERATE_ENTRIES;\n\n Iterator.prototype.inspect =\n Iterator.prototype.toSource = function () { return this.toString(); }\n Iterator.prototype[ITERATOR_SYMBOL] = function () {\n return this;\n };\n\n\n function iteratorValue(type, k, v, iteratorResult) {\n var value = type === 0 ? k : type === 1 ? v : [k, v];\n iteratorResult ? (iteratorResult.value = value) : (iteratorResult = {\n value: value, done: false\n });\n return iteratorResult;\n }\n\n function iteratorDone() {\n return { value: undefined, done: true };\n }\n\n function hasIterator(maybeIterable) {\n return !!getIteratorFn(maybeIterable);\n }\n\n function isIterator(maybeIterator) {\n return maybeIterator && typeof maybeIterator.next === 'function';\n }\n\n function getIterator(iterable) {\n var iteratorFn = getIteratorFn(iterable);\n return iteratorFn && iteratorFn.call(iterable);\n }\n\n function getIteratorFn(iterable) {\n var iteratorFn = iterable && (\n (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) ||\n iterable[FAUX_ITERATOR_SYMBOL]\n );\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n }\n\n function isArrayLike(value) {\n return value && typeof value.length === 'number';\n }\n\n createClass(Seq, Iterable);\n function Seq(value) {\n return value === null || value === undefined ? emptySequence() :\n isIterable(value) ? value.toSeq() : seqFromValue(value);\n }\n\n Seq.of = function(/*...values*/) {\n return Seq(arguments);\n };\n\n Seq.prototype.toSeq = function() {\n return this;\n };\n\n Seq.prototype.toString = function() {\n return this.__toString('Seq {', '}');\n };\n\n Seq.prototype.cacheResult = function() {\n if (!this._cache && this.__iterateUncached) {\n this._cache = this.entrySeq().toArray();\n this.size = this._cache.length;\n }\n return this;\n };\n\n // abstract __iterateUncached(fn, reverse)\n\n Seq.prototype.__iterate = function(fn, reverse) {\n return seqIterate(this, fn, reverse, true);\n };\n\n // abstract __iteratorUncached(type, reverse)\n\n Seq.prototype.__iterator = function(type, reverse) {\n return seqIterator(this, type, reverse, true);\n };\n\n\n\n createClass(KeyedSeq, Seq);\n function KeyedSeq(value) {\n return value === null || value === undefined ?\n emptySequence().toKeyedSeq() :\n isIterable(value) ?\n (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) :\n keyedSeqFromValue(value);\n }\n\n KeyedSeq.prototype.toKeyedSeq = function() {\n return this;\n };\n\n\n\n createClass(IndexedSeq, Seq);\n function IndexedSeq(value) {\n return value === null || value === undefined ? emptySequence() :\n !isIterable(value) ? indexedSeqFromValue(value) :\n isKeyed(value) ? value.entrySeq() : value.toIndexedSeq();\n }\n\n IndexedSeq.of = function(/*...values*/) {\n return IndexedSeq(arguments);\n };\n\n IndexedSeq.prototype.toIndexedSeq = function() {\n return this;\n };\n\n IndexedSeq.prototype.toString = function() {\n return this.__toString('Seq [', ']');\n };\n\n IndexedSeq.prototype.__iterate = function(fn, reverse) {\n return seqIterate(this, fn, reverse, false);\n };\n\n IndexedSeq.prototype.__iterator = function(type, reverse) {\n return seqIterator(this, type, reverse, false);\n };\n\n\n\n createClass(SetSeq, Seq);\n function SetSeq(value) {\n return (\n value === null || value === undefined ? emptySequence() :\n !isIterable(value) ? indexedSeqFromValue(value) :\n isKeyed(value) ? value.entrySeq() : value\n ).toSetSeq();\n }\n\n SetSeq.of = function(/*...values*/) {\n return SetSeq(arguments);\n };\n\n SetSeq.prototype.toSetSeq = function() {\n return this;\n };\n\n\n\n Seq.isSeq = isSeq;\n Seq.Keyed = KeyedSeq;\n Seq.Set = SetSeq;\n Seq.Indexed = IndexedSeq;\n\n var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';\n\n Seq.prototype[IS_SEQ_SENTINEL] = true;\n\n\n\n createClass(ArraySeq, IndexedSeq);\n function ArraySeq(array) {\n this._array = array;\n this.size = array.length;\n }\n\n ArraySeq.prototype.get = function(index, notSetValue) {\n return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;\n };\n\n ArraySeq.prototype.__iterate = function(fn, reverse) {\n var array = this._array;\n var maxIndex = array.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n ArraySeq.prototype.__iterator = function(type, reverse) {\n var array = this._array;\n var maxIndex = array.length - 1;\n var ii = 0;\n return new Iterator(function() \n {return ii > maxIndex ?\n iteratorDone() :\n iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])}\n );\n };\n\n\n\n createClass(ObjectSeq, KeyedSeq);\n function ObjectSeq(object) {\n var keys = Object.keys(object);\n this._object = object;\n this._keys = keys;\n this.size = keys.length;\n }\n\n ObjectSeq.prototype.get = function(key, notSetValue) {\n if (notSetValue !== undefined && !this.has(key)) {\n return notSetValue;\n }\n return this._object[key];\n };\n\n ObjectSeq.prototype.has = function(key) {\n return this._object.hasOwnProperty(key);\n };\n\n ObjectSeq.prototype.__iterate = function(fn, reverse) {\n var object = this._object;\n var keys = this._keys;\n var maxIndex = keys.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n var key = keys[reverse ? maxIndex - ii : ii];\n if (fn(object[key], key, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n ObjectSeq.prototype.__iterator = function(type, reverse) {\n var object = this._object;\n var keys = this._keys;\n var maxIndex = keys.length - 1;\n var ii = 0;\n return new Iterator(function() {\n var key = keys[reverse ? maxIndex - ii : ii];\n return ii++ > maxIndex ?\n iteratorDone() :\n iteratorValue(type, key, object[key]);\n });\n };\n\n ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n createClass(IterableSeq, IndexedSeq);\n function IterableSeq(iterable) {\n this._iterable = iterable;\n this.size = iterable.length || iterable.size;\n }\n\n IterableSeq.prototype.__iterateUncached = function(fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterable = this._iterable;\n var iterator = getIterator(iterable);\n var iterations = 0;\n if (isIterator(iterator)) {\n var step;\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n }\n return iterations;\n };\n\n IterableSeq.prototype.__iteratorUncached = function(type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterable = this._iterable;\n var iterator = getIterator(iterable);\n if (!isIterator(iterator)) {\n return new Iterator(iteratorDone);\n }\n var iterations = 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step : iteratorValue(type, iterations++, step.value);\n });\n };\n\n\n\n createClass(IteratorSeq, IndexedSeq);\n function IteratorSeq(iterator) {\n this._iterator = iterator;\n this._iteratorCache = [];\n }\n\n IteratorSeq.prototype.__iterateUncached = function(fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterator = this._iterator;\n var cache = this._iteratorCache;\n var iterations = 0;\n while (iterations < cache.length) {\n if (fn(cache[iterations], iterations++, this) === false) {\n return iterations;\n }\n }\n var step;\n while (!(step = iterator.next()).done) {\n var val = step.value;\n cache[iterations] = val;\n if (fn(val, iterations++, this) === false) {\n break;\n }\n }\n return iterations;\n };\n\n IteratorSeq.prototype.__iteratorUncached = function(type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = this._iterator;\n var cache = this._iteratorCache;\n var iterations = 0;\n return new Iterator(function() {\n if (iterations >= cache.length) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n cache[iterations] = step.value;\n }\n return iteratorValue(type, iterations, cache[iterations++]);\n });\n };\n\n\n\n\n // # pragma Helper functions\n\n function isSeq(maybeSeq) {\n return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]);\n }\n\n var EMPTY_SEQ;\n\n function emptySequence() {\n return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));\n }\n\n function keyedSeqFromValue(value) {\n var seq =\n Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() :\n isIterator(value) ? new IteratorSeq(value).fromEntrySeq() :\n hasIterator(value) ? new IterableSeq(value).fromEntrySeq() :\n typeof value === 'object' ? new ObjectSeq(value) :\n undefined;\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of [k, v] entries, '+\n 'or keyed object: ' + value\n );\n }\n return seq;\n }\n\n function indexedSeqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value);\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of values: ' + value\n );\n }\n return seq;\n }\n\n function seqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value) ||\n (typeof value === 'object' && new ObjectSeq(value));\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of values, or keyed object: ' + value\n );\n }\n return seq;\n }\n\n function maybeIndexedSeqFromValue(value) {\n return (\n isArrayLike(value) ? new ArraySeq(value) :\n isIterator(value) ? new IteratorSeq(value) :\n hasIterator(value) ? new IterableSeq(value) :\n undefined\n );\n }\n\n function seqIterate(seq, fn, reverse, useKeys) {\n var cache = seq._cache;\n if (cache) {\n var maxIndex = cache.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n var entry = cache[reverse ? maxIndex - ii : ii];\n if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) {\n return ii + 1;\n }\n }\n return ii;\n }\n return seq.__iterateUncached(fn, reverse);\n }\n\n function seqIterator(seq, type, reverse, useKeys) {\n var cache = seq._cache;\n if (cache) {\n var maxIndex = cache.length - 1;\n var ii = 0;\n return new Iterator(function() {\n var entry = cache[reverse ? maxIndex - ii : ii];\n return ii++ > maxIndex ?\n iteratorDone() :\n iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]);\n });\n }\n return seq.__iteratorUncached(type, reverse);\n }\n\n function fromJS(json, converter) {\n return converter ?\n fromJSWith(converter, json, '', {'': json}) :\n fromJSDefault(json);\n }\n\n function fromJSWith(converter, json, key, parentJSON) {\n if (Array.isArray(json)) {\n return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)}));\n }\n if (isPlainObj(json)) {\n return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)}));\n }\n return json;\n }\n\n function fromJSDefault(json) {\n if (Array.isArray(json)) {\n return IndexedSeq(json).map(fromJSDefault).toList();\n }\n if (isPlainObj(json)) {\n return KeyedSeq(json).map(fromJSDefault).toMap();\n }\n return json;\n }\n\n function isPlainObj(value) {\n return value && (value.constructor === Object || value.constructor === undefined);\n }\n\n /**\n * An extension of the \"same-value\" algorithm as [described for use by ES6 Map\n * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)\n *\n * NaN is considered the same as NaN, however -0 and 0 are considered the same\n * value, which is different from the algorithm described by\n * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n *\n * This is extended further to allow Objects to describe the values they\n * represent, by way of `valueOf` or `equals` (and `hashCode`).\n *\n * Note: because of this extension, the key equality of Immutable.Map and the\n * value equality of Immutable.Set will differ from ES6 Map and Set.\n *\n * ### Defining custom values\n *\n * The easiest way to describe the value an object represents is by implementing\n * `valueOf`. For example, `Date` represents a value by returning a unix\n * timestamp for `valueOf`:\n *\n * var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...\n * var date2 = new Date(1234567890000);\n * date1.valueOf(); // 1234567890000\n * assert( date1 !== date2 );\n * assert( Immutable.is( date1, date2 ) );\n *\n * Note: overriding `valueOf` may have other implications if you use this object\n * where JavaScript expects a primitive, such as implicit string coercion.\n *\n * For more complex types, especially collections, implementing `valueOf` may\n * not be performant. An alternative is to implement `equals` and `hashCode`.\n *\n * `equals` takes another object, presumably of similar type, and returns true\n * if the it is equal. Equality is symmetrical, so the same result should be\n * returned if this and the argument are flipped.\n *\n * assert( a.equals(b) === b.equals(a) );\n *\n * `hashCode` returns a 32bit integer number representing the object which will\n * be used to determine how to store the value object in a Map or Set. You must\n * provide both or neither methods, one must not exist without the other.\n *\n * Also, an important relationship between these methods must be upheld: if two\n * values are equal, they *must* return the same hashCode. If the values are not\n * equal, they might have the same hashCode; this is called a hash collision,\n * and while undesirable for performance reasons, it is acceptable.\n *\n * if (a.equals(b)) {\n * assert( a.hashCode() === b.hashCode() );\n * }\n *\n * All Immutable collections implement `equals` and `hashCode`.\n *\n */\n function is(valueA, valueB) {\n if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n return true;\n }\n if (!valueA || !valueB) {\n return false;\n }\n if (typeof valueA.valueOf === 'function' &&\n typeof valueB.valueOf === 'function') {\n valueA = valueA.valueOf();\n valueB = valueB.valueOf();\n if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n return true;\n }\n if (!valueA || !valueB) {\n return false;\n }\n }\n if (typeof valueA.equals === 'function' &&\n typeof valueB.equals === 'function' &&\n valueA.equals(valueB)) {\n return true;\n }\n return false;\n }\n\n function deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (\n !isIterable(b) ||\n a.size !== undefined && b.size !== undefined && a.size !== b.size ||\n a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash ||\n isKeyed(a) !== isKeyed(b) ||\n isIndexed(a) !== isIndexed(b) ||\n isOrdered(a) !== isOrdered(b)\n ) {\n return false;\n }\n\n if (a.size === 0 && b.size === 0) {\n return true;\n }\n\n var notAssociative = !isAssociative(a);\n\n if (isOrdered(a)) {\n var entries = a.entries();\n return b.every(function(v, k) {\n var entry = entries.next().value;\n return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));\n }) && entries.next().done;\n }\n\n var flipped = false;\n\n if (a.size === undefined) {\n if (b.size === undefined) {\n if (typeof a.cacheResult === 'function') {\n a.cacheResult();\n }\n } else {\n flipped = true;\n var _ = a;\n a = b;\n b = _;\n }\n }\n\n var allEqual = true;\n var bSize = b.__iterate(function(v, k) {\n if (notAssociative ? !a.has(v) :\n flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) {\n allEqual = false;\n return false;\n }\n });\n\n return allEqual && a.size === bSize;\n }\n\n createClass(Repeat, IndexedSeq);\n\n function Repeat(value, times) {\n if (!(this instanceof Repeat)) {\n return new Repeat(value, times);\n }\n this._value = value;\n this.size = times === undefined ? Infinity : Math.max(0, times);\n if (this.size === 0) {\n if (EMPTY_REPEAT) {\n return EMPTY_REPEAT;\n }\n EMPTY_REPEAT = this;\n }\n }\n\n Repeat.prototype.toString = function() {\n if (this.size === 0) {\n return 'Repeat []';\n }\n return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';\n };\n\n Repeat.prototype.get = function(index, notSetValue) {\n return this.has(index) ? this._value : notSetValue;\n };\n\n Repeat.prototype.includes = function(searchValue) {\n return is(this._value, searchValue);\n };\n\n Repeat.prototype.slice = function(begin, end) {\n var size = this.size;\n return wholeSlice(begin, end, size) ? this :\n new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size));\n };\n\n Repeat.prototype.reverse = function() {\n return this;\n };\n\n Repeat.prototype.indexOf = function(searchValue) {\n if (is(this._value, searchValue)) {\n return 0;\n }\n return -1;\n };\n\n Repeat.prototype.lastIndexOf = function(searchValue) {\n if (is(this._value, searchValue)) {\n return this.size;\n }\n return -1;\n };\n\n Repeat.prototype.__iterate = function(fn, reverse) {\n for (var ii = 0; ii < this.size; ii++) {\n if (fn(this._value, ii, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this;\n var ii = 0;\n return new Iterator(function() \n {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()}\n );\n };\n\n Repeat.prototype.equals = function(other) {\n return other instanceof Repeat ?\n is(this._value, other._value) :\n deepEqual(other);\n };\n\n\n var EMPTY_REPEAT;\n\n function invariant(condition, error) {\n if (!condition) throw new Error(error);\n }\n\n createClass(Range, IndexedSeq);\n\n function Range(start, end, step) {\n if (!(this instanceof Range)) {\n return new Range(start, end, step);\n }\n invariant(step !== 0, 'Cannot step a Range by 0');\n start = start || 0;\n if (end === undefined) {\n end = Infinity;\n }\n step = step === undefined ? 1 : Math.abs(step);\n if (end < start) {\n step = -step;\n }\n this._start = start;\n this._end = end;\n this._step = step;\n this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);\n if (this.size === 0) {\n if (EMPTY_RANGE) {\n return EMPTY_RANGE;\n }\n EMPTY_RANGE = this;\n }\n }\n\n Range.prototype.toString = function() {\n if (this.size === 0) {\n return 'Range []';\n }\n return 'Range [ ' +\n this._start + '...' + this._end +\n (this._step !== 1 ? ' by ' + this._step : '') +\n ' ]';\n };\n\n Range.prototype.get = function(index, notSetValue) {\n return this.has(index) ?\n this._start + wrapIndex(this, index) * this._step :\n notSetValue;\n };\n\n Range.prototype.includes = function(searchValue) {\n var possibleIndex = (searchValue - this._start) / this._step;\n return possibleIndex >= 0 &&\n possibleIndex < this.size &&\n possibleIndex === Math.floor(possibleIndex);\n };\n\n Range.prototype.slice = function(begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n begin = resolveBegin(begin, this.size);\n end = resolveEnd(end, this.size);\n if (end <= begin) {\n return new Range(0, 0);\n }\n return new Range(this.get(begin, this._end), this.get(end, this._end), this._step);\n };\n\n Range.prototype.indexOf = function(searchValue) {\n var offsetValue = searchValue - this._start;\n if (offsetValue % this._step === 0) {\n var index = offsetValue / this._step;\n if (index >= 0 && index < this.size) {\n return index\n }\n }\n return -1;\n };\n\n Range.prototype.lastIndexOf = function(searchValue) {\n return this.indexOf(searchValue);\n };\n\n Range.prototype.__iterate = function(fn, reverse) {\n var maxIndex = this.size - 1;\n var step = this._step;\n var value = reverse ? this._start + maxIndex * step : this._start;\n for (var ii = 0; ii <= maxIndex; ii++) {\n if (fn(value, ii, this) === false) {\n return ii + 1;\n }\n value += reverse ? -step : step;\n }\n return ii;\n };\n\n Range.prototype.__iterator = function(type, reverse) {\n var maxIndex = this.size - 1;\n var step = this._step;\n var value = reverse ? this._start + maxIndex * step : this._start;\n var ii = 0;\n return new Iterator(function() {\n var v = value;\n value += reverse ? -step : step;\n return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v);\n });\n };\n\n Range.prototype.equals = function(other) {\n return other instanceof Range ?\n this._start === other._start &&\n this._end === other._end &&\n this._step === other._step :\n deepEqual(this, other);\n };\n\n\n var EMPTY_RANGE;\n\n createClass(Collection, Iterable);\n function Collection() {\n throw TypeError('Abstract');\n }\n\n\n createClass(KeyedCollection, Collection);function KeyedCollection() {}\n\n createClass(IndexedCollection, Collection);function IndexedCollection() {}\n\n createClass(SetCollection, Collection);function SetCollection() {}\n\n\n Collection.Keyed = KeyedCollection;\n Collection.Indexed = IndexedCollection;\n Collection.Set = SetCollection;\n\n var imul =\n typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ?\n Math.imul :\n function imul(a, b) {\n a = a | 0; // int\n b = b | 0; // int\n var c = a & 0xffff;\n var d = b & 0xffff;\n // Shift by 0 fixes the sign on the high part.\n return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int\n };\n\n // v8 has an optimization for storing 31-bit signed numbers.\n // Values which have either 00 or 11 as the high order bits qualify.\n // This function drops the highest order bit in a signed number, maintaining\n // the sign bit.\n function smi(i32) {\n return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF);\n }\n\n function hash(o) {\n if (o === false || o === null || o === undefined) {\n return 0;\n }\n if (typeof o.valueOf === 'function') {\n o = o.valueOf();\n if (o === false || o === null || o === undefined) {\n return 0;\n }\n }\n if (o === true) {\n return 1;\n }\n var type = typeof o;\n if (type === 'number') {\n if (o !== o || o === Infinity) {\n return 0;\n }\n var h = o | 0;\n if (h !== o) {\n h ^= o * 0xFFFFFFFF;\n }\n while (o > 0xFFFFFFFF) {\n o /= 0xFFFFFFFF;\n h ^= o;\n }\n return smi(h);\n }\n if (type === 'string') {\n return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o);\n }\n if (typeof o.hashCode === 'function') {\n return o.hashCode();\n }\n if (type === 'object') {\n return hashJSObj(o);\n }\n if (typeof o.toString === 'function') {\n return hashString(o.toString());\n }\n throw new Error('Value type ' + type + ' cannot be hashed.');\n }\n\n function cachedHashString(string) {\n var hash = stringHashCache[string];\n if (hash === undefined) {\n hash = hashString(string);\n if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {\n STRING_HASH_CACHE_SIZE = 0;\n stringHashCache = {};\n }\n STRING_HASH_CACHE_SIZE++;\n stringHashCache[string] = hash;\n }\n return hash;\n }\n\n // http://jsperf.com/hashing-strings\n function hashString(string) {\n // This is the hash from JVM\n // The hash code for a string is computed as\n // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],\n // where s[i] is the ith character of the string and n is the length of\n // the string. We \"mod\" the result to make it between 0 (inclusive) and 2^31\n // (exclusive) by dropping high bits.\n var hash = 0;\n for (var ii = 0; ii < string.length; ii++) {\n hash = 31 * hash + string.charCodeAt(ii) | 0;\n }\n return smi(hash);\n }\n\n function hashJSObj(obj) {\n var hash;\n if (usingWeakMap) {\n hash = weakMap.get(obj);\n if (hash !== undefined) {\n return hash;\n }\n }\n\n hash = obj[UID_HASH_KEY];\n if (hash !== undefined) {\n return hash;\n }\n\n if (!canDefineProperty) {\n hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];\n if (hash !== undefined) {\n return hash;\n }\n\n hash = getIENodeHash(obj);\n if (hash !== undefined) {\n return hash;\n }\n }\n\n hash = ++objHashUID;\n if (objHashUID & 0x40000000) {\n objHashUID = 0;\n }\n\n if (usingWeakMap) {\n weakMap.set(obj, hash);\n } else if (isExtensible !== undefined && isExtensible(obj) === false) {\n throw new Error('Non-extensible objects are not allowed as keys.');\n } else if (canDefineProperty) {\n Object.defineProperty(obj, UID_HASH_KEY, {\n 'enumerable': false,\n 'configurable': false,\n 'writable': false,\n 'value': hash\n });\n } else if (obj.propertyIsEnumerable !== undefined &&\n obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) {\n // Since we can't define a non-enumerable property on the object\n // we'll hijack one of the less-used non-enumerable properties to\n // save our hash on it. Since this is a function it will not show up in\n // `JSON.stringify` which is what we want.\n obj.propertyIsEnumerable = function() {\n return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments);\n };\n obj.propertyIsEnumerable[UID_HASH_KEY] = hash;\n } else if (obj.nodeType !== undefined) {\n // At this point we couldn't get the IE `uniqueID` to use as a hash\n // and we couldn't use a non-enumerable property to exploit the\n // dontEnum bug so we simply add the `UID_HASH_KEY` on the node\n // itself.\n obj[UID_HASH_KEY] = hash;\n } else {\n throw new Error('Unable to set a non-enumerable property on object.');\n }\n\n return hash;\n }\n\n // Get references to ES5 object methods.\n var isExtensible = Object.isExtensible;\n\n // True if Object.defineProperty works as expected. IE8 fails this test.\n var canDefineProperty = (function() {\n try {\n Object.defineProperty({}, '@', {});\n return true;\n } catch (e) {\n return false;\n }\n }());\n\n // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it\n // and avoid memory leaks from the IE cloneNode bug.\n function getIENodeHash(node) {\n if (node && node.nodeType > 0) {\n switch (node.nodeType) {\n case 1: // Element\n return node.uniqueID;\n case 9: // Document\n return node.documentElement && node.documentElement.uniqueID;\n }\n }\n }\n\n // If possible, use a WeakMap.\n var usingWeakMap = typeof WeakMap === 'function';\n var weakMap;\n if (usingWeakMap) {\n weakMap = new WeakMap();\n }\n\n var objHashUID = 0;\n\n var UID_HASH_KEY = '__immutablehash__';\n if (typeof Symbol === 'function') {\n UID_HASH_KEY = Symbol(UID_HASH_KEY);\n }\n\n var STRING_HASH_CACHE_MIN_STRLEN = 16;\n var STRING_HASH_CACHE_MAX_SIZE = 255;\n var STRING_HASH_CACHE_SIZE = 0;\n var stringHashCache = {};\n\n function assertNotInfinite(size) {\n invariant(\n size !== Infinity,\n 'Cannot perform this action with an infinite size.'\n );\n }\n\n createClass(Map, KeyedCollection);\n\n // @pragma Construction\n\n function Map(value) {\n return value === null || value === undefined ? emptyMap() :\n isMap(value) && !isOrdered(value) ? value :\n emptyMap().withMutations(function(map ) {\n var iter = KeyedIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v, k) {return map.set(k, v)});\n });\n }\n\n Map.of = function() {var keyValues = SLICE$0.call(arguments, 0);\n return emptyMap().withMutations(function(map ) {\n for (var i = 0; i < keyValues.length; i += 2) {\n if (i + 1 >= keyValues.length) {\n throw new Error('Missing value for key: ' + keyValues[i]);\n }\n map.set(keyValues[i], keyValues[i + 1]);\n }\n });\n };\n\n Map.prototype.toString = function() {\n return this.__toString('Map {', '}');\n };\n\n // @pragma Access\n\n Map.prototype.get = function(k, notSetValue) {\n return this._root ?\n this._root.get(0, undefined, k, notSetValue) :\n notSetValue;\n };\n\n // @pragma Modification\n\n Map.prototype.set = function(k, v) {\n return updateMap(this, k, v);\n };\n\n Map.prototype.setIn = function(keyPath, v) {\n return this.updateIn(keyPath, NOT_SET, function() {return v});\n };\n\n Map.prototype.remove = function(k) {\n return updateMap(this, k, NOT_SET);\n };\n\n Map.prototype.deleteIn = function(keyPath) {\n return this.updateIn(keyPath, function() {return NOT_SET});\n };\n\n Map.prototype.update = function(k, notSetValue, updater) {\n return arguments.length === 1 ?\n k(this) :\n this.updateIn([k], notSetValue, updater);\n };\n\n Map.prototype.updateIn = function(keyPath, notSetValue, updater) {\n if (!updater) {\n updater = notSetValue;\n notSetValue = undefined;\n }\n var updatedValue = updateInDeepMap(\n this,\n forceIterator(keyPath),\n notSetValue,\n updater\n );\n return updatedValue === NOT_SET ? undefined : updatedValue;\n };\n\n Map.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._root = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyMap();\n };\n\n // @pragma Composition\n\n Map.prototype.merge = function(/*...iters*/) {\n return mergeIntoMapWith(this, undefined, arguments);\n };\n\n Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoMapWith(this, merger, iters);\n };\n\n Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n return this.updateIn(\n keyPath,\n emptyMap(),\n function(m ) {return typeof m.merge === 'function' ?\n m.merge.apply(m, iters) :\n iters[iters.length - 1]}\n );\n };\n\n Map.prototype.mergeDeep = function(/*...iters*/) {\n return mergeIntoMapWith(this, deepMerger, arguments);\n };\n\n Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoMapWith(this, deepMergerWith(merger), iters);\n };\n\n Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n return this.updateIn(\n keyPath,\n emptyMap(),\n function(m ) {return typeof m.mergeDeep === 'function' ?\n m.mergeDeep.apply(m, iters) :\n iters[iters.length - 1]}\n );\n };\n\n Map.prototype.sort = function(comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator));\n };\n\n Map.prototype.sortBy = function(mapper, comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator, mapper));\n };\n\n // @pragma Mutability\n\n Map.prototype.withMutations = function(fn) {\n var mutable = this.asMutable();\n fn(mutable);\n return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;\n };\n\n Map.prototype.asMutable = function() {\n return this.__ownerID ? this : this.__ensureOwner(new OwnerID());\n };\n\n Map.prototype.asImmutable = function() {\n return this.__ensureOwner();\n };\n\n Map.prototype.wasAltered = function() {\n return this.__altered;\n };\n\n Map.prototype.__iterator = function(type, reverse) {\n return new MapIterator(this, type, reverse);\n };\n\n Map.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n this._root && this._root.iterate(function(entry ) {\n iterations++;\n return fn(entry[1], entry[0], this$0);\n }, reverse);\n return iterations;\n };\n\n Map.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n return makeMap(this.size, this._root, ownerID, this.__hash);\n };\n\n\n function isMap(maybeMap) {\n return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]);\n }\n\n Map.isMap = isMap;\n\n var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';\n\n var MapPrototype = Map.prototype;\n MapPrototype[IS_MAP_SENTINEL] = true;\n MapPrototype[DELETE] = MapPrototype.remove;\n MapPrototype.removeIn = MapPrototype.deleteIn;\n\n\n // #pragma Trie Nodes\n\n\n\n function ArrayMapNode(ownerID, entries) {\n this.ownerID = ownerID;\n this.entries = entries;\n }\n\n ArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n return notSetValue;\n };\n\n ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n\n var entries = this.entries;\n var idx = 0;\n for (var len = entries.length; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && entries.length === 1) {\n return; // undefined\n }\n\n if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {\n return createNodes(ownerID, entries, key, value);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new ArrayMapNode(ownerID, newEntries);\n };\n\n\n\n\n function BitmapIndexedNode(ownerID, bitmap, nodes) {\n this.ownerID = ownerID;\n this.bitmap = bitmap;\n this.nodes = nodes;\n }\n\n BitmapIndexedNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK));\n var bitmap = this.bitmap;\n return (bitmap & bit) === 0 ? notSetValue :\n this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue);\n };\n\n BitmapIndexedNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var bit = 1 << keyHashFrag;\n var bitmap = this.bitmap;\n var exists = (bitmap & bit) !== 0;\n\n if (!exists && value === NOT_SET) {\n return this;\n }\n\n var idx = popCount(bitmap & (bit - 1));\n var nodes = this.nodes;\n var node = exists ? nodes[idx] : undefined;\n var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n\n if (newNode === node) {\n return this;\n }\n\n if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {\n return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);\n }\n\n if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {\n return nodes[idx ^ 1];\n }\n\n if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {\n return newNode;\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;\n var newNodes = exists ? newNode ?\n setIn(nodes, idx, newNode, isEditable) :\n spliceOut(nodes, idx, isEditable) :\n spliceIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.bitmap = newBitmap;\n this.nodes = newNodes;\n return this;\n }\n\n return new BitmapIndexedNode(ownerID, newBitmap, newNodes);\n };\n\n\n\n\n function HashArrayMapNode(ownerID, count, nodes) {\n this.ownerID = ownerID;\n this.count = count;\n this.nodes = nodes;\n }\n\n HashArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var node = this.nodes[idx];\n return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue;\n };\n\n HashArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var removed = value === NOT_SET;\n var nodes = this.nodes;\n var node = nodes[idx];\n\n if (removed && !node) {\n return this;\n }\n\n var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n if (newNode === node) {\n return this;\n }\n\n var newCount = this.count;\n if (!node) {\n newCount++;\n } else if (!newNode) {\n newCount--;\n if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {\n return packNodes(ownerID, nodes, newCount, idx);\n }\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newNodes = setIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.count = newCount;\n this.nodes = newNodes;\n return this;\n }\n\n return new HashArrayMapNode(ownerID, newCount, newNodes);\n };\n\n\n\n\n function HashCollisionNode(ownerID, keyHash, entries) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entries = entries;\n }\n\n HashCollisionNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n return notSetValue;\n };\n\n HashCollisionNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var removed = value === NOT_SET;\n\n if (keyHash !== this.keyHash) {\n if (removed) {\n return this;\n }\n SetRef(didAlter);\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);\n }\n\n var entries = this.entries;\n var idx = 0;\n for (var len = entries.length; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && len === 2) {\n return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new HashCollisionNode(ownerID, this.keyHash, newEntries);\n };\n\n\n\n\n function ValueNode(ownerID, keyHash, entry) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entry = entry;\n }\n\n ValueNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n return is(key, this.entry[0]) ? this.entry[1] : notSetValue;\n };\n\n ValueNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n var keyMatch = is(key, this.entry[0]);\n if (keyMatch ? value === this.entry[1] : removed) {\n return this;\n }\n\n SetRef(didAlter);\n\n if (removed) {\n SetRef(didChangeSize);\n return; // undefined\n }\n\n if (keyMatch) {\n if (ownerID && ownerID === this.ownerID) {\n this.entry[1] = value;\n return this;\n }\n return new ValueNode(ownerID, this.keyHash, [key, value]);\n }\n\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);\n };\n\n\n\n // #pragma Iterators\n\n ArrayMapNode.prototype.iterate =\n HashCollisionNode.prototype.iterate = function (fn, reverse) {\n var entries = this.entries;\n for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {\n if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {\n return false;\n }\n }\n }\n\n BitmapIndexedNode.prototype.iterate =\n HashArrayMapNode.prototype.iterate = function (fn, reverse) {\n var nodes = this.nodes;\n for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {\n var node = nodes[reverse ? maxIndex - ii : ii];\n if (node && node.iterate(fn, reverse) === false) {\n return false;\n }\n }\n }\n\n ValueNode.prototype.iterate = function (fn, reverse) {\n return fn(this.entry);\n }\n\n createClass(MapIterator, Iterator);\n\n function MapIterator(map, type, reverse) {\n this._type = type;\n this._reverse = reverse;\n this._stack = map._root && mapIteratorFrame(map._root);\n }\n\n MapIterator.prototype.next = function() {\n var type = this._type;\n var stack = this._stack;\n while (stack) {\n var node = stack.node;\n var index = stack.index++;\n var maxIndex;\n if (node.entry) {\n if (index === 0) {\n return mapIteratorValue(type, node.entry);\n }\n } else if (node.entries) {\n maxIndex = node.entries.length - 1;\n if (index <= maxIndex) {\n return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]);\n }\n } else {\n maxIndex = node.nodes.length - 1;\n if (index <= maxIndex) {\n var subNode = node.nodes[this._reverse ? maxIndex - index : index];\n if (subNode) {\n if (subNode.entry) {\n return mapIteratorValue(type, subNode.entry);\n }\n stack = this._stack = mapIteratorFrame(subNode, stack);\n }\n continue;\n }\n }\n stack = this._stack = this._stack.__prev;\n }\n return iteratorDone();\n };\n\n\n function mapIteratorValue(type, entry) {\n return iteratorValue(type, entry[0], entry[1]);\n }\n\n function mapIteratorFrame(node, prev) {\n return {\n node: node,\n index: 0,\n __prev: prev\n };\n }\n\n function makeMap(size, root, ownerID, hash) {\n var map = Object.create(MapPrototype);\n map.size = size;\n map._root = root;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n }\n\n var EMPTY_MAP;\n function emptyMap() {\n return EMPTY_MAP || (EMPTY_MAP = makeMap(0));\n }\n\n function updateMap(map, k, v) {\n var newRoot;\n var newSize;\n if (!map._root) {\n if (v === NOT_SET) {\n return map;\n }\n newSize = 1;\n newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);\n } else {\n var didChangeSize = MakeRef(CHANGE_LENGTH);\n var didAlter = MakeRef(DID_ALTER);\n newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter);\n if (!didAlter.value) {\n return map;\n }\n newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0);\n }\n if (map.__ownerID) {\n map.size = newSize;\n map._root = newRoot;\n map.__hash = undefined;\n map.__altered = true;\n return map;\n }\n return newRoot ? makeMap(newSize, newRoot) : emptyMap();\n }\n\n function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (!node) {\n if (value === NOT_SET) {\n return node;\n }\n SetRef(didAlter);\n SetRef(didChangeSize);\n return new ValueNode(ownerID, keyHash, [key, value]);\n }\n return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter);\n }\n\n function isLeafNode(node) {\n return node.constructor === ValueNode || node.constructor === HashCollisionNode;\n }\n\n function mergeIntoNode(node, ownerID, shift, keyHash, entry) {\n if (node.keyHash === keyHash) {\n return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);\n }\n\n var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;\n var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n\n var newNode;\n var nodes = idx1 === idx2 ?\n [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] :\n ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]);\n\n return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);\n }\n\n function createNodes(ownerID, entries, key, value) {\n if (!ownerID) {\n ownerID = new OwnerID();\n }\n var node = new ValueNode(ownerID, hash(key), [key, value]);\n for (var ii = 0; ii < entries.length; ii++) {\n var entry = entries[ii];\n node = node.update(ownerID, 0, undefined, entry[0], entry[1]);\n }\n return node;\n }\n\n function packNodes(ownerID, nodes, count, excluding) {\n var bitmap = 0;\n var packedII = 0;\n var packedNodes = new Array(count);\n for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {\n var node = nodes[ii];\n if (node !== undefined && ii !== excluding) {\n bitmap |= bit;\n packedNodes[packedII++] = node;\n }\n }\n return new BitmapIndexedNode(ownerID, bitmap, packedNodes);\n }\n\n function expandNodes(ownerID, nodes, bitmap, including, node) {\n var count = 0;\n var expandedNodes = new Array(SIZE);\n for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {\n expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;\n }\n expandedNodes[including] = node;\n return new HashArrayMapNode(ownerID, count + 1, expandedNodes);\n }\n\n function mergeIntoMapWith(map, merger, iterables) {\n var iters = [];\n for (var ii = 0; ii < iterables.length; ii++) {\n var value = iterables[ii];\n var iter = KeyedIterable(value);\n if (!isIterable(value)) {\n iter = iter.map(function(v ) {return fromJS(v)});\n }\n iters.push(iter);\n }\n return mergeIntoCollectionWith(map, merger, iters);\n }\n\n function deepMerger(existing, value, key) {\n return existing && existing.mergeDeep && isIterable(value) ?\n existing.mergeDeep(value) :\n is(existing, value) ? existing : value;\n }\n\n function deepMergerWith(merger) {\n return function(existing, value, key) {\n if (existing && existing.mergeDeepWith && isIterable(value)) {\n return existing.mergeDeepWith(merger, value);\n }\n var nextValue = merger(existing, value, key);\n return is(existing, nextValue) ? existing : nextValue;\n };\n }\n\n function mergeIntoCollectionWith(collection, merger, iters) {\n iters = iters.filter(function(x ) {return x.size !== 0});\n if (iters.length === 0) {\n return collection;\n }\n if (collection.size === 0 && !collection.__ownerID && iters.length === 1) {\n return collection.constructor(iters[0]);\n }\n return collection.withMutations(function(collection ) {\n var mergeIntoMap = merger ?\n function(value, key) {\n collection.update(key, NOT_SET, function(existing )\n {return existing === NOT_SET ? value : merger(existing, value, key)}\n );\n } :\n function(value, key) {\n collection.set(key, value);\n }\n for (var ii = 0; ii < iters.length; ii++) {\n iters[ii].forEach(mergeIntoMap);\n }\n });\n }\n\n function updateInDeepMap(existing, keyPathIter, notSetValue, updater) {\n var isNotSet = existing === NOT_SET;\n var step = keyPathIter.next();\n if (step.done) {\n var existingValue = isNotSet ? notSetValue : existing;\n var newValue = updater(existingValue);\n return newValue === existingValue ? existing : newValue;\n }\n invariant(\n isNotSet || (existing && existing.set),\n 'invalid keyPath'\n );\n var key = step.value;\n var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET);\n var nextUpdated = updateInDeepMap(\n nextExisting,\n keyPathIter,\n notSetValue,\n updater\n );\n return nextUpdated === nextExisting ? existing :\n nextUpdated === NOT_SET ? existing.remove(key) :\n (isNotSet ? emptyMap() : existing).set(key, nextUpdated);\n }\n\n function popCount(x) {\n x = x - ((x >> 1) & 0x55555555);\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333);\n x = (x + (x >> 4)) & 0x0f0f0f0f;\n x = x + (x >> 8);\n x = x + (x >> 16);\n return x & 0x7f;\n }\n\n function setIn(array, idx, val, canEdit) {\n var newArray = canEdit ? array : arrCopy(array);\n newArray[idx] = val;\n return newArray;\n }\n\n function spliceIn(array, idx, val, canEdit) {\n var newLen = array.length + 1;\n if (canEdit && idx + 1 === newLen) {\n array[idx] = val;\n return array;\n }\n var newArray = new Array(newLen);\n var after = 0;\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n newArray[ii] = val;\n after = -1;\n } else {\n newArray[ii] = array[ii + after];\n }\n }\n return newArray;\n }\n\n function spliceOut(array, idx, canEdit) {\n var newLen = array.length - 1;\n if (canEdit && idx === newLen) {\n array.pop();\n return array;\n }\n var newArray = new Array(newLen);\n var after = 0;\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n after = 1;\n }\n newArray[ii] = array[ii + after];\n }\n return newArray;\n }\n\n var MAX_ARRAY_MAP_SIZE = SIZE / 4;\n var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;\n var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;\n\n createClass(List, IndexedCollection);\n\n // @pragma Construction\n\n function List(value) {\n var empty = emptyList();\n if (value === null || value === undefined) {\n return empty;\n }\n if (isList(value)) {\n return value;\n }\n var iter = IndexedIterable(value);\n var size = iter.size;\n if (size === 0) {\n return empty;\n }\n assertNotInfinite(size);\n if (size > 0 && size < SIZE) {\n return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));\n }\n return empty.withMutations(function(list ) {\n list.setSize(size);\n iter.forEach(function(v, i) {return list.set(i, v)});\n });\n }\n\n List.of = function(/*...values*/) {\n return this(arguments);\n };\n\n List.prototype.toString = function() {\n return this.__toString('List [', ']');\n };\n\n // @pragma Access\n\n List.prototype.get = function(index, notSetValue) {\n index = wrapIndex(this, index);\n if (index >= 0 && index < this.size) {\n index += this._origin;\n var node = listNodeFor(this, index);\n return node && node.array[index & MASK];\n }\n return notSetValue;\n };\n\n // @pragma Modification\n\n List.prototype.set = function(index, value) {\n return updateList(this, index, value);\n };\n\n List.prototype.remove = function(index) {\n return !this.has(index) ? this :\n index === 0 ? this.shift() :\n index === this.size - 1 ? this.pop() :\n this.splice(index, 1);\n };\n\n List.prototype.insert = function(index, value) {\n return this.splice(index, 0, value);\n };\n\n List.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = this._origin = this._capacity = 0;\n this._level = SHIFT;\n this._root = this._tail = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyList();\n };\n\n List.prototype.push = function(/*...values*/) {\n var values = arguments;\n var oldSize = this.size;\n return this.withMutations(function(list ) {\n setListBounds(list, 0, oldSize + values.length);\n for (var ii = 0; ii < values.length; ii++) {\n list.set(oldSize + ii, values[ii]);\n }\n });\n };\n\n List.prototype.pop = function() {\n return setListBounds(this, 0, -1);\n };\n\n List.prototype.unshift = function(/*...values*/) {\n var values = arguments;\n return this.withMutations(function(list ) {\n setListBounds(list, -values.length);\n for (var ii = 0; ii < values.length; ii++) {\n list.set(ii, values[ii]);\n }\n });\n };\n\n List.prototype.shift = function() {\n return setListBounds(this, 1);\n };\n\n // @pragma Composition\n\n List.prototype.merge = function(/*...iters*/) {\n return mergeIntoListWith(this, undefined, arguments);\n };\n\n List.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoListWith(this, merger, iters);\n };\n\n List.prototype.mergeDeep = function(/*...iters*/) {\n return mergeIntoListWith(this, deepMerger, arguments);\n };\n\n List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoListWith(this, deepMergerWith(merger), iters);\n };\n\n List.prototype.setSize = function(size) {\n return setListBounds(this, 0, size);\n };\n\n // @pragma Iteration\n\n List.prototype.slice = function(begin, end) {\n var size = this.size;\n if (wholeSlice(begin, end, size)) {\n return this;\n }\n return setListBounds(\n this,\n resolveBegin(begin, size),\n resolveEnd(end, size)\n );\n };\n\n List.prototype.__iterator = function(type, reverse) {\n var index = 0;\n var values = iterateList(this, reverse);\n return new Iterator(function() {\n var value = values();\n return value === DONE ?\n iteratorDone() :\n iteratorValue(type, index++, value);\n });\n };\n\n List.prototype.__iterate = function(fn, reverse) {\n var index = 0;\n var values = iterateList(this, reverse);\n var value;\n while ((value = values()) !== DONE) {\n if (fn(value, index++, this) === false) {\n break;\n }\n }\n return index;\n };\n\n List.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n return this;\n }\n return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash);\n };\n\n\n function isList(maybeList) {\n return !!(maybeList && maybeList[IS_LIST_SENTINEL]);\n }\n\n List.isList = isList;\n\n var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';\n\n var ListPrototype = List.prototype;\n ListPrototype[IS_LIST_SENTINEL] = true;\n ListPrototype[DELETE] = ListPrototype.remove;\n ListPrototype.setIn = MapPrototype.setIn;\n ListPrototype.deleteIn =\n ListPrototype.removeIn = MapPrototype.removeIn;\n ListPrototype.update = MapPrototype.update;\n ListPrototype.updateIn = MapPrototype.updateIn;\n ListPrototype.mergeIn = MapPrototype.mergeIn;\n ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n ListPrototype.withMutations = MapPrototype.withMutations;\n ListPrototype.asMutable = MapPrototype.asMutable;\n ListPrototype.asImmutable = MapPrototype.asImmutable;\n ListPrototype.wasAltered = MapPrototype.wasAltered;\n\n\n\n function VNode(array, ownerID) {\n this.array = array;\n this.ownerID = ownerID;\n }\n\n // TODO: seems like these methods are very similar\n\n VNode.prototype.removeBefore = function(ownerID, level, index) {\n if (index === level ? 1 << level : 0 || this.array.length === 0) {\n return this;\n }\n var originIndex = (index >>> level) & MASK;\n if (originIndex >= this.array.length) {\n return new VNode([], ownerID);\n }\n var removingFirst = originIndex === 0;\n var newChild;\n if (level > 0) {\n var oldChild = this.array[originIndex];\n newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);\n if (newChild === oldChild && removingFirst) {\n return this;\n }\n }\n if (removingFirst && !newChild) {\n return this;\n }\n var editable = editableVNode(this, ownerID);\n if (!removingFirst) {\n for (var ii = 0; ii < originIndex; ii++) {\n editable.array[ii] = undefined;\n }\n }\n if (newChild) {\n editable.array[originIndex] = newChild;\n }\n return editable;\n };\n\n VNode.prototype.removeAfter = function(ownerID, level, index) {\n if (index === (level ? 1 << level : 0) || this.array.length === 0) {\n return this;\n }\n var sizeIndex = ((index - 1) >>> level) & MASK;\n if (sizeIndex >= this.array.length) {\n return this;\n }\n\n var newChild;\n if (level > 0) {\n var oldChild = this.array[sizeIndex];\n newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);\n if (newChild === oldChild && sizeIndex === this.array.length - 1) {\n return this;\n }\n }\n\n var editable = editableVNode(this, ownerID);\n editable.array.splice(sizeIndex + 1);\n if (newChild) {\n editable.array[sizeIndex] = newChild;\n }\n return editable;\n };\n\n\n\n var DONE = {};\n\n function iterateList(list, reverse) {\n var left = list._origin;\n var right = list._capacity;\n var tailPos = getTailOffset(right);\n var tail = list._tail;\n\n return iterateNodeOrLeaf(list._root, list._level, 0);\n\n function iterateNodeOrLeaf(node, level, offset) {\n return level === 0 ?\n iterateLeaf(node, offset) :\n iterateNode(node, level, offset);\n }\n\n function iterateLeaf(node, offset) {\n var array = offset === tailPos ? tail && tail.array : node && node.array;\n var from = offset > left ? 0 : left - offset;\n var to = right - offset;\n if (to > SIZE) {\n to = SIZE;\n }\n return function() {\n if (from === to) {\n return DONE;\n }\n var idx = reverse ? --to : from++;\n return array && array[idx];\n };\n }\n\n function iterateNode(node, level, offset) {\n var values;\n var array = node && node.array;\n var from = offset > left ? 0 : (left - offset) >> level;\n var to = ((right - offset) >> level) + 1;\n if (to > SIZE) {\n to = SIZE;\n }\n return function() {\n do {\n if (values) {\n var value = values();\n if (value !== DONE) {\n return value;\n }\n values = null;\n }\n if (from === to) {\n return DONE;\n }\n var idx = reverse ? --to : from++;\n values = iterateNodeOrLeaf(\n array && array[idx], level - SHIFT, offset + (idx << level)\n );\n } while (true);\n };\n }\n }\n\n function makeList(origin, capacity, level, root, tail, ownerID, hash) {\n var list = Object.create(ListPrototype);\n list.size = capacity - origin;\n list._origin = origin;\n list._capacity = capacity;\n list._level = level;\n list._root = root;\n list._tail = tail;\n list.__ownerID = ownerID;\n list.__hash = hash;\n list.__altered = false;\n return list;\n }\n\n var EMPTY_LIST;\n function emptyList() {\n return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));\n }\n\n function updateList(list, index, value) {\n index = wrapIndex(list, index);\n\n if (index !== index) {\n return list;\n }\n\n if (index >= list.size || index < 0) {\n return list.withMutations(function(list ) {\n index < 0 ?\n setListBounds(list, index).set(0, value) :\n setListBounds(list, 0, index + 1).set(index, value)\n });\n }\n\n index += list._origin;\n\n var newTail = list._tail;\n var newRoot = list._root;\n var didAlter = MakeRef(DID_ALTER);\n if (index >= getTailOffset(list._capacity)) {\n newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);\n } else {\n newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter);\n }\n\n if (!didAlter.value) {\n return list;\n }\n\n if (list.__ownerID) {\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n return makeList(list._origin, list._capacity, list._level, newRoot, newTail);\n }\n\n function updateVNode(node, ownerID, level, index, value, didAlter) {\n var idx = (index >>> level) & MASK;\n var nodeHas = node && idx < node.array.length;\n if (!nodeHas && value === undefined) {\n return node;\n }\n\n var newNode;\n\n if (level > 0) {\n var lowerNode = node && node.array[idx];\n var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter);\n if (newLowerNode === lowerNode) {\n return node;\n }\n newNode = editableVNode(node, ownerID);\n newNode.array[idx] = newLowerNode;\n return newNode;\n }\n\n if (nodeHas && node.array[idx] === value) {\n return node;\n }\n\n SetRef(didAlter);\n\n newNode = editableVNode(node, ownerID);\n if (value === undefined && idx === newNode.array.length - 1) {\n newNode.array.pop();\n } else {\n newNode.array[idx] = value;\n }\n return newNode;\n }\n\n function editableVNode(node, ownerID) {\n if (ownerID && node && ownerID === node.ownerID) {\n return node;\n }\n return new VNode(node ? node.array.slice() : [], ownerID);\n }\n\n function listNodeFor(list, rawIndex) {\n if (rawIndex >= getTailOffset(list._capacity)) {\n return list._tail;\n }\n if (rawIndex < 1 << (list._level + SHIFT)) {\n var node = list._root;\n var level = list._level;\n while (node && level > 0) {\n node = node.array[(rawIndex >>> level) & MASK];\n level -= SHIFT;\n }\n return node;\n }\n }\n\n function setListBounds(list, begin, end) {\n // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n if (begin !== undefined) {\n begin = begin | 0;\n }\n if (end !== undefined) {\n end = end | 0;\n }\n var owner = list.__ownerID || new OwnerID();\n var oldOrigin = list._origin;\n var oldCapacity = list._capacity;\n var newOrigin = oldOrigin + begin;\n var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end;\n if (newOrigin === oldOrigin && newCapacity === oldCapacity) {\n return list;\n }\n\n // If it's going to end after it starts, it's empty.\n if (newOrigin >= newCapacity) {\n return list.clear();\n }\n\n var newLevel = list._level;\n var newRoot = list._root;\n\n // New origin might need creating a higher root.\n var offsetShift = 0;\n while (newOrigin + offsetShift < 0) {\n newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner);\n newLevel += SHIFT;\n offsetShift += 1 << newLevel;\n }\n if (offsetShift) {\n newOrigin += offsetShift;\n oldOrigin += offsetShift;\n newCapacity += offsetShift;\n oldCapacity += offsetShift;\n }\n\n var oldTailOffset = getTailOffset(oldCapacity);\n var newTailOffset = getTailOffset(newCapacity);\n\n // New size might need creating a higher root.\n while (newTailOffset >= 1 << (newLevel + SHIFT)) {\n newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner);\n newLevel += SHIFT;\n }\n\n // Locate or create the new tail.\n var oldTail = list._tail;\n var newTail = newTailOffset < oldTailOffset ?\n listNodeFor(list, newCapacity - 1) :\n newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail;\n\n // Merge Tail into tree.\n if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) {\n newRoot = editableVNode(newRoot, owner);\n var node = newRoot;\n for (var level = newLevel; level > SHIFT; level -= SHIFT) {\n var idx = (oldTailOffset >>> level) & MASK;\n node = node.array[idx] = editableVNode(node.array[idx], owner);\n }\n node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;\n }\n\n // If the size has been reduced, there's a chance the tail needs to be trimmed.\n if (newCapacity < oldCapacity) {\n newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);\n }\n\n // If the new origin is within the tail, then we do not need a root.\n if (newOrigin >= newTailOffset) {\n newOrigin -= newTailOffset;\n newCapacity -= newTailOffset;\n newLevel = SHIFT;\n newRoot = null;\n newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);\n\n // Otherwise, if the root has been trimmed, garbage collect.\n } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {\n offsetShift = 0;\n\n // Identify the new top root node of the subtree of the old root.\n while (newRoot) {\n var beginIndex = (newOrigin >>> newLevel) & MASK;\n if (beginIndex !== (newTailOffset >>> newLevel) & MASK) {\n break;\n }\n if (beginIndex) {\n offsetShift += (1 << newLevel) * beginIndex;\n }\n newLevel -= SHIFT;\n newRoot = newRoot.array[beginIndex];\n }\n\n // Trim the new sides of the new root.\n if (newRoot && newOrigin > oldOrigin) {\n newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);\n }\n if (newRoot && newTailOffset < oldTailOffset) {\n newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift);\n }\n if (offsetShift) {\n newOrigin -= offsetShift;\n newCapacity -= offsetShift;\n }\n }\n\n if (list.__ownerID) {\n list.size = newCapacity - newOrigin;\n list._origin = newOrigin;\n list._capacity = newCapacity;\n list._level = newLevel;\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);\n }\n\n function mergeIntoListWith(list, merger, iterables) {\n var iters = [];\n var maxSize = 0;\n for (var ii = 0; ii < iterables.length; ii++) {\n var value = iterables[ii];\n var iter = IndexedIterable(value);\n if (iter.size > maxSize) {\n maxSize = iter.size;\n }\n if (!isIterable(value)) {\n iter = iter.map(function(v ) {return fromJS(v)});\n }\n iters.push(iter);\n }\n if (maxSize > list.size) {\n list = list.setSize(maxSize);\n }\n return mergeIntoCollectionWith(list, merger, iters);\n }\n\n function getTailOffset(size) {\n return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT);\n }\n\n createClass(OrderedMap, Map);\n\n // @pragma Construction\n\n function OrderedMap(value) {\n return value === null || value === undefined ? emptyOrderedMap() :\n isOrderedMap(value) ? value :\n emptyOrderedMap().withMutations(function(map ) {\n var iter = KeyedIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v, k) {return map.set(k, v)});\n });\n }\n\n OrderedMap.of = function(/*...values*/) {\n return this(arguments);\n };\n\n OrderedMap.prototype.toString = function() {\n return this.__toString('OrderedMap {', '}');\n };\n\n // @pragma Access\n\n OrderedMap.prototype.get = function(k, notSetValue) {\n var index = this._map.get(k);\n return index !== undefined ? this._list.get(index)[1] : notSetValue;\n };\n\n // @pragma Modification\n\n OrderedMap.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._map.clear();\n this._list.clear();\n return this;\n }\n return emptyOrderedMap();\n };\n\n OrderedMap.prototype.set = function(k, v) {\n return updateOrderedMap(this, k, v);\n };\n\n OrderedMap.prototype.remove = function(k) {\n return updateOrderedMap(this, k, NOT_SET);\n };\n\n OrderedMap.prototype.wasAltered = function() {\n return this._map.wasAltered() || this._list.wasAltered();\n };\n\n OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._list.__iterate(\n function(entry ) {return entry && fn(entry[1], entry[0], this$0)},\n reverse\n );\n };\n\n OrderedMap.prototype.__iterator = function(type, reverse) {\n return this._list.fromEntrySeq().__iterator(type, reverse);\n };\n\n OrderedMap.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map.__ensureOwner(ownerID);\n var newList = this._list.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n this._list = newList;\n return this;\n }\n return makeOrderedMap(newMap, newList, ownerID, this.__hash);\n };\n\n\n function isOrderedMap(maybeOrderedMap) {\n return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);\n }\n\n OrderedMap.isOrderedMap = isOrderedMap;\n\n OrderedMap.prototype[IS_ORDERED_SENTINEL] = true;\n OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;\n\n\n\n function makeOrderedMap(map, list, ownerID, hash) {\n var omap = Object.create(OrderedMap.prototype);\n omap.size = map ? map.size : 0;\n omap._map = map;\n omap._list = list;\n omap.__ownerID = ownerID;\n omap.__hash = hash;\n return omap;\n }\n\n var EMPTY_ORDERED_MAP;\n function emptyOrderedMap() {\n return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()));\n }\n\n function updateOrderedMap(omap, k, v) {\n var map = omap._map;\n var list = omap._list;\n var i = map.get(k);\n var has = i !== undefined;\n var newMap;\n var newList;\n if (v === NOT_SET) { // removed\n if (!has) {\n return omap;\n }\n if (list.size >= SIZE && list.size >= map.size * 2) {\n newList = list.filter(function(entry, idx) {return entry !== undefined && i !== idx});\n newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap();\n if (omap.__ownerID) {\n newMap.__ownerID = newList.__ownerID = omap.__ownerID;\n }\n } else {\n newMap = map.remove(k);\n newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);\n }\n } else {\n if (has) {\n if (v === list.get(i)[1]) {\n return omap;\n }\n newMap = map;\n newList = list.set(i, [k, v]);\n } else {\n newMap = map.set(k, list.size);\n newList = list.set(list.size, [k, v]);\n }\n }\n if (omap.__ownerID) {\n omap.size = newMap.size;\n omap._map = newMap;\n omap._list = newList;\n omap.__hash = undefined;\n return omap;\n }\n return makeOrderedMap(newMap, newList);\n }\n\n createClass(ToKeyedSequence, KeyedSeq);\n function ToKeyedSequence(indexed, useKeys) {\n this._iter = indexed;\n this._useKeys = useKeys;\n this.size = indexed.size;\n }\n\n ToKeyedSequence.prototype.get = function(key, notSetValue) {\n return this._iter.get(key, notSetValue);\n };\n\n ToKeyedSequence.prototype.has = function(key) {\n return this._iter.has(key);\n };\n\n ToKeyedSequence.prototype.valueSeq = function() {\n return this._iter.valueSeq();\n };\n\n ToKeyedSequence.prototype.reverse = function() {var this$0 = this;\n var reversedSequence = reverseFactory(this, true);\n if (!this._useKeys) {\n reversedSequence.valueSeq = function() {return this$0._iter.toSeq().reverse()};\n }\n return reversedSequence;\n };\n\n ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this;\n var mappedSequence = mapFactory(this, mapper, context);\n if (!this._useKeys) {\n mappedSequence.valueSeq = function() {return this$0._iter.toSeq().map(mapper, context)};\n }\n return mappedSequence;\n };\n\n ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var ii;\n return this._iter.__iterate(\n this._useKeys ?\n function(v, k) {return fn(v, k, this$0)} :\n ((ii = reverse ? resolveSize(this) : 0),\n function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}),\n reverse\n );\n };\n\n ToKeyedSequence.prototype.__iterator = function(type, reverse) {\n if (this._useKeys) {\n return this._iter.__iterator(type, reverse);\n }\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n var ii = reverse ? resolveSize(this) : 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, reverse ? --ii : ii++, step.value, step);\n });\n };\n\n ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n createClass(ToIndexedSequence, IndexedSeq);\n function ToIndexedSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n ToIndexedSequence.prototype.includes = function(value) {\n return this._iter.includes(value);\n };\n\n ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse);\n };\n\n ToIndexedSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n var iterations = 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, iterations++, step.value, step)\n });\n };\n\n\n\n createClass(ToSetSequence, SetSeq);\n function ToSetSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n ToSetSequence.prototype.has = function(key) {\n return this._iter.includes(key);\n };\n\n ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse);\n };\n\n ToSetSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, step.value, step.value, step);\n });\n };\n\n\n\n createClass(FromEntriesSequence, KeyedSeq);\n function FromEntriesSequence(entries) {\n this._iter = entries;\n this.size = entries.size;\n }\n\n FromEntriesSequence.prototype.entrySeq = function() {\n return this._iter.toSeq();\n };\n\n FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._iter.__iterate(function(entry ) {\n // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n if (entry) {\n validateEntry(entry);\n var indexedIterable = isIterable(entry);\n return fn(\n indexedIterable ? entry.get(1) : entry[1],\n indexedIterable ? entry.get(0) : entry[0],\n this$0\n );\n }\n }, reverse);\n };\n\n FromEntriesSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n return new Iterator(function() {\n while (true) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n if (entry) {\n validateEntry(entry);\n var indexedIterable = isIterable(entry);\n return iteratorValue(\n type,\n indexedIterable ? entry.get(0) : entry[0],\n indexedIterable ? entry.get(1) : entry[1],\n step\n );\n }\n }\n });\n };\n\n\n ToIndexedSequence.prototype.cacheResult =\n ToKeyedSequence.prototype.cacheResult =\n ToSetSequence.prototype.cacheResult =\n FromEntriesSequence.prototype.cacheResult =\n cacheResultThrough;\n\n\n function flipFactory(iterable) {\n var flipSequence = makeSequence(iterable);\n flipSequence._iter = iterable;\n flipSequence.size = iterable.size;\n flipSequence.flip = function() {return iterable};\n flipSequence.reverse = function () {\n var reversedSequence = iterable.reverse.apply(this); // super.reverse()\n reversedSequence.flip = function() {return iterable.reverse()};\n return reversedSequence;\n };\n flipSequence.has = function(key ) {return iterable.includes(key)};\n flipSequence.includes = function(key ) {return iterable.has(key)};\n flipSequence.cacheResult = cacheResultThrough;\n flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(function(v, k) {return fn(k, v, this$0) !== false}, reverse);\n }\n flipSequence.__iteratorUncached = function(type, reverse) {\n if (type === ITERATE_ENTRIES) {\n var iterator = iterable.__iterator(type, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n if (!step.done) {\n var k = step.value[0];\n step.value[0] = step.value[1];\n step.value[1] = k;\n }\n return step;\n });\n }\n return iterable.__iterator(\n type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES,\n reverse\n );\n }\n return flipSequence;\n }\n\n\n function mapFactory(iterable, mapper, context) {\n var mappedSequence = makeSequence(iterable);\n mappedSequence.size = iterable.size;\n mappedSequence.has = function(key ) {return iterable.has(key)};\n mappedSequence.get = function(key, notSetValue) {\n var v = iterable.get(key, NOT_SET);\n return v === NOT_SET ?\n notSetValue :\n mapper.call(context, v, key, iterable);\n };\n mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(\n function(v, k, c) {return fn(mapper.call(context, v, k, c), k, this$0) !== false},\n reverse\n );\n }\n mappedSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var key = entry[0];\n return iteratorValue(\n type,\n key,\n mapper.call(context, entry[1], key, iterable),\n step\n );\n });\n }\n return mappedSequence;\n }\n\n\n function reverseFactory(iterable, useKeys) {\n var reversedSequence = makeSequence(iterable);\n reversedSequence._iter = iterable;\n reversedSequence.size = iterable.size;\n reversedSequence.reverse = function() {return iterable};\n if (iterable.flip) {\n reversedSequence.flip = function () {\n var flipSequence = flipFactory(iterable);\n flipSequence.reverse = function() {return iterable.flip()};\n return flipSequence;\n };\n }\n reversedSequence.get = function(key, notSetValue) \n {return iterable.get(useKeys ? key : -1 - key, notSetValue)};\n reversedSequence.has = function(key )\n {return iterable.has(useKeys ? key : -1 - key)};\n reversedSequence.includes = function(value ) {return iterable.includes(value)};\n reversedSequence.cacheResult = cacheResultThrough;\n reversedSequence.__iterate = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(function(v, k) {return fn(v, k, this$0)}, !reverse);\n };\n reversedSequence.__iterator =\n function(type, reverse) {return iterable.__iterator(type, !reverse)};\n return reversedSequence;\n }\n\n\n function filterFactory(iterable, predicate, context, useKeys) {\n var filterSequence = makeSequence(iterable);\n if (useKeys) {\n filterSequence.has = function(key ) {\n var v = iterable.get(key, NOT_SET);\n return v !== NOT_SET && !!predicate.call(context, v, key, iterable);\n };\n filterSequence.get = function(key, notSetValue) {\n var v = iterable.get(key, NOT_SET);\n return v !== NOT_SET && predicate.call(context, v, key, iterable) ?\n v : notSetValue;\n };\n }\n filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n var iterations = 0;\n iterable.__iterate(function(v, k, c) {\n if (predicate.call(context, v, k, c)) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0);\n }\n }, reverse);\n return iterations;\n };\n filterSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var iterations = 0;\n return new Iterator(function() {\n while (true) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var key = entry[0];\n var value = entry[1];\n if (predicate.call(context, value, key, iterable)) {\n return iteratorValue(type, useKeys ? key : iterations++, value, step);\n }\n }\n });\n }\n return filterSequence;\n }\n\n\n function countByFactory(iterable, grouper, context) {\n var groups = Map().asMutable();\n iterable.__iterate(function(v, k) {\n groups.update(\n grouper.call(context, v, k, iterable),\n 0,\n function(a ) {return a + 1}\n );\n });\n return groups.asImmutable();\n }\n\n\n function groupByFactory(iterable, grouper, context) {\n var isKeyedIter = isKeyed(iterable);\n var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable();\n iterable.__iterate(function(v, k) {\n groups.update(\n grouper.call(context, v, k, iterable),\n function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)}\n );\n });\n var coerce = iterableClass(iterable);\n return groups.map(function(arr ) {return reify(iterable, coerce(arr))});\n }\n\n\n function sliceFactory(iterable, begin, end, useKeys) {\n var originalSize = iterable.size;\n\n // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n if (begin !== undefined) {\n begin = begin | 0;\n }\n if (end !== undefined) {\n if (end === Infinity) {\n end = originalSize;\n } else {\n end = end | 0;\n }\n }\n\n if (wholeSlice(begin, end, originalSize)) {\n return iterable;\n }\n\n var resolvedBegin = resolveBegin(begin, originalSize);\n var resolvedEnd = resolveEnd(end, originalSize);\n\n // begin or end will be NaN if they were provided as negative numbers and\n // this iterable's size is unknown. In that case, cache first so there is\n // a known size and these do not resolve to NaN.\n if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {\n return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys);\n }\n\n // Note: resolvedEnd is undefined when the original sequence's length is\n // unknown and this slice did not supply an end and should contain all\n // elements after resolvedBegin.\n // In that case, resolvedSize will be NaN and sliceSize will remain undefined.\n var resolvedSize = resolvedEnd - resolvedBegin;\n var sliceSize;\n if (resolvedSize === resolvedSize) {\n sliceSize = resolvedSize < 0 ? 0 : resolvedSize;\n }\n\n var sliceSeq = makeSequence(iterable);\n\n // If iterable.size is undefined, the size of the realized sliceSeq is\n // unknown at this point unless the number of items to slice is 0\n sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined;\n\n if (!useKeys && isSeq(iterable) && sliceSize >= 0) {\n sliceSeq.get = function (index, notSetValue) {\n index = wrapIndex(this, index);\n return index >= 0 && index < sliceSize ?\n iterable.get(index + resolvedBegin, notSetValue) :\n notSetValue;\n }\n }\n\n sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this;\n if (sliceSize === 0) {\n return 0;\n }\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var skipped = 0;\n var isSkipping = true;\n var iterations = 0;\n iterable.__iterate(function(v, k) {\n if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0) !== false &&\n iterations !== sliceSize;\n }\n });\n return iterations;\n };\n\n sliceSeq.__iteratorUncached = function(type, reverse) {\n if (sliceSize !== 0 && reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n // Don't bother instantiating parent iterator if taking 0.\n var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse);\n var skipped = 0;\n var iterations = 0;\n return new Iterator(function() {\n while (skipped++ < resolvedBegin) {\n iterator.next();\n }\n if (++iterations > sliceSize) {\n return iteratorDone();\n }\n var step = iterator.next();\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n } else if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations - 1, undefined, step);\n } else {\n return iteratorValue(type, iterations - 1, step.value[1], step);\n }\n });\n }\n\n return sliceSeq;\n }\n\n\n function takeWhileFactory(iterable, predicate, context) {\n var takeSequence = makeSequence(iterable);\n takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterations = 0;\n iterable.__iterate(function(v, k, c) \n {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)}\n );\n return iterations;\n };\n takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var iterating = true;\n return new Iterator(function() {\n if (!iterating) {\n return iteratorDone();\n }\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var k = entry[0];\n var v = entry[1];\n if (!predicate.call(context, v, k, this$0)) {\n iterating = false;\n return iteratorDone();\n }\n return type === ITERATE_ENTRIES ? step :\n iteratorValue(type, k, v, step);\n });\n };\n return takeSequence;\n }\n\n\n function skipWhileFactory(iterable, predicate, context, useKeys) {\n var skipSequence = makeSequence(iterable);\n skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var isSkipping = true;\n var iterations = 0;\n iterable.__iterate(function(v, k, c) {\n if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0);\n }\n });\n return iterations;\n };\n skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var skipping = true;\n var iterations = 0;\n return new Iterator(function() {\n var step, k, v;\n do {\n step = iterator.next();\n if (step.done) {\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n } else if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations++, undefined, step);\n } else {\n return iteratorValue(type, iterations++, step.value[1], step);\n }\n }\n var entry = step.value;\n k = entry[0];\n v = entry[1];\n skipping && (skipping = predicate.call(context, v, k, this$0));\n } while (skipping);\n return type === ITERATE_ENTRIES ? step :\n iteratorValue(type, k, v, step);\n });\n };\n return skipSequence;\n }\n\n\n function concatFactory(iterable, values) {\n var isKeyedIterable = isKeyed(iterable);\n var iters = [iterable].concat(values).map(function(v ) {\n if (!isIterable(v)) {\n v = isKeyedIterable ?\n keyedSeqFromValue(v) :\n indexedSeqFromValue(Array.isArray(v) ? v : [v]);\n } else if (isKeyedIterable) {\n v = KeyedIterable(v);\n }\n return v;\n }).filter(function(v ) {return v.size !== 0});\n\n if (iters.length === 0) {\n return iterable;\n }\n\n if (iters.length === 1) {\n var singleton = iters[0];\n if (singleton === iterable ||\n isKeyedIterable && isKeyed(singleton) ||\n isIndexed(iterable) && isIndexed(singleton)) {\n return singleton;\n }\n }\n\n var concatSeq = new ArraySeq(iters);\n if (isKeyedIterable) {\n concatSeq = concatSeq.toKeyedSeq();\n } else if (!isIndexed(iterable)) {\n concatSeq = concatSeq.toSetSeq();\n }\n concatSeq = concatSeq.flatten(true);\n concatSeq.size = iters.reduce(\n function(sum, seq) {\n if (sum !== undefined) {\n var size = seq.size;\n if (size !== undefined) {\n return sum + size;\n }\n }\n },\n 0\n );\n return concatSeq;\n }\n\n\n function flattenFactory(iterable, depth, useKeys) {\n var flatSequence = makeSequence(iterable);\n flatSequence.__iterateUncached = function(fn, reverse) {\n var iterations = 0;\n var stopped = false;\n function flatDeep(iter, currentDepth) {var this$0 = this;\n iter.__iterate(function(v, k) {\n if ((!depth || currentDepth < depth) && isIterable(v)) {\n flatDeep(v, currentDepth + 1);\n } else if (fn(v, useKeys ? k : iterations++, this$0) === false) {\n stopped = true;\n }\n return !stopped;\n }, reverse);\n }\n flatDeep(iterable, 0);\n return iterations;\n }\n flatSequence.__iteratorUncached = function(type, reverse) {\n var iterator = iterable.__iterator(type, reverse);\n var stack = [];\n var iterations = 0;\n return new Iterator(function() {\n while (iterator) {\n var step = iterator.next();\n if (step.done !== false) {\n iterator = stack.pop();\n continue;\n }\n var v = step.value;\n if (type === ITERATE_ENTRIES) {\n v = v[1];\n }\n if ((!depth || stack.length < depth) && isIterable(v)) {\n stack.push(iterator);\n iterator = v.__iterator(type, reverse);\n } else {\n return useKeys ? step : iteratorValue(type, iterations++, v, step);\n }\n }\n return iteratorDone();\n });\n }\n return flatSequence;\n }\n\n\n function flatMapFactory(iterable, mapper, context) {\n var coerce = iterableClass(iterable);\n return iterable.toSeq().map(\n function(v, k) {return coerce(mapper.call(context, v, k, iterable))}\n ).flatten(true);\n }\n\n\n function interposeFactory(iterable, separator) {\n var interposedSequence = makeSequence(iterable);\n interposedSequence.size = iterable.size && iterable.size * 2 -1;\n interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n iterable.__iterate(function(v, k) \n {return (!iterations || fn(separator, iterations++, this$0) !== false) &&\n fn(v, iterations++, this$0) !== false},\n reverse\n );\n return iterations;\n };\n interposedSequence.__iteratorUncached = function(type, reverse) {\n var iterator = iterable.__iterator(ITERATE_VALUES, reverse);\n var iterations = 0;\n var step;\n return new Iterator(function() {\n if (!step || iterations % 2) {\n step = iterator.next();\n if (step.done) {\n return step;\n }\n }\n return iterations % 2 ?\n iteratorValue(type, iterations++, separator) :\n iteratorValue(type, iterations++, step.value, step);\n });\n };\n return interposedSequence;\n }\n\n\n function sortFactory(iterable, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n var isKeyedIterable = isKeyed(iterable);\n var index = 0;\n var entries = iterable.toSeq().map(\n function(v, k) {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]}\n ).toArray();\n entries.sort(function(a, b) {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach(\n isKeyedIterable ?\n function(v, i) { entries[i].length = 2; } :\n function(v, i) { entries[i] = v[1]; }\n );\n return isKeyedIterable ? KeyedSeq(entries) :\n isIndexed(iterable) ? IndexedSeq(entries) :\n SetSeq(entries);\n }\n\n\n function maxFactory(iterable, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n if (mapper) {\n var entry = iterable.toSeq()\n .map(function(v, k) {return [v, mapper(v, k, iterable)]})\n .reduce(function(a, b) {return maxCompare(comparator, a[1], b[1]) ? b : a});\n return entry && entry[0];\n } else {\n return iterable.reduce(function(a, b) {return maxCompare(comparator, a, b) ? b : a});\n }\n }\n\n function maxCompare(comparator, a, b) {\n var comp = comparator(b, a);\n // b is considered the new max if the comparator declares them equal, but\n // they are not equal and b is in fact a nullish value.\n return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0;\n }\n\n\n function zipWithFactory(keyIter, zipper, iters) {\n var zipSequence = makeSequence(keyIter);\n zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min();\n // Note: this a generic base implementation of __iterate in terms of\n // __iterator which may be more generically useful in the future.\n zipSequence.__iterate = function(fn, reverse) {\n /* generic:\n var iterator = this.__iterator(ITERATE_ENTRIES, reverse);\n var step;\n var iterations = 0;\n while (!(step = iterator.next()).done) {\n iterations++;\n if (fn(step.value[1], step.value[0], this) === false) {\n break;\n }\n }\n return iterations;\n */\n // indexed:\n var iterator = this.__iterator(ITERATE_VALUES, reverse);\n var step;\n var iterations = 0;\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n return iterations;\n };\n zipSequence.__iteratorUncached = function(type, reverse) {\n var iterators = iters.map(function(i )\n {return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))}\n );\n var iterations = 0;\n var isDone = false;\n return new Iterator(function() {\n var steps;\n if (!isDone) {\n steps = iterators.map(function(i ) {return i.next()});\n isDone = steps.some(function(s ) {return s.done});\n }\n if (isDone) {\n return iteratorDone();\n }\n return iteratorValue(\n type,\n iterations++,\n zipper.apply(null, steps.map(function(s ) {return s.value}))\n );\n });\n };\n return zipSequence\n }\n\n\n // #pragma Helper Functions\n\n function reify(iter, seq) {\n return isSeq(iter) ? seq : iter.constructor(seq);\n }\n\n function validateEntry(entry) {\n if (entry !== Object(entry)) {\n throw new TypeError('Expected [K, V] tuple: ' + entry);\n }\n }\n\n function resolveSize(iter) {\n assertNotInfinite(iter.size);\n return ensureSize(iter);\n }\n\n function iterableClass(iterable) {\n return isKeyed(iterable) ? KeyedIterable :\n isIndexed(iterable) ? IndexedIterable :\n SetIterable;\n }\n\n function makeSequence(iterable) {\n return Object.create(\n (\n isKeyed(iterable) ? KeyedSeq :\n isIndexed(iterable) ? IndexedSeq :\n SetSeq\n ).prototype\n );\n }\n\n function cacheResultThrough() {\n if (this._iter.cacheResult) {\n this._iter.cacheResult();\n this.size = this._iter.size;\n return this;\n } else {\n return Seq.prototype.cacheResult.call(this);\n }\n }\n\n function defaultComparator(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n }\n\n function forceIterator(keyPath) {\n var iter = getIterator(keyPath);\n if (!iter) {\n // Array might not be iterable in this environment, so we need a fallback\n // to our wrapped type.\n if (!isArrayLike(keyPath)) {\n throw new TypeError('Expected iterable or array-like: ' + keyPath);\n }\n iter = getIterator(Iterable(keyPath));\n }\n return iter;\n }\n\n createClass(Record, KeyedCollection);\n\n function Record(defaultValues, name) {\n var hasInitialized;\n\n var RecordType = function Record(values) {\n if (values instanceof RecordType) {\n return values;\n }\n if (!(this instanceof RecordType)) {\n return new RecordType(values);\n }\n if (!hasInitialized) {\n hasInitialized = true;\n var keys = Object.keys(defaultValues);\n setProps(RecordTypePrototype, keys);\n RecordTypePrototype.size = keys.length;\n RecordTypePrototype._name = name;\n RecordTypePrototype._keys = keys;\n RecordTypePrototype._defaultValues = defaultValues;\n }\n this._map = Map(values);\n };\n\n var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype);\n RecordTypePrototype.constructor = RecordType;\n\n return RecordType;\n }\n\n Record.prototype.toString = function() {\n return this.__toString(recordName(this) + ' {', '}');\n };\n\n // @pragma Access\n\n Record.prototype.has = function(k) {\n return this._defaultValues.hasOwnProperty(k);\n };\n\n Record.prototype.get = function(k, notSetValue) {\n if (!this.has(k)) {\n return notSetValue;\n }\n var defaultVal = this._defaultValues[k];\n return this._map ? this._map.get(k, defaultVal) : defaultVal;\n };\n\n // @pragma Modification\n\n Record.prototype.clear = function() {\n if (this.__ownerID) {\n this._map && this._map.clear();\n return this;\n }\n var RecordType = this.constructor;\n return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap()));\n };\n\n Record.prototype.set = function(k, v) {\n if (!this.has(k)) {\n throw new Error('Cannot set unknown key \"' + k + '\" on ' + recordName(this));\n }\n if (this._map && !this._map.has(k)) {\n var defaultVal = this._defaultValues[k];\n if (v === defaultVal) {\n return this;\n }\n }\n var newMap = this._map && this._map.set(k, v);\n if (this.__ownerID || newMap === this._map) {\n return this;\n }\n return makeRecord(this, newMap);\n };\n\n Record.prototype.remove = function(k) {\n if (!this.has(k)) {\n return this;\n }\n var newMap = this._map && this._map.remove(k);\n if (this.__ownerID || newMap === this._map) {\n return this;\n }\n return makeRecord(this, newMap);\n };\n\n Record.prototype.wasAltered = function() {\n return this._map.wasAltered();\n };\n\n Record.prototype.__iterator = function(type, reverse) {var this$0 = this;\n return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterator(type, reverse);\n };\n\n Record.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterate(fn, reverse);\n };\n\n Record.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map && this._map.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n return makeRecord(this, newMap, ownerID);\n };\n\n\n var RecordPrototype = Record.prototype;\n RecordPrototype[DELETE] = RecordPrototype.remove;\n RecordPrototype.deleteIn =\n RecordPrototype.removeIn = MapPrototype.removeIn;\n RecordPrototype.merge = MapPrototype.merge;\n RecordPrototype.mergeWith = MapPrototype.mergeWith;\n RecordPrototype.mergeIn = MapPrototype.mergeIn;\n RecordPrototype.mergeDeep = MapPrototype.mergeDeep;\n RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith;\n RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n RecordPrototype.setIn = MapPrototype.setIn;\n RecordPrototype.update = MapPrototype.update;\n RecordPrototype.updateIn = MapPrototype.updateIn;\n RecordPrototype.withMutations = MapPrototype.withMutations;\n RecordPrototype.asMutable = MapPrototype.asMutable;\n RecordPrototype.asImmutable = MapPrototype.asImmutable;\n\n\n function makeRecord(likeRecord, map, ownerID) {\n var record = Object.create(Object.getPrototypeOf(likeRecord));\n record._map = map;\n record.__ownerID = ownerID;\n return record;\n }\n\n function recordName(record) {\n return record._name || record.constructor.name || 'Record';\n }\n\n function setProps(prototype, names) {\n try {\n names.forEach(setProp.bind(undefined, prototype));\n } catch (error) {\n // Object.defineProperty failed. Probably IE8.\n }\n }\n\n function setProp(prototype, name) {\n Object.defineProperty(prototype, name, {\n get: function() {\n return this.get(name);\n },\n set: function(value) {\n invariant(this.__ownerID, 'Cannot set on an immutable record.');\n this.set(name, value);\n }\n });\n }\n\n createClass(Set, SetCollection);\n\n // @pragma Construction\n\n function Set(value) {\n return value === null || value === undefined ? emptySet() :\n isSet(value) && !isOrdered(value) ? value :\n emptySet().withMutations(function(set ) {\n var iter = SetIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v ) {return set.add(v)});\n });\n }\n\n Set.of = function(/*...values*/) {\n return this(arguments);\n };\n\n Set.fromKeys = function(value) {\n return this(KeyedIterable(value).keySeq());\n };\n\n Set.prototype.toString = function() {\n return this.__toString('Set {', '}');\n };\n\n // @pragma Access\n\n Set.prototype.has = function(value) {\n return this._map.has(value);\n };\n\n // @pragma Modification\n\n Set.prototype.add = function(value) {\n return updateSet(this, this._map.set(value, true));\n };\n\n Set.prototype.remove = function(value) {\n return updateSet(this, this._map.remove(value));\n };\n\n Set.prototype.clear = function() {\n return updateSet(this, this._map.clear());\n };\n\n // @pragma Composition\n\n Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0);\n iters = iters.filter(function(x ) {return x.size !== 0});\n if (iters.length === 0) {\n return this;\n }\n if (this.size === 0 && !this.__ownerID && iters.length === 1) {\n return this.constructor(iters[0]);\n }\n return this.withMutations(function(set ) {\n for (var ii = 0; ii < iters.length; ii++) {\n SetIterable(iters[ii]).forEach(function(value ) {return set.add(value)});\n }\n });\n };\n\n Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0);\n if (iters.length === 0) {\n return this;\n }\n iters = iters.map(function(iter ) {return SetIterable(iter)});\n var originalSet = this;\n return this.withMutations(function(set ) {\n originalSet.forEach(function(value ) {\n if (!iters.every(function(iter ) {return iter.includes(value)})) {\n set.remove(value);\n }\n });\n });\n };\n\n Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0);\n if (iters.length === 0) {\n return this;\n }\n iters = iters.map(function(iter ) {return SetIterable(iter)});\n var originalSet = this;\n return this.withMutations(function(set ) {\n originalSet.forEach(function(value ) {\n if (iters.some(function(iter ) {return iter.includes(value)})) {\n set.remove(value);\n }\n });\n });\n };\n\n Set.prototype.merge = function() {\n return this.union.apply(this, arguments);\n };\n\n Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return this.union.apply(this, iters);\n };\n\n Set.prototype.sort = function(comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator));\n };\n\n Set.prototype.sortBy = function(mapper, comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator, mapper));\n };\n\n Set.prototype.wasAltered = function() {\n return this._map.wasAltered();\n };\n\n Set.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._map.__iterate(function(_, k) {return fn(k, k, this$0)}, reverse);\n };\n\n Set.prototype.__iterator = function(type, reverse) {\n return this._map.map(function(_, k) {return k}).__iterator(type, reverse);\n };\n\n Set.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n return this.__make(newMap, ownerID);\n };\n\n\n function isSet(maybeSet) {\n return !!(maybeSet && maybeSet[IS_SET_SENTINEL]);\n }\n\n Set.isSet = isSet;\n\n var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';\n\n var SetPrototype = Set.prototype;\n SetPrototype[IS_SET_SENTINEL] = true;\n SetPrototype[DELETE] = SetPrototype.remove;\n SetPrototype.mergeDeep = SetPrototype.merge;\n SetPrototype.mergeDeepWith = SetPrototype.mergeWith;\n SetPrototype.withMutations = MapPrototype.withMutations;\n SetPrototype.asMutable = MapPrototype.asMutable;\n SetPrototype.asImmutable = MapPrototype.asImmutable;\n\n SetPrototype.__empty = emptySet;\n SetPrototype.__make = makeSet;\n\n function updateSet(set, newMap) {\n if (set.__ownerID) {\n set.size = newMap.size;\n set._map = newMap;\n return set;\n }\n return newMap === set._map ? set :\n newMap.size === 0 ? set.__empty() :\n set.__make(newMap);\n }\n\n function makeSet(map, ownerID) {\n var set = Object.create(SetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n }\n\n var EMPTY_SET;\n function emptySet() {\n return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));\n }\n\n createClass(OrderedSet, Set);\n\n // @pragma Construction\n\n function OrderedSet(value) {\n return value === null || value === undefined ? emptyOrderedSet() :\n isOrderedSet(value) ? value :\n emptyOrderedSet().withMutations(function(set ) {\n var iter = SetIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v ) {return set.add(v)});\n });\n }\n\n OrderedSet.of = function(/*...values*/) {\n return this(arguments);\n };\n\n OrderedSet.fromKeys = function(value) {\n return this(KeyedIterable(value).keySeq());\n };\n\n OrderedSet.prototype.toString = function() {\n return this.__toString('OrderedSet {', '}');\n };\n\n\n function isOrderedSet(maybeOrderedSet) {\n return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);\n }\n\n OrderedSet.isOrderedSet = isOrderedSet;\n\n var OrderedSetPrototype = OrderedSet.prototype;\n OrderedSetPrototype[IS_ORDERED_SENTINEL] = true;\n\n OrderedSetPrototype.__empty = emptyOrderedSet;\n OrderedSetPrototype.__make = makeOrderedSet;\n\n function makeOrderedSet(map, ownerID) {\n var set = Object.create(OrderedSetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n }\n\n var EMPTY_ORDERED_SET;\n function emptyOrderedSet() {\n return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()));\n }\n\n createClass(Stack, IndexedCollection);\n\n // @pragma Construction\n\n function Stack(value) {\n return value === null || value === undefined ? emptyStack() :\n isStack(value) ? value :\n emptyStack().unshiftAll(value);\n }\n\n Stack.of = function(/*...values*/) {\n return this(arguments);\n };\n\n Stack.prototype.toString = function() {\n return this.__toString('Stack [', ']');\n };\n\n // @pragma Access\n\n Stack.prototype.get = function(index, notSetValue) {\n var head = this._head;\n index = wrapIndex(this, index);\n while (head && index--) {\n head = head.next;\n }\n return head ? head.value : notSetValue;\n };\n\n Stack.prototype.peek = function() {\n return this._head && this._head.value;\n };\n\n // @pragma Modification\n\n Stack.prototype.push = function(/*...values*/) {\n if (arguments.length === 0) {\n return this;\n }\n var newSize = this.size + arguments.length;\n var head = this._head;\n for (var ii = arguments.length - 1; ii >= 0; ii--) {\n head = {\n value: arguments[ii],\n next: head\n };\n }\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pushAll = function(iter) {\n iter = IndexedIterable(iter);\n if (iter.size === 0) {\n return this;\n }\n assertNotInfinite(iter.size);\n var newSize = this.size;\n var head = this._head;\n iter.reverse().forEach(function(value ) {\n newSize++;\n head = {\n value: value,\n next: head\n };\n });\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pop = function() {\n return this.slice(1);\n };\n\n Stack.prototype.unshift = function(/*...values*/) {\n return this.push.apply(this, arguments);\n };\n\n Stack.prototype.unshiftAll = function(iter) {\n return this.pushAll(iter);\n };\n\n Stack.prototype.shift = function() {\n return this.pop.apply(this, arguments);\n };\n\n Stack.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._head = undefined;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyStack();\n };\n\n Stack.prototype.slice = function(begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n var resolvedBegin = resolveBegin(begin, this.size);\n var resolvedEnd = resolveEnd(end, this.size);\n if (resolvedEnd !== this.size) {\n // super.slice(begin, end);\n return IndexedCollection.prototype.slice.call(this, begin, end);\n }\n var newSize = this.size - resolvedBegin;\n var head = this._head;\n while (resolvedBegin--) {\n head = head.next;\n }\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n // @pragma Mutability\n\n Stack.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n return makeStack(this.size, this._head, ownerID, this.__hash);\n };\n\n // @pragma Iteration\n\n Stack.prototype.__iterate = function(fn, reverse) {\n if (reverse) {\n return this.reverse().__iterate(fn);\n }\n var iterations = 0;\n var node = this._head;\n while (node) {\n if (fn(node.value, iterations++, this) === false) {\n break;\n }\n node = node.next;\n }\n return iterations;\n };\n\n Stack.prototype.__iterator = function(type, reverse) {\n if (reverse) {\n return this.reverse().__iterator(type);\n }\n var iterations = 0;\n var node = this._head;\n return new Iterator(function() {\n if (node) {\n var value = node.value;\n node = node.next;\n return iteratorValue(type, iterations++, value);\n }\n return iteratorDone();\n });\n };\n\n\n function isStack(maybeStack) {\n return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]);\n }\n\n Stack.isStack = isStack;\n\n var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';\n\n var StackPrototype = Stack.prototype;\n StackPrototype[IS_STACK_SENTINEL] = true;\n StackPrototype.withMutations = MapPrototype.withMutations;\n StackPrototype.asMutable = MapPrototype.asMutable;\n StackPrototype.asImmutable = MapPrototype.asImmutable;\n StackPrototype.wasAltered = MapPrototype.wasAltered;\n\n\n function makeStack(size, head, ownerID, hash) {\n var map = Object.create(StackPrototype);\n map.size = size;\n map._head = head;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n }\n\n var EMPTY_STACK;\n function emptyStack() {\n return EMPTY_STACK || (EMPTY_STACK = makeStack(0));\n }\n\n /**\n * Contributes additional methods to a constructor\n */\n function mixin(ctor, methods) {\n var keyCopier = function(key ) { ctor.prototype[key] = methods[key]; };\n Object.keys(methods).forEach(keyCopier);\n Object.getOwnPropertySymbols &&\n Object.getOwnPropertySymbols(methods).forEach(keyCopier);\n return ctor;\n }\n\n Iterable.Iterator = Iterator;\n\n mixin(Iterable, {\n\n // ### Conversion to other types\n\n toArray: function() {\n assertNotInfinite(this.size);\n var array = new Array(this.size || 0);\n this.valueSeq().__iterate(function(v, i) { array[i] = v; });\n return array;\n },\n\n toIndexedSeq: function() {\n return new ToIndexedSequence(this);\n },\n\n toJS: function() {\n return this.toSeq().map(\n function(value ) {return value && typeof value.toJS === 'function' ? value.toJS() : value}\n ).__toJS();\n },\n\n toJSON: function() {\n return this.toSeq().map(\n function(value ) {return value && typeof value.toJSON === 'function' ? value.toJSON() : value}\n ).__toJS();\n },\n\n toKeyedSeq: function() {\n return new ToKeyedSequence(this, true);\n },\n\n toMap: function() {\n // Use Late Binding here to solve the circular dependency.\n return Map(this.toKeyedSeq());\n },\n\n toObject: function() {\n assertNotInfinite(this.size);\n var object = {};\n this.__iterate(function(v, k) { object[k] = v; });\n return object;\n },\n\n toOrderedMap: function() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedMap(this.toKeyedSeq());\n },\n\n toOrderedSet: function() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedSet(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toSet: function() {\n // Use Late Binding here to solve the circular dependency.\n return Set(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toSetSeq: function() {\n return new ToSetSequence(this);\n },\n\n toSeq: function() {\n return isIndexed(this) ? this.toIndexedSeq() :\n isKeyed(this) ? this.toKeyedSeq() :\n this.toSetSeq();\n },\n\n toStack: function() {\n // Use Late Binding here to solve the circular dependency.\n return Stack(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toList: function() {\n // Use Late Binding here to solve the circular dependency.\n return List(isKeyed(this) ? this.valueSeq() : this);\n },\n\n\n // ### Common JavaScript methods and properties\n\n toString: function() {\n return '[Iterable]';\n },\n\n __toString: function(head, tail) {\n if (this.size === 0) {\n return head + tail;\n }\n return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail;\n },\n\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n concat: function() {var values = SLICE$0.call(arguments, 0);\n return reify(this, concatFactory(this, values));\n },\n\n includes: function(searchValue) {\n return this.some(function(value ) {return is(value, searchValue)});\n },\n\n entries: function() {\n return this.__iterator(ITERATE_ENTRIES);\n },\n\n every: function(predicate, context) {\n assertNotInfinite(this.size);\n var returnValue = true;\n this.__iterate(function(v, k, c) {\n if (!predicate.call(context, v, k, c)) {\n returnValue = false;\n return false;\n }\n });\n return returnValue;\n },\n\n filter: function(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, true));\n },\n\n find: function(predicate, context, notSetValue) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[1] : notSetValue;\n },\n\n forEach: function(sideEffect, context) {\n assertNotInfinite(this.size);\n return this.__iterate(context ? sideEffect.bind(context) : sideEffect);\n },\n\n join: function(separator) {\n assertNotInfinite(this.size);\n separator = separator !== undefined ? '' + separator : ',';\n var joined = '';\n var isFirst = true;\n this.__iterate(function(v ) {\n isFirst ? (isFirst = false) : (joined += separator);\n joined += v !== null && v !== undefined ? v.toString() : '';\n });\n return joined;\n },\n\n keys: function() {\n return this.__iterator(ITERATE_KEYS);\n },\n\n map: function(mapper, context) {\n return reify(this, mapFactory(this, mapper, context));\n },\n\n reduce: function(reducer, initialReduction, context) {\n assertNotInfinite(this.size);\n var reduction;\n var useFirst;\n if (arguments.length < 2) {\n useFirst = true;\n } else {\n reduction = initialReduction;\n }\n this.__iterate(function(v, k, c) {\n if (useFirst) {\n useFirst = false;\n reduction = v;\n } else {\n reduction = reducer.call(context, reduction, v, k, c);\n }\n });\n return reduction;\n },\n\n reduceRight: function(reducer, initialReduction, context) {\n var reversed = this.toKeyedSeq().reverse();\n return reversed.reduce.apply(reversed, arguments);\n },\n\n reverse: function() {\n return reify(this, reverseFactory(this, true));\n },\n\n slice: function(begin, end) {\n return reify(this, sliceFactory(this, begin, end, true));\n },\n\n some: function(predicate, context) {\n return !this.every(not(predicate), context);\n },\n\n sort: function(comparator) {\n return reify(this, sortFactory(this, comparator));\n },\n\n values: function() {\n return this.__iterator(ITERATE_VALUES);\n },\n\n\n // ### More sequential methods\n\n butLast: function() {\n return this.slice(0, -1);\n },\n\n isEmpty: function() {\n return this.size !== undefined ? this.size === 0 : !this.some(function() {return true});\n },\n\n count: function(predicate, context) {\n return ensureSize(\n predicate ? this.toSeq().filter(predicate, context) : this\n );\n },\n\n countBy: function(grouper, context) {\n return countByFactory(this, grouper, context);\n },\n\n equals: function(other) {\n return deepEqual(this, other);\n },\n\n entrySeq: function() {\n var iterable = this;\n if (iterable._cache) {\n // We cache as an entries array, so we can just return the cache!\n return new ArraySeq(iterable._cache);\n }\n var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq();\n entriesSequence.fromEntrySeq = function() {return iterable.toSeq()};\n return entriesSequence;\n },\n\n filterNot: function(predicate, context) {\n return this.filter(not(predicate), context);\n },\n\n findEntry: function(predicate, context, notSetValue) {\n var found = notSetValue;\n this.__iterate(function(v, k, c) {\n if (predicate.call(context, v, k, c)) {\n found = [k, v];\n return false;\n }\n });\n return found;\n },\n\n findKey: function(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry && entry[0];\n },\n\n findLast: function(predicate, context, notSetValue) {\n return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);\n },\n\n findLastEntry: function(predicate, context, notSetValue) {\n return this.toKeyedSeq().reverse().findEntry(predicate, context, notSetValue);\n },\n\n findLastKey: function(predicate, context) {\n return this.toKeyedSeq().reverse().findKey(predicate, context);\n },\n\n first: function() {\n return this.find(returnTrue);\n },\n\n flatMap: function(mapper, context) {\n return reify(this, flatMapFactory(this, mapper, context));\n },\n\n flatten: function(depth) {\n return reify(this, flattenFactory(this, depth, true));\n },\n\n fromEntrySeq: function() {\n return new FromEntriesSequence(this);\n },\n\n get: function(searchKey, notSetValue) {\n return this.find(function(_, key) {return is(key, searchKey)}, undefined, notSetValue);\n },\n\n getIn: function(searchKeyPath, notSetValue) {\n var nested = this;\n // Note: in an ES6 environment, we would prefer:\n // for (var key of searchKeyPath) {\n var iter = forceIterator(searchKeyPath);\n var step;\n while (!(step = iter.next()).done) {\n var key = step.value;\n nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET;\n if (nested === NOT_SET) {\n return notSetValue;\n }\n }\n return nested;\n },\n\n groupBy: function(grouper, context) {\n return groupByFactory(this, grouper, context);\n },\n\n has: function(searchKey) {\n return this.get(searchKey, NOT_SET) !== NOT_SET;\n },\n\n hasIn: function(searchKeyPath) {\n return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET;\n },\n\n isSubset: function(iter) {\n iter = typeof iter.includes === 'function' ? iter : Iterable(iter);\n return this.every(function(value ) {return iter.includes(value)});\n },\n\n isSuperset: function(iter) {\n iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter);\n return iter.isSubset(this);\n },\n\n keyOf: function(searchValue) {\n return this.findKey(function(value ) {return is(value, searchValue)});\n },\n\n keySeq: function() {\n return this.toSeq().map(keyMapper).toIndexedSeq();\n },\n\n last: function() {\n return this.toSeq().reverse().first();\n },\n\n lastKeyOf: function(searchValue) {\n return this.toKeyedSeq().reverse().keyOf(searchValue);\n },\n\n max: function(comparator) {\n return maxFactory(this, comparator);\n },\n\n maxBy: function(mapper, comparator) {\n return maxFactory(this, comparator, mapper);\n },\n\n min: function(comparator) {\n return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator);\n },\n\n minBy: function(mapper, comparator) {\n return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper);\n },\n\n rest: function() {\n return this.slice(1);\n },\n\n skip: function(amount) {\n return this.slice(Math.max(0, amount));\n },\n\n skipLast: function(amount) {\n return reify(this, this.toSeq().reverse().skip(amount).reverse());\n },\n\n skipWhile: function(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, true));\n },\n\n skipUntil: function(predicate, context) {\n return this.skipWhile(not(predicate), context);\n },\n\n sortBy: function(mapper, comparator) {\n return reify(this, sortFactory(this, comparator, mapper));\n },\n\n take: function(amount) {\n return this.slice(0, Math.max(0, amount));\n },\n\n takeLast: function(amount) {\n return reify(this, this.toSeq().reverse().take(amount).reverse());\n },\n\n takeWhile: function(predicate, context) {\n return reify(this, takeWhileFactory(this, predicate, context));\n },\n\n takeUntil: function(predicate, context) {\n return this.takeWhile(not(predicate), context);\n },\n\n valueSeq: function() {\n return this.toIndexedSeq();\n },\n\n\n // ### Hashable Object\n\n hashCode: function() {\n return this.__hash || (this.__hash = hashIterable(this));\n }\n\n\n // ### Internal\n\n // abstract __iterate(fn, reverse)\n\n // abstract __iterator(type, reverse)\n });\n\n // var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n // var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n // var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n // var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n var IterablePrototype = Iterable.prototype;\n IterablePrototype[IS_ITERABLE_SENTINEL] = true;\n IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values;\n IterablePrototype.__toJS = IterablePrototype.toArray;\n IterablePrototype.__toStringMapper = quoteString;\n IterablePrototype.inspect =\n IterablePrototype.toSource = function() { return this.toString(); };\n IterablePrototype.chain = IterablePrototype.flatMap;\n IterablePrototype.contains = IterablePrototype.includes;\n\n mixin(KeyedIterable, {\n\n // ### More sequential methods\n\n flip: function() {\n return reify(this, flipFactory(this));\n },\n\n mapEntries: function(mapper, context) {var this$0 = this;\n var iterations = 0;\n return reify(this,\n this.toSeq().map(\n function(v, k) {return mapper.call(context, [k, v], iterations++, this$0)}\n ).fromEntrySeq()\n );\n },\n\n mapKeys: function(mapper, context) {var this$0 = this;\n return reify(this,\n this.toSeq().flip().map(\n function(k, v) {return mapper.call(context, k, v, this$0)}\n ).flip()\n );\n }\n\n });\n\n var KeyedIterablePrototype = KeyedIterable.prototype;\n KeyedIterablePrototype[IS_KEYED_SENTINEL] = true;\n KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries;\n KeyedIterablePrototype.__toJS = IterablePrototype.toObject;\n KeyedIterablePrototype.__toStringMapper = function(v, k) {return JSON.stringify(k) + ': ' + quoteString(v)};\n\n\n\n mixin(IndexedIterable, {\n\n // ### Conversion to other types\n\n toKeyedSeq: function() {\n return new ToKeyedSequence(this, false);\n },\n\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n filter: function(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, false));\n },\n\n findIndex: function(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[0] : -1;\n },\n\n indexOf: function(searchValue) {\n var key = this.keyOf(searchValue);\n return key === undefined ? -1 : key;\n },\n\n lastIndexOf: function(searchValue) {\n var key = this.lastKeyOf(searchValue);\n return key === undefined ? -1 : key;\n },\n\n reverse: function() {\n return reify(this, reverseFactory(this, false));\n },\n\n slice: function(begin, end) {\n return reify(this, sliceFactory(this, begin, end, false));\n },\n\n splice: function(index, removeNum /*, ...values*/) {\n var numArgs = arguments.length;\n removeNum = Math.max(removeNum | 0, 0);\n if (numArgs === 0 || (numArgs === 2 && !removeNum)) {\n return this;\n }\n // If index is negative, it should resolve relative to the size of the\n // collection. However size may be expensive to compute if not cached, so\n // only call count() if the number is in fact negative.\n index = resolveBegin(index, index < 0 ? this.count() : this.size);\n var spliced = this.slice(0, index);\n return reify(\n this,\n numArgs === 1 ?\n spliced :\n spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum))\n );\n },\n\n\n // ### More collection methods\n\n findLastIndex: function(predicate, context) {\n var entry = this.findLastEntry(predicate, context);\n return entry ? entry[0] : -1;\n },\n\n first: function() {\n return this.get(0);\n },\n\n flatten: function(depth) {\n return reify(this, flattenFactory(this, depth, false));\n },\n\n get: function(index, notSetValue) {\n index = wrapIndex(this, index);\n return (index < 0 || (this.size === Infinity ||\n (this.size !== undefined && index > this.size))) ?\n notSetValue :\n this.find(function(_, key) {return key === index}, undefined, notSetValue);\n },\n\n has: function(index) {\n index = wrapIndex(this, index);\n return index >= 0 && (this.size !== undefined ?\n this.size === Infinity || index < this.size :\n this.indexOf(index) !== -1\n );\n },\n\n interpose: function(separator) {\n return reify(this, interposeFactory(this, separator));\n },\n\n interleave: function(/*...iterables*/) {\n var iterables = [this].concat(arrCopy(arguments));\n var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables);\n var interleaved = zipped.flatten(true);\n if (zipped.size) {\n interleaved.size = zipped.size * iterables.length;\n }\n return reify(this, interleaved);\n },\n\n keySeq: function() {\n return Range(0, this.size);\n },\n\n last: function() {\n return this.get(-1);\n },\n\n skipWhile: function(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, false));\n },\n\n zip: function(/*, ...iterables */) {\n var iterables = [this].concat(arrCopy(arguments));\n return reify(this, zipWithFactory(this, defaultZipper, iterables));\n },\n\n zipWith: function(zipper/*, ...iterables */) {\n var iterables = arrCopy(arguments);\n iterables[0] = this;\n return reify(this, zipWithFactory(this, zipper, iterables));\n }\n\n });\n\n IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true;\n IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n\n mixin(SetIterable, {\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n get: function(value, notSetValue) {\n return this.has(value) ? value : notSetValue;\n },\n\n includes: function(value) {\n return this.has(value);\n },\n\n\n // ### More sequential methods\n\n keySeq: function() {\n return this.valueSeq();\n }\n\n });\n\n SetIterable.prototype.has = IterablePrototype.includes;\n SetIterable.prototype.contains = SetIterable.prototype.includes;\n\n\n // Mixin subclasses\n\n mixin(KeyedSeq, KeyedIterable.prototype);\n mixin(IndexedSeq, IndexedIterable.prototype);\n mixin(SetSeq, SetIterable.prototype);\n\n mixin(KeyedCollection, KeyedIterable.prototype);\n mixin(IndexedCollection, IndexedIterable.prototype);\n mixin(SetCollection, SetIterable.prototype);\n\n\n // #pragma Helper functions\n\n function keyMapper(v, k) {\n return k;\n }\n\n function entryMapper(v, k) {\n return [k, v];\n }\n\n function not(predicate) {\n return function() {\n return !predicate.apply(this, arguments);\n }\n }\n\n function neg(predicate) {\n return function() {\n return -predicate.apply(this, arguments);\n }\n }\n\n function quoteString(value) {\n return typeof value === 'string' ? JSON.stringify(value) : String(value);\n }\n\n function defaultZipper() {\n return arrCopy(arguments);\n }\n\n function defaultNegComparator(a, b) {\n return a < b ? 1 : a > b ? -1 : 0;\n }\n\n function hashIterable(iterable) {\n if (iterable.size === Infinity) {\n return 0;\n }\n var ordered = isOrdered(iterable);\n var keyed = isKeyed(iterable);\n var h = ordered ? 1 : 0;\n var size = iterable.__iterate(\n keyed ?\n ordered ?\n function(v, k) { h = 31 * h + hashMerge(hash(v), hash(k)) | 0; } :\n function(v, k) { h = h + hashMerge(hash(v), hash(k)) | 0; } :\n ordered ?\n function(v ) { h = 31 * h + hash(v) | 0; } :\n function(v ) { h = h + hash(v) | 0; }\n );\n return murmurHashOfSize(size, h);\n }\n\n function murmurHashOfSize(size, h) {\n h = imul(h, 0xCC9E2D51);\n h = imul(h << 15 | h >>> -15, 0x1B873593);\n h = imul(h << 13 | h >>> -13, 5);\n h = (h + 0xE6546B64 | 0) ^ size;\n h = imul(h ^ h >>> 16, 0x85EBCA6B);\n h = imul(h ^ h >>> 13, 0xC2B2AE35);\n h = smi(h ^ h >>> 16);\n return h;\n }\n\n function hashMerge(a, b) {\n return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int\n }\n\n var Immutable = {\n\n Iterable: Iterable,\n\n Seq: Seq,\n Collection: Collection,\n Map: Map,\n OrderedMap: OrderedMap,\n List: List,\n Stack: Stack,\n Set: Set,\n OrderedSet: OrderedSet,\n\n Record: Record,\n Range: Range,\n Repeat: Repeat,\n\n is: is,\n fromJS: fromJS\n\n };\n\n return Immutable;\n\n}));\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/immutable/dist/immutable.js\n ** module id = 3\n ** module chunks = 0\n **/","/**\n * Checks if the passed in value is a string\n * @param {*} val\n * @return {boolean}\n */\nexports.isString = function(val) {\n return typeof val === 'string' || objectToString(val) === '[object String]'\n}\n\n/**\n * Checks if the passed in value is an array\n * @param {*} val\n * @return {boolean}\n */\nexports.isArray = Array.isArray /* istanbul ignore next */|| function(val) {\n return objectToString(val) === '[object Array]'\n}\n\n// taken from underscore source to account for browser discrepancy\n/* istanbul ignore if */\nif (typeof /./ !== 'function' && typeof Int8Array !== 'object') {\n /**\n * Checks if the passed in value is a function\n * @param {*} val\n * @return {boolean}\n */\n exports.isFunction = function(obj) {\n return typeof obj === 'function' || false\n }\n} else {\n /**\n * Checks if the passed in value is a function\n * @param {*} val\n * @return {boolean}\n */\n exports.isFunction = function(val) {\n return toString.call(val) === '[object Function]'\n }\n}\n\n/**\n * Checks if the passed in value is of type Object\n * @param {*} val\n * @return {boolean}\n */\nexports.isObject = function(obj) {\n var type = typeof obj\n return type === 'function' || type === 'object' && !!obj\n}\n\n/**\n * Extends an object with the properties of additional objects\n * @param {object} obj\n * @param {object} objects\n * @return {object}\n */\nexports.extend = function(obj) {\n var length = arguments.length\n\n if (!obj || length < 2) {\n return obj || {}\n }\n\n for (var index = 1; index < length; index++) {\n var source = arguments[index]\n var keys = Object.keys(source)\n var l = keys.length\n\n for (var i = 0; i < l; i++) {\n var key = keys[i]\n obj[key] = source[key]\n }\n }\n\n return obj\n}\n\n/**\n * Creates a shallow clone of an object\n * @param {object} obj\n * @return {object}\n */\nexports.clone = function(obj) {\n if (!exports.isObject(obj)) {\n return obj\n }\n return exports.isArray(obj) ? obj.slice() : exports.extend({}, obj)\n}\n\n/**\n * Iterates over a collection of elements yielding each iteration to an\n * iteratee. The iteratee may be bound to the context argument and is invoked\n * each time with three arguments (value, index|key, collection). Iteration may\n * be exited early by explicitly returning false.\n * @param {array|object|string} collection\n * @param {function} iteratee\n * @param {*} context\n * @return {array|object|string}\n */\nexports.each = function(collection, iteratee, context) {\n var length = collection ? collection.length : 0\n var i = -1\n var keys\n var origIteratee\n\n if (context) {\n origIteratee = iteratee\n iteratee = function(value, index, innerCollection) {\n return origIteratee.call(context, value, index, innerCollection)\n }\n }\n\n if (isLength(length)) {\n while (++i < length) {\n if (iteratee(collection[i], i, collection) === false) {\n break\n }\n }\n } else {\n keys = Object.keys(collection)\n length = keys.length\n while (++i < length) {\n if (iteratee(collection[keys[i]], keys[i], collection) === false) {\n break\n }\n }\n }\n\n return collection\n}\n\n/**\n * Returns a new function the invokes `func` with `partialArgs` prepended to\n * any passed into the new function. Acts like `Array.prototype.bind`, except\n * it does not alter `this` context.\n * @param {function} func\n * @param {*} partialArgs\n * @return {function}\n */\nexports.partial = function(func) {\n var slice = Array.prototype.slice\n var partialArgs = slice.call(arguments, 1)\n\n return function() {\n return func.apply(this, partialArgs.concat(slice.call(arguments)))\n }\n}\n\n/**\n * Returns a factory method that allows construction with or without `new`\n */\nexports.toFactory = function(Klass) {\n var Factory = function(...args) {\n return new Klass(...args)\n }\n\n Factory.__proto__ = Klass // eslint-disable-line no-proto\n Factory.prototype = Klass.prototype\n return Factory\n}\n\n/**\n * Returns the text value representation of an object\n * @private\n * @param {*} obj\n * @return {string}\n */\nfunction objectToString(obj) {\n return obj && typeof obj === 'object' && toString.call(obj)\n}\n\n/**\n * Checks if the value is a valid array-like length.\n * @private\n * @param {*} val\n * @return {bool}\n */\nfunction isLength(val) {\n return typeof val === 'number'\n && val > -1\n && val % 1 === 0\n && val <= Number.MAX_VALUE\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utils.js\n **/","import Immutable from 'immutable'\nimport { isObject } from './utils'\n\n/**\n * A collection of helpers for the ImmutableJS library\n */\n\n/**\n * @param {*} obj\n * @return {boolean}\n */\nexport function isImmutable(obj) {\n return Immutable.Iterable.isIterable(obj)\n}\n\n/**\n * Returns true if the value is an ImmutableJS data structure\n * or a JavaScript primitive that is immutable (string, number, etc)\n * @param {*} obj\n * @return {boolean}\n */\nexport function isImmutableValue(obj) {\n return (\n isImmutable(obj) ||\n !isObject(obj)\n )\n}\n\n/**\n * Converts an Immutable Sequence to JS object\n * Can be called on any type\n */\nexport function toJS(arg) {\n // arg instanceof Immutable.Sequence is unreliable\n return (isImmutable(arg))\n ? arg.toJS()\n : arg\n}\n\n/**\n * Converts a JS object to an Immutable object, if it's\n * already Immutable its a no-op\n */\nexport function toImmutable(arg) {\n return (isImmutable(arg))\n ? arg\n : Immutable.fromJS(arg)\n}\n\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/immutable-helpers.js\n **/","import Immutable from 'immutable'\nimport createReactMixin from './create-react-mixin'\nimport * as fns from './reactor/fns'\nimport { DefaultCache } from './reactor/cache'\nimport { NoopLogger, ConsoleGroupLogger } from './logging'\nimport { isKeyPath } from './key-path'\nimport { isGetter } from './getter'\nimport { toJS } from './immutable-helpers'\nimport { extend, toFactory } from './utils'\nimport {\n ReactorState,\n ObserverState,\n DEBUG_OPTIONS,\n PROD_OPTIONS,\n} from './reactor/records'\n\n/**\n * State is stored in NuclearJS Reactors. Reactors\n * contain a 'state' object which is an Immutable.Map\n *\n * The only way Reactors can change state is by reacting to\n * messages. To update state, Reactor's dispatch messages to\n * all registered cores, and the core returns it's new\n * state based on the message\n */\nclass Reactor {\n constructor(config = {}) {\n const debug = !!config.debug\n const baseOptions = debug ? DEBUG_OPTIONS : PROD_OPTIONS\n // if defined, merge the custom implementation over the noop logger to avoid undefined lookups,\n // otherwise, just use the built-in console group logger\n let logger = config.logger ? extend({}, NoopLogger, config.logger) : NoopLogger\n if (!config.logger && debug) {\n logger = ConsoleGroupLogger\n }\n const initialReactorState = new ReactorState({\n debug: debug,\n cache: config.cache || DefaultCache(),\n logger: logger,\n // merge config options with the defaults\n options: baseOptions.merge(config.options || {}),\n })\n\n this.prevReactorState = initialReactorState\n this.reactorState = initialReactorState\n this.observerState = new ObserverState()\n\n this.ReactMixin = createReactMixin(this)\n\n // keep track of the depth of batch nesting\n this.__batchDepth = 0\n\n // keep track if we are currently dispatching\n this.__isDispatching = false\n }\n\n /**\n * Evaluates a KeyPath or Getter in context of the reactor state\n * @param {KeyPath|Getter} keyPathOrGetter\n * @return {*}\n */\n evaluate(keyPathOrGetter) {\n let { result, reactorState } = fns.evaluate(this.reactorState, keyPathOrGetter)\n this.reactorState = reactorState\n return result\n }\n\n /**\n * Gets the coerced state (to JS object) of the reactor.evaluate\n * @param {KeyPath|Getter} keyPathOrGetter\n * @return {*}\n */\n evaluateToJS(keyPathOrGetter) {\n return toJS(this.evaluate(keyPathOrGetter))\n }\n\n /**\n * Adds a change observer whenever a certain part of the reactor state changes\n *\n * 1. observe(handlerFn) - 1 argument, called anytime reactor.state changes\n * 2. observe(keyPath, handlerFn) same as above\n * 3. observe(getter, handlerFn) called whenever any getter dependencies change with\n * the value of the getter\n *\n * Adds a change handler whenever certain deps change\n * If only one argument is passed invoked the handler whenever\n * the reactor state changes\n *\n * @param {KeyPath|Getter} getter\n * @param {function} handler\n * @return {function} unwatch function\n */\n observe(getter, handler) {\n if (arguments.length === 1) {\n handler = getter\n getter = []\n }\n let { observerState, entry } = fns.addObserver(this.observerState, getter, handler)\n this.observerState = observerState\n return () => {\n this.observerState = fns.removeObserverByEntry(this.observerState, entry)\n }\n }\n\n unobserve(getter, handler) {\n if (arguments.length === 0) {\n throw new Error('Must call unobserve with a Getter')\n }\n if (!isGetter(getter) && !isKeyPath(getter)) {\n throw new Error('Must call unobserve with a Getter')\n }\n\n this.observerState = fns.removeObserver(this.observerState, getter, handler)\n }\n\n /**\n * Dispatches a single message\n * @param {string} actionType\n * @param {object|undefined} payload\n */\n dispatch(actionType, payload) {\n if (this.__batchDepth === 0) {\n if (fns.getOption(this.reactorState, 'throwOnDispatchInDispatch')) {\n if (this.__isDispatching) {\n this.__isDispatching = false\n throw new Error('Dispatch may not be called while a dispatch is in progress')\n }\n }\n this.__isDispatching = true\n }\n\n try {\n this.reactorState = fns.dispatch(this.reactorState, actionType, payload)\n } catch (e) {\n this.__isDispatching = false\n throw e\n }\n\n try {\n this.__notify()\n } finally {\n this.__isDispatching = false\n }\n }\n\n /**\n * Allows batching of dispatches before notifying change observers\n * @param {Function} fn\n */\n batch(fn) {\n this.batchStart()\n fn()\n this.batchEnd()\n }\n\n /**\n * @deprecated\n * @param {String} id\n * @param {Store} store\n */\n registerStore(id, store) {\n /* eslint-disable no-console */\n console.warn('Deprecation warning: `registerStore` will no longer be supported in 1.1, use `registerStores` instead')\n /* eslint-enable no-console */\n this.registerStores({\n [id]: store,\n })\n }\n\n /**\n * @param {Object} stores\n */\n registerStores(stores) {\n this.reactorState = fns.registerStores(this.reactorState, stores)\n this.__notify()\n }\n\n /**\n * Replace store implementation (handlers) without modifying the app state or calling getInitialState\n * Useful for hot reloading\n * @param {Object} stores\n */\n replaceStores(stores) {\n this.reactorState = fns.replaceStores(this.reactorState, stores)\n }\n\n /**\n * Returns a plain object representing the application state\n * @return {Object}\n */\n serialize() {\n return fns.serialize(this.reactorState)\n }\n\n /**\n * @param {Object} state\n */\n loadState(state) {\n this.reactorState = fns.loadState(this.reactorState, state)\n this.__notify()\n }\n\n /**\n * Resets the state of a reactor and returns back to initial state\n */\n reset() {\n const newState = fns.reset(this.reactorState)\n this.reactorState = newState\n this.prevReactorState = newState\n this.observerState = new ObserverState()\n }\n\n /**\n * Notifies all change observers with the current state\n * @private\n */\n __notify() {\n if (this.__batchDepth > 0) {\n // in the middle of batch, dont notify\n return\n }\n\n const dirtyStores = this.reactorState.get('dirtyStores')\n if (dirtyStores.size === 0) {\n return\n }\n\n let observerIdsToNotify = Immutable.Set().withMutations(set => {\n // notify all observers\n set.union(this.observerState.get('any'))\n\n dirtyStores.forEach(id => {\n const entries = this.observerState.getIn(['stores', id])\n if (!entries) {\n return\n }\n set.union(entries)\n })\n })\n\n observerIdsToNotify.forEach((observerId) => {\n const entry = this.observerState.getIn(['observersMap', observerId])\n if (!entry) {\n // don't notify here in the case a handler called unobserve on another observer\n return\n }\n\n const getter = entry.get('getter')\n const handler = entry.get('handler')\n\n const prevEvaluateResult = fns.evaluate(this.prevReactorState, getter)\n const currEvaluateResult = fns.evaluate(this.reactorState, getter)\n\n this.prevReactorState = prevEvaluateResult.reactorState\n this.reactorState = currEvaluateResult.reactorState\n\n const prevValue = prevEvaluateResult.result\n const currValue = currEvaluateResult.result\n\n if (!Immutable.is(prevValue, currValue)) {\n handler.call(null, currValue)\n }\n })\n\n const nextReactorState = fns.resetDirtyStores(this.reactorState)\n\n this.prevReactorState = nextReactorState\n this.reactorState = nextReactorState\n }\n\n /**\n * Starts batching, ie pausing notifies and batching up changes\n * to be notified when batchEnd() is called\n */\n batchStart() {\n this.__batchDepth++\n }\n\n /**\n * Ends a batch cycle and will notify obsevers of all changes if\n * the batch depth is back to 0 (outer most batch completed)\n */\n batchEnd() {\n this.__batchDepth--\n\n if (this.__batchDepth <= 0) {\n // set to true to catch if dispatch called from observer\n this.__isDispatching = true\n try {\n this.__notify()\n } catch (e) {\n this.__isDispatching = false\n throw e\n }\n this.__isDispatching = false\n }\n }\n}\n\nexport default toFactory(Reactor)\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/reactor.js\n **/","import { each } from './utils'\n\n/**\n * Returns a mapping of the getDataBinding keys to\n * the reactor values\n */\nfunction getState(reactor, data) {\n let state = {}\n each(data, (value, key) => {\n state[key] = reactor.evaluate(value)\n })\n return state\n}\n\n/**\n * @param {Reactor} reactor\n */\nexport default function(reactor) {\n return {\n getInitialState() {\n return getState(reactor, this.getDataBindings())\n },\n\n componentDidMount() {\n this.__unwatchFns = []\n each(this.getDataBindings(), (getter, key) => {\n const unwatchFn = reactor.observe(getter, (val) => {\n this.setState({\n [key]: val,\n })\n })\n\n this.__unwatchFns.push(unwatchFn)\n })\n },\n\n componentWillUnmount() {\n while (this.__unwatchFns.length) {\n this.__unwatchFns.shift()()\n }\n },\n }\n}\n\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/create-react-mixin.js\n **/","import Immutable from 'immutable'\nimport { CacheEntry } from './cache'\nimport { isImmutableValue } from '../immutable-helpers'\nimport { toImmutable } from '../immutable-helpers'\nimport { fromKeyPath, getStoreDeps, getComputeFn, getDeps, isGetter } from '../getter'\nimport { isEqual, isKeyPath } from '../key-path'\nimport { each } from '../utils'\n\n/**\n * Immutable Types\n */\nconst EvaluateResult = Immutable.Record({ result: null, reactorState: null})\n\nfunction evaluateResult(result, reactorState) {\n return new EvaluateResult({\n result: result,\n reactorState: reactorState,\n })\n}\n\n/**\n * @param {ReactorState} reactorState\n * @param {Object} stores\n * @return {ReactorState}\n */\nexport function registerStores(reactorState, stores) {\n return reactorState.withMutations((reactorState) => {\n each(stores, (store, id) => {\n if (reactorState.getIn(['stores', id])) {\n /* eslint-disable no-console */\n console.warn('Store already defined for id = ' + id)\n /* eslint-enable no-console */\n }\n\n const initialState = store.getInitialState()\n\n if (initialState === undefined && getOption(reactorState, 'throwOnUndefinedStoreReturnValue')) {\n throw new Error('Store getInitialState() must return a value, did you forget a return statement')\n }\n if (getOption(reactorState, 'throwOnNonImmutableStore') && !isImmutableValue(initialState)) {\n throw new Error('Store getInitialState() must return an immutable value, did you forget to call toImmutable')\n }\n\n reactorState\n .update('stores', stores => stores.set(id, store))\n .update('state', state => state.set(id, initialState))\n .update('dirtyStores', state => state.add(id))\n .update('storeStates', storeStates => incrementStoreStates(storeStates, [id]))\n })\n incrementId(reactorState)\n })\n}\n\n/**\n * Overrides the store implementation without resetting the value of that particular part of the app state\n * this is useful when doing hot reloading of stores.\n * @param {ReactorState} reactorState\n * @param {Object} stores\n * @return {ReactorState}\n */\nexport function replaceStores(reactorState, stores) {\n return reactorState.withMutations((reactorState) => {\n each(stores, (store, id) => {\n reactorState.update('stores', stores => stores.set(id, store))\n })\n })\n}\n\n/**\n * @param {ReactorState} reactorState\n * @param {String} actionType\n * @param {*} payload\n * @return {ReactorState}\n */\nexport function dispatch(reactorState, actionType, payload) {\n let logging = reactorState.get('logger')\n\n if (actionType === undefined && getOption(reactorState, 'throwOnUndefinedActionType')) {\n throw new Error('`dispatch` cannot be called with an `undefined` action type.')\n }\n\n const currState = reactorState.get('state')\n let dirtyStores = reactorState.get('dirtyStores')\n\n const nextState = currState.withMutations(state => {\n logging.dispatchStart(reactorState, actionType, payload)\n\n // let each store handle the message\n reactorState.get('stores').forEach((store, id) => {\n const currState = state.get(id)\n let newState\n\n try {\n newState = store.handle(currState, actionType, payload)\n } catch(e) {\n // ensure console.group is properly closed\n logging.dispatchError(reactorState, e.message)\n throw e\n }\n\n if (newState === undefined && getOption(reactorState, 'throwOnUndefinedStoreReturnValue')) {\n const errorMsg = 'Store handler must return a value, did you forget a return statement'\n logging.dispatchError(reactorState, errorMsg)\n throw new Error(errorMsg)\n }\n\n state.set(id, newState)\n\n if (currState !== newState) {\n // if the store state changed add store to list of dirty stores\n dirtyStores = dirtyStores.add(id)\n }\n })\n\n logging.dispatchEnd(reactorState, state, dirtyStores, currState)\n })\n\n const nextReactorState = reactorState\n .set('state', nextState)\n .set('dirtyStores', dirtyStores)\n .update('storeStates', storeStates => incrementStoreStates(storeStates, dirtyStores))\n\n return incrementId(nextReactorState)\n}\n\n/**\n * @param {ReactorState} reactorState\n * @param {Immutable.Map} state\n * @return {ReactorState}\n */\nexport function loadState(reactorState, state) {\n let dirtyStores = []\n const stateToLoad = toImmutable({}).withMutations(stateToLoad => {\n each(state, (serializedStoreState, storeId) => {\n const store = reactorState.getIn(['stores', storeId])\n if (store) {\n const storeState = store.deserialize(serializedStoreState)\n if (storeState !== undefined) {\n stateToLoad.set(storeId, storeState)\n dirtyStores.push(storeId)\n }\n }\n })\n })\n\n const dirtyStoresSet = Immutable.Set(dirtyStores)\n return reactorState\n .update('state', state => state.merge(stateToLoad))\n .update('dirtyStores', stores => stores.union(dirtyStoresSet))\n .update('storeStates', storeStates => incrementStoreStates(storeStates, dirtyStores))\n}\n\n/**\n * Adds a change observer whenever a certain part of the reactor state changes\n *\n * 1. observe(handlerFn) - 1 argument, called anytime reactor.state changes\n * 2. observe(keyPath, handlerFn) same as above\n * 3. observe(getter, handlerFn) called whenever any getter dependencies change with\n * the value of the getter\n *\n * Adds a change handler whenever certain deps change\n * If only one argument is passed invoked the handler whenever\n * the reactor state changes\n *\n * @param {ObserverState} observerState\n * @param {KeyPath|Getter} getter\n * @param {function} handler\n * @return {ObserveResult}\n */\nexport function addObserver(observerState, getter, handler) {\n // use the passed in getter as the key so we can rely on a byreference call for unobserve\n const getterKey = getter\n if (isKeyPath(getter)) {\n getter = fromKeyPath(getter)\n }\n\n const currId = observerState.get('nextId')\n const storeDeps = getStoreDeps(getter)\n const entry = Immutable.Map({\n id: currId,\n storeDeps: storeDeps,\n getterKey: getterKey,\n getter: getter,\n handler: handler,\n })\n\n let updatedObserverState\n if (storeDeps.size === 0) {\n // no storeDeps means the observer is dependent on any of the state changing\n updatedObserverState = observerState.update('any', observerIds => observerIds.add(currId))\n } else {\n updatedObserverState = observerState.withMutations(map => {\n storeDeps.forEach(storeId => {\n let path = ['stores', storeId]\n if (!map.hasIn(path)) {\n map.setIn(path, Immutable.Set())\n }\n map.updateIn(['stores', storeId], observerIds => observerIds.add(currId))\n })\n })\n }\n\n updatedObserverState = updatedObserverState\n .set('nextId', currId + 1)\n .setIn(['observersMap', currId], entry)\n\n return {\n observerState: updatedObserverState,\n entry: entry,\n }\n}\n\n/**\n * @param {ReactorState} reactorState\n * @param {String} option\n * @return {Boolean}\n */\nexport function getOption(reactorState, option) {\n const value = reactorState.getIn(['options', option])\n if (value === undefined) {\n throw new Error('Invalid option: ' + option)\n }\n return value\n}\n\n/**\n * Use cases\n * removeObserver(observerState, [])\n * removeObserver(observerState, [], handler)\n * removeObserver(observerState, ['keyPath'])\n * removeObserver(observerState, ['keyPath'], handler)\n * removeObserver(observerState, getter)\n * removeObserver(observerState, getter, handler)\n * @param {ObserverState} observerState\n * @param {KeyPath|Getter} getter\n * @param {Function} handler\n * @return {ObserverState}\n */\nexport function removeObserver(observerState, getter, handler) {\n const entriesToRemove = observerState.get('observersMap').filter(entry => {\n // use the getterKey in the case of a keyPath is transformed to a getter in addObserver\n let entryGetter = entry.get('getterKey')\n let handlersMatch = (!handler || entry.get('handler') === handler)\n if (!handlersMatch) {\n return false\n }\n // check for a by-value equality of keypaths\n if (isKeyPath(getter) && isKeyPath(entryGetter)) {\n return isEqual(getter, entryGetter)\n }\n // we are comparing two getters do it by reference\n return (getter === entryGetter)\n })\n\n return observerState.withMutations(map => {\n entriesToRemove.forEach(entry => removeObserverByEntry(map, entry))\n })\n}\n\n/**\n * Removes an observer entry by id from the observerState\n * @param {ObserverState} observerState\n * @param {Immutable.Map} entry\n * @return {ObserverState}\n */\nexport function removeObserverByEntry(observerState, entry) {\n return observerState.withMutations(map => {\n const id = entry.get('id')\n const storeDeps = entry.get('storeDeps')\n\n if (storeDeps.size === 0) {\n map.update('any', anyObsevers => anyObsevers.remove(id))\n } else {\n storeDeps.forEach(storeId => {\n map.updateIn(['stores', storeId], observers => {\n if (observers) {\n // check for observers being present because reactor.reset() can be called before an unwatch fn\n return observers.remove(id)\n }\n return observers\n })\n })\n }\n\n map.removeIn(['observersMap', id])\n })\n}\n\n/**\n * @param {ReactorState} reactorState\n * @return {ReactorState}\n */\nexport function reset(reactorState) {\n const prevState = reactorState.get('state')\n\n return reactorState.withMutations(reactorState => {\n const storeMap = reactorState.get('stores')\n const storeIds = storeMap.keySeq().toJS()\n storeMap.forEach((store, id) => {\n const storeState = prevState.get(id)\n const resetStoreState = store.handleReset(storeState)\n if (resetStoreState === undefined && getOption(reactorState, 'throwOnUndefinedStoreReturnValue')) {\n throw new Error('Store handleReset() must return a value, did you forget a return statement')\n }\n if (getOption(reactorState, 'throwOnNonImmutableStore') && !isImmutableValue(resetStoreState)) {\n throw new Error('Store reset state must be an immutable value, did you forget to call toImmutable')\n }\n reactorState.setIn(['state', id], resetStoreState)\n })\n\n reactorState.update('storeStates', storeStates => incrementStoreStates(storeStates, storeIds))\n resetDirtyStores(reactorState)\n })\n}\n\n/**\n * @param {ReactorState} reactorState\n * @param {KeyPath|Gettter} keyPathOrGetter\n * @return {EvaluateResult}\n */\nexport function evaluate(reactorState, keyPathOrGetter) {\n const state = reactorState.get('state')\n\n if (isKeyPath(keyPathOrGetter)) {\n // if its a keyPath simply return\n return evaluateResult(\n state.getIn(keyPathOrGetter),\n reactorState\n )\n } else if (!isGetter(keyPathOrGetter)) {\n throw new Error('evaluate must be passed a keyPath or Getter')\n }\n\n // Must be a Getter\n\n const cache = reactorState.get('cache')\n var cacheEntry = cache.lookup(keyPathOrGetter)\n const isCacheMiss = !cacheEntry || isDirtyCacheEntry(reactorState, cacheEntry)\n if (isCacheMiss) {\n cacheEntry = createCacheEntry(reactorState, keyPathOrGetter)\n }\n\n return evaluateResult(\n cacheEntry.get('value'),\n reactorState.update('cache', cache => {\n return isCacheMiss ?\n cache.miss(keyPathOrGetter, cacheEntry) :\n cache.hit(keyPathOrGetter)\n })\n )\n}\n\n/**\n * Returns serialized state for all stores\n * @param {ReactorState} reactorState\n * @return {Object}\n */\nexport function serialize(reactorState) {\n let serialized = {}\n reactorState.get('stores').forEach((store, id) => {\n let storeState = reactorState.getIn(['state', id])\n let serializedState = store.serialize(storeState)\n if (serializedState !== undefined) {\n serialized[id] = serializedState\n }\n })\n return serialized\n}\n\n/**\n * Returns serialized state for all stores\n * @param {ReactorState} reactorState\n * @return {ReactorState}\n */\nexport function resetDirtyStores(reactorState) {\n return reactorState.set('dirtyStores', Immutable.Set())\n}\n\n/**\n * @param {ReactorState} reactorState\n * @param {CacheEntry} cacheEntry\n * @return {boolean}\n */\nfunction isDirtyCacheEntry(reactorState, cacheEntry) {\n const storeStates = cacheEntry.get('storeStates')\n\n // if there are no store states for this entry then it was never cached before\n return !storeStates.size || storeStates.some((stateId, storeId) => {\n return reactorState.getIn(['storeStates', storeId]) !== stateId\n })\n}\n\n/**\n * Evaluates getter for given reactorState and returns CacheEntry\n * @param {ReactorState} reactorState\n * @param {Getter} getter\n * @return {CacheEntry}\n */\nfunction createCacheEntry(reactorState, getter) {\n // evaluate dependencies\n const args = getDeps(getter).map(dep => evaluate(reactorState, dep).result)\n const value = getComputeFn(getter).apply(null, args)\n\n const storeDeps = getStoreDeps(getter)\n const storeStates = toImmutable({}).withMutations(map => {\n storeDeps.forEach(storeId => {\n const stateId = reactorState.getIn(['storeStates', storeId])\n map.set(storeId, stateId)\n })\n })\n\n return CacheEntry({\n value: value,\n storeStates: storeStates,\n dispatchId: reactorState.get('dispatchId'),\n })\n}\n\n/**\n * @param {ReactorState} reactorState\n * @return {ReactorState}\n */\nfunction incrementId(reactorState) {\n return reactorState.update('dispatchId', id => id + 1)\n}\n\n\n/**\n * @param {Immutable.Map} storeStates\n * @param {Array} storeIds\n * @return {Immutable.Map}\n */\nfunction incrementStoreStates(storeStates, storeIds) {\n return storeStates.withMutations(map => {\n storeIds.forEach(id => {\n const nextId = map.has(id) ? map.get(id) + 1 : 1\n map.set(id, nextId)\n })\n })\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/reactor/fns.js\n **/","import { Map, OrderedSet, Record } from 'immutable'\n\nexport const CacheEntry = Record({\n value: null,\n storeStates: Map(),\n dispatchId: null,\n})\n\n/*******************************************************************************\n * interface PersistentCache {\n * has(item)\n * lookup(item, notFoundValue)\n * hit(item)\n * miss(item, entry)\n * evict(item)\n * asMap()\n * }\n *\n * Inspired by clojure.core.cache/CacheProtocol\n *******************************************************************************/\n\n/**\n * Plain map-based cache\n */\nexport class BasicCache {\n\n /**\n * @param {Immutable.Map} cache\n */\n constructor(cache = Map()) {\n this.cache = cache\n }\n\n /**\n * Retrieve the associated value, if it exists in this cache, otherwise\n * returns notFoundValue (or undefined if not provided)\n * @param {Object} item\n * @param {Object?} notFoundValue\n * @return {CacheEntry?}\n */\n lookup(item, notFoundValue) {\n return this.cache.get(item, notFoundValue)\n }\n\n /**\n * Checks if this cache contains an associated value\n * @param {Object} item\n * @return {boolean}\n */\n has(item) {\n return this.cache.has(item)\n }\n\n /**\n * Return cached items as map\n * @return {Immutable.Map}\n */\n asMap() {\n return this.cache\n }\n\n /**\n * Updates this cache when it is determined to contain the associated value\n * @param {Object} item\n * @return {BasicCache}\n */\n hit(item) {\n return this\n }\n\n /**\n * Updates this cache when it is determined to **not** contain the associated value\n * @param {Object} item\n * @param {CacheEntry} entry\n * @return {BasicCache}\n */\n miss(item, entry) {\n return new BasicCache(\n this.cache.update(item, existingEntry => {\n if (existingEntry && existingEntry.dispatchId > entry.dispatchId) {\n throw new Error('Refusing to cache older value')\n }\n return entry\n })\n )\n }\n\n /**\n * Removes entry from cache\n * @param {Object} item\n * @return {BasicCache}\n */\n evict(item) {\n return new BasicCache(this.cache.remove(item))\n }\n}\n\nconst DEFAULT_LRU_LIMIT = 1000\nconst DEFAULT_LRU_EVICT_COUNT = 1\n\n/**\n * Implements caching strategy that evicts least-recently-used items in cache\n * when an item is being added to a cache that has reached a configured size\n * limit.\n */\nexport class LRUCache {\n\n constructor(limit = DEFAULT_LRU_LIMIT, evictCount = DEFAULT_LRU_EVICT_COUNT, cache = new BasicCache(), lru = OrderedSet()) {\n console.log(\"using LRU\")\n this.limit = limit\n this.evictCount = evictCount\n this.cache = cache\n this.lru = lru\n }\n\n /**\n * Retrieve the associated value, if it exists in this cache, otherwise\n * returns notFoundValue (or undefined if not provided)\n * @param {Object} item\n * @param {Object?} notFoundValue\n * @return {CacheEntry}\n */\n lookup(item, notFoundValue) {\n return this.cache.lookup(item, notFoundValue)\n }\n\n /**\n * Checks if this cache contains an associated value\n * @param {Object} item\n * @return {boolean}\n */\n has(item) {\n return this.cache.has(item)\n }\n\n /**\n * Return cached items as map\n * @return {Immutable.Map}\n */\n asMap() {\n return this.cache.asMap()\n }\n\n /**\n * Updates this cache when it is determined to contain the associated value\n * @param {Object} item\n * @return {LRUCache}\n */\n hit(item) {\n if (!this.cache.has(item)) {\n return this\n }\n\n // remove it first to reorder in lru OrderedSet\n return new LRUCache(this.limit, this.evictCount, this.cache, this.lru.remove(item).add(item))\n }\n\n /**\n * Updates this cache when it is determined to **not** contain the associated value\n * If cache has reached size limit, the LRU item is evicted.\n * @param {Object} item\n * @param {CacheEntry} entry\n * @return {LRUCache}\n */\n miss(item, entry) {\n var lruCache\n if (this.lru.size >= this.limit) {\n if (this.has(item)) {\n return new LRUCache(\n this.limit,\n this.evictCount,\n this.cache.miss(item, entry),\n this.lru.remove(item).add(item)\n )\n }\n\n const cache = (this.lru\n .take(this.evictCount)\n .reduce((c, evictItem) => c.evict(evictItem), this.cache)\n .miss(item, entry))\n\n lruCache = new LRUCache(\n this.limit,\n this.evictCount,\n cache,\n this.lru.skip(this.evictCount).add(item)\n )\n } else {\n lruCache = new LRUCache(\n this.limit,\n this.evictCount,\n this.cache.miss(item, entry),\n this.lru.add(item)\n )\n }\n return lruCache\n }\n\n /**\n * Removes entry from cache\n * @param {Object} item\n * @return {LRUCache}\n */\n evict(item) {\n if (!this.cache.has(item)) {\n return this\n }\n\n return new LRUCache(\n this.limit,\n this.evictCount,\n this.cache.evict(item),\n this.lru.remove(item)\n )\n }\n}\n\n/**\n * Returns default cache strategy\n * @return {BasicCache}\n */\nexport function DefaultCache() {\n return new BasicCache()\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/reactor/cache.js\n **/","import Immutable, { List } from 'immutable'\nimport { isFunction, isArray } from './utils'\nimport { isKeyPath } from './key-path'\n\n/**\n * Getter helper functions\n * A getter is an array with the form:\n * [, ..., ]\n */\nconst identity = (x) => x\n\n/**\n * Checks if something is a getter literal, ex: ['dep1', 'dep2', function(dep1, dep2) {...}]\n * @param {*} toTest\n * @return {boolean}\n */\nfunction isGetter(toTest) {\n return (isArray(toTest) && isFunction(toTest[toTest.length - 1]))\n}\n\n/**\n * Returns the compute function from a getter\n * @param {Getter} getter\n * @return {function}\n */\nfunction getComputeFn(getter) {\n return getter[getter.length - 1]\n}\n\n/**\n * Returns an array of deps from a getter\n * @param {Getter} getter\n * @return {function}\n */\nfunction getDeps(getter) {\n return getter.slice(0, getter.length - 1)\n}\n\n/**\n * Returns an array of deps from a getter and all its deps\n * @param {Getter} getter\n * @param {Immutable.Set} existing\n * @return {Immutable.Set}\n */\nfunction getFlattenedDeps(getter, existing) {\n if (!existing) {\n existing = Immutable.Set()\n }\n\n const toAdd = Immutable.Set().withMutations(set => {\n if (!isGetter(getter)) {\n throw new Error('getFlattenedDeps must be passed a Getter')\n }\n\n getDeps(getter).forEach(dep => {\n if (isKeyPath(dep)) {\n set.add(List(dep))\n } else if (isGetter(dep)) {\n set.union(getFlattenedDeps(dep))\n } else {\n throw new Error('Invalid getter, each dependency must be a KeyPath or Getter')\n }\n })\n })\n\n return existing.union(toAdd)\n}\n\n/**\n * @param {KeyPath}\n * @return {Getter}\n */\nfunction fromKeyPath(keyPath) {\n if (!isKeyPath(keyPath)) {\n throw new Error('Cannot create Getter from KeyPath: ' + keyPath)\n }\n\n return [keyPath, identity]\n}\n\n/**\n * Adds non enumerated __storeDeps property\n * @param {Getter}\n */\nfunction getStoreDeps(getter) {\n if (getter.hasOwnProperty('__storeDeps')) {\n return getter.__storeDeps\n }\n\n const storeDeps = getFlattenedDeps(getter)\n .map(keyPath => keyPath.first())\n .filter(x => !!x)\n\n\n Object.defineProperty(getter, '__storeDeps', {\n enumerable: false,\n configurable: false,\n writable: false,\n value: storeDeps,\n })\n\n return storeDeps\n}\n\nexport default {\n isGetter,\n getComputeFn,\n getFlattenedDeps,\n getStoreDeps,\n getDeps,\n fromKeyPath,\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/getter.js\n **/","import Immutable from 'immutable'\nimport { isArray, isFunction } from './utils'\n\n/**\n * Checks if something is simply a keyPath and not a getter\n * @param {*} toTest\n * @return {boolean}\n */\nexport function isKeyPath(toTest) {\n return (\n isArray(toTest) &&\n !isFunction(toTest[toTest.length - 1])\n )\n}\n\n/**\n * Checks if two keypaths are equal by value\n * @param {KeyPath} a\n * @param {KeyPath} a\n * @return {Boolean}\n */\nexport function isEqual(a, b) {\n const iA = Immutable.List(a)\n const iB = Immutable.List(b)\n\n return Immutable.is(iA, iB)\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/key-path.js\n **/","import { getOption } from './reactor/fns'\n\n/* eslint-disable no-console */\n/**\n * Wraps a Reactor.react invocation in a console.group\n */\nexport const ConsoleGroupLogger = {\n /**\n * @param {ReactorState} reactorState\n * @param {String} type\n * @param {*} payload\n */\n dispatchStart: function(reactorState, type, payload) {\n if (!getOption(reactorState, 'logDispatches')) {\n return\n }\n\n if (console.group) {\n console.groupCollapsed('Dispatch: %s', type)\n console.group('payload')\n console.debug(payload)\n console.groupEnd()\n }\n },\n /**\n * @param {ReactorState} reactorState\n * @param {Error} error\n */\n dispatchError: function(reactorState, error) {\n if (!getOption(reactorState, 'logDispatches')) {\n return\n }\n\n if (console.group) {\n console.debug('Dispatch error: ' + error)\n console.groupEnd()\n }\n },\n /**\n * @param {ReactorState} reactorState\n * @param {Map} state\n * @param {Set} dirtyStores\n */\n dispatchEnd: function(reactorState, state, dirtyStores, previousState) {\n if (!getOption(reactorState, 'logDispatches')) {\n return\n }\n\n if (console.group) {\n if (getOption(reactorState, 'logDirtyStores')) {\n console.log('Stores updated:', dirtyStores.toList().toJS())\n }\n\n if (getOption(reactorState, 'logAppState')) {\n console.debug('Dispatch done, new state: ', state.toJS())\n }\n console.groupEnd()\n }\n },\n}\n\n/* eslint-enable no-console */\n\nexport const NoopLogger = {\n /**\n * @param {ReactorState} reactorState\n * @param {String} type\n * @param {*} payload\n */\n dispatchStart: function(reactorState, type, payload) {\n },\n /**\n * @param {ReactorState} reactorState\n * @param {Error} error\n */\n dispatchError: function(reactorState, error) {\n },\n /**\n * @param {ReactorState} reactorState\n * @param {Map} state\n * @param {Set} dirtyStores\n */\n dispatchEnd: function(reactorState, state, dirtyStores) {\n },\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/logging.js\n **/","import { Map, Set, Record } from 'immutable'\nimport { DefaultCache } from './cache'\nimport { NoopLogger } from '../logging'\n\nexport const PROD_OPTIONS = Map({\n // logs information for each dispatch\n logDispatches: false,\n // log the entire app state after each dispatch\n logAppState: false,\n // logs what stores changed after a dispatch\n logDirtyStores: false,\n // if true, throws an error when dispatching an `undefined` actionType\n throwOnUndefinedActionType: false,\n // if true, throws an error if a store returns undefined\n throwOnUndefinedStoreReturnValue: false,\n // if true, throws an error if a store.getInitialState() returns a non immutable value\n throwOnNonImmutableStore: false,\n // if true, throws when dispatching in dispatch\n throwOnDispatchInDispatch: false,\n})\n\nexport const DEBUG_OPTIONS = Map({\n // logs information for each dispatch\n logDispatches: true,\n // log the entire app state after each dispatch\n logAppState: true,\n // logs what stores changed after a dispatch\n logDirtyStores: true,\n // if true, throws an error when dispatching an `undefined` actionType\n throwOnUndefinedActionType: true,\n // if true, throws an error if a store returns undefined\n throwOnUndefinedStoreReturnValue: true,\n // if true, throws an error if a store.getInitialState() returns a non immutable value\n throwOnNonImmutableStore: true,\n // if true, throws when dispatching in dispatch\n throwOnDispatchInDispatch: true,\n})\n\nexport const ReactorState = Record({\n dispatchId: 0,\n state: Map(),\n stores: Map(),\n cache: DefaultCache(),\n logger: NoopLogger,\n // maintains a mapping of storeId => state id (monotomically increasing integer whenever store state changes)\n storeStates: Map(),\n dirtyStores: Set(),\n debug: false,\n // production defaults\n options: PROD_OPTIONS,\n})\n\nexport const ObserverState = Record({\n // observers registered to any store change\n any: Set(),\n // observers registered to specific store changes\n stores: Map({}),\n\n observersMap: Map({}),\n\n nextId: 1,\n})\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/reactor/records.js\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/src/logging.js b/src/logging.js index b1c1373..63bce17 100644 --- a/src/logging.js +++ b/src/logging.js @@ -41,7 +41,7 @@ export const ConsoleGroupLogger = { * @param {Map} state * @param {Set} dirtyStores */ - dispatchEnd: function(reactorState, state, dirtyStores) { + dispatchEnd: function(reactorState, state, dirtyStores, previousState) { if (!getOption(reactorState, 'logDispatches')) { return } diff --git a/src/main.js b/src/main.js index 3e0ebc1..1b17bf6 100644 --- a/src/main.js +++ b/src/main.js @@ -5,6 +5,7 @@ import Immutable from 'immutable' import { toJS, toImmutable, isImmutable } from './immutable-helpers' import { isKeyPath } from './key-path' import { isGetter } from './getter' +import { LRUCache } from './reactor/cache' import createReactMixin from './create-react-mixin' export default { @@ -17,4 +18,5 @@ export default { toImmutable, isImmutable, createReactMixin, + LRUCache, } diff --git a/src/reactor/fns.js b/src/reactor/fns.js index 35f83da..5fae572 100644 --- a/src/reactor/fns.js +++ b/src/reactor/fns.js @@ -112,7 +112,7 @@ export function dispatch(reactorState, actionType, payload) { } }) - logging.dispatchEnd(reactorState, state, dirtyStores) + logging.dispatchEnd(reactorState, state, dirtyStores, currState) }) const nextReactorState = reactorState