/*! * js-sdsl v4.4.0 * https://github.com/js-sdsl/js-sdsl * (c) 2021-present ZLY201 * MIT license */ !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 A=function(t,i){return(A=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}A(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}function s(e,n){var s,o,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(s)throw new TypeError("Generator is already executing.");for(;u=f&&i[f=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]=i&&4096>1,e=this.l[r];if(this.v(e,i)<=0)break;this.l[t]=e,t=r}this.l[t]=i},f.prototype._=function(t,i){for(var r=this.l[t];t>1)),t},f.prototype.top=function(){return this.l[0]},f.prototype.find=function(t){return 0<=this.l.indexOf(t)},f.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))},f.prototype.updateItem=function(t){t=this.l.indexOf(t);return!(t<0||(this.p(t),this._(t,this.i>>1),0))},f.prototype.toArray=function(){return u([],h(this.l),!1)};var U,e=f;function f(t,i,r){void 0===t&&(t=[]),void 0===i&&(i=function(t,i){return i>1),o=n.i-1>>1;0<=o;--o)n._(o,s);return n}i(z,J=q);var J,p=z;function z(){return null!==J&&J.apply(this,arguments)||this}function c(){throw new RangeError("Iterator access denied!")}i(Z,W=r),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 W,Y=Z;function Z(t,i){i=W.call(this,i)||this;return i.t=t,0===i.iteratorType?(i.pre=function(){return 0===this.t&&c(),--this.t,this},i.next=function(){return this.t===this.container.size()&&c(),this.t+=1,this}):(i.pre=function(){return this.t===this.container.size()-1&&c(),this.t+=1,this},i.next=function(){return-1===this.t&&c(),--this.t,this}),i}i(Q,$=Y),Q.prototype.copy=function(){return new Q(this.t,this.container,this.iteratorType)};var $,a=Q;function Q(t,i,r){t=$.call(this,t,r)||this;return t.container=i,t}i(l,tt=p),l.prototype.clear=function(){this.i=0,this.I.length=0},l.prototype.begin=function(){return new a(0,this)},l.prototype.end=function(){return new a(this.i,this)},l.prototype.rBegin=function(){return new a(this.i-1,this,1)},l.prototype.rEnd=function(){return new a(-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;rthis.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,u([t,0],h(new Array(r).fill(i)),!1)),this.i+=r,this.i},l.prototype.find=function(t){for(var i=0;i=t.length?void 0:t)&&t[e++],done:!t}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")}(this.I)];case 1:return t.sent(),[2]}})};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?u([],h(t),!1):t,e.i=t.length):(e.I=[],r=e,t.forEach(function(t){r.pushBack(t)})),e}i(v,rt=r),Object.defineProperty(v.prototype,"pointer",{get:function(){return this.t===this.O&&c(),this.t.k},set:function(t){this.t===this.O&&c(),this.t.k=t},enumerable:!1,configurable:!0}),v.prototype.copy=function(){return new v(this.t,this.O,this.container,this.iteratorType)};var rt,y=v;function v(t,i,r,e){e=rt.call(this,e)||this;return e.t=t,e.O=i,e.container=r,0===e.iteratorType?(e.pre=function(){return this.t.S===this.O&&c(),this.t=this.t.S,this},e.next=function(){return this.t===this.O&&c(),this.t=this.t.L,this}):(e.pre=function(){return this.t.L===this.O&&c(),this.t=this.t.L,this},e.next=function(){return this.t===this.O&&c(),this.t=this.t.S,this}),e}i(O,et=p),O.prototype.M=function(t){var i=t.S,r=t.L;(i.L=r).S=i,t===this.H&&(this.H=r),t===this.g&&(this.g=i),--this.i},O.prototype.A=function(t,i){var r=i.L,t={k:t,S:i,L:r};i.L=t,r.S=t,i===this.O&&(this.H=t),r===this.O&&(this.g=t),this.i+=1},O.prototype.clear=function(){this.i=0,this.H=this.g=this.O.S=this.O.L=this.O},O.prototype.begin=function(){return new y(this.H,this.O,this)},O.prototype.end=function(){return new y(this.O,this.O,this)},O.prototype.rBegin=function(){return new y(this.g,this.O,this,1)},O.prototype.rEnd=function(){return new y(this.O,this.O,this,1)},O.prototype.front=function(){return this.H.k},O.prototype.back=function(){return this.g.k},O.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;for(var i=this.H;t--;)i=i.L;return i.k},O.prototype.eraseElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;for(var i=this.H;t--;)i=i.L;return this.M(i),this.i},O.prototype.eraseElementByValue=function(t){for(var i=this.H;i!==this.O;)i.k===t&&this.M(i),i=i.L;return this.i},O.prototype.eraseElementByIterator=function(t){var i=t.t;return i===this.O&&c(),t=t.next(),this.M(i),t},O.prototype.pushBack=function(t){return this.A(t,this.g),this.i},O.prototype.popBack=function(){var t;if(0!==this.i)return t=this.g.k,this.M(this.g),t},O.prototype.pushFront=function(t){return this.A(t,this.O),this.i},O.prototype.popFront=function(){var t;if(0!==this.i)return t=this.H.k,this.M(this.H),t},O.prototype.setElementByPos=function(t,i){if(t<0||t>this.i-1)throw new RangeError;for(var r=this.H;t--;)r=r.L;r.k=i},O.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>1||1,e=0;e=this.D&&(i-=this.D),{curNodeBucketIndex:i,curNodePointerIndex:i=(i=(t+1)%this.V-1)<0?this.V-1:i}},P.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},P.prototype.begin=function(){return new d(0,this)},P.prototype.end=function(){return new d(this.i,this)},P.prototype.rBegin=function(){return new d(this.i-1,this,1)},P.prototype.rEnd=function(){return new d(-1,this,1)},P.prototype.front=function(){if(0!==this.i)return this.m[this.u][this.T]},P.prototype.back=function(){if(0!==this.i)return this.m[this.C][this.q]},P.prototype.pushBack=function(t){return this.i&&(this.qthis.i-1)throw new RangeError;var t=this.R(t),i=t.curNodeBucketIndex,t=t.curNodePointerIndex;return this.m[i][t]},P.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},P.prototype.insert=function(t,i,r){void 0===r&&(r=1);var e=this.i;if(t<0||ethis.i-1)throw new RangeError;if(0===t)this.popFront();else{if(t!==this.i-1)for(var i=this.i-1,r=this.R(t),e=r.curNodeBucketIndex,n=r.curNodePointerIndex,s=t;s>1)-(i>>1),r.T=r.q=r.V-e%r.V>>1,r);return t.forEach(function(t){s.pushBack(t)}),r}w.prototype.S=function(){var t=this;if(1===t.F&&t.B.B===t)t=t.N;else if(t.P)for(t=t.P;t.N;)t=t.N;else{for(var i=t.B;i.P===t;)i=(t=i).B;t=i}return t},w.prototype.L=function(){var t=this;if(t.N){for(t=t.N;t.P;)t=t.P;return t}for(var i=t.B;i.N===t;)i=(t=i).B;return t.N!==i?i:t},w.prototype.J=function(){var t=this.B,i=this.N,r=i.P;return t.B===this?t.B=i:t.P===this?t.P=i:t.N=i,i.B=t,(i.P=this).B=i,(this.N=r)&&(r.B=this),i},w.prototype.K=function(){var t=this.B,i=this.P,r=i.N;return t.B===this?t.B=i:t.P===this?t.P=i:t.N=i,i.B=t,(i.N=this).B=i,(this.P=r)&&(r.B=this),i};var pt=w;function w(t,i,r){void 0===r&&(r=1),this.P=void 0,this.N=void 0,this.B=void 0,this.G=t,this.k=i,this.F=r}i(g,B=pt),g.prototype.J=function(){var t=B.prototype.J.call(this);return this.W(),t.W(),t},g.prototype.K=function(){var t=B.prototype.K.call(this);return this.W(),t.W(),t},g.prototype.W=function(){this.U=1,this.P&&(this.U+=this.P.U),this.N&&(this.U+=this.N.U)};var B,ct=g;function g(){var t=null!==B&&B.apply(this,arguments)||this;return t.U=1,t}i(b,at=q),b.prototype.Z=function(t,i){for(var r=this.O;t;){var e=this.v(t.G,i);if(e<0)t=t.N;else{if(!(0this.i-1)throw new RangeError;t=this.et(t);return this.M(t),this.i},b.prototype.eraseElementByKey=function(t){return 0!==this.i&&(t=this.ht(this.X,t))!==this.O&&(this.M(t),!0)},b.prototype.eraseElementByIterator=function(t){var i=t.t,r=(i===this.O&&c(),void 0===i.N);return 0===t.iteratorType?r&&t.next():r&&void 0!==i.P||t.next(),this.M(i),t},b.prototype.getHeight=function(){return 0===this.i?0:function t(i){return i?Math.max(t(i.P),t(i.N))+1:0}(this.X)};var at,p=b;function b(t,i){void 0===t&&(t=function(t,i){return tthis.i-1)throw new RangeError;return this.et(t).G},k.prototype.find=function(t){t=this.ht(this.X,t);return new m(t,this.O,this)},k.prototype.union=function(t){var i=this;return t.forEach(function(t){i.insert(t)}),this.i},k.prototype[Symbol.iterator]=function(){var i,r,e;return s(this,function(t){switch(t.label){case 0:i=this.i,r=this.et(),e=0,t.label=1;case 1:return ethis.i-1)throw new RangeError;t=this.et(t);return[t.G,t.k]},L.prototype.find=function(t){t=this.ht(this.X,t);return new N(t,this.O,this)},L.prototype.getElementByKey=function(t){return this.ht(this.X,t).k},L.prototype.union=function(t){var i=this;return t.forEach(function(t){i.setElement(t[0],t[1])}),this.i},L.prototype[Symbol.iterator]=function(){var i,r,e,n;return s(this,function(t){switch(t.label){case 0:i=this.i,r=this.et(),e=0,t.label=1;case 1:return ethis.i-1)throw new RangeError;for(var i=this.H;t--;)i=i.L;return this.M(i),this.i};var Et,r=S;function S(){var t=Et.call(this)||this;return t.ut=[],t.ot={},t.HASH_TAG=Symbol("@@HASH_TAG"),Object.setPrototypeOf(t.ot,null),t.O={},t.O.S=t.O.L=t.H=t.g=t.O,t}i(F,kt=p),Object.defineProperty(F.prototype,"pointer",{get:function(){return this.t===this.O&&c(),this.t.G},enumerable:!1,configurable:!0}),F.prototype.copy=function(){return new F(this.t,this.O,this.container,this.iteratorType)};var kt,G=F;function F(t,i,r,e){t=kt.call(this,t,i,e)||this;return t.container=r,t}i(I,Nt=r),I.prototype.begin=function(){return new G(this.H,this.O,this)},I.prototype.end=function(){return new G(this.O,this.O,this)},I.prototype.rBegin=function(){return new G(this.g,this.O,this,1)},I.prototype.rEnd=function(){return new G(this.O,this.O,this,1)},I.prototype.front=function(){return this.H.G},I.prototype.back=function(){return this.g.G},I.prototype.insert=function(t,i){return this.st(t,void 0,i)},I.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;for(var i=this.H;t--;)i=i.L;return i.G},I.prototype.find=function(t,i){t=this.ft(t,i);return new G(t,this.O,this)},I.prototype.forEach=function(t){for(var i=0,r=this.H;r!==this.O;)t(r.G,i++,this),r=r.L},I.prototype[Symbol.iterator]=function(){var i;return s(this,function(t){switch(t.label){case 0:i=this.H,t.label=1;case 1:return i===this.O?[3,3]:[4,i.G];case 2:return t.sent(),i=i.L,[3,1];case 3:return[2]}})};var Nt,q=I;function I(t){void 0===t&&(t=[]);var i=Nt.call(this)||this,r=i;return t.forEach(function(t){r.insert(t)}),i}i(x,Ht=p),Object.defineProperty(x.prototype,"pointer",{get:function(){this.t===this.O&&c();var e=this;return new Proxy([],{get:function(t,i){return"0"===i?e.t.G:"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}),x.prototype.copy=function(){return new x(this.t,this.O,this.container,this.iteratorType)};var Ht,T=x;function x(t,i,r,e){t=Ht.call(this,t,i,e)||this;return t.container=r,t}i(X,Lt=r),X.prototype.begin=function(){return new T(this.H,this.O,this)},X.prototype.end=function(){return new T(this.O,this.O,this)},X.prototype.rBegin=function(){return new T(this.g,this.O,this,1)},X.prototype.rEnd=function(){return new T(this.O,this.O,this,1)},X.prototype.front=function(){if(0!==this.i)return[this.H.G,this.H.k]},X.prototype.back=function(){if(0!==this.i)return[this.g.G,this.g.k]},X.prototype.setElement=function(t,i,r){return this.st(t,i,r)},X.prototype.getElementByKey=function(t,i){return(i=void 0===i?gt(t):i)?void 0!==(i=t[this.HASH_TAG])?this.ut[i].k:void 0:(i=this.ot[t])?i.k:void 0},X.prototype.getElementByPos=function(t){if(t<0||t>this.i-1)throw new RangeError;for(var i=this.H;t--;)i=i.L;return[i.G,i.k]},X.prototype.find=function(t,i){t=this.ft(t,i);return new T(t,this.O,this)},X.prototype.forEach=function(t){for(var i=0,r=this.H;r!==this.O;)t([r.G,r.k],i++,this),r=r.L},X.prototype[Symbol.iterator]=function(){var i;return s(this,function(t){switch(t.label){case 0:i=this.H,t.label=1;case 1:return i===this.O?[3,3]:[4,[i.G,i.k]];case 2:return t.sent(),i=i.L,[3,1];case 3:return[2]}})};var Lt,p=X;function X(t){void 0===t&&(t=[]);var i=Lt.call(this)||this,r=i;return t.forEach(function(t){r.setElement(t[0],t[1])}),i}t.Deque=Y,t.HashMap=p,t.HashSet=q,t.LinkList=nt,t.OrderedMap=yt,t.OrderedSet=Pt,t.PriorityQueue=e,t.Queue=K,t.Stack=M,t.Vector=it,Object.defineProperty(t,"ct",{value:!0})}); //# sourceMappingURL=js-sdsl.min.js.map