Socket
Socket
Sign inDemoInstall

js-sdsl

Package Overview
Dependencies
0
Maintainers
2
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.2.0 to 4.3.0

10

CHANGELOG.md

@@ -7,2 +7,12 @@ # Change Log

## [4.3.0] - 2023.01.20
### Added
- Add public member `container` to `Iterator` which means the container that the iterator pointed to.
### Changed
- Reimplement `Queue`, separate `Queue` from `Deque`.
## [4.2.0] - 2022.11.20

@@ -9,0 +19,0 @@

16

dist/cjs/container/ContainerBase/index.d.ts

@@ -10,2 +10,6 @@ /**

/**
* @description The container pointed to by the iterator.
*/
abstract readonly container: Container<T>;
/**
* @description Iterator's type.

@@ -199,10 +203,6 @@ * @example

*/
export declare type initContainer<T> = ({
size: number;
} | {
length: number;
} | {
size(): number;
}) & {
forEach(callback: (element: T) => void): void;
export declare type initContainer<T> = {
size?: number | (() => number);
length?: number;
forEach: (callback: (el: T) => void) => void;
};
import { Container, ContainerIterator } from "../../ContainerBase";
export declare type HashLinkNode<K, V> = {
_key: K;
_value: V;
_pre: HashLinkNode<K, V>;
_next: HashLinkNode<K, V>;
};
export declare abstract class HashContainerIterator<K, V> extends ContainerIterator<K | [K, V]> {
abstract readonly container: HashContainer<K, V>;
pre(): this;

@@ -4,0 +11,0 @@ next(): this;

@@ -72,3 +72,3 @@ "use strict";

}
K(t) {
V(t) {
const {L: e, B: i} = t;

@@ -164,3 +164,3 @@ e.B = i;

}
this.K(i);
this.V(i);
return true;

@@ -173,3 +173,3 @@ }

}
this.K(e);
this.V(e);
return t.next();

@@ -185,3 +185,3 @@ }

}
this.K(e);
this.V(e);
return this.i;

@@ -188,0 +188,0 @@ }

@@ -1,4 +0,6 @@

import { initContainer } from "../ContainerBase";
import { HashContainer, HashContainerIterator } from "./Base";
import { initContainer, IteratorType } from "../ContainerBase";
import { HashContainer, HashContainerIterator, HashLinkNode } from "./Base";
declare class HashMapIterator<K, V> extends HashContainerIterator<K, V> {
readonly container: HashMap<K, V>;
constructor(node: HashLinkNode<K, V>, header: HashLinkNode<K, V>, container: HashMap<K, V>, iteratorType?: IteratorType);
get pointer(): [K, V];

@@ -27,9 +29,2 @@ copy(): HashMapIterator<K, V>;

/**
* @description Check key if exist in container.
* @param key - The element you want to search.
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
* If a `undefined` value is passed in, the type will be automatically judged.
* @returns An iterator pointing to the element if found, or super end if not found.
*/
/**
* @description Get the value of the element of the specified key.

@@ -44,2 +39,9 @@ * @param key - The key want to search.

getElementByPos(pos: number): [K, V];
/**
* @description Check key if exist in container.
* @param key - The element you want to search.
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
* If a `undefined` value is passed in, the type will be automatically judged.
* @returns An iterator pointing to the element if found, or super end if not found.
*/
find(key: K, isObject?: boolean): HashMapIterator<K, V>;

@@ -46,0 +48,0 @@ forEach(callback: (element: [K, V], index: number, hashMap: HashMap<K, V>) => void): void;

@@ -22,2 +22,6 @@ "use strict";

class HashMapIterator extends _Base.HashContainerIterator {
constructor(t, e, r, s) {
super(t, e, s);
this.container = r;
}
get pointer() {

@@ -42,3 +46,3 @@ if (this.o === this.h) {

copy() {
return new HashMapIterator(this.o, this.h, this.iteratorType);
return new HashMapIterator(this.o, this.h, this.container, this.iteratorType);
}

@@ -56,12 +60,12 @@ }

begin() {
return new HashMapIterator(this.p, this.h);
return new HashMapIterator(this.p, this.h, this);
}
end() {
return new HashMapIterator(this.h, this.h);
return new HashMapIterator(this.h, this.h, this);
}
rBegin() {
return new HashMapIterator(this._, this.h, 1);
return new HashMapIterator(this._, this.h, this, 1);
}
rEnd() {
return new HashMapIterator(this.h, this.h, 1);
return new HashMapIterator(this.h, this.h, this, 1);
}

@@ -100,3 +104,3 @@ front() {

const r = this.I(t, e);
return new HashMapIterator(r, this.h);
return new HashMapIterator(r, this.h, this);
}

@@ -103,0 +107,0 @@ forEach(t) {

@@ -1,7 +0,9 @@

import { initContainer } from "../ContainerBase";
import { HashContainer, HashContainerIterator } from "./Base";
declare class HashSetIterator<K, V> extends HashContainerIterator<K, V> {
import { initContainer, IteratorType } from "../ContainerBase";
import { HashContainer, HashContainerIterator, HashLinkNode } from "./Base";
declare class HashSetIterator<K> extends HashContainerIterator<K, undefined> {
readonly container: HashSet<K>;
constructor(node: HashLinkNode<K, undefined>, header: HashLinkNode<K, undefined>, container: HashSet<K>, iteratorType?: IteratorType);
get pointer(): K;
copy(): HashSetIterator<K, V>;
equals(iter: HashSetIterator<K, V>): boolean;
copy(): HashSetIterator<K>;
equals(iter: HashSetIterator<K>): boolean;
}

@@ -11,6 +13,6 @@ export type { HashSetIterator };

constructor(container?: initContainer<K>);
begin(): HashSetIterator<K, undefined>;
end(): HashSetIterator<K, undefined>;
rBegin(): HashSetIterator<K, undefined>;
rEnd(): HashSetIterator<K, undefined>;
begin(): HashSetIterator<K>;
end(): HashSetIterator<K>;
rBegin(): HashSetIterator<K>;
rEnd(): HashSetIterator<K>;
front(): K | undefined;

@@ -34,3 +36,3 @@ back(): K | undefined;

*/
find(key: K, isObject?: boolean): HashSetIterator<K, undefined>;
find(key: K, isObject?: boolean): HashSetIterator<K>;
forEach(callback: (element: K, index: number, container: HashSet<K>) => void): void;

@@ -37,0 +39,0 @@ [Symbol.iterator](): Generator<K, void, unknown>;

@@ -14,2 +14,6 @@ "use strict";

class HashSetIterator extends _Base.HashContainerIterator {
constructor(t, e, r, s) {
super(t, e, s);
this.container = r;
}
get pointer() {

@@ -22,3 +26,3 @@ if (this.o === this.h) {

copy() {
return new HashSetIterator(this.o, this.h, this.iteratorType);
return new HashSetIterator(this.o, this.h, this.container, this.iteratorType);
}

@@ -36,12 +40,12 @@ }

begin() {
return new HashSetIterator(this.p, this.h);
return new HashSetIterator(this.p, this.h, this);
}
end() {
return new HashSetIterator(this.h, this.h);
return new HashSetIterator(this.h, this.h, this);
}
rBegin() {
return new HashSetIterator(this._, this.h, 1);
return new HashSetIterator(this._, this.h, this, 1);
}
rEnd() {
return new HashSetIterator(this.h, this.h, 1);
return new HashSetIterator(this.h, this.h, this, 1);
}

@@ -69,3 +73,3 @@ front() {

const r = this.I(t, e);
return new HashSetIterator(r, this.h);
return new HashSetIterator(r, this.h, this);
}

@@ -72,0 +76,0 @@ forEach(t) {

@@ -11,32 +11,37 @@ "use strict";

var _Deque = _interopRequireDefault(require("../SequentialContainer/Deque"));
function _interopRequireDefault(e) {
return e && e.t ? e : {
default: e
};
}
class Queue extends _ContainerBase.Base {
constructor(e = []) {
constructor(t = []) {
super();
this.q = new _Deque.default(e);
this.i = this.q.size();
this.j = 0;
this.q = [];
const s = this;
t.forEach((function(t) {
s.push(t);
}));
}
clear() {
this.q.clear();
this.i = 0;
this.q = [];
this.i = this.j = 0;
}
push(e) {
this.q.pushBack(e);
this.i += 1;
return this.i;
push(t) {
const s = this.q.length;
if (this.j / s > .5 && this.j + this.i >= s && s > 4096) {
const s = this.i;
for (let t = 0; t < s; ++t) {
this.q[t] = this.q[this.j + t];
}
this.j = 0;
this.q[this.i] = t;
} else this.q[this.j + this.i] = t;
return ++this.i;
}
pop() {
if (this.i === 0) return;
const t = this.q[this.j++];
this.i -= 1;
return this.q.popFront();
return t;
}
front() {
return this.q.front();
if (this.i === 0) return;
return this.q[this.j];
}

@@ -43,0 +48,0 @@ }

import { ContainerIterator } from "../../ContainerBase";
import SequentialContainer from "./index";
export declare abstract class RandomIterator<T> extends ContainerIterator<T> {
abstract readonly container: SequentialContainer<T>;
get pointer(): T;

@@ -4,0 +6,0 @@ set pointer(newValue: T);

@@ -14,8 +14,5 @@ "use strict";

class RandomIterator extends _ContainerBase.ContainerIterator {
constructor(t, r, i, s, h) {
super(h);
constructor(t, r) {
super(r);
this.o = t;
this.D = r;
this.R = i;
this.N = s;
if (this.iteratorType === 0) {

@@ -30,3 +27,3 @@ this.pre = function() {

this.next = function() {
if (this.o === this.D()) {
if (this.o === this.container.size()) {
(0, _throwError.throwIteratorAccessError)();

@@ -39,3 +36,3 @@ }

this.pre = function() {
if (this.o === this.D() - 1) {
if (this.o === this.container.size() - 1) {
(0, _throwError.throwIteratorAccessError)();

@@ -56,12 +53,6 @@ }

get pointer() {
if (this.o < 0 || this.o > this.D() - 1) {
throw new RangeError;
}
return this.R(this.o);
return this.container.getElementByPos(this.o);
}
set pointer(t) {
if (this.o < 0 || this.o > this.D() - 1) {
throw new RangeError;
}
this.N(this.o, t);
this.container.setElementByPos(this.o, t);
}

@@ -68,0 +59,0 @@ }

import SequentialContainer from './Base';
import { initContainer } from "../ContainerBase";
import { IteratorType, initContainer } from "../ContainerBase";
import { RandomIterator } from "./Base/RandomIterator";
declare class DequeIterator<T> extends RandomIterator<T> {
readonly container: Deque<T>;
constructor(node: number, container: Deque<T>, iteratorType?: IteratorType);
copy(): DequeIterator<T>;

@@ -6,0 +8,0 @@ equals(iter: DequeIterator<T>): boolean;

@@ -20,4 +20,8 @@ "use strict";

class DequeIterator extends _RandomIterator.RandomIterator {
constructor(t, i, s) {
super(t, s);
this.container = i;
}
copy() {
return new DequeIterator(this.o, this.D, this.R, this.N, this.iteratorType);
return new DequeIterator(this.o, this.container, this.iteratorType);
}

@@ -27,30 +31,24 @@ }

class Deque extends _Base.default {
constructor(t = [], s = 1 << 12) {
constructor(t = [], i = 1 << 12) {
super();
this.j = 0;
this.D = 0;
this.R = 0;
this.N = 0;
this.P = 0;
this.A = 0;
this.F = 0;
this.j = 0;
this.O = 0;
this.T = [];
let i;
if ("size" in t) {
if (typeof t.size === "number") {
i = t.size;
} else {
i = t.size();
}
} else if ("length" in t) {
i = t.length;
} else {
throw new RangeError("Can't get container's size!");
this.A = [];
const s = (() => {
if (typeof t.length === "number") return t.length;
if (typeof t.size === "number") return t.size;
if (typeof t.size === "function") return t.size();
throw new TypeError("Cannot get the length or size of the container");
})();
this.F = i;
this.P = Math.max(Math.ceil(s / this.F), 1);
for (let t = 0; t < this.P; ++t) {
this.A.push(new Array(this.F));
}
this.V = s;
this.O = Math.max(Math.ceil(i / this.V), 1);
for (let t = 0; t < this.O; ++t) {
this.T.push(new Array(this.V));
}
const h = Math.ceil(i / this.V);
this.P = this.F = (this.O >> 1) - (h >> 1);
this.A = this.j = this.V - i % this.V >> 1;
const h = Math.ceil(s / this.F);
this.j = this.R = (this.P >> 1) - (h >> 1);
this.D = this.N = this.F - s % this.F >> 1;
const e = this;

@@ -60,35 +58,32 @@ t.forEach((function(t) {

}));
this.size = this.size.bind(this);
this.getElementByPos = this.getElementByPos.bind(this);
this.setElementByPos = this.setElementByPos.bind(this);
}
G() {
T() {
const t = [];
const s = Math.max(this.O >> 1, 1);
for (let i = 0; i < s; ++i) {
t[i] = new Array(this.V);
const i = Math.max(this.P >> 1, 1);
for (let s = 0; s < i; ++s) {
t[s] = new Array(this.F);
}
for (let s = this.P; s < this.O; ++s) {
t[t.length] = this.T[s];
for (let i = this.j; i < this.P; ++i) {
t[t.length] = this.A[i];
}
for (let s = 0; s < this.F; ++s) {
t[t.length] = this.T[s];
for (let i = 0; i < this.R; ++i) {
t[t.length] = this.A[i];
}
t[t.length] = [ ...this.T[this.F] ];
this.P = s;
this.F = t.length - 1;
for (let i = 0; i < s; ++i) {
t[t.length] = new Array(this.V);
t[t.length] = [ ...this.A[this.R] ];
this.j = i;
this.R = t.length - 1;
for (let s = 0; s < i; ++s) {
t[t.length] = new Array(this.F);
}
this.T = t;
this.O = t.length;
this.A = t;
this.P = t.length;
}
J(t) {
const s = this.A + t + 1;
const i = s % this.V;
let h = i - 1;
let e = this.P + (s - i) / this.V;
if (i === 0) e -= 1;
e %= this.O;
if (h < 0) h += this.V;
O(t) {
const i = this.D + t + 1;
const s = i % this.F;
let h = s - 1;
let e = this.j + (i - s) / this.F;
if (s === 0) e -= 1;
e %= this.P;
if (h < 0) h += this.F;
return {

@@ -100,40 +95,42 @@ curNodeBucketIndex: e,

clear() {
this.T = [ [] ];
this.O = 1;
this.P = this.F = this.i = 0;
this.A = this.j = this.V >> 1;
this.A = [ new Array(this.F) ];
this.P = 1;
this.j = this.R = this.i = 0;
this.D = this.N = this.F >> 1;
}
begin() {
return new DequeIterator(0, this.size, this.getElementByPos, this.setElementByPos);
return new DequeIterator(0, this);
}
end() {
return new DequeIterator(this.i, this.size, this.getElementByPos, this.setElementByPos);
return new DequeIterator(this.i, this);
}
rBegin() {
return new DequeIterator(this.i - 1, this.size, this.getElementByPos, this.setElementByPos, 1);
return new DequeIterator(this.i - 1, this, 1);
}
rEnd() {
return new DequeIterator(-1, this.size, this.getElementByPos, this.setElementByPos, 1);
return new DequeIterator(-1, this, 1);
}
front() {
return this.T[this.P][this.A];
if (this.i === 0) return;
return this.A[this.j][this.D];
}
back() {
return this.T[this.F][this.j];
if (this.i === 0) return;
return this.A[this.R][this.N];
}
pushBack(t) {
if (this.i) {
if (this.j < this.V - 1) {
this.j += 1;
} else if (this.F < this.O - 1) {
this.F += 1;
this.j = 0;
if (this.N < this.F - 1) {
this.N += 1;
} else if (this.R < this.P - 1) {
this.R += 1;
this.N = 0;
} else {
this.F = 0;
this.j = 0;
this.R = 0;
this.N = 0;
}
if (this.F === this.P && this.j === this.A) this.G();
if (this.R === this.j && this.N === this.D) this.T();
}
this.i += 1;
this.T[this.F][this.j] = t;
this.A[this.R][this.N] = t;
return this.i;

@@ -143,13 +140,12 @@ }

if (this.i === 0) return;
const t = this.T[this.F][this.j];
delete this.T[this.F][this.j];
const t = this.A[this.R][this.N];
if (this.i !== 1) {
if (this.j > 0) {
this.j -= 1;
} else if (this.F > 0) {
this.F -= 1;
this.j = this.V - 1;
if (this.N > 0) {
this.N -= 1;
} else if (this.R > 0) {
this.R -= 1;
this.N = this.F - 1;
} else {
this.F = this.O - 1;
this.j = this.V - 1;
this.R = this.P - 1;
this.N = this.F - 1;
}

@@ -162,15 +158,15 @@ }

if (this.i) {
if (this.A > 0) {
this.A -= 1;
} else if (this.P > 0) {
this.P -= 1;
this.A = this.V - 1;
if (this.D > 0) {
this.D -= 1;
} else if (this.j > 0) {
this.j -= 1;
this.D = this.F - 1;
} else {
this.P = this.O - 1;
this.A = this.V - 1;
this.j = this.P - 1;
this.D = this.F - 1;
}
if (this.P === this.F && this.A === this.j) this.G();
if (this.j === this.R && this.D === this.N) this.T();
}
this.i += 1;
this.T[this.P][this.A] = t;
this.A[this.j][this.D] = t;
return this.i;

@@ -180,13 +176,12 @@ }

if (this.i === 0) return;
const t = this.T[this.P][this.A];
delete this.T[this.P][this.A];
const t = this.A[this.j][this.D];
if (this.i !== 1) {
if (this.A < this.V - 1) {
this.A += 1;
} else if (this.P < this.O - 1) {
this.P += 1;
this.A = 0;
if (this.D < this.F - 1) {
this.D += 1;
} else if (this.j < this.P - 1) {
this.j += 1;
this.D = 0;
} else {
this.P = 0;
this.A = 0;
this.j = 0;
this.D = 0;
}

@@ -201,13 +196,13 @@ }

}
const {curNodeBucketIndex: s, curNodePointerIndex: i} = this.J(t);
return this.T[s][i];
const {curNodeBucketIndex: i, curNodePointerIndex: s} = this.O(t);
return this.A[i][s];
}
setElementByPos(t, s) {
setElementByPos(t, i) {
if (t < 0 || t > this.i - 1) {
throw new RangeError;
}
const {curNodeBucketIndex: i, curNodePointerIndex: h} = this.J(t);
this.T[i][h] = s;
const {curNodeBucketIndex: s, curNodePointerIndex: h} = this.O(t);
this.A[s][h] = i;
}
insert(t, s, i = 1) {
insert(t, i, s = 1) {
if (t < 0 || t > this.i) {

@@ -217,12 +212,12 @@ throw new RangeError;

if (t === 0) {
while (i--) this.pushFront(s);
while (s--) this.pushFront(i);
} else if (t === this.i) {
while (i--) this.pushBack(s);
while (s--) this.pushBack(i);
} else {
const h = [];
for (let s = t; s < this.i; ++s) {
h.push(this.getElementByPos(s));
for (let i = t; i < this.i; ++i) {
h.push(this.getElementByPos(i));
}
this.cut(t - 1);
for (let t = 0; t < i; ++t) this.pushBack(s);
for (let t = 0; t < s; ++t) this.pushBack(i);
for (let t = 0; t < h.length; ++t) this.pushBack(h[t]);

@@ -237,5 +232,5 @@ }

}
const {curNodeBucketIndex: s, curNodePointerIndex: i} = this.J(t);
this.F = s;
this.j = i;
const {curNodeBucketIndex: i, curNodePointerIndex: s} = this.O(t);
this.R = i;
this.N = s;
this.i = t + 1;

@@ -249,11 +244,11 @@ return this.i;

if (t === 0) this.popFront(); else if (t === this.i - 1) this.popBack(); else {
const s = [];
for (let i = t + 1; i < this.i; ++i) {
s.push(this.getElementByPos(i));
const i = [];
for (let s = t + 1; s < this.i; ++s) {
i.push(this.getElementByPos(s));
}
this.cut(t);
this.popBack();
const i = this;
s.forEach((function(t) {
i.pushBack(t);
const s = this;
i.forEach((function(t) {
s.pushBack(t);
}));

@@ -265,14 +260,14 @@ }

if (this.i === 0) return 0;
const s = [];
for (let i = 0; i < this.i; ++i) {
const h = this.getElementByPos(i);
if (h !== t) s.push(h);
const i = [];
for (let s = 0; s < this.i; ++s) {
const h = this.getElementByPos(s);
if (h !== t) i.push(h);
}
const i = s.length;
for (let t = 0; t < i; ++t) this.setElementByPos(t, s[t]);
return this.cut(i - 1);
const s = i.length;
for (let t = 0; t < s; ++t) this.setElementByPos(t, i[t]);
return this.cut(s - 1);
}
eraseElementByIterator(t) {
const s = t.o;
this.eraseElementByPos(s);
const i = t.o;
this.eraseElementByPos(i);
t = t.next();

@@ -282,5 +277,5 @@ return t;

find(t) {
for (let s = 0; s < this.i; ++s) {
if (this.getElementByPos(s) === t) {
return new DequeIterator(s, this.size, this.getElementByPos, this.setElementByPos);
for (let i = 0; i < this.i; ++i) {
if (this.getElementByPos(i) === t) {
return new DequeIterator(i, this);
}

@@ -292,9 +287,9 @@ }

let t = 0;
let s = this.i - 1;
while (t < s) {
const i = this.getElementByPos(t);
this.setElementByPos(t, this.getElementByPos(s));
this.setElementByPos(s, i);
let i = this.i - 1;
while (t < i) {
const s = this.getElementByPos(t);
this.setElementByPos(t, this.getElementByPos(i));
this.setElementByPos(i, s);
t += 1;
s -= 1;
i -= 1;
}

@@ -307,7 +302,7 @@ }

let t = 1;
let s = this.getElementByPos(0);
for (let i = 1; i < this.i; ++i) {
const h = this.getElementByPos(i);
if (h !== s) {
s = h;
let i = this.getElementByPos(0);
for (let s = 1; s < this.i; ++s) {
const h = this.getElementByPos(s);
if (h !== i) {
i = h;
this.setElementByPos(t++, h);

@@ -320,8 +315,8 @@ }

sort(t) {
const s = [];
const i = [];
for (let t = 0; t < this.i; ++t) {
s.push(this.getElementByPos(t));
i.push(this.getElementByPos(t));
}
s.sort(t);
for (let t = 0; t < this.i; ++t) this.setElementByPos(t, s[t]);
i.sort(t);
for (let t = 0; t < this.i; ++t) this.setElementByPos(t, i[t]);
}

@@ -331,16 +326,16 @@ shrinkToFit() {

const t = [];
this.forEach((function(s) {
t.push(s);
this.forEach((function(i) {
t.push(i);
}));
this.O = Math.max(Math.ceil(this.i / this.V), 1);
this.i = this.P = this.F = this.A = this.j = 0;
this.T = [];
for (let t = 0; t < this.O; ++t) {
this.T.push(new Array(this.V));
this.P = Math.max(Math.ceil(this.i / this.F), 1);
this.i = this.j = this.R = this.D = this.N = 0;
this.A = [];
for (let t = 0; t < this.P; ++t) {
this.A.push(new Array(this.F));
}
for (let s = 0; s < t.length; ++s) this.pushBack(t[s]);
for (let i = 0; i < t.length; ++i) this.pushBack(t[i]);
}
forEach(t) {
for (let s = 0; s < this.i; ++s) {
t(this.getElementByPos(s), s, this);
for (let i = 0; i < this.i; ++i) {
t(this.getElementByPos(i), i, this);
}

@@ -347,0 +342,0 @@ }

import SequentialContainer from './Base';
import { ContainerIterator, initContainer } from "../ContainerBase";
declare class LinkListIterator<T> extends ContainerIterator<T> {
readonly container: LinkList<T>;
get pointer(): T;

@@ -5,0 +6,0 @@ set pointer(newValue: T);

@@ -22,6 +22,7 @@ "use strict";

class LinkListIterator extends _ContainerBase.ContainerIterator {
constructor(t, i, s) {
super(s);
constructor(t, i, s, r) {
super(r);
this.o = t;
this.h = i;
this.container = s;
if (this.iteratorType === 0) {

@@ -72,3 +73,3 @@ this.pre = function() {

copy() {
return new LinkListIterator(this.o, this.h, this.iteratorType);
return new LinkListIterator(this.o, this.h, this.container, this.iteratorType);
}

@@ -87,3 +88,3 @@ }

}
K(t) {
V(t) {
const {L: i, B: s} = t;

@@ -100,3 +101,3 @@ i.B = s;

}
U(t, i) {
G(t, i) {
const s = i.B;

@@ -123,12 +124,12 @@ const r = {

begin() {
return new LinkListIterator(this.p, this.h);
return new LinkListIterator(this.p, this.h, this);
}
end() {
return new LinkListIterator(this.h, this.h);
return new LinkListIterator(this.h, this.h, this);
}
rBegin() {
return new LinkListIterator(this._, this.h, 1);
return new LinkListIterator(this._, this.h, this, 1);
}
rEnd() {
return new LinkListIterator(this.h, this.h, 1);
return new LinkListIterator(this.h, this.h, this, 1);
}

@@ -159,3 +160,3 @@ front() {

}
this.K(i);
this.V(i);
return this.i;

@@ -167,3 +168,3 @@ }

if (i.l === t) {
this.K(i);
this.V(i);
}

@@ -180,7 +181,7 @@ i = i.B;

t = t.next();
this.K(i);
this.V(i);
return t;
}
pushBack(t) {
this.U(t, this._);
this.G(t, this._);
return this.i;

@@ -191,7 +192,7 @@ }

const t = this._.l;
this.K(this._);
this.V(this._);
return t;
}
pushFront(t) {
this.U(t, this.h);
this.G(t, this.h);
return this.i;

@@ -202,3 +203,3 @@ }

const t = this.p.l;
this.K(this.p);
this.V(this.p);
return t;

@@ -249,3 +250,3 @@ }

if (i.l === t) {
return new LinkListIterator(i, this.h);
return new LinkListIterator(i, this.h, this);
}

@@ -312,3 +313,3 @@ i = i.B;

}
i.U(t, s.L);
i.G(t, s.L);
}));

@@ -315,0 +316,0 @@ }

import SequentialContainer from './Base';
import { initContainer } from "../ContainerBase";
import { initContainer, IteratorType } from "../ContainerBase";
import { RandomIterator } from "./Base/RandomIterator";
declare class VectorIterator<T> extends RandomIterator<T> {
container: Vector<T>;
constructor(node: number, container: Vector<T>, iteratorType?: IteratorType);
copy(): VectorIterator<T>;

@@ -6,0 +8,0 @@ equals(iter: VectorIterator<T>): boolean;

@@ -20,4 +20,8 @@ "use strict";

class VectorIterator extends _RandomIterator.RandomIterator {
constructor(t, r, e) {
super(t, e);
this.container = r;
}
copy() {
return new VectorIterator(this.o, this.D, this.R, this.N, this.iteratorType);
return new VectorIterator(this.o, this.container, this.iteratorType);
}

@@ -30,6 +34,6 @@ }

if (Array.isArray(t)) {
this.W = r ? [ ...t ] : t;
this.J = r ? [ ...t ] : t;
this.i = t.length;
} else {
this.W = [];
this.J = [];
const r = this;

@@ -40,27 +44,24 @@ t.forEach((function(t) {

}
this.size = this.size.bind(this);
this.getElementByPos = this.getElementByPos.bind(this);
this.setElementByPos = this.setElementByPos.bind(this);
}
clear() {
this.i = 0;
this.W.length = 0;
this.J.length = 0;
}
begin() {
return new VectorIterator(0, this.size, this.getElementByPos, this.setElementByPos);
return new VectorIterator(0, this);
}
end() {
return new VectorIterator(this.i, this.size, this.getElementByPos, this.setElementByPos);
return new VectorIterator(this.i, this);
}
rBegin() {
return new VectorIterator(this.i - 1, this.size, this.getElementByPos, this.setElementByPos, 1);
return new VectorIterator(this.i - 1, this, 1);
}
rEnd() {
return new VectorIterator(-1, this.size, this.getElementByPos, this.setElementByPos, 1);
return new VectorIterator(-1, this, 1);
}
front() {
return this.W[0];
return this.J[0];
}
back() {
return this.W[this.i - 1];
return this.J[this.i - 1];
}

@@ -71,3 +72,3 @@ getElementByPos(t) {

}
return this.W[t];
return this.J[t];
}

@@ -78,3 +79,3 @@ eraseElementByPos(t) {

}
this.W.splice(t, 1);
this.J.splice(t, 1);
this.i -= 1;

@@ -86,7 +87,7 @@ return this.i;

for (let e = 0; e < this.i; ++e) {
if (this.W[e] !== t) {
this.W[r++] = this.W[e];
if (this.J[e] !== t) {
this.J[r++] = this.J[e];
}
}
this.i = this.W.length = r;
this.i = this.J.length = r;
return this.i;

@@ -101,3 +102,3 @@ }

pushBack(t) {
this.W.push(t);
this.J.push(t);
this.i += 1;

@@ -109,3 +110,3 @@ return this.i;

this.i -= 1;
return this.W.pop();
return this.J.pop();
}

@@ -116,3 +117,3 @@ setElementByPos(t, r) {

}
this.W[t] = r;
this.J[t] = r;
}

@@ -123,3 +124,3 @@ insert(t, r, e = 1) {

}
this.W.splice(t, 0, ...new Array(e).fill(r));
this.J.splice(t, 0, ...new Array(e).fill(r));
this.i += e;

@@ -130,4 +131,4 @@ return this.i;

for (let r = 0; r < this.i; ++r) {
if (this.W[r] === t) {
return new VectorIterator(r, this.size, this.getElementByPos, this.getElementByPos);
if (this.J[r] === t) {
return new VectorIterator(r, this);
}

@@ -138,3 +139,3 @@ }

reverse() {
this.W.reverse();
this.J.reverse();
}

@@ -144,15 +145,15 @@ unique() {

for (let r = 1; r < this.i; ++r) {
if (this.W[r] !== this.W[r - 1]) {
this.W[t++] = this.W[r];
if (this.J[r] !== this.J[r - 1]) {
this.J[t++] = this.J[r];
}
}
this.i = this.W.length = t;
this.i = this.J.length = t;
return this.i;
}
sort(t) {
this.W.sort(t);
this.J.sort(t);
}
forEach(t) {
for (let r = 0; r < this.i; ++r) {
t(this.W[r], r, this);
t(this.J[r], r, this);
}

@@ -162,3 +163,3 @@ }

return function*() {
yield* this.W;
yield* this.J;
}.bind(this)();

@@ -165,0 +166,0 @@ }

@@ -22,3 +22,3 @@ "use strict";

super();
this.rr = undefined;
this.Y = undefined;
this.v = e;

@@ -45,3 +45,3 @@ if (t) {

};
this.K = function(e) {
this.V = function(e) {
let t = this.fe(e);

@@ -60,7 +60,7 @@ while (t !== this.h) {

};
this.K = this.fe;
this.V = this.fe;
}
this.h = new this.re;
}
$(e, t) {
X(e, t) {
let i = this.h;

@@ -70,6 +70,6 @@ while (e) {

if (s < 0) {
e = e.Z;
e = e.W;
} else if (s > 0) {
i = e;
e = e.Y;
e = e.U;
} else return e;

@@ -79,3 +79,3 @@ }

}
er(e, t) {
Z(e, t) {
let i = this.h;

@@ -85,6 +85,6 @@ while (e) {

if (s <= 0) {
e = e.Z;
e = e.W;
} else {
i = e;
e = e.Y;
e = e.U;
}

@@ -94,3 +94,3 @@ }

}
tr(e, t) {
$(e, t) {
let i = this.h;

@@ -101,5 +101,5 @@ while (e) {

i = e;
e = e.Z;
e = e.W;
} else if (s > 0) {
e = e.Y;
e = e.U;
} else return e;

@@ -109,3 +109,3 @@ }

}
sr(e, t) {
rr(e, t) {
let i = this.h;

@@ -116,5 +116,5 @@ while (e) {

i = e;
e = e.Z;
e = e.W;
} else {
e = e.Y;
e = e.U;
}

@@ -132,22 +132,22 @@ }

}
if (e === t.Y) {
const i = t.Z;
if (e === t.U) {
const i = t.W;
if (i.ee === 1) {
i.ee = 0;
t.ee = 1;
if (t === this.rr) {
this.rr = t.te();
if (t === this.Y) {
this.Y = t.te();
} else t.te();
} else {
if (i.Z && i.Z.ee === 1) {
if (i.W && i.W.ee === 1) {
i.ee = t.ee;
t.ee = 0;
i.Z.ee = 0;
if (t === this.rr) {
this.rr = t.te();
i.W.ee = 0;
if (t === this.Y) {
this.Y = t.te();
} else t.te();
return;
} else if (i.Y && i.Y.ee === 1) {
} else if (i.U && i.U.ee === 1) {
i.ee = 1;
i.Y.ee = 0;
i.U.ee = 0;
i.se();

@@ -160,21 +160,21 @@ } else {

} else {
const i = t.Y;
const i = t.U;
if (i.ee === 1) {
i.ee = 0;
t.ee = 1;
if (t === this.rr) {
this.rr = t.se();
if (t === this.Y) {
this.Y = t.se();
} else t.se();
} else {
if (i.Y && i.Y.ee === 1) {
if (i.U && i.U.ee === 1) {
i.ee = t.ee;
t.ee = 0;
i.Y.ee = 0;
if (t === this.rr) {
this.rr = t.se();
i.U.ee = 0;
if (t === this.Y) {
this.Y = t.se();
} else t.se();
return;
} else if (i.Z && i.Z.ee === 1) {
} else if (i.W && i.W.ee === 1) {
i.ee = 1;
i.Z.ee = 0;
i.W.ee = 0;
i.te();

@@ -195,8 +195,8 @@ } else {

let t = e;
while (t.Y || t.Z) {
if (t.Z) {
t = t.Z;
while (t.Y) t = t.Y;
while (t.U || t.W) {
if (t.W) {
t = t.W;
while (t.U) t = t.U;
} else {
t = t.Y;
t = t.U;
}

@@ -207,14 +207,14 @@ [e.u, t.u] = [ t.u, e.u ];

}
if (this.h.Y === t) {
this.h.Y = t.tt;
} else if (this.h.Z === t) {
this.h.Z = t.tt;
if (this.h.U === t) {
this.h.U = t.tt;
} else if (this.h.W === t) {
this.h.W = t.tt;
}
this.ue(t);
const i = t.tt;
if (t === i.Y) {
i.Y = undefined;
} else i.Z = undefined;
if (t === i.U) {
i.U = undefined;
} else i.W = undefined;
this.i -= 1;
this.rr.ee = 0;
this.Y.ee = 0;
return i;

@@ -224,6 +224,6 @@ }

if (e === undefined) return false;
const i = this.oe(e.Y, t);
const i = this.oe(e.U, t);
if (i) return true;
if (t(e)) return true;
return this.oe(e.Z, t);
return this.oe(e.W, t);
}

@@ -235,26 +235,26 @@ he(e) {

const i = t.tt;
if (t === i.Y) {
const s = i.Z;
if (t === i.U) {
const s = i.W;
if (s && s.ee === 1) {
s.ee = t.ee = 0;
if (i === this.rr) return;
if (i === this.Y) return;
i.ee = 1;
e = i;
continue;
} else if (e === t.Z) {
} else if (e === t.W) {
e.ee = 0;
if (e.Y) e.Y.tt = t;
if (e.Z) e.Z.tt = i;
t.Z = e.Y;
i.Y = e.Z;
e.Y = t;
e.Z = i;
if (i === this.rr) {
this.rr = e;
if (e.U) e.U.tt = t;
if (e.W) e.W.tt = i;
t.W = e.U;
i.U = e.W;
e.U = t;
e.W = i;
if (i === this.Y) {
this.Y = e;
this.h.tt = e;
} else {
const t = i.tt;
if (t.Y === i) {
t.Y = e;
} else t.Z = e;
if (t.U === i) {
t.U = e;
} else t.W = e;
}

@@ -272,4 +272,4 @@ e.tt = i.tt;

t.ee = 0;
if (i === this.rr) {
this.rr = i.se();
if (i === this.Y) {
this.Y = i.se();
} else i.se();

@@ -279,25 +279,25 @@ i.ee = 1;

} else {
const s = i.Y;
const s = i.U;
if (s && s.ee === 1) {
s.ee = t.ee = 0;
if (i === this.rr) return;
if (i === this.Y) return;
i.ee = 1;
e = i;
continue;
} else if (e === t.Y) {
} else if (e === t.U) {
e.ee = 0;
if (e.Y) e.Y.tt = i;
if (e.Z) e.Z.tt = t;
i.Z = e.Y;
t.Y = e.Z;
e.Y = i;
e.Z = t;
if (i === this.rr) {
this.rr = e;
if (e.U) e.U.tt = i;
if (e.W) e.W.tt = t;
i.W = e.U;
t.U = e.W;
e.U = i;
e.W = t;
if (i === this.Y) {
this.Y = e;
this.h.tt = e;
} else {
const t = i.tt;
if (t.Y === i) {
t.Y = e;
} else t.Z = e;
if (t.U === i) {
t.U = e;
} else t.W = e;
}

@@ -315,4 +315,4 @@ e.tt = i.tt;

t.ee = 0;
if (i === this.rr) {
this.rr = i.te();
if (i === this.Y) {
this.Y = i.te();
} else i.te();

@@ -326,14 +326,14 @@ i.ee = 1;

ne(e, t, i) {
if (this.rr === undefined) {
if (this.Y === undefined) {
this.i += 1;
this.rr = new this.re(e, t);
this.rr.ee = 0;
this.rr.tt = this.h;
this.h.tt = this.rr;
this.h.Y = this.rr;
this.h.Z = this.rr;
this.Y = new this.re(e, t);
this.Y.ee = 0;
this.Y.tt = this.h;
this.h.tt = this.Y;
this.h.U = this.Y;
this.h.W = this.Y;
return;
}
let s;
const r = this.h.Y;
const r = this.h.U;
const n = this.v(r.u, e);

@@ -344,8 +344,8 @@ if (n === 0) {

} else if (n > 0) {
r.Y = new this.re(e, t);
r.Y.tt = r;
s = r.Y;
this.h.Y = s;
r.U = new this.re(e, t);
r.U.tt = r;
s = r.U;
this.h.U = s;
} else {
const r = this.h.Z;
const r = this.h.W;
const n = this.v(r.u, e);

@@ -356,6 +356,6 @@ if (n === 0) {

} else if (n < 0) {
r.Z = new this.re(e, t);
r.Z.tt = r;
s = r.Z;
this.h.Z = s;
r.W = new this.re(e, t);
r.W.tt = r;
s = r.W;
this.h.W = s;
} else {

@@ -377,7 +377,7 @@ if (i !== undefined) {

s = new this.re(e, t);
if (i.Z === undefined) {
i.Z = s;
if (i.W === undefined) {
i.W = s;
s.tt = i;
} else {
r.Y = s;
r.U = s;
s.tt = r;

@@ -390,21 +390,21 @@ }

if (s === undefined) {
s = this.rr;
s = this.Y;
while (true) {
const i = this.v(s.u, e);
if (i > 0) {
if (s.Y === undefined) {
s.Y = new this.re(e, t);
s.Y.tt = s;
s = s.Y;
if (s.U === undefined) {
s.U = new this.re(e, t);
s.U.tt = s;
s = s.U;
break;
}
s = s.Y;
s = s.U;
} else if (i < 0) {
if (s.Z === undefined) {
s.Z = new this.re(e, t);
s.Z.tt = s;
s = s.Z;
if (s.W === undefined) {
s.W = new this.re(e, t);
s.W.tt = s;
s = s.W;
break;
}
s = s.Z;
s = s.W;
} else {

@@ -425,5 +425,5 @@ s.l = t;

if (i < 0) {
e = e.Z;
e = e.W;
} else if (i > 0) {
e = e.Y;
e = e.U;
} else return e;

@@ -435,5 +435,5 @@ }

this.i = 0;
this.rr = undefined;
this.Y = undefined;
this.h.tt = undefined;
this.h.Y = this.h.Z = undefined;
this.h.U = this.h.W = undefined;
}

@@ -449,3 +449,3 @@ updateKeyByIterator(e, t) {

}
if (i === this.h.Y) {
if (i === this.h.U) {
if (this.v(i.B().u, t) > 0) {

@@ -457,3 +457,3 @@ i.u = t;

}
if (i === this.h.Z) {
if (i === this.h.W) {
if (this.v(i.L().u, t) < 0) {

@@ -478,5 +478,5 @@ i.u = t;

const i = this;
this.oe(this.rr, (function(s) {
this.oe(this.Y, (function(s) {
if (e === t) {
i.K(s);
i.V(s);
return true;

@@ -491,5 +491,5 @@ }

if (this.i === 0) return false;
const t = this.I(this.rr, e);
const t = this.I(this.Y, e);
if (t === this.h) return false;
this.K(t);
this.V(t);
return true;

@@ -502,3 +502,3 @@ }

}
const i = t.Z === undefined;
const i = t.W === undefined;
const s = e.iteratorType === 0;

@@ -508,5 +508,5 @@ if (s) {

} else {
if (!i || t.Y === undefined) e.next();
if (!i || t.U === undefined) e.next();
}
this.K(t);
this.V(t);
return e;

@@ -537,5 +537,5 @@ }

if (!e) return 0;
return Math.max(traversal(e.Y), traversal(e.Z)) + 1;
return Math.max(traversal(e.U), traversal(e.W)) + 1;
};
return traversal(this.rr);
return traversal(this.Y);
}

@@ -542,0 +542,0 @@ }

import { ContainerIterator } from "../../ContainerBase";
import TreeContainer from "./index";
declare abstract class TreeIterator<K, V> extends ContainerIterator<K | [K, V]> {
abstract readonly container: TreeContainer<K, V>;
/**

@@ -4,0 +6,0 @@ * @description Get the sequential index of the iterator in the tree container.<br/>

@@ -20,3 +20,3 @@ "use strict";

this.pre = function() {
if (this.o === this.h.Y) {
if (this.o === this.h.U) {
(0, _throwError.throwIteratorAccessError)();

@@ -36,3 +36,3 @@ }

this.pre = function() {
if (this.o === this.h.Z) {
if (this.o === this.h.W) {
(0, _throwError.throwIteratorAccessError)();

@@ -62,11 +62,11 @@ }

let i = 0;
if (t.Y) {
i += t.Y.rt;
if (t.U) {
i += t.U.rt;
}
while (t !== r) {
const r = t.tt;
if (t === r.Z) {
if (t === r.W) {
i += 1;
if (r.Y) {
i += r.Y.rt;
if (r.U) {
i += r.U.rt;
}

@@ -73,0 +73,0 @@ }

@@ -1,1 +0,47 @@

export {};
export declare const enum TreeNodeColor {
RED = 1,
BLACK = 0
}
export declare class TreeNode<K, V> {
_color: TreeNodeColor;
_key: K | undefined;
_value: V | undefined;
_left: TreeNode<K, V> | undefined;
_right: TreeNode<K, V> | undefined;
_parent: TreeNode<K, V> | undefined;
constructor(key?: K, value?: V);
/**
* @description Get the pre node.
* @returns TreeNode about the pre node.
*/
_pre(): TreeNode<K, V>;
/**
* @description Get the next node.
* @returns TreeNode about the next node.
*/
_next(): TreeNode<K, V>;
/**
* @description Rotate left.
* @returns TreeNode about moved to original position after rotation.
*/
_rotateLeft(): TreeNode<K, V>;
/**
* @description Rotate right.
* @returns TreeNode about moved to original position after rotation.
*/
_rotateRight(): TreeNode<K, V>;
}
export declare class TreeNodeEnableIndex<K, V> extends TreeNode<K, V> {
_subTreeSize: number;
/**
* @description Rotate left and do recount.
* @returns TreeNode about moved to original position after rotation.
*/
_rotateLeft(): TreeNodeEnableIndex<K, V>;
/**
* @description Rotate right and do recount.
* @returns TreeNode about moved to original position after rotation.
*/
_rotateRight(): TreeNodeEnableIndex<K, V>;
_recount(): void;
}

@@ -14,4 +14,4 @@ "use strict";

this.l = undefined;
this.Y = undefined;
this.Z = undefined;
this.U = undefined;
this.W = undefined;
this.tt = undefined;

@@ -24,11 +24,11 @@ this.u = e;

if (e.ee === 1 && e.tt.tt === e) {
e = e.Z;
} else if (e.Y) {
e = e.Y;
while (e.Z) {
e = e.Z;
e = e.W;
} else if (e.U) {
e = e.U;
while (e.W) {
e = e.W;
}
} else {
let t = e.tt;
while (t.Y === e) {
while (t.U === e) {
e = t;

@@ -43,6 +43,6 @@ t = e.tt;

let e = this;
if (e.Z) {
e = e.Z;
while (e.Y) {
e = e.Y;
if (e.W) {
e = e.W;
while (e.U) {
e = e.U;
}

@@ -52,7 +52,7 @@ return e;

let t = e.tt;
while (t.Z === e) {
while (t.W === e) {
e = t;
t = e.tt;
}
if (e.Z !== t) {
if (e.W !== t) {
return t;

@@ -64,9 +64,9 @@ } else return e;

const e = this.tt;
const t = this.Z;
const s = t.Y;
if (e.tt === this) e.tt = t; else if (e.Y === this) e.Y = t; else e.Z = t;
const t = this.W;
const s = t.U;
if (e.tt === this) e.tt = t; else if (e.U === this) e.U = t; else e.W = t;
t.tt = e;
t.Y = this;
t.U = this;
this.tt = t;
this.Z = s;
this.W = s;
if (s) s.tt = this;

@@ -77,9 +77,9 @@ return t;

const e = this.tt;
const t = this.Y;
const s = t.Z;
if (e.tt === this) e.tt = t; else if (e.Y === this) e.Y = t; else e.Z = t;
const t = this.U;
const s = t.W;
if (e.tt === this) e.tt = t; else if (e.U === this) e.U = t; else e.W = t;
t.tt = e;
t.Z = this;
t.W = this;
this.tt = t;
this.Y = s;
this.U = s;
if (s) s.tt = this;

@@ -111,7 +111,7 @@ return t;

this.rt = 1;
if (this.Y) {
this.rt += this.Y.rt;
if (this.U) {
this.rt += this.U.rt;
}
if (this.Z) {
this.rt += this.Z.rt;
if (this.W) {
this.rt += this.W.rt;
}

@@ -118,0 +118,0 @@ }

import TreeContainer from './Base';
import TreeIterator from './Base/TreeIterator';
import { initContainer } from "../ContainerBase";
import { TreeNode } from './Base/TreeNode';
import { initContainer, IteratorType } from "../ContainerBase";
declare class OrderedMapIterator<K, V> extends TreeIterator<K, V> {
container: OrderedMap<K, V>;
constructor(node: TreeNode<K, V>, header: TreeNode<K, V>, container: OrderedMap<K, V>, iteratorType?: IteratorType);
get pointer(): [K, V];

@@ -6,0 +9,0 @@ copy(): OrderedMapIterator<K, V>;

@@ -22,2 +22,6 @@ "use strict";

class OrderedMapIterator extends _TreeIterator.default {
constructor(r, t, e, s) {
super(r, t, s);
this.container = e;
}
get pointer() {

@@ -29,7 +33,7 @@ if (this.o === this.h) {

return new Proxy([], {
get(e, t) {
if (t === "0") return r.o.u; else if (t === "1") return r.o.l;
get(t, e) {
if (e === "0") return r.o.u; else if (e === "1") return r.o.l;
},
set(e, t, s) {
if (t !== "1") {
set(t, e, s) {
if (e !== "1") {
throw new TypeError("props must be 1");

@@ -43,3 +47,3 @@ }

copy() {
return new OrderedMapIterator(this.o, this.h, this.iteratorType);
return new OrderedMapIterator(this.o, this.h, this.container, this.iteratorType);
}

@@ -49,4 +53,4 @@ }

class OrderedMap extends _Base.default {
constructor(r = [], e, t) {
super(e, t);
constructor(r = [], t, e) {
super(t, e);
const s = this;

@@ -57,23 +61,23 @@ r.forEach((function(r) {

}
* X(r) {
* K(r) {
if (r === undefined) return;
yield* this.X(r.Y);
yield* this.K(r.U);
yield [ r.u, r.l ];
yield* this.X(r.Z);
yield* this.K(r.W);
}
begin() {
return new OrderedMapIterator(this.h.Y || this.h, this.h);
return new OrderedMapIterator(this.h.U || this.h, this.h, this);
}
end() {
return new OrderedMapIterator(this.h, this.h);
return new OrderedMapIterator(this.h, this.h, this);
}
rBegin() {
return new OrderedMapIterator(this.h.Z || this.h, this.h, 1);
return new OrderedMapIterator(this.h.W || this.h, this.h, this, 1);
}
rEnd() {
return new OrderedMapIterator(this.h, this.h, 1);
return new OrderedMapIterator(this.h, this.h, this, 1);
}
front() {
if (this.i === 0) return;
const r = this.h.Y;
const r = this.h.U;
return [ r.u, r.l ];

@@ -83,36 +87,36 @@ }

if (this.i === 0) return;
const r = this.h.Z;
const r = this.h.W;
return [ r.u, r.l ];
}
lowerBound(r) {
const e = this.$(this.rr, r);
return new OrderedMapIterator(e, this.h);
const t = this.X(this.Y, r);
return new OrderedMapIterator(t, this.h, this);
}
upperBound(r) {
const e = this.er(this.rr, r);
return new OrderedMapIterator(e, this.h);
const t = this.Z(this.Y, r);
return new OrderedMapIterator(t, this.h, this);
}
reverseLowerBound(r) {
const e = this.tr(this.rr, r);
return new OrderedMapIterator(e, this.h);
const t = this.$(this.Y, r);
return new OrderedMapIterator(t, this.h, this);
}
reverseUpperBound(r) {
const e = this.sr(this.rr, r);
return new OrderedMapIterator(e, this.h);
const t = this.rr(this.Y, r);
return new OrderedMapIterator(t, this.h, this);
}
setElement(r, e, t) {
return this.M(r, e, t);
setElement(r, t, e) {
return this.M(r, t, e);
}
find(r) {
const e = this.I(this.rr, r);
return new OrderedMapIterator(e, this.h);
const t = this.I(this.Y, r);
return new OrderedMapIterator(t, this.h, this);
}
getElementByKey(r) {
const e = this.I(this.rr, r);
return e.l;
const t = this.I(this.Y, r);
return t.l;
}
union(r) {
const e = this;
const t = this;
r.forEach((function(r) {
e.setElement(r[0], r[1]);
t.setElement(r[0], r[1]);
}));

@@ -122,3 +126,3 @@ return this.i;

[Symbol.iterator]() {
return this.X(this.rr);
return this.K(this.Y);
}

@@ -125,0 +129,0 @@ }

import TreeContainer from './Base';
import TreeIterator from './Base/TreeIterator';
import { initContainer } from "../ContainerBase";
import { TreeNode } from './Base/TreeNode';
import { initContainer, IteratorType } from "../ContainerBase";
declare class OrderedSetIterator<K> extends TreeIterator<K, undefined> {
container: OrderedSet<K>;
constructor(node: TreeNode<K, undefined>, header: TreeNode<K, undefined>, container: OrderedSet<K>, iteratorType?: IteratorType);
get pointer(): NonNullable<K>;

@@ -6,0 +9,0 @@ copy(): OrderedSetIterator<K>;

@@ -22,2 +22,6 @@ "use strict";

class OrderedSetIterator extends _TreeIterator.default {
constructor(e, t, r, i) {
super(e, t, i);
this.container = r;
}
get pointer() {

@@ -30,3 +34,3 @@ if (this.o === this.h) {

copy() {
return new OrderedSetIterator(this.o, this.h, this.iteratorType);
return new OrderedSetIterator(this.o, this.h, this.container, this.iteratorType);
}

@@ -36,4 +40,4 @@ }

class OrderedSet extends _Base.default {
constructor(e = [], r, t) {
super(r, t);
constructor(e = [], t, r) {
super(t, r);
const i = this;

@@ -44,53 +48,53 @@ e.forEach((function(e) {

}
* X(e) {
* K(e) {
if (e === undefined) return;
yield* this.X(e.Y);
yield* this.K(e.U);
yield e.u;
yield* this.X(e.Z);
yield* this.K(e.W);
}
begin() {
return new OrderedSetIterator(this.h.Y || this.h, this.h);
return new OrderedSetIterator(this.h.U || this.h, this.h, this);
}
end() {
return new OrderedSetIterator(this.h, this.h);
return new OrderedSetIterator(this.h, this.h, this);
}
rBegin() {
return new OrderedSetIterator(this.h.Z || this.h, this.h, 1);
return new OrderedSetIterator(this.h.W || this.h, this.h, this, 1);
}
rEnd() {
return new OrderedSetIterator(this.h, this.h, 1);
return new OrderedSetIterator(this.h, this.h, this, 1);
}
front() {
return this.h.Y ? this.h.Y.u : undefined;
return this.h.U ? this.h.U.u : undefined;
}
back() {
return this.h.Z ? this.h.Z.u : undefined;
return this.h.W ? this.h.W.u : undefined;
}
insert(e, r) {
return this.M(e, undefined, r);
insert(e, t) {
return this.M(e, undefined, t);
}
find(e) {
const r = this.I(this.rr, e);
return new OrderedSetIterator(r, this.h);
const t = this.I(this.Y, e);
return new OrderedSetIterator(t, this.h, this);
}
lowerBound(e) {
const r = this.$(this.rr, e);
return new OrderedSetIterator(r, this.h);
const t = this.X(this.Y, e);
return new OrderedSetIterator(t, this.h, this);
}
upperBound(e) {
const r = this.er(this.rr, e);
return new OrderedSetIterator(r, this.h);
const t = this.Z(this.Y, e);
return new OrderedSetIterator(t, this.h, this);
}
reverseLowerBound(e) {
const r = this.tr(this.rr, e);
return new OrderedSetIterator(r, this.h);
const t = this.$(this.Y, e);
return new OrderedSetIterator(t, this.h, this);
}
reverseUpperBound(e) {
const r = this.sr(this.rr, e);
return new OrderedSetIterator(r, this.h);
const t = this.rr(this.Y, e);
return new OrderedSetIterator(t, this.h, this);
}
union(e) {
const r = this;
const t = this;
e.forEach((function(e) {
r.insert(e);
t.insert(e);
}));

@@ -100,3 +104,3 @@ return this.i;

[Symbol.iterator]() {
return this.X(this.rr);
return this.K(this.Y);
}

@@ -103,0 +107,0 @@ }

@@ -10,2 +10,6 @@ /**

/**
* @description The container pointed to by the iterator.
*/
abstract readonly container: Container<T>;
/**
* @description Iterator's type.

@@ -199,10 +203,6 @@ * @example

*/
export declare type initContainer<T> = ({
size: number;
} | {
length: number;
} | {
size(): number;
}) & {
forEach(callback: (element: T) => void): void;
export declare type initContainer<T> = {
size?: number | (() => number);
length?: number;
forEach: (callback: (el: T) => void) => void;
};

@@ -39,7 +39,7 @@ var __extends = this && this.t || function() {

function Base() {
this.i = 0;
this.M = 0;
}
Object.defineProperty(Base.prototype, "length", {
get: function() {
return this.i;
return this.M;
},

@@ -50,6 +50,6 @@ enumerable: false,

Base.prototype.size = function() {
return this.i;
return this.M;
};
Base.prototype.empty = function() {
return this.i === 0;
return this.M === 0;
};

@@ -56,0 +56,0 @@ return Base;

import { Container, ContainerIterator } from "../../ContainerBase";
export declare type HashLinkNode<K, V> = {
_key: K;
_value: V;
_pre: HashLinkNode<K, V>;
_next: HashLinkNode<K, V>;
};
export declare abstract class HashContainerIterator<K, V> extends ContainerIterator<K | [K, V]> {
abstract readonly container: HashContainer<K, V>;
pre(): this;

@@ -4,0 +11,0 @@ next(): this;

@@ -36,6 +36,6 @@ var __extends = this && this.t || function() {

n.pre = function() {
if (this.o.W === this.h) {
if (this.o.L === this.h) {
throwIteratorAccessError();
}
this.o = this.o.W;
this.o = this.o.L;
return this;

@@ -62,3 +62,3 @@ };

}
this.o = this.o.W;
this.o = this.o.L;
return this;

@@ -83,16 +83,16 @@ };

i.h = {};
i.h.W = i.h.m = i.l = i.M = i.h;
i.h.L = i.h.m = i.H = i.l = i.h;
return i;
}
HashContainer.prototype.X = function(t) {
var i = t.W, r = t.m;
HashContainer.prototype.G = function(t) {
var i = t.L, r = t.m;
i.m = r;
r.W = i;
r.L = i;
if (t === this.H) {
this.H = r;
}
if (t === this.l) {
this.l = r;
this.l = i;
}
if (t === this.M) {
this.M = i;
}
this.i -= 1;
this.M -= 1;
};

@@ -105,4 +105,4 @@ HashContainer.prototype.v = function(t, i, r) {

if (n !== undefined) {
this._[n].H = i;
return this.i;
this._[n].p = i;
return this.M;
}

@@ -114,5 +114,5 @@ Object.defineProperty(t, this.HASH_TAG, {

e = {
p: t,
H: i,
W: this.M,
u: t,
p: i,
L: this.l,
m: this.h

@@ -124,9 +124,9 @@ };

if (s) {
s.H = i;
return this.i;
s.p = i;
return this.M;
}
e = {
p: t,
H: i,
W: this.M,
u: t,
p: i,
L: this.l,
m: this.h

@@ -136,11 +136,11 @@ };

}
if (this.i === 0) {
this.l = e;
if (this.M === 0) {
this.H = e;
this.h.m = e;
} else {
this.M.m = e;
this.l.m = e;
}
this.M = e;
this.h.W = e;
return ++this.i;
this.l = e;
this.h.L = e;
return ++this.M;
};

@@ -160,3 +160,3 @@ HashContainer.prototype.g = function(t, i) {

this._.forEach((function(i) {
delete i.p[t];
delete i.u[t];
}));

@@ -166,4 +166,4 @@ this._ = [];

Object.setPrototypeOf(this.I, null);
this.i = 0;
this.l = this.M = this.h.W = this.h.m = this.h;
this.M = 0;
this.H = this.l = this.h.L = this.h.m = this.h;
};

@@ -184,3 +184,3 @@ HashContainer.prototype.eraseElementByKey = function(t, i) {

}
this.X(r);
this.G(r);
return true;

@@ -193,15 +193,15 @@ };

}
this.X(i);
this.G(i);
return t.next();
};
HashContainer.prototype.eraseElementByPos = function(t) {
if (t < 0 || t > this.i - 1) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
var i = this.l;
var i = this.H;
while (t--) {
i = i.m;
}
this.X(i);
return this.i;
this.G(i);
return this.M;
};

@@ -208,0 +208,0 @@ return HashContainer;

@@ -1,4 +0,6 @@

import { initContainer } from "../ContainerBase";
import { HashContainer, HashContainerIterator } from "./Base";
import { initContainer, IteratorType } from "../ContainerBase";
import { HashContainer, HashContainerIterator, HashLinkNode } from "./Base";
declare class HashMapIterator<K, V> extends HashContainerIterator<K, V> {
readonly container: HashMap<K, V>;
constructor(node: HashLinkNode<K, V>, header: HashLinkNode<K, V>, container: HashMap<K, V>, iteratorType?: IteratorType);
get pointer(): [K, V];

@@ -27,9 +29,2 @@ copy(): HashMapIterator<K, V>;

/**
* @description Check key if exist in container.
* @param key - The element you want to search.
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
* If a `undefined` value is passed in, the type will be automatically judged.
* @returns An iterator pointing to the element if found, or super end if not found.
*/
/**
* @description Get the value of the element of the specified key.

@@ -44,2 +39,9 @@ * @param key - The key want to search.

getElementByPos(pos: number): [K, V];
/**
* @description Check key if exist in container.
* @param key - The element you want to search.
* @param isObject - Tell us if the type of inserted key is `object` to improve efficiency.<br/>
* If a `undefined` value is passed in, the type will be automatically judged.
* @returns An iterator pointing to the element if found, or super end if not found.
*/
find(key: K, isObject?: boolean): HashMapIterator<K, V>;

@@ -46,0 +48,0 @@ forEach(callback: (element: [K, V], index: number, hashMap: HashMap<K, V>) => void): void;

@@ -22,3 +22,3 @@ var __extends = this && this.t || function() {

var __generator = this && this.u || function(t, r) {
var __generator = this && this.i || function(t, r) {
var n = {

@@ -121,4 +121,6 @@ label: 0,

__extends(HashMapIterator, t);
function HashMapIterator() {
return t !== null && t.apply(this, arguments) || this;
function HashMapIterator(r, n, e, i) {
var a = t.call(this, r, n, i) || this;
a.container = e;
return a;
}

@@ -133,3 +135,3 @@ Object.defineProperty(HashMapIterator.prototype, "pointer", {

get: function(r, n) {
if (n === "0") return t.o.p; else if (n === "1") return t.o.H;
if (n === "0") return t.o.u; else if (n === "1") return t.o.p;
},

@@ -140,3 +142,3 @@ set: function(r, n, e) {

}
t.o.H = e;
t.o.p = e;
return true;

@@ -150,3 +152,3 @@ }

HashMapIterator.prototype.copy = function() {
return new HashMapIterator(this.o, this.h, this.iteratorType);
return new HashMapIterator(this.o, this.h, this.container, this.iteratorType);
};

@@ -170,20 +172,20 @@ return HashMapIterator;

HashMap.prototype.begin = function() {
return new HashMapIterator(this.l, this.h);
return new HashMapIterator(this.H, this.h, this);
};
HashMap.prototype.end = function() {
return new HashMapIterator(this.h, this.h);
return new HashMapIterator(this.h, this.h, this);
};
HashMap.prototype.rBegin = function() {
return new HashMapIterator(this.M, this.h, 1);
return new HashMapIterator(this.l, this.h, this, 1);
};
HashMap.prototype.rEnd = function() {
return new HashMapIterator(this.h, this.h, 1);
return new HashMapIterator(this.h, this.h, this, 1);
};
HashMap.prototype.front = function() {
if (this.i === 0) return;
return [ this.l.p, this.l.H ];
if (this.M === 0) return;
return [ this.H.u, this.H.p ];
};
HashMap.prototype.back = function() {
if (this.i === 0) return;
return [ this.M.p, this.M.H ];
if (this.M === 0) return;
return [ this.l.u, this.l.p ];
};

@@ -197,26 +199,26 @@ HashMap.prototype.setElement = function(t, r, n) {

var n = t[this.HASH_TAG];
return n !== undefined ? this._[n].H : undefined;
return n !== undefined ? this._[n].p : undefined;
}
var e = this.I[t];
return e ? e.H : undefined;
return e ? e.p : undefined;
};
HashMap.prototype.getElementByPos = function(t) {
if (t < 0 || t > this.i - 1) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
var r = this.l;
var r = this.H;
while (t--) {
r = r.m;
}
return [ r.p, r.H ];
return [ r.u, r.p ];
};
HashMap.prototype.find = function(t, r) {
var n = this.g(t, r);
return new HashMapIterator(n, this.h);
return new HashMapIterator(n, this.h, this);
};
HashMap.prototype.forEach = function(t) {
var r = 0;
var n = this.l;
var n = this.H;
while (n !== this.h) {
t([ n.p, n.H ], r++, this);
t([ n.u, n.p ], r++, this);
n = n.m;

@@ -231,3 +233,3 @@ }

case 0:
t = this.l;
t = this.H;
r.label = 1;

@@ -237,3 +239,3 @@

if (!(t !== this.h)) return [ 3, 3 ];
return [ 4, [ t.p, t.H ] ];
return [ 4, [ t.u, t.p ] ];

@@ -240,0 +242,0 @@ case 2:

@@ -1,7 +0,9 @@

import { initContainer } from "../ContainerBase";
import { HashContainer, HashContainerIterator } from "./Base";
declare class HashSetIterator<K, V> extends HashContainerIterator<K, V> {
import { initContainer, IteratorType } from "../ContainerBase";
import { HashContainer, HashContainerIterator, HashLinkNode } from "./Base";
declare class HashSetIterator<K> extends HashContainerIterator<K, undefined> {
readonly container: HashSet<K>;
constructor(node: HashLinkNode<K, undefined>, header: HashLinkNode<K, undefined>, container: HashSet<K>, iteratorType?: IteratorType);
get pointer(): K;
copy(): HashSetIterator<K, V>;
equals(iter: HashSetIterator<K, V>): boolean;
copy(): HashSetIterator<K>;
equals(iter: HashSetIterator<K>): boolean;
}

@@ -11,6 +13,6 @@ export type { HashSetIterator };

constructor(container?: initContainer<K>);
begin(): HashSetIterator<K, undefined>;
end(): HashSetIterator<K, undefined>;
rBegin(): HashSetIterator<K, undefined>;
rEnd(): HashSetIterator<K, undefined>;
begin(): HashSetIterator<K>;
end(): HashSetIterator<K>;
rBegin(): HashSetIterator<K>;
rEnd(): HashSetIterator<K>;
front(): K | undefined;

@@ -34,3 +36,3 @@ back(): K | undefined;

*/
find(key: K, isObject?: boolean): HashSetIterator<K, undefined>;
find(key: K, isObject?: boolean): HashSetIterator<K>;
forEach(callback: (element: K, index: number, container: HashSet<K>) => void): void;

@@ -37,0 +39,0 @@ [Symbol.iterator](): Generator<K, void, unknown>;

@@ -22,3 +22,3 @@ var __extends = this && this.t || function() {

var __generator = this && this.u || function(t, r) {
var __generator = this && this.i || function(t, r) {
var e = {

@@ -119,4 +119,6 @@ label: 0,

__extends(HashSetIterator, t);
function HashSetIterator() {
return t !== null && t.apply(this, arguments) || this;
function HashSetIterator(r, e, n, i) {
var s = t.call(this, r, e, i) || this;
s.container = n;
return s;
}

@@ -128,3 +130,3 @@ Object.defineProperty(HashSetIterator.prototype, "pointer", {

}
return this.o.p;
return this.o.u;
},

@@ -135,3 +137,3 @@ enumerable: false,

HashSetIterator.prototype.copy = function() {
return new HashSetIterator(this.o, this.h, this.iteratorType);
return new HashSetIterator(this.o, this.h, this.container, this.iteratorType);
};

@@ -155,18 +157,18 @@ return HashSetIterator;

HashSet.prototype.begin = function() {
return new HashSetIterator(this.l, this.h);
return new HashSetIterator(this.H, this.h, this);
};
HashSet.prototype.end = function() {
return new HashSetIterator(this.h, this.h);
return new HashSetIterator(this.h, this.h, this);
};
HashSet.prototype.rBegin = function() {
return new HashSetIterator(this.M, this.h, 1);
return new HashSetIterator(this.l, this.h, this, 1);
};
HashSet.prototype.rEnd = function() {
return new HashSetIterator(this.h, this.h, 1);
return new HashSetIterator(this.h, this.h, this, 1);
};
HashSet.prototype.front = function() {
return this.l.p;
return this.H.u;
};
HashSet.prototype.back = function() {
return this.M.p;
return this.l.u;
};

@@ -177,20 +179,20 @@ HashSet.prototype.insert = function(t, r) {

HashSet.prototype.getElementByPos = function(t) {
if (t < 0 || t > this.i - 1) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
var r = this.l;
var r = this.H;
while (t--) {
r = r.m;
}
return r.p;
return r.u;
};
HashSet.prototype.find = function(t, r) {
var e = this.g(t, r);
return new HashSetIterator(e, this.h);
return new HashSetIterator(e, this.h, this);
};
HashSet.prototype.forEach = function(t) {
var r = 0;
var e = this.l;
var e = this.H;
while (e !== this.h) {
t(e.p, r++, this);
t(e.u, r++, this);
e = e.m;

@@ -205,3 +207,3 @@ }

case 0:
t = this.l;
t = this.H;
r.label = 1;

@@ -211,3 +213,3 @@

if (!(t !== this.h)) return [ 3, 3 ];
return [ 4, t.p ];
return [ 4, t.u ];

@@ -214,0 +216,0 @@ case 2:

@@ -22,3 +22,3 @@ var __extends = this && this.t || function() {

var __read = this && this.P || function(i, r) {
var __read = this && this.q || function(i, r) {
var t = typeof Symbol === "function" && i[Symbol.iterator];

@@ -43,3 +43,3 @@ if (!t) return i;

var __spreadArray = this && this.A || function(i, r, t) {
var __spreadArray = this && this.D || function(i, r, t) {
if (t || arguments.length === 2) for (var e = 0, n = r.length, u; e < n; e++) {

@@ -73,63 +73,63 @@ if (u || !(e in r)) {

var n = i.call(this) || this;
n.j = t;
n.$ = t;
if (Array.isArray(r)) {
n.B = e ? __spreadArray([], __read(r), false) : r;
n.ii = e ? __spreadArray([], __read(r), false) : r;
} else {
n.B = [];
n.ii = [];
var u = n;
r.forEach((function(i) {
u.B.push(i);
u.ii.push(i);
}));
}
n.i = n.B.length;
var s = n.i >> 1;
for (var o = n.i - 1 >> 1; o >= 0; --o) {
n.O(o, s);
n.M = n.ii.length;
var s = n.M >> 1;
for (var o = n.M - 1 >> 1; o >= 0; --o) {
n.ri(o, s);
}
return n;
}
PriorityQueue.prototype.S = function(i) {
var r = this.B[i];
PriorityQueue.prototype.ti = function(i) {
var r = this.ii[i];
while (i > 0) {
var t = i - 1 >> 1;
var e = this.B[t];
if (this.j(e, r) <= 0) break;
this.B[i] = e;
var e = this.ii[t];
if (this.$(e, r) <= 0) break;
this.ii[i] = e;
i = t;
}
this.B[i] = r;
this.ii[i] = r;
};
PriorityQueue.prototype.O = function(i, r) {
var t = this.B[i];
PriorityQueue.prototype.ri = function(i, r) {
var t = this.ii[i];
while (i < r) {
var e = i << 1 | 1;
var n = e + 1;
var u = this.B[e];
if (n < this.i && this.j(u, this.B[n]) > 0) {
var u = this.ii[e];
if (n < this.M && this.$(u, this.ii[n]) > 0) {
e = n;
u = this.B[n];
u = this.ii[n];
}
if (this.j(u, t) >= 0) break;
this.B[i] = u;
if (this.$(u, t) >= 0) break;
this.ii[i] = u;
i = e;
}
this.B[i] = t;
this.ii[i] = t;
};
PriorityQueue.prototype.clear = function() {
this.i = 0;
this.B.length = 0;
this.M = 0;
this.ii.length = 0;
};
PriorityQueue.prototype.push = function(i) {
this.B.push(i);
this.S(this.i);
this.i += 1;
this.ii.push(i);
this.ti(this.M);
this.M += 1;
};
PriorityQueue.prototype.pop = function() {
if (this.i === 0) return;
var i = this.B[0];
var r = this.B.pop();
this.i -= 1;
if (this.i) {
this.B[0] = r;
this.O(0, this.i >> 1);
if (this.M === 0) return;
var i = this.ii[0];
var r = this.ii.pop();
this.M -= 1;
if (this.M) {
this.ii[0] = r;
this.ri(0, this.M >> 1);
}

@@ -139,20 +139,20 @@ return i;

PriorityQueue.prototype.top = function() {
return this.B[0];
return this.ii[0];
};
PriorityQueue.prototype.find = function(i) {
return this.B.indexOf(i) >= 0;
return this.ii.indexOf(i) >= 0;
};
PriorityQueue.prototype.remove = function(i) {
var r = this.B.indexOf(i);
var r = this.ii.indexOf(i);
if (r < 0) return false;
if (r === 0) {
this.pop();
} else if (r === this.i - 1) {
this.B.pop();
this.i -= 1;
} else if (r === this.M - 1) {
this.ii.pop();
this.M -= 1;
} else {
this.B.splice(r, 1, this.B.pop());
this.i -= 1;
this.S(r);
this.O(r, this.i >> 1);
this.ii.splice(r, 1, this.ii.pop());
this.M -= 1;
this.ti(r);
this.ri(r, this.M >> 1);
}

@@ -162,10 +162,10 @@ return true;

PriorityQueue.prototype.updateItem = function(i) {
var r = this.B.indexOf(i);
var r = this.ii.indexOf(i);
if (r < 0) return false;
this.S(r);
this.O(r, this.i >> 1);
this.ti(r);
this.ri(r, this.M >> 1);
return true;
};
PriorityQueue.prototype.toArray = function() {
return __spreadArray([], __read(this.B), false);
return __spreadArray([], __read(this.ii), false);
};

@@ -172,0 +172,0 @@ return PriorityQueue;

var __extends = this && this.t || function() {
var extendStatics = function(e, t) {
var extendStatics = function(t, i) {
extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(e, t) {
e.__proto__ = t;
} || function(e, t) {
for (var n in t) if (Object.prototype.hasOwnProperty.call(t, n)) e[n] = t[n];
} instanceof Array && function(t, i) {
t.__proto__ = i;
} || function(t, i) {
for (var n in i) if (Object.prototype.hasOwnProperty.call(i, n)) t[n] = i[n];
};
return extendStatics(e, t);
return extendStatics(t, i);
};
return function(e, t) {
if (typeof t !== "function" && t !== null) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
extendStatics(e, t);
return function(t, i) {
if (typeof i !== "function" && i !== null) throw new TypeError("Class extends value " + String(i) + " is not a constructor or null");
extendStatics(t, i);
function __() {
this.constructor = e;
this.constructor = t;
}
e.prototype = t === null ? Object.create(t) : (__.prototype = t.prototype, new __);
t.prototype = i === null ? Object.create(i) : (__.prototype = i.prototype, new __);
};

@@ -24,31 +24,42 @@ }();

import Deque from "../SequentialContainer/Deque";
var Queue = function(e) {
__extends(Queue, e);
function Queue(t) {
if (t === void 0) {
t = [];
var Queue = function(t) {
__extends(Queue, t);
function Queue(i) {
if (i === void 0) {
i = [];
}
var n = e.call(this) || this;
n.q = new Deque(t);
n.i = n.q.size();
var n = t.call(this) || this;
n.A = 0;
n.tt = [];
var e = n;
i.forEach((function(t) {
e.push(t);
}));
return n;
}
Queue.prototype.clear = function() {
this.q.clear();
this.i = 0;
this.tt = [];
this.M = this.A = 0;
};
Queue.prototype.push = function(e) {
this.q.pushBack(e);
this.i += 1;
return this.i;
Queue.prototype.push = function(t) {
var i = this.tt.length;
if (this.A / i > .5 && this.A + this.M >= i && i > 4096) {
var n = this.M;
for (var e = 0; e < n; ++e) {
this.tt[e] = this.tt[this.A + e];
}
this.A = 0;
this.tt[this.M] = t;
} else this.tt[this.A + this.M] = t;
return ++this.M;
};
Queue.prototype.pop = function() {
if (this.i === 0) return;
this.i -= 1;
return this.q.popFront();
if (this.M === 0) return;
var t = this.tt[this.A++];
this.M -= 1;
return t;
};
Queue.prototype.front = function() {
return this.q.front();
if (this.M === 0) return;
return this.tt[this.A];
};

@@ -55,0 +66,0 @@ return Queue;

@@ -31,3 +31,3 @@ var __extends = this && this.t || function() {

var i = t.call(this) || this;
i.k = [];
i.nt = [];
var r = i;

@@ -40,17 +40,17 @@ n.forEach((function(t) {

Stack.prototype.clear = function() {
this.i = 0;
this.k = [];
this.M = 0;
this.nt = [];
};
Stack.prototype.push = function(t) {
this.k.push(t);
this.i += 1;
return this.i;
this.nt.push(t);
this.M += 1;
return this.M;
};
Stack.prototype.pop = function() {
if (this.i === 0) return;
this.i -= 1;
return this.k.pop();
if (this.M === 0) return;
this.M -= 1;
return this.nt.pop();
};
Stack.prototype.top = function() {
return this.k[this.i - 1];
return this.nt[this.M - 1];
};

@@ -57,0 +57,0 @@ return Stack;

import { ContainerIterator } from "../../ContainerBase";
import SequentialContainer from "./index";
export declare abstract class RandomIterator<T> extends ContainerIterator<T> {
abstract readonly container: SequentialContainer<T>;
get pointer(): T;

@@ -4,0 +6,0 @@ set pointer(newValue: T);

@@ -28,10 +28,7 @@ var __extends = this && this.t || function() {

__extends(RandomIterator, t);
function RandomIterator(r, n, o, i, e) {
var s = t.call(this, e) || this;
s.o = r;
s.D = n;
s.R = o;
s.C = i;
if (s.iteratorType === 0) {
s.pre = function() {
function RandomIterator(r, n) {
var o = t.call(this, n) || this;
o.o = r;
if (o.iteratorType === 0) {
o.pre = function() {
if (this.o === 0) {

@@ -43,4 +40,4 @@ throwIteratorAccessError();

};
s.next = function() {
if (this.o === this.D()) {
o.next = function() {
if (this.o === this.container.size()) {
throwIteratorAccessError();

@@ -52,4 +49,4 @@ }

} else {
s.pre = function() {
if (this.o === this.D() - 1) {
o.pre = function() {
if (this.o === this.container.size() - 1) {
throwIteratorAccessError();

@@ -60,3 +57,3 @@ }

};
s.next = function() {
o.next = function() {
if (this.o === -1) {

@@ -69,16 +66,10 @@ throwIteratorAccessError();

}
return s;
return o;
}
Object.defineProperty(RandomIterator.prototype, "pointer", {
get: function() {
if (this.o < 0 || this.o > this.D() - 1) {
throw new RangeError;
}
return this.R(this.o);
return this.container.getElementByPos(this.o);
},
set: function(t) {
if (this.o < 0 || this.o > this.D() - 1) {
throw new RangeError;
}
this.C(this.o, t);
this.container.setElementByPos(this.o, t);
},

@@ -85,0 +76,0 @@ enumerable: false,

import SequentialContainer from './Base';
import { initContainer } from "../ContainerBase";
import { IteratorType, initContainer } from "../ContainerBase";
import { RandomIterator } from "./Base/RandomIterator";
declare class DequeIterator<T> extends RandomIterator<T> {
readonly container: Deque<T>;
constructor(node: number, container: Deque<T>, iteratorType?: IteratorType);
copy(): DequeIterator<T>;

@@ -6,0 +8,0 @@ equals(iter: DequeIterator<T>): boolean;

@@ -8,3 +8,3 @@ var __extends = this && this.t || function() {

} || function(t, i) {
for (var e in i) if (Object.prototype.hasOwnProperty.call(i, e)) t[e] = i[e];
for (var r in i) if (Object.prototype.hasOwnProperty.call(i, r)) t[r] = i[r];
};

@@ -23,4 +23,4 @@ return extendStatics(t, i);

var __generator = this && this.u || function(t, i) {
var e = {
var __generator = this && this.i || function(t, i) {
var r = {
label: 0,

@@ -33,3 +33,3 @@ sent: function() {

ops: []
}, r, s, h, n;
}, e, s, h, n;
return n = {

@@ -48,5 +48,5 @@ next: verb(0),

function step(n) {
if (r) throw new TypeError("Generator is already executing.");
while (e) try {
if (r = 1, s && (h = n[0] & 2 ? s["return"] : n[0] ? s["throw"] || ((h = s["return"]) && h.call(s),
if (e) throw new TypeError("Generator is already executing.");
while (r) try {
if (e = 1, s && (h = n[0] & 2 ? s["return"] : n[0] ? s["throw"] || ((h = s["return"]) && h.call(s),
0) : s.next) && !(h = h.call(s, n[1])).done) return h;

@@ -61,3 +61,3 @@ if (s = 0, h) n = [ n[0] & 2, h.value ];

case 4:
e.label++;
r.label++;
return {

@@ -69,3 +69,3 @@ value: n[1],

case 5:
e.label++;
r.label++;
s = n[1];

@@ -76,30 +76,30 @@ n = [ 0 ];

case 7:
n = e.ops.pop();
e.trys.pop();
n = r.ops.pop();
r.trys.pop();
continue;
default:
if (!(h = e.trys, h = h.length > 0 && h[h.length - 1]) && (n[0] === 6 || n[0] === 2)) {
e = 0;
if (!(h = r.trys, h = h.length > 0 && h[h.length - 1]) && (n[0] === 6 || n[0] === 2)) {
r = 0;
continue;
}
if (n[0] === 3 && (!h || n[1] > h[0] && n[1] < h[3])) {
e.label = n[1];
r.label = n[1];
break;
}
if (n[0] === 6 && e.label < h[1]) {
e.label = h[1];
if (n[0] === 6 && r.label < h[1]) {
r.label = h[1];
h = n;
break;
}
if (h && e.label < h[2]) {
e.label = h[2];
e.ops.push(n);
if (h && r.label < h[2]) {
r.label = h[2];
r.ops.push(n);
break;
}
if (h[2]) e.ops.pop();
e.trys.pop();
if (h[2]) r.ops.pop();
r.trys.pop();
continue;
}
n = i.call(t, e);
n = i.call(t, r);
} catch (t) {

@@ -109,3 +109,3 @@ n = [ 6, t ];

} finally {
r = h = 0;
e = h = 0;
}

@@ -120,8 +120,8 @@ if (n[0] & 5) throw n[1];

var __read = this && this.P || function(t, i) {
var e = typeof Symbol === "function" && t[Symbol.iterator];
if (!e) return t;
var r = e.call(t), s, h = [], n;
var __read = this && this.q || function(t, i) {
var r = typeof Symbol === "function" && t[Symbol.iterator];
if (!r) return t;
var e = r.call(t), s, h = [], n;
try {
while ((i === void 0 || i-- > 0) && !(s = r.next()).done) h.push(s.value);
while ((i === void 0 || i-- > 0) && !(s = e.next()).done) h.push(s.value);
} catch (t) {

@@ -133,3 +133,3 @@ n = {

try {
if (s && !s.done && (e = r["return"])) e.call(r);
if (s && !s.done && (r = e["return"])) r.call(e);
} finally {

@@ -142,7 +142,7 @@ if (n) throw n.error;

var __spreadArray = this && this.A || function(t, i, e) {
if (e || arguments.length === 2) for (var r = 0, s = i.length, h; r < s; r++) {
if (h || !(r in i)) {
if (!h) h = Array.prototype.slice.call(i, 0, r);
h[r] = i[r];
var __spreadArray = this && this.D || function(t, i, r) {
if (r || arguments.length === 2) for (var e = 0, s = i.length, h; e < s; e++) {
if (h || !(e in i)) {
if (!h) h = Array.prototype.slice.call(i, 0, e);
h[e] = i[e];
}

@@ -159,7 +159,9 @@ }

__extends(DequeIterator, t);
function DequeIterator() {
return t !== null && t.apply(this, arguments) || this;
function DequeIterator(i, r, e) {
var s = t.call(this, i, e) || this;
s.container = r;
return s;
}
DequeIterator.prototype.copy = function() {
return new DequeIterator(this.o, this.D, this.R, this.C, this.iteratorType);
return new DequeIterator(this.o, this.container, this.iteratorType);
};

@@ -171,208 +173,199 @@ return DequeIterator;

__extends(Deque, t);
function Deque(i, e) {
function Deque(i, r) {
if (i === void 0) {
i = [];
}
if (e === void 0) {
e = 1 << 12;
if (r === void 0) {
r = 1 << 12;
}
var r = t.call(this) || this;
r.N = 0;
r.T = 0;
r.G = 0;
r.F = 0;
r.J = 0;
r.K = [];
var s;
if ("size" in i) {
if (typeof i.size === "number") {
s = i.size;
} else {
s = i.size();
}
} else if ("length" in i) {
s = i.length;
} else {
throw new RangeError("Can't get container's size!");
var e = t.call(this) || this;
e.A = 0;
e.S = 0;
e.R = 0;
e.k = 0;
e.C = 0;
e.j = [];
var s = function() {
if (typeof i.length === "number") return i.length;
if (typeof i.size === "number") return i.size;
if (typeof i.size === "function") return i.size();
throw new TypeError("Cannot get the length or size of the container");
}();
e.B = r;
e.C = Math.max(Math.ceil(s / e.B), 1);
for (var h = 0; h < e.C; ++h) {
e.j.push(new Array(e.B));
}
r.L = e;
r.J = Math.max(Math.ceil(s / r.L), 1);
for (var h = 0; h < r.J; ++h) {
r.K.push(new Array(r.L));
}
var n = Math.ceil(s / r.L);
r.N = r.G = (r.J >> 1) - (n >> 1);
r.T = r.F = r.L - s % r.L >> 1;
var u = r;
var n = Math.ceil(s / e.B);
e.A = e.R = (e.C >> 1) - (n >> 1);
e.S = e.k = e.B - s % e.B >> 1;
var u = e;
i.forEach((function(t) {
u.pushBack(t);
}));
r.size = r.size.bind(r);
r.getElementByPos = r.getElementByPos.bind(r);
r.setElementByPos = r.setElementByPos.bind(r);
return r;
return e;
}
Deque.prototype.U = function() {
Deque.prototype.O = function() {
var t = [];
var i = Math.max(this.J >> 1, 1);
for (var e = 0; e < i; ++e) {
t[e] = new Array(this.L);
var i = Math.max(this.C >> 1, 1);
for (var r = 0; r < i; ++r) {
t[r] = new Array(this.B);
}
for (var e = this.N; e < this.J; ++e) {
t[t.length] = this.K[e];
for (var r = this.A; r < this.C; ++r) {
t[t.length] = this.j[r];
}
for (var e = 0; e < this.G; ++e) {
t[t.length] = this.K[e];
for (var r = 0; r < this.R; ++r) {
t[t.length] = this.j[r];
}
t[t.length] = __spreadArray([], __read(this.K[this.G]), false);
this.N = i;
this.G = t.length - 1;
for (var e = 0; e < i; ++e) {
t[t.length] = new Array(this.L);
t[t.length] = __spreadArray([], __read(this.j[this.R]), false);
this.A = i;
this.R = t.length - 1;
for (var r = 0; r < i; ++r) {
t[t.length] = new Array(this.B);
}
this.K = t;
this.J = t.length;
this.j = t;
this.C = t.length;
};
Deque.prototype.V = function(t) {
var i = this.T + t + 1;
var e = i % this.L;
var r = e - 1;
var s = this.N + (i - e) / this.L;
if (e === 0) s -= 1;
s %= this.J;
if (r < 0) r += this.L;
Deque.prototype.T = function(t) {
var i = this.S + t + 1;
var r = i % this.B;
var e = r - 1;
var s = this.A + (i - r) / this.B;
if (r === 0) s -= 1;
s %= this.C;
if (e < 0) e += this.B;
return {
curNodeBucketIndex: s,
curNodePointerIndex: r
curNodePointerIndex: e
};
};
Deque.prototype.clear = function() {
this.K = [ [] ];
this.J = 1;
this.N = this.G = this.i = 0;
this.T = this.F = this.L >> 1;
this.j = [ new Array(this.B) ];
this.C = 1;
this.A = this.R = this.M = 0;
this.S = this.k = this.B >> 1;
};
Deque.prototype.begin = function() {
return new DequeIterator(0, this.size, this.getElementByPos, this.setElementByPos);
return new DequeIterator(0, this);
};
Deque.prototype.end = function() {
return new DequeIterator(this.i, this.size, this.getElementByPos, this.setElementByPos);
return new DequeIterator(this.M, this);
};
Deque.prototype.rBegin = function() {
return new DequeIterator(this.i - 1, this.size, this.getElementByPos, this.setElementByPos, 1);
return new DequeIterator(this.M - 1, this, 1);
};
Deque.prototype.rEnd = function() {
return new DequeIterator(-1, this.size, this.getElementByPos, this.setElementByPos, 1);
return new DequeIterator(-1, this, 1);
};
Deque.prototype.front = function() {
return this.K[this.N][this.T];
if (this.M === 0) return;
return this.j[this.A][this.S];
};
Deque.prototype.back = function() {
return this.K[this.G][this.F];
if (this.M === 0) return;
return this.j[this.R][this.k];
};
Deque.prototype.pushBack = function(t) {
if (this.i) {
if (this.F < this.L - 1) {
this.F += 1;
} else if (this.G < this.J - 1) {
this.G += 1;
this.F = 0;
if (this.M) {
if (this.k < this.B - 1) {
this.k += 1;
} else if (this.R < this.C - 1) {
this.R += 1;
this.k = 0;
} else {
this.G = 0;
this.F = 0;
this.R = 0;
this.k = 0;
}
if (this.G === this.N && this.F === this.T) this.U();
if (this.R === this.A && this.k === this.S) this.O();
}
this.i += 1;
this.K[this.G][this.F] = t;
return this.i;
this.M += 1;
this.j[this.R][this.k] = t;
return this.M;
};
Deque.prototype.popBack = function() {
if (this.i === 0) return;
var t = this.K[this.G][this.F];
delete this.K[this.G][this.F];
if (this.i !== 1) {
if (this.F > 0) {
this.F -= 1;
} else if (this.G > 0) {
this.G -= 1;
this.F = this.L - 1;
if (this.M === 0) return;
var t = this.j[this.R][this.k];
if (this.M !== 1) {
if (this.k > 0) {
this.k -= 1;
} else if (this.R > 0) {
this.R -= 1;
this.k = this.B - 1;
} else {
this.G = this.J - 1;
this.F = this.L - 1;
this.R = this.C - 1;
this.k = this.B - 1;
}
}
this.i -= 1;
this.M -= 1;
return t;
};
Deque.prototype.pushFront = function(t) {
if (this.i) {
if (this.T > 0) {
this.T -= 1;
} else if (this.N > 0) {
this.N -= 1;
this.T = this.L - 1;
if (this.M) {
if (this.S > 0) {
this.S -= 1;
} else if (this.A > 0) {
this.A -= 1;
this.S = this.B - 1;
} else {
this.N = this.J - 1;
this.T = this.L - 1;
this.A = this.C - 1;
this.S = this.B - 1;
}
if (this.N === this.G && this.T === this.F) this.U();
if (this.A === this.R && this.S === this.k) this.O();
}
this.i += 1;
this.K[this.N][this.T] = t;
return this.i;
this.M += 1;
this.j[this.A][this.S] = t;
return this.M;
};
Deque.prototype.popFront = function() {
if (this.i === 0) return;
var t = this.K[this.N][this.T];
delete this.K[this.N][this.T];
if (this.i !== 1) {
if (this.T < this.L - 1) {
this.T += 1;
} else if (this.N < this.J - 1) {
this.N += 1;
this.T = 0;
if (this.M === 0) return;
var t = this.j[this.A][this.S];
if (this.M !== 1) {
if (this.S < this.B - 1) {
this.S += 1;
} else if (this.A < this.C - 1) {
this.A += 1;
this.S = 0;
} else {
this.N = 0;
this.T = 0;
this.A = 0;
this.S = 0;
}
}
this.i -= 1;
this.M -= 1;
return t;
};
Deque.prototype.getElementByPos = function(t) {
if (t < 0 || t > this.i - 1) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
var i = this.V(t), e = i.curNodeBucketIndex, r = i.curNodePointerIndex;
return this.K[e][r];
var i = this.T(t), r = i.curNodeBucketIndex, e = i.curNodePointerIndex;
return this.j[r][e];
};
Deque.prototype.setElementByPos = function(t, i) {
if (t < 0 || t > this.i - 1) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
var e = this.V(t), r = e.curNodeBucketIndex, s = e.curNodePointerIndex;
this.K[r][s] = i;
var r = this.T(t), e = r.curNodeBucketIndex, s = r.curNodePointerIndex;
this.j[e][s] = i;
};
Deque.prototype.insert = function(t, i, e) {
if (e === void 0) {
e = 1;
Deque.prototype.insert = function(t, i, r) {
if (r === void 0) {
r = 1;
}
if (t < 0 || t > this.i) {
if (t < 0 || t > this.M) {
throw new RangeError;
}
if (t === 0) {
while (e--) this.pushFront(i);
} else if (t === this.i) {
while (e--) this.pushBack(i);
while (r--) this.pushFront(i);
} else if (t === this.M) {
while (r--) this.pushBack(i);
} else {
var r = [];
for (var s = t; s < this.i; ++s) {
r.push(this.getElementByPos(s));
var e = [];
for (var s = t; s < this.M; ++s) {
e.push(this.getElementByPos(s));
}
this.cut(t - 1);
for (var s = 0; s < e; ++s) this.pushBack(i);
for (var s = 0; s < r.length; ++s) this.pushBack(r[s]);
for (var s = 0; s < r; ++s) this.pushBack(i);
for (var s = 0; s < e.length; ++s) this.pushBack(e[s]);
}
return this.i;
return this.M;
};

@@ -384,35 +377,35 @@ Deque.prototype.cut = function(t) {

}
var i = this.V(t), e = i.curNodeBucketIndex, r = i.curNodePointerIndex;
this.G = e;
this.F = r;
this.i = t + 1;
return this.i;
var i = this.T(t), r = i.curNodeBucketIndex, e = i.curNodePointerIndex;
this.R = r;
this.k = e;
this.M = t + 1;
return this.M;
};
Deque.prototype.eraseElementByPos = function(t) {
if (t < 0 || t > this.i - 1) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
if (t === 0) this.popFront(); else if (t === this.i - 1) this.popBack(); else {
if (t === 0) this.popFront(); else if (t === this.M - 1) this.popBack(); else {
var i = [];
for (var e = t + 1; e < this.i; ++e) {
i.push(this.getElementByPos(e));
for (var r = t + 1; r < this.M; ++r) {
i.push(this.getElementByPos(r));
}
this.cut(t);
this.popBack();
var r = this;
var e = this;
i.forEach((function(t) {
r.pushBack(t);
e.pushBack(t);
}));
}
return this.i;
return this.M;
};
Deque.prototype.eraseElementByValue = function(t) {
if (this.i === 0) return 0;
if (this.M === 0) return 0;
var i = [];
for (var e = 0; e < this.i; ++e) {
var r = this.getElementByPos(e);
if (r !== t) i.push(r);
for (var r = 0; r < this.M; ++r) {
var e = this.getElementByPos(r);
if (e !== t) i.push(e);
}
var s = i.length;
for (var e = 0; e < s; ++e) this.setElementByPos(e, i[e]);
for (var r = 0; r < s; ++r) this.setElementByPos(r, i[r]);
return this.cut(s - 1);

@@ -427,5 +420,5 @@ };

Deque.prototype.find = function(t) {
for (var i = 0; i < this.i; ++i) {
for (var i = 0; i < this.M; ++i) {
if (this.getElementByPos(i) === t) {
return new DequeIterator(i, this.size, this.getElementByPos, this.setElementByPos);
return new DequeIterator(i, this);
}

@@ -437,7 +430,7 @@ }

var t = 0;
var i = this.i - 1;
var i = this.M - 1;
while (t < i) {
var e = this.getElementByPos(t);
var r = this.getElementByPos(t);
this.setElementByPos(t, this.getElementByPos(i));
this.setElementByPos(i, e);
this.setElementByPos(i, r);
t += 1;

@@ -448,27 +441,27 @@ i -= 1;

Deque.prototype.unique = function() {
if (this.i <= 1) {
return this.i;
if (this.M <= 1) {
return this.M;
}
var t = 1;
var i = this.getElementByPos(0);
for (var e = 1; e < this.i; ++e) {
var r = this.getElementByPos(e);
if (r !== i) {
i = r;
this.setElementByPos(t++, r);
for (var r = 1; r < this.M; ++r) {
var e = this.getElementByPos(r);
if (e !== i) {
i = e;
this.setElementByPos(t++, e);
}
}
while (this.i > t) this.popBack();
return this.i;
while (this.M > t) this.popBack();
return this.M;
};
Deque.prototype.sort = function(t) {
var i = [];
for (var e = 0; e < this.i; ++e) {
i.push(this.getElementByPos(e));
for (var r = 0; r < this.M; ++r) {
i.push(this.getElementByPos(r));
}
i.sort(t);
for (var e = 0; e < this.i; ++e) this.setElementByPos(e, i[e]);
for (var r = 0; r < this.M; ++r) this.setElementByPos(r, i[r]);
};
Deque.prototype.shrinkToFit = function() {
if (this.i === 0) return;
if (this.M === 0) return;
var t = [];

@@ -478,7 +471,7 @@ this.forEach((function(i) {

}));
this.J = Math.max(Math.ceil(this.i / this.L), 1);
this.i = this.N = this.G = this.T = this.F = 0;
this.K = [];
for (var i = 0; i < this.J; ++i) {
this.K.push(new Array(this.L));
this.C = Math.max(Math.ceil(this.M / this.B), 1);
this.M = this.A = this.R = this.S = this.k = 0;
this.j = [];
for (var i = 0; i < this.C; ++i) {
this.j.push(new Array(this.B));
}

@@ -488,3 +481,3 @@ for (var i = 0; i < t.length; ++i) this.pushBack(t[i]);

Deque.prototype.forEach = function(t) {
for (var i = 0; i < this.i; ++i) {
for (var i = 0; i < this.M; ++i) {
t(this.getElementByPos(i), i, this);

@@ -503,3 +496,3 @@ }

case 1:
if (!(t < this.i)) return [ 3, 4 ];
if (!(t < this.M)) return [ 3, 4 ];
return [ 4, this.getElementByPos(t) ];

@@ -506,0 +499,0 @@

import SequentialContainer from './Base';
import { ContainerIterator, initContainer } from "../ContainerBase";
declare class LinkListIterator<T> extends ContainerIterator<T> {
readonly container: LinkList<T>;
get pointer(): T;

@@ -5,0 +6,0 @@ set pointer(newValue: T);

@@ -22,3 +22,3 @@ var __extends = this && this.t || function() {

var __generator = this && this.u || function(t, i) {
var __generator = this && this.i || function(t, i) {
var r = {

@@ -121,15 +121,16 @@ label: 0,

__extends(LinkListIterator, t);
function LinkListIterator(i, r, n) {
var s = t.call(this, n) || this;
s.o = i;
s.h = r;
if (s.iteratorType === 0) {
s.pre = function() {
if (this.o.W === this.h) {
function LinkListIterator(i, r, n, s) {
var e = t.call(this, s) || this;
e.o = i;
e.h = r;
e.container = n;
if (e.iteratorType === 0) {
e.pre = function() {
if (this.o.L === this.h) {
throwIteratorAccessError();
}
this.o = this.o.W;
this.o = this.o.L;
return this;
};
s.next = function() {
e.next = function() {
if (this.o === this.h) {

@@ -142,3 +143,3 @@ throwIteratorAccessError();

} else {
s.pre = function() {
e.pre = function() {
if (this.o.m === this.h) {

@@ -150,11 +151,11 @@ throwIteratorAccessError();

};
s.next = function() {
e.next = function() {
if (this.o === this.h) {
throwIteratorAccessError();
}
this.o = this.o.W;
this.o = this.o.L;
return this;
};
}
return s;
return e;
}

@@ -166,3 +167,3 @@ Object.defineProperty(LinkListIterator.prototype, "pointer", {

}
return this.o.H;
return this.o.p;
},

@@ -173,3 +174,3 @@ set: function(t) {

}
this.o.H = t;
this.o.p = t;
},

@@ -180,3 +181,3 @@ enumerable: false,

LinkListIterator.prototype.copy = function() {
return new LinkListIterator(this.o, this.h, this.iteratorType);
return new LinkListIterator(this.o, this.h, this.container, this.iteratorType);
};

@@ -194,3 +195,3 @@ return LinkListIterator;

r.h = {};
r.l = r.M = r.h.W = r.h.m = r.h;
r.H = r.l = r.h.L = r.h.m = r.h;
var n = r;

@@ -202,83 +203,83 @@ i.forEach((function(t) {

}
LinkList.prototype.X = function(t) {
var i = t.W, r = t.m;
LinkList.prototype.G = function(t) {
var i = t.L, r = t.m;
i.m = r;
r.W = i;
r.L = i;
if (t === this.H) {
this.H = r;
}
if (t === this.l) {
this.l = r;
this.l = i;
}
if (t === this.M) {
this.M = i;
}
this.i -= 1;
this.M -= 1;
};
LinkList.prototype.Y = function(t, i) {
LinkList.prototype.F = function(t, i) {
var r = i.m;
var n = {
H: t,
W: i,
p: t,
L: i,
m: r
};
i.m = n;
r.W = n;
r.L = n;
if (i === this.h) {
this.l = n;
this.H = n;
}
if (r === this.h) {
this.M = n;
this.l = n;
}
this.i += 1;
this.M += 1;
};
LinkList.prototype.clear = function() {
this.i = 0;
this.l = this.M = this.h.W = this.h.m = this.h;
this.M = 0;
this.H = this.l = this.h.L = this.h.m = this.h;
};
LinkList.prototype.begin = function() {
return new LinkListIterator(this.l, this.h);
return new LinkListIterator(this.H, this.h, this);
};
LinkList.prototype.end = function() {
return new LinkListIterator(this.h, this.h);
return new LinkListIterator(this.h, this.h, this);
};
LinkList.prototype.rBegin = function() {
return new LinkListIterator(this.M, this.h, 1);
return new LinkListIterator(this.l, this.h, this, 1);
};
LinkList.prototype.rEnd = function() {
return new LinkListIterator(this.h, this.h, 1);
return new LinkListIterator(this.h, this.h, this, 1);
};
LinkList.prototype.front = function() {
return this.l.H;
return this.H.p;
};
LinkList.prototype.back = function() {
return this.M.H;
return this.l.p;
};
LinkList.prototype.getElementByPos = function(t) {
if (t < 0 || t > this.i - 1) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
var i = this.l;
var i = this.H;
while (t--) {
i = i.m;
}
return i.H;
return i.p;
};
LinkList.prototype.eraseElementByPos = function(t) {
if (t < 0 || t > this.i - 1) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
var i = this.l;
var i = this.H;
while (t--) {
i = i.m;
}
this.X(i);
return this.i;
this.G(i);
return this.M;
};
LinkList.prototype.eraseElementByValue = function(t) {
var i = this.l;
var i = this.H;
while (i !== this.h) {
if (i.H === t) {
this.X(i);
if (i.p === t) {
this.G(i);
}
i = i.m;
}
return this.i;
return this.M;
};

@@ -291,34 +292,34 @@ LinkList.prototype.eraseElementByIterator = function(t) {

t = t.next();
this.X(i);
this.G(i);
return t;
};
LinkList.prototype.pushBack = function(t) {
this.Y(t, this.M);
return this.i;
this.F(t, this.l);
return this.M;
};
LinkList.prototype.popBack = function() {
if (this.i === 0) return;
var t = this.M.H;
this.X(this.M);
if (this.M === 0) return;
var t = this.l.p;
this.G(this.l);
return t;
};
LinkList.prototype.pushFront = function(t) {
this.Y(t, this.h);
return this.i;
this.F(t, this.h);
return this.M;
};
LinkList.prototype.popFront = function() {
if (this.i === 0) return;
var t = this.l.H;
this.X(this.l);
if (this.M === 0) return;
var t = this.H.p;
this.G(this.H);
return t;
};
LinkList.prototype.setElementByPos = function(t, i) {
if (t < 0 || t > this.i - 1) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
var r = this.l;
var r = this.H;
while (t--) {
r = r.m;
}
r.H = i;
r.p = i;
};

@@ -329,12 +330,12 @@ LinkList.prototype.insert = function(t, i, r) {

}
if (t < 0 || t > this.i) {
if (t < 0 || t > this.M) {
throw new RangeError;
}
if (r <= 0) return this.i;
if (r <= 0) return this.M;
if (t === 0) {
while (r--) this.pushFront(i);
} else if (t === this.i) {
} else if (t === this.M) {
while (r--) this.pushBack(i);
} else {
var n = this.l;
var n = this.H;
for (var s = 1; s < t; ++s) {

@@ -344,21 +345,21 @@ n = n.m;

var e = n.m;
this.i += r;
this.M += r;
while (r--) {
n.m = {
H: i,
W: n
p: i,
L: n
};
n.m.W = n;
n.m.L = n;
n = n.m;
}
n.m = e;
e.W = n;
e.L = n;
}
return this.i;
return this.M;
};
LinkList.prototype.find = function(t) {
var i = this.l;
var i = this.H;
while (i !== this.h) {
if (i.H === t) {
return new LinkListIterator(i, this.h);
if (i.p === t) {
return new LinkListIterator(i, this.h, this);
}

@@ -370,12 +371,12 @@ i = i.m;

LinkList.prototype.reverse = function() {
if (this.i <= 1) return;
var t = this.l;
var i = this.M;
if (this.M <= 1) return;
var t = this.H;
var i = this.l;
var r = 0;
while (r << 1 < this.i) {
var n = t.H;
t.H = i.H;
i.H = n;
while (r << 1 < this.M) {
var n = t.p;
t.p = i.p;
i.p = n;
t = t.m;
i = i.W;
i = i.L;
r += 1;

@@ -385,20 +386,20 @@ }

LinkList.prototype.unique = function() {
if (this.i <= 1) {
return this.i;
if (this.M <= 1) {
return this.M;
}
var t = this.l;
var t = this.H;
while (t !== this.h) {
var i = t;
while (i.m !== this.h && i.H === i.m.H) {
while (i.m !== this.h && i.p === i.m.p) {
i = i.m;
this.i -= 1;
this.M -= 1;
}
t.m = i.m;
t.m.W = t;
t.m.L = t;
t = t.m;
}
return this.i;
return this.M;
};
LinkList.prototype.sort = function(t) {
if (this.i <= 1) return;
if (this.M <= 1) return;
var i = [];

@@ -409,5 +410,5 @@ this.forEach((function(t) {

i.sort(t);
var r = this.l;
var r = this.H;
i.forEach((function(t) {
r.H = t;
r.p = t;
r = r.m;

@@ -418,3 +419,3 @@ }));

var i = this;
if (this.i === 0) {
if (this.M === 0) {
t.forEach((function(t) {

@@ -424,17 +425,17 @@ i.pushBack(t);

} else {
var r = this.l;
var r = this.H;
t.forEach((function(t) {
while (r !== i.h && r.H <= t) {
while (r !== i.h && r.p <= t) {
r = r.m;
}
i.Y(t, r.W);
i.F(t, r.L);
}));
}
return this.i;
return this.M;
};
LinkList.prototype.forEach = function(t) {
var i = this.l;
var i = this.H;
var r = 0;
while (i !== this.h) {
t(i.H, r++, this);
t(i.p, r++, this);
i = i.m;

@@ -449,4 +450,4 @@ }

case 0:
if (this.i === 0) return [ 2 ];
t = this.l;
if (this.M === 0) return [ 2 ];
t = this.H;
i.label = 1;

@@ -456,3 +457,3 @@

if (!(t !== this.h)) return [ 3, 3 ];
return [ 4, t.H ];
return [ 4, t.p ];

@@ -459,0 +460,0 @@ case 2:

import SequentialContainer from './Base';
import { initContainer } from "../ContainerBase";
import { initContainer, IteratorType } from "../ContainerBase";
import { RandomIterator } from "./Base/RandomIterator";
declare class VectorIterator<T> extends RandomIterator<T> {
container: Vector<T>;
constructor(node: number, container: Vector<T>, iteratorType?: IteratorType);
copy(): VectorIterator<T>;

@@ -6,0 +8,0 @@ equals(iter: VectorIterator<T>): boolean;

@@ -22,3 +22,3 @@ var __extends = this && this.t || function() {

var __generator = this && this.u || function(t, r) {
var __generator = this && this.i || function(t, r) {
var e = {

@@ -32,10 +32,10 @@ label: 0,

ops: []
}, n, i, o, s;
return s = {
}, n, i, o, u;
return u = {
next: verb(0),
throw: verb(1),
return: verb(2)
}, typeof Symbol === "function" && (s[Symbol.iterator] = function() {
}, typeof Symbol === "function" && (u[Symbol.iterator] = function() {
return this;
}), s;
}), u;
function verb(t) {

@@ -46,12 +46,12 @@ return function(r) {

}
function step(s) {
function step(u) {
if (n) throw new TypeError("Generator is already executing.");
while (e) try {
if (n = 1, i && (o = s[0] & 2 ? i["return"] : s[0] ? i["throw"] || ((o = i["return"]) && o.call(i),
0) : i.next) && !(o = o.call(i, s[1])).done) return o;
if (i = 0, o) s = [ s[0] & 2, o.value ];
switch (s[0]) {
if (n = 1, i && (o = u[0] & 2 ? i["return"] : u[0] ? i["throw"] || ((o = i["return"]) && o.call(i),
0) : i.next) && !(o = o.call(i, u[1])).done) return o;
if (i = 0, o) u = [ u[0] & 2, o.value ];
switch (u[0]) {
case 0:
case 1:
o = s;
o = u;
break;

@@ -62,3 +62,3 @@

return {
value: s[1],
value: u[1],
done: false

@@ -69,8 +69,8 @@ };

e.label++;
i = s[1];
s = [ 0 ];
i = u[1];
u = [ 0 ];
continue;
case 7:
s = e.ops.pop();
u = e.ops.pop();
e.trys.pop();

@@ -80,13 +80,13 @@ continue;

default:
if (!(o = e.trys, o = o.length > 0 && o[o.length - 1]) && (s[0] === 6 || s[0] === 2)) {
if (!(o = e.trys, o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
e = 0;
continue;
}
if (s[0] === 3 && (!o || s[1] > o[0] && s[1] < o[3])) {
e.label = s[1];
if (u[0] === 3 && (!o || u[1] > o[0] && u[1] < o[3])) {
e.label = u[1];
break;
}
if (s[0] === 6 && e.label < o[1]) {
if (u[0] === 6 && e.label < o[1]) {
e.label = o[1];
o = s;
o = u;
break;

@@ -96,3 +96,3 @@ }

e.label = o[2];
e.ops.push(s);
e.ops.push(u);
break;

@@ -104,5 +104,5 @@ }

}
s = r.call(t, e);
u = r.call(t, e);
} catch (t) {
s = [ 6, t ];
u = [ 6, t ];
i = 0;

@@ -112,5 +112,5 @@ } finally {

}
if (s[0] & 5) throw s[1];
if (u[0] & 5) throw u[1];
return {
value: s[0] ? s[1] : void 0,
value: u[0] ? u[1] : void 0,
done: true

@@ -121,10 +121,10 @@ };

var __read = this && this.P || function(t, r) {
var __read = this && this.q || function(t, r) {
var e = typeof Symbol === "function" && t[Symbol.iterator];
if (!e) return t;
var n = e.call(t), i, o = [], s;
var n = e.call(t), i, o = [], u;
try {
while ((r === void 0 || r-- > 0) && !(i = n.next()).done) o.push(i.value);
} catch (t) {
s = {
u = {
error: t

@@ -136,3 +136,3 @@ };

} finally {
if (s) throw s.error;
if (u) throw u.error;
}

@@ -143,3 +143,3 @@ }

var __spreadArray = this && this.A || function(t, r, e) {
var __spreadArray = this && this.D || function(t, r, e) {
if (e || arguments.length === 2) for (var n = 0, i = r.length, o; n < i; n++) {

@@ -154,3 +154,3 @@ if (o || !(n in r)) {

var __values = this && this.Z || function(t) {
var __values = this && this.V || function(t) {
var r = typeof Symbol === "function" && Symbol.iterator, e = r && t[r], n = 0;

@@ -176,7 +176,9 @@ if (e) return e.call(t);

__extends(VectorIterator, t);
function VectorIterator() {
return t !== null && t.apply(this, arguments) || this;
function VectorIterator(r, e, n) {
var i = t.call(this, r, n) || this;
i.container = e;
return i;
}
VectorIterator.prototype.copy = function() {
return new VectorIterator(this.o, this.D, this.R, this.C, this.iteratorType);
return new VectorIterator(this.o, this.container, this.iteratorType);
};

@@ -197,6 +199,6 @@ return VectorIterator;

if (Array.isArray(r)) {
n.$ = e ? __spreadArray([], __read(r), false) : r;
n.i = r.length;
n.J = e ? __spreadArray([], __read(r), false) : r;
n.M = r.length;
} else {
n.$ = [];
n.J = [];
var i = n;

@@ -207,52 +209,49 @@ r.forEach((function(t) {

}
n.size = n.size.bind(n);
n.getElementByPos = n.getElementByPos.bind(n);
n.setElementByPos = n.setElementByPos.bind(n);
return n;
}
Vector.prototype.clear = function() {
this.i = 0;
this.$.length = 0;
this.M = 0;
this.J.length = 0;
};
Vector.prototype.begin = function() {
return new VectorIterator(0, this.size, this.getElementByPos, this.setElementByPos);
return new VectorIterator(0, this);
};
Vector.prototype.end = function() {
return new VectorIterator(this.i, this.size, this.getElementByPos, this.setElementByPos);
return new VectorIterator(this.M, this);
};
Vector.prototype.rBegin = function() {
return new VectorIterator(this.i - 1, this.size, this.getElementByPos, this.setElementByPos, 1);
return new VectorIterator(this.M - 1, this, 1);
};
Vector.prototype.rEnd = function() {
return new VectorIterator(-1, this.size, this.getElementByPos, this.setElementByPos, 1);
return new VectorIterator(-1, this, 1);
};
Vector.prototype.front = function() {
return this.$[0];
return this.J[0];
};
Vector.prototype.back = function() {
return this.$[this.i - 1];
return this.J[this.M - 1];
};
Vector.prototype.getElementByPos = function(t) {
if (t < 0 || t > this.i - 1) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
return this.$[t];
return this.J[t];
};
Vector.prototype.eraseElementByPos = function(t) {
if (t < 0 || t > this.i - 1) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
this.$.splice(t, 1);
this.i -= 1;
return this.i;
this.J.splice(t, 1);
this.M -= 1;
return this.M;
};
Vector.prototype.eraseElementByValue = function(t) {
var r = 0;
for (var e = 0; e < this.i; ++e) {
if (this.$[e] !== t) {
this.$[r++] = this.$[e];
for (var e = 0; e < this.M; ++e) {
if (this.J[e] !== t) {
this.J[r++] = this.J[e];
}
}
this.i = this.$.length = r;
return this.i;
this.M = this.J.length = r;
return this.M;
};

@@ -266,16 +265,16 @@ Vector.prototype.eraseElementByIterator = function(t) {

Vector.prototype.pushBack = function(t) {
this.$.push(t);
this.i += 1;
return this.i;
this.J.push(t);
this.M += 1;
return this.M;
};
Vector.prototype.popBack = function() {
if (this.i === 0) return;
this.i -= 1;
return this.$.pop();
if (this.M === 0) return;
this.M -= 1;
return this.J.pop();
};
Vector.prototype.setElementByPos = function(t, r) {
if (t < 0 || t > this.i - 1) {
if (t < 0 || t > this.M - 1) {
throw new RangeError;
}
this.$[t] = r;
this.J[t] = r;
};

@@ -287,13 +286,13 @@ Vector.prototype.insert = function(t, r, e) {

}
if (t < 0 || t > this.i) {
if (t < 0 || t > this.M) {
throw new RangeError;
}
(n = this.$).splice.apply(n, __spreadArray([ t, 0 ], __read(new Array(e).fill(r)), false));
this.i += e;
return this.i;
(n = this.J).splice.apply(n, __spreadArray([ t, 0 ], __read(new Array(e).fill(r)), false));
this.M += e;
return this.M;
};
Vector.prototype.find = function(t) {
for (var r = 0; r < this.i; ++r) {
if (this.$[r] === t) {
return new VectorIterator(r, this.size, this.getElementByPos, this.getElementByPos);
for (var r = 0; r < this.M; ++r) {
if (this.J[r] === t) {
return new VectorIterator(r, this);
}

@@ -304,20 +303,20 @@ }

Vector.prototype.reverse = function() {
this.$.reverse();
this.J.reverse();
};
Vector.prototype.unique = function() {
var t = 1;
for (var r = 1; r < this.i; ++r) {
if (this.$[r] !== this.$[r - 1]) {
this.$[t++] = this.$[r];
for (var r = 1; r < this.M; ++r) {
if (this.J[r] !== this.J[r - 1]) {
this.J[t++] = this.J[r];
}
}
this.i = this.$.length = t;
return this.i;
this.M = this.J.length = t;
return this.M;
};
Vector.prototype.sort = function(t) {
this.$.sort(t);
this.J.sort(t);
};
Vector.prototype.forEach = function(t) {
for (var r = 0; r < this.i; ++r) {
t(this.$[r], r, this);
for (var r = 0; r < this.M; ++r) {
t(this.J[r], r, this);
}

@@ -330,3 +329,3 @@ };

case 0:
return [ 5, __values(this.$) ];
return [ 5, __values(this.J) ];

@@ -333,0 +332,0 @@ case 1:

@@ -22,3 +22,3 @@ var __extends = this && this.t || function() {

var __read = this && this.P || function(e, r) {
var __read = this && this.q || function(e, r) {
var i = typeof Symbol === "function" && e[Symbol.iterator];

@@ -43,3 +43,3 @@ if (!i) return e;

var __values = this && this.Z || function(e) {
var __values = this && this.V || function(e) {
var r = typeof Symbol === "function" && Symbol.iterator, i = r && e[r], t = 0;

@@ -79,4 +79,4 @@ if (i) return i.call(e);

var t = e.call(this) || this;
t.ir = undefined;
t.j = r;
t.W = undefined;
t.$ = r;
if (i) {

@@ -87,6 +87,6 @@ t.re = TreeNodeEnableIndex;

if (t) {
var n = t.hr;
var n = t.rr;
while (n !== this.h) {
n.cr += 1;
n = n.hr;
n.tr += 1;
n = n.rr;
}

@@ -101,9 +101,9 @@ var s = this.fe(t);

}
return this.i;
return this.M;
};
t.X = function(e) {
t.G = function(e) {
var r = this.he(e);
while (r !== this.h) {
r.cr -= 1;
r = r.hr;
r.tr -= 1;
r = r.rr;
}

@@ -116,5 +116,5 @@ };

if (t) this.fe(t);
return this.i;
return this.M;
};
t.X = t.he;
t.G = t.he;
}

@@ -124,11 +124,11 @@ t.h = new t.re;

}
TreeContainer.prototype.nr = function(e, r) {
TreeContainer.prototype.U = function(e, r) {
var i = this.h;
while (e) {
var t = this.j(e.p, r);
var t = this.$(e.u, r);
if (t < 0) {
e = e.tr;
e = e.N;
} else if (t > 0) {
i = e;
e = e.er;
e = e.K;
} else return e;

@@ -138,11 +138,11 @@ }

};
TreeContainer.prototype.ar = function(e, r) {
TreeContainer.prototype.X = function(e, r) {
var i = this.h;
while (e) {
var t = this.j(e.p, r);
var t = this.$(e.u, r);
if (t <= 0) {
e = e.tr;
e = e.N;
} else {
i = e;
e = e.er;
e = e.K;
}

@@ -152,11 +152,11 @@ }

};
TreeContainer.prototype.ur = function(e, r) {
TreeContainer.prototype.Y = function(e, r) {
var i = this.h;
while (e) {
var t = this.j(e.p, r);
var t = this.$(e.u, r);
if (t < 0) {
i = e;
e = e.tr;
e = e.N;
} else if (t > 0) {
e = e.er;
e = e.K;
} else return e;

@@ -166,11 +166,11 @@ }

};
TreeContainer.prototype.sr = function(e, r) {
TreeContainer.prototype.Z = function(e, r) {
var i = this.h;
while (e) {
var t = this.j(e.p, r);
var t = this.$(e.u, r);
if (t < 0) {
i = e;
e = e.tr;
e = e.N;
} else {
e = e.er;
e = e.K;
}

@@ -182,3 +182,3 @@ }

while (true) {
var r = e.hr;
var r = e.rr;
if (r === this.h) return;

@@ -189,22 +189,22 @@ if (e.ee === 1) {

}
if (e === r.er) {
var i = r.tr;
if (e === r.K) {
var i = r.N;
if (i.ee === 1) {
i.ee = 0;
r.ee = 1;
if (r === this.ir) {
this.ir = r.ne();
if (r === this.W) {
this.W = r.ne();
} else r.ne();
} else {
if (i.tr && i.tr.ee === 1) {
if (i.N && i.N.ee === 1) {
i.ee = r.ee;
r.ee = 0;
i.tr.ee = 0;
if (r === this.ir) {
this.ir = r.ne();
i.N.ee = 0;
if (r === this.W) {
this.W = r.ne();
} else r.ne();
return;
} else if (i.er && i.er.ee === 1) {
} else if (i.K && i.K.ee === 1) {
i.ee = 1;
i.er.ee = 0;
i.K.ee = 0;
i.te();

@@ -217,21 +217,21 @@ } else {

} else {
var i = r.er;
var i = r.K;
if (i.ee === 1) {
i.ee = 0;
r.ee = 1;
if (r === this.ir) {
this.ir = r.te();
if (r === this.W) {
this.W = r.te();
} else r.te();
} else {
if (i.er && i.er.ee === 1) {
if (i.K && i.K.ee === 1) {
i.ee = r.ee;
r.ee = 0;
i.er.ee = 0;
if (r === this.ir) {
this.ir = r.te();
i.K.ee = 0;
if (r === this.W) {
this.W = r.te();
} else r.te();
return;
} else if (i.tr && i.tr.ee === 1) {
} else if (i.N && i.N.ee === 1) {
i.ee = 1;
i.tr.ee = 0;
i.N.ee = 0;
i.ne();

@@ -248,3 +248,3 @@ } else {

var r, i;
if (this.i === 1) {
if (this.M === 1) {
this.clear();

@@ -254,25 +254,25 @@ return this.h;

var t = e;
while (t.er || t.tr) {
if (t.tr) {
t = t.tr;
while (t.er) t = t.er;
while (t.K || t.N) {
if (t.N) {
t = t.N;
while (t.K) t = t.K;
} else {
t = t.er;
t = t.K;
}
r = __read([ t.p, e.p ], 2), e.p = r[0], t.p = r[1];
i = __read([ t.H, e.H ], 2), e.H = i[0], t.H = i[1];
r = __read([ t.u, e.u ], 2), e.u = r[0], t.u = r[1];
i = __read([ t.p, e.p ], 2), e.p = i[0], t.p = i[1];
e = t;
}
if (this.h.er === t) {
this.h.er = t.hr;
} else if (this.h.tr === t) {
this.h.tr = t.hr;
if (this.h.K === t) {
this.h.K = t.rr;
} else if (this.h.N === t) {
this.h.N = t.rr;
}
this.ue(t);
var n = t.hr;
if (t === n.er) {
n.er = undefined;
} else n.tr = undefined;
this.i -= 1;
this.ir.ee = 0;
var n = t.rr;
if (t === n.K) {
n.K = undefined;
} else n.N = undefined;
this.M -= 1;
this.W.ee = 0;
return n;

@@ -282,40 +282,40 @@ };

if (e === undefined) return false;
var i = this.ae(e.er, r);
var i = this.ae(e.K, r);
if (i) return true;
if (r(e)) return true;
return this.ae(e.tr, r);
return this.ae(e.N, r);
};
TreeContainer.prototype.fe = function(e) {
while (true) {
var r = e.hr;
var r = e.rr;
if (r.ee === 0) return;
var i = r.hr;
if (r === i.er) {
var t = i.tr;
var i = r.rr;
if (r === i.K) {
var t = i.N;
if (t && t.ee === 1) {
t.ee = r.ee = 0;
if (i === this.ir) return;
if (i === this.W) return;
i.ee = 1;
e = i;
continue;
} else if (e === r.tr) {
} else if (e === r.N) {
e.ee = 0;
if (e.er) e.er.hr = r;
if (e.tr) e.tr.hr = i;
r.tr = e.er;
i.er = e.tr;
e.er = r;
e.tr = i;
if (i === this.ir) {
this.ir = e;
this.h.hr = e;
if (e.K) e.K.rr = r;
if (e.N) e.N.rr = i;
r.N = e.K;
i.K = e.N;
e.K = r;
e.N = i;
if (i === this.W) {
this.W = e;
this.h.rr = e;
} else {
var n = i.hr;
if (n.er === i) {
n.er = e;
} else n.tr = e;
var n = i.rr;
if (n.K === i) {
n.K = e;
} else n.N = e;
}
e.hr = i.hr;
r.hr = e;
i.hr = e;
e.rr = i.rr;
r.rr = e;
i.rr = e;
i.ee = 1;

@@ -329,4 +329,4 @@ return {

r.ee = 0;
if (i === this.ir) {
this.ir = i.te();
if (i === this.W) {
this.W = i.te();
} else i.te();

@@ -336,29 +336,29 @@ i.ee = 1;

} else {
var t = i.er;
var t = i.K;
if (t && t.ee === 1) {
t.ee = r.ee = 0;
if (i === this.ir) return;
if (i === this.W) return;
i.ee = 1;
e = i;
continue;
} else if (e === r.er) {
} else if (e === r.K) {
e.ee = 0;
if (e.er) e.er.hr = i;
if (e.tr) e.tr.hr = r;
i.tr = e.er;
r.er = e.tr;
e.er = i;
e.tr = r;
if (i === this.ir) {
this.ir = e;
this.h.hr = e;
if (e.K) e.K.rr = i;
if (e.N) e.N.rr = r;
i.N = e.K;
r.K = e.N;
e.K = i;
e.N = r;
if (i === this.W) {
this.W = e;
this.h.rr = e;
} else {
var n = i.hr;
if (n.er === i) {
n.er = e;
} else n.tr = e;
var n = i.rr;
if (n.K === i) {
n.K = e;
} else n.N = e;
}
e.hr = i.hr;
r.hr = e;
i.hr = e;
e.rr = i.rr;
r.rr = e;
i.rr = e;
i.ee = 1;

@@ -372,4 +372,4 @@ return {

r.ee = 0;
if (i === this.ir) {
this.ir = i.ne();
if (i === this.W) {
this.W = i.ne();
} else i.ne();

@@ -383,34 +383,34 @@ i.ee = 1;

TreeContainer.prototype.se = function(e, r, i) {
if (this.ir === undefined) {
this.i += 1;
this.ir = new this.re(e, r);
this.ir.ee = 0;
this.ir.hr = this.h;
this.h.hr = this.ir;
this.h.er = this.ir;
this.h.tr = this.ir;
if (this.W === undefined) {
this.M += 1;
this.W = new this.re(e, r);
this.W.ee = 0;
this.W.rr = this.h;
this.h.rr = this.W;
this.h.K = this.W;
this.h.N = this.W;
return;
}
var t;
var n = this.h.er;
var s = this.j(n.p, e);
var n = this.h.K;
var s = this.$(n.u, e);
if (s === 0) {
n.H = r;
n.p = r;
return;
} else if (s > 0) {
n.er = new this.re(e, r);
n.er.hr = n;
t = n.er;
this.h.er = t;
n.K = new this.re(e, r);
n.K.rr = n;
t = n.K;
this.h.K = t;
} else {
var f = this.h.tr;
var h = this.j(f.p, e);
var f = this.h.N;
var h = this.$(f.u, e);
if (h === 0) {
f.H = r;
f.p = r;
return;
} else if (h < 0) {
f.tr = new this.re(e, r);
f.tr.hr = f;
t = f.tr;
this.h.tr = t;
f.N = new this.re(e, r);
f.N.rr = f;
t = f.N;
this.h.N = t;
} else {

@@ -420,20 +420,20 @@ if (i !== undefined) {

if (u !== this.h) {
var a = this.j(u.p, e);
var a = this.$(u.u, e);
if (a === 0) {
u.H = r;
u.p = r;
return;
} else if (a > 0) {
var o = u.W();
var l = this.j(o.p, e);
var o = u.L();
var l = this.$(o.u, e);
if (l === 0) {
o.H = r;
o.p = r;
return;
} else if (l < 0) {
t = new this.re(e, r);
if (o.tr === undefined) {
o.tr = t;
t.hr = o;
if (o.N === undefined) {
o.N = t;
t.rr = o;
} else {
u.er = t;
t.hr = u;
u.K = t;
t.rr = u;
}

@@ -445,23 +445,23 @@ }

if (t === undefined) {
t = this.ir;
t = this.W;
while (true) {
var v = this.j(t.p, e);
var v = this.$(t.u, e);
if (v > 0) {
if (t.er === undefined) {
t.er = new this.re(e, r);
t.er.hr = t;
t = t.er;
if (t.K === undefined) {
t.K = new this.re(e, r);
t.K.rr = t;
t = t.K;
break;
}
t = t.er;
t = t.K;
} else if (v < 0) {
if (t.tr === undefined) {
t.tr = new this.re(e, r);
t.tr.hr = t;
t = t.tr;
if (t.N === undefined) {
t.N = new this.re(e, r);
t.N.rr = t;
t = t.N;
break;
}
t = t.tr;
t = t.N;
} else {
t.H = r;
t.p = r;
return;

@@ -473,3 +473,3 @@ }

}
this.i += 1;
this.M += 1;
return t;

@@ -479,7 +479,7 @@ };

while (e) {
var i = this.j(e.p, r);
var i = this.$(e.u, r);
if (i < 0) {
e = e.tr;
e = e.N;
} else if (i > 0) {
e = e.er;
e = e.K;
} else return e;

@@ -490,6 +490,6 @@ }

TreeContainer.prototype.clear = function() {
this.i = 0;
this.ir = undefined;
this.h.hr = undefined;
this.h.er = this.h.tr = undefined;
this.M = 0;
this.W = undefined;
this.h.rr = undefined;
this.h.K = this.h.N = undefined;
};

@@ -501,9 +501,9 @@ TreeContainer.prototype.updateKeyByIterator = function(e, r) {

}
if (this.i === 1) {
i.p = r;
if (this.M === 1) {
i.u = r;
return true;
}
if (i === this.h.er) {
if (this.j(i.m().p, r) > 0) {
i.p = r;
if (i === this.h.K) {
if (this.$(i.m().u, r) > 0) {
i.u = r;
return true;

@@ -513,5 +513,5 @@ }

}
if (i === this.h.tr) {
if (this.j(i.W().p, r) < 0) {
i.p = r;
if (i === this.h.N) {
if (this.$(i.L().u, r) < 0) {
i.u = r;
return true;

@@ -521,11 +521,11 @@ }

}
var t = i.W().p;
if (this.j(t, r) >= 0) return false;
var n = i.m().p;
if (this.j(n, r) <= 0) return false;
i.p = r;
var t = i.L().u;
if (this.$(t, r) >= 0) return false;
var n = i.m().u;
if (this.$(n, r) <= 0) return false;
i.u = r;
return true;
};
TreeContainer.prototype.eraseElementByPos = function(e) {
if (e < 0 || e > this.i - 1) {
if (e < 0 || e > this.M - 1) {
throw new RangeError;

@@ -535,5 +535,5 @@ }

var i = this;
this.ae(this.ir, (function(t) {
this.ae(this.W, (function(t) {
if (e === r) {
i.X(t);
i.G(t);
return true;

@@ -544,9 +544,9 @@ }

}));
return this.i;
return this.M;
};
TreeContainer.prototype.eraseElementByKey = function(e) {
if (this.i === 0) return false;
var r = this.g(this.ir, e);
if (this.M === 0) return false;
var r = this.g(this.W, e);
if (r === this.h) return false;
this.X(r);
this.G(r);
return true;

@@ -559,3 +559,3 @@ };

}
var i = r.tr === undefined;
var i = r.N === undefined;
var t = e.iteratorType === 0;

@@ -565,5 +565,5 @@ if (t) {

} else {
if (!i || r.er === undefined) e.next();
if (!i || r.K === undefined) e.next();
}
this.X(r);
this.G(r);
return e;

@@ -593,3 +593,3 @@ };

var r, i;
if (e < 0 || e > this.i - 1) {
if (e < 0 || e > this.M - 1) {
throw new RangeError;

@@ -622,8 +622,8 @@ }

TreeContainer.prototype.getHeight = function() {
if (this.i === 0) return 0;
if (this.M === 0) return 0;
var traversal = function(e) {
if (!e) return 0;
return Math.max(traversal(e.er), traversal(e.tr)) + 1;
return Math.max(traversal(e.K), traversal(e.N)) + 1;
};
return traversal(this.ir);
return traversal(this.W);
};

@@ -630,0 +630,0 @@ return TreeContainer;

import { ContainerIterator } from "../../ContainerBase";
import TreeContainer from "./index";
declare abstract class TreeIterator<K, V> extends ContainerIterator<K | [K, V]> {
abstract readonly container: TreeContainer<K, V>;
/**

@@ -4,0 +6,0 @@ * @description Get the sequential index of the iterator in the tree container.<br/>

@@ -34,6 +34,6 @@ var __extends = this && this.t || function() {

n.pre = function() {
if (this.o === this.h.er) {
if (this.o === this.h.K) {
throwIteratorAccessError();
}
this.o = this.o.W();
this.o = this.o.L();
return this;

@@ -50,3 +50,3 @@ };

n.pre = function() {
if (this.o === this.h.tr) {
if (this.o === this.h.N) {
throwIteratorAccessError();

@@ -61,3 +61,3 @@ }

}
this.o = this.o.W();
this.o = this.o.L();
return this;

@@ -71,6 +71,6 @@ };

var r = this.o;
var t = this.h.hr;
var t = this.h.rr;
if (r === this.h) {
if (t) {
return t.cr - 1;
return t.tr - 1;
}

@@ -80,11 +80,11 @@ return 0;

var e = 0;
if (r.er) {
e += r.er.cr;
if (r.K) {
e += r.K.tr;
}
while (r !== t) {
var i = r.hr;
if (r === i.tr) {
var i = r.rr;
if (r === i.N) {
e += 1;
if (i.er) {
e += i.er.cr;
if (i.K) {
e += i.K.tr;
}

@@ -91,0 +91,0 @@ }

@@ -1,1 +0,47 @@

export {};
export declare const enum TreeNodeColor {
RED = 1,
BLACK = 0
}
export declare class TreeNode<K, V> {
_color: TreeNodeColor;
_key: K | undefined;
_value: V | undefined;
_left: TreeNode<K, V> | undefined;
_right: TreeNode<K, V> | undefined;
_parent: TreeNode<K, V> | undefined;
constructor(key?: K, value?: V);
/**
* @description Get the pre node.
* @returns TreeNode about the pre node.
*/
_pre(): TreeNode<K, V>;
/**
* @description Get the next node.
* @returns TreeNode about the next node.
*/
_next(): TreeNode<K, V>;
/**
* @description Rotate left.
* @returns TreeNode about moved to original position after rotation.
*/
_rotateLeft(): TreeNode<K, V>;
/**
* @description Rotate right.
* @returns TreeNode about moved to original position after rotation.
*/
_rotateRight(): TreeNode<K, V>;
}
export declare class TreeNodeEnableIndex<K, V> extends TreeNode<K, V> {
_subTreeSize: number;
/**
* @description Rotate left and do recount.
* @returns TreeNode about moved to original position after rotation.
*/
_rotateLeft(): TreeNodeEnableIndex<K, V>;
/**
* @description Rotate right and do recount.
* @returns TreeNode about moved to original position after rotation.
*/
_rotateRight(): TreeNodeEnableIndex<K, V>;
_recount(): void;
}

@@ -25,24 +25,24 @@ var __extends = this && this.t || function() {

this.ee = 1;
this.u = undefined;
this.p = undefined;
this.H = undefined;
this.er = undefined;
this.tr = undefined;
this.hr = undefined;
this.p = e;
this.H = n;
this.K = undefined;
this.N = undefined;
this.rr = undefined;
this.u = e;
this.p = n;
}
TreeNode.prototype.W = function() {
TreeNode.prototype.L = function() {
var e = this;
if (e.ee === 1 && e.hr.hr === e) {
e = e.tr;
} else if (e.er) {
e = e.er;
while (e.tr) {
e = e.tr;
if (e.ee === 1 && e.rr.rr === e) {
e = e.N;
} else if (e.K) {
e = e.K;
while (e.N) {
e = e.N;
}
} else {
var n = e.hr;
while (n.er === e) {
var n = e.rr;
while (n.K === e) {
e = n;
n = e.hr;
n = e.rr;
}

@@ -55,15 +55,15 @@ e = n;

var e = this;
if (e.tr) {
e = e.tr;
while (e.er) {
e = e.er;
if (e.N) {
e = e.N;
while (e.K) {
e = e.K;
}
return e;
} else {
var n = e.hr;
while (n.tr === e) {
var n = e.rr;
while (n.N === e) {
e = n;
n = e.hr;
n = e.rr;
}
if (e.tr !== n) {
if (e.N !== n) {
return n;

@@ -74,23 +74,23 @@ } else return e;

TreeNode.prototype.ne = function() {
var e = this.hr;
var n = this.tr;
var t = n.er;
if (e.hr === this) e.hr = n; else if (e.er === this) e.er = n; else e.tr = n;
n.hr = e;
n.er = this;
this.hr = n;
this.tr = t;
if (t) t.hr = this;
var e = this.rr;
var n = this.N;
var t = n.K;
if (e.rr === this) e.rr = n; else if (e.K === this) e.K = n; else e.N = n;
n.rr = e;
n.K = this;
this.rr = n;
this.N = t;
if (t) t.rr = this;
return n;
};
TreeNode.prototype.te = function() {
var e = this.hr;
var n = this.er;
var t = n.tr;
if (e.hr === this) e.hr = n; else if (e.er === this) e.er = n; else e.tr = n;
n.hr = e;
n.tr = this;
this.hr = n;
this.er = t;
if (t) t.hr = this;
var e = this.rr;
var n = this.K;
var t = n.N;
if (e.rr === this) e.rr = n; else if (e.K === this) e.K = n; else e.N = n;
n.rr = e;
n.N = this;
this.rr = n;
this.K = t;
if (t) t.rr = this;
return n;

@@ -107,3 +107,3 @@ };

var n = e !== null && e.apply(this, arguments) || this;
n.cr = 1;
n.tr = 1;
return n;

@@ -124,8 +124,8 @@ }

TreeNodeEnableIndex.prototype.ie = function() {
this.cr = 1;
if (this.er) {
this.cr += this.er.cr;
this.tr = 1;
if (this.K) {
this.tr += this.K.tr;
}
if (this.tr) {
this.cr += this.tr.cr;
if (this.N) {
this.tr += this.N.tr;
}

@@ -132,0 +132,0 @@ };

import TreeContainer from './Base';
import TreeIterator from './Base/TreeIterator';
import { initContainer } from "../ContainerBase";
import { TreeNode } from './Base/TreeNode';
import { initContainer, IteratorType } from "../ContainerBase";
declare class OrderedMapIterator<K, V> extends TreeIterator<K, V> {
container: OrderedMap<K, V>;
constructor(node: TreeNode<K, V>, header: TreeNode<K, V>, container: OrderedMap<K, V>, iteratorType?: IteratorType);
get pointer(): [K, V];

@@ -6,0 +9,0 @@ copy(): OrderedMapIterator<K, V>;

@@ -22,3 +22,3 @@ var __extends = this && this.t || function() {

var __generator = this && this.u || function(r, e) {
var __generator = this && this.i || function(r, e) {
var t = {

@@ -113,3 +113,3 @@ label: 0,

var __values = this && this.Z || function(r) {
var __values = this && this.V || function(r) {
var e = typeof Symbol === "function" && Symbol.iterator, t = e && r[e], n = 0;

@@ -137,4 +137,6 @@ if (t) return t.call(r);

__extends(OrderedMapIterator, r);
function OrderedMapIterator() {
return r !== null && r.apply(this, arguments) || this;
function OrderedMapIterator(e, t, n, i) {
var o = r.call(this, e, t, i) || this;
o.container = n;
return o;
}

@@ -149,3 +151,3 @@ Object.defineProperty(OrderedMapIterator.prototype, "pointer", {

get: function(e, t) {
if (t === "0") return r.o.p; else if (t === "1") return r.o.H;
if (t === "0") return r.o.u; else if (t === "1") return r.o.p;
},

@@ -156,3 +158,3 @@ set: function(e, t, n) {

}
r.o.H = n;
r.o.p = n;
return true;

@@ -166,3 +168,3 @@ }

OrderedMapIterator.prototype.copy = function() {
return new OrderedMapIterator(this.o, this.h, this.iteratorType);
return new OrderedMapIterator(this.o, this.h, this.container, this.iteratorType);
};

@@ -185,3 +187,3 @@ return OrderedMapIterator;

}
OrderedMap.prototype.rr = function(r) {
OrderedMap.prototype.P = function(r) {
return __generator(this, (function(e) {

@@ -191,11 +193,11 @@ switch (e.label) {

if (r === undefined) return [ 2 ];
return [ 5, __values(this.rr(r.er)) ];
return [ 5, __values(this.P(r.K)) ];
case 1:
e.sent();
return [ 4, [ r.p, r.H ] ];
return [ 4, [ r.u, r.p ] ];
case 2:
e.sent();
return [ 5, __values(this.rr(r.tr)) ];
return [ 5, __values(this.P(r.N)) ];

@@ -209,38 +211,38 @@ case 3:

OrderedMap.prototype.begin = function() {
return new OrderedMapIterator(this.h.er || this.h, this.h);
return new OrderedMapIterator(this.h.K || this.h, this.h, this);
};
OrderedMap.prototype.end = function() {
return new OrderedMapIterator(this.h, this.h);
return new OrderedMapIterator(this.h, this.h, this);
};
OrderedMap.prototype.rBegin = function() {
return new OrderedMapIterator(this.h.tr || this.h, this.h, 1);
return new OrderedMapIterator(this.h.N || this.h, this.h, this, 1);
};
OrderedMap.prototype.rEnd = function() {
return new OrderedMapIterator(this.h, this.h, 1);
return new OrderedMapIterator(this.h, this.h, this, 1);
};
OrderedMap.prototype.front = function() {
if (this.i === 0) return;
var r = this.h.er;
return [ r.p, r.H ];
if (this.M === 0) return;
var r = this.h.K;
return [ r.u, r.p ];
};
OrderedMap.prototype.back = function() {
if (this.i === 0) return;
var r = this.h.tr;
return [ r.p, r.H ];
if (this.M === 0) return;
var r = this.h.N;
return [ r.u, r.p ];
};
OrderedMap.prototype.lowerBound = function(r) {
var e = this.nr(this.ir, r);
return new OrderedMapIterator(e, this.h);
var e = this.U(this.W, r);
return new OrderedMapIterator(e, this.h, this);
};
OrderedMap.prototype.upperBound = function(r) {
var e = this.ar(this.ir, r);
return new OrderedMapIterator(e, this.h);
var e = this.X(this.W, r);
return new OrderedMapIterator(e, this.h, this);
};
OrderedMap.prototype.reverseLowerBound = function(r) {
var e = this.ur(this.ir, r);
return new OrderedMapIterator(e, this.h);
var e = this.Y(this.W, r);
return new OrderedMapIterator(e, this.h, this);
};
OrderedMap.prototype.reverseUpperBound = function(r) {
var e = this.sr(this.ir, r);
return new OrderedMapIterator(e, this.h);
var e = this.Z(this.W, r);
return new OrderedMapIterator(e, this.h, this);
};

@@ -251,8 +253,8 @@ OrderedMap.prototype.setElement = function(r, e, t) {

OrderedMap.prototype.find = function(r) {
var e = this.g(this.ir, r);
return new OrderedMapIterator(e, this.h);
var e = this.g(this.W, r);
return new OrderedMapIterator(e, this.h, this);
};
OrderedMap.prototype.getElementByKey = function(r) {
var e = this.g(this.ir, r);
return e.H;
var e = this.g(this.W, r);
return e.p;
};

@@ -264,6 +266,6 @@ OrderedMap.prototype.union = function(r) {

}));
return this.i;
return this.M;
};
OrderedMap.prototype[Symbol.iterator] = function() {
return this.rr(this.ir);
return this.P(this.W);
};

@@ -270,0 +272,0 @@ return OrderedMap;

import TreeContainer from './Base';
import TreeIterator from './Base/TreeIterator';
import { initContainer } from "../ContainerBase";
import { TreeNode } from './Base/TreeNode';
import { initContainer, IteratorType } from "../ContainerBase";
declare class OrderedSetIterator<K> extends TreeIterator<K, undefined> {
container: OrderedSet<K>;
constructor(node: TreeNode<K, undefined>, header: TreeNode<K, undefined>, container: OrderedSet<K>, iteratorType?: IteratorType);
get pointer(): NonNullable<K>;

@@ -6,0 +9,0 @@ copy(): OrderedSetIterator<K>;

var __extends = this && this.t || function() {
var extendStatics = function(e, r) {
var extendStatics = function(e, t) {
extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(e, r) {
e.__proto__ = r;
} || function(e, r) {
for (var t in r) if (Object.prototype.hasOwnProperty.call(r, t)) e[t] = r[t];
} instanceof Array && function(e, t) {
e.__proto__ = t;
} || function(e, t) {
for (var r in t) if (Object.prototype.hasOwnProperty.call(t, r)) e[r] = t[r];
};
return extendStatics(e, r);
return extendStatics(e, t);
};
return function(e, r) {
if (typeof r !== "function" && r !== null) throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
extendStatics(e, r);
return function(e, t) {
if (typeof t !== "function" && t !== null) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
extendStatics(e, t);
function __() {
this.constructor = e;
}
e.prototype = r === null ? Object.create(r) : (__.prototype = r.prototype, new __);
e.prototype = t === null ? Object.create(t) : (__.prototype = t.prototype, new __);
};
}();
var __generator = this && this.u || function(e, r) {
var t = {
var __generator = this && this.i || function(e, t) {
var r = {
label: 0,

@@ -40,4 +40,4 @@ sent: function() {

function verb(e) {
return function(r) {
return step([ e, r ]);
return function(t) {
return step([ e, t ]);
};

@@ -47,3 +47,3 @@ }

if (n) throw new TypeError("Generator is already executing.");
while (t) try {
while (r) try {
if (n = 1, i && (o = u[0] & 2 ? i["return"] : u[0] ? i["throw"] || ((o = i["return"]) && o.call(i),

@@ -59,3 +59,3 @@ 0) : i.next) && !(o = o.call(i, u[1])).done) return o;

case 4:
t.label++;
r.label++;
return {

@@ -67,3 +67,3 @@ value: u[1],

case 5:
t.label++;
r.label++;
i = u[1];

@@ -74,30 +74,30 @@ u = [ 0 ];

case 7:
u = t.ops.pop();
t.trys.pop();
u = r.ops.pop();
r.trys.pop();
continue;
default:
if (!(o = t.trys, o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
t = 0;
if (!(o = r.trys, o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
r = 0;
continue;
}
if (u[0] === 3 && (!o || u[1] > o[0] && u[1] < o[3])) {
t.label = u[1];
r.label = u[1];
break;
}
if (u[0] === 6 && t.label < o[1]) {
t.label = o[1];
if (u[0] === 6 && r.label < o[1]) {
r.label = o[1];
o = u;
break;
}
if (o && t.label < o[2]) {
t.label = o[2];
t.ops.push(u);
if (o && r.label < o[2]) {
r.label = o[2];
r.ops.push(u);
break;
}
if (o[2]) t.ops.pop();
t.trys.pop();
if (o[2]) r.ops.pop();
r.trys.pop();
continue;
}
u = r.call(e, t);
u = t.call(e, r);
} catch (e) {

@@ -117,5 +117,5 @@ u = [ 6, e ];

var __values = this && this.Z || function(e) {
var r = typeof Symbol === "function" && Symbol.iterator, t = r && e[r], n = 0;
if (t) return t.call(e);
var __values = this && this.V || function(e) {
var t = typeof Symbol === "function" && Symbol.iterator, r = t && e[t], n = 0;
if (r) return r.call(e);
if (e && typeof e.length === "number") return {

@@ -130,3 +130,3 @@ next: function() {

};
throw new TypeError(r ? "Object is not iterable." : "Symbol.iterator is not defined.");
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
};

@@ -142,4 +142,6 @@

__extends(OrderedSetIterator, e);
function OrderedSetIterator() {
return e !== null && e.apply(this, arguments) || this;
function OrderedSetIterator(t, r, n, i) {
var o = e.call(this, t, r, i) || this;
o.container = n;
return o;
}

@@ -151,3 +153,3 @@ Object.defineProperty(OrderedSetIterator.prototype, "pointer", {

}
return this.o.p;
return this.o.u;
},

@@ -158,3 +160,3 @@ enumerable: false,

OrderedSetIterator.prototype.copy = function() {
return new OrderedSetIterator(this.o, this.h, this.iteratorType);
return new OrderedSetIterator(this.o, this.h, this.container, this.iteratorType);
};

@@ -166,9 +168,9 @@ return OrderedSetIterator;

__extends(OrderedSet, e);
function OrderedSet(r, t, n) {
if (r === void 0) {
r = [];
function OrderedSet(t, r, n) {
if (t === void 0) {
t = [];
}
var i = e.call(this, t, n) || this;
var i = e.call(this, r, n) || this;
var o = i;
r.forEach((function(e) {
t.forEach((function(e) {
o.insert(e);

@@ -178,19 +180,19 @@ }));

}
OrderedSet.prototype.rr = function(e) {
return __generator(this, (function(r) {
switch (r.label) {
OrderedSet.prototype.P = function(e) {
return __generator(this, (function(t) {
switch (t.label) {
case 0:
if (e === undefined) return [ 2 ];
return [ 5, __values(this.rr(e.er)) ];
return [ 5, __values(this.P(e.K)) ];
case 1:
r.sent();
return [ 4, e.p ];
t.sent();
return [ 4, e.u ];
case 2:
r.sent();
return [ 5, __values(this.rr(e.tr)) ];
t.sent();
return [ 5, __values(this.P(e.N)) ];
case 3:
r.sent();
t.sent();
return [ 2 ];

@@ -201,51 +203,51 @@ }

OrderedSet.prototype.begin = function() {
return new OrderedSetIterator(this.h.er || this.h, this.h);
return new OrderedSetIterator(this.h.K || this.h, this.h, this);
};
OrderedSet.prototype.end = function() {
return new OrderedSetIterator(this.h, this.h);
return new OrderedSetIterator(this.h, this.h, this);
};
OrderedSet.prototype.rBegin = function() {
return new OrderedSetIterator(this.h.tr || this.h, this.h, 1);
return new OrderedSetIterator(this.h.N || this.h, this.h, this, 1);
};
OrderedSet.prototype.rEnd = function() {
return new OrderedSetIterator(this.h, this.h, 1);
return new OrderedSetIterator(this.h, this.h, this, 1);
};
OrderedSet.prototype.front = function() {
return this.h.er ? this.h.er.p : undefined;
return this.h.K ? this.h.K.u : undefined;
};
OrderedSet.prototype.back = function() {
return this.h.tr ? this.h.tr.p : undefined;
return this.h.N ? this.h.N.u : undefined;
};
OrderedSet.prototype.insert = function(e, r) {
return this.v(e, undefined, r);
OrderedSet.prototype.insert = function(e, t) {
return this.v(e, undefined, t);
};
OrderedSet.prototype.find = function(e) {
var r = this.g(this.ir, e);
return new OrderedSetIterator(r, this.h);
var t = this.g(this.W, e);
return new OrderedSetIterator(t, this.h, this);
};
OrderedSet.prototype.lowerBound = function(e) {
var r = this.nr(this.ir, e);
return new OrderedSetIterator(r, this.h);
var t = this.U(this.W, e);
return new OrderedSetIterator(t, this.h, this);
};
OrderedSet.prototype.upperBound = function(e) {
var r = this.ar(this.ir, e);
return new OrderedSetIterator(r, this.h);
var t = this.X(this.W, e);
return new OrderedSetIterator(t, this.h, this);
};
OrderedSet.prototype.reverseLowerBound = function(e) {
var r = this.ur(this.ir, e);
return new OrderedSetIterator(r, this.h);
var t = this.Y(this.W, e);
return new OrderedSetIterator(t, this.h, this);
};
OrderedSet.prototype.reverseUpperBound = function(e) {
var r = this.sr(this.ir, e);
return new OrderedSetIterator(r, this.h);
var t = this.Z(this.W, e);
return new OrderedSetIterator(t, this.h, this);
};
OrderedSet.prototype.union = function(e) {
var r = this;
var t = this;
e.forEach((function(e) {
r.insert(e);
t.insert(e);
}));
return this.i;
return this.M;
};
OrderedSet.prototype[Symbol.iterator] = function() {
return this.rr(this.ir);
return this.P(this.W);
};

@@ -252,0 +254,0 @@ return OrderedSet;

/*!
* js-sdsl v4.2.0
* js-sdsl v4.3.0
* https://github.com/js-sdsl/js-sdsl

@@ -7,3 +7,3 @@ * (c) 2021-present ZLY201 <zilongyao1366@gmail.com>

*/
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).sdsl={})}(this,function(t){"use strict";var k=function(t,i){return(k=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,i){t.__proto__=i}:function(t,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}))(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function r(){this.constructor=t}k(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}function r(e,n){var s,o,h,u={label:0,sent:function(){if(1&h[0])throw h[1];return h[1]},trys:[],ops:[]},p={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(p[Symbol.iterator]=function(){return this}),p;function t(r){return function(t){var i=[r,t];if(s)throw new TypeError("Generator is already executing.");for(;u=p&&i[p=0]?0:u;)try{if(s=1,o&&(h=2&i[0]?o.return:i[0]?o.throw||((h=o.return)&&h.call(o),0):o.next)&&!(h=h.call(o,i[1])).done)return h;switch(o=0,(i=h?[2&i[0],h.value]:i)[0]){case 0:case 1:h=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,o=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(h=0<(h=u.trys).length&&h[h.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!h||i[1]>h[0]&&i[1]<h[3]))u.label=i[1];else if(6===i[0]&&u.label<h[1])u.label=h[1],h=i;else{if(!(h&&u.label<h[2])){h[2]&&u.ops.pop(),u.trys.pop();continue}u.label=h[2],u.ops.push(i)}}i=n.call(e,u)}catch(t){i=[6,t],o=0}finally{s=h=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}function u(t){var i="function"==typeof Symbol&&Symbol.iterator,r=i&&t[i],e=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&e>=t.length?void 0:t)&&t[e++],done:!t}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(t,i){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var e,n,s=r.call(t),o=[];try{for(;(void 0===i||0<i--)&&!(e=s.next()).done;)o.push(e.value)}catch(t){n={error:t}}finally{try{e&&!e.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}function p(t,i,r){if(r||2===arguments.length)for(var e,n=0,s=i.length;n<s;n++)!e&&n in i||((e=e||Array.prototype.slice.call(i,0,n))[n]=i[n]);return t.concat(e||Array.prototype.slice.call(i))}O.prototype.equals=function(t){return this.t===t.t};var e=O;function O(t){this.iteratorType=t=void 0===t?0:t}Object.defineProperty(S.prototype,"length",{get:function(){return this.i},enumerable:!1,configurable:!0}),S.prototype.size=function(){return this.i},S.prototype.empty=function(){return 0===this.i};var n=S;function S(){this.i=0}i(T,N=n);var N,_=T;function T(){return null!==N&&N.apply(this,arguments)||this}i(s,I=n),s.prototype.clear=function(){this.i=0,this.h=[]},s.prototype.push=function(t){return this.h.push(t),this.i+=1,this.i},s.prototype.pop=function(){if(0!==this.i)return--this.i,this.h.pop()},s.prototype.top=function(){return this.h[this.i-1]};var I,q=s;function s(t){void 0===t&&(t=[]);var i=I.call(this)||this,r=(i.h=[],i);return t.forEach(function(t){r.push(t)}),i}i(L,M=_);var M,H=L;function L(){return null!==M&&M.apply(this,arguments)||this}function o(){throw new RangeError("Iterator access denied!")}i(W,z=e),Object.defineProperty(W.prototype,"pointer",{get:function(){if(this.t<0||this.t>this.u()-1)throw new RangeError;return this.o(this.t)},set:function(t){if(this.t<0||this.t>this.u()-1)throw new RangeError;this.v(this.t,t)},enumerable:!1,configurable:!0});var z,Y=W;function W(t,i,r,e,n){n=z.call(this,n)||this;return n.t=t,n.u=i,n.o=r,n.v=e,0===n.iteratorType?(n.pre=function(){return 0===this.t&&o(),--this.t,this},n.next=function(){return this.t===this.u()&&o(),this.t+=1,this}):(n.pre=function(){return this.t===this.u()-1&&o(),this.t+=1,this},n.next=function(){return-1===this.t&&o(),--this.t,this}),n}i(Z,X=Y),Z.prototype.copy=function(){return new Z(this.t,this.u,this.o,this.v,this.iteratorType)};var X,f=Z;function Z(){return null!==X&&X.apply(this,arguments)||this}i(c,C=H),c.prototype.k=function(){for(var t=[],i=Math.max(this.S>>1,1),r=0;r<i;++r)t[r]=new Array(this.O);for(r=this.l;r<this.S;++r)t[t.length]=this.L[r];for(r=0;r<this.p;++r)t[t.length]=this.L[r];t[t.length]=p([],h(this.L[this.p]),!1),this.l=i,this.p=t.length-1;for(r=0;r<i;++r)t[t.length]=new Array(this.O);this.L=t,this.S=t.length},c.prototype.g=function(t){var t=this._+t+1,i=t%this.O,r=i-1,t=this.l+(t-i)/this.O;return 0==i&&--t,t%=this.S,r<0&&(r+=this.O),{curNodeBucketIndex:t,curNodePointerIndex:r}},c.prototype.clear=function(){this.L=[[]],this.S=1,this.l=this.p=this.i=0,this._=this.I=this.O>>1},c.prototype.begin=function(){return new f(0,this.size,this.getElementByPos,this.setElementByPos)},c.prototype.end=function(){return new f(this.i,this.size,this.getElementByPos,this.setElementByPos)},c.prototype.rBegin=function(){return new f(this.i-1,this.size,this.getElementByPos,this.setElementByPos,1)},c.prototype.rEnd=function(){return new f(-1,this.size,this.getElementByPos,this.setElementByPos,1)},c.prototype.front=function(){return this.L[this.l][this._]},c.prototype.back=function(){return this.L[this.p][this.I]},c.prototype.pushBack=function(t){return this.i&&(this.I<this.O-1?this.I+=1:(this.p<this.S-1?this.p+=1:this.p=0,this.I=0),this.p===this.l)&&this.I===this._&&this.k(),this.i+=1,this.L[this.p][this.I]=t,this.i},c.prototype.popBack=function(){var t;if(0!==this.i)return t=this.L[this.p][this.I],delete this.L[this.p][this.I],1!==this.i&&(0<this.I?--this.I:(0<this.p?--this.p:this.p=this.S-1,this.I=this.O-1)),--this.i,t},c.prototype.pushFront=function(t){return this.i&&(0<this._?--this._:(0<this.l?--this.l:this.l=this.S-1,this._=this.O-1),this.l===this.p)&&this._===this.I&&this.k(),this.i+=1,this.L[this.l][this._]=t,this.i},c.prototype.popFront=function(){var t;if(0!==this.i)return t=this.L[this.l][this._],delete this.L[this.l][this._],1!==this.i&&(this._<this.O-1?this._+=1:(this.l<this.S-1?this.l+=1:this.l=0,this._=0)),--this.i,t},c.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;var t=this.g(t),i=t.curNodeBucketIndex,t=t.curNodePointerIndex;return this.L[i][t]},c.prototype.setElementByPos=function(t,i){if(t<0||t>this.i-1)throw new RangeError;var t=this.g(t),r=t.curNodeBucketIndex,t=t.curNodePointerIndex;this.L[r][t]=i},c.prototype.insert=function(t,i,r){if(void 0===r&&(r=1),t<0||t>this.i)throw new RangeError;if(0===t)for(;r--;)this.pushFront(i);else if(t===this.i)for(;r--;)this.pushBack(i);else{for(var e=[],n=t;n<this.i;++n)e.push(this.getElementByPos(n));this.cut(t-1);for(n=0;n<r;++n)this.pushBack(i);for(n=0;n<e.length;++n)this.pushBack(e[n])}return this.i},c.prototype.cut=function(t){var i,r;return t<0?(this.clear(),0):(i=(r=this.g(t)).curNodeBucketIndex,r=r.curNodePointerIndex,this.p=i,this.I=r,this.i=t+1,this.i)},c.prototype.eraseElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;if(0===t)this.popFront();else if(t===this.i-1)this.popBack();else{for(var i=[],r=t+1;r<this.i;++r)i.push(this.getElementByPos(r));this.cut(t),this.popBack();var e=this;i.forEach(function(t){e.pushBack(t)})}return this.i},c.prototype.eraseElementByValue=function(t){if(0===this.i)return 0;for(var i=[],r=0;r<this.i;++r){var e=this.getElementByPos(r);e!==t&&i.push(e)}for(var n=i.length,r=0;r<n;++r)this.setElementByPos(r,i[r]);return this.cut(n-1)},c.prototype.eraseElementByIterator=function(t){var i=t.t;return this.eraseElementByPos(i),t=t.next()},c.prototype.find=function(t){for(var i=0;i<this.i;++i)if(this.getElementByPos(i)===t)return new f(i,this.size,this.getElementByPos,this.setElementByPos);return this.end()},c.prototype.reverse=function(){for(var t=0,i=this.i-1;t<i;){var r=this.getElementByPos(t);this.setElementByPos(t,this.getElementByPos(i)),this.setElementByPos(i,r),t+=1,--i}},c.prototype.unique=function(){if(!(this.i<=1)){for(var t=1,i=this.getElementByPos(0),r=1;r<this.i;++r){var e=this.getElementByPos(r);e!==i&&this.setElementByPos(t++,i=e)}for(;this.i>t;)this.popBack()}return this.i},c.prototype.sort=function(t){for(var i=[],r=0;r<this.i;++r)i.push(this.getElementByPos(r));i.sort(t);for(r=0;r<this.i;++r)this.setElementByPos(r,i[r])},c.prototype.shrinkToFit=function(){if(0!==this.i){var i=[];this.forEach(function(t){i.push(t)}),this.S=Math.max(Math.ceil(this.i/this.O),1),this.i=this.l=this.p=this._=this.I=0,this.L=[];for(var t=0;t<this.S;++t)this.L.push(new Array(this.O));for(t=0;t<i.length;++t)this.pushBack(i[t])}},c.prototype.forEach=function(t){for(var i=0;i<this.i;++i)t(this.getElementByPos(i),i,this)},c.prototype[Symbol.iterator]=function(){return function(){var i;return r(this,function(t){switch(t.label){case 0:i=0,t.label=1;case 1:return i<this.i?[4,this.getElementByPos(i)]:[3,4];case 2:t.sent(),t.label=3;case 3:return++i,[3,1];case 4:return[2]}})}.bind(this)()};var C,Q=c;function c(t,i){void 0===t&&(t=[]),void 0===i&&(i=4096);var r,e=C.call(this)||this;if(e.l=0,e._=0,e.p=0,e.I=0,e.S=0,e.L=[],"size"in t)r="number"==typeof t.size?t.size:t.size();else{if(!("length"in t))throw new RangeError("Can't get container's size!");r=t.length}e.O=i,e.S=Math.max(Math.ceil(r/e.O),1);for(var n=0;n<e.S;++n)e.L.push(new Array(e.O));var i=Math.ceil(r/e.O),s=(e.l=e.p=(e.S>>1)-(i>>1),e._=e.I=e.O-r%e.O>>1,e);return t.forEach(function(t){s.pushBack(t)}),e.size=e.size.bind(e),e.getElementByPos=e.getElementByPos.bind(e),e.setElementByPos=e.setElementByPos.bind(e),e}i(a,tt=n),a.prototype.clear=function(){this.H.clear(),this.i=0},a.prototype.push=function(t){return this.H.pushBack(t),this.i+=1,this.i},a.prototype.pop=function(){if(0!==this.i)return--this.i,this.H.popFront()},a.prototype.front=function(){return this.H.front()};var tt,it=a;function a(t){void 0===t&&(t=[]);var i=tt.call(this)||this;return i.H=new Q(t),i.i=i.H.size(),i}i(l,rt=n),l.prototype.T=function(t){for(var i=this.A[t];0<t;){var r=t-1>>1,e=this.A[r];if(this.M(e,i)<=0)break;this.A[t]=e,t=r}this.A[t]=i},l.prototype.C=function(t,i){for(var r=this.A[t];t<i;){var e=t<<1|1,n=e+1,s=this.A[e];if(n<this.i&&0<this.M(s,this.A[n])&&(s=this.A[e=n]),0<=this.M(s,r))break;this.A[t]=s,t=e}this.A[t]=r},l.prototype.clear=function(){this.i=0,this.A.length=0},l.prototype.push=function(t){this.A.push(t),this.T(this.i),this.i+=1},l.prototype.pop=function(){var t,i;if(0!==this.i)return t=this.A[0],i=this.A.pop(),--this.i,this.i&&(this.A[0]=i,this.C(0,this.i>>1)),t},l.prototype.top=function(){return this.A[0]},l.prototype.find=function(t){return 0<=this.A.indexOf(t)},l.prototype.remove=function(t){t=this.A.indexOf(t);return!(t<0||(0===t?this.pop():t===this.i-1?(this.A.pop(),--this.i):(this.A.splice(t,1,this.A.pop()),--this.i,this.T(t),this.C(t,this.i>>1)),0))},l.prototype.updateItem=function(t){t=this.A.indexOf(t);return!(t<0||(this.T(t),this.C(t,this.i>>1),0))},l.prototype.toArray=function(){return p([],h(this.A),!1)};var rt,n=l;function l(t,i,r){void 0===t&&(t=[]),void 0===i&&(i=function(t,i){return i<t?-1:t<i?1:0}),void 0===r&&(r=!0);for(var e,n=rt.call(this)||this,s=(n.M=i,Array.isArray(t)?n.A=r?p([],h(t),!1):t:(n.A=[],e=n,t.forEach(function(t){e.A.push(t)})),n.i=n.A.length,n.i>>1),o=n.i-1>>1;0<=o;--o)n.C(o,s);return n}i(nt,et=Y),nt.prototype.copy=function(){return new nt(this.t,this.u,this.o,this.v,this.iteratorType)};var et,y=nt;function nt(){return null!==et&&et.apply(this,arguments)||this}i(v,st=H),v.prototype.clear=function(){this.i=0,this.q.length=0},v.prototype.begin=function(){return new y(0,this.size,this.getElementByPos,this.setElementByPos)},v.prototype.end=function(){return new y(this.i,this.size,this.getElementByPos,this.setElementByPos)},v.prototype.rBegin=function(){return new y(this.i-1,this.size,this.getElementByPos,this.setElementByPos,1)},v.prototype.rEnd=function(){return new y(-1,this.size,this.getElementByPos,this.setElementByPos,1)},v.prototype.front=function(){return this.q[0]},v.prototype.back=function(){return this.q[this.i-1]},v.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;return this.q[t]},v.prototype.eraseElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;return this.q.splice(t,1),--this.i,this.i},v.prototype.eraseElementByValue=function(t){for(var i=0,r=0;r<this.i;++r)this.q[r]!==t&&(this.q[i++]=this.q[r]);return this.i=this.q.length=i,this.i},v.prototype.eraseElementByIterator=function(t){var i=t.t;return t=t.next(),this.eraseElementByPos(i),t},v.prototype.pushBack=function(t){return this.q.push(t),this.i+=1,this.i},v.prototype.popBack=function(){if(0!==this.i)return--this.i,this.q.pop()},v.prototype.setElementByPos=function(t,i){if(t<0||t>this.i-1)throw new RangeError;this.q[t]=i},v.prototype.insert=function(t,i,r){var e;if(void 0===r&&(r=1),t<0||t>this.i)throw new RangeError;return(e=this.q).splice.apply(e,p([t,0],h(new Array(r).fill(i)),!1)),this.i+=r,this.i},v.prototype.find=function(t){for(var i=0;i<this.i;++i)if(this.q[i]===t)return new y(i,this.size,this.getElementByPos,this.getElementByPos);return this.end()},v.prototype.reverse=function(){this.q.reverse()},v.prototype.unique=function(){for(var t=1,i=1;i<this.i;++i)this.q[i]!==this.q[i-1]&&(this.q[t++]=this.q[i]);return this.i=this.q.length=t,this.i},v.prototype.sort=function(t){this.q.sort(t)},v.prototype.forEach=function(t){for(var i=0;i<this.i;++i)t(this.q[i],i,this)},v.prototype[Symbol.iterator]=function(){return function(){return r(this,function(t){switch(t.label){case 0:return[5,u(this.q)];case 1:return t.sent(),[2]}})}.bind(this)()};var st,Y=v;function v(t,i){void 0===t&&(t=[]),void 0===i&&(i=!0);var r,e=st.call(this)||this;return Array.isArray(t)?(e.q=i?p([],h(t),!1):t,e.i=t.length):(e.q=[],r=e,t.forEach(function(t){r.pushBack(t)})),e.size=e.size.bind(e),e.getElementByPos=e.getElementByPos.bind(e),e.setElementByPos=e.setElementByPos.bind(e),e}i(D,ot=e),Object.defineProperty(D.prototype,"pointer",{get:function(){return this.t===this.D&&o(),this.t.R},set:function(t){this.t===this.D&&o(),this.t.R=t},enumerable:!1,configurable:!0}),D.prototype.copy=function(){return new D(this.t,this.D,this.iteratorType)};var ot,d=D;function D(t,i,r){r=ot.call(this,r)||this;return r.t=t,r.D=i,0===r.iteratorType?(r.pre=function(){return this.t.m===this.D&&o(),this.t=this.t.m,this},r.next=function(){return this.t===this.D&&o(),this.t=this.t.V,this}):(r.pre=function(){return this.t.V===this.D&&o(),this.t=this.t.V,this},r.next=function(){return this.t===this.D&&o(),this.t=this.t.m,this}),r}i(w,ht=H),w.prototype.P=function(t){var i=t.m,r=t.V;(i.V=r).m=i,t===this.j&&(this.j=r),t===this.N&&(this.N=i),--this.i},w.prototype.B=function(t,i){var r=i.V,t={R:t,m:i,V:r};i.V=t,r.m=t,i===this.D&&(this.j=t),r===this.D&&(this.N=t),this.i+=1},w.prototype.clear=function(){this.i=0,this.j=this.N=this.D.m=this.D.V=this.D},w.prototype.begin=function(){return new d(this.j,this.D)},w.prototype.end=function(){return new d(this.D,this.D)},w.prototype.rBegin=function(){return new d(this.N,this.D,1)},w.prototype.rEnd=function(){return new d(this.D,this.D,1)},w.prototype.front=function(){return this.j.R},w.prototype.back=function(){return this.N.R},w.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;for(var i=this.j;t--;)i=i.V;return i.R},w.prototype.eraseElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;for(var i=this.j;t--;)i=i.V;return this.P(i),this.i},w.prototype.eraseElementByValue=function(t){for(var i=this.j;i!==this.D;)i.R===t&&this.P(i),i=i.V;return this.i},w.prototype.eraseElementByIterator=function(t){var i=t.t;return i===this.D&&o(),t=t.next(),this.P(i),t},w.prototype.pushBack=function(t){return this.B(t,this.N),this.i},w.prototype.popBack=function(){var t;if(0!==this.i)return t=this.N.R,this.P(this.N),t},w.prototype.pushFront=function(t){return this.B(t,this.D),this.i},w.prototype.popFront=function(){var t;if(0!==this.i)return t=this.j.R,this.P(this.j),t},w.prototype.setElementByPos=function(t,i){if(t<0||t>this.i-1)throw new RangeError;for(var r=this.j;t--;)r=r.V;r.R=i},w.prototype.insert=function(t,i,r){if(void 0===r&&(r=1),t<0||t>this.i)throw new RangeError;if(!(r<=0))if(0===t)for(;r--;)this.pushFront(i);else if(t===this.i)for(;r--;)this.pushBack(i);else{for(var e=this.j,n=1;n<t;++n)e=e.V;var s=e.V;for(this.i+=r;r--;)e.V={R:i,m:e},e=(e.V.m=e).V;(e.V=s).m=e}return this.i},w.prototype.find=function(t){for(var i=this.j;i!==this.D;){if(i.R===t)return new d(i,this.D);i=i.V}return this.end()},w.prototype.reverse=function(){if(!(this.i<=1))for(var t=this.j,i=this.N,r=0;r<<1<this.i;){var e=t.R;t.R=i.R,i.R=e,t=t.V,i=i.m,r+=1}},w.prototype.unique=function(){if(!(this.i<=1))for(var t=this.j;t!==this.D;){for(var i=t;i.V!==this.D&&i.R===i.V.R;)i=i.V,--this.i;t.V=i.V,t=(t.V.m=t).V}return this.i},w.prototype.sort=function(t){var i,r;this.i<=1||(i=[],this.forEach(function(t){i.push(t)}),i.sort(t),r=this.j,i.forEach(function(t){r.R=t,r=r.V}))},w.prototype.merge=function(t){var i,r=this;return 0===this.i?t.forEach(function(t){r.pushBack(t)}):(i=this.j,t.forEach(function(t){for(;i!==r.D&&i.R<=t;)i=i.V;r.B(t,i.m)})),this.i},w.prototype.forEach=function(t){for(var i=this.j,r=0;i!==this.D;)t(i.R,r++,this),i=i.V},w.prototype[Symbol.iterator]=function(){return function(){var i;return r(this,function(t){switch(t.label){case 0:if(0===this.i)return[2];i=this.j,t.label=1;case 1:return i===this.D?[3,3]:[4,i.R];case 2:return t.sent(),i=i.V,[3,1];case 3:return[2]}})}.bind(this)()};var ht,H=w;function w(t){void 0===t&&(t=[]);var i=ht.call(this)||this,r=(i.D={},i.j=i.N=i.D.m=i.D.V=i.D,i);return t.forEach(function(t){r.pushBack(t)}),i}m.prototype.m=function(){var t=this;if(1===t.G&&t.U.U===t)t=t.K;else if(t.J)for(t=t.J;t.K;)t=t.K;else{for(var i=t.U;i.J===t;)i=(t=i).U;t=i}return t},m.prototype.V=function(){var t=this;if(t.K){for(t=t.K;t.J;)t=t.J;return t}for(var i=t.U;i.K===t;)i=(t=i).U;return t.K!==i?i:t},m.prototype.W=function(){var t=this.U,i=this.K,r=i.J;return t.U===this?t.U=i:t.J===this?t.J=i:t.K=i,i.U=t,(i.J=this).U=i,(this.K=r)&&(r.U=this),i},m.prototype.X=function(){var t=this.U,i=this.J,r=i.K;return t.U===this?t.U=i:t.J===this?t.J=i:t.K=i,i.U=t,(i.K=this).U=i,(this.J=r)&&(r.U=this),i};var ut=m;function m(t,i){this.G=1,this.F=void 0,this.R=void 0,this.J=void 0,this.K=void 0,this.U=void 0,this.F=t,this.R=i}i(g,E=ut),g.prototype.W=function(){var t=E.prototype.W.call(this);return this.Z(),t.Z(),t},g.prototype.X=function(){var t=E.prototype.X.call(this);return this.Z(),t.Z(),t},g.prototype.Z=function(){this.Y=1,this.J&&(this.Y+=this.J.Y),this.K&&(this.Y+=this.K.Y)};var E,pt=g;function g(){var t=null!==E&&E.apply(this,arguments)||this;return t.Y=1,t}i(b,ft=_),b.prototype.st=function(t,i){for(var r=this.D;t;){var e=this.M(t.F,i);if(e<0)t=t.K;else{if(!(0<e))return t;t=(r=t).J}}return r},b.prototype.ht=function(t,i){for(var r=this.D;t;)t=this.M(t.F,i)<=0?t.K:(r=t).J;return r},b.prototype.ut=function(t,i){for(var r=this.D;t;){var e=this.M(t.F,i);if(e<0)t=(r=t).K;else{if(!(0<e))return t;t=t.J}}return r},b.prototype.ot=function(t,i){for(var r=this.D;t;)t=this.M(t.F,i)<0?(r=t).K:t.J;return r},b.prototype.ft=function(t){for(;;){var i,r=t.U;if(r===this.D)return;if(1===t.G)return void(t.G=0);if(t===r.J)if(1===(i=r.K).G)i.G=0,r.G=1,r===this.$?this.$=r.W():r.W();else{if(i.K&&1===i.K.G)return i.G=r.G,r.G=0,i.K.G=0,void(r===this.$?this.$=r.W():r.W());i.J&&1===i.J.G?(i.G=1,i.J.G=0,i.X()):(i.G=1,t=r)}else if(1===(i=r.J).G)i.G=0,r.G=1,r===this.$?this.$=r.X():r.X();else{if(i.J&&1===i.J.G)return i.G=r.G,r.G=0,i.J.G=0,void(r===this.$?this.$=r.X():r.X());i.K&&1===i.K.G?(i.G=1,i.K.G=0,i.W()):(i.G=1,t=r)}}},b.prototype.nt=function(t){var i;if(1===this.i)return this.clear(),this.D;for(var r=t;r.J||r.K;){if(r.K)for(r=r.K;r.J;)r=r.J;else r=r.J;i=h([r.F,t.F],2),t.F=i[0],r.F=i[1],i=h([r.R,t.R],2),t.R=i[0],r.R=i[1],t=r}this.D.J===r?this.D.J=r.U:this.D.K===r&&(this.D.K=r.U),this.ft(r);var e=r.U;return r===e.J?e.J=void 0:e.K=void 0,--this.i,this.$.G=0,e},b.prototype.ct=function(t,i){return void 0!==t&&(!!this.ct(t.J,i)||!!i(t)||this.ct(t.K,i))},b.prototype.et=function(t){for(;;){var i=t.U;if(0===i.G)return;var r,e,n=i.U;if(i===n.J){if((r=n.K)&&1===r.G){if(r.G=i.G=0,n===this.$)return;n.G=1,t=n;continue}if(t===i.K)return t.G=0,t.J&&(t.J.U=i),t.K&&(t.K.U=n),i.K=t.J,n.J=t.K,t.J=i,(t.K=n)===this.$?(this.$=t,this.D.U=t):(e=n.U).J===n?e.J=t:e.K=t,t.U=n.U,i.U=t,n.U=t,n.G=1,{parentNode:i,grandParent:n,curNode:t};i.G=0,n===this.$?this.$=n.X():n.X()}else{if((r=n.J)&&1===r.G){if(r.G=i.G=0,n===this.$)return;n.G=1,t=n;continue}if(t===i.J)return t.G=0,t.J&&(t.J.U=n),t.K&&(t.K.U=i),n.K=t.J,i.J=t.K,t.J=n,t.K=i,n===this.$?(this.$=t,this.D.U=t):(e=n.U).J===n?e.J=t:e.K=t,t.U=n.U,i.U=t,n.U=t,n.G=1,{parentNode:i,grandParent:n,curNode:t};i.G=0,n===this.$?this.$=n.W():n.W()}return void(n.G=1)}},b.prototype.rt=function(t,i,r){if(void 0===this.$)this.i+=1,this.$=new this.tt(t,i),this.$.G=0,this.$.U=this.D,this.D.U=this.$,this.D.J=this.$,this.D.K=this.$;else{var e,n=this.D.J,s=this.M(n.F,t);if(0!==s){if(0<s)n.J=new this.tt(t,i),e=(n.J.U=n).J,this.D.J=e;else{var s=this.D.K,o=this.M(s.F,t);if(0===o)return void(s.R=i);if(o<0)s.K=new this.tt(t,i),e=(s.K.U=s).K,this.D.K=e;else{if(void 0!==r){o=r.t;if(o!==this.D){s=this.M(o.F,t);if(0===s)return void(o.R=i);if(0<s){r=o.m(),s=this.M(r.F,t);if(0===s)return void(r.R=i);s<0&&(e=new this.tt(t,i),void 0===r.K?(r.K=e).U=r:(o.J=e).U=o)}}}if(void 0===e)for(e=this.$;;){var h=this.M(e.F,t);if(0<h){if(void 0===e.J){e.J=new this.tt(t,i),e=(e.J.U=e).J;break}e=e.J}else{if(!(h<0))return void(e.R=i);if(void 0===e.K){e.K=new this.tt(t,i),e=(e.K.U=e).K;break}e=e.K}}}}return this.i+=1,e}n.R=i}},b.prototype.vt=function(t,i){for(;t;){var r=this.M(t.F,i);if(r<0)t=t.K;else{if(!(0<r))return t;t=t.J}}return t||this.D},b.prototype.clear=function(){this.i=0,this.$=void 0,this.D.U=void 0,this.D.J=this.D.K=void 0},b.prototype.updateKeyByIterator=function(t,i){t=t.t;if(t===this.D&&o(),1!==this.i){if(t===this.D.J)return 0<this.M(t.V().F,i)&&(t.F=i,!0);if(t===this.D.K)return this.M(t.m().F,i)<0&&(t.F=i,!0);var r=t.m().F;if(0<=this.M(r,i))return!1;if(r=t.V().F,this.M(r,i)<=0)return!1}return t.F=i,!0},b.prototype.eraseElementByPos=function(i){if(i<0||i>this.i-1)throw new RangeError;var r=0,e=this;return this.ct(this.$,function(t){return i===r?(e.P(t),!0):(r+=1,!1)}),this.i},b.prototype.eraseElementByKey=function(t){return 0!==this.i&&(t=this.vt(this.$,t))!==this.D&&(this.P(t),!0)},b.prototype.eraseElementByIterator=function(t){var i=t.t,r=(i===this.D&&o(),void 0===i.K);return 0===t.iteratorType?r&&t.next():r&&void 0!==i.J||t.next(),this.P(i),t},b.prototype.forEach=function(t){var i,r,e=0;try{for(var n=u(this),s=n.next();!s.done;s=n.next())t(s.value,e++,this)}catch(t){i={error:t}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}},b.prototype.getElementByPos=function(t){var i,r,e;if(t<0||t>this.i-1)throw new RangeError;var n=0;try{for(var s=u(this),o=s.next();!o.done;o=s.next()){var h=o.value;if(n===t){e=h;break}n+=1}}catch(t){i={error:t}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return e},b.prototype.getHeight=function(){var i;return 0===this.i?0:(i=function(t){return t?Math.max(i(t.J),i(t.K))+1:0})(this.$)};var ft,B=b;function b(t,i){void 0===t&&(t=function(t,i){return t<i?-1:i<t?1:0}),void 0===i&&(i=!1);var r=ft.call(this)||this;return r.$=void 0,r.M=t,i?(r.tt=pt,r.it=function(t,i,r){t=this.rt(t,i,r);if(t){for(var e=t.U;e!==this.D;)e.Y+=1,e=e.U;var i=this.et(t);i&&(r=i.parentNode,t=i.grandParent,i=i.curNode,r.Z(),t.Z(),i.Z())}return this.i},r.P=function(t){for(var i=this.nt(t);i!==this.D;)--i.Y,i=i.U}):(r.tt=ut,r.it=function(t,i,r){t=this.rt(t,i,r);return t&&this.et(t),this.i},r.P=r.nt),r.D=new r.tt,r}i(lt,ct=e),Object.defineProperty(lt.prototype,"index",{get:function(){var t=this.t,i=this.D.U;if(t===this.D)return i?i.Y-1:0;var r=0;for(t.J&&(r+=t.J.Y);t!==i;){var e=t.U;t===e.K&&(r+=1,e.J)&&(r+=e.J.Y),t=e}return r},enumerable:!1,configurable:!0});var ct,at=lt;function lt(t,i,r){r=ct.call(this,r)||this;return r.t=t,r.D=i,0===r.iteratorType?(r.pre=function(){return this.t===this.D.J&&o(),this.t=this.t.m(),this},r.next=function(){return this.t===this.D&&o(),this.t=this.t.V(),this}):(r.pre=function(){return this.t===this.D.K&&o(),this.t=this.t.V(),this},r.next=function(){return this.t===this.D&&o(),this.t=this.t.m(),this}),r}i(J,yt=at),Object.defineProperty(J.prototype,"pointer",{get:function(){return this.t===this.D&&o(),this.t.F},enumerable:!1,configurable:!0}),J.prototype.copy=function(){return new J(this.t,this.D,this.iteratorType)};var yt,P=J;function J(){return null!==yt&&yt.apply(this,arguments)||this}i(K,vt=B),K.prototype.dt=function(i){return r(this,function(t){switch(t.label){case 0:return void 0===i?[2]:[5,u(this.dt(i.J))];case 1:return t.sent(),[4,i.F];case 2:return t.sent(),[5,u(this.dt(i.K))];case 3:return t.sent(),[2]}})},K.prototype.begin=function(){return new P(this.D.J||this.D,this.D)},K.prototype.end=function(){return new P(this.D,this.D)},K.prototype.rBegin=function(){return new P(this.D.K||this.D,this.D,1)},K.prototype.rEnd=function(){return new P(this.D,this.D,1)},K.prototype.front=function(){return this.D.J?this.D.J.F:void 0},K.prototype.back=function(){return this.D.K?this.D.K.F:void 0},K.prototype.insert=function(t,i){return this.it(t,void 0,i)},K.prototype.find=function(t){t=this.vt(this.$,t);return new P(t,this.D)},K.prototype.lowerBound=function(t){t=this.st(this.$,t);return new P(t,this.D)},K.prototype.upperBound=function(t){t=this.ht(this.$,t);return new P(t,this.D)},K.prototype.reverseLowerBound=function(t){t=this.ut(this.$,t);return new P(t,this.D)},K.prototype.reverseUpperBound=function(t){t=this.ot(this.$,t);return new P(t,this.D)},K.prototype.union=function(t){var i=this;return t.forEach(function(t){i.insert(t)}),this.i},K.prototype[Symbol.iterator]=function(){return this.dt(this.$)};var vt,dt=K;function K(t,i,r){void 0===t&&(t=[]);var i=vt.call(this,i,r)||this,e=i;return t.forEach(function(t){e.insert(t)}),i}i(V,Dt=at),Object.defineProperty(V.prototype,"pointer",{get:function(){this.t===this.D&&o();var e=this;return new Proxy([],{get:function(t,i){return"0"===i?e.t.F:"1"===i?e.t.R:void 0},set:function(t,i,r){if("1"!==i)throw new TypeError("props must be 1");return e.t.R=r,!0}})},enumerable:!1,configurable:!0}),V.prototype.copy=function(){return new V(this.t,this.D,this.iteratorType)};var Dt,R=V;function V(){return null!==Dt&&Dt.apply(this,arguments)||this}i(A,wt=B),A.prototype.dt=function(i){return r(this,function(t){switch(t.label){case 0:return void 0===i?[2]:[5,u(this.dt(i.J))];case 1:return t.sent(),[4,[i.F,i.R]];case 2:return t.sent(),[5,u(this.dt(i.K))];case 3:return t.sent(),[2]}})},A.prototype.begin=function(){return new R(this.D.J||this.D,this.D)},A.prototype.end=function(){return new R(this.D,this.D)},A.prototype.rBegin=function(){return new R(this.D.K||this.D,this.D,1)},A.prototype.rEnd=function(){return new R(this.D,this.D,1)},A.prototype.front=function(){var t;if(0!==this.i)return[(t=this.D.J).F,t.R]},A.prototype.back=function(){var t;if(0!==this.i)return[(t=this.D.K).F,t.R]},A.prototype.lowerBound=function(t){t=this.st(this.$,t);return new R(t,this.D)},A.prototype.upperBound=function(t){t=this.ht(this.$,t);return new R(t,this.D)},A.prototype.reverseLowerBound=function(t){t=this.ut(this.$,t);return new R(t,this.D)},A.prototype.reverseUpperBound=function(t){t=this.ot(this.$,t);return new R(t,this.D)},A.prototype.setElement=function(t,i,r){return this.it(t,i,r)},A.prototype.find=function(t){t=this.vt(this.$,t);return new R(t,this.D)},A.prototype.getElementByKey=function(t){return this.vt(this.$,t).R},A.prototype.union=function(t){var i=this;return t.forEach(function(t){i.setElement(t[0],t[1])}),this.i},A.prototype[Symbol.iterator]=function(){return this.dt(this.$)};var wt,at=A;function A(t,i,r){void 0===t&&(t=[]);var i=wt.call(this,i,r)||this,e=i;return t.forEach(function(t){e.setElement(t[0],t[1])}),i}function mt(t){var i=typeof t;return"object"==i&&null!==t||"function"==i}i(gt,Et=e);var Et,B=gt;function gt(t,i,r){r=Et.call(this,r)||this;return r.t=t,r.D=i,0===r.iteratorType?(r.pre=function(){return this.t.m===this.D&&o(),this.t=this.t.m,this},r.next=function(){return this.t===this.D&&o(),this.t=this.t.V,this}):(r.pre=function(){return this.t.V===this.D&&o(),this.t=this.t.V,this},r.next=function(){return this.t===this.D&&o(),this.t=this.t.m,this}),r}i(U,Bt=_),U.prototype.P=function(t){var i=t.m,r=t.V;(i.V=r).m=i,t===this.j&&(this.j=r),t===this.N&&(this.N=i),--this.i},U.prototype.it=function(t,i,r){var e;if(r=void 0===r?mt(t):r){r=t[this.HASH_TAG];if(void 0!==r)return this.lt[r].R=i,this.i;Object.defineProperty(t,this.HASH_TAG,{value:this.lt.length,configurable:!0}),e={F:t,R:i,m:this.N,V:this.D},this.lt.push(e)}else{r=this.wt[t];if(r)return r.R=i,this.i;e={F:t,R:i,m:this.N,V:this.D},this.wt[t]=e}return 0===this.i?(this.j=e,this.D.V=e):this.N.V=e,this.N=e,this.D.m=e,++this.i},U.prototype.vt=function(t,i){return(i=void 0===i?mt(t):i)?void 0===(i=t[this.HASH_TAG])?this.D:this.lt[i]:this.wt[t]||this.D},U.prototype.clear=function(){var i=this.HASH_TAG;this.lt.forEach(function(t){delete t.F[i]}),this.lt=[],this.wt={},Object.setPrototypeOf(this.wt,null),this.i=0,this.j=this.N=this.D.m=this.D.V=this.D},U.prototype.eraseElementByKey=function(t,i){var r;if(i=void 0===i?mt(t):i){i=t[this.HASH_TAG];if(void 0===i)return!1;delete t[this.HASH_TAG],r=this.lt[i],delete this.lt[i]}else{if(void 0===(r=this.wt[t]))return!1;delete this.wt[t]}return this.P(r),!0},U.prototype.eraseElementByIterator=function(t){var i=t.t;return i===this.D&&o(),this.P(i),t.next()},U.prototype.eraseElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;for(var i=this.j;t--;)i=i.V;return this.P(i),this.i};var Bt,e=U;function U(){var t=Bt.call(this)||this;return t.lt=[],t.wt={},t.HASH_TAG=Symbol("@@HASH_TAG"),Object.setPrototypeOf(t.wt,null),t.D={},t.D.m=t.D.V=t.j=t.N=t.D,t}i(G,bt=B),Object.defineProperty(G.prototype,"pointer",{get:function(){return this.t===this.D&&o(),this.t.F},enumerable:!1,configurable:!0}),G.prototype.copy=function(){return new G(this.t,this.D,this.iteratorType)};var bt,j=G;function G(){return null!==bt&&bt.apply(this,arguments)||this}i(F,Pt=e),F.prototype.begin=function(){return new j(this.j,this.D)},F.prototype.end=function(){return new j(this.D,this.D)},F.prototype.rBegin=function(){return new j(this.N,this.D,1)},F.prototype.rEnd=function(){return new j(this.D,this.D,1)},F.prototype.front=function(){return this.j.F},F.prototype.back=function(){return this.N.F},F.prototype.insert=function(t,i){return this.it(t,void 0,i)},F.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;for(var i=this.j;t--;)i=i.V;return i.F},F.prototype.find=function(t,i){t=this.vt(t,i);return new j(t,this.D)},F.prototype.forEach=function(t){for(var i=0,r=this.j;r!==this.D;)t(r.F,i++,this),r=r.V},F.prototype[Symbol.iterator]=function(){return function(){var i;return r(this,function(t){switch(t.label){case 0:i=this.j,t.label=1;case 1:return i===this.D?[3,3]:[4,i.F];case 2:return t.sent(),i=i.V,[3,1];case 3:return[2]}})}.bind(this)()};var Pt,_=F;function F(t){void 0===t&&(t=[]);var i=Pt.call(this)||this,r=i;return t.forEach(function(t){r.insert(t)}),i}i(Kt,Jt=B),Object.defineProperty(Kt.prototype,"pointer",{get:function(){this.t===this.D&&o();var e=this;return new Proxy([],{get:function(t,i){return"0"===i?e.t.F:"1"===i?e.t.R:void 0},set:function(t,i,r){if("1"!==i)throw new TypeError("props must be 1");return e.t.R=r,!0}})},enumerable:!1,configurable:!0}),Kt.prototype.copy=function(){return new Kt(this.t,this.D,this.iteratorType)};var Jt,x=Kt;function Kt(){return null!==Jt&&Jt.apply(this,arguments)||this}i($,Rt=e),$.prototype.begin=function(){return new x(this.j,this.D)},$.prototype.end=function(){return new x(this.D,this.D)},$.prototype.rBegin=function(){return new x(this.N,this.D,1)},$.prototype.rEnd=function(){return new x(this.D,this.D,1)},$.prototype.front=function(){if(0!==this.i)return[this.j.F,this.j.R]},$.prototype.back=function(){if(0!==this.i)return[this.N.F,this.N.R]},$.prototype.setElement=function(t,i,r){return this.it(t,i,r)},$.prototype.getElementByKey=function(t,i){return(i=void 0===i?mt(t):i)?void 0!==(i=t[this.HASH_TAG])?this.lt[i].R:void 0:(i=this.wt[t])?i.R:void 0},$.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;for(var i=this.j;t--;)i=i.V;return[i.F,i.R]},$.prototype.find=function(t,i){t=this.vt(t,i);return new x(t,this.D)},$.prototype.forEach=function(t){for(var i=0,r=this.j;r!==this.D;)t([r.F,r.R],i++,this),r=r.V},$.prototype[Symbol.iterator]=function(){return function(){var i;return r(this,function(t){switch(t.label){case 0:i=this.j,t.label=1;case 1:return i===this.D?[3,3]:[4,[i.F,i.R]];case 2:return t.sent(),i=i.V,[3,1];case 3:return[2]}})}.bind(this)()};var Rt,B=$;function $(t){void 0===t&&(t=[]);var i=Rt.call(this)||this,r=i;return t.forEach(function(t){r.setElement(t[0],t[1])}),i}t.Deque=Q,t.HashMap=B,t.HashSet=_,t.LinkList=H,t.OrderedMap=at,t.OrderedSet=dt,t.PriorityQueue=n,t.Queue=it,t.Stack=q,t.Vector=Y,Object.defineProperty(t,"_t",{value:!0})});
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).sdsl={})}(this,function(t){"use strict";var L=function(t,i){return(L=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,i){t.__proto__=i}:function(t,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}))(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function r(){this.constructor=t}L(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}function r(e,n){var o,s,h,u={label:0,sent:function(){if(1&h[0])throw h[1];return h[1]},trys:[],ops:[]},f={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function t(r){return function(t){var i=[r,t];if(o)throw new TypeError("Generator is already executing.");for(;u=f&&i[f=0]?0:u;)try{if(o=1,s&&(h=2&i[0]?s.return:i[0]?s.throw||((h=s.return)&&h.call(s),0):s.next)&&!(h=h.call(s,i[1])).done)return h;switch(s=0,(i=h?[2&i[0],h.value]:i)[0]){case 0:case 1:h=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,s=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(h=0<(h=u.trys).length&&h[h.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!h||i[1]>h[0]&&i[1]<h[3]))u.label=i[1];else if(6===i[0]&&u.label<h[1])u.label=h[1],h=i;else{if(!(h&&u.label<h[2])){h[2]&&u.ops.pop(),u.trys.pop();continue}u.label=h[2],u.ops.push(i)}}i=n.call(e,u)}catch(t){i=[6,t],s=0}finally{o=h=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}function u(t){var i="function"==typeof Symbol&&Symbol.iterator,r=i&&t[i],e=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&e>=t.length?void 0:t)&&t[e++],done:!t}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(t,i){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var e,n,o=r.call(t),s=[];try{for(;(void 0===i||0<i--)&&!(e=o.next()).done;)s.push(e.value)}catch(t){n={error:t}}finally{try{e&&!e.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s}function f(t,i,r){if(r||2===arguments.length)for(var e,n=0,o=i.length;n<o;n++)!e&&n in i||((e=e||Array.prototype.slice.call(i,0,n))[n]=i[n]);return t.concat(e||Array.prototype.slice.call(i))}M.prototype.equals=function(t){return this.t===t.t};var e=M;function M(t){this.iteratorType=t=void 0===t?0:t}Object.defineProperty(V.prototype,"length",{get:function(){return this.i},enumerable:!1,configurable:!0}),V.prototype.size=function(){return this.i},V.prototype.empty=function(){return 0===this.i};var n=V;function V(){this.i=0}i(j,R=n);var R,_=j;function j(){return null!==R&&R.apply(this,arguments)||this}i(o,q=n),o.prototype.clear=function(){this.i=0,this.h=[]},o.prototype.push=function(t){return this.h.push(t),this.i+=1,this.i},o.prototype.pop=function(){if(0!==this.i)return--this.i,this.h.pop()},o.prototype.top=function(){return this.h[this.i-1]};var q,C=o;function o(t){void 0===t&&(t=[]);var i=q.call(this)||this,r=(i.h=[],i);return t.forEach(function(t){r.push(t)}),i}i(s,D=n),s.prototype.clear=function(){this.o=[],this.i=this.u=0},s.prototype.push=function(t){var i=this.o.length;if(.5<this.u/i&&this.u+this.i>=i&&4096<i){for(var r=this.i,e=0;e<r;++e)this.o[e]=this.o[this.u+e];this.u=0,this.o[this.i]=t}else this.o[this.u+this.i]=t;return++this.i},s.prototype.pop=function(){var t;if(0!==this.i)return t=this.o[this.u++],--this.i,t},s.prototype.front=function(){if(0!==this.i)return this.o[this.u]};var D,K=s;function s(t){void 0===t&&(t=[]);var i=D.call(this)||this,r=(i.u=0,i.o=[],i);return t.forEach(function(t){r.push(t)}),i}i(p,U=n),p.prototype.p=function(t){for(var i=this.l[t];0<t;){var r=t-1>>1,e=this.l[r];if(this.v(e,i)<=0)break;this.l[t]=e,t=r}this.l[t]=i},p.prototype._=function(t,i){for(var r=this.l[t];t<i;){var e=t<<1|1,n=e+1,o=this.l[e];if(n<this.i&&0<this.v(o,this.l[n])&&(o=this.l[e=n]),0<=this.v(o,r))break;this.l[t]=o,t=e}this.l[t]=r},p.prototype.clear=function(){this.i=0,this.l.length=0},p.prototype.push=function(t){this.l.push(t),this.p(this.i),this.i+=1},p.prototype.pop=function(){var t,i;if(0!==this.i)return t=this.l[0],i=this.l.pop(),--this.i,this.i&&(this.l[0]=i,this._(0,this.i>>1)),t},p.prototype.top=function(){return this.l[0]},p.prototype.find=function(t){return 0<=this.l.indexOf(t)},p.prototype.remove=function(t){t=this.l.indexOf(t);return!(t<0||(0===t?this.pop():t===this.i-1?(this.l.pop(),--this.i):(this.l.splice(t,1,this.l.pop()),--this.i,this.p(t),this._(t,this.i>>1)),0))},p.prototype.updateItem=function(t){t=this.l.indexOf(t);return!(t<0||(this.p(t),this._(t,this.i>>1),0))},p.prototype.toArray=function(){return f([],h(this.l),!1)};var U,n=p;function p(t,i,r){void 0===t&&(t=[]),void 0===i&&(i=function(t,i){return i<t?-1:t<i?1:0}),void 0===r&&(r=!0);for(var e,n=U.call(this)||this,o=(n.v=i,Array.isArray(t)?n.l=r?f([],h(t),!1):t:(n.l=[],e=n,t.forEach(function(t){e.l.push(t)})),n.i=n.l.length,n.i>>1),s=n.i-1>>1;0<=s;--s)n._(s,o);return n}i(Y,J=_);var J,c=Y;function Y(){return null!==J&&J.apply(this,arguments)||this}function a(){throw new RangeError("Iterator access denied!")}i(Z,z=e),Object.defineProperty(Z.prototype,"pointer",{get:function(){return this.container.getElementByPos(this.t)},set:function(t){this.container.setElementByPos(this.t,t)},enumerable:!1,configurable:!0});var z,W=Z;function Z(t,i){i=z.call(this,i)||this;return i.t=t,0===i.iteratorType?(i.pre=function(){return 0===this.t&&a(),--this.t,this},i.next=function(){return this.t===this.container.size()&&a(),this.t+=1,this}):(i.pre=function(){return this.t===this.container.size()-1&&a(),this.t+=1,this},i.next=function(){return-1===this.t&&a(),--this.t,this}),i}i(Q,$=W),Q.prototype.copy=function(){return new Q(this.t,this.container,this.iteratorType)};var $,y=Q;function Q(t,i,r){t=$.call(this,t,r)||this;return t.container=i,t}i(l,tt=c),l.prototype.clear=function(){this.i=0,this.I.length=0},l.prototype.begin=function(){return new y(0,this)},l.prototype.end=function(){return new y(this.i,this)},l.prototype.rBegin=function(){return new y(this.i-1,this,1)},l.prototype.rEnd=function(){return new y(-1,this,1)},l.prototype.front=function(){return this.I[0]},l.prototype.back=function(){return this.I[this.i-1]},l.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;return this.I[t]},l.prototype.eraseElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;return this.I.splice(t,1),--this.i,this.i},l.prototype.eraseElementByValue=function(t){for(var i=0,r=0;r<this.i;++r)this.I[r]!==t&&(this.I[i++]=this.I[r]);return this.i=this.I.length=i,this.i},l.prototype.eraseElementByIterator=function(t){var i=t.t;return t=t.next(),this.eraseElementByPos(i),t},l.prototype.pushBack=function(t){return this.I.push(t),this.i+=1,this.i},l.prototype.popBack=function(){if(0!==this.i)return--this.i,this.I.pop()},l.prototype.setElementByPos=function(t,i){if(t<0||t>this.i-1)throw new RangeError;this.I[t]=i},l.prototype.insert=function(t,i,r){var e;if(void 0===r&&(r=1),t<0||t>this.i)throw new RangeError;return(e=this.I).splice.apply(e,f([t,0],h(new Array(r).fill(i)),!1)),this.i+=r,this.i},l.prototype.find=function(t){for(var i=0;i<this.i;++i)if(this.I[i]===t)return new y(i,this);return this.end()},l.prototype.reverse=function(){this.I.reverse()},l.prototype.unique=function(){for(var t=1,i=1;i<this.i;++i)this.I[i]!==this.I[i-1]&&(this.I[t++]=this.I[i]);return this.i=this.I.length=t,this.i},l.prototype.sort=function(t){this.I.sort(t)},l.prototype.forEach=function(t){for(var i=0;i<this.i;++i)t(this.I[i],i,this)},l.prototype[Symbol.iterator]=function(){return function(){return r(this,function(t){switch(t.label){case 0:return[5,u(this.I)];case 1:return t.sent(),[2]}})}.bind(this)()};var tt,it=l;function l(t,i){void 0===t&&(t=[]),void 0===i&&(i=!0);var r,e=tt.call(this)||this;return Array.isArray(t)?(e.I=i?f([],h(t),!1):t,e.i=t.length):(e.I=[],r=e,t.forEach(function(t){r.pushBack(t)})),e}i(d,rt=e),Object.defineProperty(d.prototype,"pointer",{get:function(){return this.t===this.S&&a(),this.t.k},set:function(t){this.t===this.S&&a(),this.t.k=t},enumerable:!1,configurable:!0}),d.prototype.copy=function(){return new d(this.t,this.S,this.container,this.iteratorType)};var rt,v=d;function d(t,i,r,e){e=rt.call(this,e)||this;return e.t=t,e.S=i,e.container=r,0===e.iteratorType?(e.pre=function(){return this.t.L===this.S&&a(),this.t=this.t.L,this},e.next=function(){return this.t===this.S&&a(),this.t=this.t.O,this}):(e.pre=function(){return this.t.O===this.S&&a(),this.t=this.t.O,this},e.next=function(){return this.t===this.S&&a(),this.t=this.t.L,this}),e}i(S,et=c),S.prototype.M=function(t){var i=t.L,r=t.O;(i.O=r).L=i,t===this.H&&(this.H=r),t===this.g&&(this.g=i),--this.i},S.prototype.A=function(t,i){var r=i.O,t={k:t,L:i,O:r};i.O=t,r.L=t,i===this.S&&(this.H=t),r===this.S&&(this.g=t),this.i+=1},S.prototype.clear=function(){this.i=0,this.H=this.g=this.S.L=this.S.O=this.S},S.prototype.begin=function(){return new v(this.H,this.S,this)},S.prototype.end=function(){return new v(this.S,this.S,this)},S.prototype.rBegin=function(){return new v(this.g,this.S,this,1)},S.prototype.rEnd=function(){return new v(this.S,this.S,this,1)},S.prototype.front=function(){return this.H.k},S.prototype.back=function(){return this.g.k},S.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;for(var i=this.H;t--;)i=i.O;return i.k},S.prototype.eraseElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;for(var i=this.H;t--;)i=i.O;return this.M(i),this.i},S.prototype.eraseElementByValue=function(t){for(var i=this.H;i!==this.S;)i.k===t&&this.M(i),i=i.O;return this.i},S.prototype.eraseElementByIterator=function(t){var i=t.t;return i===this.S&&a(),t=t.next(),this.M(i),t},S.prototype.pushBack=function(t){return this.A(t,this.g),this.i},S.prototype.popBack=function(){var t;if(0!==this.i)return t=this.g.k,this.M(this.g),t},S.prototype.pushFront=function(t){return this.A(t,this.S),this.i},S.prototype.popFront=function(){var t;if(0!==this.i)return t=this.H.k,this.M(this.H),t},S.prototype.setElementByPos=function(t,i){if(t<0||t>this.i-1)throw new RangeError;for(var r=this.H;t--;)r=r.O;r.k=i},S.prototype.insert=function(t,i,r){if(void 0===r&&(r=1),t<0||t>this.i)throw new RangeError;if(!(r<=0))if(0===t)for(;r--;)this.pushFront(i);else if(t===this.i)for(;r--;)this.pushBack(i);else{for(var e=this.H,n=1;n<t;++n)e=e.O;var o=e.O;for(this.i+=r;r--;)e.O={k:i,L:e},e=(e.O.L=e).O;(e.O=o).L=e}return this.i},S.prototype.find=function(t){for(var i=this.H;i!==this.S;){if(i.k===t)return new v(i,this.S,this);i=i.O}return this.end()},S.prototype.reverse=function(){if(!(this.i<=1))for(var t=this.H,i=this.g,r=0;r<<1<this.i;){var e=t.k;t.k=i.k,i.k=e,t=t.O,i=i.L,r+=1}},S.prototype.unique=function(){if(!(this.i<=1))for(var t=this.H;t!==this.S;){for(var i=t;i.O!==this.S&&i.k===i.O.k;)i=i.O,--this.i;t.O=i.O,t=(t.O.L=t).O}return this.i},S.prototype.sort=function(t){var i,r;this.i<=1||(i=[],this.forEach(function(t){i.push(t)}),i.sort(t),r=this.H,i.forEach(function(t){r.k=t,r=r.O}))},S.prototype.merge=function(t){var i,r=this;return 0===this.i?t.forEach(function(t){r.pushBack(t)}):(i=this.H,t.forEach(function(t){for(;i!==r.S&&i.k<=t;)i=i.O;r.A(t,i.L)})),this.i},S.prototype.forEach=function(t){for(var i=this.H,r=0;i!==this.S;)t(i.k,r++,this),i=i.O},S.prototype[Symbol.iterator]=function(){return function(){var i;return r(this,function(t){switch(t.label){case 0:if(0===this.i)return[2];i=this.H,t.label=1;case 1:return i===this.S?[3,3]:[4,i.k];case 2:return t.sent(),i=i.O,[3,1];case 3:return[2]}})}.bind(this)()};var et,nt=S;function S(t){void 0===t&&(t=[]);var i=et.call(this)||this,r=(i.S={},i.H=i.g=i.S.L=i.S.O=i.S,i);return t.forEach(function(t){r.pushBack(t)}),i}i(st,ot=W),st.prototype.copy=function(){return new st(this.t,this.container,this.iteratorType)};var ot,B=st;function st(t,i,r){t=ot.call(this,t,r)||this;return t.container=i,t}i(w,ht=c),w.prototype.j=function(){for(var t=[],i=Math.max(this.D>>1,1),r=0;r<i;++r)t[r]=new Array(this.V);for(r=this.u;r<this.D;++r)t[t.length]=this.m[r];for(r=0;r<this.C;++r)t[t.length]=this.m[r];t[t.length]=f([],h(this.m[this.C]),!1),this.u=i,this.C=t.length-1;for(r=0;r<i;++r)t[t.length]=new Array(this.V);this.m=t,this.D=t.length},w.prototype.R=function(t){var t=this.T+t+1,i=t%this.V,r=i-1,t=this.u+(t-i)/this.V;return 0==i&&--t,t%=this.D,r<0&&(r+=this.V),{curNodeBucketIndex:t,curNodePointerIndex:r}},w.prototype.clear=function(){this.m=[new Array(this.V)],this.D=1,this.u=this.C=this.i=0,this.T=this.q=this.V>>1},w.prototype.begin=function(){return new B(0,this)},w.prototype.end=function(){return new B(this.i,this)},w.prototype.rBegin=function(){return new B(this.i-1,this,1)},w.prototype.rEnd=function(){return new B(-1,this,1)},w.prototype.front=function(){if(0!==this.i)return this.m[this.u][this.T]},w.prototype.back=function(){if(0!==this.i)return this.m[this.C][this.q]},w.prototype.pushBack=function(t){return this.i&&(this.q<this.V-1?this.q+=1:(this.C<this.D-1?this.C+=1:this.C=0,this.q=0),this.C===this.u)&&this.q===this.T&&this.j(),this.i+=1,this.m[this.C][this.q]=t,this.i},w.prototype.popBack=function(){var t;if(0!==this.i)return t=this.m[this.C][this.q],1!==this.i&&(0<this.q?--this.q:(0<this.C?--this.C:this.C=this.D-1,this.q=this.V-1)),--this.i,t},w.prototype.pushFront=function(t){return this.i&&(0<this.T?--this.T:(0<this.u?--this.u:this.u=this.D-1,this.T=this.V-1),this.u===this.C)&&this.T===this.q&&this.j(),this.i+=1,this.m[this.u][this.T]=t,this.i},w.prototype.popFront=function(){var t;if(0!==this.i)return t=this.m[this.u][this.T],1!==this.i&&(this.T<this.V-1?this.T+=1:(this.u<this.D-1?this.u+=1:this.u=0,this.T=0)),--this.i,t},w.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;var t=this.R(t),i=t.curNodeBucketIndex,t=t.curNodePointerIndex;return this.m[i][t]},w.prototype.setElementByPos=function(t,i){if(t<0||t>this.i-1)throw new RangeError;var t=this.R(t),r=t.curNodeBucketIndex,t=t.curNodePointerIndex;this.m[r][t]=i},w.prototype.insert=function(t,i,r){if(void 0===r&&(r=1),t<0||t>this.i)throw new RangeError;if(0===t)for(;r--;)this.pushFront(i);else if(t===this.i)for(;r--;)this.pushBack(i);else{for(var e=[],n=t;n<this.i;++n)e.push(this.getElementByPos(n));this.cut(t-1);for(n=0;n<r;++n)this.pushBack(i);for(n=0;n<e.length;++n)this.pushBack(e[n])}return this.i},w.prototype.cut=function(t){var i,r;return t<0?(this.clear(),0):(i=(r=this.R(t)).curNodeBucketIndex,r=r.curNodePointerIndex,this.C=i,this.q=r,this.i=t+1,this.i)},w.prototype.eraseElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;if(0===t)this.popFront();else if(t===this.i-1)this.popBack();else{for(var i=[],r=t+1;r<this.i;++r)i.push(this.getElementByPos(r));this.cut(t),this.popBack();var e=this;i.forEach(function(t){e.pushBack(t)})}return this.i},w.prototype.eraseElementByValue=function(t){if(0===this.i)return 0;for(var i=[],r=0;r<this.i;++r){var e=this.getElementByPos(r);e!==t&&i.push(e)}for(var n=i.length,r=0;r<n;++r)this.setElementByPos(r,i[r]);return this.cut(n-1)},w.prototype.eraseElementByIterator=function(t){var i=t.t;return this.eraseElementByPos(i),t=t.next()},w.prototype.find=function(t){for(var i=0;i<this.i;++i)if(this.getElementByPos(i)===t)return new B(i,this);return this.end()},w.prototype.reverse=function(){for(var t=0,i=this.i-1;t<i;){var r=this.getElementByPos(t);this.setElementByPos(t,this.getElementByPos(i)),this.setElementByPos(i,r),t+=1,--i}},w.prototype.unique=function(){if(!(this.i<=1)){for(var t=1,i=this.getElementByPos(0),r=1;r<this.i;++r){var e=this.getElementByPos(r);e!==i&&this.setElementByPos(t++,i=e)}for(;this.i>t;)this.popBack()}return this.i},w.prototype.sort=function(t){for(var i=[],r=0;r<this.i;++r)i.push(this.getElementByPos(r));i.sort(t);for(r=0;r<this.i;++r)this.setElementByPos(r,i[r])},w.prototype.shrinkToFit=function(){if(0!==this.i){var i=[];this.forEach(function(t){i.push(t)}),this.D=Math.max(Math.ceil(this.i/this.V),1),this.i=this.u=this.C=this.T=this.q=0,this.m=[];for(var t=0;t<this.D;++t)this.m.push(new Array(this.V));for(t=0;t<i.length;++t)this.pushBack(i[t])}},w.prototype.forEach=function(t){for(var i=0;i<this.i;++i)t(this.getElementByPos(i),i,this)},w.prototype[Symbol.iterator]=function(){return function(){var i;return r(this,function(t){switch(t.label){case 0:i=0,t.label=1;case 1:return i<this.i?[4,this.getElementByPos(i)]:[3,4];case 2:t.sent(),t.label=3;case 3:return++i,[3,1];case 4:return[2]}})}.bind(this)()};var ht,W=w;function w(t,i){void 0===t&&(t=[]),void 0===i&&(i=4096);var r=ht.call(this)||this,e=(r.u=0,r.T=0,r.C=0,r.q=0,r.D=0,r.m=[],function(){if("number"==typeof t.length)return t.length;if("number"==typeof t.size)return t.size;if("function"==typeof t.size)return t.size();throw new TypeError("Cannot get the length or size of the container")}());r.V=i,r.D=Math.max(Math.ceil(e/r.V),1);for(var n=0;n<r.D;++n)r.m.push(new Array(r.V));var i=Math.ceil(e/r.V),o=(r.u=r.C=(r.D>>1)-(i>>1),r.T=r.q=r.V-e%r.V>>1,r);return t.forEach(function(t){o.pushBack(t)}),r}g.prototype.L=function(){var t=this;if(1===t.N&&t.F.F===t)t=t.G;else if(t.B)for(t=t.B;t.G;)t=t.G;else{for(var i=t.F;i.B===t;)i=(t=i).F;t=i}return t},g.prototype.O=function(){var t=this;if(t.G){for(t=t.G;t.B;)t=t.B;return t}for(var i=t.F;i.G===t;)i=(t=i).F;return t.G!==i?i:t},g.prototype.J=function(){var t=this.F,i=this.G,r=i.B;return t.F===this?t.F=i:t.B===this?t.B=i:t.G=i,i.F=t,(i.B=this).F=i,(this.G=r)&&(r.F=this),i},g.prototype.K=function(){var t=this.F,i=this.B,r=i.G;return t.F===this?t.F=i:t.B===this?t.B=i:t.G=i,i.F=t,(i.G=this).F=i,(this.B=r)&&(r.F=this),i};var ut=g;function g(t,i){this.N=1,this.P=void 0,this.k=void 0,this.B=void 0,this.G=void 0,this.F=void 0,this.P=t,this.k=i}i(m,E=ut),m.prototype.J=function(){var t=E.prototype.J.call(this);return this.W(),t.W(),t},m.prototype.K=function(){var t=E.prototype.K.call(this);return this.W(),t.W(),t},m.prototype.W=function(){this.U=1,this.B&&(this.U+=this.B.U),this.G&&(this.U+=this.G.U)};var E,ft=m;function m(){var t=null!==E&&E.apply(this,arguments)||this;return t.U=1,t}i(P,pt=_),P.prototype.rt=function(t,i){for(var r=this.S;t;){var e=this.v(t.P,i);if(e<0)t=t.G;else{if(!(0<e))return t;t=(r=t).B}}return r},P.prototype.et=function(t,i){for(var r=this.S;t;)t=this.v(t.P,i)<=0?t.G:(r=t).B;return r},P.prototype.nt=function(t,i){for(var r=this.S;t;){var e=this.v(t.P,i);if(e<0)t=(r=t).G;else{if(!(0<e))return t;t=t.B}}return r},P.prototype.st=function(t,i){for(var r=this.S;t;)t=this.v(t.P,i)<0?(r=t).G:t.B;return r},P.prototype.ht=function(t){for(;;){var i,r=t.F;if(r===this.S)return;if(1===t.N)return void(t.N=0);if(t===r.B)if(1===(i=r.G).N)i.N=0,r.N=1,r===this.X?this.X=r.J():r.J();else{if(i.G&&1===i.G.N)return i.N=r.N,r.N=0,i.G.N=0,void(r===this.X?this.X=r.J():r.J());i.B&&1===i.B.N?(i.N=1,i.B.N=0,i.K()):(i.N=1,t=r)}else if(1===(i=r.B).N)i.N=0,r.N=1,r===this.X?this.X=r.K():r.K();else{if(i.B&&1===i.B.N)return i.N=r.N,r.N=0,i.B.N=0,void(r===this.X?this.X=r.K():r.K());i.G&&1===i.G.N?(i.N=1,i.G.N=0,i.J()):(i.N=1,t=r)}}},P.prototype.it=function(t){var i;if(1===this.i)return this.clear(),this.S;for(var r=t;r.B||r.G;){if(r.G)for(r=r.G;r.B;)r=r.B;else r=r.B;i=h([r.P,t.P],2),t.P=i[0],r.P=i[1],i=h([r.k,t.k],2),t.k=i[0],r.k=i[1],t=r}this.S.B===r?this.S.B=r.F:this.S.G===r&&(this.S.G=r.F),this.ht(r);var e=r.F;return r===e.B?e.B=void 0:e.G=void 0,--this.i,this.X.N=0,e},P.prototype.ut=function(t,i){return void 0!==t&&(!!this.ut(t.B,i)||!!i(t)||this.ut(t.G,i))},P.prototype.tt=function(t){for(;;){var i=t.F;if(0===i.N)return;var r,e,n=i.F;if(i===n.B){if((r=n.G)&&1===r.N){if(r.N=i.N=0,n===this.X)return;n.N=1,t=n;continue}if(t===i.G)return t.N=0,t.B&&(t.B.F=i),t.G&&(t.G.F=n),i.G=t.B,n.B=t.G,t.B=i,(t.G=n)===this.X?(this.X=t,this.S.F=t):(e=n.F).B===n?e.B=t:e.G=t,t.F=n.F,i.F=t,n.F=t,n.N=1,{parentNode:i,grandParent:n,curNode:t};i.N=0,n===this.X?this.X=n.K():n.K()}else{if((r=n.B)&&1===r.N){if(r.N=i.N=0,n===this.X)return;n.N=1,t=n;continue}if(t===i.B)return t.N=0,t.B&&(t.B.F=n),t.G&&(t.G.F=i),n.G=t.B,i.B=t.G,t.B=n,t.G=i,n===this.X?(this.X=t,this.S.F=t):(e=n.F).B===n?e.B=t:e.G=t,t.F=n.F,i.F=t,n.F=t,n.N=1,{parentNode:i,grandParent:n,curNode:t};i.N=0,n===this.X?this.X=n.J():n.J()}return void(n.N=1)}},P.prototype.$=function(t,i,r){if(void 0===this.X)this.i+=1,this.X=new this.Y(t,i),this.X.N=0,this.X.F=this.S,this.S.F=this.X,this.S.B=this.X,this.S.G=this.X;else{var e,n=this.S.B,o=this.v(n.P,t);if(0!==o){if(0<o)n.B=new this.Y(t,i),e=(n.B.F=n).B,this.S.B=e;else{var o=this.S.G,s=this.v(o.P,t);if(0===s)return void(o.k=i);if(s<0)o.G=new this.Y(t,i),e=(o.G.F=o).G,this.S.G=e;else{if(void 0!==r){s=r.t;if(s!==this.S){o=this.v(s.P,t);if(0===o)return void(s.k=i);if(0<o){r=s.L(),o=this.v(r.P,t);if(0===o)return void(r.k=i);o<0&&(e=new this.Y(t,i),void 0===r.G?(r.G=e).F=r:(s.B=e).F=s)}}}if(void 0===e)for(e=this.X;;){var h=this.v(e.P,t);if(0<h){if(void 0===e.B){e.B=new this.Y(t,i),e=(e.B.F=e).B;break}e=e.B}else{if(!(h<0))return void(e.k=i);if(void 0===e.G){e.G=new this.Y(t,i),e=(e.G.F=e).G;break}e=e.G}}}}return this.i+=1,e}n.k=i}},P.prototype.ot=function(t,i){for(;t;){var r=this.v(t.P,i);if(r<0)t=t.G;else{if(!(0<r))return t;t=t.B}}return t||this.S},P.prototype.clear=function(){this.i=0,this.X=void 0,this.S.F=void 0,this.S.B=this.S.G=void 0},P.prototype.updateKeyByIterator=function(t,i){t=t.t;if(t===this.S&&a(),1!==this.i){if(t===this.S.B)return 0<this.v(t.O().P,i)&&(t.P=i,!0);if(t===this.S.G)return this.v(t.L().P,i)<0&&(t.P=i,!0);var r=t.L().P;if(0<=this.v(r,i))return!1;if(r=t.O().P,this.v(r,i)<=0)return!1}return t.P=i,!0},P.prototype.eraseElementByPos=function(i){if(i<0||i>this.i-1)throw new RangeError;var r=0,e=this;return this.ut(this.X,function(t){return i===r?(e.M(t),!0):(r+=1,!1)}),this.i},P.prototype.eraseElementByKey=function(t){return 0!==this.i&&(t=this.ot(this.X,t))!==this.S&&(this.M(t),!0)},P.prototype.eraseElementByIterator=function(t){var i=t.t,r=(i===this.S&&a(),void 0===i.G);return 0===t.iteratorType?r&&t.next():r&&void 0!==i.B||t.next(),this.M(i),t},P.prototype.forEach=function(t){var i,r,e=0;try{for(var n=u(this),o=n.next();!o.done;o=n.next())t(o.value,e++,this)}catch(t){i={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}},P.prototype.getElementByPos=function(t){var i,r,e;if(t<0||t>this.i-1)throw new RangeError;var n=0;try{for(var o=u(this),s=o.next();!s.done;s=o.next()){var h=s.value;if(n===t){e=h;break}n+=1}}catch(t){i={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return e},P.prototype.getHeight=function(){var i;return 0===this.i?0:(i=function(t){return t?Math.max(i(t.B),i(t.G))+1:0})(this.X)};var pt,c=P;function P(t,i){void 0===t&&(t=function(t,i){return t<i?-1:i<t?1:0}),void 0===i&&(i=!1);var r=pt.call(this)||this;return r.X=void 0,r.v=t,i?(r.Y=ft,r.Z=function(t,i,r){t=this.$(t,i,r);if(t){for(var e=t.F;e!==this.S;)e.U+=1,e=e.F;var i=this.tt(t);i&&(r=i.parentNode,t=i.grandParent,i=i.curNode,r.W(),t.W(),i.W())}return this.i},r.M=function(t){for(var i=this.it(t);i!==this.S;)--i.U,i=i.F}):(r.Y=ut,r.Z=function(t,i,r){t=this.$(t,i,r);return t&&this.tt(t),this.i},r.M=r.it),r.S=new r.Y,r}i(yt,ct=e),Object.defineProperty(yt.prototype,"index",{get:function(){var t=this.t,i=this.S.F;if(t===this.S)return i?i.U-1:0;var r=0;for(t.B&&(r+=t.B.U);t!==i;){var e=t.F;t===e.G&&(r+=1,e.B)&&(r+=e.B.U),t=e}return r},enumerable:!1,configurable:!0});var ct,at=yt;function yt(t,i,r){r=ct.call(this,r)||this;return r.t=t,r.S=i,0===r.iteratorType?(r.pre=function(){return this.t===this.S.B&&a(),this.t=this.t.L(),this},r.next=function(){return this.t===this.S&&a(),this.t=this.t.O(),this}):(r.pre=function(){return this.t===this.S.G&&a(),this.t=this.t.O(),this},r.next=function(){return this.t===this.S&&a(),this.t=this.t.L(),this}),r}i(k,lt=at),Object.defineProperty(k.prototype,"pointer",{get:function(){return this.t===this.S&&a(),this.t.P},enumerable:!1,configurable:!0}),k.prototype.copy=function(){return new k(this.t,this.S,this.container,this.iteratorType)};var lt,b=k;function k(t,i,r,e){t=lt.call(this,t,i,e)||this;return t.container=r,t}i(G,vt=c),G.prototype.ft=function(i){return r(this,function(t){switch(t.label){case 0:return void 0===i?[2]:[5,u(this.ft(i.B))];case 1:return t.sent(),[4,i.P];case 2:return t.sent(),[5,u(this.ft(i.G))];case 3:return t.sent(),[2]}})},G.prototype.begin=function(){return new b(this.S.B||this.S,this.S,this)},G.prototype.end=function(){return new b(this.S,this.S,this)},G.prototype.rBegin=function(){return new b(this.S.G||this.S,this.S,this,1)},G.prototype.rEnd=function(){return new b(this.S,this.S,this,1)},G.prototype.front=function(){return this.S.B?this.S.B.P:void 0},G.prototype.back=function(){return this.S.G?this.S.G.P:void 0},G.prototype.insert=function(t,i){return this.Z(t,void 0,i)},G.prototype.find=function(t){t=this.ot(this.X,t);return new b(t,this.S,this)},G.prototype.lowerBound=function(t){t=this.rt(this.X,t);return new b(t,this.S,this)},G.prototype.upperBound=function(t){t=this.et(this.X,t);return new b(t,this.S,this)},G.prototype.reverseLowerBound=function(t){t=this.nt(this.X,t);return new b(t,this.S,this)},G.prototype.reverseUpperBound=function(t){t=this.st(this.X,t);return new b(t,this.S,this)},G.prototype.union=function(t){var i=this;return t.forEach(function(t){i.insert(t)}),this.i},G.prototype[Symbol.iterator]=function(){return this.ft(this.X)};var vt,dt=G;function G(t,i,r){void 0===t&&(t=[]);var i=vt.call(this,i,r)||this,e=i;return t.forEach(function(t){e.insert(t)}),i}i(F,St=at),Object.defineProperty(F.prototype,"pointer",{get:function(){this.t===this.S&&a();var e=this;return new Proxy([],{get:function(t,i){return"0"===i?e.t.P:"1"===i?e.t.k:void 0},set:function(t,i,r){if("1"!==i)throw new TypeError("props must be 1");return e.t.k=r,!0}})},enumerable:!1,configurable:!0}),F.prototype.copy=function(){return new F(this.t,this.S,this.container,this.iteratorType)};var St,O=F;function F(t,i,r,e){t=St.call(this,t,i,e)||this;return t.container=r,t}i(N,Bt=c),N.prototype.ft=function(i){return r(this,function(t){switch(t.label){case 0:return void 0===i?[2]:[5,u(this.ft(i.B))];case 1:return t.sent(),[4,[i.P,i.k]];case 2:return t.sent(),[5,u(this.ft(i.G))];case 3:return t.sent(),[2]}})},N.prototype.begin=function(){return new O(this.S.B||this.S,this.S,this)},N.prototype.end=function(){return new O(this.S,this.S,this)},N.prototype.rBegin=function(){return new O(this.S.G||this.S,this.S,this,1)},N.prototype.rEnd=function(){return new O(this.S,this.S,this,1)},N.prototype.front=function(){var t;if(0!==this.i)return[(t=this.S.B).P,t.k]},N.prototype.back=function(){var t;if(0!==this.i)return[(t=this.S.G).P,t.k]},N.prototype.lowerBound=function(t){t=this.rt(this.X,t);return new O(t,this.S,this)},N.prototype.upperBound=function(t){t=this.et(this.X,t);return new O(t,this.S,this)},N.prototype.reverseLowerBound=function(t){t=this.nt(this.X,t);return new O(t,this.S,this)},N.prototype.reverseUpperBound=function(t){t=this.st(this.X,t);return new O(t,this.S,this)},N.prototype.setElement=function(t,i,r){return this.Z(t,i,r)},N.prototype.find=function(t){t=this.ot(this.X,t);return new O(t,this.S,this)},N.prototype.getElementByKey=function(t){return this.ot(this.X,t).k},N.prototype.union=function(t){var i=this;return t.forEach(function(t){i.setElement(t[0],t[1])}),this.i},N.prototype[Symbol.iterator]=function(){return this.ft(this.X)};var Bt,at=N;function N(t,i,r){void 0===t&&(t=[]);var i=Bt.call(this,i,r)||this,e=i;return t.forEach(function(t){e.setElement(t[0],t[1])}),i}function wt(t){var i=typeof t;return"object"==i&&null!==t||"function"==i}i(Et,gt=e);var gt,c=Et;function Et(t,i,r){r=gt.call(this,r)||this;return r.t=t,r.S=i,0===r.iteratorType?(r.pre=function(){return this.t.L===this.S&&a(),this.t=this.t.L,this},r.next=function(){return this.t===this.S&&a(),this.t=this.t.O,this}):(r.pre=function(){return this.t.O===this.S&&a(),this.t=this.t.O,this},r.next=function(){return this.t===this.S&&a(),this.t=this.t.L,this}),r}i(H,mt=_),H.prototype.M=function(t){var i=t.L,r=t.O;(i.O=r).L=i,t===this.H&&(this.H=r),t===this.g&&(this.g=i),--this.i},H.prototype.Z=function(t,i,r){var e;if(r=void 0===r?wt(t):r){r=t[this.HASH_TAG];if(void 0!==r)return this.ct[r].k=i,this.i;Object.defineProperty(t,this.HASH_TAG,{value:this.ct.length,configurable:!0}),e={P:t,k:i,L:this.g,O:this.S},this.ct.push(e)}else{r=this.vt[t];if(r)return r.k=i,this.i;e={P:t,k:i,L:this.g,O:this.S},this.vt[t]=e}return 0===this.i?(this.H=e,this.S.O=e):this.g.O=e,this.g=e,this.S.L=e,++this.i},H.prototype.ot=function(t,i){return(i=void 0===i?wt(t):i)?void 0===(i=t[this.HASH_TAG])?this.S:this.ct[i]:this.vt[t]||this.S},H.prototype.clear=function(){var i=this.HASH_TAG;this.ct.forEach(function(t){delete t.P[i]}),this.ct=[],this.vt={},Object.setPrototypeOf(this.vt,null),this.i=0,this.H=this.g=this.S.L=this.S.O=this.S},H.prototype.eraseElementByKey=function(t,i){var r;if(i=void 0===i?wt(t):i){i=t[this.HASH_TAG];if(void 0===i)return!1;delete t[this.HASH_TAG],r=this.ct[i],delete this.ct[i]}else{if(void 0===(r=this.vt[t]))return!1;delete this.vt[t]}return this.M(r),!0},H.prototype.eraseElementByIterator=function(t){var i=t.t;return i===this.S&&a(),this.M(i),t.next()},H.prototype.eraseElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;for(var i=this.H;t--;)i=i.O;return this.M(i),this.i};var mt,e=H;function H(){var t=mt.call(this)||this;return t.ct=[],t.vt={},t.HASH_TAG=Symbol("@@HASH_TAG"),Object.setPrototypeOf(t.vt,null),t.S={},t.S.L=t.S.O=t.H=t.g=t.S,t}i(x,Pt=c),Object.defineProperty(x.prototype,"pointer",{get:function(){return this.t===this.S&&a(),this.t.P},enumerable:!1,configurable:!0}),x.prototype.copy=function(){return new x(this.t,this.S,this.container,this.iteratorType)};var Pt,T=x;function x(t,i,r,e){t=Pt.call(this,t,i,e)||this;return t.container=r,t}i(X,bt=e),X.prototype.begin=function(){return new T(this.H,this.S,this)},X.prototype.end=function(){return new T(this.S,this.S,this)},X.prototype.rBegin=function(){return new T(this.g,this.S,this,1)},X.prototype.rEnd=function(){return new T(this.S,this.S,this,1)},X.prototype.front=function(){return this.H.P},X.prototype.back=function(){return this.g.P},X.prototype.insert=function(t,i){return this.Z(t,void 0,i)},X.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;for(var i=this.H;t--;)i=i.O;return i.P},X.prototype.find=function(t,i){t=this.ot(t,i);return new T(t,this.S,this)},X.prototype.forEach=function(t){for(var i=0,r=this.H;r!==this.S;)t(r.P,i++,this),r=r.O},X.prototype[Symbol.iterator]=function(){return function(){var i;return r(this,function(t){switch(t.label){case 0:i=this.H,t.label=1;case 1:return i===this.S?[3,3]:[4,i.P];case 2:return t.sent(),i=i.O,[3,1];case 3:return[2]}})}.bind(this)()};var bt,_=X;function X(t){void 0===t&&(t=[]);var i=bt.call(this)||this,r=i;return t.forEach(function(t){r.insert(t)}),i}i(Gt,kt=c),Object.defineProperty(Gt.prototype,"pointer",{get:function(){this.t===this.S&&a();var e=this;return new Proxy([],{get:function(t,i){return"0"===i?e.t.P:"1"===i?e.t.k:void 0},set:function(t,i,r){if("1"!==i)throw new TypeError("props must be 1");return e.t.k=r,!0}})},enumerable:!1,configurable:!0}),Gt.prototype.copy=function(){return new Gt(this.t,this.S,this.container,this.iteratorType)};var kt,I=Gt;function Gt(t,i,r,e){t=kt.call(this,t,i,e)||this;return t.container=r,t}i(A,Ot=e),A.prototype.begin=function(){return new I(this.H,this.S,this)},A.prototype.end=function(){return new I(this.S,this.S,this)},A.prototype.rBegin=function(){return new I(this.g,this.S,this,1)},A.prototype.rEnd=function(){return new I(this.S,this.S,this,1)},A.prototype.front=function(){if(0!==this.i)return[this.H.P,this.H.k]},A.prototype.back=function(){if(0!==this.i)return[this.g.P,this.g.k]},A.prototype.setElement=function(t,i,r){return this.Z(t,i,r)},A.prototype.getElementByKey=function(t,i){return(i=void 0===i?wt(t):i)?void 0!==(i=t[this.HASH_TAG])?this.ct[i].k:void 0:(i=this.vt[t])?i.k:void 0},A.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;for(var i=this.H;t--;)i=i.O;return[i.P,i.k]},A.prototype.find=function(t,i){t=this.ot(t,i);return new I(t,this.S,this)},A.prototype.forEach=function(t){for(var i=0,r=this.H;r!==this.S;)t([r.P,r.k],i++,this),r=r.O},A.prototype[Symbol.iterator]=function(){return function(){var i;return r(this,function(t){switch(t.label){case 0:i=this.H,t.label=1;case 1:return i===this.S?[3,3]:[4,[i.P,i.k]];case 2:return t.sent(),i=i.O,[3,1];case 3:return[2]}})}.bind(this)()};var Ot,c=A;function A(t){void 0===t&&(t=[]);var i=Ot.call(this)||this,r=i;return t.forEach(function(t){r.setElement(t[0],t[1])}),i}t.Deque=W,t.HashMap=c,t.HashSet=_,t.LinkList=nt,t.OrderedMap=at,t.OrderedSet=dt,t.PriorityQueue=n,t.Queue=K,t.Stack=C,t.Vector=it,Object.defineProperty(t,"dt",{value:!0})});
//# sourceMappingURL=js-sdsl.min.js.map
{
"name": "js-sdsl",
"version": "4.2.0",
"version": "4.3.0",
"description": "javascript standard data structure library which benchmark against C++ STL",

@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js",

@@ -11,3 +11,3 @@ <p align="center">

<a href="https://www.npmjs.com/package/js-sdsl"><img src="https://img.shields.io/npm/v/js-sdsl.svg" alt="NPM Version" /></a>
<a href="https://github.com/js-sdsl/js-sdsl/actions/workflows/build.yml"><img src="https://img.shields.io/github/workflow/status/js-sdsl/js-sdsl/js-sdsl%20CI" alt="Build Status" /></a>
<a href="https://github.com/js-sdsl/js-sdsl/actions/workflows/build.yml"><img src="https://img.shields.io/github/actions/workflow/status/js-sdsl/js-sdsl/build.yml" alt="Build Status" /></a>
<a href='https://coveralls.io/github/js-sdsl/js-sdsl?branch=main'><img src='https://coveralls.io/repos/github/js-sdsl/js-sdsl/badge.svg?branch=main' alt='Coverage Status' /></a>

@@ -26,4 +26,4 @@ <a href="https://github.com/js-sdsl/js-sdsl"><img src="https://img.shields.io/github/stars/js-sdsl/js-sdsl.svg" alt="GITHUB Star" /></a>

- **Stack** - first in first out stack.
- **Queue** - first in last out queue.
- **Stack** - first in last out stack.
- **Queue** - first in first out queue.
- **PriorityQueue** - heap-implemented priority queue.

@@ -162,3 +162,3 @@ - **Vector** - protected array, cannot to operate properties like `length` directly.

We use jest library to write unit tests, you can see test coverage on [coveralls](https://coveralls.io/github/js-sdsl/js-sdsl). You can run `yarn test:unit` command to reproduce it.
We use [karma](https://karma-runner.github.io/) and [mocha](https://mochajs.org/) frame to do unit tests and synchronize to [coveralls](https://coveralls.io/github/js-sdsl/js-sdsl). You can run `yarn test:unit` command to reproduce it.

@@ -180,3 +180,3 @@ ### For performance

```bash
$ git clone https://github.com/js-sdsl/js-sdl.git
$ git clone https://github.com/js-sdsl/js-sdsl.git
$ cd js-sdsl

@@ -183,0 +183,0 @@ $ npm install

@@ -11,3 +11,3 @@ <p align="center">

<a href="https://www.npmjs.com/package/js-sdsl"><img src="https://img.shields.io/npm/v/js-sdsl.svg" alt="NPM Version" /></a>
<a href="https://github.com/js-sdsl/js-sdsl/actions/workflows/build.yml"><img src="https://img.shields.io/github/workflow/status/js-sdsl/js-sdsl/js-sdsl%20CI" alt="Build Status" /></a>
<a href="https://github.com/js-sdsl/js-sdsl/actions/workflows/build.yml"><img src="https://img.shields.io/github/actions/workflow/status/js-sdsl/js-sdsl/build.yml" alt="Build Status" /></a>
<a href='https://coveralls.io/github/js-sdsl/js-sdsl?branch=main'><img src='https://coveralls.io/repos/github/js-sdsl/js-sdsl/badge.svg?branch=main' alt='Coverage Status' /></a>

@@ -26,4 +26,4 @@ <a href="https://github.com/js-sdsl/js-sdsl"><img src="https://img.shields.io/github/stars/js-sdsl/js-sdsl.svg" alt="GITHUB Star" /></a>

- **Stack** - 先进先出的堆栈
- **Queue** - 先进后出的队列
- **Stack** - 先进后出的堆栈
- **Queue** - 先进先出的队列
- **PriorityQueue** - 堆实现的优先级队列

@@ -164,3 +164,3 @@ - **Vector** - 受保护的数组,不能直接操作像 `length` 这样的属性

我们使用 `jest` 库来编写我们的单元测试,并将结果同步到了 [coveralls](https://coveralls.io/github/js-sdsl/js-sdsl) 上,你可以使用 `yarn test:unit` 命令来重建它
我们使用 [karma](https://karma-runner.github.io/) 和 [mocha](https://mochajs.org/) 框架进行单元测试,并同步到 [coveralls](https://coveralls.io/github/js-sdsl/js-sdsl) 上,你可以使用 `yarn test:unit` 命令来重建它

@@ -182,3 +182,3 @@ ### 对于性能的校验

```bash
$ git clone https://github.com/js-sdsl/js-sdl.git
$ git clone https://github.com/js-sdsl/js-sdsl.git
$ cd js-sdsl

@@ -185,0 +185,0 @@ $ npm install

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc