UNPKG

grid-engine

Version:

Phaser3 plugin for grid based movement on a 2D game board.

1 lines 307 kB
(()=>{var eT=Object.create;var Go=Object.defineProperty,rT=Object.defineProperties,iT=Object.getOwnPropertyDescriptor,nT=Object.getOwnPropertyDescriptors,oT=Object.getOwnPropertyNames,Qc=Object.getOwnPropertySymbols,sT=Object.getPrototypeOf,Kc=Object.prototype.hasOwnProperty,aT=Object.prototype.propertyIsEnumerable;var Xc=(r,t,e)=>t in r?Go(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,it=(r,t)=>{for(var e in t||(t={}))Kc.call(t,e)&&Xc(r,e,t[e]);if(Qc)for(var e of Qc(t))aT.call(t,e)&&Xc(r,e,t[e]);return r},we=(r,t)=>rT(r,nT(t));var V=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),uT=(r,t)=>{for(var e in t)Go(r,e,{get:t[e],enumerable:!0})},hT=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of oT(t))!Kc.call(r,s)&&s!==e&&Go(r,s,{get:()=>t[s],enumerable:!(i=iT(t,s))||i.enumerable});return r};var Jc=(r,t,e)=>(e=r!=null?eT(sT(r)):{},hT(t||!r||!r.__esModule?Go(e,"default",{value:r,enumerable:!0}):e,r));var Rn=V(kn=>{var OT=function(r,t){return r<t?-1:r>t?1:0},AT=function(r,t){return r<t?1:r>t?-1:0};function IT(r){return function(t,e){return r(e,t)}}function MT(r){return r===2?function(t,e){return t[0]<e[0]?-1:t[0]>e[0]?1:t[1]<e[1]?-1:t[1]>e[1]?1:0}:function(t,e){for(var i=0;i<r;){if(t[i]<e[i])return-1;if(t[i]>e[i])return 1;i++}return 0}}kn.DEFAULT_COMPARATOR=OT;kn.DEFAULT_REVERSE_COMPARATOR=AT;kn.reverseComparator=IT;kn.createTupleComparator=MT});var Sf=V(Lu=>{Lu.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer!="undefined";Lu.SYMBOL_SUPPORT=typeof Symbol!="undefined"});var mt=V((FE,Lf)=>{var _f=Sf(),DT=_f.ARRAY_BUFFER_SUPPORT,kT=_f.SYMBOL_SUPPORT;Lf.exports=function(t,e){var i,s,a,h,c;if(!t)throw new Error("obliterator/forEach: invalid iterable.");if(typeof e!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(t)||DT&&ArrayBuffer.isView(t)||typeof t=="string"||t.toString()==="[object Arguments]"){for(a=0,h=t.length;a<h;a++)e(t[a],a);return}if(typeof t.forEach=="function"){t.forEach(e);return}if(kT&&Symbol.iterator in t&&typeof t.next!="function"&&(t=t[Symbol.iterator]()),typeof t.next=="function"){for(i=t,a=0;c=i.next(),c.done!==!0;)e(c.value,a),a++;return}for(s in t)t.hasOwnProperty(s)&&e(t[s],s)}});var bs=V((zE,kf)=>{var Ef=Rn(),Of=mt(),Af=Ef.DEFAULT_COMPARATOR,RT=Ef.reverseComparator;function ne(r){if(this.clear(),this.comparator=r||Af,typeof this.comparator!="function")throw new Error("mnemonist/FibonacciHeap.constructor: given comparator should be a function.")}ne.prototype.clear=function(){this.root=null,this.min=null,this.size=0};function FT(r){return{item:r,degree:0}}function If(r,t){r.root?(t.right=r.root.right,t.left=r.root,r.root.right.left=t,r.root.right=t):r.root=t}ne.prototype.push=function(r){var t=FT(r);return t.left=t,t.right=t,If(this,t),(!this.min||this.comparator(t.item,this.min.item)<=0)&&(this.min=t),++this.size};ne.prototype.peek=function(){return this.min?this.min.item:void 0};function Mf(r){for(var t=[],e=r,i=!1;!(e===r&&i);)e===r&&(i=!0),t.push(e),e=e.right;return t}function Df(r,t){r.root===t&&(r.root=t.right),t.left.right=t.right,t.right.left=t.left}function zT(r,t){r.child?(t.right=r.child.right,t.left=r.child,r.child.right.left=t,r.child.right=t):r.child=t}function VT(r,t,e){Df(r,t),t.left=t,t.right=t,zT(e,t),e.degree++,t.parent=e}function NT(r){var t=new Array(r.size),e=Mf(r.root),i,s,a,h,c,f;for(i=0,s=e.length;i<s;i++){for(a=e[i],c=a.degree;t[c];)h=t[c],r.comparator(a.item,h.item)>0&&(f=a,a=h,h=f),VT(r,h,a),t[c]=null,c++;t[c]=a}for(i=0;i<r.size;i++)t[i]&&r.comparator(t[i].item,r.min.item)<=0&&(r.min=t[i])}ne.prototype.pop=function(){if(this.size){var r=this.min;if(r.child){var t=Mf(r.child),e,i,s;for(i=0,s=t.length;i<s;i++)e=t[i],If(this,e),delete e.parent}return Df(this,r),r===r.right?(this.min=null,this.root=null):(this.min=r.right,NT(this)),this.size--,r.item}};ne.prototype.inspect=function(){var r={size:this.size};return this.min&&"item"in this.min&&(r.top=this.min.item),Object.defineProperty(r,"constructor",{value:ne,enumerable:!1}),r};typeof Symbol!="undefined"&&(ne.prototype[Symbol.for("nodejs.util.inspect.custom")]=ne.prototype.inspect);function vs(r){if(this.clear(),this.comparator=r||Af,typeof this.comparator!="function")throw new Error("mnemonist/FibonacciHeap.constructor: given comparator should be a function.");this.comparator=RT(this.comparator)}vs.prototype=ne.prototype;ne.from=function(r,t){var e=new ne(t);return Of(r,function(i){e.push(i)}),e};vs.from=function(r,t){var e=new vs(t);return Of(r,function(i){e.push(i)}),e};ne.MinFibonacciHeap=ne;ne.MaxFibonacciHeap=vs;kf.exports=ne});var oe=V(or=>{var jT=Math.pow(2,8)-1,GT=Math.pow(2,16)-1,UT=Math.pow(2,32)-1,BT=Math.pow(2,7)-1,HT=Math.pow(2,15)-1,WT=Math.pow(2,31)-1;or.getPointerArray=function(r){var t=r-1;if(t<=jT)return Uint8Array;if(t<=GT)return Uint16Array;if(t<=UT)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")};or.getSignedPointerArray=function(r){var t=r-1;return t<=BT?Int8Array:t<=HT?Int16Array:t<=WT?Int32Array:Float64Array};or.getNumberType=function(r){return r===(r|0)?Math.sign(r)===-1?r<=127&&r>=-128?Int8Array:r<=32767&&r>=-32768?Int16Array:Int32Array:r<=255?Uint8Array:r<=65535?Uint16Array:Uint32Array:Float64Array};var qT={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};or.getMinimalRepresentation=function(r,t){var e=null,i=0,s,a,h,c,f;for(c=0,f=r.length;c<f;c++)h=t?t(r[c]):r[c],a=or.getNumberType(h),s=qT[a.name],s>i&&(i=s,e=a);return e};or.isTypedArray=function(r){return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView(r)};or.concat=function(){var r=0,t,e,i;for(t=0,i=arguments.length;t<i;t++)r+=arguments[t].length;var s=new arguments[0].constructor(r);for(t=0,e=0;t<i;t++)s.set(arguments[t],e),e+=arguments[t].length;return s};or.indices=function(r){for(var t=or.getPointerArray(r),e=new t(r),i=0;i<r;i++)e[i]=i;return e}});var pe=V(zn=>{var zf=mt(),Vf=oe();function $T(r){return Array.isArray(r)||Vf.isTypedArray(r)}function Eu(r){if(typeof r.length=="number")return r.length;if(typeof r.size=="number")return r.size}function YT(r){var t=Eu(r),e=typeof t=="number"?new Array(t):[],i=0;return zf(r,function(s){e[i++]=s}),e}function QT(r){var t=Eu(r),e=typeof t=="number"?Vf.getPointerArray(t):Array,i=typeof t=="number"?new Array(t):[],s=typeof t=="number"?new e(t):[],a=0;return zf(r,function(h){i[a]=h,s[a]=a++}),[i,s]}zn.isArrayLike=$T;zn.guessLength=Eu;zn.toArray=YT;zn.toArrayWithIndices=QT});var Ls=V((aO,Uf)=>{var Cs=mt(),Nf=Rn(),sr=pe(),_s=Nf.DEFAULT_COMPARATOR,Ou=Nf.reverseComparator;function Au(r,t,e,i){for(var s=t[i],a,h;i>e;){if(a=i-1>>1,h=t[a],r(s,h)<0){t[i]=h,i=a;continue}break}t[i]=s}function Vn(r,t,e){for(var i=t.length,s=e,a=t[e],h=2*e+1,c;h<i;)c=h+1,c<i&&r(t[h],t[c])>=0&&(h=c),t[e]=t[h],e=h,h=2*e+1;t[e]=a,Au(r,t,s,e)}function jf(r,t,e){t.push(e),Au(r,t,0,t.length-1)}function Iu(r,t){var e=t.pop();if(t.length!==0){var i=t[0];return t[0]=e,Vn(r,t,0),i}return e}function Ni(r,t,e){if(t.length===0)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var i=t[0];return t[0]=e,Vn(r,t,0),i}function Gf(r,t,e){var i;return t.length!==0&&r(t[0],e)<0&&(i=t[0],t[0]=e,e=i,Vn(r,t,0)),e}function pi(r,t){for(var e=t.length,i=e>>1,s=i;--s>=0;)Vn(r,t,s)}function Mu(r,t){for(var e=t.length,i=0,s=new Array(e);i<e;)s[i++]=Iu(r,t);return s}function XT(r,t,e){arguments.length===2&&(e=t,t=r,r=_s);var i=Ou(r),s,a,h,c=1/0,f;if(t===1){if(sr.isArrayLike(e)){for(s=0,a=e.length;s<a;s++)h=e[s],(c===1/0||r(h,c)<0)&&(c=h);return f=new e.constructor(1),f[0]=c,f}return Cs(e,function(y){(c===1/0||r(y,c)<0)&&(c=y)}),[c]}if(sr.isArrayLike(e)){if(t>=e.length)return e.slice().sort(r);for(f=e.slice(0,t),pi(i,f),s=t,a=e.length;s<a;s++)i(e[s],f[0])>0&&Ni(i,f,e[s]);return f.sort(r)}var m=sr.guessLength(e);return m!==null&&m<t&&(t=m),f=new Array(t),s=0,Cs(e,function(y){s<t?f[s]=y:(s===t&&pi(i,f),i(y,f[0])>0&&Ni(i,f,y)),s++}),f.length>s&&(f.length=s),f.sort(r)}function KT(r,t,e){arguments.length===2&&(e=t,t=r,r=_s);var i=Ou(r),s,a,h,c=-1/0,f;if(t===1){if(sr.isArrayLike(e)){for(s=0,a=e.length;s<a;s++)h=e[s],(c===-1/0||r(h,c)>0)&&(c=h);return f=new e.constructor(1),f[0]=c,f}return Cs(e,function(y){(c===-1/0||r(y,c)>0)&&(c=y)}),[c]}if(sr.isArrayLike(e)){if(t>=e.length)return e.slice().sort(i);for(f=e.slice(0,t),pi(r,f),s=t,a=e.length;s<a;s++)r(e[s],f[0])>0&&Ni(r,f,e[s]);return f.sort(i)}var m=sr.guessLength(e);return m!==null&&m<t&&(t=m),f=new Array(t),s=0,Cs(e,function(y){s<t?f[s]=y:(s===t&&pi(r,f),r(y,f[0])>0&&Ni(r,f,y)),s++}),f.length>s&&(f.length=s),f.sort(i)}function at(r){if(this.clear(),this.comparator=r||_s,typeof this.comparator!="function")throw new Error("mnemonist/Heap.constructor: given comparator should be a function.")}at.prototype.clear=function(){this.items=[],this.size=0};at.prototype.push=function(r){return jf(this.comparator,this.items,r),++this.size};at.prototype.peek=function(){return this.items[0]};at.prototype.pop=function(){return this.size!==0&&this.size--,Iu(this.comparator,this.items)};at.prototype.replace=function(r){return Ni(this.comparator,this.items,r)};at.prototype.pushpop=function(r){return Gf(this.comparator,this.items,r)};at.prototype.consume=function(){return this.size=0,Mu(this.comparator,this.items)};at.prototype.toArray=function(){return Mu(this.comparator,this.items.slice())};at.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:at,enumerable:!1}),r};typeof Symbol!="undefined"&&(at.prototype[Symbol.for("nodejs.util.inspect.custom")]=at.prototype.inspect);function Ss(r){if(this.clear(),this.comparator=r||_s,typeof this.comparator!="function")throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=Ou(this.comparator)}Ss.prototype=at.prototype;at.from=function(r,t){var e=new at(t),i;return sr.isArrayLike(r)?i=r.slice():i=sr.toArray(r),pi(e.comparator,i),e.items=i,e.size=i.length,e};Ss.from=function(r,t){var e=new Ss(t),i;return sr.isArrayLike(r)?i=r.slice():i=sr.toArray(r),pi(e.comparator,i),e.items=i,e.size=i.length,e};at.siftUp=Vn;at.siftDown=Au;at.push=jf;at.pop=Iu;at.replace=Ni;at.pushpop=Gf;at.heapify=pi;at.consume=Mu;at.nsmallest=XT;at.nlargest=KT;at.MinHeap=at;at.MaxHeap=Ss;Uf.exports=at});var $f=V((uO,qf)=>{var Bf="";function Hf(r,t,e){for(var i=t.length,s=[],a=i,h=-1,c,f=0,m;a--;)h=Math.max(r[t[a]+e],h);for(m=h>>24&&32||h>>16&&24||h>>8&&16||8;f<m;f+=4){for(a=16;a--;)s[a]=[];for(a=i;a--;)s[r[t[a]+e]>>f&15].push(t[a]);for(c=0;c<16;c++)for(h=s[c].length;h--;)t[++a]=s[c][h]}}function JT(r,t,e,i){return r[e]-r[i]||(e%3===2?r[e+1]-r[i+1]||t[e+2]-t[i+2]:t[e+1]-t[i+1])}function Du(r,t){var e=[],i=[],s=2*t/3|0,a=t-s,h=s+1>>1,c=s,f=0,m,y=[],b=[];if(t===1)return[0];for(;c--;)e[c]=(c*3>>1)+1;for(c=3;c--;)Hf(r,e,c);for(f=i[(e[0]/3|0)+(e[0]%3===1?0:h)]=1,c=1;c<s;c++)(r[e[c]]!==r[e[c-1]]||r[e[c]+1]!==r[e[c-1]+1]||r[e[c]+2]!==r[e[c-1]+2])&&f++,i[(e[c]/3|0)+(e[c]%3===1?0:h)]=f;if(f<s)for(i=Du(i,s),c=s;c--;)e[c]=i[c]<h?i[c]*3+1:(i[c]-h)*3+2;for(c=s;c--;)y[e[c]]=c;for(y[t]=-1,y[t+1]=-2,i=t%3===1?[t-1]:[],c=0;c<s;c++)e[c]%3===1&&i.push(e[c]-1);for(Hf(r,i,0),c=0,f=0,m=0;c<s&&f<a;)b[m++]=JT(r,y,e[c],i[f])<0?e[c++]:i[f++];for(;c<s;)b[m++]=e[c++];for(;f<a;)b[m++]=i[f++];return b}function Wf(r){var t=r.length,e=t%3,i=new Array(t+e),s,a;if(typeof r!="string"){var h=Object.create(null);for(a=0;a<t;a++)h[r[a]]||(h[r[a]]=!0);var c=Object.create(null),f=Object.keys(h).sort();for(a=0,s=f.length;a<s;a++)c[f[a]]=a+1;for(a=0;a<t;a++)i[a]=c[r[a]]}else for(a=0;a<t;a++)i[a]=r.charCodeAt(a);for(a=t;a<t+e;a++)i[a]=0;return i}function Br(r){this.hasArbitrarySequence=typeof r!="string",this.string=r,this.length=r.length,this.array=Du(Wf(r),this.length)}Br.prototype.toString=function(){return this.array.join(",")};Br.prototype.toJSON=function(){return this.array};Br.prototype.inspect=function(){for(var r=new Array(this.length),t=0;t<this.length;t++)r[t]=this.string.slice(this.array[t]);return Object.defineProperty(r,"constructor",{value:Br,enumerable:!1}),r};typeof Symbol!="undefined"&&(Br.prototype[Symbol.for("nodejs.util.inspect.custom")]=Br.prototype.inspect);function Hr(r){if(this.hasArbitrarySequence=typeof r[0]!="string",this.size=r.length,this.hasArbitrarySequence){this.text=[];for(var t=0,e=this.size;t<e;t++)this.text.push.apply(this.text,r[t]),t<e-1&&this.text.push(Bf)}else this.text=r.join(Bf);this.firstLength=r[0].length,this.length=this.text.length,this.array=Du(Wf(this.text),this.length)}Hr.prototype.longestCommonSubsequence=function(){var r=this.hasArbitrarySequence?[]:"",t,e,i,s,a;for(e=1;e<this.length;e++)if(s=this.array[e],a=this.array[e-1],!(s<this.firstLength&&a<this.firstLength)&&!(s>this.firstLength&&a>this.firstLength)){for(t=Math.min(this.length-s,this.length-a),i=0;i<t;i++)if(this.text[s+i]!==this.text[a+i]){t=i;break}t>r.length&&(r=this.text.slice(s,s+t))}return r};Hr.prototype.toString=function(){return this.array.join(",")};Hr.prototype.toJSON=function(){return this.array};Hr.prototype.inspect=function(){for(var r=new Array(this.length),t=0;t<this.length;t++)r[t]=this.text.slice(this.array[t]);return Object.defineProperty(r,"constructor",{value:Hr,enumerable:!1}),r};typeof Symbol!="undefined"&&(Hr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Hr.prototype.inspect);Br.GeneralizedSuffixArray=Hr;qf.exports=Br});var Jf=V((hO,Kf)=>{var ZT=mt();function $e(r){this.size=0,this.items=new Map,this.inverse=r}function xe(){this.size=0,this.items=new Map,this.inverse=new $e(this)}function Yf(){this.size=0,this.items.clear(),this.inverse.items.clear()}xe.prototype.clear=Yf;$e.prototype.clear=Yf;function Qf(r,t){if(this.items.has(r)){var e=this.items.get(r);if(e===t)return this;this.inverse.items.delete(e)}if(this.inverse.items.has(t)){var i=this.inverse.items.get(t);if(i===r)return this;this.items.delete(i)}return this.items.set(r,t),this.inverse.items.set(t,r),this.size=this.items.size,this.inverse.size=this.inverse.items.size,this}xe.prototype.set=Qf;$e.prototype.set=Qf;function Xf(r){if(this.items.has(r)){var t=this.items.get(r);return this.items.delete(r),this.inverse.items.delete(t),this.size=this.items.size,this.inverse.size=this.inverse.items.size,!0}return!1}xe.prototype.delete=Xf;$e.prototype.delete=Xf;var tx=["has","get","forEach","keys","values","entries"];tx.forEach(function(r){xe.prototype[r]=$e.prototype[r]=function(){return Map.prototype[r].apply(this.items,arguments)}});typeof Symbol!="undefined"&&(xe.prototype[Symbol.iterator]=xe.prototype.entries,$e.prototype[Symbol.iterator]=$e.prototype.entries);xe.prototype.inspect=function(){var r={left:this.items,right:this.inverse.items};return Object.defineProperty(r,"constructor",{value:xe,enumerable:!1}),r};typeof Symbol!="undefined"&&(xe.prototype[Symbol.for("nodejs.util.inspect.custom")]=xe.prototype.inspect);$e.prototype.inspect=function(){var r={left:this.inverse.items,right:this.items};return Object.defineProperty(r,"constructor",{value:$e,enumerable:!1}),r};typeof Symbol!="undefined"&&($e.prototype[Symbol.for("nodejs.util.inspect.custom")]=$e.prototype.inspect);xe.from=function(r){var t=new xe;return ZT(r,function(e,i){t.set(i,e)}),t};Kf.exports=xe});var jt=V((lO,Zf)=>{function ar(r){if(typeof r!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=r}typeof Symbol!="undefined"&&(ar.prototype[Symbol.iterator]=function(){return this});ar.of=function(){var r=arguments,t=r.length,e=0;return new ar(function(){return e>=t?{done:!0}:{done:!1,value:r[e++]}})};ar.empty=function(){var r=new ar(function(){return{done:!0}});return r};ar.fromSequence=function(r){var t=0,e=r.length;return new ar(function(){return t>=e?{done:!0}:{done:!1,value:r[t++]}})};ar.is=function(r){return r instanceof ar?!0:typeof r=="object"&&r!==null&&typeof r.next=="function"};Zf.exports=ar});var Ru=V(Ye=>{function ep(r){return r|=r>>1,r|=r>>2,r|=r>>4,r|=r>>8,r|=r>>16,r&~(r>>1)}Ye.msb32=ep;function ku(r){return r|=r>>1,r|=r>>2,r|=r>>4,r&~(r>>1)}Ye.msb8=ku;Ye.test=function(r,t){return r>>t&1};Ye.criticalBit8=function(r,t){return ku(r^t)};Ye.criticalBit8Mask=function(r,t){return~ku(r^t)>>>0&255};Ye.testCriticalBit8=function(r,t){return 1+(r|t)>>8};Ye.criticalBit32Mask=function(r,t){return~ep(r^t)>>>0&4294967295};Ye.popcount=function(r){return r-=r>>1&1431655765,r=(r&858993459)+(r>>2&858993459),r=r+(r>>4)&252645135,r+=r>>8,r+=r>>16,r&127};var ji=new Uint8Array(Math.pow(2,8));for(Nn=0,tp=ji.length;Nn<tp;Nn++)ji[Nn]=Ye.popcount(Nn);var Nn,tp;Ye.table8Popcount=function(r){return ji[r&255]+ji[r>>8&255]+ji[r>>16&255]+ji[r>>24&255]}});var op=V((fO,np)=>{var ip=jt(),rp=Ru();function Dt(r){this.length=r,this.clear()}Dt.prototype.clear=function(){this.size=0,this.array=new Uint32Array(Math.ceil(this.length/32))};Dt.prototype.set=function(r,t){var e=r>>5,i=r&31,s=this.array[e],a;return t===0||t===!1?a=this.array[e]&=~(1<<i):a=this.array[e]|=1<<i,a=a>>>0,a>s?this.size++:a<s&&this.size--,this};Dt.prototype.reset=function(r){var t=r>>5,e=r&31,i=this.array[t],s;return s=this.array[t]&=~(1<<e),s<i&&this.size--,this};Dt.prototype.flip=function(r){var t=r>>5,e=r&31,i=this.array[t],s=this.array[t]^=1<<e;return s=s>>>0,s>i?this.size++:s<i&&this.size--,this};Dt.prototype.get=function(r){var t=r>>5,e=r&31;return this.array[t]>>e&1};Dt.prototype.test=function(r){return!!this.get(r)};Dt.prototype.rank=function(r){if(this.size===0)return 0;for(var t=r>>5,e=r&31,i=0,s=0;s<t;s++)i+=rp.table8Popcount(this.array[s]);var a=this.array[t]&(1<<e)-1;return i+=rp.table8Popcount(a),i};Dt.prototype.select=function(r){if(this.size===0||r>=this.length)return-1;for(var t,e=32,i=0,s=0,a=0,h=this.array.length;a<h;a++)if(t=this.array[a],t!==0){a===h-1&&(e=this.length%32||32);for(var c=0;c<e;c++,i++)if(s+=t>>c&1,s===r)return i}};Dt.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=this.length,i,s,a=32,h=0,c=this.array.length;h<c;h++){i=this.array[h],h===c-1&&(a=e%32||32);for(var f=0;f<a;f++)s=i>>f&1,r.call(t,s,h*32+f)}};Dt.prototype.values=function(){var r=this.length,t=!1,e,i,s=this.array,a=s.length,h=0,c=-1,f=32;return new ip(function m(){if(!t){if(h>=a)return{done:!0};h===a-1&&(f=r%32||32),e=s[h++],t=!0,c=-1}return c++,c>=f?(t=!1,m()):(i=e>>c&1,{value:i})})};Dt.prototype.entries=function(){var r=this.length,t=!1,e,i,s=this.array,a,h=s.length,c=0,f=-1,m=32;return new ip(function y(){if(!t){if(c>=h)return{done:!0};c===h-1&&(m=r%32||32),e=s[c++],t=!0,f=-1}return f++,a=~-c*32+f,f>=m?(t=!1,y()):(i=e>>f&1,{value:[a,i]})})};typeof Symbol!="undefined"&&(Dt.prototype[Symbol.iterator]=Dt.prototype.values);Dt.prototype.inspect=function(){var r=new Uint8Array(this.length);return this.forEach(function(t,e){r[e]=t}),Object.defineProperty(r,"constructor",{value:Dt,enumerable:!1}),r};typeof Symbol!="undefined"&&(Dt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Dt.prototype.inspect);Dt.prototype.toJSON=function(){return Array.from(this.array)};np.exports=Dt});var hp=V((pO,up)=>{var ap=jt(),sp=Ru(),ex=function(r){return Math.max(1,Math.ceil(r*1.5))};function rx(r){return new Uint32Array(Math.ceil(r/32))}function dt(r){var t=r||0,e=ex;typeof r=="object"&&(t=r.initialLength||r.initialCapacity||0,e=r.policy||e),this.size=0,this.length=t,this.capacity=Math.ceil(this.length/32)*32,this.policy=e,this.array=rx(this.capacity)}dt.prototype.set=function(r,t){if(this.length<r)throw new Error("BitVector.set: index out of bounds.");var e=r>>5,i=r&31,s=this.array[e],a;return t===0||t===!1?a=this.array[e]&=~(1<<i):a=this.array[e]|=1<<i,a=a>>>0,a>s?this.size++:a<s&&this.size--,this};dt.prototype.reset=function(r){var t=r>>5,e=r&31,i=this.array[t],s;return s=this.array[t]&=~(1<<e),s<i&&this.size--,this};dt.prototype.flip=function(r){var t=r>>5,e=r&31,i=this.array[t],s=this.array[t]^=1<<e;return s=s>>>0,s>i?this.size++:s<i&&this.size--,this};dt.prototype.applyPolicy=function(r){var t=this.policy(r||this.capacity);if(typeof t!="number"||t<0)throw new Error("mnemonist/bit-vector.applyPolicy: policy returned an invalid value (expecting a positive integer).");if(t<=this.capacity)throw new Error("mnemonist/bit-vector.applyPolicy: policy returned a less or equal capacity to allocate.");return Math.ceil(t/32)*32};dt.prototype.reallocate=function(r){var t=r;if(r=Math.ceil(r/32)*32,t<this.length&&(this.length=t),r===this.capacity)return this;var e=this.array,i=r/32;return i===this.array.length?this:(i>this.array.length?(this.array=new Uint32Array(i),this.array.set(e,0)):this.array=e.slice(0,i),this.capacity=r,this)};dt.prototype.grow=function(r){var t;if(typeof r=="number"){if(this.capacity>=r)return this;for(t=this.capacity;t<r;)t=this.applyPolicy(t);return this.reallocate(t),this}return t=this.applyPolicy(),this.reallocate(t),this};dt.prototype.resize=function(r){return r===this.length?this:r<this.length?(this.length=r,this):(this.length=r,this.reallocate(r),this)};dt.prototype.push=function(r){if(this.capacity===this.length&&this.grow(),r===0||r===!1)return++this.length;this.size++;var t=this.length++,e=t>>5,i=t&31;return this.array[e]|=1<<i,this.length};dt.prototype.pop=function(){if(this.length!==0){var r=--this.length,t=r>>5,e=r&31;return this.array[t]>>e&1}};dt.prototype.get=function(r){if(!(this.length<r)){var t=r>>5,e=r&31;return this.array[t]>>e&1}};dt.prototype.test=function(r){return this.length<r?!1:!!this.get(r)};dt.prototype.rank=function(r){if(this.size===0)return 0;for(var t=r>>5,e=r&31,i=0,s=0;s<t;s++)i+=sp.table8Popcount(this.array[s]);var a=this.array[t]&(1<<e)-1;return i+=sp.table8Popcount(a),i};dt.prototype.select=function(r){if(this.size===0||r>=this.length)return-1;for(var t,e=32,i=0,s=0,a=0,h=this.array.length;a<h;a++)if(t=this.array[a],t!==0){a===h-1&&(e=this.length%32||32);for(var c=0;c<e;c++,i++)if(s+=t>>c&1,s===r)return i}};dt.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=this.length,i,s,a=32,h=0,c=this.array.length;h<c;h++){i=this.array[h],h===c-1&&(a=e%32||32);for(var f=0;f<a;f++)s=i>>f&1,r.call(t,s,h*32+f)}};dt.prototype.values=function(){var r=this.length,t=!1,e,i,s=this.array,a=s.length,h=0,c=-1,f=32;return new ap(function m(){if(!t){if(h>=a)return{done:!0};h===a-1&&(f=r%32||32),e=s[h++],t=!0,c=-1}return c++,c>=f?(t=!1,m()):(i=e>>c&1,{value:i})})};dt.prototype.entries=function(){var r=this.length,t=!1,e,i,s=this.array,a,h=s.length,c=0,f=-1,m=32;return new ap(function y(){if(!t){if(c>=h)return{done:!0};c===h-1&&(m=r%32||32),e=s[c++],t=!0,f=-1}return f++,a=~-c*32+f,f>=m?(t=!1,y()):(i=e>>f&1,{value:[a,i]})})};typeof Symbol!="undefined"&&(dt.prototype[Symbol.iterator]=dt.prototype.values);dt.prototype.inspect=function(){var r=new Uint8Array(this.length);return this.forEach(function(t,e){r[e]=t}),Object.defineProperty(r,"constructor",{value:dt,enumerable:!1}),r};typeof Symbol!="undefined"&&(dt.prototype[Symbol.for("nodejs.util.inspect.custom")]=dt.prototype.inspect);dt.prototype.toJSON=function(){return Array.from(this.array.slice(0,(this.length>>5)+1))};up.exports=dt});var cp=V((mO,lp)=>{function mi(r,t){return(r&65535)*t+(((r>>>16)*t&65535)<<16)&4294967295}function ix(r,t){return(r&65535)+(t>>>16)+(((r>>>16)+t&65535)<<16)&4294967295}function Fu(r,t){return r<<t|r>>>32-t}lp.exports=function(t,e){var i=3432918353,s=461845907,a=15,h=13,c=5,f=1801774676,m=t,y,b,_;for(b=0,_=e.length-4;b<=_;b+=4)y=e[b]|e[b+1]<<8|e[b+2]<<16|e[b+3]<<24,y=mi(y,i),y=Fu(y,a),y=mi(y,s),m^=y,m=Fu(m,h),m=mi(m,c),m=ix(m,f);switch(y=0,e.length&3){case 3:y^=e[b+2]<<16;case 2:y^=e[b+1]<<8;case 1:y^=e[b],y=mi(y,i),y=Fu(y,a),y=mi(y,s),m^=y;default:}return m^=e.length,m^=m>>>16,m=mi(m,2246822507),m^=m>>>13,m=mi(m,3266489909),m^=m>>>16,m>>>0}});var dp=V((dO,mp)=>{var nx=cp(),ox=mt(),sx=Math.LN2*Math.LN2,ax={errorRate:.005};function fp(r){var t=new Uint16Array(r.length),e,i;for(e=0,i=r.length;e<i;e++)t[e]=r.charCodeAt(e);return t}function pp(r,t,e){var i=nx(t*4221880213&4294967295,e);return i%(r*8)}function di(r){var t={};if(!r)throw new Error("mnemonist/BloomFilter.constructor: a BloomFilter must be created with a capacity.");if(typeof r=="object"?t=r:t.capacity=r,typeof t.capacity!="number"||t.capacity<=0)throw new Error("mnemonist/BloomFilter.constructor: `capacity` option should be a positive integer.");if(this.capacity=t.capacity,this.errorRate=t.errorRate||ax.errorRate,typeof this.errorRate!="number"||t.errorRate<=0)throw new Error("mnemonist/BloomFilter.constructor: `errorRate` option should be a positive float.");this.clear()}di.prototype.clear=function(){var r=-1/sx*this.capacity*Math.log(this.errorRate),t=r/8|0;this.hashFunctions=t*8/this.capacity*Math.LN2|0,this.data=new Uint8Array(t)};di.prototype.add=function(r){for(var t=fp(r),e=0,i=this.hashFunctions;e<i;e++){var s=pp(this.data.length,e,t),a=1<<(7&s);this.data[s>>3]|=a}return this};di.prototype.test=function(r){for(var t=fp(r),e=0,i=this.hashFunctions;e<i;e++){var s=pp(this.data.length,e,t);if(!(this.data[s>>3]&1<<(7&s)))return!1}return!0};di.prototype.toJSON=function(){return this.data};di.from=function(r,t){if(!t&&(t=r.length||r.size,typeof t!="number"))throw new Error("BloomFilter.from: could not infer the filter's capacity. Try passing it as second argument.");var e=new di(t);return ox(r,function(i){e.add(i)}),e};mp.exports=di});var yp=V((gO,gp)=>{var ux=mt();function Qe(r){if(typeof r!="function")throw new Error("mnemonist/BKTree.constructor: given `distance` should be a function.");this.distance=r,this.clear()}Qe.prototype.add=function(r){if(!this.root)return this.root={item:r,children:{}},this.size++,this;for(var t=this.root,e;e=this.distance(r,t.item),!!t.children[e];)t=t.children[e];return t.children[e]={item:r,children:{}},this.size++,this};Qe.prototype.search=function(r,t){if(!this.root)return[];for(var e=[],i=[this.root],s,a,h,c,f;i.length;)for(s=i.pop(),h=this.distance(t,s.item),h<=r&&e.push({item:s.item,distance:h}),c=h-r,f=h+r+1;c<f;c++)a=s.children[c],a&&i.push(a);return e};Qe.prototype.clear=function(){this.size=0,this.root=null};Qe.prototype.toJSON=function(){return this.root};Qe.prototype.inspect=function(){for(var r=[],t=[this.root],e,i;t.length;)if(e=t.pop(),!!e){r.push(e.item);for(i in e.children)t.push(e.children[i])}return Object.defineProperty(r,"constructor",{value:Qe,enumerable:!1}),r};typeof Symbol!="undefined"&&(Qe.prototype[Symbol.for("nodejs.util.inspect.custom")]=Qe.prototype.inspect);Qe.from=function(r,t){var e=new Qe(t);return ux(r,function(i){e.add(i)}),e};gp.exports=Qe});var Vu=V((yO,bp)=>{var zu=pe(),vp=jt();function Ct(r,t){if(arguments.length<2)throw new Error("mnemonist/fixed-deque: expecting an Array class and a capacity.");if(typeof t!="number"||t<=0)throw new Error("mnemonist/fixed-deque: `capacity` should be a positive number.");this.ArrayClass=r,this.capacity=t,this.items=new r(this.capacity),this.clear()}Ct.prototype.clear=function(){this.start=0,this.size=0};Ct.prototype.push=function(r){if(this.size===this.capacity)throw new Error("mnemonist/fixed-deque.push: deque capacity ("+this.capacity+") exceeded!");var t=this.start+this.size;return t>=this.capacity&&(t-=this.capacity),this.items[t]=r,++this.size};Ct.prototype.unshift=function(r){if(this.size===this.capacity)throw new Error("mnemonist/fixed-deque.unshift: deque capacity ("+this.capacity+") exceeded!");var t=this.start-1;return this.start===0&&(t=this.capacity-1),this.items[t]=r,this.start=t,++this.size};Ct.prototype.pop=function(){if(this.size!==0){this.size--;var r=this.start+this.size;return r>=this.capacity&&(r-=this.capacity),this.items[r]}};Ct.prototype.shift=function(){if(this.size!==0){var r=this.start;return this.size--,this.start++,this.start===this.capacity&&(this.start=0),this.items[r]}};Ct.prototype.peekFirst=function(){if(this.size!==0)return this.items[this.start]};Ct.prototype.peekLast=function(){if(this.size!==0){var r=this.start+this.size-1;return r>=this.capacity&&(r-=this.capacity),this.items[r]}};Ct.prototype.get=function(r){if(!(this.size===0||r>=this.capacity))return r=this.start+r,r>=this.capacity&&(r-=this.capacity),this.items[r]};Ct.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=this.capacity,i=this.size,s=this.start,a=0;a<i;)r.call(t,this.items[s],a,this),s++,a++,s===e&&(s=0)};Ct.prototype.toArray=function(){var r=this.start+this.size;if(r<this.capacity)return this.items.slice(this.start,r);for(var t=new this.ArrayClass(this.size),e=this.capacity,i=this.size,s=this.start,a=0;a<i;)t[a]=this.items[s],s++,a++,s===e&&(s=0);return t};Ct.prototype.values=function(){var r=this.items,t=this.capacity,e=this.size,i=this.start,s=0;return new vp(function(){if(s>=e)return{done:!0};var a=r[i];return i++,s++,i===t&&(i=0),{value:a,done:!1}})};Ct.prototype.entries=function(){var r=this.items,t=this.capacity,e=this.size,i=this.start,s=0;return new vp(function(){if(s>=e)return{done:!0};var a=r[i];return i++,i===t&&(i=0),{value:[s++,a],done:!1}})};typeof Symbol!="undefined"&&(Ct.prototype[Symbol.iterator]=Ct.prototype.values);Ct.prototype.inspect=function(){var r=this.toArray();return r.type=this.ArrayClass.name,r.capacity=this.capacity,Object.defineProperty(r,"constructor",{value:Ct,enumerable:!1}),r};typeof Symbol!="undefined"&&(Ct.prototype[Symbol.for("nodejs.util.inspect.custom")]=Ct.prototype.inspect);Ct.from=function(r,t,e){if(arguments.length<3&&(e=zu.guessLength(r),typeof e!="number"))throw new Error("mnemonist/fixed-deque.from: could not guess iterable length. Please provide desired capacity as last argument.");var i=new Ct(t,e);if(zu.isArrayLike(r)){var s,a;for(s=0,a=r.length;s<a;s++)i.items[s]=r[s];return i.size=a,i}return zu.forEach(r,function(h){i.push(h)}),i};bp.exports=Ct});var Tp=V((vO,Pp)=>{var Nu=pe(),ju=Vu();function Gi(r,t){if(arguments.length<2)throw new Error("mnemonist/circular-buffer: expecting an Array class and a capacity.");if(typeof t!="number"||t<=0)throw new Error("mnemonist/circular-buffer: `capacity` should be a positive number.");this.ArrayClass=r,this.capacity=t,this.items=new r(this.capacity),this.clear()}function wp(r){Gi.prototype[r]=ju.prototype[r]}Object.keys(ju.prototype).forEach(wp);typeof Symbol!="undefined"&&Object.getOwnPropertySymbols(ju.prototype).forEach(wp);Gi.prototype.push=function(r){var t=this.start+this.size;return t>=this.capacity&&(t-=this.capacity),this.items[t]=r,this.size===this.capacity?(t++,t>=this.capacity?this.start=0:this.start=t,this.size):++this.size};Gi.prototype.unshift=function(r){var t=this.start-1;return this.start===0&&(t=this.capacity-1),this.items[t]=r,this.size===this.capacity?(this.start=t,this.size):(this.start=t,++this.size)};Gi.from=function(r,t,e){if(arguments.length<3&&(e=Nu.guessLength(r),typeof e!="number"))throw new Error("mnemonist/circular-buffer.from: could not guess iterable length. Please provide desired capacity as last argument.");var i=new Gi(t,e);if(Nu.isArrayLike(r)){var s,a;for(s=0,a=r.length;s<a;s++)i.items[s]=r[s];return i.size=a,i}return Nu.forEach(r,function(h){i.push(h)}),i};Pp.exports=Gi});var Cp=V((bO,xp)=>{function qt(r){if(typeof r!="function")throw new Error("mnemonist/DefaultMap.constructor: expecting a function.");this.items=new Map,this.factory=r,this.size=0}qt.prototype.clear=function(){this.items.clear(),this.size=0};qt.prototype.get=function(r){var t=this.items.get(r);return typeof t=="undefined"&&(t=this.factory(r,this.size),this.items.set(r,t),this.size++),t};qt.prototype.peek=function(r){return this.items.get(r)};qt.prototype.set=function(r,t){return this.items.set(r,t),this.size=this.items.size,this};qt.prototype.has=function(r){return this.items.has(r)};qt.prototype.delete=function(r){var t=this.items.delete(r);return this.size=this.items.size,t};qt.prototype.forEach=function(r,t){t=arguments.length>1?t:this,this.items.forEach(r,t)};qt.prototype.entries=function(){return this.items.entries()};qt.prototype.keys=function(){return this.items.keys()};qt.prototype.values=function(){return this.items.values()};typeof Symbol!="undefined"&&(qt.prototype[Symbol.iterator]=qt.prototype.entries);qt.prototype.inspect=function(){return this.items};typeof Symbol!="undefined"&&(qt.prototype[Symbol.for("nodejs.util.inspect.custom")]=qt.prototype.inspect);qt.autoIncrement=function(){var r=0;return function(){return r++}};xp.exports=qt});var _p=V((wO,Sp)=>{function ur(r){if(typeof r!="function")throw new Error("mnemonist/DefaultWeakMap.constructor: expecting a function.");this.items=new WeakMap,this.factory=r}ur.prototype.clear=function(){this.items=new WeakMap};ur.prototype.get=function(r){var t=this.items.get(r);return typeof t=="undefined"&&(t=this.factory(r),this.items.set(r,t)),t};ur.prototype.peek=function(r){return this.items.get(r)};ur.prototype.set=function(r,t){return this.items.set(r,t),this};ur.prototype.has=function(r){return this.items.has(r)};ur.prototype.delete=function(r){return this.items.delete(r)};ur.prototype.inspect=function(){return this.items};typeof Symbol!="undefined"&&(ur.prototype[Symbol.for("nodejs.util.inspect.custom")]=ur.prototype.inspect);Sp.exports=ur});var Ep=V((PO,Lp)=>{var Gu=oe();function hr(r){var t=Gu.getPointerArray(r),e=Gu.getPointerArray(Math.log2(r));this.size=r,this.dimension=r,this.parents=new t(r),this.ranks=new e(r);for(var i=0;i<r;i++)this.parents[i]=i}hr.prototype.find=function(r){for(var t=r,e,i;e=this.parents[t],t!==e;)t=e;for(;i=this.parents[r],i!==t;)this.parents[r]=t,r=i;return t};hr.prototype.union=function(r,t){var e=this.find(r),i=this.find(t);if(e===i)return this;this.dimension--;var s=this.ranks[r],a=this.ranks[t];return s<a?this.parents[e]=i:s>a?this.parents[i]=e:(this.parents[i]=e,this.ranks[e]++),this};hr.prototype.connected=function(r,t){var e=this.find(r);return e===this.find(t)};hr.prototype.mapping=function(){for(var r=Gu.getPointerArray(this.dimension),t={},e=new r(this.size),i=0,s,a=0,h=this.parents.length;a<h;a++)s=this.find(a),typeof t[s]=="undefined"?(e[a]=i,t[s]=i++):e[a]=t[s];return e};hr.prototype.compile=function(){for(var r={},t=new Array(this.dimension),e=0,i,s=0,a=this.parents.length;s<a;s++)i=this.find(s),typeof r[i]=="undefined"?(t[e]=[s],r[i]=e++):t[r[i]].push(s);return t};hr.prototype.inspect=function(){var r=this.compile();return Object.defineProperty(r,"constructor",{value:hr,enumerable:!1}),r};typeof Symbol!="undefined"&&(hr.prototype[Symbol.for("nodejs.util.inspect.custom")]=hr.prototype.inspect);Lp.exports=hr});var Es=V((TO,Ip)=>{var Op=Rn(),Uu=Ls(),hx=Op.DEFAULT_COMPARATOR,lx=Op.reverseComparator;function cx(r,t,e,i){for(var s=e,a=i,h=t[i],c=2*i+1,f;c<s;)f=c+1,f<s&&r(t[c],t[f])>=0&&(c=f),t[i]=t[c],i=c,c=2*i+1;t[i]=h,Uu.siftDown(r,t,a,i)}function Ap(r,t,e,i){for(var s=i,a=s,h=new r(i),c,f;a>0;)c=e[--a],a!==0&&(f=e[0],e[0]=c,cx(t,e,--i,0),c=f),h[a]=c;return h}function lr(r,t,e){if(arguments.length===2&&(e=t,t=null),this.ArrayClass=r,this.capacity=e,this.items=new r(e),this.clear(),this.comparator=t||hx,typeof e!="number"&&e<=0)throw new Error("mnemonist/FixedReverseHeap.constructor: capacity should be a number > 0.");if(typeof this.comparator!="function")throw new Error("mnemonist/FixedReverseHeap.constructor: given comparator should be a function.");this.comparator=lx(this.comparator)}lr.prototype.clear=function(){this.size=0};lr.prototype.push=function(r){return this.size<this.capacity?(this.items[this.size]=r,Uu.siftDown(this.comparator,this.items,0,this.size),this.size++):this.comparator(r,this.items[0])>0&&Uu.replace(this.comparator,this.items,r),this.size};lr.prototype.peek=function(){return this.items[0]};lr.prototype.consume=function(){var r=Ap(this.ArrayClass,this.comparator,this.items,this.size);return this.size=0,r};lr.prototype.toArray=function(){return Ap(this.ArrayClass,this.comparator,this.items.slice(0,this.size),this.size)};lr.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:lr,enumerable:!1}),r};typeof Symbol!="undefined"&&(lr.prototype[Symbol.for("nodejs.util.inspect.custom")]=lr.prototype.inspect);Ip.exports=lr});var kp=V((xO,Dp)=>{var fx=mt(),Mp=function(r){return r};function Kt(r){if(this.items=new Map,this.clear(),Array.isArray(r)?(this.writeHashFunction=r[0],this.readHashFunction=r[1]):(this.writeHashFunction=r,this.readHashFunction=r),this.writeHashFunction||(this.writeHashFunction=Mp),this.readHashFunction||(this.readHashFunction=Mp),typeof this.writeHashFunction!="function")throw new Error("mnemonist/FuzzyMap.constructor: invalid hash function given.");if(typeof this.readHashFunction!="function")throw new Error("mnemonist/FuzzyMap.constructor: invalid hash function given.")}Kt.prototype.clear=function(){this.items.clear(),this.size=0};Kt.prototype.add=function(r){var t=this.writeHashFunction(r);return this.items.set(t,r),this.size=this.items.size,this};Kt.prototype.set=function(r,t){return r=this.writeHashFunction(r),this.items.set(r,t),this.size=this.items.size,this};Kt.prototype.get=function(r){return r=this.readHashFunction(r),this.items.get(r)};Kt.prototype.has=function(r){return r=this.readHashFunction(r),this.items.has(r)};Kt.prototype.forEach=function(r,t){t=arguments.length>1?t:this,this.items.forEach(function(e){r.call(t,e,e)})};Kt.prototype.values=function(){return this.items.values()};typeof Symbol!="undefined"&&(Kt.prototype[Symbol.iterator]=Kt.prototype.values);Kt.prototype.inspect=function(){var r=Array.from(this.items.values());return Object.defineProperty(r,"constructor",{value:Kt,enumerable:!1}),r};typeof Symbol!="undefined"&&(Kt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Kt.prototype.inspect);Kt.from=function(r,t,e){var i=new Kt(t);return fx(r,function(s,a){e?i.set(a,s):i.add(s)}),i};Dp.exports=Kt});var Bu=V((CO,Rp)=>{var Os=jt(),px=mt();function ct(r){this.Container=r||Array,this.items=new Map,this.clear(),Object.defineProperty(this.items,"constructor",{value:ct,enumerable:!1})}ct.prototype.clear=function(){this.size=0,this.dimension=0,this.items.clear()};ct.prototype.set=function(r,t){var e=this.items.get(r),i;return e||(this.dimension++,e=new this.Container,this.items.set(r,e)),this.Container===Set?(i=e.size,e.add(t),i<e.size&&this.size++):(e.push(t),this.size++),this};ct.prototype.delete=function(r){var t=this.items.get(r);return t?(this.size-=this.Container===Set?t.size:t.length,this.dimension--,this.items.delete(r),!0):!1};ct.prototype.remove=function(r,t){var e=this.items.get(r),i,s;return e?this.Container===Set?(i=e.delete(t),i&&this.size--,e.size===0&&(this.items.delete(r),this.dimension--),i):(s=e.indexOf(t),s===-1?!1:(this.size--,e.length===1?(this.items.delete(r),this.dimension--,!0):(e.splice(s,1),!0))):!1};ct.prototype.has=function(r){return this.items.has(r)};ct.prototype.get=function(r){return this.items.get(r)};ct.prototype.multiplicity=function(r){var t=this.items.get(r);return typeof t=="undefined"?0:this.Container===Set?t.size:t.length};ct.prototype.count=ct.prototype.multiplicity;ct.prototype.forEach=function(r,t){t=arguments.length>1?t:this;var e;function i(s){r.call(t,s,e)}this.items.forEach(function(s,a){e=a,s.forEach(i)})};ct.prototype.forEachAssociation=function(r,t){t=arguments.length>1?t:this,this.items.forEach(r,t)};ct.prototype.keys=function(){return this.items.keys()};ct.prototype.values=function(){var r=this.items.values(),t=!1,e,i,s,a;return this.Container===Set?new Os(function h(){if(!t){if(i=r.next(),i.done)return{done:!0};t=!0,e=i.value.values()}return i=e.next(),i.done?(t=!1,h()):{done:!1,value:i.value}}):new Os(function h(){if(!t){if(i=r.next(),i.done)return{done:!0};t=!0,e=i.value,s=0,a=e.length}return s>=a?(t=!1,h()):{done:!1,value:e[s++]}})};ct.prototype.entries=function(){var r=this.items.entries(),t=!1,e,i,s,a,h;return this.Container===Set?new Os(function c(){if(!t){if(i=r.next(),i.done)return{done:!0};t=!0,s=i.value[0],e=i.value[1].values()}return i=e.next(),i.done?(t=!1,c()):{done:!1,value:[s,i.value]}}):new Os(function c(){if(!t){if(i=r.next(),i.done)return{done:!0};t=!0,s=i.value[0],e=i.value[1],a=0,h=e.length}return a>=h?(t=!1,c()):{done:!1,value:[s,e[a++]]}})};ct.prototype.containers=function(){return this.items.values()};ct.prototype.associations=function(){return this.items.entries()};typeof Symbol!="undefined"&&(ct.prototype[Symbol.iterator]=ct.prototype.entries);ct.prototype.inspect=function(){return this.items};typeof Symbol!="undefined"&&(ct.prototype[Symbol.for("nodejs.util.inspect.custom")]=ct.prototype.inspect);ct.prototype.toJSON=function(){return this.items};ct.from=function(r,t){var e=new ct(t);return px(r,function(i,s){e.set(s,i)}),e};Rp.exports=ct});var Vp=V((SO,zp)=>{var mx=Bu(),dx=mt(),Fp=function(r){return r};function Jt(r,t){if(this.items=new mx(t),this.clear(),Array.isArray(r)?(this.writeHashFunction=r[0],this.readHashFunction=r[1]):(this.writeHashFunction=r,this.readHashFunction=r),this.writeHashFunction||(this.writeHashFunction=Fp),this.readHashFunction||(this.readHashFunction=Fp),typeof this.writeHashFunction!="function")throw new Error("mnemonist/FuzzyMultiMap.constructor: invalid hash function given.");if(typeof this.readHashFunction!="function")throw new Error("mnemonist/FuzzyMultiMap.constructor: invalid hash function given.")}Jt.prototype.clear=function(){this.items.clear(),this.size=0,this.dimension=0};Jt.prototype.add=function(r){var t=this.writeHashFunction(r);return this.items.set(t,r),this.size=this.items.size,this.dimension=this.items.dimension,this};Jt.prototype.set=function(r,t){return r=this.writeHashFunction(r),this.items.set(r,t),this.size=this.items.size,this.dimension=this.items.dimension,this};Jt.prototype.get=function(r){return r=this.readHashFunction(r),this.items.get(r)};Jt.prototype.has=function(r){return r=this.readHashFunction(r),this.items.has(r)};Jt.prototype.forEach=function(r,t){t=arguments.length>1?t:this,this.items.forEach(function(e){r.call(t,e,e)})};Jt.prototype.values=function(){return this.items.values()};typeof Symbol!="undefined"&&(Jt.prototype[Symbol.iterator]=Jt.prototype.values);Jt.prototype.inspect=function(){var r=Array.from(this);return Object.defineProperty(r,"constructor",{value:Jt,enumerable:!1}),r};typeof Symbol!="undefined"&&(Jt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Jt.prototype.inspect);Jt.from=function(r,t,e,i){arguments.length===3&&typeof e=="boolean"&&(i=e,e=Array);var s=new Jt(t,e);return dx(r,function(a,h){i?s.set(h,a):s.add(a)}),s};zp.exports=Jt});var Gp=V((_O,jp)=>{var Np=1024;function gx(r){return(r&r-1)===0}function Xe(r,t){if(arguments.length<1)throw new Error("mnemonist/hashed-array-tree: expecting at least a byte array constructor.");var e=t||0,i=Np,s=0;if(typeof t=="object"&&(e=t.initialCapacity||0,s=t.initialLength||0,i=t.blockSize||Np),!i||!gx(i))throw new Error("mnemonist/hashed-array-tree: block size should be a power of two.");var a=Math.max(s,e),h=Math.ceil(a/i);this.ArrayClass=r,this.length=s,this.capacity=h*i,this.blockSize=i,this.offsetMask=i-1,this.blockMask=Math.log2(i),this.blocks=new Array(h);for(var c=0;c<h;c++)this.blocks[c]=new this.ArrayClass(this.blockSize)}Xe.prototype.set=function(r,t){if(this.length<r)throw new Error("HashedArrayTree("+this.ArrayClass.name+").set: index out of bounds.");var e=r>>this.blockMask,i=r&this.offsetMask;return this.blocks[e][i]=t,this};Xe.prototype.get=function(r){if(!(this.length<r)){var t=r>>this.blockMask,e=r&this.offsetMask;return this.blocks[t][e]}};Xe.prototype.grow=function(r){if(typeof r!="number"&&(r=this.capacity+this.blockSize),this.capacity>=r)return this;for(;this.capacity<r;)this.blocks.push(new this.ArrayClass(this.blockSize)),this.capacity+=this.blockSize;return this};Xe.prototype.resize=function(r){return r===this.length?this:r<this.length?(this.length=r,this):(this.length=r,this.grow(r),this)};Xe.prototype.push=function(r){this.capacity===this.length&&this.grow();var t=this.length,e=t>>this.blockMask,i=t&this.offsetMask;return this.blocks[e][i]=r,++this.length};Xe.prototype.pop=function(){if(this.length!==0){var r=this.blocks[this.blocks.length-1],t=--this.length&this.offsetMask;return r[t]}};Xe.prototype.inspect=function(){for(var r=new this.ArrayClass(this.length),t,e=0,i=this.length;e<i;e++)t=e>>this.blockMask,r[e]=this.blocks[t][e&this.offsetMask];return r.type=this.ArrayClass.name,r.items=this.length,r.capacity=this.capacity,r.blockSize=this.blockSize,Object.defineProperty(r,"constructor",{value:Xe,enumerable:!1}),r};typeof Symbol!="undefined"&&(Xe.prototype[Symbol.for("nodejs.util.inspect.custom")]=Xe.prototype.inspect);jp.exports=Xe});var Wu=V((LO,Bp)=>{var Up=jt(),Hu=pe();function kt(r,t){if(arguments.length<2)throw new Error("mnemonist/fixed-stack: expecting an Array class and a capacity.");if(typeof t!="number"||t<=0)throw new Error("mnemonist/fixed-stack: `capacity` should be a positive number.");this.capacity=t,this.ArrayClass=r,this.items=new this.ArrayClass(this.capacity),this.clear()}kt.prototype.clear=function(){this.size=0};kt.prototype.push=function(r){if(this.size===this.capacity)throw new Error("mnemonist/fixed-stack.push: stack capacity ("+this.capacity+") exceeded!");return this.items[this.size++]=r,this.size};kt.prototype.pop=function(){if(this.size!==0)return this.items[--this.size]};kt.prototype.peek=function(){return this.items[this.size-1]};kt.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=0,i=this.items.length;e<i;e++)r.call(t,this.items[i-e-1],e,this)};kt.prototype.toArray=function(){for(var r=new this.ArrayClass(this.size),t=this.size-1,e=this.size;e--;)r[e]=this.items[t-e];return r};kt.prototype.values=function(){var r=this.items,t=this.size,e=0;return new Up(function(){if(e>=t)return{done:!0};var i=r[t-e-1];return e++,{value:i,done:!1}})};kt.prototype.entries=function(){var r=this.items,t=this.size,e=0;return new Up(function(){if(e>=t)return{done:!0};var i=r[t-e-1];return{value:[e++,i],done:!1}})};typeof Symbol!="undefined"&&(kt.prototype[Symbol.iterator]=kt.prototype.values);kt.prototype.toString=function(){return this.toArray().join(",")};kt.prototype.toJSON=function(){return this.toArray()};kt.prototype.inspect=function(){var r=this.toArray();return r.type=this.ArrayClass.name,r.capacity=this.capacity,Object.defineProperty(r,"constructor",{value:kt,enumerable:!1}),r};typeof Symbol!="undefined"&&(kt.prototype[Symbol.for("nodejs.util.inspect.custom")]=kt.prototype.inspect);kt.from=function(r,t,e){if(arguments.length<3&&(e=Hu.guessLength(r),typeof e!="number"))throw new Error("mnemonist/fixed-stack.from: could not guess iterable length. Please provide desired capacity as last argument.");var i=new kt(t,e);if(Hu.isArrayLike(r)){var s,a;for(s=0,a=r.length;s<a;s++)i.items[s]=r[s];return i.size=a,i}return Hu.forEach(r,function(h){i.push(h)}),i};Bp.exports=kt});var Wp=V((EO,Hp)=>{var yx=pe(),vx=oe(),bx=Wu();function qu(r,t,e,i,s,a,h,c){var f=h+(c-h)/2|0,m=~-f,y=-~f,b=e[f];i[a]=b+1;var _=t?t(r[b]):r[b][1],C=a*2+1,I=a*2+2,M=-1/0,R=-1/0;h<=m&&(M=qu(r,t,e,i,s,C,h,m)),y<=c&&(R=qu(r,t,e,i,s,I,y,c));var j=Math.max(_,M,R),B=b;return j===M?B=s[i[C]-1]:j===R&&(B=s[i[I]-1]),s[b]=B,j}function cr(r,t){this.size=r.length,this.intervals=r;var e=null,i=null;Array.isArray(t)&&(e=t[0],i=t[1]);var s=r.length,a=vx.getPointerArray(s+1),h=new a(s),c;for(c=1;c<s;c++)h[c]=c;h.sort(function(_,C){return _=r[_],C=r[C],e?(_=e(_),C=e(C)):(_=_[0],C=C[0]),_<C?-1:_>C?1:0});var f=Math.ceil(Math.log2(s+1)),m=Math.pow(2,f)-1,y=new a(m),b=new a(s);qu(r,i,h,y,b,0,0,s-1),h=null,this.height=f,this.tree=y,this.augmentations=b,this.startGetter=e,this.endGetter=i,this.stack=new bx(a,this.height)}cr.prototype.intervalsContainingPoint=function(r){var t=[],e=this.stack;e.clear(),e.push(0);for(var i=this.tree.length,s,a,h,c,f,m,y,b,_;e.size;)s=e.pop(),a=this.tree[s]-1,h=this.intervals[a],c=this.intervals[this.augmentations[a]],y=this.endGetter?this.endGetter(c):c[1],!(r>y)&&(b=s*2+1,b<i&&this.tree[b]!==0&&e.push(b),f=this.startGetter?this.startGetter(h):h[0],m=this.endGetter?this.endGetter(h):h[1],r>=f&&r<=m&&t.push(h),!(r<f)&&(_=s*2+2,_<i&&this.tree[_]!==0&&e.push(_)));return t};cr.prototype.intervalsOverlappingInterval=function(r){var t=this.startGetter?this.startGetter(r):r[0],e=this.endGetter?this.endGetter(r):r[1],i=[],s=this.stack;s.clear(),s.push(0);for(var a=this.tree.length,h,c,f,m,y,b,_,C,I;s.size;)h=s.pop(),c=this.tree[h]-1,f=this.intervals[c],m=this.intervals[this.augmentations[c]],_=this.endGetter?this.endGetter(m):m[1],!(t>_)&&(C=h*2+1,C<a&&this.tree[C]!==0&&s.push(C),y=this.startGetter?this.startGetter(f):f[0],b=this.endGetter?this.endGetter(f):f[1],e>=y&&t<=b&&i.push(f),!(e<y)&&(I=h*2+2,I<a&&this.tree[I]!==0&&s.push(I)));return i};cr.prototype.inspect=function(){var r=this.intervals.slice();return Object.defineProperty(r,"constructor",{value:cr,enumerable:!1}),r};typeof Symbol!="undefined"&&(cr.prototype[Symbol.for("nodejs.util.inspect.custom")]=cr.prototype.inspect);cr.from=function(r,t){return yx.isArrayLike(r)?new cr(r,t):new cr(Array.from(r),t)};Hp.exports=cr});var $u=V(Wr=>{Wr.search=function(r,t,e,i){var s=0;e=typeof e!="undefined"?e:0,i=typeof i!="undefined"?i:r.length,i--;for(var a;e<=i;)if(s=e+i>>>1,a=r[s],a>t)i=~-s;else if(a<t)e=-~s;else return s;return-1};Wr.searchWithComparator=function(r,t,e){for(var i=0,s=0,a=~-t.length,h;s<=a;)if(i=s+a>>>1,h=r(t[i],e),h>0)a=~-i;else if(h<0)s=-~i;else return i;return-1};Wr.lowerBound=function(r,t,e,i){var s=0;for(e=typeof e!="undefined"?e:0,i=typeof i!="undefined"?i:r.length;e<i;)s=e+i>>>1,t<=r[s]?i=s:e=-~s;return e};Wr.lowerBoundWithComparator=function(r,t,e){for(var i=0,s=0,a=t.length;s<a;)i=s+a>>>1,r(e,t[i])<=0?a=i:s=-~i;return s};Wr.lowerBoundIndices=function(r,t,e,i,s){var a=0;for(i=typeof i!="undefined"?i:0,s=typeof s!="undefined"?s:r.length;i<s;)a=i+s>>>1,e<=r[t[a]]?s=a:i=-~a;return i};Wr.upperBound=function(r,t,e,i){var s=0;for(e=typeof e!="undefined"?e:0,i=typeof i!="undefined"?i:r.length;e<i;)s=e+i>>>1,t>=r[s]?e=-~s:i=s;return e};Wr.upperBoundWithComparator=function(r,t,e){for(var i=0,s=0,a=t.length;s<a;)i=s+a>>>1,r(e,t[i])>=0?s=-~i:a=i;return s}});var Qp=V(qr=>{var Ui=oe(),Bi=pe().isArrayLike,gi=$u(),qp=bs();function $p(r,t){if(r.length===0)return t.slice();if(t.length===0)return r.slice();var e;r[0]>t[0]&&(e=r,r=t,t=e);var i=r[r.length-1],s=t[0];if(i<=s)retu