1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752 |
- (function(t, i) {
- typeof exports === "object" && typeof module !== "undefined" ? i(exports) : typeof define === "function" && define.amd ? define("sdsl", [ "exports" ], i) : (t = typeof globalThis !== "undefined" ? globalThis : t || self,
- i(t.sdsl = {}));
- })(this, (function(t) {
- "use strict";
- var extendStatics = function(t, i) {
- extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function(t, i) {
- t.__proto__ = i;
- } || function(t, i) {
- for (var e in i) if (Object.prototype.hasOwnProperty.call(i, e)) t[e] = i[e];
- };
- return extendStatics(t, i);
- };
- function __extends(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 = t;
- }
- t.prototype = i === null ? Object.create(i) : (__.prototype = i.prototype, new __);
- }
- function __generator(t, i) {
- var e = {
- label: 0,
- sent: function() {
- if (s[0] & 1) throw s[1];
- return s[1];
- },
- trys: [],
- ops: []
- }, r, n, s, h;
- return h = {
- next: verb(0),
- throw: verb(1),
- return: verb(2)
- }, typeof Symbol === "function" && (h[Symbol.iterator] = function() {
- return this;
- }), h;
- function verb(t) {
- return function(i) {
- return step([ t, i ]);
- };
- }
- function step(h) {
- if (r) throw new TypeError("Generator is already executing.");
- while (e) try {
- if (r = 1, n && (s = h[0] & 2 ? n["return"] : h[0] ? n["throw"] || ((s = n["return"]) && s.call(n),
- 0) : n.next) && !(s = s.call(n, h[1])).done) return s;
- if (n = 0, s) h = [ h[0] & 2, s.value ];
- switch (h[0]) {
- case 0:
- case 1:
- s = h;
- break;
- case 4:
- e.label++;
- return {
- value: h[1],
- done: false
- };
- case 5:
- e.label++;
- n = h[1];
- h = [ 0 ];
- continue;
- case 7:
- h = e.ops.pop();
- e.trys.pop();
- continue;
- default:
- if (!(s = e.trys, s = s.length > 0 && s[s.length - 1]) && (h[0] === 6 || h[0] === 2)) {
- e = 0;
- continue;
- }
- if (h[0] === 3 && (!s || h[1] > s[0] && h[1] < s[3])) {
- e.label = h[1];
- break;
- }
- if (h[0] === 6 && e.label < s[1]) {
- e.label = s[1];
- s = h;
- break;
- }
- if (s && e.label < s[2]) {
- e.label = s[2];
- e.ops.push(h);
- break;
- }
- if (s[2]) e.ops.pop();
- e.trys.pop();
- continue;
- }
- h = i.call(t, e);
- } catch (t) {
- h = [ 6, t ];
- n = 0;
- } finally {
- r = s = 0;
- }
- if (h[0] & 5) throw h[1];
- return {
- value: h[0] ? h[1] : void 0,
- done: true
- };
- }
- }
- function __values(t) {
- var i = typeof Symbol === "function" && Symbol.iterator, e = i && t[i], r = 0;
- if (e) return e.call(t);
- if (t && typeof t.length === "number") return {
- next: function() {
- if (t && r >= t.length) t = void 0;
- return {
- value: t && t[r++],
- done: !t
- };
- }
- };
- throw new TypeError(i ? "Object is not iterable." : "Symbol.iterator is not defined.");
- }
- function __read(t, i) {
- var e = typeof Symbol === "function" && t[Symbol.iterator];
- if (!e) return t;
- var r = e.call(t), n, s = [], h;
- try {
- while ((i === void 0 || i-- > 0) && !(n = r.next()).done) s.push(n.value);
- } catch (t) {
- h = {
- error: t
- };
- } finally {
- try {
- if (n && !n.done && (e = r["return"])) e.call(r);
- } finally {
- if (h) throw h.error;
- }
- }
- return s;
- }
- function __spreadArray(t, i, e) {
- if (e || arguments.length === 2) for (var r = 0, n = i.length, s; r < n; r++) {
- if (s || !(r in i)) {
- if (!s) s = Array.prototype.slice.call(i, 0, r);
- s[r] = i[r];
- }
- }
- return t.concat(s || Array.prototype.slice.call(i));
- }
- var i = function() {
- function ContainerIterator(t) {
- if (t === void 0) {
- t = 0;
- }
- this.iteratorType = t;
- }
- return ContainerIterator;
- }();
- var e = function() {
- function Base() {
- this.t = 0;
- }
- Base.prototype.size = function() {
- return this.t;
- };
- Base.prototype.empty = function() {
- return this.t === 0;
- };
- return Base;
- }();
- var r = function(t) {
- __extends(Container, t);
- function Container() {
- return t !== null && t.apply(this, arguments) || this;
- }
- return Container;
- }(e);
- var n = function(t) {
- __extends(Stack, t);
- function Stack(i) {
- if (i === void 0) {
- i = [];
- }
- var e = t.call(this) || this;
- e.i = [];
- i.forEach((function(t) {
- return e.push(t);
- }));
- return e;
- }
- Stack.prototype.clear = function() {
- this.t = 0;
- this.i.length = 0;
- };
- Stack.prototype.push = function(t) {
- this.i.push(t);
- this.t += 1;
- };
- Stack.prototype.pop = function() {
- this.i.pop();
- if (this.t > 0) this.t -= 1;
- };
- Stack.prototype.top = function() {
- return this.i[this.t - 1];
- };
- return Stack;
- }(e);
- var s = function(t) {
- __extends(SequentialContainer, t);
- function SequentialContainer() {
- return t !== null && t.apply(this, arguments) || this;
- }
- return SequentialContainer;
- }(r);
- var h = function(t) {
- __extends(RandomIterator, t);
- function RandomIterator(i, e, r, n, s) {
- var h = t.call(this, s) || this;
- h.h = i;
- h.u = e;
- h.o = r;
- h.v = n;
- if (h.iteratorType === 0) {
- h.pre = function() {
- if (this.h === 0) {
- throw new RangeError("Random iterator access denied!");
- }
- this.h -= 1;
- return this;
- };
- h.next = function() {
- if (this.h === this.u()) {
- throw new RangeError("Random Iterator access denied!");
- }
- this.h += 1;
- return this;
- };
- } else {
- h.pre = function() {
- if (this.h === this.u() - 1) {
- throw new RangeError("Random iterator access denied!");
- }
- this.h += 1;
- return this;
- };
- h.next = function() {
- if (this.h === -1) {
- throw new RangeError("Random iterator access denied!");
- }
- this.h -= 1;
- return this;
- };
- }
- return h;
- }
- Object.defineProperty(RandomIterator.prototype, "pointer", {
- get: function() {
- return this.o(this.h);
- },
- set: function(t) {
- this.v(this.h, t);
- },
- enumerable: false,
- configurable: true
- });
- RandomIterator.prototype.equals = function(t) {
- return this.h === t.h;
- };
- return RandomIterator;
- }(i);
- var u = function(t) {
- __extends(DequeIterator, t);
- function DequeIterator() {
- return t !== null && t.apply(this, arguments) || this;
- }
- DequeIterator.prototype.copy = function() {
- return new DequeIterator(this.h, this.u, this.o, this.v, this.iteratorType);
- };
- return DequeIterator;
- }(h);
- var f = function(t) {
- __extends(Deque, t);
- function Deque(i, e) {
- if (i === void 0) {
- i = [];
- }
- if (e === void 0) {
- e = 1 << 12;
- }
- var r = t.call(this) || this;
- r.l = 0;
- r._ = 0;
- r.L = 0;
- r.p = 0;
- r.O = 0;
- r.k = [];
- var n;
- if ("size" in i) {
- if (typeof i.size === "number") {
- n = i.size;
- } else {
- n = i.size();
- }
- } else if ("length" in i) {
- n = i.length;
- } else {
- throw new RangeError("Can't get container's size!");
- }
- r.S = e;
- r.O = Math.max(Math.ceil(n / r.S), 1);
- for (var s = 0; s < r.O; ++s) {
- r.k.push(new Array(r.S));
- }
- var h = Math.ceil(n / r.S);
- r.l = r.L = (r.O >> 1) - (h >> 1);
- r._ = r.p = r.S - n % r.S >> 1;
- i.forEach((function(t) {
- return r.pushBack(t);
- }));
- r.size = r.size.bind(r);
- r.getElementByPos = r.getElementByPos.bind(r);
- r.setElementByPos = r.setElementByPos.bind(r);
- return r;
- }
- Deque.prototype.I = function() {
- var t = [];
- var i = Math.max(this.O >> 1, 1);
- for (var e = 0; e < i; ++e) {
- t[e] = new Array(this.S);
- }
- for (var e = this.l; e < this.O; ++e) {
- t[t.length] = this.k[e];
- }
- for (var e = 0; e < this.L; ++e) {
- t[t.length] = this.k[e];
- }
- t[t.length] = __spreadArray([], __read(this.k[this.L]), false);
- this.l = i;
- this.L = t.length - 1;
- for (var e = 0; e < i; ++e) {
- t[t.length] = new Array(this.S);
- }
- this.k = t;
- this.O = t.length;
- };
- Deque.prototype.g = function(t) {
- var i = this._ + t + 1;
- var e = i % this.S;
- var r = e - 1;
- var n = this.l + (i - e) / this.S;
- if (e === 0) n -= 1;
- n %= this.O;
- if (r < 0) r += this.S;
- return {
- curNodeBucketIndex: n,
- curNodePointerIndex: r
- };
- };
- Deque.prototype.clear = function() {
- this.k = [ [] ];
- this.O = 1;
- this.l = this.L = this.t = 0;
- this._ = this.p = this.S >> 1;
- };
- Deque.prototype.front = function() {
- return this.k[this.l][this._];
- };
- Deque.prototype.back = function() {
- return this.k[this.L][this.p];
- };
- Deque.prototype.begin = function() {
- return new u(0, this.size, this.getElementByPos, this.setElementByPos);
- };
- Deque.prototype.end = function() {
- return new u(this.t, this.size, this.getElementByPos, this.setElementByPos);
- };
- Deque.prototype.rBegin = function() {
- return new u(this.t - 1, this.size, this.getElementByPos, this.setElementByPos, 1);
- };
- Deque.prototype.rEnd = function() {
- return new u(-1, this.size, this.getElementByPos, this.setElementByPos, 1);
- };
- Deque.prototype.pushBack = function(t) {
- if (this.t) {
- if (this.p < this.S - 1) {
- this.p += 1;
- } else if (this.L < this.O - 1) {
- this.L += 1;
- this.p = 0;
- } else {
- this.L = 0;
- this.p = 0;
- }
- if (this.L === this.l && this.p === this._) this.I();
- }
- this.t += 1;
- this.k[this.L][this.p] = t;
- };
- Deque.prototype.popBack = function() {
- if (!this.t) return;
- this.k[this.L][this.p] = undefined;
- if (this.t !== 1) {
- if (this.p > 0) {
- this.p -= 1;
- } else if (this.L > 0) {
- this.L -= 1;
- this.p = this.S - 1;
- } else {
- this.L = this.O - 1;
- this.p = this.S - 1;
- }
- }
- this.t -= 1;
- };
- Deque.prototype.pushFront = function(t) {
- if (this.t) {
- if (this._ > 0) {
- this._ -= 1;
- } else if (this.l > 0) {
- this.l -= 1;
- this._ = this.S - 1;
- } else {
- this.l = this.O - 1;
- this._ = this.S - 1;
- }
- if (this.l === this.L && this._ === this.p) this.I();
- }
- this.t += 1;
- this.k[this.l][this._] = t;
- };
- Deque.prototype.popFront = function() {
- if (!this.t) return;
- this.k[this.l][this._] = undefined;
- if (this.t !== 1) {
- if (this._ < this.S - 1) {
- this._ += 1;
- } else if (this.l < this.O - 1) {
- this.l += 1;
- this._ = 0;
- } else {
- this.l = 0;
- this._ = 0;
- }
- }
- this.t -= 1;
- };
- Deque.prototype.forEach = function(t) {
- for (var i = 0; i < this.t; ++i) {
- t(this.getElementByPos(i), i);
- }
- };
- Deque.prototype.getElementByPos = function(t) {
- var i = this.g(t), e = i.curNodeBucketIndex, r = i.curNodePointerIndex;
- return this.k[e][r];
- };
- Deque.prototype.setElementByPos = function(t, i) {
- var e = this.g(t), r = e.curNodeBucketIndex, n = e.curNodePointerIndex;
- this.k[r][n] = i;
- };
- Deque.prototype.insert = function(t, i, e) {
- if (e === void 0) {
- e = 1;
- }
- if (t === 0) {
- while (e--) this.pushFront(i);
- } else if (t === this.t) {
- while (e--) this.pushBack(i);
- } else {
- var r = [];
- for (var n = t; n < this.t; ++n) {
- r.push(this.getElementByPos(n));
- }
- this.cut(t - 1);
- for (var n = 0; n < e; ++n) this.pushBack(i);
- for (var n = 0; n < r.length; ++n) this.pushBack(r[n]);
- }
- };
- Deque.prototype.cut = function(t) {
- if (t < 0) {
- this.clear();
- return;
- }
- var i = this.g(t), e = i.curNodeBucketIndex, r = i.curNodePointerIndex;
- this.L = e;
- this.p = r;
- this.t = t + 1;
- };
- Deque.prototype.eraseElementByPos = function(t) {
- var i = this;
- if (t === 0) this.popFront(); else if (t === this.t - 1) this.popBack(); else {
- var e = [];
- for (var r = t + 1; r < this.t; ++r) {
- e.push(this.getElementByPos(r));
- }
- this.cut(t);
- this.popBack();
- e.forEach((function(t) {
- return i.pushBack(t);
- }));
- }
- };
- Deque.prototype.eraseElementByValue = function(t) {
- if (!this.t) return;
- var i = [];
- for (var e = 0; e < this.t; ++e) {
- var r = this.getElementByPos(e);
- if (r !== t) i.push(r);
- }
- var n = i.length;
- for (var e = 0; e < n; ++e) this.setElementByPos(e, i[e]);
- this.cut(n - 1);
- };
- Deque.prototype.eraseElementByIterator = function(t) {
- var i = t.h;
- this.eraseElementByPos(i);
- t = t.next();
- return t;
- };
- Deque.prototype.find = function(t) {
- for (var i = 0; i < this.t; ++i) {
- if (this.getElementByPos(i) === t) {
- return new u(i, this.size, this.getElementByPos, this.setElementByPos);
- }
- }
- return this.end();
- };
- Deque.prototype.reverse = function() {
- var t = 0;
- var i = this.t - 1;
- while (t < i) {
- var e = this.getElementByPos(t);
- this.setElementByPos(t, this.getElementByPos(i));
- this.setElementByPos(i, e);
- t += 1;
- i -= 1;
- }
- };
- Deque.prototype.unique = function() {
- if (this.t <= 1) return;
- var t = 1;
- var i = this.getElementByPos(0);
- for (var e = 1; e < this.t; ++e) {
- var r = this.getElementByPos(e);
- if (r !== i) {
- i = r;
- this.setElementByPos(t++, r);
- }
- }
- while (this.t > t) this.popBack();
- };
- Deque.prototype.sort = function(t) {
- var i = [];
- for (var e = 0; e < this.t; ++e) {
- i.push(this.getElementByPos(e));
- }
- i.sort(t);
- for (var e = 0; e < this.t; ++e) this.setElementByPos(e, i[e]);
- };
- Deque.prototype.shrinkToFit = function() {
- if (!this.t) return;
- var t = [];
- this.forEach((function(i) {
- return t.push(i);
- }));
- this.O = Math.max(Math.ceil(this.t / this.S), 1);
- this.t = this.l = this.L = this._ = this.p = 0;
- this.k = [];
- for (var i = 0; i < this.O; ++i) {
- this.k.push(new Array(this.S));
- }
- for (var i = 0; i < t.length; ++i) this.pushBack(t[i]);
- };
- Deque.prototype[Symbol.iterator] = function() {
- return function() {
- var t;
- return __generator(this, (function(i) {
- switch (i.label) {
- case 0:
- t = 0;
- i.label = 1;
- case 1:
- if (!(t < this.t)) return [ 3, 4 ];
- return [ 4, this.getElementByPos(t) ];
- case 2:
- i.sent();
- i.label = 3;
- case 3:
- ++t;
- return [ 3, 1 ];
- case 4:
- return [ 2 ];
- }
- }));
- }.bind(this)();
- };
- return Deque;
- }(s);
- var a = function(t) {
- __extends(Queue, t);
- function Queue(i) {
- if (i === void 0) {
- i = [];
- }
- var e = t.call(this) || this;
- e.T = new f(i);
- e.t = e.T.size();
- return e;
- }
- Queue.prototype.clear = function() {
- this.T.clear();
- this.t = 0;
- };
- Queue.prototype.push = function(t) {
- this.T.pushBack(t);
- this.t += 1;
- };
- Queue.prototype.pop = function() {
- this.T.popFront();
- if (this.t) this.t -= 1;
- };
- Queue.prototype.front = function() {
- return this.T.front();
- };
- return Queue;
- }(e);
- var o = function(t) {
- __extends(PriorityQueue, t);
- function PriorityQueue(i, e, r) {
- if (i === void 0) {
- i = [];
- }
- if (e === void 0) {
- e = function(t, i) {
- if (t > i) return -1;
- if (t < i) return 1;
- return 0;
- };
- }
- if (r === void 0) {
- r = true;
- }
- var n = t.call(this) || this;
- n.M = e;
- if (Array.isArray(i)) {
- n.q = r ? __spreadArray([], __read(i), false) : i;
- } else {
- n.q = [];
- i.forEach((function(t) {
- return n.q.push(t);
- }));
- }
- n.t = n.q.length;
- var s = n.t >> 1;
- for (var h = n.t - 1 >> 1; h >= 0; --h) {
- n.D(h, s);
- }
- return n;
- }
- PriorityQueue.prototype.m = function(t) {
- var i = this.q[t];
- while (t > 0) {
- var e = t - 1 >> 1;
- var r = this.q[e];
- if (this.M(r, i) <= 0) break;
- this.q[t] = r;
- t = e;
- }
- this.q[t] = i;
- };
- PriorityQueue.prototype.D = function(t, i) {
- var e = this.q[t];
- while (t < i) {
- var r = t << 1 | 1;
- var n = r + 1;
- var s = this.q[r];
- if (n < this.t && this.M(s, this.q[n]) > 0) {
- r = n;
- s = this.q[n];
- }
- if (this.M(s, e) >= 0) break;
- this.q[t] = s;
- t = r;
- }
- this.q[t] = e;
- };
- PriorityQueue.prototype.clear = function() {
- this.t = 0;
- this.q.length = 0;
- };
- PriorityQueue.prototype.push = function(t) {
- this.q.push(t);
- this.m(this.t);
- this.t += 1;
- };
- PriorityQueue.prototype.pop = function() {
- if (!this.t) return;
- var t = this.q.pop();
- this.t -= 1;
- if (this.t) {
- this.q[0] = t;
- this.D(0, this.t >> 1);
- }
- };
- PriorityQueue.prototype.top = function() {
- return this.q[0];
- };
- PriorityQueue.prototype.find = function(t) {
- return this.q.indexOf(t) >= 0;
- };
- PriorityQueue.prototype.remove = function(t) {
- var i = this.q.indexOf(t);
- if (i < 0) return false;
- if (i === 0) {
- this.pop();
- } else if (i === this.t - 1) {
- this.q.pop();
- this.t -= 1;
- } else {
- this.q.splice(i, 1, this.q.pop());
- this.t -= 1;
- this.m(i);
- this.D(i, this.t >> 1);
- }
- return true;
- };
- PriorityQueue.prototype.updateItem = function(t) {
- var i = this.q.indexOf(t);
- if (i < 0) return false;
- this.m(i);
- this.D(i, this.t >> 1);
- return true;
- };
- PriorityQueue.prototype.toArray = function() {
- return __spreadArray([], __read(this.q), false);
- };
- return PriorityQueue;
- }(e);
- var c = function(t) {
- __extends(VectorIterator, t);
- function VectorIterator() {
- return t !== null && t.apply(this, arguments) || this;
- }
- VectorIterator.prototype.copy = function() {
- return new VectorIterator(this.h, this.u, this.o, this.v, this.iteratorType);
- };
- return VectorIterator;
- }(h);
- var v = function(t) {
- __extends(Vector, t);
- function Vector(i, e) {
- if (i === void 0) {
- i = [];
- }
- if (e === void 0) {
- e = true;
- }
- var r = t.call(this) || this;
- if (Array.isArray(i)) {
- r.C = e ? __spreadArray([], __read(i), false) : i;
- r.t = i.length;
- } else {
- r.C = [];
- i.forEach((function(t) {
- return r.pushBack(t);
- }));
- }
- r.size = r.size.bind(r);
- r.getElementByPos = r.getElementByPos.bind(r);
- r.setElementByPos = r.setElementByPos.bind(r);
- return r;
- }
- Vector.prototype.clear = function() {
- this.t = 0;
- this.C.length = 0;
- };
- Vector.prototype.begin = function() {
- return new c(0, this.size, this.getElementByPos, this.setElementByPos);
- };
- Vector.prototype.end = function() {
- return new c(this.t, this.size, this.getElementByPos, this.setElementByPos);
- };
- Vector.prototype.rBegin = function() {
- return new c(this.t - 1, this.size, this.getElementByPos, this.setElementByPos, 1);
- };
- Vector.prototype.rEnd = function() {
- return new c(-1, this.size, this.getElementByPos, this.setElementByPos, 1);
- };
- Vector.prototype.front = function() {
- return this.C[0];
- };
- Vector.prototype.back = function() {
- return this.C[this.t - 1];
- };
- Vector.prototype.forEach = function(t) {
- for (var i = 0; i < this.t; ++i) {
- t(this.C[i], i);
- }
- };
- Vector.prototype.getElementByPos = function(t) {
- return this.C[t];
- };
- Vector.prototype.eraseElementByPos = function(t) {
- this.C.splice(t, 1);
- this.t -= 1;
- };
- Vector.prototype.eraseElementByValue = function(t) {
- var i = 0;
- for (var e = 0; e < this.t; ++e) {
- if (this.C[e] !== t) {
- this.C[i++] = this.C[e];
- }
- }
- this.t = this.C.length = i;
- };
- Vector.prototype.eraseElementByIterator = function(t) {
- var i = t.h;
- t = t.next();
- this.eraseElementByPos(i);
- return t;
- };
- Vector.prototype.pushBack = function(t) {
- this.C.push(t);
- this.t += 1;
- };
- Vector.prototype.popBack = function() {
- if (!this.t) return;
- this.C.pop();
- this.t -= 1;
- };
- Vector.prototype.setElementByPos = function(t, i) {
- this.C[t] = i;
- };
- Vector.prototype.insert = function(t, i, e) {
- var r;
- if (e === void 0) {
- e = 1;
- }
- (r = this.C).splice.apply(r, __spreadArray([ t, 0 ], __read(new Array(e).fill(i)), false));
- this.t += e;
- };
- Vector.prototype.find = function(t) {
- for (var i = 0; i < this.t; ++i) {
- if (this.C[i] === t) {
- return new c(i, this.size, this.getElementByPos, this.getElementByPos);
- }
- }
- return this.end();
- };
- Vector.prototype.reverse = function() {
- this.C.reverse();
- };
- Vector.prototype.unique = function() {
- var t = 1;
- for (var i = 1; i < this.t; ++i) {
- if (this.C[i] !== this.C[i - 1]) {
- this.C[t++] = this.C[i];
- }
- }
- this.t = this.C.length = t;
- };
- Vector.prototype.sort = function(t) {
- this.C.sort(t);
- };
- Vector.prototype[Symbol.iterator] = function() {
- return function() {
- return __generator(this, (function(t) {
- switch (t.label) {
- case 0:
- return [ 5, __values(this.C) ];
- case 1:
- return [ 2, t.sent() ];
- }
- }));
- }.bind(this)();
- };
- return Vector;
- }(s);
- var d = function() {
- function LinkNode(t) {
- this.R = undefined;
- this.V = undefined;
- this.H = undefined;
- this.R = t;
- }
- return LinkNode;
- }();
- var l = function(t) {
- __extends(LinkListIterator, t);
- function LinkListIterator(i, e, r) {
- var n = t.call(this, r) || this;
- n.h = i;
- n.N = e;
- if (n.iteratorType === 0) {
- n.pre = function() {
- if (this.h.V === this.N) {
- throw new RangeError("LinkList iterator access denied!");
- }
- this.h = this.h.V;
- return this;
- };
- n.next = function() {
- if (this.h === this.N) {
- throw new RangeError("LinkList iterator access denied!");
- }
- this.h = this.h.H;
- return this;
- };
- } else {
- n.pre = function() {
- if (this.h.H === this.N) {
- throw new RangeError("LinkList iterator access denied!");
- }
- this.h = this.h.H;
- return this;
- };
- n.next = function() {
- if (this.h === this.N) {
- throw new RangeError("LinkList iterator access denied!");
- }
- this.h = this.h.V;
- return this;
- };
- }
- return n;
- }
- Object.defineProperty(LinkListIterator.prototype, "pointer", {
- get: function() {
- if (this.h === this.N) {
- throw new RangeError("LinkList iterator access denied!");
- }
- return this.h.R;
- },
- set: function(t) {
- if (this.h === this.N) {
- throw new RangeError("LinkList iterator access denied!");
- }
- this.h.R = t;
- },
- enumerable: false,
- configurable: true
- });
- LinkListIterator.prototype.equals = function(t) {
- return this.h === t.h;
- };
- LinkListIterator.prototype.copy = function() {
- return new LinkListIterator(this.h, this.N, this.iteratorType);
- };
- return LinkListIterator;
- }(i);
- var w = function(t) {
- __extends(LinkList, t);
- function LinkList(i) {
- if (i === void 0) {
- i = [];
- }
- var e = t.call(this) || this;
- e.N = new d;
- e.j = undefined;
- e.P = undefined;
- i.forEach((function(t) {
- return e.pushBack(t);
- }));
- return e;
- }
- LinkList.prototype.clear = function() {
- this.t = 0;
- this.j = this.P = undefined;
- this.N.V = this.N.H = undefined;
- };
- LinkList.prototype.begin = function() {
- return new l(this.j || this.N, this.N);
- };
- LinkList.prototype.end = function() {
- return new l(this.N, this.N);
- };
- LinkList.prototype.rBegin = function() {
- return new l(this.P || this.N, this.N, 1);
- };
- LinkList.prototype.rEnd = function() {
- return new l(this.N, this.N, 1);
- };
- LinkList.prototype.front = function() {
- return this.j ? this.j.R : undefined;
- };
- LinkList.prototype.back = function() {
- return this.P ? this.P.R : undefined;
- };
- LinkList.prototype.forEach = function(t) {
- if (!this.t) return;
- var i = this.j;
- var e = 0;
- while (i !== this.N) {
- t(i.R, e++);
- i = i.H;
- }
- };
- LinkList.prototype.getElementByPos = function(t) {
- var i = this.j;
- while (t--) {
- i = i.H;
- }
- return i.R;
- };
- LinkList.prototype.eraseElementByPos = function(t) {
- if (t === 0) this.popFront(); else if (t === this.t - 1) this.popBack(); else {
- var i = this.j;
- while (t--) {
- i = i.H;
- }
- i = i;
- var e = i.V;
- var r = i.H;
- r.V = e;
- e.H = r;
- this.t -= 1;
- }
- };
- LinkList.prototype.eraseElementByValue = function(t) {
- while (this.j && this.j.R === t) this.popFront();
- while (this.P && this.P.R === t) this.popBack();
- if (!this.j) return;
- var i = this.j;
- while (i !== this.N) {
- if (i.R === t) {
- var e = i.V;
- var r = i.H;
- r.V = e;
- e.H = r;
- this.t -= 1;
- }
- i = i.H;
- }
- };
- LinkList.prototype.eraseElementByIterator = function(t) {
- var i = t.h;
- if (i === this.N) {
- throw new RangeError("Invalid iterator");
- }
- t = t.next();
- if (this.j === i) this.popFront(); else if (this.P === i) this.popBack(); else {
- var e = i.V;
- var r = i.H;
- r.V = e;
- e.H = r;
- this.t -= 1;
- }
- return t;
- };
- LinkList.prototype.pushBack = function(t) {
- this.t += 1;
- var i = new d(t);
- if (!this.P) {
- this.j = this.P = i;
- this.N.H = this.j;
- this.j.V = this.N;
- } else {
- this.P.H = i;
- i.V = this.P;
- this.P = i;
- }
- this.P.H = this.N;
- this.N.V = this.P;
- };
- LinkList.prototype.popBack = function() {
- if (!this.P) return;
- this.t -= 1;
- if (this.j === this.P) {
- this.j = this.P = undefined;
- this.N.H = undefined;
- } else {
- this.P = this.P.V;
- this.P.H = this.N;
- }
- this.N.V = this.P;
- };
- LinkList.prototype.setElementByPos = function(t, i) {
- var e = this.j;
- while (t--) {
- e = e.H;
- }
- e.R = i;
- };
- LinkList.prototype.insert = function(t, i, e) {
- if (e === void 0) {
- e = 1;
- }
- if (e <= 0) return;
- if (t === 0) {
- while (e--) this.pushFront(i);
- } else if (t === this.t) {
- while (e--) this.pushBack(i);
- } else {
- var r = this.j;
- for (var n = 1; n < t; ++n) {
- r = r.H;
- }
- var s = r.H;
- this.t += e;
- while (e--) {
- r.H = new d(i);
- r.H.V = r;
- r = r.H;
- }
- r.H = s;
- s.V = r;
- }
- };
- LinkList.prototype.find = function(t) {
- if (!this.j) return this.end();
- var i = this.j;
- while (i !== this.N) {
- if (i.R === t) {
- return new l(i, this.N);
- }
- i = i.H;
- }
- return this.end();
- };
- LinkList.prototype.reverse = function() {
- if (this.t <= 1) return;
- var t = this.j;
- var i = this.P;
- var e = 0;
- while (e << 1 < this.t) {
- var r = t.R;
- t.R = i.R;
- i.R = r;
- t = t.H;
- i = i.V;
- e += 1;
- }
- };
- LinkList.prototype.unique = function() {
- if (this.t <= 1) return;
- var t = this.j;
- while (t !== this.N) {
- var i = t;
- while (i.H && i.R === i.H.R) {
- i = i.H;
- this.t -= 1;
- }
- t.H = i.H;
- t.H.V = t;
- t = t.H;
- }
- };
- LinkList.prototype.sort = function(t) {
- if (this.t <= 1) return;
- var i = [];
- this.forEach((function(t) {
- return i.push(t);
- }));
- i.sort(t);
- var e = this.j;
- i.forEach((function(t) {
- e.R = t;
- e = e.H;
- }));
- };
- LinkList.prototype.pushFront = function(t) {
- this.t += 1;
- var i = new d(t);
- if (!this.j) {
- this.j = this.P = i;
- this.P.H = this.N;
- this.N.V = this.P;
- } else {
- i.H = this.j;
- this.j.V = i;
- this.j = i;
- }
- this.N.H = this.j;
- this.j.V = this.N;
- };
- LinkList.prototype.popFront = function() {
- if (!this.j) return;
- this.t -= 1;
- if (this.j === this.P) {
- this.j = this.P = undefined;
- this.N.V = this.P;
- } else {
- this.j = this.j.H;
- this.j.V = this.N;
- }
- this.N.H = this.j;
- };
- LinkList.prototype.merge = function(t) {
- var i = this;
- if (!this.j) {
- t.forEach((function(t) {
- return i.pushBack(t);
- }));
- return;
- }
- var e = this.j;
- t.forEach((function(t) {
- while (e && e !== i.N && e.R <= t) {
- e = e.H;
- }
- if (e === i.N) {
- i.pushBack(t);
- e = i.P;
- } else if (e === i.j) {
- i.pushFront(t);
- e = i.j;
- } else {
- i.t += 1;
- var r = e.V;
- r.H = new d(t);
- r.H.V = r;
- r.H.H = e;
- e.V = r.H;
- }
- }));
- };
- LinkList.prototype[Symbol.iterator] = function() {
- return function() {
- var t;
- return __generator(this, (function(i) {
- switch (i.label) {
- case 0:
- if (!this.j) return [ 2 ];
- t = this.j;
- i.label = 1;
- case 1:
- if (!(t !== this.N)) return [ 3, 3 ];
- return [ 4, t.R ];
- case 2:
- i.sent();
- t = t.H;
- return [ 3, 1 ];
- case 3:
- return [ 2 ];
- }
- }));
- }.bind(this)();
- };
- return LinkList;
- }(s);
- var _ = function() {
- function TreeNode(t, i) {
- this.A = 1;
- this.B = undefined;
- this.R = undefined;
- this.G = undefined;
- this.J = undefined;
- this.F = undefined;
- this.B = t;
- this.R = i;
- }
- TreeNode.prototype.pre = function() {
- var t = this;
- if (t.A === 1 && t.F.F === t) {
- t = t.J;
- } else if (t.G) {
- t = t.G;
- while (t.J) {
- t = t.J;
- }
- } else {
- var i = t.F;
- while (i.G === t) {
- t = i;
- i = t.F;
- }
- t = i;
- }
- return t;
- };
- TreeNode.prototype.next = function() {
- var t = this;
- if (t.J) {
- t = t.J;
- while (t.G) {
- t = t.G;
- }
- return t;
- } else {
- var i = t.F;
- while (i.J === t) {
- t = i;
- i = t.F;
- }
- if (t.J !== i) {
- return i;
- } else return t;
- }
- };
- TreeNode.prototype.rotateLeft = function() {
- var t = this.F;
- var i = this.J;
- var e = i.G;
- if (t.F === this) t.F = i; else if (t.G === this) t.G = i; else t.J = i;
- i.F = t;
- i.G = this;
- this.F = i;
- this.J = e;
- if (e) e.F = this;
- return i;
- };
- TreeNode.prototype.rotateRight = function() {
- var t = this.F;
- var i = this.G;
- var e = i.J;
- if (t.F === this) t.F = i; else if (t.G === this) t.G = i; else t.J = i;
- i.F = t;
- i.J = this;
- this.F = i;
- this.G = e;
- if (e) e.F = this;
- return i;
- };
- return TreeNode;
- }();
- var y = function(t) {
- __extends(TreeNodeEnableIndex, t);
- function TreeNodeEnableIndex() {
- var i = t !== null && t.apply(this, arguments) || this;
- i.G = undefined;
- i.J = undefined;
- i.F = undefined;
- i.K = 1;
- return i;
- }
- TreeNodeEnableIndex.prototype.rotateLeft = function() {
- var i = t.prototype.rotateLeft.call(this);
- this.recount();
- i.recount();
- return i;
- };
- TreeNodeEnableIndex.prototype.rotateRight = function() {
- var i = t.prototype.rotateRight.call(this);
- this.recount();
- i.recount();
- return i;
- };
- TreeNodeEnableIndex.prototype.recount = function() {
- this.K = 1;
- if (this.G) this.K += this.G.K;
- if (this.J) this.K += this.J.K;
- };
- return TreeNodeEnableIndex;
- }(_);
- var L = function(t) {
- __extends(TreeContainer, t);
- function TreeContainer(i, e) {
- if (i === void 0) {
- i = function(t, i) {
- if (t < i) return -1;
- if (t > i) return 1;
- return 0;
- };
- }
- if (e === void 0) {
- e = false;
- }
- var r = t.call(this) || this;
- r.U = undefined;
- r.W = function(t, i) {
- if (t === undefined) return false;
- var e = r.W(t.G, i);
- if (e) return true;
- if (i(t)) return true;
- return r.W(t.J, i);
- };
- r.M = i;
- if (e) {
- r.X = y;
- r.Y = function(t, i, e) {
- var r = this.Z(t, i, e);
- if (r) {
- var n = r.F;
- while (n !== this.N) {
- n.K += 1;
- n = n.F;
- }
- var s = this.$(r);
- if (s) {
- var h = s, u = h.parentNode, f = h.grandParent, a = h.curNode;
- u.recount();
- f.recount();
- a.recount();
- }
- }
- };
- r.tt = function(t) {
- var i = this.it(t);
- while (i !== this.N) {
- i.K -= 1;
- i = i.F;
- }
- };
- } else {
- r.X = _;
- r.Y = function(t, i, e) {
- var r = this.Z(t, i, e);
- if (r) this.$(r);
- };
- r.tt = r.it;
- }
- r.N = new r.X;
- return r;
- }
- TreeContainer.prototype.et = function(t, i) {
- var e;
- while (t) {
- var r = this.M(t.B, i);
- if (r < 0) {
- t = t.J;
- } else if (r > 0) {
- e = t;
- t = t.G;
- } else return t;
- }
- return e === undefined ? this.N : e;
- };
- TreeContainer.prototype.rt = function(t, i) {
- var e;
- while (t) {
- var r = this.M(t.B, i);
- if (r <= 0) {
- t = t.J;
- } else {
- e = t;
- t = t.G;
- }
- }
- return e === undefined ? this.N : e;
- };
- TreeContainer.prototype.nt = function(t, i) {
- var e;
- while (t) {
- var r = this.M(t.B, i);
- if (r < 0) {
- e = t;
- t = t.J;
- } else if (r > 0) {
- t = t.G;
- } else return t;
- }
- return e === undefined ? this.N : e;
- };
- TreeContainer.prototype.st = function(t, i) {
- var e;
- while (t) {
- var r = this.M(t.B, i);
- if (r < 0) {
- e = t;
- t = t.J;
- } else {
- t = t.G;
- }
- }
- return e === undefined ? this.N : e;
- };
- TreeContainer.prototype.ht = function(t) {
- while (true) {
- var i = t.F;
- if (i === this.N) return;
- if (t.A === 1) {
- t.A = 0;
- return;
- }
- if (t === i.G) {
- var e = i.J;
- if (e.A === 1) {
- e.A = 0;
- i.A = 1;
- if (i === this.U) {
- this.U = i.rotateLeft();
- } else i.rotateLeft();
- } else {
- if (e.J && e.J.A === 1) {
- e.A = i.A;
- i.A = 0;
- e.J.A = 0;
- if (i === this.U) {
- this.U = i.rotateLeft();
- } else i.rotateLeft();
- return;
- } else if (e.G && e.G.A === 1) {
- e.A = 1;
- e.G.A = 0;
- e.rotateRight();
- } else {
- e.A = 1;
- t = i;
- }
- }
- } else {
- var e = i.G;
- if (e.A === 1) {
- e.A = 0;
- i.A = 1;
- if (i === this.U) {
- this.U = i.rotateRight();
- } else i.rotateRight();
- } else {
- if (e.G && e.G.A === 1) {
- e.A = i.A;
- i.A = 0;
- e.G.A = 0;
- if (i === this.U) {
- this.U = i.rotateRight();
- } else i.rotateRight();
- return;
- } else if (e.J && e.J.A === 1) {
- e.A = 1;
- e.J.A = 0;
- e.rotateLeft();
- } else {
- e.A = 1;
- t = i;
- }
- }
- }
- }
- };
- TreeContainer.prototype.it = function(t) {
- var i, e;
- if (this.t === 1) {
- this.clear();
- return this.N;
- }
- var r = t;
- while (r.G || r.J) {
- if (r.J) {
- r = r.J;
- while (r.G) r = r.G;
- } else {
- r = r.G;
- }
- i = __read([ r.B, t.B ], 2), t.B = i[0], r.B = i[1];
- e = __read([ r.R, t.R ], 2), t.R = e[0], r.R = e[1];
- t = r;
- }
- if (this.N.G === r) {
- this.N.G = r.F;
- } else if (this.N.J === r) {
- this.N.J = r.F;
- }
- this.ht(r);
- var n = r.F;
- if (r === n.G) {
- n.G = undefined;
- } else n.J = undefined;
- this.t -= 1;
- this.U.A = 0;
- return n;
- };
- TreeContainer.prototype.$ = function(t) {
- while (true) {
- var i = t.F;
- if (i.A === 0) return;
- var e = i.F;
- if (i === e.G) {
- var r = e.J;
- if (r && r.A === 1) {
- r.A = i.A = 0;
- if (e === this.U) return;
- e.A = 1;
- t = e;
- continue;
- } else if (t === i.J) {
- t.A = 0;
- if (t.G) t.G.F = i;
- if (t.J) t.J.F = e;
- i.J = t.G;
- e.G = t.J;
- t.G = i;
- t.J = e;
- if (e === this.U) {
- this.U = t;
- this.N.F = t;
- } else {
- var n = e.F;
- if (n.G === e) {
- n.G = t;
- } else n.J = t;
- }
- t.F = e.F;
- i.F = t;
- e.F = t;
- e.A = 1;
- return {
- parentNode: i,
- grandParent: e,
- curNode: t
- };
- } else {
- i.A = 0;
- if (e === this.U) {
- this.U = e.rotateRight();
- } else e.rotateRight();
- e.A = 1;
- }
- } else {
- var r = e.G;
- if (r && r.A === 1) {
- r.A = i.A = 0;
- if (e === this.U) return;
- e.A = 1;
- t = e;
- continue;
- } else if (t === i.G) {
- t.A = 0;
- if (t.G) t.G.F = e;
- if (t.J) t.J.F = i;
- e.J = t.G;
- i.G = t.J;
- t.G = e;
- t.J = i;
- if (e === this.U) {
- this.U = t;
- this.N.F = t;
- } else {
- var n = e.F;
- if (n.G === e) {
- n.G = t;
- } else n.J = t;
- }
- t.F = e.F;
- i.F = t;
- e.F = t;
- e.A = 1;
- return {
- parentNode: i,
- grandParent: e,
- curNode: t
- };
- } else {
- i.A = 0;
- if (e === this.U) {
- this.U = e.rotateLeft();
- } else e.rotateLeft();
- e.A = 1;
- }
- }
- return;
- }
- };
- TreeContainer.prototype.Z = function(t, i, e) {
- if (this.U === undefined) {
- this.t += 1;
- this.U = new this.X(t, i);
- this.U.A = 0;
- this.U.F = this.N;
- this.N.F = this.U;
- this.N.G = this.U;
- this.N.J = this.U;
- return;
- }
- var r;
- var n = this.N.G;
- var s = this.M(n.B, t);
- if (s === 0) {
- n.R = i;
- return;
- } else if (s > 0) {
- n.G = new this.X(t, i);
- n.G.F = n;
- r = n.G;
- this.N.G = r;
- } else {
- var h = this.N.J;
- var u = this.M(h.B, t);
- if (u === 0) {
- h.R = i;
- return;
- } else if (u < 0) {
- h.J = new this.X(t, i);
- h.J.F = h;
- r = h.J;
- this.N.J = r;
- } else {
- if (e !== undefined) {
- var f = e.h;
- if (f !== this.N) {
- var a = this.M(f.B, t);
- if (a === 0) {
- f.R = i;
- return;
- } else if (a > 0) {
- var o = f.pre();
- var c = this.M(o.B, t);
- if (c === 0) {
- o.R = i;
- return;
- } else if (c < 0) {
- r = new this.X(t, i);
- if (o.J === undefined) {
- o.J = r;
- r.F = o;
- } else {
- f.G = r;
- r.F = f;
- }
- }
- }
- }
- }
- if (r === undefined) {
- r = this.U;
- while (true) {
- var v = this.M(r.B, t);
- if (v > 0) {
- if (r.G === undefined) {
- r.G = new this.X(t, i);
- r.G.F = r;
- r = r.G;
- break;
- }
- r = r.G;
- } else if (v < 0) {
- if (r.J === undefined) {
- r.J = new this.X(t, i);
- r.J.F = r;
- r = r.J;
- break;
- }
- r = r.J;
- } else {
- r.R = i;
- return;
- }
- }
- }
- }
- }
- this.t += 1;
- return r;
- };
- TreeContainer.prototype.clear = function() {
- this.t = 0;
- this.U = undefined;
- this.N.F = undefined;
- this.N.G = this.N.J = undefined;
- };
- TreeContainer.prototype.updateKeyByIterator = function(t, i) {
- var e = t.h;
- if (e === this.N) {
- throw new TypeError("Invalid iterator!");
- }
- if (this.t === 1) {
- e.B = i;
- return true;
- }
- if (e === this.N.G) {
- if (this.M(e.next().B, i) > 0) {
- e.B = i;
- return true;
- }
- return false;
- }
- if (e === this.N.J) {
- if (this.M(e.pre().B, i) < 0) {
- e.B = i;
- return true;
- }
- return false;
- }
- var r = e.pre().B;
- if (this.M(r, i) >= 0) return false;
- var n = e.next().B;
- if (this.M(n, i) <= 0) return false;
- e.B = i;
- return true;
- };
- TreeContainer.prototype.eraseElementByPos = function(t) {
- var i = this;
- var e = 0;
- this.W(this.U, (function(r) {
- if (t === e) {
- i.tt(r);
- return true;
- }
- e += 1;
- return false;
- }));
- };
- TreeContainer.prototype.ut = function(t, i) {
- while (t) {
- var e = this.M(t.B, i);
- if (e < 0) {
- t = t.J;
- } else if (e > 0) {
- t = t.G;
- } else return t;
- }
- return t;
- };
- TreeContainer.prototype.eraseElementByKey = function(t) {
- if (!this.t) return;
- var i = this.ut(this.U, t);
- if (i === undefined) return;
- this.tt(i);
- };
- TreeContainer.prototype.eraseElementByIterator = function(t) {
- var i = t.h;
- if (i === this.N) {
- throw new RangeError("Invalid iterator");
- }
- if (i.J === undefined) {
- t = t.next();
- }
- this.tt(i);
- return t;
- };
- TreeContainer.prototype.getHeight = function() {
- if (!this.t) return 0;
- var traversal = function(t) {
- if (!t) return 0;
- return Math.max(traversal(t.G), traversal(t.J)) + 1;
- };
- return traversal(this.U);
- };
- return TreeContainer;
- }(r);
- var p = function(t) {
- __extends(TreeIterator, t);
- function TreeIterator(i, e, r) {
- var n = t.call(this, r) || this;
- n.h = i;
- n.N = e;
- if (n.iteratorType === 0) {
- n.pre = function() {
- if (this.h === this.N.G) {
- throw new RangeError("Tree iterator access denied!");
- }
- this.h = this.h.pre();
- return this;
- };
- n.next = function() {
- if (this.h === this.N) {
- throw new RangeError("Tree iterator access denied!");
- }
- this.h = this.h.next();
- return this;
- };
- } else {
- n.pre = function() {
- if (this.h === this.N.J) {
- throw new RangeError("Tree iterator access denied!");
- }
- this.h = this.h.next();
- return this;
- };
- n.next = function() {
- if (this.h === this.N) {
- throw new RangeError("Tree iterator access denied!");
- }
- this.h = this.h.pre();
- return this;
- };
- }
- return n;
- }
- Object.defineProperty(TreeIterator.prototype, "index", {
- get: function() {
- var t = this.h;
- var i = this.N.F;
- if (t === this.N) {
- if (i) {
- return i.K - 1;
- }
- return 0;
- }
- var e = 0;
- if (t.G) {
- e += t.G.K;
- }
- while (t !== i) {
- var r = t.F;
- if (t === r.J) {
- e += 1;
- if (r.G) {
- e += r.G.K;
- }
- }
- t = r;
- }
- return e;
- },
- enumerable: false,
- configurable: true
- });
- TreeIterator.prototype.equals = function(t) {
- return this.h === t.h;
- };
- return TreeIterator;
- }(i);
- var O = function(t) {
- __extends(OrderedSetIterator, t);
- function OrderedSetIterator() {
- return t !== null && t.apply(this, arguments) || this;
- }
- Object.defineProperty(OrderedSetIterator.prototype, "pointer", {
- get: function() {
- if (this.h === this.N) {
- throw new RangeError("OrderedSet iterator access denied!");
- }
- return this.h.B;
- },
- enumerable: false,
- configurable: true
- });
- OrderedSetIterator.prototype.copy = function() {
- return new OrderedSetIterator(this.h, this.N, this.iteratorType);
- };
- return OrderedSetIterator;
- }(p);
- var b = function(t) {
- __extends(OrderedSet, t);
- function OrderedSet(i, e, r) {
- if (i === void 0) {
- i = [];
- }
- var n = t.call(this, e, r) || this;
- n.ft = function(t) {
- return __generator(this, (function(i) {
- switch (i.label) {
- case 0:
- if (t === undefined) return [ 2 ];
- return [ 5, __values(this.ft(t.G)) ];
- case 1:
- i.sent();
- return [ 4, t.B ];
- case 2:
- i.sent();
- return [ 5, __values(this.ft(t.J)) ];
- case 3:
- i.sent();
- return [ 2 ];
- }
- }));
- };
- i.forEach((function(t) {
- return n.insert(t);
- }));
- return n;
- }
- OrderedSet.prototype.begin = function() {
- return new O(this.N.G || this.N, this.N);
- };
- OrderedSet.prototype.end = function() {
- return new O(this.N, this.N);
- };
- OrderedSet.prototype.rBegin = function() {
- return new O(this.N.J || this.N, this.N, 1);
- };
- OrderedSet.prototype.rEnd = function() {
- return new O(this.N, this.N, 1);
- };
- OrderedSet.prototype.front = function() {
- return this.N.G ? this.N.G.B : undefined;
- };
- OrderedSet.prototype.back = function() {
- return this.N.J ? this.N.J.B : undefined;
- };
- OrderedSet.prototype.forEach = function(t) {
- var i, e;
- var r = 0;
- try {
- for (var n = __values(this), s = n.next(); !s.done; s = n.next()) {
- var h = s.value;
- t(h, r++);
- }
- } catch (t) {
- i = {
- error: t
- };
- } finally {
- try {
- if (s && !s.done && (e = n.return)) e.call(n);
- } finally {
- if (i) throw i.error;
- }
- }
- };
- OrderedSet.prototype.getElementByPos = function(t) {
- var i, e;
- var r;
- var n = 0;
- try {
- for (var s = __values(this), h = s.next(); !h.done; h = s.next()) {
- var u = h.value;
- if (n === t) {
- r = u;
- break;
- }
- n += 1;
- }
- } catch (t) {
- i = {
- error: t
- };
- } finally {
- try {
- if (h && !h.done && (e = s.return)) e.call(s);
- } finally {
- if (i) throw i.error;
- }
- }
- return r;
- };
- OrderedSet.prototype.insert = function(t, i) {
- this.Y(t, undefined, i);
- };
- OrderedSet.prototype.find = function(t) {
- var i = this.ut(this.U, t);
- if (i !== undefined) {
- return new O(i, this.N);
- }
- return this.end();
- };
- OrderedSet.prototype.lowerBound = function(t) {
- var i = this.et(this.U, t);
- return new O(i, this.N);
- };
- OrderedSet.prototype.upperBound = function(t) {
- var i = this.rt(this.U, t);
- return new O(i, this.N);
- };
- OrderedSet.prototype.reverseLowerBound = function(t) {
- var i = this.nt(this.U, t);
- return new O(i, this.N);
- };
- OrderedSet.prototype.reverseUpperBound = function(t) {
- var i = this.st(this.U, t);
- return new O(i, this.N);
- };
- OrderedSet.prototype.union = function(t) {
- var i = this;
- t.forEach((function(t) {
- return i.insert(t);
- }));
- };
- OrderedSet.prototype[Symbol.iterator] = function() {
- return this.ft(this.U);
- };
- return OrderedSet;
- }(L);
- var k = function(t) {
- __extends(OrderedMapIterator, t);
- function OrderedMapIterator() {
- return t !== null && t.apply(this, arguments) || this;
- }
- Object.defineProperty(OrderedMapIterator.prototype, "pointer", {
- get: function() {
- var t = this;
- if (this.h === this.N) {
- throw new RangeError("OrderedMap iterator access denied");
- }
- return new Proxy([], {
- get: function(i, e) {
- if (e === "0") return t.h.B; else if (e === "1") return t.h.R;
- },
- set: function(i, e, r) {
- if (e !== "1") {
- throw new TypeError("props must be 1");
- }
- t.h.R = r;
- return true;
- }
- });
- },
- enumerable: false,
- configurable: true
- });
- OrderedMapIterator.prototype.copy = function() {
- return new OrderedMapIterator(this.h, this.N, this.iteratorType);
- };
- return OrderedMapIterator;
- }(p);
- var S = function(t) {
- __extends(OrderedMap, t);
- function OrderedMap(i, e, r) {
- if (i === void 0) {
- i = [];
- }
- var n = t.call(this, e, r) || this;
- n.ft = function(t) {
- return __generator(this, (function(i) {
- switch (i.label) {
- case 0:
- if (t === undefined) return [ 2 ];
- return [ 5, __values(this.ft(t.G)) ];
- case 1:
- i.sent();
- return [ 4, [ t.B, t.R ] ];
- case 2:
- i.sent();
- return [ 5, __values(this.ft(t.J)) ];
- case 3:
- i.sent();
- return [ 2 ];
- }
- }));
- };
- i.forEach((function(t) {
- var i = __read(t, 2), e = i[0], r = i[1];
- return n.setElement(e, r);
- }));
- return n;
- }
- OrderedMap.prototype.begin = function() {
- return new k(this.N.G || this.N, this.N);
- };
- OrderedMap.prototype.end = function() {
- return new k(this.N, this.N);
- };
- OrderedMap.prototype.rBegin = function() {
- return new k(this.N.J || this.N, this.N, 1);
- };
- OrderedMap.prototype.rEnd = function() {
- return new k(this.N, this.N, 1);
- };
- OrderedMap.prototype.front = function() {
- if (!this.t) return undefined;
- var t = this.N.G;
- return [ t.B, t.R ];
- };
- OrderedMap.prototype.back = function() {
- if (!this.t) return undefined;
- var t = this.N.J;
- return [ t.B, t.R ];
- };
- OrderedMap.prototype.forEach = function(t) {
- var i, e;
- var r = 0;
- try {
- for (var n = __values(this), s = n.next(); !s.done; s = n.next()) {
- var h = s.value;
- t(h, r++);
- }
- } catch (t) {
- i = {
- error: t
- };
- } finally {
- try {
- if (s && !s.done && (e = n.return)) e.call(n);
- } finally {
- if (i) throw i.error;
- }
- }
- };
- OrderedMap.prototype.lowerBound = function(t) {
- var i = this.et(this.U, t);
- return new k(i, this.N);
- };
- OrderedMap.prototype.upperBound = function(t) {
- var i = this.rt(this.U, t);
- return new k(i, this.N);
- };
- OrderedMap.prototype.reverseLowerBound = function(t) {
- var i = this.nt(this.U, t);
- return new k(i, this.N);
- };
- OrderedMap.prototype.reverseUpperBound = function(t) {
- var i = this.st(this.U, t);
- return new k(i, this.N);
- };
- OrderedMap.prototype.setElement = function(t, i, e) {
- this.Y(t, i, e);
- };
- OrderedMap.prototype.find = function(t) {
- var i = this.ut(this.U, t);
- if (i !== undefined) {
- return new k(i, this.N);
- }
- return this.end();
- };
- OrderedMap.prototype.getElementByKey = function(t) {
- var i = this.ut(this.U, t);
- return i ? i.R : undefined;
- };
- OrderedMap.prototype.getElementByPos = function(t) {
- var i, e;
- var r;
- var n = 0;
- try {
- for (var s = __values(this), h = s.next(); !h.done; h = s.next()) {
- var u = h.value;
- if (n === t) {
- r = u;
- break;
- }
- n += 1;
- }
- } catch (t) {
- i = {
- error: t
- };
- } finally {
- try {
- if (h && !h.done && (e = s.return)) e.call(s);
- } finally {
- if (i) throw i.error;
- }
- }
- return r;
- };
- OrderedMap.prototype.union = function(t) {
- var i = this;
- t.forEach((function(t) {
- var e = __read(t, 2), r = e[0], n = e[1];
- return i.setElement(r, n);
- }));
- };
- OrderedMap.prototype[Symbol.iterator] = function() {
- return this.ft(this.U);
- };
- return OrderedMap;
- }(L);
- var I = function(t) {
- __extends(HashContainer, t);
- function HashContainer(i, e) {
- if (i === void 0) {
- i = 16;
- }
- if (e === void 0) {
- e = function(t) {
- var i;
- if (typeof t !== "string") {
- i = JSON.stringify(t);
- } else i = t;
- var e = 0;
- var r = i.length;
- for (var n = 0; n < r; n++) {
- var s = i.charCodeAt(n);
- e = (e << 5) - e + s;
- e |= 0;
- }
- return e >>> 0;
- };
- }
- var r = t.call(this) || this;
- if (i < 16 || (i & i - 1) !== 0) {
- throw new RangeError("InitBucketNum range error");
- }
- r.O = r.ot = i;
- r.ct = e;
- return r;
- }
- HashContainer.prototype.clear = function() {
- this.t = 0;
- this.O = this.ot;
- this.vt = [];
- };
- return HashContainer;
- }(e);
- var g = function(t) {
- __extends(HashSet, t);
- function HashSet(i, e, r) {
- if (i === void 0) {
- i = [];
- }
- var n = t.call(this, e, r) || this;
- n.vt = [];
- i.forEach((function(t) {
- return n.insert(t);
- }));
- return n;
- }
- HashSet.prototype.I = function() {
- var t = this;
- if (this.O >= 1073741824) return;
- var i = [];
- var e = this.O;
- this.O <<= 1;
- var r = Object.keys(this.vt);
- var n = r.length;
- var _loop_1 = function(n) {
- var h = parseInt(r[n]);
- var u = s.vt[h];
- var f = u.size();
- if (f === 0) return "continue";
- if (f === 1) {
- var a = u.front();
- i[s.ct(a) & s.O - 1] = new v([ a ], false);
- return "continue";
- }
- var o = [];
- var c = [];
- u.forEach((function(i) {
- var r = t.ct(i);
- if ((r & e) === 0) {
- o.push(i);
- } else c.push(i);
- }));
- if (u instanceof b) {
- if (o.length > 6) {
- i[h] = new b(o);
- } else {
- i[h] = new v(o, false);
- }
- if (c.length > 6) {
- i[h + e] = new b(c);
- } else {
- i[h + e] = new v(c, false);
- }
- } else {
- i[h] = new v(o, false);
- i[h + e] = new v(c, false);
- }
- };
- var s = this;
- for (var h = 0; h < n; ++h) {
- _loop_1(h);
- }
- this.vt = i;
- };
- HashSet.prototype.forEach = function(t) {
- var i = Object.values(this.vt);
- var e = i.length;
- var r = 0;
- for (var n = 0; n < e; ++n) {
- i[n].forEach((function(i) {
- return t(i, r++);
- }));
- }
- };
- HashSet.prototype.insert = function(t) {
- var i = this.ct(t) & this.O - 1;
- var e = this.vt[i];
- if (!e) {
- this.vt[i] = new v([ t ], false);
- this.t += 1;
- } else {
- var r = e.size();
- if (e instanceof v) {
- if (!e.find(t).equals(e.end())) return;
- e.pushBack(t);
- if (r + 1 >= 8) {
- if (this.O <= 64) {
- this.t += 1;
- this.I();
- return;
- }
- this.vt[i] = new b(e);
- }
- this.t += 1;
- } else {
- e.insert(t);
- var n = e.size();
- this.t += n - r;
- }
- }
- if (this.t > this.O * .75) {
- this.I();
- }
- };
- HashSet.prototype.eraseElementByKey = function(t) {
- var i = this.ct(t) & this.O - 1;
- var e = this.vt[i];
- if (!e) return;
- var r = e.size();
- if (r === 0) return;
- if (e instanceof v) {
- e.eraseElementByValue(t);
- var n = e.size();
- this.t += n - r;
- } else {
- e.eraseElementByKey(t);
- var n = e.size();
- this.t += n - r;
- if (n <= 6) {
- this.vt[i] = new v(e);
- }
- }
- };
- HashSet.prototype.find = function(t) {
- var i = this.ct(t) & this.O - 1;
- var e = this.vt[i];
- if (!e) return false;
- return !e.find(t).equals(e.end());
- };
- HashSet.prototype[Symbol.iterator] = function() {
- return function() {
- var t, i, e, r, n, s, h, u;
- var f, a;
- return __generator(this, (function(o) {
- switch (o.label) {
- case 0:
- t = Object.values(this.vt);
- i = t.length;
- e = 0;
- o.label = 1;
- case 1:
- if (!(e < i)) return [ 3, 10 ];
- r = t[e];
- o.label = 2;
- case 2:
- o.trys.push([ 2, 7, 8, 9 ]);
- n = (f = void 0, __values(r)), s = n.next();
- o.label = 3;
- case 3:
- if (!!s.done) return [ 3, 6 ];
- h = s.value;
- return [ 4, h ];
- case 4:
- o.sent();
- o.label = 5;
- case 5:
- s = n.next();
- return [ 3, 3 ];
- case 6:
- return [ 3, 9 ];
- case 7:
- u = o.sent();
- f = {
- error: u
- };
- return [ 3, 9 ];
- case 8:
- try {
- if (s && !s.done && (a = n.return)) a.call(n);
- } finally {
- if (f) throw f.error;
- }
- return [ 7 ];
- case 9:
- ++e;
- return [ 3, 1 ];
- case 10:
- return [ 2 ];
- }
- }));
- }.bind(this)();
- };
- return HashSet;
- }(I);
- var T = function(t) {
- __extends(HashMap, t);
- function HashMap(i, e, r) {
- if (i === void 0) {
- i = [];
- }
- var n = t.call(this, e, r) || this;
- n.vt = [];
- i.forEach((function(t) {
- return n.setElement(t[0], t[1]);
- }));
- return n;
- }
- HashMap.prototype.I = function() {
- var t = this;
- if (this.O >= 1073741824) return;
- var i = [];
- var e = this.O;
- this.O <<= 1;
- var r = Object.keys(this.vt);
- var n = r.length;
- var _loop_1 = function(n) {
- var h = parseInt(r[n]);
- var u = s.vt[h];
- var f = u.size();
- if (f === 0) return "continue";
- if (f === 1) {
- var a = u.front();
- i[s.ct(a[0]) & s.O - 1] = new v([ a ], false);
- return "continue";
- }
- var o = [];
- var c = [];
- u.forEach((function(i) {
- var r = t.ct(i[0]);
- if ((r & e) === 0) {
- o.push(i);
- } else c.push(i);
- }));
- if (u instanceof S) {
- if (o.length > 6) {
- i[h] = new S(o);
- } else {
- i[h] = new v(o, false);
- }
- if (c.length > 6) {
- i[h + e] = new S(c);
- } else {
- i[h + e] = new v(c, false);
- }
- } else {
- i[h] = new v(o, false);
- i[h + e] = new v(c, false);
- }
- };
- var s = this;
- for (var h = 0; h < n; ++h) {
- _loop_1(h);
- }
- this.vt = i;
- };
- HashMap.prototype.forEach = function(t) {
- var i = Object.values(this.vt);
- var e = i.length;
- var r = 0;
- for (var n = 0; n < e; ++n) {
- i[n].forEach((function(i) {
- return t(i, r++);
- }));
- }
- };
- HashMap.prototype.setElement = function(t, i) {
- var e, r;
- var n = this.ct(t) & this.O - 1;
- var s = this.vt[n];
- if (!s) {
- this.t += 1;
- this.vt[n] = new v([ [ t, i ] ], false);
- } else {
- var h = s.size();
- if (s instanceof v) {
- try {
- for (var u = __values(s), f = u.next(); !f.done; f = u.next()) {
- var a = f.value;
- if (a[0] === t) {
- a[1] = i;
- return;
- }
- }
- } catch (t) {
- e = {
- error: t
- };
- } finally {
- try {
- if (f && !f.done && (r = u.return)) r.call(u);
- } finally {
- if (e) throw e.error;
- }
- }
- s.pushBack([ t, i ]);
- if (h + 1 >= 8) {
- if (this.O <= 64) {
- this.t += 1;
- this.I();
- return;
- }
- this.vt[n] = new S(this.vt[n]);
- }
- this.t += 1;
- } else {
- s.setElement(t, i);
- var o = s.size();
- this.t += o - h;
- }
- }
- if (this.t > this.O * .75) {
- this.I();
- }
- };
- HashMap.prototype.getElementByKey = function(t) {
- var i, e;
- var r = this.ct(t) & this.O - 1;
- var n = this.vt[r];
- if (!n) return undefined;
- if (n instanceof S) {
- return n.getElementByKey(t);
- } else {
- try {
- for (var s = __values(n), h = s.next(); !h.done; h = s.next()) {
- var u = h.value;
- if (u[0] === t) return u[1];
- }
- } catch (t) {
- i = {
- error: t
- };
- } finally {
- try {
- if (h && !h.done && (e = s.return)) e.call(s);
- } finally {
- if (i) throw i.error;
- }
- }
- return undefined;
- }
- };
- HashMap.prototype.eraseElementByKey = function(t) {
- var i, e;
- var r = this.ct(t) & this.O - 1;
- var n = this.vt[r];
- if (!n) return;
- if (n instanceof v) {
- var s = 0;
- try {
- for (var h = __values(n), u = h.next(); !u.done; u = h.next()) {
- var f = u.value;
- if (f[0] === t) {
- n.eraseElementByPos(s);
- this.t -= 1;
- return;
- }
- s += 1;
- }
- } catch (t) {
- i = {
- error: t
- };
- } finally {
- try {
- if (u && !u.done && (e = h.return)) e.call(h);
- } finally {
- if (i) throw i.error;
- }
- }
- } else {
- var a = n.size();
- n.eraseElementByKey(t);
- var o = n.size();
- this.t += o - a;
- if (o <= 6) {
- this.vt[r] = new v(n);
- }
- }
- };
- HashMap.prototype.find = function(t) {
- var i, e;
- var r = this.ct(t) & this.O - 1;
- var n = this.vt[r];
- if (!n) return false;
- if (n instanceof S) {
- return !n.find(t).equals(n.end());
- }
- try {
- for (var s = __values(n), h = s.next(); !h.done; h = s.next()) {
- var u = h.value;
- if (u[0] === t) return true;
- }
- } catch (t) {
- i = {
- error: t
- };
- } finally {
- try {
- if (h && !h.done && (e = s.return)) e.call(s);
- } finally {
- if (i) throw i.error;
- }
- }
- return false;
- };
- HashMap.prototype[Symbol.iterator] = function() {
- return function() {
- var t, i, e, r, n, s, h, u;
- var f, a;
- return __generator(this, (function(o) {
- switch (o.label) {
- case 0:
- t = Object.values(this.vt);
- i = t.length;
- e = 0;
- o.label = 1;
- case 1:
- if (!(e < i)) return [ 3, 10 ];
- r = t[e];
- o.label = 2;
- case 2:
- o.trys.push([ 2, 7, 8, 9 ]);
- n = (f = void 0, __values(r)), s = n.next();
- o.label = 3;
- case 3:
- if (!!s.done) return [ 3, 6 ];
- h = s.value;
- return [ 4, h ];
- case 4:
- o.sent();
- o.label = 5;
- case 5:
- s = n.next();
- return [ 3, 3 ];
- case 6:
- return [ 3, 9 ];
- case 7:
- u = o.sent();
- f = {
- error: u
- };
- return [ 3, 9 ];
- case 8:
- try {
- if (s && !s.done && (a = n.return)) a.call(n);
- } finally {
- if (f) throw f.error;
- }
- return [ 7 ];
- case 9:
- ++e;
- return [ 3, 1 ];
- case 10:
- return [ 2 ];
- }
- }));
- }.bind(this)();
- };
- return HashMap;
- }(I);
- t.Deque = f;
- t.HashMap = T;
- t.HashSet = g;
- t.LinkList = w;
- t.OrderedMap = S;
- t.OrderedSet = b;
- t.PriorityQueue = o;
- t.Queue = a;
- t.Stack = n;
- t.Vector = v;
- Object.defineProperty(t, "dt", {
- value: true
- });
- }));
|