!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).sdsl={})}(this,function(t){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function e(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function l(r,i){var n,o,h,s={label:0,sent:function(){if(1&h[0])throw h[1];return h[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(h=2&e[0]?o.return:e[0]?o.throw||((h=o.return)&&h.call(o),0):o.next)&&!(h=h.call(o,e[1])).done)return h;switch(o=0,(e=h?[2&e[0],h.value]:e)[0]){case 0:case 1:h=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,o=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(h=0<(h=s.trys).length&&h[h.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!h||e[1]>h[0]&&e[1]=t.length?void 0:t)&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function f(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),h=[];try{for(;(void 0===e||0>1,1),r=0;r>1},T.prototype.front=function(){return this.map[this.first][this.curFirst]},T.prototype.back=function(){return this.map[this.last][this.curLast]},T.prototype.begin=function(){return new P(0,this.size,this.getElementByPos,this.setElementByPos)},T.prototype.end=function(){return new P(this.length,this.size,this.getElementByPos,this.setElementByPos)},T.prototype.rBegin=function(){return new P(this.length-1,this.size,this.getElementByPos,this.setElementByPos,o.REVERSE)},T.prototype.rEnd=function(){return new P(-1,this.size,this.getElementByPos,this.setElementByPos,o.REVERSE)},T.prototype.pushBack=function(t){this.length&&(this.curLastt;)this.popBack()}},T.prototype.sort=function(t){for(var e=[],r=0;r>1)-(e>>1),i.curFirst=i.curLast=i.bucketSize-r%i.bucketSize>>1,t.forEach(function(t){return i.pushBack(t)}),i.size=i.size.bind(i),i.getElementByPos=i.getElementByPos.bind(i),i.setElementByPos=i.setElementByPos.bind(i),i}var z,S=(e(F,z=n),F.prototype.clear=function(){this.queue.clear(),this.length=0},F.prototype.push=function(t){this.queue.pushBack(t),this.length+=1},F.prototype.pop=function(){this.queue.popFront(),this.length&&--this.length},F.prototype.front=function(){return this.queue.front()},F);function F(t){void 0===t&&(t=[]);var e=z.call(this)||this;return e.queue=new N(t),e.length=e.queue.size(),e}var A,Q=(e(O,A=n),O.prototype.adjust=function(t){var e,r=t<<1|1,i=2+(t<<1);r>1;if(this.cmp(this.priorityQueue[r],t)<=0)break;this.adjust(r),e=r}},O.prototype.pop=function(){if(this.length){var t=this.priorityQueue[this.length-1];--this.length;for(var e=0;e=this.length)break;var n=r;if(i>1;0<=n;--n)for(var o=n,h=o<<1|1;h>>0});var r=dt.call(this)||this;if(t<16||0!=(t&t-1))throw new RangeError("InitBucketNum range error");return r.bucketNum=r.initBucketNum=t,r.hashFunc=e,r}var gt,w=(e(mt,gt=yt),mt.prototype.reAllocate=function(){var o=this;if(!(this.bucketNum>=yt.maxBucketNum)){var h=[],s=this.bucketNum;this.bucketNum<<=1;for(var a=Object.keys(this.hashTable),t=a.length,u=this,e=0;eyt.untreeifyThreshold?h[e]=new ht(i):i.length&&(h[e]=new q(i,!1)),n.length>yt.untreeifyThreshold?h[e+s]=new ht(n):n.length&&(h[e+s]=new q(n,!1))):(i.length>=yt.treeifyThreshold?h[e]=new ht(i):i.length&&(h[e]=new q(i,!1)),n.length>=yt.treeifyThreshold?h[e+s]=new ht(n):n.length&&(h[e+s]=new q(n,!1)))}(e);this.hashTable=h}},mt.prototype.forEach=function(e){for(var t=Object.values(this.hashTable),r=t.length,i=0,n=0;nthis.bucketNum*yt.sigma&&this.reAllocate()},mt.prototype.eraseElementByKey=function(t){var e,r,i=this.hashFunc(t)&this.bucketNum-1,n=this.hashTable[i];!n||0!==(e=n.size())&&(n instanceof q?(n.eraseElementByValue(t),r=n.size(),this.length+=r-e):(n.eraseElementByKey(t),r=n.size(),this.length+=r-e,r<=yt.untreeifyThreshold&&(this.hashTable[i]=new q(n))))},mt.prototype.find=function(t){var e=this.hashFunc(t)&this.bucketNum-1,e=this.hashTable[e];return!!e&&!e.find(t).equals(e.end())},mt.prototype[Symbol.iterator]=function(){return function(){var e,r,i,n,o,h,s,a,u;return l(this,function(t){switch(t.label){case 0:e=Object.values(this.hashTable),r=e.length,i=0,t.label=1;case 1:if(!(i=yt.maxBucketNum)){var h=[],s=this.bucketNum;this.bucketNum<<=1;for(var a=Object.keys(this.hashTable),t=a.length,u=this,e=0;eyt.untreeifyThreshold?h[e]=new ft(i):i.length&&(h[e]=new q(i,!1)),n.length>yt.untreeifyThreshold?h[e+s]=new ft(n):n.length&&(h[e+s]=new q(n,!1))):(i.length>=yt.treeifyThreshold?h[e]=new ft(i):i.length&&(h[e]=new q(i,!1)),n.length>=yt.treeifyThreshold?h[e+s]=new ft(n):n.length&&(h[e+s]=new q(n,!1)))}(e);this.hashTable=h}},bt.prototype.forEach=function(e){for(var t=Object.values(this.hashTable),r=t.length,i=0,n=0;nthis.bucketNum*bt.sigma&&this.reAllocate()},bt.prototype.getElementByKey=function(t){var e,r,i=this.hashFunc(t)&this.bucketNum-1,i=this.hashTable[i];if(i){if(i instanceof ft)return i.getElementByKey(t);try{for(var n=c(i),o=n.next();!o.done;o=n.next()){var h=o.value;if(h[0]===t)return h[1]}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}}},bt.prototype.eraseElementByKey=function(t){var e=this.hashFunc(t)&this.bucketNum-1,r=this.hashTable[e];if(r)if(r instanceof q){var i=0;try{for(var n=c(r),o=n.next();!o.done;o=n.next()){if(o.value[0]===t)return r.eraseElementByPos(i),void--this.length;i+=1}}catch(t){s={error:t}}finally{try{o&&!o.done&&(h=n.return)&&h.call(n)}finally{if(s)throw s.error}}}else{var h=r.size();r.eraseElementByKey(t);var s=r.size();this.length+=s-h,s<=yt.untreeifyThreshold&&(this.hashTable[e]=new q(r))}},bt.prototype.find=function(t){var e,r,i=this.hashFunc(t)&this.bucketNum-1,i=this.hashTable[i];if(!i)return!1;if(i instanceof ft)return!i.find(t).equals(i.end());try{for(var n=c(i),o=n.next();!o.done;o=n.next())if(o.value[0]===t)return!0}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return!1},bt.prototype[Symbol.iterator]=function(){return function(){var e,r,i,n,o,h,s,a,u;return l(this,function(t){switch(t.label){case 0:e=Object.values(this.hashTable),r=e.length,i=0,t.label=1;case 1:if(!(i