Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

immutable

Package Overview
Dependencies
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immutable - npm Package Compare versions

Comparing version 2.0.10 to 2.0.11

2558

dist/Immutable.d.ts

@@ -24,1488 +24,1530 @@ /**

/**
* `Immutable.is()` has the same semantics as Object.is(), but treats immutable
* sequences as data, equal if the second immutable sequences contains
* equivalent data. It's used throughout when checking for equality.
*
* var map1 = Immutable.Map({a:1, b:1, c:1});
* var map2 = Immutable.Map({a:1, b:1, c:1});
* assert(map1 !== map2);
* assert(Object.is(map1, map2) === false);
* assert(Immutable.is(map1, map2) === true);
*
*/
export declare function is(first: any, second: any): boolean;
declare module 'Immutable' {
/**
* `Immutable.fromJS()` deeply converts plain JS objects and arrays to
* Immutable sequences.
*
* If a `converter` is optionally provided, it will be called with every
* sequence (beginning with the most nested sequences and proceeding to the
* original sequence itself), along with the key refering to this Sequence
* and the parent JS object provided as `this`. For the top level, object,
* the key will be "". This `converter` is expected to return a new Sequence,
* allowing for custom convertions from deep JS objects.
*
* This example converts JSON to Vector and OrderedMap:
*
* Immutable.fromJS({a: {b: [10, 20, 30]}, c: 40}, function (value, key) {
* var isIndexed = value instanceof IndexedSequence;
* console.log(isIndexed, key, this);
* return isIndexed ? value.toVector() : value.toOrderedMap();
* });
*
* // true, "b", {b: [10, 20, 30]}
* // false, "a", {a: {b: [10, 20, 30]}, c: 40}
* // false, "", {"": {a: {b: [10, 20, 30]}, c: 40}}
*
* If `converter` is not provided, the default behavior will convert Arrays into
* Vectors and Objects into Maps.
*
* Note: `converter` acts similarly to [`reviver`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter)
* in `JSON.parse`.
*/
export declare function fromJS(
json: any,
converter?: (k: any, v: Sequence<any, any>) => any
): any;
/**
* Sequence
* --------
*
* The `Sequence` is a set of (key, value) entries which can be iterated, and
* is the base class for all collections in `immutable`, allowing them to
* make use of all the Sequence methods (such as `map` and `filter`).
*
* **Sequences are immutable** — Once a sequence is created, it cannot be
* changed, appended to, rearranged or otherwise modified. Instead, any mutative
* method called on a sequence will return a new immutable sequence.
*
* **Sequences are lazy** — Sequences do as little work as necessary to respond
* to any method call.
*
* For example, the following does no work, because the resulting sequence is
* never used:
*
* var oddSquares = Immutable.Sequence(1,2,3,4,5,6,7,8)
* .filter(x => x % 2).map(x => x * x);
*
* Once the sequence is used, it performs only the work necessary. In this
* example, no intermediate arrays are ever created, filter is only called
* twice, and map is only called once:
*
* console.log(evenSquares.last()); // 49
*
* Lazy Sequences allow for the efficient chaining of sequence operations,
* allowing for the expression of logic that can otherwise be very tedious:
*
* Immutable.Sequence({a:1, b:1, c:1})
* .flip().map(key => key.toUpperCase()).flip().toObject();
* // Map { A: 1, B: 1, C: 1 }
*
* As well as expressing logic that would otherwise seem memory-limited:
*
* Immutable.Range(1, Infinity)
* .skip(1000)
* .map(n => -n)
* .filter(n => n % 2 === 0)
* .take(2)
* .reduce((r, n) => r * n, 1);
* // 1006008
*
* Note: A sequence is always iterated in the same order, however that order may
* not always be well defined, as is the case for the `Map`.
*/
/**
* `Immutable.Sequence()` returns a sequence of its parameters.
*
* * If provided a single argument:
* * If a Sequence, that same Sequence is returned.
* * If an Array, an `IndexedSequence` is returned.
* * If a plain Object, a `Sequence` is returned, iterated in the same order
* as the for-in would iterate through the Object itself.
* * An `IndexedSequence` of all arguments is returned.
*
* Note: if a Sequence is created from a JavaScript Array or Object, then it can
* still possibly mutated if the underlying Array or Object is ever mutated.
*/
export declare function Sequence<T>(seq: IndexedSequence<T>): IndexedSequence<T>;
export declare function Sequence<T>(array: Array<T>): IndexedSequence<T>;
export declare function Sequence<K, V>(seq: Sequence<K, V>): Sequence<K, V>;
export declare function Sequence<V>(obj: {[key: string]: V}): Sequence<string, V>;
export declare function Sequence<T>(...values: T[]): IndexedSequence<T>;
export declare function Sequence(): Sequence<any, any>;
/**
* Like `Immutable.Sequence()`, `Immutable.Sequence.from()` returns a sequence,
* but always expects a single argument.
*/
export declare module Sequence {
function from<T>(seq: IndexedSequence<T>): IndexedSequence<T>;
function from<T>(array: Array<T>): IndexedSequence<T>;
function from<K, V>(seq: Sequence<K, V>): Sequence<K, V>;
function from<V>(obj: {[key: string]: V}): Sequence<string, V>;
}
export interface Sequence<K, V> {
/**
* Some sequences can describe their length lazily. When this is the case,
* length will be an integer. Otherwise it will be undefined.
* `Immutable.is()` has the same semantics as Object.is(), but treats immutable
* sequences as data, equal if the second immutable sequences contains
* equivalent data. It's used throughout when checking for equality.
*
* For example, the new Sequences returned from map() or reverse()
* preserve the length of the original sequence while filter() does not.
* var map1 = Immutable.Map({a:1, b:1, c:1});
* var map2 = Immutable.Map({a:1, b:1, c:1});
* assert(map1 !== map2);
* assert(Object.is(map1, map2) === false);
* assert(Immutable.is(map1, map2) === true);
*
* Note: All original collections will have a length, including Maps, Vectors,
* Sets, Ranges, Repeats and Sequences made from Arrays and Objects.
*/
length: number;
export function is(first: any, second: any): boolean;
/**
* Regardless of if this sequence can describe its length lazily, this method
* will always return the correct length. E.g. it evaluates the full sequence
* if necessary.
* `Immutable.fromJS()` deeply converts plain JS objects and arrays to
* Immutable sequences.
*
* If `predicate` is provided, then this returns the count of entries in the
* sequence for which the `predicate` returns true.
*/
count(): number;
count(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): number;
/**
* Deeply converts this sequence to a string.
*/
toString(): string;
/**
* Deeply converts this sequence to equivalent JS.
* If a `converter` is optionally provided, it will be called with every
* sequence (beginning with the most nested sequences and proceeding to the
* original sequence itself), along with the key refering to this Sequence
* and the parent JS object provided as `this`. For the top level, object,
* the key will be "". This `converter` is expected to return a new Sequence,
* allowing for custom convertions from deep JS objects.
*
* IndexedSequences, Vectors, Ranges, Repeats and Sets become Arrays, while
* other Sequences become Objects.
* This example converts JSON to Vector and OrderedMap:
*
* Immutable.fromJS({a: {b: [10, 20, 30]}, c: 40}, function (value, key) {
* var isIndexed = value instanceof IndexedSequence;
* console.log(isIndexed, key, this);
* return isIndexed ? value.toVector() : value.toOrderedMap();
* });
*
* // true, "b", {b: [10, 20, 30]}
* // false, "a", {a: {b: [10, 20, 30]}, c: 40}
* // false, "", {"": {a: {b: [10, 20, 30]}, c: 40}}
*
* If `converter` is not provided, the default behavior will convert Arrays into
* Vectors and Objects into Maps.
*
* Note: `converter` acts similarly to [`reviver`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter)
* in `JSON.parse`.
*/
toJS(): any;
export function fromJS(
json: any,
converter?: (k: any, v: Sequence<any, any>) => any
): any;
/**
* Converts this sequence to an Array, discarding keys.
*/
toArray(): Array<V>;
/**
* Converts this sequence to an Object. Throws if keys are not strings.
*/
toObject(): Object;
/**
* Converts this sequence to a Vector, discarding keys.
* Sequence
* --------
*
* Note: This is equivalent to `Vector.from(this)`, but provided to allow for
* chained expressions.
*/
toVector(): Vector<V>;
/**
* Converts this sequence to a Map, Throws if keys are not hashable.
* The `Sequence` is a set of (key, value) entries which can be iterated, and
* is the base class for all collections in `immutable`, allowing them to
* make use of all the Sequence methods (such as `map` and `filter`).
*
* Note: This is equivalent to `Map.from(this)`, but provided to allow for
* chained expressions.
*/
toMap(): Map<K, V>;
/**
* Converts this sequence to a Map, maintaining the order of iteration.
* **Sequences are immutable** — Once a sequence is created, it cannot be
* changed, appended to, rearranged or otherwise modified. Instead, any mutative
* method called on a sequence will return a new immutable sequence.
*
* Note: This is equivalent to `OrderedMap.from(this)`, but provided to allow
* for chained expressions.
*/
toOrderedMap(): Map<K, V>;
/**
* Converts this sequence to a Set, discarding keys. Throws if values
* are not hashable.
* **Sequences are lazy** — Sequences do as little work as necessary to respond
* to any method call.
*
* Note: This is equivalent to `Set.from(this)`, but provided to allow for
* chained expressions.
* For example, the following does no work, because the resulting sequence is
* never used:
*
* var oddSquares = Immutable.Sequence(1,2,3,4,5,6,7,8)
* .filter(x => x % 2).map(x => x * x);
*
* Once the sequence is used, it performs only the work necessary. In this
* example, no intermediate arrays are ever created, filter is only called
* twice, and map is only called once:
*
* console.log(evenSquares.last()); // 49
*
* Lazy Sequences allow for the efficient chaining of sequence operations,
* allowing for the expression of logic that can otherwise be very tedious:
*
* Immutable.Sequence({a:1, b:1, c:1})
* .flip().map(key => key.toUpperCase()).flip().toObject();
* // Map { A: 1, B: 1, C: 1 }
*
* As well as expressing logic that would otherwise seem memory-limited:
*
* Immutable.Range(1, Infinity)
* .skip(1000)
* .map(n => -n)
* .filter(n => n % 2 === 0)
* .take(2)
* .reduce((r, n) => r * n, 1);
* // 1006008
*
* Note: A sequence is always iterated in the same order, however that order may
* not always be well defined, as is the case for the `Map`.
*/
toSet(): Set<V>;
/**
* True if this and the other sequence have value equality, as defined
* by `Immutable.is()`.
* `Immutable.Sequence()` returns a sequence of its parameters.
*
* Note: This is equivalent to `Immutable.is(this, other)`, but provided to
* allow for chained expressions.
* * If provided a single argument:
* * If a Sequence, that same Sequence is returned.
* * If an Array, an `IndexedSequence` is returned.
* * If a plain Object, a `Sequence` is returned, iterated in the same order
* as the for-in would iterate through the Object itself.
* * An `IndexedSequence` of all arguments is returned.
*
* Note: if a Sequence is created from a JavaScript Array or Object, then it can
* still possibly mutated if the underlying Array or Object is ever mutated.
*/
equals(other: Sequence<K, V>): boolean;
export function Sequence<T>(seq: IndexedSequence<T>): IndexedSequence<T>;
export function Sequence<T>(array: Array<T>): IndexedSequence<T>;
export function Sequence<K, V>(seq: Sequence<K, V>): Sequence<K, V>;
export function Sequence<V>(obj: {[key: string]: V}): Sequence<string, V>;
export function Sequence<T>(...values: T[]): IndexedSequence<T>;
export function Sequence(): Sequence<any, any>;
/**
* Joins values together as a string, inserting a separator between each.
* The default separator is ",".
* Like `Immutable.Sequence()`, `Immutable.Sequence.from()` returns a sequence,
* but always expects a single argument.
*/
join(separator?: string): string;
export module Sequence {
function from<T>(seq: IndexedSequence<T>): IndexedSequence<T>;
function from<T>(array: Array<T>): IndexedSequence<T>;
function from<K, V>(seq: Sequence<K, V>): Sequence<K, V>;
function from<V>(obj: {[key: string]: V}): Sequence<string, V>;
}
/**
* Returns a new sequence with other values and sequences concatenated to
* this one. All entries will be present in the resulting sequence, even if
* they have the same key.
*/
concat(...valuesOrSequences: any[]): Sequence<any, any>;
/**
* Returns a new sequence which iterates in reverse order of this sequence.
*/
reverse(): Sequence<K, V>;
export interface Sequence<K, V> {
/**
* Returns a new indexed sequence of the keys of this sequence,
* discarding values.
*/
keys(): IndexedSequence<K>;
/**
* Some sequences can describe their length lazily. When this is the case,
* length will be an integer. Otherwise it will be undefined.
*
* For example, the new Sequences returned from map() or reverse()
* preserve the length of the original sequence while filter() does not.
*
* Note: All original collections will have a length, including Maps, Vectors,
* Sets, Ranges, Repeats and Sequences made from Arrays and Objects.
*/
length: number;
/**
* Returns a new indexed sequence of the keys of this sequence,
* discarding keys.
*/
values(): IndexedSequence<V>;
/**
* Regardless of if this sequence can describe its length lazily, this method
* will always return the correct length. E.g. it evaluates the full sequence
* if necessary.
*
* If `predicate` is provided, then this returns the count of entries in the
* sequence for which the `predicate` returns true.
*/
count(): number;
count(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): number;
/**
* Returns a new indexed sequence of [key, value] tuples.
*/
entries(): IndexedSequence</*(K, V)*/Array<any>>;
/**
* Deeply converts this sequence to a string.
*/
toString(): string;
/**
* The `sideEffect` is executed for every entry in the sequence.
*
* Unlike `Array.prototype.forEach`, if any call of `sideEffect` returns
* `false`, the iteration will stop. Returns the length of the sequence which
* was iterated.
*/
forEach(
sideEffect: (value?: V, key?: K, seq?: Sequence<K, V>) => any,
thisArg?: any
): number;
/**
* Deeply converts this sequence to equivalent JS.
*
* IndexedSequences, Vectors, Ranges, Repeats and Sets become Arrays, while
* other Sequences become Objects.
*/
toJS(): any;
/**
* Reduces the sequence to a value by calling the `reducer` for every entry
* in the sequence and passing along the reduced value.
*/
reduce<R>(
reducer: (reduction?: R, value?: V, key?: K, seq?: Sequence<K, V>) => R,
initialReduction?: R,
thisArg?: any
): R;
/**
* Converts this sequence to an Array, discarding keys.
*/
toArray(): Array<V>;
/**
* Reduces the sequence in reverse (from the right side).
*
* Note: Equivalent to this.reverse().reduce(), but provided for parity
* with `Array.prototype.reduceRight`.
*/
reduceRight<R>(
reducer: (reduction?: R, value?: V, key?: K, seq?: Sequence<K, V>) => R,
initialReduction: R,
thisArg?: any
): R;
/**
* Converts this sequence to an Object. Throws if keys are not strings.
*/
toObject(): Object;
/**
* True if `predicate` returns true for all entries in the sequence.
*/
every(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): boolean;
/**
* Converts this sequence to a Vector, discarding keys.
*
* Note: This is equivalent to `Vector.from(this)`, but provided to allow for
* chained expressions.
*/
toVector(): Vector<V>;
/**
* True if `predicate` returns true for any entry in the sequence.
*/
some(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): boolean;
/**
* Converts this sequence to a Map, Throws if keys are not hashable.
*
* Note: This is equivalent to `Map.from(this)`, but provided to allow for
* chained expressions.
*/
toMap(): Map<K, V>;
/**
* The first value in the sequence.
*/
first(): V;
/**
* Converts this sequence to a Map, maintaining the order of iteration.
*
* Note: This is equivalent to `OrderedMap.from(this)`, but provided to allow
* for chained expressions.
*/
toOrderedMap(): Map<K, V>;
/**
* The last value in the sequence.
*/
last(): V;
/**
* Converts this sequence to a Set, discarding keys. Throws if values
* are not hashable.
*
* Note: This is equivalent to `Set.from(this)`, but provided to allow for
* chained expressions.
*/
toSet(): Set<V>;
/**
* Returns a new Sequence containing all entries except the first.
*/
rest(): Sequence<K, V>
/**
* True if this and the other sequence have value equality, as defined
* by `Immutable.is()`.
*
* Note: This is equivalent to `Immutable.is(this, other)`, but provided to
* allow for chained expressions.
*/
equals(other: Sequence<K, V>): boolean;
/**
* Returns a new Sequence containing all entries except the last.
*/
butLast(): Sequence<K, V>
/**
* Joins values together as a string, inserting a separator between each.
* The default separator is ",".
*/
join(separator?: string): string;
/**
* True if a key exists within this Sequence.
*/
has(key: K): boolean;
/**
* Returns a new sequence with other values and sequences concatenated to
* this one. All entries will be present in the resulting sequence, even if
* they have the same key.
*/
concat(...valuesOrSequences: any[]): Sequence<any, any>;
/**
* Returns the value associated with the provided key, or notFoundValue if
* the Sequence does not contain this key.
*
* Note: it is possible a key may be associated with an `undefined` value, so
* if `notFoundValue` is not provided and this method returns `undefined`,
* that does not guarantee the key was not found.
*/
get(key: K, notFoundValue?: V): V;
/**
* Returns a new sequence which iterates in reverse order of this sequence.
*/
reverse(): Sequence<K, V>;
/**
* Returns the value found by following a key path through nested sequences.
*/
getIn(searchKeyPath: Array<K>, notFoundValue?: V): V;
/**
* Returns a new indexed sequence of the keys of this sequence,
* discarding values.
*/
keys(): IndexedSequence<K>;
/**
* True if a value exists within this Sequence.
*/
contains(value: V): boolean;
/**
* Returns a new indexed sequence of the keys of this sequence,
* discarding keys.
*/
values(): IndexedSequence<V>;
/**
* Returns the value for which the `predicate` returns true.
*/
find(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any,
notFoundValue?: V
): V;
/**
* Returns a new indexed sequence of [key, value] tuples.
*/
entries(): IndexedSequence</*(K, V)*/Array<any>>;
/**
* Returns the key for which the `predicate` returns true.
*/
findKey(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): K;
/**
* The `sideEffect` is executed for every entry in the sequence.
*
* Unlike `Array.prototype.forEach`, if any call of `sideEffect` returns
* `false`, the iteration will stop. Returns the length of the sequence which
* was iterated.
*/
forEach(
sideEffect: (value?: V, key?: K, seq?: Sequence<K, V>) => any,
thisArg?: any
): number;
/**
* Returns the last value for which the `predicate` returns true.
*
* Note: `predicate` will be called for each entry in reverse.
*/
findLast(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any,
notFoundValue?: V
): V;
/**
* Reduces the sequence to a value by calling the `reducer` for every entry
* in the sequence and passing along the reduced value.
*/
reduce<R>(
reducer: (reduction?: R, value?: V, key?: K, seq?: Sequence<K, V>) => R,
initialReduction?: R,
thisArg?: any
): R;
/**
* Returns the last key for which the `predicate` returns true.
*
* Note: `predicate` will be called for each entry in reverse.
*/
findLastKey(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): K;
/**
* Reduces the sequence in reverse (from the right side).
*
* Note: Equivalent to this.reverse().reduce(), but provided for parity
* with `Array.prototype.reduceRight`.
*/
reduceRight<R>(
reducer: (reduction?: R, value?: V, key?: K, seq?: Sequence<K, V>) => R,
initialReduction: R,
thisArg?: any
): R;
/**
* Returns a new sequence with this sequences's keys as it's values, and this
* sequences's values as it's keys.
*
* Sequence({ a: 'z', b: 'y' }).flip() // { z: 'a', y: 'b' }
*
*/
flip(): Sequence<V, K>;
/**
* True if `predicate` returns true for all entries in the sequence.
*/
every(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): boolean;
/**
* Returns a new sequence with values passed through a `mapper` function.
*
* Sequence({ a: 1, b: 2 }).map(x => 10 * x) // { a: 10, b: 20 }
*
*/
map<M>(
mapper: (value?: V, key?: K, seq?: Sequence<K, V>) => M,
thisArg?: any
): Sequence<K, M>;
/**
* True if `predicate` returns true for any entry in the sequence.
*/
some(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): boolean;
/**
* Returns a new sequence with keys passed through a `mapper` function.
*
* Sequence({ a: 1, b: 2 }).mapKeys(x => x.toUpperCase()) // { A: 1, B: 2 }
*
*/
mapKeys<M>(
mapper: (key?: K, value?: V, seq?: Sequence<K, V>) => M,
thisArg?: any
): Sequence<M, V>;
/**
* The first value in the sequence.
*/
first(): V;
/**
* Returns a new sequence with only the entries for which the `predicate`
* function returns true.
*
* Sequence({a:1,b:2,c:3,d:4}).filter(x => x % 2 === 0) // { b: 2, d: 4 }
*
*/
filter(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): Sequence<K, V>;
/**
* The last value in the sequence.
*/
last(): V;
/**
* Returns a new sequence representing a portion of this sequence from start
* up to but not including end.
*
* If begin is negative, it is offset from the end of the sequence. e.g.
* `slice(-2)` returns a sequence of the last two entries. If it is not
* provided the new sequence will begin at the beginning of this sequence.
*
* If end is negative, it is offset from the end of the sequence. e.g.
* `slice(0, -1)` returns a sequence of everything but the last entry. If it
* is not provided, the new sequence will continue through the end of
* this sequence.
*
* If the requested slice is equivalent to the current Sequence, then it will
* return itself.
*
* Note: unlike `Array.prototype.slice`, this function is O(1) and copies
* no data. The resulting sequence is also lazy, and a copy is only made when
* it is converted such as via `toArray()` or `toVector()`.
*/
slice(begin?: number, end?: number): Sequence<K, V>;
/**
* Returns a new Sequence containing all entries except the first.
*/
rest(): Sequence<K, V>
/**
* Returns a new sequence which contains the first `amount` entries from
* this sequence.
*/
take(amount: number): Sequence<K, V>;
/**
* Returns a new Sequence containing all entries except the last.
*/
butLast(): Sequence<K, V>
/**
* Returns a new sequence which contains the last `amount` entries from
* this sequence.
*/
takeLast(amount: number): Sequence<K, V>;
/**
* True if a key exists within this Sequence.
*/
has(key: K): boolean;
/**
* Returns a new sequence which contains entries from this sequence as long
* as the `predicate` returns true.
*
* Sequence('dog','frog','cat','hat','god').takeWhile(x => x.match(/o/))
* // ['dog', 'frog']
*
*/
takeWhile(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): Sequence<K, V>;
/**
* Returns the value associated with the provided key, or notFoundValue if
* the Sequence does not contain this key.
*
* Note: it is possible a key may be associated with an `undefined` value, so
* if `notFoundValue` is not provided and this method returns `undefined`,
* that does not guarantee the key was not found.
*/
get(key: K, notFoundValue?: V): V;
/**
* Returns a new sequence which contains entries from this sequence as long
* as the `predicate` returns false.
*
* Sequence('dog','frog','cat','hat','god').takeUntil(x => x.match(/at/))
* // ['dog', 'frog']
*
*/
takeUntil(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): Sequence<K, V>;
/**
* Returns the value found by following a key path through nested sequences.
*/
getIn(searchKeyPath: Array<K>, notFoundValue?: V): V;
/**
* Returns a new sequence which excludes the first `amount` entries from
* this sequence.
*/
skip(amount: number): Sequence<K, V>;
/**
* True if a value exists within this Sequence.
*/
contains(value: V): boolean;
/**
* Returns a new sequence which excludes the last `amount` entries from
* this sequence.
*/
skipLast(amount: number): Sequence<K, V>;
/**
* Returns the value for which the `predicate` returns true.
*/
find(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any,
notFoundValue?: V
): V;
/**
* Returns a new sequence which contains entries starting from when
* `predicate` first returns false.
*
* Sequence('dog','frog','cat','hat','god').skipWhile(x => x.match(/g/))
* // ['cat', 'hat', 'god']
*
*/
skipWhile(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): Sequence<K, V>;
/**
* Returns the key for which the `predicate` returns true.
*/
findKey(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): K;
/**
* Returns a new sequence which contains entries starting from when
* `predicate` first returns true.
*
* Sequence('dog','frog','cat','hat','god').skipUntil(x => x.match(/hat/))
* // ['hat', 'god']
*
*/
skipUntil(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): Sequence<K, V>;
/**
* Returns the last value for which the `predicate` returns true.
*
* Note: `predicate` will be called for each entry in reverse.
*/
findLast(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any,
notFoundValue?: V
): V;
/**
* Returns a `Map` of counts, grouped by the return value of the
* `grouper` function.
*
* Note: Because this returns a Map, this method is not lazy.
*/
countBy<G>(
grouper: (value?: V, key?: K, seq?: Sequence<K, V>) => G,
thisArg?: any
): Map<G, number>;
/**
* Returns the last key for which the `predicate` returns true.
*
* Note: `predicate` will be called for each entry in reverse.
*/
findLastKey(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): K;
/**
* Returns a `Map` of sequences, grouped by the return value of the
* `grouper` function.
*
* Note: Because this returns a Map, this method is not lazy.
*/
groupBy<G>(
grouper: (value?: V, key?: K, seq?: Sequence<K, V>) => G,
thisArg?: any
): Map<G, Sequence<K, V>>;
/**
* Returns a new sequence with this sequences's keys as it's values, and this
* sequences's values as it's keys.
*
* Sequence({ a: 'z', b: 'y' }).flip() // { z: 'a', y: 'b' }
*
*/
flip(): Sequence<V, K>;
sort(comparator?: (valueA: V, valueB: V) => number): Sequence<K, V>;
/**
* Returns a new sequence with values passed through a `mapper` function.
*
* Sequence({ a: 1, b: 2 }).map(x => 10 * x) // { a: 10, b: 20 }
*
*/
map<M>(
mapper: (value?: V, key?: K, seq?: Sequence<K, V>) => M,
thisArg?: any
): Sequence<K, M>;
sortBy<S>(
sortValueMapper: (value?: V, key?: K, seq?: Sequence<K, V>) => S,
comparator?: (valueA: S, valueB: S) => number
): Sequence<K, V>;
/**
* Returns a new sequence with keys passed through a `mapper` function.
*
* Sequence({ a: 1, b: 2 }).mapKeys(x => x.toUpperCase()) // { A: 1, B: 2 }
*
*/
mapKeys<M>(
mapper: (key?: K, value?: V, seq?: Sequence<K, V>) => M,
thisArg?: any
): Sequence<M, V>;
/**
* Because Sequences are lazy and designed to be chained together, they do
* not cache their results. For example, this map function is called 6 times:
*
* var squares = Sequence(1,2,3).map(x => x * x);
* squares.join() + squares.join();
*
* If you know a derived sequence will be used multiple times, it may be more
* efficient to first cache it. Here, map is called 3 times:
*
* var squares = Sequence(1,2,3).map(x => x * x).cacheResult();
* squares.join() + squares.join();
*
* Use this method judiciously, as it must fully evaluate a lazy Sequence.
*
* Note: after calling `cacheResult()`, a Sequence will always have a length.
*/
cacheResult(): Sequence<K, V>;
}
/**
* Returns a new sequence with only the entries for which the `predicate`
* function returns true.
*
* Sequence({a:1,b:2,c:3,d:4}).filter(x => x % 2 === 0) // { b: 2, d: 4 }
*
*/
filter(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): Sequence<K, V>;
/**
* Returns a new sequence representing a portion of this sequence from start
* up to but not including end.
*
* If begin is negative, it is offset from the end of the sequence. e.g.
* `slice(-2)` returns a sequence of the last two entries. If it is not
* provided the new sequence will begin at the beginning of this sequence.
*
* If end is negative, it is offset from the end of the sequence. e.g.
* `slice(0, -1)` returns a sequence of everything but the last entry. If it
* is not provided, the new sequence will continue through the end of
* this sequence.
*
* If the requested slice is equivalent to the current Sequence, then it will
* return itself.
*
* Note: unlike `Array.prototype.slice`, this function is O(1) and copies
* no data. The resulting sequence is also lazy, and a copy is only made when
* it is converted such as via `toArray()` or `toVector()`.
*/
slice(begin?: number, end?: number): Sequence<K, V>;
/**
* Indexed Sequence
* ----------------
*
* Indexed Sequences have incrementing numeric keys. They exhibit
* slightly different behavior than `Sequence` for some methods in order to
* better mirror the behavior of JavaScript's `Array`, and add others which do
* not make sense on non-indexed sequences such as `indexOf`.
*
* Like JavaScript arrays, `IndexedSequence`s may be sparse, skipping over some
* indices and may have a length larger than the highest index.
*/
/**
* Returns a new sequence which contains the first `amount` entries from
* this sequence.
*/
take(amount: number): Sequence<K, V>;
export interface IndexedSequence<T> extends Sequence<number, T> {
/**
* Returns a new sequence which contains the last `amount` entries from
* this sequence.
*/
takeLast(amount: number): Sequence<K, V>;
/**
* If this is a sequence of entries (key-value tuples), it will return a
* sequence of those entries.
*/
fromEntries(): Sequence<any, any>;
/**
* Returns a new sequence which contains entries from this sequence as long
* as the `predicate` returns true.
*
* Sequence('dog','frog','cat','hat','god').takeWhile(x => x.match(/o/))
* // ['dog', 'frog']
*
*/
takeWhile(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): Sequence<K, V>;
/**
* Returns the first index at which a given value can be found in the
* sequence, or -1 if it is not present.
*/
indexOf(searchValue: T): number;
/**
* Returns a new sequence which contains entries from this sequence as long
* as the `predicate` returns false.
*
* Sequence('dog','frog','cat','hat','god').takeUntil(x => x.match(/at/))
* // ['dog', 'frog']
*
*/
takeUntil(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): Sequence<K, V>;
/**
* Returns the last index at which a given value can be found in the
* sequence, or -1 if it is not present.
*/
lastIndexOf(searchValue: T): number;
/**
* Returns a new sequence which excludes the first `amount` entries from
* this sequence.
*/
skip(amount: number): Sequence<K, V>;
/**
* Returns the first index in the sequence where a value satisfies the
* provided predicate function. Otherwise -1 is returned.
*/
findIndex(
predicate: (value?: T, index?: number, seq?: IndexedSequence<T>) => boolean,
thisArg?: any
): number;
/**
* Returns a new sequence which excludes the last `amount` entries from
* this sequence.
*/
skipLast(amount: number): Sequence<K, V>;
/**
* Returns the last index in the sequence where a value satisfies the
* provided predicate function. Otherwise -1 is returned.
*/
findLastIndex(
predicate: (value?: T, index?: number, seq?: IndexedSequence<T>) => boolean,
thisArg?: any
): number;
/**
* Returns a new sequence which contains entries starting from when
* `predicate` first returns false.
*
* Sequence('dog','frog','cat','hat','god').skipWhile(x => x.match(/g/))
* // ['cat', 'hat', 'god']
*
*/
skipWhile(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): Sequence<K, V>;
/**
* Splice returns a new indexed sequence by replacing a region of this sequence
* with new values. If values are not provided, it only skips the region to
* be removed.
*
* Sequence(['a','b','c','d']).splice(1, 2, 'q', 'r', 's')
* // ['a', 'q', 'r', 's', 'd']
*
*/
splice(index: number, removeNum: number, ...values: any[]): IndexedSequence<T>;
/**
* Returns a new sequence which contains entries starting from when
* `predicate` first returns true.
*
* Sequence('dog','frog','cat','hat','god').skipUntil(x => x.match(/hat/))
* // ['hat', 'god']
*
*/
skipUntil(
predicate: (value?: V, key?: K, seq?: Sequence<K, V>) => boolean,
thisArg?: any
): Sequence<K, V>;
/**
* When IndexedSequence is converted to an array, the index keys are
* maintained. This differs from the behavior of Sequence which
* simply makes a dense array of all values.
* @override
*/
toArray(): Array<T>;
/**
* Returns a `Map` of counts, grouped by the return value of the
* `grouper` function.
*
* Note: Because this returns a Map, this method is not lazy.
*/
countBy<G>(
grouper: (value?: V, key?: K, seq?: Sequence<K, V>) => G,
thisArg?: any
): Map<G, number>;
/**
* This has the same altered behavior as `toArray`.
* @override
*/
toVector(): Vector<T>;
/**
* Returns a `Map` of sequences, grouped by the return value of the
* `grouper` function.
*
* Note: Because this returns a Map, this method is not lazy.
*/
groupBy<G>(
grouper: (value?: V, key?: K, seq?: Sequence<K, V>) => G,
thisArg?: any
): Map<G, Sequence<K, V>>;
/**
* This new behavior will iterate through the values and sequences with
* increasing indices.
* @override
*/
concat(...valuesOrSequences: any[]): IndexedSequence<any>;
sort(comparator?: (valueA: V, valueB: V) => number): Sequence<K, V>;
/**
* This new behavior will not only iterate through the sequence in reverse,
* but it will also reverse the indices so the last value will report being
* at index 0. If you wish to preserve the original indices, set
* maintainIndices to true.
* @override
*/
reverse(maintainIndices?: boolean): IndexedSequence<T>;
sortBy<S>(
sortValueMapper: (value?: V, key?: K, seq?: Sequence<K, V>) => S,
comparator?: (valueA: S, valueB: S) => number
): Sequence<K, V>;
/**
* Indexed sequences have a different `filter` behavior, where the filtered
* values have new indicies incrementing from 0. If you want to preserve the
* original indicies, set maintainIndices to true.
* @override
*/
filter(
predicate: (value?: T, index?: number, seq?: IndexedSequence<T>) => boolean,
thisArg?: any,
maintainIndices?: boolean
): IndexedSequence<T>;
/**
* Because Sequences are lazy and designed to be chained together, they do
* not cache their results. For example, this map function is called 6 times:
*
* var squares = Sequence(1,2,3).map(x => x * x);
* squares.join() + squares.join();
*
* If you know a derived sequence will be used multiple times, it may be more
* efficient to first cache it. Here, map is called 3 times:
*
* var squares = Sequence(1,2,3).map(x => x * x).cacheResult();
* squares.join() + squares.join();
*
* Use this method judiciously, as it must fully evaluate a lazy Sequence.
*
* Note: after calling `cacheResult()`, a Sequence will always have a length.
*/
cacheResult(): Sequence<K, V>;
}
/**
* Adds the ability to maintain original indices.
* @override
*/
slice(start: number, end?: number, maintainIndices?: boolean): IndexedSequence<T>;
/**
* Has the same altered behavior as `takeWhile`.
* @override
* Indexed Sequence
* ----------------
*
* Indexed Sequences have incrementing numeric keys. They exhibit
* slightly different behavior than `Sequence` for some methods in order to
* better mirror the behavior of JavaScript's `Array`, and add others which do
* not make sense on non-indexed sequences such as `indexOf`.
*
* Like JavaScript arrays, `IndexedSequence`s may be sparse, skipping over some
* indices and may have a length larger than the highest index.
*/
take(amount: number, maintainIndices?: boolean): IndexedSequence<T>;
/**
* Has the same altered behavior as `takeWhile`.
* @override
*/
takeLast(amount: number, maintainIndices?: boolean): IndexedSequence<T>;
export interface IndexedSequence<T> extends Sequence<number, T> {
/**
* Indexed sequences have a different `takeWhile` behavior. The first
* value will have an index of 0 and the length of the sequence could be
* truncated. If you want to preserve the original indicies, set
* maintainIndices to true.
* @override
*/
takeWhile(
predicate: (value?: T, index?: number, seq?: IndexedSequence<T>) => boolean,
thisArg?: any,
maintainIndices?: boolean
): IndexedSequence<T>;
/**
* If this is a sequence of entries (key-value tuples), it will return a
* sequence of those entries.
*/
fromEntries(): Sequence<any, any>;
/**
* Has the same altered behavior as `takeWhile`.
* @override
*/
takeUntil(
predicate: (value?: T, index?: number, seq?: IndexedSequence<T>) => boolean,
thisArg?: any,
maintainIndices?: boolean
): IndexedSequence<T>;
/**
* Returns the first index at which a given value can be found in the
* sequence, or -1 if it is not present.
*/
indexOf(searchValue: T): number;
/**
* Has the same altered behavior as `skipWhile`.
* @override
*/
skip(amount: number, maintainIndices?: boolean): IndexedSequence<T>;
/**
* Returns the last index at which a given value can be found in the
* sequence, or -1 if it is not present.
*/
lastIndexOf(searchValue: T): number;
/**
* Has the same altered behavior as `skipWhile`.
* @override
*/
skipLast(amount: number, maintainIndices?: boolean): IndexedSequence<T>;
/**
* Returns the first index in the sequence where a value satisfies the
* provided predicate function. Otherwise -1 is returned.
*/
findIndex(
predicate: (value?: T, index?: number, seq?: IndexedSequence<T>) => boolean,
thisArg?: any
): number;
/**
* Indexed sequences have a different `skipWhile` behavior. The first
* non-skipped value will have an index of 0. If you want to preserve the
* original indicies, set maintainIndices to true.
* @override
*/
skipWhile(
predicate: (value?: T, index?: number, seq?: IndexedSequence<T>) => boolean,
thisArg?: any,
maintainIndices?: boolean
): IndexedSequence<T>;
/**
* Returns the last index in the sequence where a value satisfies the
* provided predicate function. Otherwise -1 is returned.
*/
findLastIndex(
predicate: (value?: T, index?: number, seq?: IndexedSequence<T>) => boolean,
thisArg?: any
): number;
/**
* Has the same altered behavior as `skipWhile`.
* @override
*/
skipUntil(
predicate: (value?: T, index?: number, seq?: IndexedSequence<T>) => boolean,
thisArg?: any,
maintainIndices?: boolean
): IndexedSequence<T>;
/**
* Splice returns a new indexed sequence by replacing a region of this sequence
* with new values. If values are not provided, it only skips the region to
* be removed.
*
* Sequence(['a','b','c','d']).splice(1, 2, 'q', 'r', 's')
* // ['a', 'q', 'r', 's', 'd']
*
*/
splice(index: number, removeNum: number, ...values: any[]): IndexedSequence<T>;
/**
* Indexed sequences have a different `groupBy` behavior. Each group will be
* a new indexed sequence starting with an index of 0. If you want to preserve
* the original indicies, set maintainIndices to true.
* @override
*/
groupBy<G>(
grouper: (value?: T, index?: number, seq?: IndexedSequence<T>) => G,
thisArg?: any,
maintainIndices?: boolean
): Map<G, any/*IndexedSequence<T>*/>; // Bug: exposing this causes the type checker to implode.
/**
* When IndexedSequence is converted to an array, the index keys are
* maintained. This differs from the behavior of Sequence which
* simply makes a dense array of all values.
* @override
*/
toArray(): Array<T>;
/**
* This has the same altered behavior as `toArray`.
* @override
*/
toVector(): Vector<T>;
sort(
comparator?: (valueA: T, valueB: T) => number,
maintainIndices?: boolean
): IndexedSequence<T>;
/**
* This new behavior will iterate through the values and sequences with
* increasing indices.
* @override
*/
concat(...valuesOrSequences: any[]): IndexedSequence<any>;
sortBy<S>(
sortValueMapper: (value?: T, index?: number, seq?: IndexedSequence<T>) => S,
comparator?: (valueA: S, valueB: S) => number,
maintainIndices?: boolean
): IndexedSequence<T>;
/**
* This new behavior will not only iterate through the sequence in reverse,
* but it will also reverse the indices so the last value will report being
* at index 0. If you wish to preserve the original indices, set
* maintainIndices to true.
* @override
*/
reverse(maintainIndices?: boolean): IndexedSequence<T>;
/**
* Indexed sequences have a different `filter` behavior, where the filtered
* values have new indicies incrementing from 0. If you want to preserve the
* original indicies, set maintainIndices to true.
* @override
*/
filter(
predicate: (value?: T, index?: number, seq?: IndexedSequence<T>) => boolean,
thisArg?: any,
maintainIndices?: boolean
): IndexedSequence<T>;
/**
* Returns an IndexedSequence
* @override
*/
map<M>(
mapper: (value?: T, index?: number, seq?: IndexedSequence<T>) => M,
thisArg?: any
): IndexedSequence<M>;
/**
* Adds the ability to maintain original indices.
* @override
*/
slice(start: number, end?: number, maintainIndices?: boolean): IndexedSequence<T>;
/**
* Returns an IndexedSequence
* @override
*/
cacheResult(): IndexedSequence<T>;
}
/**
* Has the same altered behavior as `takeWhile`.
* @override
*/
take(amount: number, maintainIndices?: boolean): IndexedSequence<T>;
/**
* Has the same altered behavior as `takeWhile`.
* @override
*/
takeLast(amount: number, maintainIndices?: boolean): IndexedSequence<T>;
/**
* Range
* -----
*
* Returns a lazy indexed sequence of numbers from `start` (inclusive) to `end`
* (exclusive), by `step`, where `start` defaults to 0, `step` to 1, and `end` to
* infinity. When `start` is equal to `end`, returns empty range.
*
* Range() // [0,1,2,3,...]
* Range(10) // [10,11,12,13,...]
* Range(10,15) // [10,11,12,13,14]
* Range(10,30,5) // [10,15,20,25]
* Range(30,10,5) // [30,25,20,15]
* Range(30,30,5) // []
*
*/
export declare function Range(start?: number, end?: number, step?: number): IndexedSequence<number>;
/**
* Indexed sequences have a different `takeWhile` behavior. The first
* value will have an index of 0 and the length of the sequence could be
* truncated. If you want to preserve the original indicies, set
* maintainIndices to true.
* @override
*/
takeWhile(
predicate: (value?: T, index?: number, seq?: IndexedSequence<T>) => boolean,
thisArg?: any,
maintainIndices?: boolean
): IndexedSequence<T>;
/**
* Has the same altered behavior as `takeWhile`.
* @override
*/
takeUntil(
predicate: (value?: T, index?: number, seq?: IndexedSequence<T>) => boolean,
thisArg?: any,
maintainIndices?: boolean
): IndexedSequence<T>;
/**
* Repeat
* ------
*
* Returns a lazy sequence of `value` repeated `times` times. When `times` is
* not defined, returns an infinite sequence of `value`.
*
* Repeat('foo') // ['foo','foo','foo',...]
* Repeat('bar',4) // ['bar','bar','bar','bar']
*
*/
export declare function Repeat<T>(value: T, times?: number): IndexedSequence<T>;
/**
* Has the same altered behavior as `skipWhile`.
* @override
*/
skip(amount: number, maintainIndices?: boolean): IndexedSequence<T>;
/**
* Has the same altered behavior as `skipWhile`.
* @override
*/
skipLast(amount: number, maintainIndices?: boolean): IndexedSequence<T>;
/**
* Map
* ---
*
* A Map is a Sequence of (key, value) pairs with `O(log32 N)` gets and sets.
*
* Map is a hash map and requires keys that are hashable, either a primitive
* (string or number) or an object with a `hashCode(): number` method.
*
* Iteration order of a Map is undefined, however is stable. Multiple iterations
* of the same Map will iterate in the same order.
*/
/**
* Indexed sequences have a different `skipWhile` behavior. The first
* non-skipped value will have an index of 0. If you want to preserve the
* original indicies, set maintainIndices to true.
* @override
*/
skipWhile(
predicate: (value?: T, index?: number, seq?: IndexedSequence<T>) => boolean,
thisArg?: any,
maintainIndices?: boolean
): IndexedSequence<T>;
export declare module Map {
/**
* Has the same altered behavior as `skipWhile`.
* @override
*/
skipUntil(
predicate: (value?: T, index?: number, seq?: IndexedSequence<T>) => boolean,
thisArg?: any,
maintainIndices?: boolean
): IndexedSequence<T>;
/**
* `Map.empty()` creates a new immutable map of length 0.
*/
function empty<K, V>(): Map<K, V>;
/**
* Indexed sequences have a different `groupBy` behavior. Each group will be
* a new indexed sequence starting with an index of 0. If you want to preserve
* the original indicies, set maintainIndices to true.
* @override
*/
groupBy<G>(
grouper: (value?: T, index?: number, seq?: IndexedSequence<T>) => G,
thisArg?: any,
maintainIndices?: boolean
): Map<G, any/*IndexedSequence<T>*/>; // Bug: exposing this causes the type checker to implode.
/**
* `Map.from()` creates a new immutable Map with the same key value pairs as
* the provided Sequence or JavaScript Object or Array.
*
* var newMap = Map.from({key: "value"});
*
*/
function from<K, V>(sequence: Sequence<K, V>): Map<K, V>;
function from<V>(object: {[key: string]: V}): Map<string, V>;
function from<V>(array: Array<V>): Map<number, V>;
}
/**
* Alias for `Map.empty()`.
*/
export declare function Map<K, V>(): Map<K, V>;
sort(
comparator?: (valueA: T, valueB: T) => number,
maintainIndices?: boolean
): IndexedSequence<T>;
/**
* Alias for `Map.from()`.
*/
export declare function Map<K, V>(sequence: Sequence<K, V>): Map<K, V>;
export declare function Map<V>(object: {[key: string]: V}): Map<string, V>;
export declare function Map<V>(array: Array<V>): Map<number, V>;
sortBy<S>(
sortValueMapper: (value?: T, index?: number, seq?: IndexedSequence<T>) => S,
comparator?: (valueA: S, valueB: S) => number,
maintainIndices?: boolean
): IndexedSequence<T>;
export interface Map<K, V> extends Sequence<K, V> {
/**
* Returns an IndexedSequence
* @override
*/
map<M>(
mapper: (value?: T, index?: number, seq?: IndexedSequence<T>) => M,
thisArg?: any
): IndexedSequence<M>;
/**
* Returns a new Map also containing the new key, value pair. If an equivalent
* key already exists in this Map, it will be replaced.
*/
set(key: K, value: V): Map<K, V>;
/**
* Returns an IndexedSequence
* @override
*/
cacheResult(): IndexedSequence<T>;
}
/**
* Returns a new Map which excludes this `key`.
*/
delete(key: K): Map<K, V>;
/**
* Returns a new Map containing no keys or values.
*/
clear(): Map<K, V>;
/**
* When this cursor's (or any of its sub-cursors') `update` method is called,
* the resulting new data structure will be provided to the `onChange`
* function. Use this callback to keep track of the most current value or
* update the rest of your application.
*/
cursor(
onChange?: (newValue: Map<K, V>, oldValue?: Map<K, V>) => void
): Cursor<Map<K, V>>;
cursor(
keyPath: Array<any>,
onChange?: (newValue: Map<K, V>, oldValue?: Map<K, V>) => void
): Cursor<any>;
cursor(
key: K,
onChange?: (newValue: Map<K, V>, oldValue?: Map<K, V>) => void
): Cursor<V>;
/**
* Returns a new Map having updated the value at this `key` with the return
* value of calling `updater` with the existing value, or undefined if the
* key was not already set.
* Range
* -----
*
* Equivalent to: `map.set(key, updater(map.get(key)))`.
*/
update(key: K, updater: (value: V) => V): Map<K, V>;
/**
* Returns a new Map having applied the `updater` to the entry found at the
* keyPath. If any keys in `keyPath` do not exist, a new immutable Map will be
* created at that key.
* Returns a lazy indexed sequence of numbers from `start` (inclusive) to `end`
* (exclusive), by `step`, where `start` defaults to 0, `step` to 1, and `end` to
* infinity. When `start` is equal to `end`, returns empty range.
*
* var data = Immutable.fromJS({ a: { b: { c: 10 } } });
* data.updateIn(['a', 'b'], map => map.set('d', 20));
* // { a: { b: { c: 10, d: 20 } } }
* Range() // [0,1,2,3,...]
* Range(10) // [10,11,12,13,...]
* Range(10,15) // [10,11,12,13,14]
* Range(10,30,5) // [10,15,20,25]
* Range(30,10,5) // [30,25,20,15]
* Range(30,30,5) // []
*
*/
updateIn(
keyPath: Array<any>,
updater: (value: any) => any
): Map<K, V>;
export function Range(start?: number, end?: number, step?: number): IndexedSequence<number>;
/**
* Returns a new Map resulting from merging the provided Sequences
* (or JS objects) into this Map. In other words, this takes each entry of
* each sequence and sets it on this Map.
*
* var x = Immutable.Map({a: 10, b: 20, c: 30});
* var y = Immutable.Map({b: 40, a: 50, d: 60});
* x.merge(y) // { a: 50, b: 40, c: 30, d: 60 }
* y.merge(x) // { b: 20, a: 10, d: 60, c: 30 }
*
*/
merge(...sequences: Sequence<K, V>[]): Map<K, V>;
merge(...sequences: {[key: string]: V}[]): Map<string, V>;
/**
* Like `merge()`, `mergeWith()` returns a new Map resulting from merging the
* provided Sequences (or JS objects) into this Map, but uses the `merger`
* function for dealing with conflicts.
* Repeat
* ------
*
* var x = Immutable.Map({a: 10, b: 20, c: 30});
* var y = Immutable.Map({b: 40, a: 50, d: 60});
* x.mergeWith((prev, next) => prev / next, y) // { a: 0.2, b: 0.5, c: 30, d: 60 }
* y.mergeWith((prev, next) => prev / next, x) // { b: 2, a: 5, d: 60, c: 30 }
* Returns a lazy sequence of `value` repeated `times` times. When `times` is
* not defined, returns an infinite sequence of `value`.
*
*/
mergeWith(
merger: (previous?: V, next?: V) => V,
...sequences: Sequence<K, V>[]
): Map<K, V>;
mergeWith(
merger: (previous?: V, next?: V) => V,
...sequences: {[key: string]: V}[]
): Map<string, V>;
/**
* Like `merge()`, but when two Sequences conflict, it merges them as well,
* recursing deeply through the nested data.
* Repeat('foo') // ['foo','foo','foo',...]
* Repeat('bar',4) // ['bar','bar','bar','bar']
*
* var x = Immutable.fromJS({a: { x: 10, y: 10 }, b: { x: 20, y: 50 } });
* var y = Immutable.fromJS({a: { x: 2 }, b: { y: 5 }, c: { z: 3 } });
* x.deepMerge(y) // {a: { x: 2, y: 10 }, b: { x: 20, y: 5 }, c: { z: 3 } }
*
*/
deepMerge(...sequences: Sequence<K, V>[]): Map<K, V>;
deepMerge(...sequences: {[key: string]: V}[]): Map<string, V>;
export function Repeat<T>(value: T, times?: number): IndexedSequence<T>;
/**
* Like `deepMerge()`, but when two non-Sequences conflict, it uses the
* `merger` function to determine the resulting value.
*
* var x = Immutable.fromJS({a: { x: 10, y: 10 }, b: { x: 20, y: 50 } });
* var y = Immutable.fromJS({a: { x: 2 }, b: { y: 5 }, c: { z: 3 } });
* x.deepMergeWith((prev, next) => prev / next, y)
* // {a: { x: 5, y: 10 }, b: { x: 20, y: 10 }, c: { z: 3 } }
*
*/
deepMergeWith(
merger: (previous?: V, next?: V) => V,
...sequences: Sequence<K, V>[]
): Map<K, V>;
deepMergeWith(
merger: (previous?: V, next?: V) => V,
...sequences: {[key: string]: V}[]
): Map<string, V>;
/**
* Every time you call one of the above functions, a new immutable Map is
* created. If a pure function calls a number of these to produce a final
* return value, then a penalty on performance and memory has been paid by
* creating all of the intermediate immutable Maps.
* Map
* ---
*
* If you need to apply a series of mutations to produce a new immutable
* Map, `withMutations()` create a temporary mutable copy of the Map which
* can applying mutations in a highly performant manner. In fact, this is
* exactly how complex mutations like `merge` are done.
* A Map is a Sequence of (key, value) pairs with `O(log32 N)` gets and sets.
*
* As an example, this results in the creation of 2, not 4, new Maps:
* Map is a hash map and requires keys that are hashable, either a primitive
* (string or number) or an object with a `hashCode(): number` method.
*
* var map1 = Immutable.Map();
* var map2 = map1.withMutations(map => {
* map.set('a', 1).set('b', 2).set('c', 3);
* });
* assert(map1.length === 0);
* assert(map2.length === 3);
*
* Iteration order of a Map is undefined, however is stable. Multiple iterations
* of the same Map will iterate in the same order.
*/
withMutations(mutator: (mutable: Map<K, V>) => any): Map<K, V>;
export module Map {
/**
* `Map.empty()` creates a new immutable map of length 0.
*/
function empty<K, V>(): Map<K, V>;
/**
* `Map.from()` creates a new immutable Map with the same key value pairs as
* the provided Sequence or JavaScript Object or Array.
*
* var newMap = Map.from({key: "value"});
* var newMap = Map.from([["key", "value"]]);
*
*/
function from<K, V>(sequence: Sequence<K, V>): Map<K, V>;
function from<V>(object: {[key: string]: V}): Map<string, V>;
function from<V>(entries: Array</*(K, V)*/Array<any>>): Map<any, any>;
}
/**
* Another way to avoid creation of intermediate Immutable maps is to create
* a mutable copy of this collection. Mutable copies *always* return `this`,
* and thus shouldn't be used for equality. Your function should never return
* a mutable copy of a collection, only use it internally to create a new
* collection. If possible, use `withMutations` as it provides an easier to
* use API.
*
* Note: if the collection is already mutable, `asMutable` returns itself.
* Alias for `Map.empty()`.
*/
asMutable(): Map<K, V>;
export function Map<K, V>(): Map<K, V>;
/**
* The yin to `asMutable`'s yang. Because it applies to mutable collections,
* this operation is *mutable* and returns itself. Once performed, the mutable
* copy has become immutable and can be safely returned from a function.
* Alias for `Map.from()`.
*/
asImmutable(): Map<K, V>;
}
export function Map<K, V>(sequence: Sequence<K, V>): Map<K, V>;
export function Map<V>(object: {[key: string]: V}): Map<string, V>;
export function Map<V>(entries: Array</*(K, V)*/Array<any>>): Map<any, any>;
/**
* Ordered Map
* -----------
*
* OrderedMap constructors return a Map which has the additional guarantee of
* the iteration order of entries to match the order in which they were set().
* This makes OrderedMap behave similarly to native JS objects.
*/
export interface Map<K, V> extends Sequence<K, V> {
export declare module OrderedMap {
/**
* Returns a new Map also containing the new key, value pair. If an equivalent
* key already exists in this Map, it will be replaced.
*/
set(key: K, value: V): Map<K, V>;
/**
* `OrderedMap.empty()` creates a new immutable ordered Map of length 0.
*/
function empty<K, V>(): Map<K, V>;
/**
* Returns a new Map which excludes this `key`.
*/
delete(key: K): Map<K, V>;
/**
* `OrderedMap.from()` creates a new immutable ordered Map with the same key
* value pairs as the provided Sequence or JavaScript Object or Array.
*
* var newMap = OrderedMap.from({key: "value"});
*
*/
function from<K, V>(sequence: Sequence<K, V>): Map<K, V>;
function from<V>(object: {[key: string]: V}): Map<string, V>;
function from<V>(array: Array<V>): Map<number, V>;
}
/**
* Returns a new Map containing no keys or values.
*/
clear(): Map<K, V>;
/**
* Alias for `OrderedMap.empty()`.
*/
export declare function OrderedMap<K, V>(): Map<K, V>;
/**
* When this cursor's (or any of its sub-cursors') `update` method is called,
* the resulting new data structure will be provided to the `onChange`
* function. Use this callback to keep track of the most current value or
* update the rest of your application.
*/
cursor(
onChange?: (newValue: Map<K, V>, oldValue?: Map<K, V>, keyPath?: Array<any>) => void
): Cursor<Map<K, V>>;
cursor(
keyPath: Array<any>,
onChange?: (newValue: Map<K, V>, oldValue?: Map<K, V>, keyPath?: Array<any>) => void
): Cursor<any>;
cursor(
key: K,
onChange?: (newValue: Map<K, V>, oldValue?: Map<K, V>, keyPath?: Array<any>) => void
): Cursor<V>;
/**
* Alias for `OrderedMap.from()`.
*/
export declare function OrderedMap<K, V>(sequence: Sequence<K, V>): Map<K, V>;
export declare function OrderedMap<V>(object: {[key: string]: V}): Map<string, V>;
export declare function OrderedMap<V>(array: Array<V>): Map<number, V>;
/**
* Returns a new Map having updated the value at this `key` with the return
* value of calling `updater` with the existing value, or undefined if the
* key was not already set.
*
* Equivalent to: `map.set(key, updater(map.get(key)))`.
*/
update(key: K, updater: (value: V) => V): Map<K, V>;
/**
* Returns a new Map having applied the `updater` to the entry found at the
* keyPath. If any keys in `keyPath` do not exist, a new immutable Map will be
* created at that key.
*
* var data = Immutable.fromJS({ a: { b: { c: 10 } } });
* data.updateIn(['a', 'b'], map => map.set('d', 20));
* // { a: { b: { c: 10, d: 20 } } }
*
*/
updateIn(
keyPath: Array<any>,
updater: (value: any) => any
): Map<K, V>;
/**
* Record
* ------
*
* Creates a new Class which produces maps with a specific set of allowed string
* keys and have default values.
*
* var ABRecord = Record({a:1, b:2})
* var myRecord = new ABRecord({b:3})
*
* Records always have a value for the keys they define. `delete()`ing a key
* from a record simply resets it to the default value for that key.
*
* myRecord.length // 2
* myRecordWithoutB = myRecord.delete('b')
* myRecordWithoutB.get('b') // 2
* myRecordWithoutB.length // 2
*
* Because Records have a known set of string keys, property get access works as
* expected, however property sets will throw an Error.
*
* myRecord.b // 3
* myRecord.b = 5 // throws Error
*
* Record Classes can be extended as well, allowing for custom methods on your
* Record. This isn't how things are done in functional environments, but is a
* common pattern in many JS programs.
*
* class ABRecord extends Record({a:1,b:2}) {
* getAB() {
* return this.a + this.b;
* }
* }
*
* var myRecord = new ABRecord(b:3)
* myRecord.getAB() // 4
*
*/
export declare function Record(defaultValues: Sequence<string, any>, name?: string): RecordClass;
export declare function Record(defaultValues: {[key: string]: any}, name?: string): RecordClass;
/**
* Returns a new Map resulting from merging the provided Sequences
* (or JS objects) into this Map. In other words, this takes each entry of
* each sequence and sets it on this Map.
*
* var x = Immutable.Map({a: 10, b: 20, c: 30});
* var y = Immutable.Map({b: 40, a: 50, d: 60});
* x.merge(y) // { a: 50, b: 40, c: 30, d: 60 }
* y.merge(x) // { b: 20, a: 10, d: 60, c: 30 }
*
*/
merge(...sequences: Sequence<K, V>[]): Map<K, V>;
merge(...sequences: {[key: string]: V}[]): Map<string, V>;
export interface RecordClass {
new (): Map<string, any>;
new (values: Sequence<string, any>): Map<string, any>;
new (values: {[key: string]: any}): Map<string, any>;
}
/**
* Like `merge()`, `mergeWith()` returns a new Map resulting from merging the
* provided Sequences (or JS objects) into this Map, but uses the `merger`
* function for dealing with conflicts.
*
* var x = Immutable.Map({a: 10, b: 20, c: 30});
* var y = Immutable.Map({b: 40, a: 50, d: 60});
* x.mergeWith((prev, next) => prev / next, y) // { a: 0.2, b: 0.5, c: 30, d: 60 }
* y.mergeWith((prev, next) => prev / next, x) // { b: 2, a: 5, d: 60, c: 30 }
*
*/
mergeWith(
merger: (previous?: V, next?: V) => V,
...sequences: Sequence<K, V>[]
): Map<K, V>;
mergeWith(
merger: (previous?: V, next?: V) => V,
...sequences: {[key: string]: V}[]
): Map<string, V>;
/**
* Like `merge()`, but when two Sequences conflict, it merges them as well,
* recursing deeply through the nested data.
*
* var x = Immutable.fromJS({a: { x: 10, y: 10 }, b: { x: 20, y: 50 } });
* var y = Immutable.fromJS({a: { x: 2 }, b: { y: 5 }, c: { z: 3 } });
* x.deepMerge(y) // {a: { x: 2, y: 10 }, b: { x: 20, y: 5 }, c: { z: 3 } }
*
*/
deepMerge(...sequences: Sequence<K, V>[]): Map<K, V>;
deepMerge(...sequences: {[key: string]: V}[]): Map<string, V>;
/**
* Set
* ---
*
* A Set is a Sequence of unique values with `O(log32 N)` gets and sets.
*
* Sets, like Maps, require that their values are hashable, either a primitive
* (string or number) or an object with a `hashCode(): number` method.
*
* When iterating a Set, the entries will be (value, value) pairs. Iteration
* order of a Set is undefined, however is stable. Multiple iterations of the
* same Set will iterate in the same order.
*/
/**
* Like `deepMerge()`, but when two non-Sequences conflict, it uses the
* `merger` function to determine the resulting value.
*
* var x = Immutable.fromJS({a: { x: 10, y: 10 }, b: { x: 20, y: 50 } });
* var y = Immutable.fromJS({a: { x: 2 }, b: { y: 5 }, c: { z: 3 } });
* x.deepMergeWith((prev, next) => prev / next, y)
* // {a: { x: 5, y: 10 }, b: { x: 20, y: 10 }, c: { z: 3 } }
*
*/
deepMergeWith(
merger: (previous?: V, next?: V) => V,
...sequences: Sequence<K, V>[]
): Map<K, V>;
deepMergeWith(
merger: (previous?: V, next?: V) => V,
...sequences: {[key: string]: V}[]
): Map<string, V>;
export declare module Set {
/**
* Every time you call one of the above functions, a new immutable Map is
* created. If a pure function calls a number of these to produce a final
* return value, then a penalty on performance and memory has been paid by
* creating all of the intermediate immutable Maps.
*
* If you need to apply a series of mutations to produce a new immutable
* Map, `withMutations()` create a temporary mutable copy of the Map which
* can applying mutations in a highly performant manner. In fact, this is
* exactly how complex mutations like `merge` are done.
*
* As an example, this results in the creation of 2, not 4, new Maps:
*
* var map1 = Immutable.Map();
* var map2 = map1.withMutations(map => {
* map.set('a', 1).set('b', 2).set('c', 3);
* });
* assert(map1.length === 0);
* assert(map2.length === 3);
*
*/
withMutations(mutator: (mutable: Map<K, V>) => any): Map<K, V>;
/**
* `Set.empty()` creates a new immutable set of length 0.
*/
function empty<T>(): Set<T>;
/**
* Another way to avoid creation of intermediate Immutable maps is to create
* a mutable copy of this collection. Mutable copies *always* return `this`,
* and thus shouldn't be used for equality. Your function should never return
* a mutable copy of a collection, only use it internally to create a new
* collection. If possible, use `withMutations` as it provides an easier to
* use API.
*
* Note: if the collection is already mutable, `asMutable` returns itself.
*/
asMutable(): Map<K, V>;
/**
* `Set.from()` creates a new immutable Set containing the values from this
* Sequence or JavaScript Array.
*/
function from<T>(sequence: Sequence<any, T>): Set<T>;
function from<T>(array: Array<T>): Set<T>;
/**
* The yin to `asMutable`'s yang. Because it applies to mutable collections,
* this operation is *mutable* and returns itself. Once performed, the mutable
* copy has become immutable and can be safely returned from a function.
*/
asImmutable(): Map<K, V>;
}
/**
* `Set.fromKeys()` creates a new immutable Set containing the keys from
* this Sequence or JavaScript Object.
* Ordered Map
* -----------
*
* OrderedMap constructors return a Map which has the additional guarantee of
* the iteration order of entries to match the order in which they were set().
* This makes OrderedMap behave similarly to native JS objects.
*/
function fromKeys<T>(sequence: Sequence<T, any>): Set<T>;
function fromKeys(object: {[key: string]: any}): Set<string>;
}
/**
* Alias for `Set.empty()`
*/
export declare function Set<T>(): Set<T>;
export module OrderedMap {
/**
* Like `Set.from()`, but accepts variable arguments instead of an Array.
*/
export declare function Set<T>(...values: T[]): Set<T>;
/**
* `OrderedMap.empty()` creates a new immutable ordered Map of length 0.
*/
function empty<K, V>(): Map<K, V>;
/**
* `OrderedMap.from()` creates a new immutable ordered Map with the same key
* value pairs as the provided Sequence or JavaScript Object or Array.
*
* var newMap = OrderedMap.from({key: "value"});
*
*/
function from<K, V>(sequence: Sequence<K, V>): Map<K, V>;
function from<V>(object: {[key: string]: V}): Map<string, V>;
function from<V>(array: Array<V>): Map<number, V>;
}
export interface Set<T> extends Sequence<T, T> {
/**
* Returns a new Set which also includes this value.
* Alias for `OrderedMap.empty()`.
*/
add(value: T): Set<T>;
export function OrderedMap<K, V>(): Map<K, V>;
/**
* Returns a new Set which excludes this value.
* Alias for `OrderedMap.from()`.
*/
delete(value: T): Set<T>;
export function OrderedMap<K, V>(sequence: Sequence<K, V>): Map<K, V>;
export function OrderedMap<V>(object: {[key: string]: V}): Map<string, V>;
export function OrderedMap<V>(array: Array<V>): Map<number, V>;
/**
* Returns a new Set containing no values.
*/
clear(): Set<T>;
/**
* Returns a Set including any value from `sequences` that does not already
* exist in this Set.
* Record
* ------
*
* Creates a new Class which produces maps with a specific set of allowed string
* keys and have default values.
*
* var ABRecord = Record({a:1, b:2})
* var myRecord = new ABRecord({b:3})
*
* Records always have a value for the keys they define. `delete()`ing a key
* from a record simply resets it to the default value for that key.
*
* myRecord.length // 2
* myRecordWithoutB = myRecord.delete('b')
* myRecordWithoutB.get('b') // 2
* myRecordWithoutB.length // 2
*
* Because Records have a known set of string keys, property get access works as
* expected, however property sets will throw an Error.
*
* myRecord.b // 3
* myRecord.b = 5 // throws Error
*
* Record Classes can be extended as well, allowing for custom methods on your
* Record. This isn't how things are done in functional environments, but is a
* common pattern in many JS programs.
*
* class ABRecord extends Record({a:1,b:2}) {
* getAB() {
* return this.a + this.b;
* }
* }
*
* var myRecord = new ABRecord(b:3)
* myRecord.getAB() // 4
*
*/
union(...sequences: Sequence<any, T>[]): Set<T>;
union(...sequences: Array<T>[]): Set<T>;
export function Record(defaultValues: Sequence<string, any>, name?: string): RecordClass;
export function Record(defaultValues: {[key: string]: any}, name?: string): RecordClass;
/**
* Returns a Set which has removed any values not also contained
* within `sequences`.
*/
intersect(...sequences: Sequence<any, T>[]): Set<T>;
intersect(...sequences: Array<T>[]): Set<T>;
export interface RecordClass {
new (): Map<string, any>;
new (values: Sequence<string, any>): Map<string, any>;
new (values: {[key: string]: any}): Map<string, any>;
}
/**
* Returns a Set excluding any values contained within `sequences`.
*/
subtract(...sequences: Sequence<any, T>[]): Set<T>;
subtract(...sequences: Array<T>[]): Set<T>;
/**
* True if `sequence` contains every value in this Set.
* Set
* ---
*
* A Set is a Sequence of unique values with `O(log32 N)` gets and sets.
*
* Sets, like Maps, require that their values are hashable, either a primitive
* (string or number) or an object with a `hashCode(): number` method.
*
* When iterating a Set, the entries will be (value, value) pairs. Iteration
* order of a Set is undefined, however is stable. Multiple iterations of the
* same Set will iterate in the same order.
*/
isSubset(sequence: Sequence<any, T>): boolean;
isSubset(sequence: Array<T>): boolean;
/**
* True if this Set contains every value in `sequence`.
*/
isSuperset(sequence: Sequence<any, T>): boolean;
isSuperset(sequence: Array<T>): boolean;
export module Set {
/**
* @see `Map.prototype.withMutations`
*/
withMutations(mutator: (mutable: Set<T>) => any): Set<T>;
/**
* `Set.empty()` creates a new immutable set of length 0.
*/
function empty<T>(): Set<T>;
/**
* `Set.from()` creates a new immutable Set containing the values from this
* Sequence or JavaScript Array.
*/
function from<T>(sequence: Sequence<any, T>): Set<T>;
function from<T>(array: Array<T>): Set<T>;
/**
* `Set.fromKeys()` creates a new immutable Set containing the keys from
* this Sequence or JavaScript Object.
*/
function fromKeys<T>(sequence: Sequence<T, any>): Set<T>;
function fromKeys(object: {[key: string]: any}): Set<string>;
}
/**
* @see `Map.prototype.asMutable`
* Alias for `Set.empty()`
*/
asMutable(): Set<T>;
export function Set<T>(): Set<T>;
/**
* @see `Map.prototype.asImmutable`
* Like `Set.from()`, but accepts variable arguments instead of an Array.
*/
asImmutable(): Set<T>;
}
export function Set<T>(...values: T[]): Set<T>;
/**
* Vector
* ------
*
* Vectors are like a Map with numeric keys which always iterate in the order
* of their keys. They may be sparse: if an index has not been set, it will not
* be iterated over. Also, via `setBounds` (or `fromArray` with a sparse array),
* a Vector may have a length higher than the highest index.
*
* @see: [MDN: Array relationship between length and numeric properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#Relationship_between_length_and_numerical_properties_2).
*/
export interface Set<T> extends Sequence<T, T> {
export declare module Vector {
/**
* Returns a new Set which also includes this value.
*/
add(value: T): Set<T>;
/**
* `Vector.empty()` returns a Vector of length 0.
*/
function empty<T>(): Vector<T>;
/**
* Returns a new Set which excludes this value.
*/
delete(value: T): Set<T>;
/**
* `Vector.from()` returns a Vector of the same length of the provided
* `values` JavaScript Array or Sequence, containing the values at the
* same indices.
*
* If a non-indexed Sequence is provided, its keys will be discarded and
* its values will be used to fill the returned Vector.
*/
function from<T>(array: Array<T>): Vector<T>;
function from<T>(sequence: Sequence<any, T>): Vector<T>;
}
/**
* Returns a new Set containing no values.
*/
clear(): Set<T>;
/**
* Alias for `Vector.empty()`
*/
export declare function Vector<T>(): Vector<T>;
/**
* Returns a Set including any value from `sequences` that does not already
* exist in this Set.
*/
union(...sequences: Sequence<any, T>[]): Set<T>;
union(...sequences: Array<T>[]): Set<T>;
/**
* Like `Vector.from()`, but accepts variable arguments instead of an Array.
*/
export declare function Vector<T>(...values: T[]): Vector<T>;
/**
* Returns a Set which has removed any values not also contained
* within `sequences`.
*/
intersect(...sequences: Sequence<any, T>[]): Set<T>;
intersect(...sequences: Array<T>[]): Set<T>;
/**
* Returns a Set excluding any values contained within `sequences`.
*/
subtract(...sequences: Sequence<any, T>[]): Set<T>;
subtract(...sequences: Array<T>[]): Set<T>;
export interface Vector<T> extends IndexedSequence<T> {
/**
* True if `sequence` contains every value in this Set.
*/
isSubset(sequence: Sequence<any, T>): boolean;
isSubset(sequence: Array<T>): boolean;
/**
* Returns a new Vector which includes `value` at `index`. If `index` already
* exists in this Vector, it will be replaced.
*/
set(index: number, value: T): Vector<T>;
/**
* True if this Set contains every value in `sequence`.
*/
isSuperset(sequence: Sequence<any, T>): boolean;
isSuperset(sequence: Array<T>): boolean;
/**
* Returns a new Vector which excludes this `index`. It will not affect the
* length of the Vector, instead leaving a sparse hole.
*/
delete(index: number): Vector<T>;
/**
* @see `Map.prototype.withMutations`
*/
withMutations(mutator: (mutable: Set<T>) => any): Set<T>;
/**
* Returns a new Vector with 0 length and no values.
*/
clear(): Vector<T>;
/**
* @see `Map.prototype.asMutable`
*/
asMutable(): Set<T>;
/**
* Returns a new Vector with the provided `values` appended, starting at this
* Vector's `length`.
*/
push(...values: T[]): Vector<T>;
/**
* @see `Map.prototype.asImmutable`
*/
asImmutable(): Set<T>;
}
/**
* Returns a new Vector with a length ones less than this Vector, excluding
* the last index in this Vector.
* Vector
* ------
*
* Note: this differs from `Array.prototype.pop` because it returns a new
* Vector rather than the removed value. Use `last()` to get the last value
* in this Vector.
* Vectors are like a Map with numeric keys which always iterate in the order
* of their keys. They may be sparse: if an index has not been set, it will not
* be iterated over. Also, via `setBounds` (or `fromArray` with a sparse array),
* a Vector may have a length higher than the highest index.
*
* @see: [MDN: Array relationship between length and numeric properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#Relationship_between_length_and_numerical_properties_2).
*/
pop(): Vector<T>;
/**
* Returns a new Vector with the provided `values` prepended, pushing other
* values ahead to higher indices.
*/
unshift(...values: T[]): Vector<T>;
export module Vector {
/**
* `Vector.empty()` returns a Vector of length 0.
*/
function empty<T>(): Vector<T>;
/**
* `Vector.from()` returns a Vector of the same length of the provided
* `values` JavaScript Array or Sequence, containing the values at the
* same indices.
*
* If a non-indexed Sequence is provided, its keys will be discarded and
* its values will be used to fill the returned Vector.
*/
function from<T>(array: Array<T>): Vector<T>;
function from<T>(sequence: Sequence<any, T>): Vector<T>;
}
/**
* Returns a new Vector with a length ones less than this Vector, excluding
* the first index in this Vector, shifting all other values to a lower index.
*
* Note: this differs from `Array.prototype.shift` because it returns a new
* Vector rather than the removed value. Use `first()` to get the last value
* in this Vector.
* Alias for `Vector.empty()`
*/
shift(): Vector<T>;
export function Vector<T>(): Vector<T>;
/**
* @see Map.cursor
* Like `Vector.from()`, but accepts variable arguments instead of an Array.
*/
cursor(
onChange?: (newValue: Vector<T>, oldValue?: Vector<T>) => void
): Cursor<Vector<T>>;
cursor(
keyPath: Array<any>,
onChange?: (newValue: Vector<T>, oldValue?: Vector<T>) => void
): Cursor<any>;
export function Vector<T>(...values: T[]): Vector<T>;
/**
* Returns a new Vector with an updated value at `index` with the return value
* of calling `updater` with the existing value, or undefined if `index` was
* not set.
*
* @see Map.update
*/
update(index: number, updater: (value: T) => T): Vector<T>;
export interface Vector<T> extends IndexedSequence<T> {
/**
* @see `Map.prototype.updateIn`
*/
updateIn(
keyPath: Array<any>,
updater: (value: any) => any
): Vector<T>;
/**
* Returns a new Vector which includes `value` at `index`. If `index` already
* exists in this Vector, it will be replaced.
*/
set(index: number, value: T): Vector<T>;
/**
* @see `Map.prototype.merge`
*/
merge(...sequences: IndexedSequence<T>[]): Vector<T>;
merge(...sequences: Array<T>[]): Vector<T>;
/**
* Returns a new Vector which excludes this `index`. It will not affect the
* length of the Vector, instead leaving a sparse hole.
*/
delete(index: number): Vector<T>;
/**
* @see `Map.prototype.mergeWith`
*/
mergeWith(
merger: (previous?: T, next?: T) => T,
...sequences: IndexedSequence<T>[]
): Vector<T>;
mergeWith(
merger: (previous?: T, next?: T) => T,
...sequences: Array<T>[]
): Vector<T>;
/**
* Returns a new Vector with 0 length and no values.
*/
clear(): Vector<T>;
/**
* @see `Map.prototype.deepMerge`
*/
deepMerge(...sequences: IndexedSequence<T>[]): Vector<T>;
deepMerge(...sequences: Array<T>[]): Vector<T>;
/**
* Returns a new Vector with the provided `values` appended, starting at this
* Vector's `length`.
*/
push(...values: T[]): Vector<T>;
/**
* @see `Map.prototype.deepMergeWith`
*/
deepMergeWith(
merger: (previous?: T, next?: T) => T,
...sequences: IndexedSequence<T>[]
): Vector<T>;
deepMergeWith(
merger: (previous?: T, next?: T) => T,
...sequences: Array<T>[]
): Vector<T>;
/**
* Returns a new Vector with a length ones less than this Vector, excluding
* the last index in this Vector.
*
* Note: this differs from `Array.prototype.pop` because it returns a new
* Vector rather than the removed value. Use `last()` to get the last value
* in this Vector.
*/
pop(): Vector<T>;
/**
* Returns a new Vector with length `length`. If `length` is less than this
* Vector's length, the new Vector will exclude values at the higher indices.
* If `length` is greater than this Vector's length, the new Vector will have
* unset sparse holes for the newly available indices.
*/
setLength(length: number): Vector<T>;
/**
* Returns a new Vector with the provided `values` prepended, pushing other
* values ahead to higher indices.
*/
unshift(...values: T[]): Vector<T>;
/**
* @see `Map.prototype.withMutations`
*/
withMutations(mutator: (mutable: Vector<T>) => any): Vector<T>;
/**
* Returns a new Vector with a length ones less than this Vector, excluding
* the first index in this Vector, shifting all other values to a lower index.
*
* Note: this differs from `Array.prototype.shift` because it returns a new
* Vector rather than the removed value. Use `first()` to get the last value
* in this Vector.
*/
shift(): Vector<T>;
/**
* @see `Map.prototype.asMutable`
*/
asMutable(): Vector<T>;
/**
* @see Map.cursor
*/
cursor(
onChange?: (newValue: Vector<T>, oldValue?: Vector<T>, keyPath?: Array<any>) => void
): Cursor<Vector<T>>;
cursor(
keyPath: Array<any>,
onChange?: (newValue: Vector<T>, oldValue?: Vector<T>, keyPath?: Array<any>) => void
): Cursor<any>;
cursor(
key: number,
onChange?: (newValue: Vector<T>, oldValue?: Vector<T>, keyPath?: Array<any>) => void
): Cursor<T>;
/**
* @see `Map.prototype.asImmutable`
*/
asImmutable(): Vector<T>;
/**
* Returns a new Vector with an updated value at `index` with the return value
* of calling `updater` with the existing value, or undefined if `index` was
* not set.
*
* @see Map.update
*/
update(index: number, updater: (value: T) => T): Vector<T>;
/**
* @see `Map.prototype.updateIn`
*/
updateIn(
keyPath: Array<any>,
updater: (value: any) => any
): Vector<T>;
/**
* @see `Map.prototype.merge`
*/
merge(...sequences: IndexedSequence<T>[]): Vector<T>;
merge(...sequences: Array<T>[]): Vector<T>;
/**
* @see `Map.prototype.mergeWith`
*/
mergeWith(
merger: (previous?: T, next?: T) => T,
...sequences: IndexedSequence<T>[]
): Vector<T>;
mergeWith(
merger: (previous?: T, next?: T) => T,
...sequences: Array<T>[]
): Vector<T>;
/**
* @see `Map.prototype.deepMerge`
*/
deepMerge(...sequences: IndexedSequence<T>[]): Vector<T>;
deepMerge(...sequences: Array<T>[]): Vector<T>;
/**
* @see `Map.prototype.deepMergeWith`
*/
deepMergeWith(
merger: (previous?: T, next?: T) => T,
...sequences: IndexedSequence<T>[]
): Vector<T>;
deepMergeWith(
merger: (previous?: T, next?: T) => T,
...sequences: Array<T>[]
): Vector<T>;
/**
* Returns a new Vector with length `length`. If `length` is less than this
* Vector's length, the new Vector will exclude values at the higher indices.
* If `length` is greater than this Vector's length, the new Vector will have
* unset sparse holes for the newly available indices.
*/
setLength(length: number): Vector<T>;
/**
* @see `Map.prototype.withMutations`
*/
withMutations(mutator: (mutable: Vector<T>) => any): Vector<T>;
/**
* @see `Map.prototype.asMutable`
*/
asMutable(): Vector<T>;
/**
* @see `Map.prototype.asImmutable`
*/
asImmutable(): Vector<T>;
/**
* Allows `Vector` to be used in ES6 for-of expressions, returning an object
* that adheres to the `Iterator` interface: it has a `next()` method which
* returns the next (index, value) tuple.
*
* When no entries remain, returns `{ done: true }`
*/
iterator(): { next(): { value: /*(number, T)*/Array<any>; done: boolean; } }
}
/**
* Allows `Vector` to be used in ES7 for expressions, returns an `Iterator`
* which has a `next()` method which returns the next (index, value) tuple.
* Cursors
* -------
*
* When no entries remain, throws StopIteration in ES7 otherwise returns null.
* Cursors allow you to hold a reference to a path in a nested immutable data
* structure, allowing you to pass smaller sections of a larger nested
* collection to portions of your application while maintaining a central point
* aware of changes to the entire data structure.
*
* This is particularly useful when used in conjuction with component-based UI
* libraries like [React](http://facebook.github.io/react/) or to simulate
* "state" throughout an application while maintaining a single flow of logic.
*
* Cursors provide a simple API for getting the value at that path
* (the equivalent of `this.getIn(keyPath)`), updating the value at that path
* (the equivalent of `this.updateIn(keyPath)`), and getting a sub-cursor
* starting from that path.
*
* When updated, a new root collection is created and provided to the `onChange`
* function provided to the first call to `map.cursor(...)`.
*
* @see Map.cursor
*/
__iterator__(): {next(): /*(number, T)*/Array<any>}
}
export interface Cursor<T> {
/**
* Cursors
* -------
*
* Cursors allow you to hold a reference to a path in a nested immutable data
* structure, allowing you to pass smaller sections of a larger nested
* collection to portions of your application while maintaining a central point
* aware of changes to the entire data structure.
*
* This is particularly useful when used in conjuction with component-based UI
* libraries like [React](http://facebook.github.io/react/) or to simulate
* "state" throughout an application while maintaining a single flow of logic.
*
* Cursors provide a simple API for getting the value at that path
* (the equivalent of `this.getIn(keyPath)`), updating the value at that path
* (the equivalent of `this.updateIn(keyPath)`), and getting a sub-cursor
* starting from that path.
*
* When updated, a new root collection is created and provided to the `onChange`
* function provided to the first call to `map.cursor(...)`.
*
* @see Map.cursor
*/
/**
* Returns the value at the cursor, if the cursor path does not yet exist,
* an empty map (matching the behavior of update).
*/
get(): T;
export interface Cursor<T> {
/**
* Returns the value at the `key` in the cursor, or `notFoundValue` if it
* does not exist.
*
* This is shorthand for `cursor.get().get(key)`
*/
get(key: any, notFoundValue?: any): any;
/**
* Returns the value at the cursor, if the cursor path does not yet exist,
* an empty map (matching the behavior of update).
*/
get(): T;
/**
* Updates the value in the data this cursor points to, triggering the callback
* for the root cursor and returning a new cursor pointing to the new data.
*/
update(updater: (value: T) => T): Cursor<T>;
/**
* Updates the value in the data this cursor points to, triggering the callback
* for the root cursor and returning a new cursor pointing to the new data.
*/
update(updater: (value: T) => T): Cursor<T>;
/**
* Updates the value at `key` in the cursor, returning a new cursor pointing
* to the new data.
*
* This is shorthand for `cursor.update(x => x.update(key, fn))`
*/
update(key: any, updater: (value: any) => any): Cursor<T>;
/**
* Returns a sub-cursor following the key-path starting from this cursor.
*/
cursor(subKeyPath: Array<any>): Cursor<any>;
cursor(subKey: any): Cursor<any>;
/**
* Sets `value` at `key` in the cursor, returning a new cursor to the same
* point in the new data.
*
* This is shorthand for `cursor.update(x => x.set(key, value))`
*/
set(key: any, value: any): Cursor<T>;
/**
* Deletes `key` from the cursor, returning a new cursor to the same
* point in the new data.
*
* This is shorthand for `cursor.update(x => x.delete(key))`
*/
delete(key: any): Cursor<T>;
/**
* Returns a sub-cursor following the key-path starting from this cursor.
*/
cursor(subKeyPath: Array<any>): Cursor<any>;
cursor(subKey: any): Cursor<any>;
}
}

@@ -9,20 +9,19 @@ /**

*/
function t(){function t(t,e,r,n){var i;if(n){var s=n.prototype;i=W.create(s)}else i=t.prototype;return W.keys(e).forEach(function(t){i[t]=e[t]}),W.keys(r).forEach(function(e){t[e]=r[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,r,n){return W.getPrototypeOf(e)[r].apply(t,n)}function r(t,r,n){e(t,r,"constructor",n)}function n(){return Object.create(B.prototype)}function i(t){var e=Object.create(R.prototype);return e.__reversedIndices=t?t.__reversedIndices:!1,e}function s(t,e,r,n){var i=t.get?t.get(e[n],K):K;return i===K?r:++n===e.length?i:s(i,e,r,n)}function u(t,e,r){return(0===t||null!=r&&-r>=t)&&(null==e||null!=r&&e>=r)}function o(t,e){return 0>t?Math.max(0,e+t):e?Math.min(e,t):t}function a(t,e){return null==t?e:0>t?Math.max(0,e+t):e?Math.min(e,t):t}function h(t){return t}function l(t,e){return[e,t]}function c(){return!0}function f(){return this}function _(t){return(t||0)+1}function p(t,e,r,n,i){var s=t.__makeSequence();return s.__iterateUncached=function(s,u,o){var a=0,h=t.__iterate(function(t,i,u){if(e.call(r,t,i,u)){if(s(t,n?i:a,u)===!1)return!1;a++}},u,o);return i?h:a},s}function v(t){return function(){return!t.apply(this,arguments)}}function g(t){return"string"==typeof t?JSON.stringify(t):t}function y(t,e){for(var r="";e;)1&e&&(r+=t),(e>>=1)&&(t+=t);return r}function m(t,e){return t>e?1:e>t?-1:0}function d(t){if(1/0===t)throw Error("Cannot perform this action with an infinite sequence.")}function w(t,e){return t===e?0!==t||0!==e||1/t===1/e:t!==t?e!==e:t instanceof B?t.equals(e):!1}function I(t,e,r,n,i){var s=r>>>e&oe,u=[],o=[];return o[s]=i,null!=n&&(u[s]=n),new T(t,1<<s,u,o)}function k(t){return function(e,r){return e&&e.mergeDeepWith?e.mergeDeepWith(t,r):t?t(e,r):r}}function O(t,e,r){return 0===r.length?t:t.withMutations(function(t){for(var n=0;r.length>n;n++){var i=r[n];i&&(i=i.forEach?i:B(i),i.forEach(e?function(r,n){var i=t.get(n,K);t.set(n,i===K?r:e(i,r))}:function(e,r){t.set(r,e)}))}})}function D(t,e,r,n){var i=e[n],s=t.get?t.get(i,K):K;if(s===K&&(s=N.empty()),!t.set)throw Error("updateIn with invalid keyPath");
return t.set(i,++n===e.length?r(s):D(s,e,r,n))}function b(t){return te.value=t,te}function M(t){if(!t)return 0;if(t===!0)return 1;if("function"==typeof t.hashCode)return t.hashCode();var e=typeof t;if("number"===e)return Math.floor(t)%2147483647;if("string"===e)return S(t);throw Error("Unable to hash")}function S(t){var e=ie[t];if(null==e){e=0;for(var r=0;t.length>r;r++)e=(31*e+t.charCodeAt(r))%ee;ne===re&&(ne=0,ie={}),ne++,ie[t]=e}return e}function x(t,e){var r=Math.max.apply(null,e.map(function(t){return t.length||0}));return r>t.length?t.setLength(r):t}function E(t,e){if(0>t)throw Error("Index out of bounds");return t+e}function C(t){return ue>t?0:t-1>>>se<<se}function q(t,e){if(!t)throw Error(e)}function q(t,e){if(!t)throw Error(e)}function j(t,e){return e?A(e,t,"",{"":t}):U(t)}function A(t,e,r,n){return e&&(Array.isArray(e)||e.constructor===Object)?t.call(n,r,B(e).map(function(r,n){return A(t,r,n,e)})):e}function U(t){if(t){if(Array.isArray(t))return B(t).map(U).toVector();if(t.constructor===Object)return B(t).map(U).toMap()}return t}var W=Object,z={};z.createClass=t,z.superCall=e,z.defaultSuperCall=r;var B=function(t){return P.from(1===arguments.length?t:Array.prototype.slice.call(arguments))},P=B;z.createClass(B,{toString:function(){return this.__toString("Seq {","}")},__toString:function(t,e){return 0===this.length?t+e:t+" "+this.map(this.__toStringMapper).join(", ")+" "+e},__toStringMapper:function(t,e){return e+": "+g(t)},toJS:function(){return this.map(function(t){return t instanceof P?t.toJS():t}).__toJS()},toArray:function(){d(this.length);var t=Array(this.length||0);return this.values().forEach(function(e,r){t[r]=e}),t},toObject:function(){d(this.length);var t={};return this.forEach(function(e,r){t[r]=e}),t},toVector:function(){return d(this.length),ae.from(this)},toMap:function(){return d(this.length),N.from(this)},toOrderedMap:function(){return d(this.length),me.from(this)},toSet:function(){return d(this.length),ve.from(this)},equals:function(t){if(this===t)return!0;if(!(t instanceof P))return!1;if(null!=this.length&&null!=t.length){if(this.length!==t.length)return!1;
if(0===this.length&&0===t.length)return!0}return this.__deepEquals(t)},__deepEquals:function(t){var e=this.cacheResult().entries().toArray(),r=0;return t.every(function(t,n){var i=e[r++];return w(n,i[0])&&w(t,i[1])})},join:function(t){t=t||",";var e="",r=!0;return this.forEach(function(n){r?(r=!1,e+=n):e+=t+n}),e},count:function(t,e){return t?this.filter(t,e).count():(null==this.length&&(this.length=this.forEach(c)),this.length)},countBy:function(t){var e=this;return me.empty().withMutations(function(r){e.forEach(function(e,n,i){r.update(t(e,n,i),_)})})},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];var r=[this].concat(t.map(function(t){return P(t)})),n=this.__makeSequence();return n.length=r.reduce(function(t,e){return null!=t&&null!=e.length?t+e.length:void 0},0),n.__iterateUncached=function(t,e){for(var n,i=0,s=r.length-1,u=0;s>=u&&!n;u++){var o=r[e?s-u:u];i+=o.__iterate(function(e,r,i){return t(e,r,i)===!1?(n=!0,!1):void 0},e)}return i},n},reverse:function(){var t=this,e=t.__makeSequence();return e.length=t.length,e.__iterateUncached=function(e,r){return t.__iterate(e,!r)},e.reverse=function(){return t},e},keys:function(){return this.flip().values()},values:function(){var t=this,e=i(t);return e.length=t.length,e.values=f,e.__iterateUncached=function(e,r,n){if(n&&null==this.length)return this.cacheResult().__iterate(e,r,n);var i,s=0;return n?(s=this.length-1,i=function(t,r,n){return e(t,s--,n)!==!1}):i=function(t,r,n){return e(t,s++,n)!==!1},t.__iterate(i,r),n?this.length:s},e},entries:function(){var t=this;if(t._cache)return P(t._cache);var e=t.map(l).values();return e.fromEntries=function(){return t},e},forEach:function(t,e){return this.__iterate(e?t.bind(e):t)},reduce:function(t,e,r){var n=e;return this.forEach(function(e,i,s){n=t.call(r,n,e,i,s)}),n},reduceRight:function(t,e,r){return this.reverse(!0).reduce(t,e,r)},every:function(t,e){var r=!0;return this.forEach(function(n,i,s){return t.call(e,n,i,s)?void 0:(r=!1,!1)}),r},some:function(t,e){return!this.every(v(t),e)},first:function(){return this.find(c)
},last:function(){return this.findLast(c)},rest:function(){return this.slice(1)},butLast:function(){return this.slice(0,-1)},has:function(t){return this.get(t,K)!==K},get:function(t,e){return this.find(function(e,r){return w(r,t)},null,e)},getIn:function(t,e){return t&&0!==t.length?s(this,t,e,0):this},contains:function(t){return this.find(function(e){return w(e,t)},null,K)!==K},find:function(t,e,r){var n=r;return this.forEach(function(r,i,s){return t.call(e,r,i,s)?(n=r,!1):void 0}),n},findKey:function(t,e){var r;return this.forEach(function(n,i,s){return t.call(e,n,i,s)?(r=i,!1):void 0}),r},findLast:function(t,e,r){return this.reverse(!0).find(t,e,r)},findLastKey:function(t,e){return this.reverse(!0).findKey(t,e)},flip:function(){var t=this,e=n();return e.length=t.length,e.flip=function(){return t},e.__iterateUncached=function(e,r){return t.__iterate(function(t,r,n){return e(r,t,n)!==!1},r)},e},map:function(t,e){var r=this,n=r.__makeSequence();return n.length=r.length,n.__iterateUncached=function(n,i){return r.__iterate(function(r,i,s){return n(t.call(e,r,i,s),i,s)!==!1},i)},n},mapKeys:function(t,e){var r=this,n=r.__makeSequence();return n.length=r.length,n.__iterateUncached=function(n,i){return r.__iterate(function(r,i,s){return n(r,t.call(e,i,r,s),s)!==!1},i)},n},filter:function(t,e){return p(this,t,e,!0,!1)},slice:function(t,e){if(u(t,e,this.length))return this;var r=o(t,this.length),n=a(e,this.length);if(r!==r||n!==n)return this.entries().slice(t,e).fromEntries();var i=0===r?this:this.skip(r);return null==n||n===this.length?i:i.take(n-r)},take:function(t){var e=0,r=this.takeWhile(function(){return e++<t});return r.length=this.length&&Math.min(this.length,t),r},takeLast:function(t,e){return this.reverse(e).take(t).reverse(e)},takeWhile:function(t,e){var r=this,n=r.__makeSequence();return n.__iterateUncached=function(n,i,s){if(i)return this.cacheResult().__iterate(n,i,s);var u=0;return r.__iterate(function(r,i,s){return t.call(e,r,i,s)&&n(r,i,s)!==!1?void u++:!1},i,s),u},n},takeUntil:function(t,e,r){return this.takeWhile(v(t),e,r)
},skip:function(t,e){if(0===t)return this;var r=0,n=this.skipWhile(function(){return r++<t},null,e);return n.length=this.length&&Math.max(0,this.length-t),n},skipLast:function(t,e){return this.reverse(e).skip(t).reverse(e)},skipWhile:function(t,e){var r=this,n=r.__makeSequence();return n.__iterateUncached=function(n,i,s){if(i)return this.cacheResult().__iterate(n,i,s);var u=!0,o=0;return r.__iterate(function(r,i,s){if(!u||!(u=t.call(e,r,i,s))){if(n(r,i,s)===!1)return!1;o++}},i,s),o},n},skipUntil:function(t,e,r){return this.skipWhile(v(t),e,r)},groupBy:function(t){var e=this,r=me.empty().withMutations(function(r){e.forEach(function(e,n,i){var s=t(e,n,i),u=r.get(s,K);u===K&&(u=[],r.set(s,u)),u.push([n,e])})});return r.map(function(t){return P(t).fromEntries()})},sort:function(t,e){return this.sortBy(h,t,e)},sortBy:function(t,e){e=e||m;var r=this;return P(this.entries().entries().toArray().sort(function(n,i){return e(t(n[1][1],n[1][0],r),t(i[1][1],i[1][0],r))||n[0]-i[0]})).fromEntries().values().fromEntries()},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(d(this.length),this._cache=this.entries().toArray(),null==this.length&&(this.length=this._cache.length)),this},__iterate:function(t,e,r){if(!this._cache)return this.__iterateUncached(t,e,r);var n=this.length-1,i=this._cache,s=this;if(e)for(var u=i.length-1;u>=0;u--){var o=i[u];if(t(o[1],r?o[0]:n-o[0],s)===!1)break}else i.every(r?function(e){return t(e[1],n-e[0],s)!==!1}:function(e){return t(e[1],e[0],s)!==!1});return this.length},__makeSequence:function(){return n()}},{from:function(t){if(t instanceof P)return t;if(!Array.isArray(t)){if(t&&t.constructor===Object)return new L(t);t=[t]}return new V(t)}}),B.prototype.toJSON=B.prototype.toJS,B.prototype.inspect=B.prototype.toSource=function(){return""+this},B.prototype.__toJS=B.prototype.toObject;var R=function(){z.defaultSuperCall(this,J.prototype,arguments)},J=R;z.createClass(R,{toString:function(){return this.__toString("Seq [","]")},toArray:function(){d(this.length);var t=Array(this.length||0);
return t.length=this.forEach(function(e,r){t[r]=e}),t},fromEntries:function(){var t=this,e=n();return e.length=t.length,e.entries=function(){return t},e.__iterateUncached=function(e,r,n){return t.__iterate(function(t,r,n){return e(t[1],t[0],n)},r,n)},e},join:function(t){t=t||",";var e="",r=0;return this.forEach(function(n,i){var s=i-r;r=i,e+=(1===s?t:y(t,s))+n}),this.length&&this.length-1>r&&(e+=y(t,this.length-1-r)),e},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];var r=[this].concat(t).map(function(t){return B(t)}),n=this.__makeSequence();return n.length=r.reduce(function(t,e){return null!=t&&null!=e.length?t+e.length:void 0},0),n.__iterateUncached=function(t,e,n){if(n&&!this.length)return this.cacheResult().__iterate(t,e,n);for(var i,s=0,u=n&&this.length-1,o=r.length-1,a=0;o>=a&&!i;a++){var h=r[e?o-a:a];h instanceof J||(h=h.values()),s+=h.__iterate(function(e,r,o){return r+=s,t(e,n?u-r:r,o)===!1?(i=!0,!1):void 0},e)}return s},n},reverse:function(t){var e=this,r=e.__makeSequence();return r.length=e.length,r.__reversedIndices=!!(t^e.__reversedIndices),r.__iterateUncached=function(r,n,i){return e.__iterate(r,!n,i^t)},r.reverse=function(r){return t===r?e:J.prototype.reverse.call(this,r)},r},values:function(){var t=z.superCall(this,J.prototype,"values",[]);return t.length=void 0,t},filter:function(t,e,r){var n=p(this,t,e,r,r);return r&&(n.length=this.length),n},indexOf:function(t){return this.findIndex(function(e){return w(e,t)})},lastIndexOf:function(t){return this.reverse(!0).indexOf(t)},findIndex:function(t,e){var r=this.findKey(t,e);return null==r?-1:r},findLastIndex:function(t,e){return this.reverse(!0).findIndex(t,e)},slice:function(t,e,r){var n=this;if(u(t,e,n.length))return n;var i=n.__makeSequence(),s=o(t,n.length),h=a(e,n.length);return i.length=n.length&&(r?n.length:h-s),i.__reversedIndices=n.__reversedIndices,i.__iterateUncached=function(i,u,l){if(u)return this.cacheResult().__iterate(i,u,l);var c=this.__reversedIndices^l;if(s!==s||h!==h||c&&null==n.length){var f=n.count();s=o(t,f),h=a(e,f)
}var _=c?n.length-h:s,p=c?n.length-s:h,v=n.__iterate(function(t,e,n){return c?null!=p&&e>=p||e>=_&&i(t,r?e:e-_,n)!==!1:_>e||(null==p||p>e)&&i(t,r?e:e-_,n)!==!1},u,l);return null!=this.length?this.length:r?v:Math.max(0,v-_)},i},splice:function(t,e){for(var r=[],n=2;arguments.length>n;n++)r[n-2]=arguments[n];return 0===e&&0===r.length?this:this.slice(0,t).concat(r,this.slice(t+e))},takeWhile:function(t,e,r){var n=this,i=n.__makeSequence();return i.__iterateUncached=function(s,u,o){if(u)return this.cacheResult().__iterate(s,u,o);var a=0,h=!0,l=n.__iterate(function(r,n,i){return t.call(e,r,n,i)&&s(r,n,i)!==!1?void(a=n):(h=!1,!1)},u,o);return r?i.length:h?l:a+1},r&&(i.length=this.length),i},skipWhile:function(t,e,r){var n=this,i=n.__makeSequence();return r&&(i.length=this.length),i.__iterateUncached=function(i,s,u){if(s)return this.cacheResult().__iterate(i,s,u);var o=n.__reversedIndices^u,a=!0,h=0,l=n.__iterate(function(n,s,o){return a&&(a=t.call(e,n,s,o),a||(h=s)),a||i(n,u||r?s:s-h,o)!==!1},s,u);return r?l:o?h+1:l-h},i},groupBy:function(t,e,r){var n=this,i=me.empty().withMutations(function(e){n.forEach(function(i,s,u){var o=t(i,s,u),a=e.get(o,K);a===K&&(a=Array(r?n.length:0),e.set(o,a)),r?a[s]=i:a.push(i)})});return i.map(function(t){return B(t)})},sortBy:function(t,e,r){var n=z.superCall(this,J.prototype,"sortBy",[t,e]);return r||(n=n.values()),n.length=this.length,n},__makeSequence:function(){return i(this)}},{},B),R.prototype.__toJS=R.prototype.toArray,R.prototype.__toStringMapper=g;var L=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};z.createClass(L,{toObject:function(){return this._object},get:function(t,e){return void 0===e||this.has(t)?this._object[t]:e},has:function(t){return this._object.hasOwnProperty(t)},__iterate:function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,s=0;i>=s;s++){var u=e?i-s:s;if(t(r[n[u]],n[u],r)===!1)break}return s}},{},B);var V=function(t){this._array=t,this.length=t.length};z.createClass(V,{toArray:function(){return this._array},__iterate:function(t,e,r){var n=this._array,i=n.length-1,s=-1;
if(e){for(var u=i;u>=0;u--){if(n.hasOwnProperty(u)&&t(n[u],r?u:i-u,n)===!1)return s+1;s=u}return n.length}var o=n.every(function(e,u){return t(e,r?i-u:u,n)===!1?!1:(s=u,!0)});return o?n.length:s+1}},{},R),V.prototype.get=L.prototype.get,V.prototype.has=L.prototype.has;var K={},H=function(t,e,r){this._rootData=t,this._keyPath=e,this._onChange=r},F=H;z.createClass(H,{get:function(){return this._rootData.getIn(this._keyPath,N.empty())},update:function(t){var e=this._rootData.updateIn(this._keyPath,t),r=this._onChange;return r&&r.call(void 0,e,this._rootData),new F(e,this._keyPath,r)},cursor:function(t){return t&&!Array.isArray(t)&&(t=[t]),t&&0!==t.length?new F(this._rootData,this._keyPath?this._keyPath.concat(t):t,this._onChange):this}},{});var N=function(t){return t&&t.constructor===G?t:t&&0!==t.length?G.empty().merge(t):G.empty()},G=N;z.createClass(N,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return null==t||null==this._root?e:this._root.get(0,M(t),t,e)},set:function(t,e){if(null==t)return this;var r,n=this.length;if(this._root){var i=b();r=this._root.set(this.__ownerID,0,M(t),t,e,i),i.value&&n++}else n++,r=I(this.__ownerID,0,M(t),t,e);return this.__ownerID?(this.length=n,this._root=r,this):r===this._root?this:G._make(n,r)},"delete":function(t){if(null==t||null==this._root)return this;if(this.__ownerID){var e=b();return this._root=this._root.delete(this.__ownerID,0,M(t),t,e),e.value&&this.length--,this}var r=this._root.delete(this.__ownerID,0,M(t),t);return r?r===this._root?this:G._make(this.length-1,r):G.empty()},update:function(t,e){return this.set(t,e(this.get(t)))},clear:function(){return this.__ownerID?(this.length=0,this._root=null,this):G.empty()},merge:function(){return O(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return O(this,t,e)},mergeDeep:function(){return O(this,k(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return O(this,k(t),e)},updateIn:function(t,e){return t&&0!==t.length?D(this,t,e,0):e(this)
},cursor:function(t,e){return e||"function"!=typeof t||(e=t,t=null),t&&!Array.isArray(t)&&(t=[t]),new H(this,t,e)},withMutations:function(t){var e=this.asMutable();return t(e),e.__ensureOwner(this.__ownerID)},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new Q)},asImmutable:function(){return this.__ensureOwner()},__ensureOwner:function(t){return t===this.__ownerID?this:t?G._make(this.length,this._root,t):(this.__ownerID=t,this)},__deepEqual:function(t){var e=this;return t.every(function(t,r){return w(e.get(r,K),t)})},__iterate:function(t,e){return this._root?this._root.iterate(this,t,e):0}},{empty:function(){return $||($=G._make(0))},_make:function(t,e,r){var n=Object.create(G.prototype);return n.length=t,n._root=e,n.__ownerID=r,n}},B),N.from=N;var Q=function(){};z.createClass(Q,{},{});var T=function(t,e,r,n){this.ownerID=t,this.bitmap=e,this.keys=r,this.values=n},X=T;z.createClass(T,{get:function(t,e,r,n){var i=e>>>t&oe;if(0===(this.bitmap&1<<i))return n;var s=this.keys[i],u=this.values[i];return null==s?u.get(t+se,e,r,n):r===s?u:n},set:function(t,e,r,n,i,s){var u,o=r>>>e&oe,a=1<<o;if(0===(this.bitmap&a))return s&&(s.value=!0),u=this.ensureOwner(t),u.keys[o]=n,u.values[o]=i,u.bitmap|=a,u;var h,l=this.keys[o],c=this.values[o];if(null==l)return h=c.set(t,e+se,r,n,i,s),h===c?this:(u=this.ensureOwner(t),u.values[o]=h,u);if(n===l)return i===c?this:(u=this.ensureOwner(t),u.values[o]=i,u);var f=M(l);return h=r===f?new Y(t,r,[l,n],[c,i]):I(t,e+se,f,l,c).set(t,e+se,r,n,i),s&&(s.value=!0),u=this.ensureOwner(t),delete u.keys[o],u.values[o]=h,u},"delete":function(t,e,r,n,i){var s,u=r>>>e&oe,o=1<<u,a=this.keys[u];if(0===(this.bitmap&o)||null!=a&&n!==a)return this;if(null==a){var h=this.values[u],l=h.delete(t,e+se,r,n,i);if(l===h)return this;if(l)return s=this.ensureOwner(t),s.values[u]=l,s}else i&&(i.value=!0);return this.bitmap===o?null:(s=this.ensureOwner(t),delete s.keys[u],delete s.values[u],s.bitmap^=o,s)},ensureOwner:function(t){return t&&t===this.ownerID?this:new X(t,this.bitmap,this.keys.slice(),this.values.slice())
},iterate:function(t,e,r){for(var n=this.values,i=this.keys,s=n.length,u=0;s>=u;u++){var o=r?s-u:u,a=i[o],h=n[o];if(null!=a){if(e(h,a,t)===!1)return!1}else if(h&&!h.iterate(t,e,r))return!1}return!0}},{});var Y=function(t,e,r,n){this.ownerID=t,this.collisionHash=e,this.keys=r,this.values=n},Z=Y;z.createClass(Y,{get:function(t,e,r,n){var i=B(this.keys).indexOf(r);return-1===i?n:this.values[i]},set:function(t,e,r,n,i,s){if(r!==this.collisionHash)return s&&(s.value=!0),I(t,e,this.collisionHash,null,this).set(t,e,r,n,i);var u=B(this.keys).indexOf(n);if(u>=0&&this.values[u]===i)return this;var o=this.ensureOwner(t);return-1===u?(o.keys.push(n),o.values.push(i),s&&(s.value=!0)):o.values[u]=i,o},"delete":function(t,e,r,n,i){var s=this.keys.indexOf(n);if(-1===s)return this;if(i&&(i.value=!0),this.values.length>1){var u=this.ensureOwner(t);return u.keys[s]=u.keys.pop(),u.values[s]=u.values.pop(),u}},ensureOwner:function(t){return t&&t===this.ownerID?this:new Z(t,this.collisionHash,this.keys.slice(),this.values.slice())},iterate:function(t,e,r){for(var n=this.values,i=this.keys,s=n.length-1,u=0;s>=u;u++){var o=r?s-u:u;if(e(n[o],i[o],t)===!1)return!1}return!0}},{});var $,te={value:!1},ee=4294967296,re=255,ne=0,ie={},se=5,ue=1<<se,oe=ue-1,K={},ae=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return he.from(t)},he=ae;z.createClass(ae,{toString:function(){return this.__toString("Vector [","]")},get:function(t,e){if(t=E(t,this._origin),t>=this._size)return e;var r=this._nodeFor(t),n=t&oe;return r&&(void 0===e||r.array.hasOwnProperty(n))?r.array[n]:e},first:function(){return this.get(0)},last:function(){return this.get(this.length?this.length-1:0)},set:function(t,e){var r=C(this._size);if(t>=this.length)return this.withMutations(function(r){return r._setBounds(0,t+1).set(t,e)});if(this.get(t,K)===e)return this;if(t=E(t,this._origin),t>=r){var n=this._tail.ensureOwner(this.__ownerID);n.array[t&oe]=e;var i=t>=this._size?t+1:this._size;return this.__ownerID?(this.length=i-this._origin,this._size=i,this._tail=n,this):he._make(this._origin,i,this._level,this._root,n)
}for(var s=this._root.ensureOwner(this.__ownerID),u=s,o=this._level;o>0;o-=se){var a=t>>>o&oe;u=u.array[a]=u.array[a]?u.array[a].ensureOwner(this.__ownerID):new le([],this.__ownerID)}return u.array[t&oe]=e,this.__ownerID?(this._root=s,this):he._make(this._origin,this._size,this._level,s,this._tail)},"delete":function(t){if(!this.has(t))return this;var e=C(this._size);if(t=E(t,this._origin),t>=e){var r=this._tail.ensureOwner(this.__ownerID);return delete r.array[t&oe],this.__ownerID?(this._tail=r,this):he._make(this._origin,this._size,this._level,this._root,r)}for(var n=this._root.ensureOwner(this.__ownerID),i=n,s=this._level;s>0;s-=se){var u=t>>>s&oe;i=i.array[u]=i.array[u].ensureOwner(this.__ownerID)}return delete i.array[t&oe],this.__ownerID?(this._root=n,this):he._make(this._origin,this._size,this._level,n,this._tail)},clear:function(){return this.__ownerID?(this.length=this._origin=this._size=0,this._level=se,this._root=this._tail=pe,this):he.empty()},push:function(){var t=arguments,e=this.length;return this.withMutations(function(r){r._setBounds(0,e+t.length);for(var n=0;t.length>n;n++)r.set(e+n,t[n])})},pop:function(){return this._setBounds(0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){e._setBounds(-t.length);for(var r=0;t.length>r;r++)e.set(r,t[r])})},shift:function(){return this._setBounds(1)},merge:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return N.prototype.merge.apply(x(this,t),arguments)},mergeWith:function(){for(var t=[],e=1;arguments.length>e;e++)t[e-1]=arguments[e];return N.prototype.mergeWith.apply(x(this,t),arguments)},mergeDeep:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return N.prototype.mergeDeep.apply(x(this,t),arguments)},mergeDeepWith:function(){for(var t=[],e=1;arguments.length>e;e++)t[e-1]=arguments[e];return N.prototype.mergeDeepWith.apply(x(this,t),arguments)},setLength:function(t){return this._setBounds(0,t)},_setBounds:function(t,e){var r=this.__ownerID||new Q,n=this._origin,i=this._size,s=n+t,u=null==e?i:0>e?i+e:n+e;
if(s===n&&u===i)return this;if(s>=u)return this.clear();for(var o=this._level,a=this._root,h=0;0>s+h;)a=new le(a.array.length?[,a]:[],r),o+=se,h+=1<<o;h&&(s+=h,n+=h,u+=h,i+=h);for(var l=C(i),c=C(u);c>=1<<o+se;)a=new le(a.array.length?[a]:[],r),o+=se;var f=this._tail,_=l>c?this._nodeFor(u):c>l?new le([],r):f;if(c>l&&i>s&&f.array.length){a=a.ensureOwner(r);for(var p=a,v=o;v>se;v-=se){var g=l>>>v&oe;p=p.array[g]=p.array[g]?p.array[g].ensureOwner(r):new le([],r)}p.array[l>>>se&oe]=f}if(i>u&&(_=_.removeAfter(r,0,u)),s>=c)s-=c,u-=c,o=se,a=pe,_=_.removeBefore(r,0,s);else if(s>n||l>c){var y,m;h=0;do y=s>>>o&oe,m=c-1>>>o&oe,y===m&&(y&&(h+=(1<<o)*y),o-=se,a=a&&a.array[y]);while(a&&y===m);a&&s>n&&(a=a.removeBefore(r,o,s-h)),a&&l>c&&(a=a.removeAfter(r,o,c-h)),h&&(s-=h,u-=h),a=a||pe}return this.__ownerID?(this.length=u-s,this._origin=s,this._size=u,this._level=o,this._root=a,this._tail=_,this):he._make(s,u,o,a,_)},__ensureOwner:function(t){return t===this.__ownerID?this:t?he._make(this._origin,this._size,this._level,this._root,this._tail,t):(this.__ownerID=t,this)},slice:function(t,e,r){var n=z.superCall(this,he.prototype,"slice",[t,e,r]);if(!r&&n!==this){var i=this,s=i.length;n.toVector=function(){return i._setBounds(0>t?Math.max(0,s+t):s?Math.min(s,t):t,null==e?s:0>e?Math.max(0,s+e):s?Math.min(s,e):e)}}return n},__deepEquals:function(t){var e=this.__iterator__();return t.every(function(t,r){var n=e.next();return r===n[0]&&w(t,n[1])})},__iterator__:function(){return new fe(this,this._origin,this._size,this._level,this._root,this._tail)},__iterate:function(t,e,r){var n=this,i=0,s=n.length-1;r^=e;var u,o=function(e,u){return t(e,r?s-u:u,n)===!1?!1:(i=u,!0)},a=C(this._size);return u=e?this._tail.iterate(0,a-this._origin,this._size-this._origin,o,e)&&this._root.iterate(this._level,-this._origin,a-this._origin,o,e):this._root.iterate(this._level,-this._origin,a-this._origin,o,e)&&this._tail.iterate(0,a-this._origin,this._size-this._origin,o,e),(u?s:e?s-i:i)+1},_nodeFor:function(t){if(t>=C(this._size))return this._tail;if(1<<this._level+se>t){for(var e=this._root,r=this._level;e&&r>0;)e=e.array[t>>>r&oe],r-=se;
return e}}},{empty:function(){return _e||(_e=he._make(0,0,se,pe,pe))},from:function(t){if(t&&t.constructor===he)return t;if(!t||0===t.length)return he.empty();var e=Array.isArray(t);return t.length>0&&ue>t.length?he._make(0,t.length,se,pe,new le(e?t.slice():B(t).toArray())):(e||(t=B(t),t instanceof R||(t=t.values())),he.empty().merge(t))},_make:function(t,e,r,n,i,s){var u=Object.create(he.prototype);return u.length=e-t,u._origin=t,u._size=e,u._level=r,u._root=n,u._tail=i,u.__ownerID=s,u}},R),ae.prototype.update=N.prototype.update,ae.prototype.updateIn=N.prototype.updateIn,ae.prototype.cursor=N.prototype.cursor,ae.prototype.withMutations=N.prototype.withMutations,ae.prototype.asMutable=N.prototype.asMutable,ae.prototype.asImmutable=N.prototype.asImmutable;var Q=function(){};z.createClass(Q,{},{});var le=function(t,e){this.array=t,this.ownerID=e},ce=le;z.createClass(le,{ensureOwner:function(t){return t&&t===this.ownerID?this:new ce(this.array.slice(),t)},removeBefore:function(t,e,r){if(r===1<<e||0===this.array.length)return this;var n=r>>>e&oe;if(n>=this.array.length)return new ce([],t);var i,s=0===n;if(e>0){var u=this.array[n];if(i=u&&u.removeBefore(t,e-se,r),i===u&&s)return this}if(s&&!i)return this;var o=this.ensureOwner();if(!s)for(var a=0;n>a;a++)delete o.array[a];return i&&(o.array[n]=i),o},removeAfter:function(t,e,r){if(r===1<<e||0===this.array.length)return this;var n=r-1>>>e&oe;if(n>=this.array.length)return this;var i,s=n===this.array.length-1;if(e>0){var u=this.array[n];if(i=u&&u.removeAfter(t,e-se,r),i===u&&s)return this}if(s&&!i)return this;var o=this.ensureOwner();return s||(o.array.length=n+1),i&&(o.array[n]=i),o},iterate:function(t,e,r,n,i){if(0===t){if(i){for(var s=this.array.length-1;s>=0;s--)if(this.array.hasOwnProperty(s)){var u=s+e;if(u>=0&&r>u&&n(this.array[s],u)===!1)return!1}return!0}return this.array.every(function(t,i){var s=i+e;return 0>s||s>=r||n(t,s)!==!1})}var o=1<<t,a=t-se;if(i){for(var h=this.array.length-1;h>=0;h--){var l=e+h*o;if(r>l&&l+o>0&&this.array.hasOwnProperty(h)&&!this.array[h].iterate(a,l,r,n,i))return!1
}return!0}return this.array.every(function(t,s){var u=e+s*o;return u>=r||0>=u+o||t.iterate(a,u,r,n,i)})}},{});var fe=function(t,e,r,n,i,s){var u=C(r);this._stack={node:i.array,level:n,offset:-e,max:u-e,__prev:{node:s.array,level:0,offset:u-e,max:r-e}}};z.createClass(fe,{next:function(){var t=this._stack;t:for(;t;){if(0===t.level)for(t.rawIndex||(t.rawIndex=0);t.node.length>t.rawIndex;){var e=t.rawIndex+t.offset;if(e>=0&&t.max>e&&t.node.hasOwnProperty(t.rawIndex)){var r=t.node[t.rawIndex];return t.rawIndex++,[e,r]}t.rawIndex++}else{var n=1<<t.level;for(t.levelIndex||(t.levelIndex=0);t.node.length>t.levelIndex;){var i=t.offset+t.levelIndex*n;if(i+n>0&&t.max>i&&t.node.hasOwnProperty(t.levelIndex)){var s=t.node[t.levelIndex].array;t.levelIndex++,t=this._stack={node:s,level:t.level-se,offset:i,max:t.max,__prev:t};continue t}t.levelIndex++}}t=this._stack=this._stack.__prev}if(global.StopIteration)throw global.StopIteration}},{});var _e,se=5,ue=1<<se,oe=ue-1,K={},pe=new le([]),ve=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return ge.from(t)},ge=ve;z.createClass(ve,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map?this._map.has(t):!1},get:function(t,e){return this.has(t)?t:e},add:function(t){if(null==t)return this;var e=this._map;return e||(e=N.empty().__ensureOwner(this.__ownerID)),e=e.set(t,null),this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:ge._make(e)},"delete":function(t){if(null==t||null==this._map)return this;var e=this._map.delete(t);return 0===e.length?this.clear():this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:ge._make(e)},clear:function(){return this.__ownerID?(this.length=0,this._map=null,this):ge.empty()},union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var r=0;t.length>r;r++){var n=t[r];n=n.forEach?n:B(n),n.forEach(function(t){return e.add(t)})}})},intersect:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;
t=t.map(function(t){return B(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.every(function(t){return t.contains(r)})||e.delete(r)})})},subtract:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return B(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.some(function(t){return t.contains(r)})&&e.delete(r)})})},isSubset:function(t){return t=B(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=B(t),t.every(function(t){return e.contains(t)})},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?ge._make(e,t):(this.__ownerID=t,this._map=e,this)},__deepEquals:function(t){return!(this._map||t._map)||this._map.equals(t._map)},__iterate:function(t,e){var r=this;return this._map?this._map.__iterate(function(e,n){return t(n,n,r)},e):0}},{empty:function(){return ye||(ye=ge._make())},from:function(t){return t&&t.constructor===ge?t:t&&0!==t.length?ge.empty().union(t):ge.empty()},fromKeys:function(t){return ge.from(B(t).flip())},_make:function(t,e){var r=Object.create(ge.prototype);return r.length=t?t.length:0,r._map=t,r.__ownerID=e,r}},B),ve.prototype.contains=ve.prototype.has,ve.prototype.withMutations=N.prototype.withMutations,ve.prototype.asMutable=N.prototype.asMutable,ve.prototype.asImmutable=N.prototype.asImmutable,ve.prototype.__toJS=R.prototype.__toJS,ve.prototype.__toStringMapper=R.prototype.__toStringMapper;var ye,me=function(t){return t&&t.constructor===de?t:t&&0!==t.length?de.empty().merge(t):de.empty()},de=me;z.createClass(me,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){if(null!=t&&this._map){var r=this._map.get(t);if(null!=r)return this._vector.get(r)[1]}return e},clear:function(){return this.__ownerID?(this.length=0,this._map=this._vector=null,this):de.empty()},set:function(t,e){if(null==t)return this;var r=this._map,n=this._vector;if(r){var i=r.get(t);
null==i?(r=r.set(t,n.length),n=n.push([t,e])):n.get(i)[1]!==e&&(n=n.set(i,[t,e]))}else n=ae.empty().__ensureOwner(this.__ownerID).set(0,[t,e]),r=N.empty().__ensureOwner(this.__ownerID).set(t,0);return this.__ownerID?(this.length=r.length,this._map=r,this._vector=n,this):n===this._vector?this:de._make(r,n)},"delete":function(t){if(null==t||null==this._map)return this;var e=this._map.get(t);if(null==e)return this;var r=this._map.delete(t),n=this._vector.delete(e);return 0===r.length?this.clear():this.__ownerID?(this.length=r.length,this._map=r,this._vector=n,this):r===this._map?this:de._make(r,n)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t),r=this._vector&&this._vector.__ensureOwner(t);return t?de._make(e,r,t):(this.__ownerID=t,this._map=e,this._vector=r,this)},__deepEqual:function(t){var e=this._vector.__iterator__();return t.every(function(t,r){var n=e.next();return n&&(n=n[1]),n&&w(r,n[0])&&w(t,n[1])})},__iterate:function(t,e){return this._vector?this._vector.fromEntries().__iterate(t,e):0}},{empty:function(){return we||(we=de._make())},_make:function(t,e,r){var n=Object.create(de.prototype);return n.length=t?t.length:0,n._map=t,n._vector=e,n.__ownerID=r,n}},N),me.from=me;var we,Ie=function(t,e){var r=function(t){this._map=N(t)};t=B(t),r.prototype=Object.create(ke.prototype),r.prototype.constructor=r,r.prototype._name=e,r.prototype._defaultValues=t;var n=Object.keys(t);return r.prototype.length=n.length,Object.defineProperty&&t.forEach(function(t,e){Object.defineProperty(r.prototype,e,{get:function(){return this.get(e)},set:function(t){if(!this.__ownerID)throw Error("Cannot set on an immutable record.");this.set(e,t)}})}),r},ke=Ie;z.createClass(Ie,{toString:function(){return this.__toString((this._name||"Record")+" {","}")},has:function(t){return this._defaultValues.has(t)},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues.get(t)):e},clear:function(){return this.__ownerID?(this._map.clear(),this):this._empty()},set:function(t,e){if(null==t||!this.has(t))return this;
var r=this._map.set(t,e);return this.__ownerID||r===this._map?this:this._make(r)},"delete":function(t){if(null==t||!this.has(t))return this;var e=this._map.delete(t);return this.__ownerID||e===this._map?this:this._make(e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?this._make(e,t):(this.__ownerID=t,this._map=e,this)},__iterate:function(t,e){var r=this;return this._defaultValues.map(function(t,e){return r.get(e)}).__iterate(t,e)},_empty:function(){Object.getPrototypeOf(this).constructor;return ke._empty||(ke._empty=this._make(N.empty()))},_make:function(t,e){var r=Object.create(Object.getPrototypeOf(this));return r._map=t,r.__ownerID=e,r}},{},B),Ie.prototype.__deepEqual=N.prototype.__deepEqual,Ie.prototype.merge=N.prototype.merge,Ie.prototype.mergeWith=N.prototype.mergeWith,Ie.prototype.mergeDeep=N.prototype.mergeDeep,Ie.prototype.mergeDeepWith=N.prototype.mergeDeepWith,Ie.prototype.update=N.prototype.update,Ie.prototype.updateIn=N.prototype.updateIn,Ie.prototype.cursor=N.prototype.cursor,Ie.prototype.withMutations=N.prototype.withMutations,Ie.prototype.asMutable=N.prototype.asMutable,Ie.prototype.asImmutable=N.prototype.asImmutable;var Oe=function(t,e,r){return this instanceof De?(q(0!==r,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&be?be:(r=null==r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,void(this.length=Math.max(0,Math.ceil((e-t)/r-1)+1)))):new De(t,e,r)},De=Oe;z.createClass(Oe,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},has:function(t){return q(t>=0,"Index out of bounds"),this.length>t},get:function(t,e){return q(t>=0,"Index out of bounds"),1/0===this.length||this.length>t?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e,r){return u(t,e,this.length)?this:r?z.superCall(this,De.prototype,"slice",[t,e,r]):(t=o(t,this.length),e=a(e,this.length),t>=e?be:new De(this.get(t,this._end),this.get(e,this._end),this._step))
},__deepEquals:function(t){return this._start===t._start&&this._end===t._end&&this._step===t._step},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;if(r>=0&&this.length>r)return r}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,t)},skip:function(t,e){return e?z.superCall(this,De.prototype,"skip",[t]):this.slice(t)},__iterate:function(t,e,r){for(var n=e^r,i=this.length-1,s=this._step,u=e?this._start+i*s:this._start,o=0;i>=o&&t(u,n?i-o:o,this)!==!1;o++)u+=e?-s:s;return n?this.length:o}},{},R),Oe.prototype.__toJS=Oe.prototype.toArray,Oe.prototype.first=ae.prototype.first,Oe.prototype.last=ae.prototype.last;var be=Oe(0,0),Me=function(t,e){return 0===e&&xe?xe:this instanceof Se?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new Se(t,e)},Se=Me;z.createClass(Me,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"},get:function(t,e){return q(t>=0,"Index out of bounds"),1/0===this.length||this.length>t?this._value:e},first:function(){return this._value},contains:function(t){return w(this._value,t)},__deepEquals:function(t){return w(this._value,t._value)},slice:function(t,e,r){if(r)return z.superCall(this,Se.prototype,"slice",[t,e,r]);var n=this.length;return t=0>t?Math.max(0,n+t):Math.min(n,t),e=null==e?n:e>0?Math.min(n,e):Math.max(0,n+e),e>t?new Se(this._value,e-t):xe},reverse:function(t){return t?z.superCall(this,Se.prototype,"reverse",[t]):this},indexOf:function(t){return w(this._value,t)?0:-1},lastIndexOf:function(t){return w(this._value,t)?this.length:-1},__iterate:function(t,e,r){var n=e^r;q(!n||1/0>this.length,"Cannot access end of infinite range.");for(var i=this.length-1,s=0;i>=s&&t(this._value,n?i-s:s,this)!==!1;s++);return n?this.length:s}},{},R),Me.prototype.last=Me.prototype.first,Me.prototype.has=Oe.prototype.has,Me.prototype.take=Oe.prototype.take,Me.prototype.skip=Oe.prototype.skip,Me.prototype.__toJS=Oe.prototype.__toJS;var xe=new Me(void 0,0),Ee={Sequence:B,Map:N,Vector:ae,Set:ve,OrderedMap:me,Record:Ie,Range:Oe,Repeat:Me,is:w,fromJS:j};
return Ee}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t();
function t(){function t(t,e,r,n){var i;if(n){var s=n.prototype;i=N.create(s)}else i=t.prototype;return N.keys(e).forEach(function(t){i[t]=e[t]}),N.keys(r).forEach(function(e){t[e]=r[e]}),i.constructor=t,t.prototype=i,t}function e(t,e,r,n){return N.getPrototypeOf(e)[r].apply(t,n)}function r(t,r,n){e(t,r,"constructor",n)}function n(){return Object.create(T)}function i(t){var e=Object.create(Z);return e.__reversedIndices=t?t.__reversedIndices:!1,e}function s(t,e,r,n){var i=t.get?t.get(e[n],ue):ue;return i===ue?r:++n===e.length?i:s(i,e,r,n)}function u(t,e,r){return(0===t||null!=r&&-r>=t)&&(null==e||null!=r&&e>=r)}function a(t,e){return 0>t?Math.max(0,e+t):e?Math.min(e,t):t}function h(t,e){return null==t?e:0>t?Math.max(0,e+t):e?Math.min(e,t):t}function o(t){return t}function l(t,e){return[e,t]}function c(){return!0}function f(){return this}function _(t){return(t||0)+1}function v(t,e,r,n,i){var s=t.__makeSequence();return s.__iterateUncached=function(s,u,a){var h=0,o=t.__iterate(function(t,i,u){if(e.call(r,t,i,u)){if(s(t,n?i:h,u)===!1)return!1;h++}},u,a);return i?o:h},s}function g(t){return function(){return!t.apply(this,arguments)}}function p(t){return"string"==typeof t?JSON.stringify(t):t}function m(t,e){for(var r="";e;)1&e&&(r+=t),(e>>=1)&&(t+=t);return r}function y(t,e){return t>e?1:e>t?-1:0}function d(t){I(1/0!==t,"Cannot perform this action with an infinite sequence.")}function w(t,e){return t===e?0!==t||0!==e||1/t===1/e:t!==t?e!==e:t instanceof G?t.equals(e):!1}function I(t,e){if(!t)throw Error(e)}function O(t,e,r){var n=t._rootData.updateIn(t._keyPath,e),i=t._keyPath||[];return t._onChange&&t._onChange.call(void 0,n,t._rootData,r?i.concat(r):i),new ee(n,t._keyPath,t._onChange)}function k(){}function D(t){return ge.value=t,ge}function b(t,e,r){var n=Object.create(oe);return n.length=t,n._root=e,n.__ownerID=r,n}function M(t,e,r,n,i){var s=r>>>e&se,u=[],a=[];return a[s]=i,null!=n&&(u[s]=n),new le(t,1<<s,u,a)}function S(t,e,r){for(var n=[],i=0;r.length>i;i++){var s=r[i];s&&n.push(Array.isArray(s)?G(s).fromEntries():G(s))
}return E(t,e,n)}function x(t){return function(e,r){return e&&e.mergeDeepWith?e.mergeDeepWith(t,r):t?t(e,r):r}}function E(t,e,r){return 0===r.length?t:t.withMutations(function(t){for(var n=e?function(r,n){var i=t.get(n,ue);t.set(n,i===ue?r:e(i,r))}:function(e,r){t.set(r,e)},i=0;r.length>i;i++)r[i].forEach(n)})}function C(t,e,r,n){var i=e[n],s=t.get?t.get(i,ue):ue;return s===ue&&(s=ae.empty()),I(t.set,"updateIn with invalid keyPath"),t.set(i,++n===e.length?r(s):C(s,e,r,n))}function A(t){if(!t)return 0;if(t===!0)return 1;if("function"==typeof t.hashCode)return t.hashCode();var e=typeof t;if("number"===e)return Math.floor(t)%2147483647;if("string"===e)return q(t);throw Error("Unable to hash: "+t)}function q(t){var e=de[t];if(null==e){e=0;for(var r=0;t.length>r;r++)e=(31*e+t.charCodeAt(r))%pe;ye===me&&(ye=0,de={}),ye++,de[t]=e}return e}function j(t,e,r,n,i,s){var u=Object.create(Oe);return u.length=e-t,u._origin=t,u._size=e,u._level=r,u._root=n,u._tail=i,u.__ownerID=s,u}function P(t,e){if(e>=W(t._size))return t._tail;if(1<<t._level+ne>e){for(var r=t._root,n=t._level;r&&n>0;)r=r.array[e>>>n&se],n-=ne;return r}}function U(t,e,r){var n=t.__ownerID||new k,i=t._origin,s=t._size,u=i+e,a=null==r?s:0>r?s+r:i+r;if(u===i&&a===s)return t;if(u>=a)return t.clear();for(var h=t._level,o=t._root,l=0;0>u+l;)o=new ke(o.array.length?[,o]:[],n),h+=ne,l+=1<<h;l&&(u+=l,i+=l,a+=l,s+=l);for(var c=W(s),f=W(a);f>=1<<h+ne;)o=new ke(o.array.length?[o]:[],n),h+=ne;var _=t._tail,v=c>f?P(t,a-1):f>c?new ke([],n):_;if(f>c&&s>u&&_.array.length){o=o.ensureOwner(n);for(var g=o,p=h;p>ne;p-=ne){var m=c>>>p&se;g=g.array[m]=g.array[m]?g.array[m].ensureOwner(n):new ke([],n)}g.array[c>>>ne&se]=_}if(s>a&&(v=v.removeAfter(n,0,a)),u>=f)u-=f,a-=f,h=ne,o=Se,v=v.removeBefore(n,0,u);else if(u>i||c>f){var y,d;l=0;do y=u>>>h&se,d=f-1>>>h&se,y===d&&(y&&(l+=(1<<h)*y),h-=ne,o=o&&o.array[y]);while(o&&y===d);o&&u>i&&(o=o.removeBefore(n,h,u-l)),o&&c>f&&(o=o.removeAfter(n,h,f-l)),l&&(u-=l,a-=l),o=o||Se}return t.__ownerID?(t.length=a-u,t._origin=u,t._size=a,t._level=h,t._root=o,t._tail=v,t):j(u,a,h,o,v)
}function z(t,e,r){for(var n=[],i=0;r.length>i;i++){var s=r[i];s&&n.push(s.forEach?s:G(s))}var u=Math.max.apply(null,n.map(function(t){return t.length||0}));return u>t.length&&(t=t.setLength(u)),E(t,e,n)}function R(t,e){return I(t>=0,"Index out of bounds"),t+e}function W(t){return ie>t?0:t-1>>>ne<<ne}function J(t,e){var r=Object.create(Ce);return r.length=t?t.length:0,r._map=t,r.__ownerID=e,r}function B(t,e,r){var n=Object.create(qe.prototype);return n.length=t?t.length:0,n._map=t,n._vector=e,n.__ownerID=r,n}function L(t,e,r){var n=Object.create(Object.getPrototypeOf(t));return n._map=e,n.__ownerID=r,n}function V(t,e){return e?K(e,t,"",{"":t}):H(t)}function K(t,e,r,n){return e&&(Array.isArray(e)||e.constructor===Object)?t.call(n,r,G(e).map(function(r,n){return K(t,r,n,e)})):e}function H(t){if(t){if(Array.isArray(t))return G(t).map(H).toVector();if(t.constructor===Object)return G(t).map(H).toMap()}return t}var N=Object,F={};F.createClass=t,F.superCall=e,F.defaultSuperCall=r;var G=function(t){return Q.from(1===arguments.length?t:Array.prototype.slice.call(arguments))},Q=G;F.createClass(G,{toString:function(){return this.__toString("Seq {","}")},__toString:function(t,e){return 0===this.length?t+e:t+" "+this.map(this.__toStringMapper).join(", ")+" "+e},__toStringMapper:function(t,e){return e+": "+p(t)},toJS:function(){return this.map(function(t){return t instanceof Q?t.toJS():t}).__toJS()},toArray:function(){d(this.length);var t=Array(this.length||0);return this.values().forEach(function(e,r){t[r]=e}),t},toObject:function(){d(this.length);var t={};return this.forEach(function(e,r){t[r]=e}),t},toVector:function(){return d(this.length),we.from(this)},toMap:function(){return d(this.length),ae.from(this)},toOrderedMap:function(){return d(this.length),qe.from(this)},toSet:function(){return d(this.length),xe.from(this)},equals:function(t){if(this===t)return!0;if(!(t instanceof Q))return!1;if(null!=this.length&&null!=t.length){if(this.length!==t.length)return!1;if(0===this.length&&0===t.length)return!0}return this.__deepEquals(t)
},__deepEquals:function(t){var e=this.cacheResult().entries().toArray(),r=0;return t.every(function(t,n){var i=e[r++];return w(n,i[0])&&w(t,i[1])})},join:function(t){t=t||",";var e="",r=!0;return this.forEach(function(n){r?(r=!1,e+=n):e+=t+n}),e},count:function(t,e){return t?this.filter(t,e).count():(null==this.length&&(this.length=this.forEach(c)),this.length)},countBy:function(t){var e=this;return qe.empty().withMutations(function(r){e.forEach(function(e,n,i){r.update(t(e,n,i),_)})})},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];var r=[this].concat(t.map(function(t){return Q(t)})),n=this.__makeSequence();return n.length=r.reduce(function(t,e){return null!=t&&null!=e.length?t+e.length:void 0},0),n.__iterateUncached=function(t,e){for(var n,i=0,s=r.length-1,u=0;s>=u&&!n;u++){var a=r[e?s-u:u];i+=a.__iterate(function(e,r,i){return t(e,r,i)===!1?(n=!0,!1):void 0},e)}return i},n},reverse:function(){var t=this,e=t.__makeSequence();return e.length=t.length,e.__iterateUncached=function(e,r){return t.__iterate(e,!r)},e.reverse=function(){return t},e},keys:function(){return this.flip().values()},values:function(){var t=this,e=i(t);return e.length=t.length,e.values=f,e.__iterateUncached=function(e,r,n){if(n&&null==this.length)return this.cacheResult().__iterate(e,r,n);var i,s=0;return n?(s=this.length-1,i=function(t,r,n){return e(t,s--,n)!==!1}):i=function(t,r,n){return e(t,s++,n)!==!1},t.__iterate(i,r),n?this.length:s},e},entries:function(){var t=this;if(t._cache)return Q(t._cache);var e=t.map(l).values();return e.fromEntries=function(){return t},e},forEach:function(t,e){return this.__iterate(e?t.bind(e):t)},reduce:function(t,e,r){var n=e;return this.forEach(function(e,i,s){n=t.call(r,n,e,i,s)}),n},reduceRight:function(t,e,r){return this.reverse(!0).reduce(t,e,r)},every:function(t,e){var r=!0;return this.forEach(function(n,i,s){return t.call(e,n,i,s)?void 0:(r=!1,!1)}),r},some:function(t,e){return!this.every(g(t),e)},first:function(){return this.find(c)},last:function(){return this.findLast(c)
},rest:function(){return this.slice(1)},butLast:function(){return this.slice(0,-1)},has:function(t){return this.get(t,ue)!==ue},get:function(t,e){return this.find(function(e,r){return w(r,t)},null,e)},getIn:function(t,e){return t&&0!==t.length?s(this,t,e,0):this},contains:function(t){return this.find(function(e){return w(e,t)},null,ue)!==ue},find:function(t,e,r){var n=r;return this.forEach(function(r,i,s){return t.call(e,r,i,s)?(n=r,!1):void 0}),n},findKey:function(t,e){var r;return this.forEach(function(n,i,s){return t.call(e,n,i,s)?(r=i,!1):void 0}),r},findLast:function(t,e,r){return this.reverse(!0).find(t,e,r)},findLastKey:function(t,e){return this.reverse(!0).findKey(t,e)},flip:function(){var t=this,e=n();return e.length=t.length,e.flip=function(){return t},e.__iterateUncached=function(e,r){return t.__iterate(function(t,r,n){return e(r,t,n)!==!1},r)},e},map:function(t,e){var r=this,n=r.__makeSequence();return n.length=r.length,n.__iterateUncached=function(n,i){return r.__iterate(function(r,i,s){return n(t.call(e,r,i,s),i,s)!==!1},i)},n},mapKeys:function(t,e){var r=this,n=r.__makeSequence();return n.length=r.length,n.__iterateUncached=function(n,i){return r.__iterate(function(r,i,s){return n(r,t.call(e,i,r,s),s)!==!1},i)},n},filter:function(t,e){return v(this,t,e,!0,!1)},slice:function(t,e){if(u(t,e,this.length))return this;var r=a(t,this.length),n=h(e,this.length);if(r!==r||n!==n)return this.entries().slice(t,e).fromEntries();var i=0===r?this:this.skip(r);return null==n||n===this.length?i:i.take(n-r)},take:function(t){var e=0,r=this.takeWhile(function(){return e++<t});return r.length=this.length&&Math.min(this.length,t),r},takeLast:function(t,e){return this.reverse(e).take(t).reverse(e)},takeWhile:function(t,e){var r=this,n=r.__makeSequence();return n.__iterateUncached=function(n,i,s){if(i)return this.cacheResult().__iterate(n,i,s);var u=0;return r.__iterate(function(r,i,s){return t.call(e,r,i,s)&&n(r,i,s)!==!1?void u++:!1},i,s),u},n},takeUntil:function(t,e,r){return this.takeWhile(g(t),e,r)},skip:function(t,e){if(0===t)return this;
var r=0,n=this.skipWhile(function(){return r++<t},null,e);return n.length=this.length&&Math.max(0,this.length-t),n},skipLast:function(t,e){return this.reverse(e).skip(t).reverse(e)},skipWhile:function(t,e){var r=this,n=r.__makeSequence();return n.__iterateUncached=function(n,i,s){if(i)return this.cacheResult().__iterate(n,i,s);var u=!0,a=0;return r.__iterate(function(r,i,s){if(!u||!(u=t.call(e,r,i,s))){if(n(r,i,s)===!1)return!1;a++}},i,s),a},n},skipUntil:function(t,e,r){return this.skipWhile(g(t),e,r)},groupBy:function(t){var e=this,r=qe.empty().withMutations(function(r){e.forEach(function(e,n,i){var s=t(e,n,i),u=r.get(s,ue);u===ue&&(u=[],r.set(s,u)),u.push([n,e])})});return r.map(function(t){return Q(t).fromEntries()})},sort:function(t,e){return this.sortBy(o,t,e)},sortBy:function(t,e){e=e||y;var r=this;return Q(this.entries().entries().toArray().sort(function(n,i){return e(t(n[1][1],n[1][0],r),t(i[1][1],i[1][0],r))||n[0]-i[0]})).fromEntries().values().fromEntries()},cacheResult:function(){return!this._cache&&this.__iterateUncached&&(d(this.length),this._cache=this.entries().toArray(),null==this.length&&(this.length=this._cache.length)),this},__iterate:function(t,e,r){if(!this._cache)return this.__iterateUncached(t,e,r);var n=this.length-1,i=this._cache,s=this;if(e)for(var u=i.length-1;u>=0;u--){var a=i[u];if(t(a[1],r?a[0]:n-a[0],s)===!1)break}else i.every(r?function(e){return t(e[1],n-e[0],s)!==!1}:function(e){return t(e[1],e[0],s)!==!1});return this.length},__makeSequence:function(){return n()}},{from:function(t){if(t instanceof Q)return t;if(!Array.isArray(t)){if(t&&t.constructor===Object)return new $(t);t=[t]}return new te(t)}});var T=G.prototype;T.toJSON=T.toJS,T.__toJS=T.toObject,T.inspect=T.toSource=function(){return""+this};var X=function(){F.defaultSuperCall(this,Y.prototype,arguments)},Y=X;F.createClass(X,{toString:function(){return this.__toString("Seq [","]")},toArray:function(){d(this.length);var t=Array(this.length||0);return t.length=this.forEach(function(e,r){t[r]=e}),t},fromEntries:function(){var t=this,e=n();
return e.length=t.length,e.entries=function(){return t},e.__iterateUncached=function(e,r,n){return t.__iterate(function(t,r,n){return e(t[1],t[0],n)},r,n)},e},join:function(t){t=t||",";var e="",r=0;return this.forEach(function(n,i){var s=i-r;r=i,e+=(1===s?t:m(t,s))+n}),this.length&&this.length-1>r&&(e+=m(t,this.length-1-r)),e},concat:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];var r=[this].concat(t).map(function(t){return G(t)}),n=this.__makeSequence();return n.length=r.reduce(function(t,e){return null!=t&&null!=e.length?t+e.length:void 0},0),n.__iterateUncached=function(t,e,n){if(n&&!this.length)return this.cacheResult().__iterate(t,e,n);for(var i,s=0,u=n&&this.length-1,a=r.length-1,h=0;a>=h&&!i;h++){var o=r[e?a-h:h];o instanceof Y||(o=o.values()),s+=o.__iterate(function(e,r,a){return r+=s,t(e,n?u-r:r,a)===!1?(i=!0,!1):void 0},e)}return s},n},reverse:function(t){var e=this,r=e.__makeSequence();return r.length=e.length,r.__reversedIndices=!!(t^e.__reversedIndices),r.__iterateUncached=function(r,n,i){return e.__iterate(r,!n,i^t)},r.reverse=function(r){return t===r?e:Z.reverse.call(this,r)},r},values:function(){var t=F.superCall(this,Y.prototype,"values",[]);return t.length=void 0,t},filter:function(t,e,r){var n=v(this,t,e,r,r);return r&&(n.length=this.length),n},indexOf:function(t){return this.findIndex(function(e){return w(e,t)})},lastIndexOf:function(t){return this.reverse(!0).indexOf(t)},findIndex:function(t,e){var r=this.findKey(t,e);return null==r?-1:r},findLastIndex:function(t,e){return this.reverse(!0).findIndex(t,e)},slice:function(t,e,r){var n=this;if(u(t,e,n.length))return n;var i=n.__makeSequence(),s=a(t,n.length),o=h(e,n.length);return i.length=n.length&&(r?n.length:o-s),i.__reversedIndices=n.__reversedIndices,i.__iterateUncached=function(i,u,l){if(u)return this.cacheResult().__iterate(i,u,l);var c=this.__reversedIndices^l;if(s!==s||o!==o||c&&null==n.length){var f=n.count();s=a(t,f),o=h(e,f)}var _=c?n.length-o:s,v=c?n.length-s:o,g=n.__iterate(function(t,e,n){return c?null!=v&&e>=v||e>=_&&i(t,r?e:e-_,n)!==!1:_>e||(null==v||v>e)&&i(t,r?e:e-_,n)!==!1
},u,l);return null!=this.length?this.length:r?g:Math.max(0,g-_)},i},splice:function(t,e){for(var r=[],n=2;arguments.length>n;n++)r[n-2]=arguments[n];return 0===e&&0===r.length?this:this.slice(0,t).concat(r,this.slice(t+e))},takeWhile:function(t,e,r){var n=this,i=n.__makeSequence();return i.__iterateUncached=function(s,u,a){if(u)return this.cacheResult().__iterate(s,u,a);var h=0,o=!0,l=n.__iterate(function(r,n,i){return t.call(e,r,n,i)&&s(r,n,i)!==!1?void(h=n):(o=!1,!1)},u,a);return r?i.length:o?l:h+1},r&&(i.length=this.length),i},skipWhile:function(t,e,r){var n=this,i=n.__makeSequence();return r&&(i.length=this.length),i.__iterateUncached=function(i,s,u){if(s)return this.cacheResult().__iterate(i,s,u);var a=n.__reversedIndices^u,h=!0,o=0,l=n.__iterate(function(n,s,a){return h&&(h=t.call(e,n,s,a),h||(o=s)),h||i(n,u||r?s:s-o,a)!==!1},s,u);return r?l:a?o+1:l-o},i},groupBy:function(t,e,r){var n=this,i=qe.empty().withMutations(function(e){n.forEach(function(i,s,u){var a=t(i,s,u),h=e.get(a,ue);h===ue&&(h=Array(r?n.length:0),e.set(a,h)),r?h[s]=i:h.push(i)})});return i.map(function(t){return G(t)})},sortBy:function(t,e,r){var n=F.superCall(this,Y.prototype,"sortBy",[t,e]);return r||(n=n.values()),n.length=this.length,n},__makeSequence:function(){return i(this)}},{},G);var Z=X.prototype;Z.__toJS=Z.toArray,Z.__toStringMapper=p;var $=function(t){var e=Object.keys(t);this._object=t,this._keys=e,this.length=e.length};F.createClass($,{toObject:function(){return this._object},get:function(t,e){return void 0===e||this.has(t)?this._object[t]:e},has:function(t){return this._object.hasOwnProperty(t)},__iterate:function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,s=0;i>=s;s++){var u=e?i-s:s;if(t(r[n[u]],n[u],r)===!1)break}return s}},{},G);var te=function(t){this._array=t,this.length=t.length};F.createClass(te,{toArray:function(){return this._array},__iterate:function(t,e,r){var n=this._array,i=n.length-1,s=-1;if(e){for(var u=i;u>=0;u--){if(n.hasOwnProperty(u)&&t(n[u],r?u:i-u,n)===!1)return s+1;s=u}return n.length}var a=n.every(function(e,u){return t(e,r?i-u:u,n)===!1?!1:(s=u,!0)
});return a?n.length:s+1}},{},X),te.prototype.get=$.prototype.get,te.prototype.has=$.prototype.has;var ee=function(t,e,r){this._rootData=t,this._keyPath=e,this._onChange=r},re=ee;F.createClass(ee,{get:function(t,e){var r=this._rootData.getIn(this._keyPath,ae.empty());return t?r.get(t,e):r},set:function(t,e){return O(this,function(r){return r.set(t,e)},t)},"delete":function(t){return O(this,function(e){return e.delete(t)},t)},update:function(t,e){var r;return"function"==typeof t?(r=t,t=void 0):r=function(r){return r.update(t,e)},O(this,r,t)},cursor:function(t){return t&&!Array.isArray(t)&&(t=[t]),t&&0!==t.length?new re(this._rootData,this._keyPath?this._keyPath.concat(t):t,this._onChange):this}},{});var ne=5,ie=1<<ne,se=ie-1,ue={},ae=function(t){return t&&t.constructor===he?t:t&&0!==t.length?he.empty().merge(t):he.empty()},he=ae;F.createClass(ae,{toString:function(){return this.__toString("Map {","}")},get:function(t,e){return null==t||null==this._root?e:this._root.get(0,A(t),t,e)},set:function(t,e){if(null==t)return this;var r,n=this.length;if(this._root){var i=D();r=this._root.set(this.__ownerID,0,A(t),t,e,i),i.value&&n++}else n++,r=M(this.__ownerID,0,A(t),t,e);return this.__ownerID?(this.length=n,this._root=r,this):r===this._root?this:b(n,r)},"delete":function(t){if(null==t||null==this._root)return this;if(this.__ownerID){var e=D();return this._root=this._root.delete(this.__ownerID,0,A(t),t,e),e.value&&this.length--,this}var r=this._root.delete(this.__ownerID,0,A(t),t);return r?r===this._root?this:b(this.length-1,r):he.empty()},update:function(t,e){return this.set(t,e(this.get(t)))},clear:function(){return this.__ownerID?(this.length=0,this._root=null,this):he.empty()},merge:function(){return S(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return S(this,t,e)},mergeDeep:function(){return S(this,x(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return S(this,x(t),e)},updateIn:function(t,e){return t&&0!==t.length?C(this,t,e,0):e(this)
},cursor:function(t,e){return e||"function"!=typeof t||(e=t,t=null),t&&!Array.isArray(t)&&(t=[t]),new ee(this,t,e)},withMutations:function(t){var e=this.asMutable();return t(e),e.__ensureOwner(this.__ownerID)},asMutable:function(){return this.__ownerID?this:this.__ensureOwner(new k)},asImmutable:function(){return this.__ensureOwner()},__iterate:function(t,e){return this._root?this._root.iterate(this,t,e):0},__deepEqual:function(t){var e=this;return t.every(function(t,r){return w(e.get(r,ue),t)})},__ensureOwner:function(t){return t===this.__ownerID?this:t?b(this.length,this._root,t):(this.__ownerID=t,this)}},{empty:function(){return ve||(ve=b(0))}},G);var oe=ae.prototype;ae.from=ae;var le=function(t,e,r,n){this.ownerID=t,this.bitmap=e,this.keys=r,this.values=n},ce=le;F.createClass(le,{get:function(t,e,r,n){var i=e>>>t&se;if(0===(this.bitmap&1<<i))return n;var s=this.keys[i],u=this.values[i];return null==s?u.get(t+ne,e,r,n):r===s?u:n},set:function(t,e,r,n,i,s){var u,a=r>>>e&se,h=1<<a;if(0===(this.bitmap&h))return s&&(s.value=!0),u=this.ensureOwner(t),u.keys[a]=n,u.values[a]=i,u.bitmap|=h,u;var o,l=this.keys[a],c=this.values[a];if(null==l)return o=c.set(t,e+ne,r,n,i,s),o===c?this:(u=this.ensureOwner(t),u.values[a]=o,u);if(n===l)return i===c?this:(u=this.ensureOwner(t),u.values[a]=i,u);var f=A(l);return o=r===f?new fe(t,r,[l,n],[c,i]):M(t,e+ne,f,l,c).set(t,e+ne,r,n,i),s&&(s.value=!0),u=this.ensureOwner(t),delete u.keys[a],u.values[a]=o,u},"delete":function(t,e,r,n,i){var s,u=r>>>e&se,a=1<<u,h=this.keys[u];if(0===(this.bitmap&a)||null!=h&&n!==h)return this;if(null==h){var o=this.values[u],l=o.delete(t,e+ne,r,n,i);if(l===o)return this;if(l)return s=this.ensureOwner(t),s.values[u]=l,s}else i&&(i.value=!0);return this.bitmap===a?null:(s=this.ensureOwner(t),delete s.keys[u],delete s.values[u],s.bitmap^=a,s)},ensureOwner:function(t){return t&&t===this.ownerID?this:new ce(t,this.bitmap,this.keys.slice(),this.values.slice())},iterate:function(t,e,r){for(var n=this.values,i=this.keys,s=n.length,u=0;s>=u;u++){var a=r?s-u:u,h=i[a],o=n[a];
if(null!=h){if(e(o,h,t)===!1)return!1}else if(o&&!o.iterate(t,e,r))return!1}return!0}},{});var fe=function(t,e,r,n){this.ownerID=t,this.collisionHash=e,this.keys=r,this.values=n},_e=fe;F.createClass(fe,{get:function(t,e,r,n){var i=G(this.keys).indexOf(r);return-1===i?n:this.values[i]},set:function(t,e,r,n,i,s){if(r!==this.collisionHash)return s&&(s.value=!0),M(t,e,this.collisionHash,null,this).set(t,e,r,n,i);var u=G(this.keys).indexOf(n);if(u>=0&&this.values[u]===i)return this;var a=this.ensureOwner(t);return-1===u?(a.keys.push(n),a.values.push(i),s&&(s.value=!0)):a.values[u]=i,a},"delete":function(t,e,r,n,i){var s=this.keys.indexOf(n);if(-1===s)return this;if(i&&(i.value=!0),this.values.length>1){var u=this.ensureOwner(t);return u.keys[s]=u.keys.pop(),u.values[s]=u.values.pop(),u}},ensureOwner:function(t){return t&&t===this.ownerID?this:new _e(t,this.collisionHash,this.keys.slice(),this.values.slice())},iterate:function(t,e,r){for(var n=this.values,i=this.keys,s=n.length-1,u=0;s>=u;u++){var a=r?s-u:u;if(e(n[a],i[a],t)===!1)return!1}return!0}},{});var ve,ge={value:!1},pe=4294967296,me=255,ye=0,de={},we=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Ie.from(t)},Ie=we;F.createClass(we,{toString:function(){return this.__toString("Vector [","]")},get:function(t,e){if(t=R(t,this._origin),t>=this._size)return e;var r=P(this,t),n=t&se;return r&&(void 0===e||r.array.hasOwnProperty(n))?r.array[n]:e},first:function(){return this.get(0)},last:function(){return this.get(this.length?this.length-1:0)},set:function(t,e){var r=W(this._size);if(t>=this.length)return this.withMutations(function(r){return U(r,0,t+1).set(t,e)});if(this.get(t,ue)===e)return this;if(t=R(t,this._origin),t>=r){var n=this._tail.ensureOwner(this.__ownerID);n.array[t&se]=e;var i=t>=this._size?t+1:this._size;return this.__ownerID?(this.length=i-this._origin,this._size=i,this._tail=n,this):j(this._origin,i,this._level,this._root,n)}for(var s=this._root.ensureOwner(this.__ownerID),u=s,a=this._level;a>0;a-=ne){var h=t>>>a&se;u=u.array[h]=u.array[h]?u.array[h].ensureOwner(this.__ownerID):new ke([],this.__ownerID)
}return u.array[t&se]=e,this.__ownerID?(this._root=s,this):j(this._origin,this._size,this._level,s,this._tail)},"delete":function(t){if(!this.has(t))return this;var e=W(this._size);if(t=R(t,this._origin),t>=e){var r=this._tail.ensureOwner(this.__ownerID);return delete r.array[t&se],this.__ownerID?(this._tail=r,this):j(this._origin,this._size,this._level,this._root,r)}for(var n=this._root.ensureOwner(this.__ownerID),i=n,s=this._level;s>0;s-=ne){var u=t>>>s&se;i=i.array[u]=i.array[u].ensureOwner(this.__ownerID)}return delete i.array[t&se],this.__ownerID?(this._root=n,this):j(this._origin,this._size,this._level,n,this._tail)},clear:function(){return this.__ownerID?(this.length=this._origin=this._size=0,this._level=ne,this._root=this._tail=Se,this):Ie.empty()},push:function(){var t=arguments,e=this.length;return this.withMutations(function(r){U(r,0,e+t.length);for(var n=0;t.length>n;n++)r.set(e+n,t[n])})},pop:function(){return U(this,0,-1)},unshift:function(){var t=arguments;return this.withMutations(function(e){U(e,-t.length);for(var r=0;t.length>r;r++)e.set(r,t[r])})},shift:function(){return U(this,1)},merge:function(){return z(this,null,arguments)},mergeWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return z(this,t,e)},mergeDeep:function(){return z(this,x(null),arguments)},mergeDeepWith:function(t){for(var e=[],r=1;arguments.length>r;r++)e[r-1]=arguments[r];return z(this,x(t),e)},setLength:function(t){return U(this,0,t)},slice:function(t,e,r){var n=F.superCall(this,Ie.prototype,"slice",[t,e,r]);if(!r&&n!==this){var i=this,s=i.length;n.toVector=function(){return U(i,0>t?Math.max(0,s+t):s?Math.min(s,t):t,null==e?s:0>e?Math.max(0,s+e):s?Math.min(s,e):e)}}return n},iterator:function(){return new be(this,this._origin,this._size,this._level,this._root,this._tail)},__iterate:function(t,e,r){var n=this,i=0,s=n.length-1;r^=e;var u,a=function(e,u){return t(e,r?s-u:u,n)===!1?!1:(i=u,!0)},h=W(this._size);return u=e?this._tail.iterate(0,h-this._origin,this._size-this._origin,a,e)&&this._root.iterate(this._level,-this._origin,h-this._origin,a,e):this._root.iterate(this._level,-this._origin,h-this._origin,a,e)&&this._tail.iterate(0,h-this._origin,this._size-this._origin,a,e),(u?s:e?s-i:i)+1
},__deepEquals:function(t){var e=this.iterator();return t.every(function(t,r){var n=e.next().value;return n&&r===n[0]&&w(t,n[1])})},__ensureOwner:function(t){return t===this.__ownerID?this:t?j(this._origin,this._size,this._level,this._root,this._tail,t):(this.__ownerID=t,this)}},{empty:function(){return Me||(Me=j(0,0,ne,Se,Se))},from:function(t){if(t&&t.constructor===Ie)return t;if(!t||0===t.length)return Ie.empty();var e=Array.isArray(t);return t.length>0&&ie>t.length?j(0,t.length,ne,Se,new ke(e?t.slice():G(t).toArray())):(e||(t=G(t),t instanceof X||(t=t.values())),Ie.empty().merge(t))}},X);var Oe=we.prototype;Oe["@@iterator"]=Oe.__iterator__,Oe.update=oe.update,Oe.updateIn=oe.updateIn,Oe.cursor=oe.cursor,Oe.withMutations=oe.withMutations,Oe.asMutable=oe.asMutable,Oe.asImmutable=oe.asImmutable;var ke=function(t,e){this.array=t,this.ownerID=e},De=ke;F.createClass(ke,{ensureOwner:function(t){return t&&t===this.ownerID?this:new De(this.array.slice(),t)},removeBefore:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r>>>e&se;if(n>=this.array.length)return new De([],t);var i,s=0===n;if(e>0){var u=this.array[n];if(i=u&&u.removeBefore(t,e-ne,r),i===u&&s)return this}if(s&&!i)return this;var a=this.ensureOwner();if(!s)for(var h=0;n>h;h++)delete a.array[h];return i&&(a.array[n]=i),a},removeAfter:function(t,e,r){if(r===e?1<<e:0||0===this.array.length)return this;var n=r-1>>>e&se;if(n>=this.array.length)return this;var i,s=n===this.array.length-1;if(e>0){var u=this.array[n];if(i=u&&u.removeAfter(t,e-ne,r),i===u&&s)return this}if(s&&!i)return this;var a=this.ensureOwner();return s||(a.array.length=n+1),i&&(a.array[n]=i),a},iterate:function(t,e,r,n,i){if(0===t){if(i){for(var s=this.array.length-1;s>=0;s--)if(this.array.hasOwnProperty(s)){var u=s+e;if(u>=0&&r>u&&n(this.array[s],u)===!1)return!1}return!0}return this.array.every(function(t,i){var s=i+e;return 0>s||s>=r||n(t,s)!==!1})}var a=1<<t,h=t-ne;if(i){for(var o=this.array.length-1;o>=0;o--){var l=e+o*a;if(r>l&&l+a>0&&this.array.hasOwnProperty(o)&&!this.array[o].iterate(h,l,r,n,i))return!1
}return!0}return this.array.every(function(t,s){var u=e+s*a;return u>=r||0>=u+a||t.iterate(h,u,r,n,i)})}},{});var be=function(t,e,r,n,i,s){var u=W(r);this._stack={node:i.array,level:n,offset:-e,max:u-e,__prev:{node:s.array,level:0,offset:u-e,max:r-e}}};F.createClass(be,{next:function(){var t=this._stack;t:for(;t;){if(0===t.level)for(t.rawIndex||(t.rawIndex=0);t.node.length>t.rawIndex;){var e=t.rawIndex+t.offset;if(e>=0&&t.max>e&&t.node.hasOwnProperty(t.rawIndex)){var r=t.node[t.rawIndex];return t.rawIndex++,{value:[e,r],done:!0}}t.rawIndex++}else{var n=1<<t.level;for(t.levelIndex||(t.levelIndex=0);t.node.length>t.levelIndex;){var i=t.offset+t.levelIndex*n;if(i+n>0&&t.max>i&&t.node.hasOwnProperty(t.levelIndex)){var s=t.node[t.levelIndex].array;t.levelIndex++,t=this._stack={node:s,level:t.level-ne,offset:i,max:t.max,__prev:t};continue t}t.levelIndex++}}t=this._stack=this._stack.__prev}return{done:!0}}},{});var Me,Se=new ke([]),xe=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return Ee.from(t)},Ee=xe;F.createClass(xe,{toString:function(){return this.__toString("Set {","}")},has:function(t){return this._map?this._map.has(t):!1},get:function(t,e){return this.has(t)?t:e},add:function(t){if(null==t)return this;var e=this._map;return e||(e=ae.empty().__ensureOwner(this.__ownerID)),e=e.set(t,null),this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:J(e)},"delete":function(t){if(null==t||null==this._map)return this;var e=this._map.delete(t);return 0===e.length?this.clear():this.__ownerID?(this.length=e.length,this._map=e,this):e===this._map?this:J(e)},clear:function(){return this.__ownerID?(this.length=0,this._map=null,this):Ee.empty()},union:function(){var t=arguments;return 0===t.length?this:this.withMutations(function(e){for(var r=0;t.length>r;r++){var n=t[r];n=n.forEach?n:G(n),n.forEach(function(t){return e.add(t)})}})},intersect:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return G(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.every(function(t){return t.contains(r)
})||e.delete(r)})})},subtract:function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];if(0===t.length)return this;t=t.map(function(t){return G(t)});var r=this;return this.withMutations(function(e){r.forEach(function(r){t.some(function(t){return t.contains(r)})&&e.delete(r)})})},isSubset:function(t){return t=G(t),this.every(function(e){return t.contains(e)})},isSuperset:function(t){var e=this;return t=G(t),t.every(function(t){return e.contains(t)})},__iterate:function(t,e){var r=this;return this._map?this._map.__iterate(function(e,n){return t(n,n,r)},e):0},__deepEquals:function(t){return!(this._map||t._map)||this._map.equals(t._map)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?J(e,t):(this.__ownerID=t,this._map=e,this)}},{empty:function(){return Ae||(Ae=J())},from:function(t){return t&&t.constructor===Ee?t:t&&0!==t.length?Ee.empty().union(t):Ee.empty()},fromKeys:function(t){return Ee.from(G(t).flip())}},G);var Ce=xe.prototype;Ce.contains=Ce.has,Ce.withMutations=ae.prototype.withMutations,Ce.asMutable=ae.prototype.asMutable,Ce.asImmutable=ae.prototype.asImmutable,Ce.__toJS=X.prototype.__toJS,Ce.__toStringMapper=X.prototype.__toStringMapper;var Ae,qe=function(t){return t&&t.constructor===je?t:t&&0!==t.length?je.empty().merge(t):je.empty()},je=qe;F.createClass(qe,{toString:function(){return this.__toString("OrderedMap {","}")},get:function(t,e){if(null!=t&&this._map){var r=this._map.get(t);if(null!=r)return this._vector.get(r)[1]}return e},clear:function(){return this.__ownerID?(this.length=0,this._map=this._vector=null,this):je.empty()},set:function(t,e){if(null==t)return this;var r=this._map,n=this._vector;if(r){var i=r.get(t);null==i?(r=r.set(t,n.length),n=n.push([t,e])):n.get(i)[1]!==e&&(n=n.set(i,[t,e]))}else n=we.empty().__ensureOwner(this.__ownerID).set(0,[t,e]),r=ae.empty().__ensureOwner(this.__ownerID).set(t,0);return this.__ownerID?(this.length=r.length,this._map=r,this._vector=n,this):n===this._vector?this:B(r,n)},"delete":function(t){if(null==t||null==this._map)return this;
var e=this._map.get(t);if(null==e)return this;var r=this._map.delete(t),n=this._vector.delete(e);return 0===r.length?this.clear():this.__ownerID?(this.length=r.length,this._map=r,this._vector=n,this):r===this._map?this:B(r,n)},__iterate:function(t,e){return this._vector?this._vector.fromEntries().__iterate(t,e):0},__deepEqual:function(t){var e=this._vector.__iterator__();return t.every(function(t,r){var n=e.next();return n&&(n=n[1]),n&&w(r,n[0])&&w(t,n[1])})},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t),r=this._vector&&this._vector.__ensureOwner(t);return t?B(e,r,t):(this.__ownerID=t,this._map=e,this._vector=r,this)}},{empty:function(){return Pe||(Pe=B())}},ae),qe.from=qe;var Pe,Ue=function(t,e){var r=function(t){this._map=ae(t)};t=G(t);var n=r.prototype=Object.create(Re);n.constructor=r,n._name=e,n._defaultValues=t;var i=Object.keys(t);return r.prototype.length=i.length,Object.defineProperty&&t.forEach(function(t,e){Object.defineProperty(r.prototype,e,{get:function(){return this.get(e)},set:function(t){I(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}),r},ze=Ue;F.createClass(Ue,{toString:function(){return this.__toString((this._name||"Record")+" {","}")},has:function(t){return this._defaultValues.has(t)},get:function(t,e){return void 0===e||this.has(t)?this._map.get(t,this._defaultValues.get(t)):e},clear:function(){if(this.__ownerID)return this._map.clear(),this;Object.getPrototypeOf(this).constructor;return ze._empty||(ze._empty=L(this,ae.empty()))},set:function(t,e){if(null==t||!this.has(t))return this;var r=this._map.set(t,e);return this.__ownerID||r===this._map?this:L(this,r)},"delete":function(t){if(null==t||!this.has(t))return this;var e=this._map.delete(t);return this.__ownerID||e===this._map?this:L(this,e)},__iterate:function(t,e){var r=this;return this._defaultValues.map(function(t,e){return r.get(e)}).__iterate(t,e)},__ensureOwner:function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?L(this,e,t):(this.__ownerID=t,this._map=e,this)
}},{},G);var Re=Ue.prototype;Re.__deepEqual=oe.__deepEqual,Re.merge=oe.merge,Re.mergeWith=oe.mergeWith,Re.mergeDeep=oe.mergeDeep,Re.mergeDeepWith=oe.mergeDeepWith,Re.update=oe.update,Re.updateIn=oe.updateIn,Re.cursor=oe.cursor,Re.withMutations=oe.withMutations,Re.asMutable=oe.asMutable,Re.asImmutable=oe.asImmutable;var We=function(t,e,r){return this instanceof Je?(I(0!==r,"Cannot step a Range by 0"),t=t||0,null==e&&(e=1/0),t===e&&Le?Le:(r=null==r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,void(this.length=Math.max(0,Math.ceil((e-t)/r-1)+1)))):new Je(t,e,r)},Je=We;F.createClass(We,{toString:function(){return 0===this.length?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},has:function(t){return I(t>=0,"Index out of bounds"),this.length>t},get:function(t,e){return I(t>=0,"Index out of bounds"),1/0===this.length||this.length>t?this._start+t*this._step:e},contains:function(t){var e=(t-this._start)/this._step;return e>=0&&this.length>e&&e===Math.floor(e)},slice:function(t,e,r){return u(t,e,this.length)?this:r?F.superCall(this,Je.prototype,"slice",[t,e,r]):(t=a(t,this.length),e=h(e,this.length),t>=e?Le:new Je(this.get(t,this._end),this.get(e,this._end),this._step))},indexOf:function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;if(r>=0&&this.length>r)return r}return-1},lastIndexOf:function(t){return this.indexOf(t)},take:function(t){return this.slice(0,t)},skip:function(t,e){return e?F.superCall(this,Je.prototype,"skip",[t]):this.slice(t)},__iterate:function(t,e,r){for(var n=e^r,i=this.length-1,s=this._step,u=e?this._start+i*s:this._start,a=0;i>=a&&t(u,n?i-a:a,this)!==!1;a++)u+=e?-s:s;return n?this.length:a},__deepEquals:function(t){return this._start===t._start&&this._end===t._end&&this._step===t._step}},{},X);var Be=We.prototype;Be.__toJS=Be.toArray,Be.first=Oe.first,Be.last=Oe.last;var Le=We(0,0),Ve=function(t,e){return 0===e&&Ne?Ne:this instanceof Ke?(this._value=t,void(this.length=null==e?1/0:Math.max(0,e))):new Ke(t,e)},Ke=Ve;F.createClass(Ve,{toString:function(){return 0===this.length?"Repeat []":"Repeat [ "+this._value+" "+this.length+" times ]"
},get:function(t,e){return I(t>=0,"Index out of bounds"),1/0===this.length||this.length>t?this._value:e},first:function(){return this._value},contains:function(t){return w(this._value,t)},slice:function(t,e,r){if(r)return F.superCall(this,Ke.prototype,"slice",[t,e,r]);var n=this.length;return t=0>t?Math.max(0,n+t):Math.min(n,t),e=null==e?n:e>0?Math.min(n,e):Math.max(0,n+e),e>t?new Ke(this._value,e-t):Ne},reverse:function(t){return t?F.superCall(this,Ke.prototype,"reverse",[t]):this},indexOf:function(t){return w(this._value,t)?0:-1},lastIndexOf:function(t){return w(this._value,t)?this.length:-1},__iterate:function(t,e,r){var n=e^r;I(!n||1/0>this.length,"Cannot access end of infinite range.");for(var i=this.length-1,s=0;i>=s&&t(this._value,n?i-s:s,this)!==!1;s++);return n?this.length:s},__deepEquals:function(t){return w(this._value,t._value)}},{},X);var He=Ve.prototype;He.last=He.first,He.has=Be.has,He.take=Be.take,He.skip=Be.skip,He.__toJS=Be.__toJS;var Ne=new Ve(void 0,0),Fe={Sequence:G,Map:ae,Vector:we,Set:xe,OrderedMap:qe,Record:Ue,Range:We,Repeat:Ve,is:w,fromJS:V};return Fe}"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):Immutable=t();
{
"name": "immutable",
"version": "2.0.10",
"version": "2.0.11",
"description": "Immutable Data Collections",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/facebook/immutable-js",

@@ -62,7 +62,8 @@ Immutable Data Collections

(Because of TypeScript 1.0's issue with NodeJS module resolution, you must
require the full file path)
Just add a reference with a relative path to the type declarations at the top
of your file.
```javascript
import Immutable = require('./node_modules/immutable/dist/Immutable');
///<reference path='./node_modules/immutable/dist/Immutable.d.ts'/>
import Immutable = require('Immutable');
var map: Immutable.Map<string, number>;

@@ -298,3 +299,3 @@ map = Immutable.Map({a:1, b:2, c:3});

aware of changes to the entire data structure: an `onChange` function which is
called whenever a cursor or subcursor is `update`d.
called whenever a cursor or sub-cursor calls `update`.

@@ -301,0 +302,0 @@ This is particularly useful when used in conjuction with component-based UI

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc