!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define("sdsl",["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 e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])})(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 e(){this.constructor=t}L(t,i),t.prototype=null===i?Object.create(i):(e.prototype=i.prototype,new e)}function a(r,n){var s,o,h,u={label:0,sent:function(){if(1&h[0])throw h[1];return h[1]},trys:[],ops:[]},t={next:i(0),throw:i(1),return:i(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function i(e){return function(t){var i=[e,t];if(s)throw new TypeError("Generator is already executing.");for(;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]=t.length?void 0:t)&&t[r++],done:!t}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(t,i){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,n,s=e.call(t),o=[];try{for(;(void 0===i||0>1,1),e=0;e>1},p.prototype.front=function(){return this.k[this.l][this._]},p.prototype.back=function(){return this.k[this.L][this.p]},p.prototype.begin=function(){return new f(0,this.size,this.getElementByPos,this.setElementByPos)},p.prototype.end=function(){return new f(this.t,this.size,this.getElementByPos,this.setElementByPos)},p.prototype.rBegin=function(){return new f(this.t-1,this.size,this.getElementByPos,this.setElementByPos,1)},p.prototype.rEnd=function(){return new f(-1,this.size,this.getElementByPos,this.setElementByPos,1)},p.prototype.pushBack=function(t){this.t&&(this.pt;)this.popBack()}},p.prototype.sort=function(t){for(var i=[],e=0;e>1)-(i>>1),r._=r.p=r.S-e%r.S>>1,t.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),r}i(l,Z=e),l.prototype.clear=function(){this.T.clear(),this.t=0},l.prototype.push=function(t){this.T.pushBack(t),this.t+=1},l.prototype.pop=function(){this.T.popFront(),this.t&&--this.t},l.prototype.front=function(){return this.T.front()};var Z,$=l;function l(t){void 0===t&&(t=[]);var i=Z.call(this)||this;return i.T=new Y(t),i.t=i.T.size(),i}i(y,Q=e),y.prototype.m=function(t){for(var i=this.q[t];0>1,r=this.q[e];if(this.M(r,i)<=0)break;this.q[t]=r,t=e}this.q[t]=i},y.prototype.D=function(t,i){for(var e=this.q[t];t>1)))},y.prototype.top=function(){return this.q[0]},y.prototype.find=function(t){return 0<=this.q.indexOf(t)},y.prototype.remove=function(t){t=this.q.indexOf(t);return!(t<0)&&(0===t?this.pop():t===this.t-1?(this.q.pop(),--this.t):(this.q.splice(t,1,this.q.pop()),--this.t,this.m(t),this.D(t,this.t>>1)),!0)},y.prototype.updateItem=function(t){t=this.q.indexOf(t);return!(t<0)&&(this.m(t),this.D(t,this.t>>1),!0)},y.prototype.toArray=function(){return h([],o(this.q),!1)};var Q,tt=y;function y(t,i,e){void 0===t&&(t=[]),void 0===i&&(i=function(t,i){return i>1),s=r.t-1>>1;0<=s;--s)r.D(s,n);return r}i(et,it=K),et.prototype.copy=function(){return new et(this.h,this.u,this.o,this.v,this.iteratorType)};var it,v=et;function et(){return null!==it&&it.apply(this,arguments)||this}i(w,rt=s),w.prototype.clear=function(){this.t=0,this.C.length=0},w.prototype.begin=function(){return new v(0,this.size,this.getElementByPos,this.setElementByPos)},w.prototype.end=function(){return new v(this.t,this.size,this.getElementByPos,this.setElementByPos)},w.prototype.rBegin=function(){return new v(this.t-1,this.size,this.getElementByPos,this.setElementByPos,1)},w.prototype.rEnd=function(){return new v(-1,this.size,this.getElementByPos,this.setElementByPos,1)},w.prototype.front=function(){return this.C[0]},w.prototype.back=function(){return this.C[this.t-1]},w.prototype.forEach=function(t){for(var i=0;i>>0});var e=vt.call(this)||this;if(t<16||0!=(t&t-1))throw new RangeError("InitBucketNum range error");return e.O=e.ot=t,e.ct=i,e}i(H,wt=r),H.prototype.I=function(){var s=this;if(!(1073741824<=this.O)){for(var o=[],h=this.O,u=(this.O<<=1,Object.keys(this.vt)),t=u.length,f=this,i=0;i.75*this.O&&this.I()},H.prototype.eraseElementByKey=function(t){var i,e,r=this.ct(t)&this.O-1,n=this.vt[r];!n||0!==(i=n.size())&&(n instanceof d?(n.eraseElementByValue(t),e=n.size(),this.t+=e-i):(n.eraseElementByKey(t),e=n.size(),this.t+=e-i,e<=6&&(this.vt[r]=new d(n))))},H.prototype.find=function(t){var i=this.ct(t)&this.O-1,i=this.vt[i];return!!i&&!i.find(t).equals(i.end())},H.prototype[Symbol.iterator]=function(){return function(){var i,e,r,n,s,o,h,u,f;return a(this,function(t){switch(t.label){case 0:i=Object.values(this.vt),e=i.length,r=0,t.label=1;case 1:if(!(r.75*this.O&&this.I()},U.prototype.getElementByKey=function(t){var i,e,r=this.ct(t)&this.O-1,r=this.vt[r];if(r){if(r instanceof x)return r.getElementByKey(t);try{for(var n=c(r),s=n.next();!s.done;s=n.next()){var o=s.value;if(o[0]===t)return o[1]}}catch(t){i={error:t}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(i)throw i.error}}}},U.prototype.eraseElementByKey=function(t){var i=this.ct(t)&this.O-1,e=this.vt[i];if(e)if(e instanceof d){var r=0;try{for(var n=c(e),s=n.next();!s.done;s=n.next()){if(s.value[0]===t)return e.eraseElementByPos(r),void--this.t;r+=1}}catch(t){h={error:t}}finally{try{s&&!s.done&&(o=n.return)&&o.call(n)}finally{if(h)throw h.error}}}else{var o=e.size(),h=(e.eraseElementByKey(t),e.size());this.t+=h-o,h<=6&&(this.vt[i]=new d(e))}},U.prototype.find=function(t){var i,e,r=this.ct(t)&this.O-1,r=this.vt[r];if(r){if(r instanceof x)return!r.find(t).equals(r.end());try{for(var n=c(r),s=n.next();!s.done;s=n.next())if(s.value[0]===t)return!0}catch(t){i={error:t}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(i)throw i.error}}}return!1},U.prototype[Symbol.iterator]=function(){return function(){var i,e,r,n,s,o,h,u,f;return a(this,function(t){switch(t.label){case 0:i=Object.values(this.vt),e=i.length,r=0,t.label=1;case 1:if(!(r