diff --git a/createPackageJsons.cjs b/createPackageJsons.cjs new file mode 100644 index 00000000..846e19f7 --- /dev/null +++ b/createPackageJsons.cjs @@ -0,0 +1,18 @@ +const fs = require('fs'); + +fs.writeFileSync("dist/mjs/package.json", + '{"type": "module"}', + { + encoding: "utf8", + flag: "a+", + mode: 0o666 + }); + +fs.writeFileSync("dist/cjs/package.json", + '{"type": "commonjs"}', + { + encoding: "utf8", + flag: "a+", + mode: 0o666 + }); + diff --git a/dist/Direction/Direction.d.ts b/dist/Direction/Direction.d.ts deleted file mode 100644 index ff97fbe3..00000000 --- a/dist/Direction/Direction.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Vector2 } from "../Utils/Vector2/Vector2"; -export declare enum Direction { - NONE = "none", - LEFT = "left", - UP_LEFT = "up-left", - UP = "up", - UP_RIGHT = "up-right", - RIGHT = "right", - DOWN_RIGHT = "down-right", - DOWN = "down", - DOWN_LEFT = "down-left" -} -export declare function directions(): Direction[]; -export declare function isDiagonal(direction: Direction): boolean; -export declare function turnCounterClockwise(direction: Direction): Direction; -export declare function directionVector(direction: Direction): Vector2; -export declare function oppositeDirection(direction: Direction): Direction; -export declare enum NumberOfDirections { - FOUR = 4, - EIGHT = 8 -} diff --git a/dist/FollowMovement/FollowMovement.d.ts b/dist/FollowMovement/FollowMovement.d.ts deleted file mode 100644 index efba87c4..00000000 --- a/dist/FollowMovement/FollowMovement.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { GridTilemap } from "../GridTilemap/GridTilemap"; -import { GridCharacter } from "../GridCharacter/GridCharacter"; -export declare class FollowMovement { - private targetMovement; - private characters; - constructor(gridTilemap: GridTilemap); - addCharacter(character: GridCharacter, charToFollow: GridCharacter, distance?: number, closestPointIfBlocked?: boolean): void; - removeCharacter(charId: string): void; - update(): void; -} diff --git a/dist/GlobalConfig/GlobalConfig.d.ts b/dist/GlobalConfig/GlobalConfig.d.ts deleted file mode 100644 index 3065f256..00000000 --- a/dist/GlobalConfig/GlobalConfig.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { GridEngineConfig } from "../GridEngine"; -import { Concrete } from "../Utils/TypeUtils"; -export declare class GlobalConfig { - private static config; - static get(): Concrete; - static set(config: Concrete): void; -} diff --git a/dist/GridCharacter/CharacterFilter/CharacterFilter.d.ts b/dist/GridCharacter/CharacterFilter/CharacterFilter.d.ts deleted file mode 100644 index 40645d3f..00000000 --- a/dist/GridCharacter/CharacterFilter/CharacterFilter.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { GridCharacter } from "../GridCharacter"; -/** - * Options for filtering characters. - */ -export interface CharacterFilteringOptions { - labels?: { - /** - * When set and not an empty array, these labels must ALL be present on a - * character in order for it to appear in the filtered result. - * - * If both, {@link CharacterFilteringOptions.withAllLabels} and - * {@link CharacterFilteringOptions.withNoneLabels} are provided and - * non-empty arrays, {@link CharacterFilteringOptions.withNoneLabels} is ignored. - * - * If both, {@link CharacterFilteringOptions.withAllLabels} and - * {@link CharacterFilteringOptions.withOneOfLabels} are provided and - * non-empty arrays, {@link CharacterFilteringoptions.withOneOfLabels} is ignored. - * @default `[]` - */ - withAllLabels?: string[]; - /** - * When set and not an empty array, NONE of these labels must be present on - * a character in order for it to appear in the filtered result. - * - * If both, {@link CharacterFilteringOptions.withAllLabels} and - * {@link CharacterFilteringOptions.withNoneLabels} are provided and - * non-empty arrays, {@link CharacterFilteringoptions.withNoneLabels} is ignored. - * - * If both, {@link CharacterFilteringOptions.withNoneLabels} and - * {@link CharacterFilteringOptions.withOneOfLabels} are provided and - * non-empty arrays, {@link CharacterFilteringOptions.withNoneLabels} is ignored. - * @default `[]` - */ - withNoneLabels?: string[]; - /** - * When set and not an empty array, ONE of these labels must be present on a - * character in order for it to appear in the filtered result. - * - * If both, {@link CharacterFilteringOptions.withAllLabels} and - * {@link CharacterFilteringoptions.withNoneLabels} are provided and - * non-empty arrays, {@link CharacterFilteringoptions.withNoneLabels} is ignored. - * - * If both, {@link CharacterFilteringOptions.withNoneLabels} and - * {@link CharacterFilteringOptions.withOneOfLabels} are provided and - * non-empty arrays, {@link CharacterFilteringOptions.withNoneLabels} is ignored. - * @default `[]` - */ - withOneOfLabels?: string[]; - }; -} -export declare function filterCharacters(characters: GridCharacter[], options: CharacterFilteringOptions): GridCharacter[]; diff --git a/dist/GridCharacter/IsometricGridCharacter/IsometricGridCharacter.d.ts b/dist/GridCharacter/IsometricGridCharacter/IsometricGridCharacter.d.ts deleted file mode 100644 index 61dfc9e0..00000000 --- a/dist/GridCharacter/IsometricGridCharacter/IsometricGridCharacter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { LayerPosition } from "./../../Pathfinding/ShortestPathAlgorithm"; -import { Direction } from "../../Direction/Direction"; -import { Vector2 } from "../../Utils/Vector2/Vector2"; -import { GridCharacter } from "../GridCharacter"; -export declare class IsometricGridCharacter extends GridCharacter { - protected tilePosToPixelPos(tilePosition: Vector2): Vector2; - protected getTileDistance(direction: Direction): Vector2; - protected toMapDirection(direction: Direction): Direction; - protected mapDepth(nextTilePos: LayerPosition): number; -} diff --git a/dist/GridEngine.esm.min.js b/dist/GridEngine.esm.min.js index 12ffabbe..75d77155 100644 --- a/dist/GridEngine.esm.min.js +++ b/dist/GridEngine.esm.min.js @@ -1,6 +1,6 @@ var JP=Object.create;var hu=Object.defineProperty,ZP=Object.defineProperties,tT=Object.getOwnPropertyDescriptor,eT=Object.getOwnPropertyDescriptors,rT=Object.getOwnPropertyNames,Bl=Object.getOwnPropertySymbols,iT=Object.getPrototypeOf,ql=Object.prototype.hasOwnProperty,nT=Object.prototype.propertyIsEnumerable;var Wl=(r,t,e)=>t in r?hu(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ot=(r,t)=>{for(var e in t||(t={}))ql.call(t,e)&&Wl(r,e,t[e]);if(Bl)for(var e of Bl(t))nT.call(t,e)&&Wl(r,e,t[e]);return r},Be=(r,t)=>ZP(r,eT(t));var z=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var oT=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of rT(t))!ql.call(r,s)&&s!==e&&hu(r,s,{get:()=>t[s],enumerable:!(n=tT(t,s))||n.enumerable});return r};var $l=(r,t,e)=>(e=r!=null?JP(iT(r)):{},oT(t||!r||!r.__esModule?hu(e,"default",{value:r,enumerable:!0}):e,r));var Ln=z(_n=>{var LT=function(r,t){return rt?1:0},ET=function(r,t){return rt?-1:0};function AT(r){return function(t,e){return r(e,t)}}function OT(r){return r===2?function(t,e){return t[0]e[0]?1:t[1]e[1]?1:0}:function(t,e){for(var n=0;ne[n])return 1;n++}return 0}}_n.DEFAULT_COMPARATOR=LT;_n.DEFAULT_REVERSE_COMPARATOR=ET;_n.reverseComparator=AT;_n.createTupleComparator=OT});var Pf=z(Pu=>{Pu.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer!="undefined";Pu.SYMBOL_SUPPORT=typeof Symbol!="undefined"});var dt=z((CE,xf)=>{var Tf=Pf(),DT=Tf.ARRAY_BUFFER_SUPPORT,MT=Tf.SYMBOL_SUPPORT;xf.exports=function(t,e){var n,s,a,h,l;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{var Sf=Ln(),Cf=dt(),_f=Sf.DEFAULT_COMPARATOR,IT=Sf.reverseComparator;function ne(r){if(this.clear(),this.comparator=r||_f,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 kT(r){return{item:r,degree:0}}function Lf(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=kT(r);return t.left=t,t.right=t,Lf(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 Ef(r){for(var t=[],e=r,n=!1;!(e===r&&n);)e===r&&(n=!0),t.push(e),e=e.right;return t}function Af(r,t){r.root===t&&(r.root=t.right),t.left.right=t.right,t.right.left=t.left}function RT(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 FT(r,t,e){Af(r,t),t.left=t,t.right=t,RT(e,t),e.degree++,t.parent=e}function zT(r){var t=new Array(r.size),e=Ef(r.root),n,s,a,h,l,p;for(n=0,s=e.length;n0&&(p=a,a=h,h=p),FT(r,h,a),t[l]=null,l++;t[l]=a}for(n=0;n{var VT=Math.pow(2,8)-1,NT=Math.pow(2,16)-1,UT=Math.pow(2,32)-1,jT=Math.pow(2,7)-1,GT=Math.pow(2,15)-1,HT=Math.pow(2,31)-1;or.getPointerArray=function(r){var t=r-1;if(t<=VT)return Uint8Array;if(t<=NT)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<=jT?Int8Array:t<=GT?Int16Array:t<=HT?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 BT={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};or.getMinimalRepresentation=function(r,t){var e=null,n=0,s,a,h,l,p;for(l=0,p=r.length;ln&&(n=s,e=a);return e};or.isTypedArray=function(r){return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView(r)};or.concat=function(){var r=0,t,e,n;for(t=0,n=arguments.length;t{var If=dt(),kf=oe();function WT(r){return Array.isArray(r)||kf.isTypedArray(r)}function Tu(r){if(typeof r.length=="number")return r.length;if(typeof r.size=="number")return r.size}function qT(r){var t=Tu(r),e=typeof t=="number"?new Array(t):[],n=0;return If(r,function(s){e[n++]=s}),e}function $T(r){var t=Tu(r),e=typeof t=="number"?kf.getPointerArray(t):Array,n=typeof t=="number"?new Array(t):[],s=typeof t=="number"?new e(t):[],a=0;return If(r,function(h){n[a]=h,s[a]=a++}),[n,s]}An.isArrayLike=WT;An.guessLength=Tu;An.toArray=qT;An.toArrayWithIndices=$T});var ws=z((YE,Vf)=>{var ys=dt(),Rf=Ln(),sr=pe(),bs=Rf.DEFAULT_COMPARATOR,xu=Rf.reverseComparator;function Su(r,t,e,n){for(var s=t[n],a,h;n>e;){if(a=n-1>>1,h=t[a],r(s,h)<0){t[n]=h,n=a;continue}break}t[n]=s}function On(r,t,e){for(var n=t.length,s=e,a=t[e],h=2*e+1,l;h=0&&(h=l),t[e]=t[h],e=h,h=2*e+1;t[e]=a,Su(r,t,s,e)}function Ff(r,t,e){t.push(e),Su(r,t,0,t.length-1)}function Cu(r,t){var e=t.pop();if(t.length!==0){var n=t[0];return t[0]=e,On(r,t,0),n}return e}function zi(r,t,e){if(t.length===0)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var n=t[0];return t[0]=e,On(r,t,0),n}function zf(r,t,e){var n;return t.length!==0&&r(t[0],e)<0&&(n=t[0],t[0]=e,e=n,On(r,t,0)),e}function ui(r,t){for(var e=t.length,n=e>>1,s=n;--s>=0;)On(r,t,s)}function _u(r,t){for(var e=t.length,n=0,s=new Array(e);n=e.length)return e.slice().sort(r);for(p=e.slice(0,t),ui(n,p),s=t,a=e.length;s0&&zi(n,p,e[s]);return p.sort(r)}var d=sr.guessLength(e);return d!==null&&d0&&zi(n,p,y)),s++}),p.length>s&&(p.length=s),p.sort(r)}function KT(r,t,e){arguments.length===2&&(e=t,t=r,r=bs);var n=xu(r),s,a,h,l=-1/0,p;if(t===1){if(sr.isArrayLike(e)){for(s=0,a=e.length;s0)&&(l=h);return p=new e.constructor(1),p[0]=l,p}return ys(e,function(y){(l===-1/0||r(y,l)>0)&&(l=y)}),[l]}if(sr.isArrayLike(e)){if(t>=e.length)return e.slice().sort(n);for(p=e.slice(0,t),ui(r,p),s=t,a=e.length;s0&&zi(r,p,e[s]);return p.sort(n)}var d=sr.guessLength(e);return d!==null&&d0&&zi(r,p,y)),s++}),p.length>s&&(p.length=s),p.sort(n)}function at(r){if(this.clear(),this.comparator=r||bs,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 Ff(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--,Cu(this.comparator,this.items)};at.prototype.replace=function(r){return zi(this.comparator,this.items,r)};at.prototype.pushpop=function(r){return zf(this.comparator,this.items,r)};at.prototype.consume=function(){return this.size=0,_u(this.comparator,this.items)};at.prototype.toArray=function(){return _u(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 vs(r){if(this.clear(),this.comparator=r||bs,typeof this.comparator!="function")throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=xu(this.comparator)}vs.prototype=at.prototype;at.from=function(r,t){var e=new at(t),n;return sr.isArrayLike(r)?n=r.slice():n=sr.toArray(r),ui(e.comparator,n),e.items=n,e.size=n.length,e};vs.from=function(r,t){var e=new vs(t),n;return sr.isArrayLike(r)?n=r.slice():n=sr.toArray(r),ui(e.comparator,n),e.items=n,e.size=n.length,e};at.siftUp=On;at.siftDown=Su;at.push=Ff;at.pop=Cu;at.replace=zi;at.pushpop=zf;at.heapify=ui;at.consume=_u;at.nsmallest=QT;at.nlargest=KT;at.MinHeap=at;at.MaxHeap=vs;Vf.exports=at});var Hf=z((XE,Gf)=>{var Nf="";function Uf(r,t,e){for(var n=t.length,s=[],a=n,h=-1,l,p=0,d;a--;)h=Math.max(r[t[a]+e],h);for(d=h>>24&&32||h>>16&&24||h>>8&&16||8;p>p&15].push(t[a]);for(l=0;l<16;l++)for(h=s[l].length;h--;)t[++a]=s[l][h]}}function YT(r,t,e,n){return r[e]-r[n]||(e%3===2?r[e+1]-r[n+1]||t[e+2]-t[n+2]:t[e+1]-t[n+1])}function Lu(r,t){var e=[],n=[],s=2*t/3|0,a=t-s,h=s+1>>1,l=s,p=0,d,y=[],b=[];if(t===1)return[0];for(;l--;)e[l]=(l*3>>1)+1;for(l=3;l--;)Uf(r,e,l);for(p=n[(e[0]/3|0)+(e[0]%3===1?0:h)]=1,l=1;lthis.firstLength&&a>this.firstLength)){for(t=Math.min(this.length-s,this.length-a),n=0;nr.length&&(r=this.text.slice(s,s+t))}return r};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{var XT=dt();function $e(r){this.size=0,this.items=new Map,this.inverse=r}function Te(){this.size=0,this.items=new Map,this.inverse=new $e(this)}function Bf(){this.size=0,this.items.clear(),this.inverse.items.clear()}Te.prototype.clear=Bf;$e.prototype.clear=Bf;function Wf(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 n=this.inverse.items.get(t);if(n===r)return this;this.items.delete(n)}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}Te.prototype.set=Wf;$e.prototype.set=Wf;function qf(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}Te.prototype.delete=qf;$e.prototype.delete=qf;var JT=["has","get","forEach","keys","values","entries"];JT.forEach(function(r){Te.prototype[r]=$e.prototype[r]=function(){return Map.prototype[r].apply(this.items,arguments)}});typeof Symbol!="undefined"&&(Te.prototype[Symbol.iterator]=Te.prototype.entries,$e.prototype[Symbol.iterator]=$e.prototype.entries);Te.prototype.inspect=function(){var r={left:this.items,right:this.inverse.items};return Object.defineProperty(r,"constructor",{value:Te,enumerable:!1}),r};typeof Symbol!="undefined"&&(Te.prototype[Symbol.for("nodejs.util.inspect.custom")]=Te.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);Te.from=function(r){var t=new Te;return XT(r,function(e,n){t.set(n,e)}),t};$f.exports=Te});var Nt=z((ZE,Kf)=>{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"};Kf.exports=ar});var Au=z(Qe=>{function Xf(r){return r|=r>>1,r|=r>>2,r|=r>>4,r|=r>>8,r|=r>>16,r&~(r>>1)}Qe.msb32=Xf;function Eu(r){return r|=r>>1,r|=r>>2,r|=r>>4,r&~(r>>1)}Qe.msb8=Eu;Qe.test=function(r,t){return r>>t&1};Qe.criticalBit8=function(r,t){return Eu(r^t)};Qe.criticalBit8Mask=function(r,t){return~Eu(r^t)>>>0&255};Qe.testCriticalBit8=function(r,t){return 1+(r|t)>>8};Qe.criticalBit32Mask=function(r,t){return~Xf(r^t)>>>0&4294967295};Qe.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 Vi=new Uint8Array(Math.pow(2,8));for(Dn=0,Yf=Vi.length;Dn>8&255]+Vi[r>>16&255]+Vi[r>>24&255]}});var ep=z((eA,tp)=>{var Zf=Nt(),Jf=Au();function It(r){this.length=r,this.clear()}It.prototype.clear=function(){this.size=0,this.array=new Uint32Array(Math.ceil(this.length/32))};It.prototype.set=function(r,t){var e=r>>5,n=r&31,s=this.array[e],a;return t===0||t===!1?a=this.array[e]&=~(1<>>0,a>s?this.size++:a>5,e=r&31,n=this.array[t],s;return s=this.array[t]&=~(1<>5,e=r&31,n=this.array[t],s=this.array[t]^=1<>>0,s>n?this.size++:s>5,e=r&31;return this.array[t]>>e&1};It.prototype.test=function(r){return!!this.get(r)};It.prototype.rank=function(r){if(this.size===0)return 0;for(var t=r>>5,e=r&31,n=0,s=0;s=this.length)return-1;for(var t,e=32,n=0,s=0,a=0,h=this.array.length;a>l&1,s===r)return n}};It.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=this.length,n,s,a=32,h=0,l=this.array.length;h>p&1,r.call(t,s,h*32+p)}};It.prototype.values=function(){var r=this.length,t=!1,e,n,s=this.array,a=s.length,h=0,l=-1,p=32;return new Zf(function d(){if(!t){if(h>=a)return{done:!0};h===a-1&&(p=r%32||32),e=s[h++],t=!0,l=-1}return l++,l>=p?(t=!1,d()):(n=e>>l&1,{value:n})})};It.prototype.entries=function(){var r=this.length,t=!1,e,n,s=this.array,a,h=s.length,l=0,p=-1,d=32;return new Zf(function y(){if(!t){if(l>=h)return{done:!0};l===h-1&&(d=r%32||32),e=s[l++],t=!0,p=-1}return p++,a=~-l*32+p,p>=d?(t=!1,y()):(n=e>>p&1,{value:[a,n]})})};typeof Symbol!="undefined"&&(It.prototype[Symbol.iterator]=It.prototype.values);It.prototype.inspect=function(){var r=new Uint8Array(this.length);return this.forEach(function(t,e){r[e]=t}),Object.defineProperty(r,"constructor",{value:It,enumerable:!1}),r};typeof Symbol!="undefined"&&(It.prototype[Symbol.for("nodejs.util.inspect.custom")]=It.prototype.inspect);It.prototype.toJSON=function(){return Array.from(this.array)};tp.exports=It});var op=z((rA,np)=>{var ip=Nt(),rp=Au(),ZT=function(r){return Math.max(1,Math.ceil(r*1.5))};function tx(r){return new Uint32Array(Math.ceil(r/32))}function mt(r){var t=r||0,e=ZT;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=tx(this.capacity)}mt.prototype.set=function(r,t){if(this.length>5,n=r&31,s=this.array[e],a;return t===0||t===!1?a=this.array[e]&=~(1<>>0,a>s?this.size++:a>5,e=r&31,n=this.array[t],s;return s=this.array[t]&=~(1<>5,e=r&31,n=this.array[t],s=this.array[t]^=1<>>0,s>n?this.size++:sthis.array.length?(this.array=new Uint32Array(n),this.array.set(e,0)):this.array=e.slice(0,n),this.capacity=r,this)};mt.prototype.grow=function(r){var t;if(typeof r=="number"){if(this.capacity>=r)return this;for(t=this.capacity;t>5,n=t&31;return this.array[e]|=1<>5,e=r&31;return this.array[t]>>e&1}};mt.prototype.get=function(r){if(!(this.length>5,e=r&31;return this.array[t]>>e&1}};mt.prototype.test=function(r){return this.length>5,e=r&31,n=0,s=0;s=this.length)return-1;for(var t,e=32,n=0,s=0,a=0,h=this.array.length;a>l&1,s===r)return n}};mt.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=this.length,n,s,a=32,h=0,l=this.array.length;h>p&1,r.call(t,s,h*32+p)}};mt.prototype.values=function(){var r=this.length,t=!1,e,n,s=this.array,a=s.length,h=0,l=-1,p=32;return new ip(function d(){if(!t){if(h>=a)return{done:!0};h===a-1&&(p=r%32||32),e=s[h++],t=!0,l=-1}return l++,l>=p?(t=!1,d()):(n=e>>l&1,{value:n})})};mt.prototype.entries=function(){var r=this.length,t=!1,e,n,s=this.array,a,h=s.length,l=0,p=-1,d=32;return new ip(function y(){if(!t){if(l>=h)return{done:!0};l===h-1&&(d=r%32||32),e=s[l++],t=!0,p=-1}return p++,a=~-l*32+p,p>=d?(t=!1,y()):(n=e>>p&1,{value:[a,n]})})};typeof Symbol!="undefined"&&(mt.prototype[Symbol.iterator]=mt.prototype.values);mt.prototype.inspect=function(){var r=new Uint8Array(this.length);return this.forEach(function(t,e){r[e]=t}),Object.defineProperty(r,"constructor",{value:mt,enumerable:!1}),r};typeof Symbol!="undefined"&&(mt.prototype[Symbol.for("nodejs.util.inspect.custom")]=mt.prototype.inspect);mt.prototype.toJSON=function(){return Array.from(this.array.slice(0,(this.length>>5)+1))};np.exports=mt});var ap=z((iA,sp)=>{function hi(r,t){return(r&65535)*t+(((r>>>16)*t&65535)<<16)&4294967295}function ex(r,t){return(r&65535)+(t>>>16)+(((r>>>16)+t&65535)<<16)&4294967295}function Ou(r,t){return r<>>32-t}sp.exports=function(t,e){var n=3432918353,s=461845907,a=15,h=13,l=5,p=1801774676,d=t,y,b,x;for(b=0,x=e.length-4;b<=x;b+=4)y=e[b]|e[b+1]<<8|e[b+2]<<16|e[b+3]<<24,y=hi(y,n),y=Ou(y,a),y=hi(y,s),d^=y,d=Ou(d,h),d=hi(d,l),d=ex(d,p);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=hi(y,n),y=Ou(y,a),y=hi(y,s),d^=y;default:}return d^=e.length,d^=d>>>16,d=hi(d,2246822507),d^=d>>>13,d=hi(d,3266489909),d^=d>>>16,d>>>0}});var lp=z((nA,cp)=>{var rx=ap(),ix=dt(),nx=Math.LN2*Math.LN2,ox={errorRate:.005};function up(r){var t=new Uint16Array(r.length),e,n;for(e=0,n=r.length;e>3]|=a}return this};ci.prototype.test=function(r){for(var t=up(r),e=0,n=this.hashFunctions;e>3]&1<<(7&s)))return!1}return!0};ci.prototype.toJSON=function(){return this.data};ci.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 ci(t);return ix(r,function(n){e.add(n)}),e};cp.exports=ci});var pp=z((oA,fp)=>{var sx=dt();function Ke(r){if(typeof r!="function")throw new Error("mnemonist/BKTree.constructor: given `distance` should be a function.");this.distance=r,this.clear()}Ke.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};Ke.prototype.search=function(r,t){if(!this.root)return[];for(var e=[],n=[this.root],s,a,h,l,p;n.length;)for(s=n.pop(),h=this.distance(t,s.item),h<=r&&e.push({item:s.item,distance:h}),l=h-r,p=h+r+1;l{var Du=pe(),dp=Nt();function St(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()}St.prototype.clear=function(){this.start=0,this.size=0};St.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)%this.capacity;return this.items[t]=r,++this.size};St.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};St.prototype.pop=function(){if(this.size===0)return;let r=(this.start+this.size-1)%this.capacity;return this.size--,this.items[r]};St.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]}};St.prototype.peekFirst=function(){if(this.size!==0)return this.items[this.start]};St.prototype.peekLast=function(){if(this.size!==0){var r=this.start+this.size-1;return r>this.capacity&&(r-=this.capacity),this.items[r]}};St.prototype.get=function(r){if(this.size!==0)return r=this.start+r,r>this.capacity&&(r-=this.capacity),this.items[r]};St.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=this.capacity,n=this.size,s=this.start,a=0;a=e)return{done:!0};var a=r[n];return n++,s++,n===t&&(n=0),{value:a,done:!1}})};St.prototype.entries=function(){var r=this.items,t=this.capacity,e=this.size,n=this.start,s=0;return new dp(function(){if(s>=e)return{done:!0};var a=r[n];return n++,n===t&&(n=0),{value:[s++,a],done:!1}})};typeof Symbol!="undefined"&&(St.prototype[Symbol.iterator]=St.prototype.values);St.prototype.inspect=function(){var r=this.toArray();return r.type=this.ArrayClass.name,r.capacity=this.capacity,Object.defineProperty(r,"constructor",{value:St,enumerable:!1}),r};typeof Symbol!="undefined"&&(St.prototype[Symbol.for("nodejs.util.inspect.custom")]=St.prototype.inspect);St.from=function(r,t,e){if(arguments.length<3&&(e=Du.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 n=new St(t,e);if(Du.isArrayLike(r)){var s,a;for(s=0,a=r.length;s{var Iu=pe(),ku=Mu();function Ni(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 gp(r){Ni.prototype[r]=ku.prototype[r]}Object.keys(ku.prototype).forEach(gp);typeof Symbol!="undefined"&&Object.getOwnPropertySymbols(ku.prototype).forEach(gp);Ni.prototype.push=function(r){var t=(this.start+this.size)%this.capacity;return this.items[t]=r,this.size===this.capacity?(this.start=(t+1)%this.capacity,this.size):++this.size};Ni.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)};Ni.from=function(r,t,e){if(arguments.length<3&&(e=Iu.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 n=new Ni(t,e);if(Iu.isArrayLike(r)){var s,a;for(s=0,a=r.length;s{function Wt(r){if(typeof r!="function")throw new Error("mnemonist/DefaultMap.constructor: expecting a function.");this.items=new Map,this.factory=r,this.size=0}Wt.prototype.clear=function(){this.items.clear(),this.size=0};Wt.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};Wt.prototype.peek=function(r){return this.items.get(r)};Wt.prototype.set=function(r,t){return this.items.set(r,t),this.size=this.items.size,this};Wt.prototype.has=function(r){return this.items.has(r)};Wt.prototype.delete=function(r){var t=this.items.delete(r);return this.size=this.items.size,t};Wt.prototype.forEach=function(r,t){t=arguments.length>1?t:this,this.items.forEach(r,t)};Wt.prototype.entries=function(){return this.items.entries()};Wt.prototype.keys=function(){return this.items.keys()};Wt.prototype.values=function(){return this.items.values()};typeof Symbol!="undefined"&&(Wt.prototype[Symbol.iterator]=Wt.prototype.entries);Wt.prototype.inspect=function(){return this.items};typeof Symbol!="undefined"&&(Wt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Wt.prototype.inspect);Wt.autoIncrement=function(){var r=0;return function(){return r++}};bp.exports=Wt});var Tp=z((hA,Pp)=>{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);Pp.exports=ur});var Sp=z((cA,xp)=>{var Ru=oe();function hr(r){var t=Ru.getPointerArray(r),e=Ru.getPointerArray(Math.log2(r));this.size=r,this.dimension=r,this.parents=new t(r),this.ranks=new e(r);for(var n=0;na?this.parents[n]=e:(this.parents[n]=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=Ru.getPointerArray(this.dimension),t={},e=new r(this.size),n=0,s,a=0,h=this.parents.length;a{var Cp=Ln(),Fu=ws(),ax=Cp.DEFAULT_COMPARATOR,ux=Cp.reverseComparator;function hx(r,t,e,n){for(var s=e,a=n,h=t[n],l=2*n+1,p;l=0&&(l=p),t[n]=t[l],n=l,l=2*n+1;t[n]=h,Fu.siftDown(r,t,a,n)}function _p(r,t,e,n){for(var s=n,a=s,h=new r(n),l,p;a>0;)l=e[--a],a!==0&&(p=e[0],e[0]=l,hx(t,e,--n,0),l=p),h[a]=l;return h}function cr(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||ax,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=ux(this.comparator)}cr.prototype.clear=function(){this.size=0};cr.prototype.push=function(r){return this.size0&&Fu.replace(this.comparator,this.items,r),this.size};cr.prototype.peek=function(){return this.items[0]};cr.prototype.consume=function(){var r=_p(this.ArrayClass,this.comparator,this.items,this.size);return this.size=0,r};cr.prototype.toArray=function(){return _p(this.ArrayClass,this.comparator,this.items.slice(0,this.size),this.size)};cr.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:cr,enumerable:!1}),r};typeof Symbol!="undefined"&&(cr.prototype[Symbol.for("nodejs.util.inspect.custom")]=cr.prototype.inspect);Lp.exports=cr});var Op=z((fA,Ap)=>{var cx=dt(),Ep=function(r){return r};function Yt(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=Ep),this.readHashFunction||(this.readHashFunction=Ep),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.")}Yt.prototype.clear=function(){this.items.clear(),this.size=0};Yt.prototype.add=function(r){var t=this.writeHashFunction(r);return this.items.set(t,r),this.size=this.items.size,this};Yt.prototype.set=function(r,t){return r=this.writeHashFunction(r),this.items.set(r,t),this.size=this.items.size,this};Yt.prototype.get=function(r){return r=this.readHashFunction(r),this.items.get(r)};Yt.prototype.has=function(r){return r=this.readHashFunction(r),this.items.has(r)};Yt.prototype.forEach=function(r,t){t=arguments.length>1?t:this,this.items.forEach(function(e){r.call(t,e,e)})};Yt.prototype.values=function(){return this.items.values()};typeof Symbol!="undefined"&&(Yt.prototype[Symbol.iterator]=Yt.prototype.values);Yt.prototype.inspect=function(){var r=Array.from(this.items.values());return Object.defineProperty(r,"constructor",{value:Yt,enumerable:!1}),r};typeof Symbol!="undefined"&&(Yt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Yt.prototype.inspect);Yt.from=function(r,t,e){var n=new Yt(t);return cx(r,function(s,a){e?n.set(a,s):n.add(s)}),n};Ap.exports=Yt});var zu=z((pA,Dp)=>{var Ts=Nt(),lx=dt();function lt(r){this.Container=r||Array,this.items=new Map,this.clear(),Object.defineProperty(this.items,"constructor",{value:lt,enumerable:!1})}lt.prototype.clear=function(){this.size=0,this.dimension=0,this.items.clear()};lt.prototype.set=function(r,t){var e=this.items.get(r),n;return e||(this.dimension++,e=new this.Container,this.items.set(r,e)),this.Container===Set?(n=e.size,e.add(t),n1?t:this;var e;function n(s){r.call(t,s,e)}this.items.forEach(function(s,a){e=a,s.forEach(n)})};lt.prototype.forEachAssociation=function(r,t){t=arguments.length>1?t:this,this.items.forEach(r,t)};lt.prototype.keys=function(){return this.items.keys()};lt.prototype.values=function(){var r=this.items.values(),t=!1,e,n,s,a;return this.Container===Set?new Ts(function h(){if(!t){if(n=r.next(),n.done)return{done:!0};t=!0,e=n.value.values()}return n=e.next(),n.done?(t=!1,h()):{done:!1,value:n.value}}):new Ts(function h(){if(!t){if(n=r.next(),n.done)return{done:!0};t=!0,e=n.value,s=0,a=e.length}return s>=a?(t=!1,h()):{done:!1,value:e[s++]}})};lt.prototype.entries=function(){var r=this.items.entries(),t=!1,e,n,s,a,h;return this.Container===Set?new Ts(function l(){if(!t){if(n=r.next(),n.done)return{done:!0};t=!0,s=n.value[0],e=n.value[1].values()}return n=e.next(),n.done?(t=!1,l()):{done:!1,value:[s,n.value]}}):new Ts(function l(){if(!t){if(n=r.next(),n.done)return{done:!0};t=!0,s=n.value[0],e=n.value[1],a=0,h=e.length}return a>=h?(t=!1,l()):{done:!1,value:[s,e[a++]]}})};lt.prototype.containers=function(){return this.items.values()};lt.prototype.associations=function(){return this.items.entries()};typeof Symbol!="undefined"&&(lt.prototype[Symbol.iterator]=lt.prototype.entries);lt.prototype.inspect=function(){return this.items};typeof Symbol!="undefined"&&(lt.prototype[Symbol.for("nodejs.util.inspect.custom")]=lt.prototype.inspect);lt.prototype.toJSON=function(){return this.items};lt.from=function(r,t){var e=new lt(t);return lx(r,function(n,s){e.set(s,n)}),e};Dp.exports=lt});var kp=z((dA,Ip)=>{var fx=zu(),px=dt(),Mp=function(r){return r};function Xt(r,t){if(this.items=new fx(t),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/FuzzyMultiMap.constructor: invalid hash function given.");if(typeof this.readHashFunction!="function")throw new Error("mnemonist/FuzzyMultiMap.constructor: invalid hash function given.")}Xt.prototype.clear=function(){this.items.clear(),this.size=0,this.dimension=0};Xt.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};Xt.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};Xt.prototype.get=function(r){return r=this.readHashFunction(r),this.items.get(r)};Xt.prototype.has=function(r){return r=this.readHashFunction(r),this.items.has(r)};Xt.prototype.forEach=function(r,t){t=arguments.length>1?t:this,this.items.forEach(function(e){r.call(t,e,e)})};Xt.prototype.values=function(){return this.items.values()};typeof Symbol!="undefined"&&(Xt.prototype[Symbol.iterator]=Xt.prototype.values);Xt.prototype.inspect=function(){var r=Array.from(this);return Object.defineProperty(r,"constructor",{value:Xt,enumerable:!1}),r};typeof Symbol!="undefined"&&(Xt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Xt.prototype.inspect);Xt.from=function(r,t,e,n){arguments.length===3&&typeof e=="boolean"&&(n=e,e=Array);var s=new Xt(t,e);return px(r,function(a,h){n?s.set(h,a):s.add(a)}),s};Ip.exports=Xt});var zp=z((mA,Fp)=>{var Rp=1024;function dx(r){return(r&r-1)===0}function Ye(r,t){if(arguments.length<1)throw new Error("mnemonist/hashed-array-tree: expecting at least a byte array constructor.");var e=t||0,n=Rp,s=0;if(typeof t=="object"&&(e=t.initialCapacity||0,s=t.initialLength||0,n=t.blockSize||Rp),!n||!dx(n))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/n);this.ArrayClass=r,this.length=s,this.capacity=h*n,this.blockSize=n,this.offsetMask=n-1,this.blockMask=Math.log2(n),this.blocks=new Array(h);for(var l=0;l>this.blockMask,n=r&this.offsetMask;return this.blocks[e][n]=t,this};Ye.prototype.get=function(r){if(!(this.length>this.blockMask,e=r&this.offsetMask;return this.blocks[t][e]}};Ye.prototype.grow=function(r){if(typeof r!="number"&&(r=this.capacity+this.blockSize),this.capacity>=r)return this;for(;this.capacity>this.blockMask,n=t&this.offsetMask;return this.blocks[e][n]=r,++this.length};Ye.prototype.pop=function(){if(this.length!==0){var r=this.blocks[this.blocks.length-1],t=--this.length&this.offsetMask;return r[t]}};Ye.prototype.inspect=function(){for(var r=new this.ArrayClass(this.length),t,e=0,n=this.length;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:Ye,enumerable:!1}),r};typeof Symbol!="undefined"&&(Ye.prototype[Symbol.for("nodejs.util.inspect.custom")]=Ye.prototype.inspect);Fp.exports=Ye});var Nu=z((gA,Np)=>{var Vp=Nt(),Vu=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,n=this.items.length;e=t)return{done:!0};var n=r[t-e-1];return e++,{value:n,done:!1}})};kt.prototype.entries=function(){var r=this.items,t=this.size,e=0;return new Vp(function(){if(e>=t)return{done:!0};var n=r[t-e-1];return{value:[e++,n],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=Vu.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 n=new kt(t,e);if(Vu.isArrayLike(r)){var s,a;for(s=0,a=r.length;s{var mx=pe(),gx=oe(),yx=Nu();function Uu(r,t,e,n,s,a,h,l){var p=h+(l-h)/2|0,d=~-p,y=-~p,b=e[p];n[a]=b+1;var x=t?t(r[b]):r[b][1],C=a*2+1,O=a*2+2,D=-1/0,R=-1/0;h<=d&&(D=Uu(r,t,e,n,s,C,h,d)),y<=l&&(R=Uu(r,t,e,n,s,O,y,l));var H=Math.max(x,D,R),j=b;return H===D?j=s[n[C]-1]:H===R&&(j=s[n[O]-1]),s[b]=j,H}function lr(r,t){this.size=r.length,this.intervals=r;var e=null,n=null;Array.isArray(t)&&(e=t[0],n=t[1]);var s=r.length,a=gx.getPointerArray(s+1),h=new a(s),l;for(l=1;lC?1:0});var p=Math.ceil(Math.log2(s+1)),d=Math.pow(2,p)-1,y=new a(d),b=new a(s);Uu(r,n,h,y,b,0,0,s-1),h=null,this.height=p,this.tree=y,this.augmentations=b,this.startGetter=e,this.endGetter=n,this.stack=new yx(a,this.height)}lr.prototype.intervalsContainingPoint=function(r){var t=[],e=this.stack;e.clear(),e.push(0);for(var n=this.tree.length,s,a,h,l,p,d,y,b,x;e.size;)s=e.pop(),a=this.tree[s]-1,h=this.intervals[a],l=this.intervals[this.augmentations[a]],y=this.endGetter?this.endGetter(l):l[1],!(r>y)&&(b=s*2+1,b=p&&r<=d&&t.push(h),!(rx)&&(C=h*2+1,C=y&&t<=b&&n.push(p),!(e{Wr.search=function(r,t,e,n){var s=0;e=typeof e!="undefined"?e:0,n=typeof n!="undefined"?n:r.length,n--;for(var a;e<=n;)if(s=e+n>>>1,a=r[s],a>t)n=~-s;else if(a>>1,h=r(t[n],e),h>0)a=~-n;else if(h<0)s=-~n;else return n;return-1};Wr.lowerBound=function(r,t,e,n){var s=0;for(e=typeof e!="undefined"?e:0,n=typeof n!="undefined"?n:r.length;e>>1,t<=r[s]?n=s:e=-~s;return e};Wr.lowerBoundWithComparator=function(r,t,e){for(var n=0,s=0,a=t.length;s>>1,r(e,t[n])<=0?a=n:s=-~n;return s};Wr.lowerBoundIndices=function(r,t,e,n,s){var a=0;for(n=typeof n!="undefined"?n:0,s=typeof s!="undefined"?s:r.length;n>>1,e<=r[t[a]]?s=a:n=-~a;return n};Wr.upperBound=function(r,t,e,n){var s=0;for(e=typeof e!="undefined"?e:0,n=typeof n!="undefined"?n:r.length;e>>1,t>=r[s]?e=-~s:n=s;return e};Wr.upperBoundWithComparator=function(r,t,e){for(var n=0,s=0,a=t.length;s>>1,r(e,t[n])>=0?s=-~n:a=n;return s}});var Wp=z(qr=>{var Ui=oe(),ji=pe().isArrayLike,li=ju(),Gp=fs();function Hp(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 n=r[r.length-1],s=t[0];if(n<=s)return Ui.isTypedArray(r)?Ui.concat(r,t):r.concat(t);var a=new r.constructor(r.length+t.length),h,l,p;for(h=0,l=r.length;ht[0]&&(e=r,r=t,t=e);var n=r[r.length-1],s=t[0];if(nt[0]&&(e=r,r=t,t=e);var n=r[r.length-1],s=t[0];if(nb?p=li.lowerBound(t,y,p+1):(a.push(y),h++,p++);return a};function vx(r){var t=0,e=-1/0,n,s,a,h=[];for(s=0,a=r.length;se&&(e=n));if(h.length===0)return new r[0].constructor(0);if(h.length===1)return h[0].slice();if(h.length===2)return Hp(h[0],h[1]);r=h;var l=new r[0].constructor(t),p=Ui.getPointerArray(e),d=new p(r.length),y=new Gp(function(C,O){return C=r[C][d[C]],O=r[O][d[O]],CO?1:0});for(s=0;st&&(t=e));if(a.length===0)return new r[0].constructor(0);if(a.length===1)return a[0].slice();if(a.length===2)return Bp(a[0],a[1]);r=a;var h=new r[0].constructor,l=Ui.getPointerArray(t),p=new l(r.length),d=new Gp(function(x,C){return x=r[x][p[x]],C=r[C][p[C]],xC?1:0});for(n=0;nt&&(t=h),s=r[l][0],a=r[l][h-1],s>e&&(e=s),an)return[];if(e===n)return[e];var d,y,b=r[0],x,C,O,D,R,H,j=e;for(l=1;lH?C=li.lowerBound(y,R,C+1):(b.push(R),x++,C++);if(b.length===0)return b;j=b[0]}return b};qr.merge=function(){if(arguments.length===2){if(ji(arguments[0]))return Hp(arguments[0],arguments[1])}else if(ji(arguments[0]))return vx(arguments);return null};qr.unionUnique=function(){if(arguments.length===2){if(ji(arguments[0]))return Bp(arguments[0],arguments[1])}else if(ji(arguments[0]))return bx(arguments);return null};qr.intersectionUnique=function(){if(arguments.length===2){if(ji(arguments[0]))return qr.intersectionUniqueArrays(arguments[0],arguments[1])}else if(ji(arguments[0]))return qr.kWayIntersectionUniqueArrays(arguments);return null}});var Qp=z((wA,$p)=>{var wx=Nt(),Px=dt(),Tx=Wp();function qp(r){return r}function se(r){if(this.clear(),Array.isArray(r)?(this.documentTokenizer=r[0],this.queryTokenizer=r[1]):(this.documentTokenizer=r,this.queryTokenizer=r),this.documentTokenizer||(this.documentTokenizer=qp),this.queryTokenizer||(this.queryTokenizer=qp),typeof this.documentTokenizer!="function")throw new Error("mnemonist/InvertedIndex.constructor: document tokenizer is not a function.");if(typeof this.queryTokenizer!="function")throw new Error("mnemonist/InvertedIndex.constructor: query tokenizer is not a function.")}se.prototype.clear=function(){this.items=[],this.mapping=new Map,this.size=0,this.dimension=0};se.prototype.add=function(r){this.size++;var t=this.items.length;this.items.push(r);var e=this.documentTokenizer(r);if(!Array.isArray(e))throw new Error("mnemonist/InvertedIndex.add: tokenizer function should return an array of tokens.");for(var n=new Set,s,a,h=0,l=e.length;h1)for(s=1,a=t.length;s1?t:this;for(var e=0,n=this.documents.length;e=t)return{done:!0};var n=r[e++];return{value:n,done:!1}})};se.prototype.tokens=function(){return this.mapping.keys()};typeof Symbol!="undefined"&&(se.prototype[Symbol.iterator]=se.prototype.documents);se.prototype.inspect=function(){var r=this.items.slice();return Object.defineProperty(r,"constructor",{value:se,enumerable:!1}),r};typeof Symbol!="undefined"&&(se.prototype[Symbol.for("nodejs.util.inspect.custom")]=se.prototype.inspect);se.from=function(r,t){var e=new se(t);return Px(r,function(n){e.add(n)}),e};$p.exports=se});var Hu=z(Gu=>{var Ut=new Float64Array(64),wt=new Float64Array(64);function xx(r,t,e){var n,s,a,h,l;for(Ut[0]=t,wt[0]=e,s=0;s>=0;)if(a=Ut[s],h=wt[s]-1,a=n&&awt[s-1]-Ut[s-1]&&(l=Ut[s],Ut[s]=Ut[s-1],Ut[s-1]=l,l=wt[s],wt[s]=wt[s-1],wt[s-1]=l)}else s--;return r}Gu.inplaceQuickSort=xx;function Sx(r,t,e,n){var s,a,h,l,p,d;for(Ut[0]=e,wt[0]=n,a=0;a>=0;)if(h=Ut[a],l=wt[a]-1,h=s&&hwt[a-1]-Ut[a-1]&&(d=Ut[a],Ut[a]=Ut[a-1],Ut[a-1]=d,d=wt[a],wt[a]=wt[a-1],wt[a-1]=d)}else a--;return t}Gu.inplaceQuickSortIndices=Sx});var Zp=z((TA,Jp)=>{var Cx=pe(),xs=oe(),Kp=Ln().createTupleComparator,Yp=Ps(),_x=Hu().inplaceQuickSortIndices;function Bu(r,t,e,n){var s,a=0,h;for(s=0;s>>1),O=e[C],h[j]=O,b>-1&&(x===0?l[b]=j+1:p[b]=j+1),H=(H+1)%r,C!==D&&C!==R-1&&d.push([H,C+1,R,j,1]),C!==D&&d.push([H,D,C,j,0]),j++;return{axes:t,labels:n,pivots:h,lefts:l,rights:p}}function Re(r,t){this.dimensions=r,this.visited=0,this.axes=t.axes,this.labels=t.labels,this.pivots=t.pivots,this.lefts=t.lefts,this.rights=t.rights,this.size=this.labels.length}Re.prototype.nearestNeighbor=function(r){var t=1/0,e=null,n=this.dimensions,s=this.axes,a=this.pivots,h=this.lefts,l=this.rights,p=0;function d(y,b){p++;var x=h[b],C=l[b],O=a[b],D=Bu(n,s,O,r);if(!(D0?x!==0&&d(y,x-1):C!==0&&d(y,C-1),R*R0?C!==0&&d(y,C-1):x!==0&&d(y,x-1))}}return d(0,0),this.visited=p,this.labels[e]};var Ex=Kp(3),Ax=Kp(2);Re.prototype.kNearestNeighbors=function(r,t){if(r<=0)throw new Error("mnemonist/kd-tree.kNearestNeighbors: k should be a positive number.");if(r=Math.min(r,this.size),r===1)return[this.nearestNeighbor(t)];var e=new Yp(Array,Ex,r),n=this.dimensions,s=this.axes,a=this.pivots,h=this.lefts,l=this.rights,p=0;function d(x,C){var O=h[C],D=l[C],R=a[C],H=Bu(n,s,R,t);e.push([H,p++,R]);var j=t[x],Z=s[x][R],ht=j-Z;x=(x+1)%n,j{var td=Nt(),Ox=dt();function yt(){this.clear()}yt.prototype.clear=function(){this.head=null,this.tail=null,this.size=0};yt.prototype.first=function(){return this.head?this.head.item:void 0};yt.prototype.peek=yt.prototype.first;yt.prototype.last=function(){return this.tail?this.tail.item:void 0};yt.prototype.push=function(r){var t={item:r,next:null};return this.head?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this.size++,this.size};yt.prototype.unshift=function(r){var t={item:r,next:null};return this.head?(this.head.next||(this.tail=this.head),t.next=this.head,this.head=t):(this.head=t,this.tail=t),this.size++,this.size};yt.prototype.shift=function(){if(this.size){var r=this.head;return this.head=r.next,this.size--,r.item}};yt.prototype.forEach=function(r,t){if(this.size){t=arguments.length>1?t:this;for(var e=this.head,n=0;e;)r.call(t,e.item,n,this),e=e.next,n++}};yt.prototype.toArray=function(){if(!this.size)return[];for(var r=new Array(this.size),t=0,e=this.size,n=this.head;t{var Wu=Nt(),Dx=dt(),Mx=oe(),Ix=pe();function Et(r,t,e){if(arguments.length<2&&(e=r,r=null,t=null),this.capacity=e,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-cache: capacity should be a finite positive integer.");var n=Mx.getPointerArray(e);this.forward=new n(e),this.backward=new n(e),this.K=typeof r=="function"?new r(e):new Array(e),this.V=typeof t=="function"?new t(e):new Array(e),this.size=0,this.head=0,this.tail=0,this.items={}}Et.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}};Et.prototype.splayOnTop=function(r){var t=this.head;if(this.head===r)return this;var e=this.backward[r],n=this.forward[r];return this.tail===r?this.tail=e:this.backward[n]=e,this.forward[e]=n,this.backward[t]=r,this.head=r,this.forward[r]=t,this};Et.prototype.set=function(r,t){var e=this.items[r];if(typeof e!="undefined"){this.splayOnTop(e),this.V[e]=t;return}this.size1?t:this;for(var e=0,n=this.size,s=this.head,a=this.K,h=this.V,l=this.forward;e=t)return{done:!0};var a=n[e];return r++,r=t)return{done:!0};var a=n[e];return r++,r=t)return{done:!0};var h=n[e],l=s[e];return r++,r{var Gi=Ss(),kx=dt(),Rx=oe(),Fx=pe();function fr(r,t,e){arguments.length<2?Gi.call(this,r):Gi.call(this,r,t,e);var n=Rx.getPointerArray(this.capacity);this.deleted=new n(this.capacity),this.deletedSize=0}for(qu in Gi.prototype)fr.prototype[qu]=Gi.prototype[qu];var qu;typeof Symbol!="undefined"&&(fr.prototype[Symbol.iterator]=Gi.prototype[Symbol.iterator]);fr.prototype.clear=function(){Gi.prototype.clear.call(this),this.deletedSize=0};fr.prototype.set=function(r,t){var e=this.items[r];if(typeof e!="undefined"){this.splayOnTop(e),this.V[e]=t;return}this.size0?e=this.deleted[--this.deletedSize]:e=this.size,this.size++):(e=this.tail,this.tail=this.backward[e],delete this.items[this.K[e]]),this.items[r]=e,this.K[e]=r,this.V[e]=t,this.forward[e]=this.head,this.backward[this.head]=e,this.head=e};fr.prototype.setpop=function(r,t){var e=null,n=null,s=this.items[r];return typeof s!="undefined"?(this.splayOnTop(s),e=this.V[s],this.V[s]=t,{evicted:!1,key:r,value:e}):(this.size0?s=this.deleted[--this.deletedSize]:s=this.size,this.size++):(s=this.tail,this.tail=this.backward[s],e=this.V[s],n=this.K[s],delete this.items[this.K[s]]),this.items[r]=s,this.K[s]=r,this.V[s]=t,this.forward[s]=this.head,this.backward[this.head]=s,this.head=s,n?{evicted:!0,key:n,value:e}:null)};fr.prototype.delete=function(r){var t=this.items[r];if(typeof t=="undefined")return!1;if(delete this.items[r],this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,!0;var e=this.backward[t],n=this.forward[t];return this.head===t&&(this.head=n),this.tail===t&&(this.tail=e),this.forward[e]=n,this.backward[n]=e,this.size--,this.deleted[this.deletedSize++]=t,!0};fr.prototype.remove=function(r,t=void 0){var e=this.items[r];if(typeof e=="undefined")return t;var n=this.V[e];if(delete this.items[r],this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,n;var s=this.backward[e],a=this.forward[e];return this.head===e&&(this.head=a),this.tail===e&&(this.tail=s),this.forward[s]=a,this.backward[a]=s,this.size--,this.deleted[this.deletedSize++]=e,n};fr.from=function(r,t,e,n){if(arguments.length<2){if(n=Fx.guessLength(r),typeof n!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(n=t,t=null,e=null);var s=new fr(t,e,n);return kx(r,function(a,h){s.set(h,a)}),s};nd.exports=fr});var $u=z((_A,sd)=>{var Hi=Ss(),zx=dt(),Vx=oe(),Nx=pe();function qt(r,t,e){if(arguments.length<2&&(e=r,r=null,t=null),this.capacity=e,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-map: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-map: capacity should be a finite positive integer.");var n=Vx.getPointerArray(e);this.forward=new n(e),this.backward=new n(e),this.K=typeof r=="function"?new r(e):new Array(e),this.V=typeof t=="function"?new t(e):new Array(e),this.size=0,this.head=0,this.tail=0,this.items=new Map}qt.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()};qt.prototype.set=function(r,t){var e=this.items.get(r);if(typeof e!="undefined"){this.splayOnTop(e),this.V[e]=t;return}this.size{var Bi=$u(),Ux=dt(),jx=oe(),Gx=pe();function pr(r,t,e){arguments.length<2?Bi.call(this,r):Bi.call(this,r,t,e);var n=jx.getPointerArray(this.capacity);this.deleted=new n(this.capacity),this.deletedSize=0}for(Qu in Bi.prototype)pr.prototype[Qu]=Bi.prototype[Qu];var Qu;typeof Symbol!="undefined"&&(pr.prototype[Symbol.iterator]=Bi.prototype[Symbol.iterator]);pr.prototype.clear=function(){Bi.prototype.clear.call(this),this.deletedSize=0};pr.prototype.set=function(r,t){var e=this.items.get(r);if(typeof e!="undefined"){this.splayOnTop(e),this.V[e]=t;return}this.size0?e=this.deleted[--this.deletedSize]:e=this.size,this.size++):(e=this.tail,this.tail=this.backward[e],this.items.delete(this.K[e])),this.items.set(r,e),this.K[e]=r,this.V[e]=t,this.forward[e]=this.head,this.backward[this.head]=e,this.head=e};pr.prototype.setpop=function(r,t){var e=null,n=null,s=this.items.get(r);return typeof s!="undefined"?(this.splayOnTop(s),e=this.V[s],this.V[s]=t,{evicted:!1,key:r,value:e}):(this.size0?s=this.deleted[--this.deletedSize]:s=this.size,this.size++):(s=this.tail,this.tail=this.backward[s],e=this.V[s],n=this.K[s],this.items.delete(this.K[s])),this.items.set(r,s),this.K[s]=r,this.V[s]=t,this.forward[s]=this.head,this.backward[this.head]=s,this.head=s,n?{evicted:!0,key:n,value:e}:null)};pr.prototype.delete=function(r){var t=this.items.get(r);if(typeof t=="undefined")return!1;if(this.items.delete(r),this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,!0;var e=this.backward[t],n=this.forward[t];return this.head===t&&(this.head=n),this.tail===t&&(this.tail=e),this.forward[e]=n,this.backward[n]=e,this.size--,this.deleted[this.deletedSize++]=t,!0};pr.prototype.remove=function(r,t=void 0){var e=this.items.get(r);if(typeof e=="undefined")return t;var n=this.V[e];if(this.items.delete(r),this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,n;var s=this.backward[e],a=this.forward[e];return this.head===e&&(this.head=a),this.tail===e&&(this.tail=s),this.forward[s]=a,this.backward[a]=s,this.size--,this.deleted[this.deletedSize++]=e,n};pr.from=function(r,t,e,n){if(arguments.length<2){if(n=Gx.guessLength(r),typeof n!="number")throw new Error("mnemonist/lru-map.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(n=t,t=null,e=null);var s=new pr(t,e,n);return Ux(r,function(a,h){s.set(h,a)}),s};ad.exports=pr});var cd=z((EA,hd)=>{var Hx=Nt(),Bx=dt(),Wx=Ps(),qx=function(r,t){return r[1]>t[1]?-1:r[1] 0.");for(var t=new Wx(Array,qx,r),e=this.items.entries(),n;n=e.next(),!n.done;)t.push(n.value);return t.consume()};et.prototype.forEach=function(r,t){t=arguments.length>1?t:this;var e;this.items.forEach(function(n,s){for(e=0;e1?t:this,this.items.forEach(r,t)};et.prototype.keys=function(){return this.items.keys()};et.prototype.values=function(){var r=this.items.entries(),t=!1,e,n,s,a;return new Hx(function h(){if(!t){if(e=r.next(),e.done)return{done:!0};t=!0,n=e.value[0],s=e.value[1],a=0}return a>=s?(t=!1,h()):(a++,{done:!1,value:n})})};et.prototype.multiplicities=function(){return this.items.entries()};typeof Symbol!="undefined"&&(et.prototype[Symbol.iterator]=et.prototype.values);et.prototype.inspect=function(){return this.items};typeof Symbol!="undefined"&&(et.prototype[Symbol.for("nodejs.util.inspect.custom")]=et.prototype.inspect);et.prototype.toJSON=function(){return this.items};et.from=function(r){var t=new et;return Bx(r,function(e){t.add(e)}),t};et.isSubset=function(r,t){var e=r.multiplicities(),n,s,a;if(r===t)return!0;if(r.dimension>t.dimension)return!1;for(;n=e.next(),!n.done;)if(s=n.value[0],a=n.value[1],t.multiplicity(s){var $x=Nt(),Qx=dt();function Kx(r,t,e){return((Math.pow(r,2)-Math.pow(Math.abs(t-e),2))/2|0)+r+1}function Yx(r,t){for(var e=0,n=0,s=t+1;nt.length?-1:r.lengtht?1:0}function ld(r,t){var e=r+1,n=t/e|0,s=n+1,a,h,l=t-n*e,p=e-l,d=new Array(r+1);for(a=0;a 0");this.levenshtein=r,this.k=t,this.clear()}Ct.prototype.clear=function(){this.size=0,this.strings=[],this.invertedIndices={}};Ct.prototype.add=function(r){var t=r.length,e=this.size;this.strings.push(r),this.size++;var n=fd(this.k,r),s=this.invertedIndices[t];typeof s=="undefined"&&(s={},this.invertedIndices[t]=s);var a,h,l,p,d;for(p=0,d=n.length;p1?t:this;for(var e=0,n=this.strings.length;e=t)return{done:!0};var n=r[e];return e++,{value:n,done:!1}})};typeof Symbol!="undefined"&&(Ct.prototype[Symbol.iterator]=Ct.prototype.values);Ct.prototype.inspect=function(){var r=this.strings.slice();return 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){var n=new Ct(t,e);return Qx(r,function(s){n.add(s)}),n};Ct.countKeys=Yx;Ct.comparator=Xx;Ct.partition=ld;Ct.segments=fd;Ct.segmentPos=Jx;Ct.multiMatchAwareInterval=pd;Ct.multiMatchAwareSubstrings=dd;md.exports=Ct});var bd=z((OA,vd)=>{var yd=Nt(),Zx=dt();function _t(){this.clear()}_t.prototype.clear=function(){this.items=[],this.offset=0,this.size=0};_t.prototype.enqueue=function(r){return this.items.push(r),++this.size};_t.prototype.dequeue=function(){if(this.size){var r=this.items[this.offset];return++this.offset*2>=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,r}};_t.prototype.peek=function(){if(this.size)return this.items[this.offset]};_t.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=this.offset,n=0,s=this.items.length;e=r.length)return{done:!0};var e=r[t];return t++,{value:e,done:!1}})};_t.prototype.entries=function(){var r=this.items,t=this.offset,e=0;return new yd(function(){if(t>=r.length)return{done:!0};var n=r[t];return t++,{value:[e++,n],done:!1}})};typeof Symbol!="undefined"&&(_t.prototype[Symbol.iterator]=_t.prototype.values);_t.prototype.toString=function(){return this.toArray().join(",")};_t.prototype.toJSON=function(){return this.toArray()};_t.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:_t,enumerable:!1}),r};typeof Symbol!="undefined"&&(_t.prototype[Symbol.for("nodejs.util.inspect.custom")]=_t.prototype.inspect);_t.from=function(r){var t=new _t;return Zx(r,function(e){t.enqueue(e)}),t};_t.of=function(){return _t.from(arguments)};vd.exports=_t});var Td=z((DA,Pd)=>{var wd=Nt(),tS=dt();function Lt(){this.clear()}Lt.prototype.clear=function(){this.items=[],this.size=0};Lt.prototype.push=function(r){return this.items.push(r),++this.size};Lt.prototype.pop=function(){if(this.size!==0)return this.size--,this.items.pop()};Lt.prototype.peek=function(){return this.items[this.size-1]};Lt.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=0,n=this.items.length;e=t)return{done:!0};var n=r[t-e-1];return e++,{value:n,done:!1}})};Lt.prototype.entries=function(){var r=this.items,t=r.length,e=0;return new wd(function(){if(e>=t)return{done:!0};var n=r[t-e-1];return{value:[e++,n],done:!1}})};typeof Symbol!="undefined"&&(Lt.prototype[Symbol.iterator]=Lt.prototype.values);Lt.prototype.toString=function(){return this.toArray().join(",")};Lt.prototype.toJSON=function(){return this.toArray()};Lt.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:Lt,enumerable:!1}),r};typeof Symbol!="undefined"&&(Lt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Lt.prototype.inspect);Lt.from=function(r){var t=new Lt;return tS(r,function(e){t.push(e)}),t};Lt.of=function(){return Lt.from(arguments)};Pd.exports=Lt});var xd=z(Rt=>{Rt.intersection=function(){if(arguments.length<2)throw new Error("mnemonist/Set.intersection: needs at least two arguments.");var r=new Set,t=1/0,e=null,n,s,a=arguments.length;for(s=0;st.size)return!1;for(;n=e.next(),!n.done;)if(!t.has(n.value))return!1;return!0};Rt.isSuperset=function(r,t){return Rt.isSubset(t,r)};Rt.add=function(r,t){for(var e=t.values(),n;n=e.next(),!n.done;)r.add(n.value)};Rt.subtract=function(r,t){for(var e=t.values(),n;n=e.next(),!n.done;)r.delete(n.value)};Rt.intersect=function(r,t){for(var e=r.values(),n;n=e.next(),!n.done;)t.has(n.value)||r.delete(n.value)};Rt.disjunct=function(r,t){for(var e=r.values(),n,s=[];n=e.next(),!n.done;)t.has(n.value)&&s.push(n.value);for(e=t.values();n=e.next(),!n.done;)r.has(n.value)||r.add(n.value);for(var a=0,h=s.length;at.size&&(e=r,r=t,t=e),r.size===0)return 0;if(r===t)return r.size;for(var n=r.values(),s,a=0;s=n.next(),!s.done;)t.has(s.value)&&a++;return a};Rt.unionSize=function(r,t){var e=Rt.intersectionSize(r,t);return r.size+t.size-e};Rt.jaccard=function(r,t){var e=Rt.intersectionSize(r,t);if(e===0)return 0;var n=r.size+t.size-e;return e/n};Rt.overlap=function(r,t){var e=Rt.intersectionSize(r,t);return e===0?0:e/Math.min(r.size,t.size)}});var Cd=z((IA,Sd)=>{var eS=Nt(),rS=oe().getPointerArray;function xe(r){var t=rS(r);this.start=0,this.size=0,this.capacity=r,this.dense=new t(r),this.sparse=new t(r)}xe.prototype.clear=function(){this.start=0,this.size=0};xe.prototype.has=function(r){if(this.size===0)return!1;var t=this.sparse[r],e=t=this.start&&t=this.start&&t1?t:this;for(var e=this.capacity,n=this.size,s=this.start,a=0;a=e)return{done:!0};var a=r[n];return n++,s++,n===t&&(n=0),{value:a,done:!1}})};typeof Symbol!="undefined"&&(xe.prototype[Symbol.iterator]=xe.prototype.values);xe.prototype.inspect=function(){var r=[];return this.forEach(function(t){r.push(t)}),Object.defineProperty(r,"constructor",{value:xe,enumerable:!1}),r.capacity=this.capacity,r};typeof Symbol!="undefined"&&(xe.prototype[Symbol.for("nodejs.util.inspect.custom")]=xe.prototype.inspect);Sd.exports=xe});var Ld=z((kA,_d)=>{var Ku=Nt(),iS=oe().getPointerArray;function Jt(r,t){arguments.length<2&&(t=r,r=Array);var e=iS(t);this.size=0,this.length=t,this.dense=new e(t),this.sparse=new e(t),this.vals=new r(t)}Jt.prototype.clear=function(){this.size=0};Jt.prototype.has=function(r){var t=this.sparse[r];return t=this.size||this.dense[t]!==r?!1:(t=this.dense[this.size-1],this.dense[this.sparse[r]]=t,this.sparse[t]=this.sparse[r],this.size--,!0)};Jt.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=0;e{var nS=Nt(),oS=oe().getPointerArray;function Se(r){var t=oS(r);this.size=0,this.length=r,this.dense=new t(r),this.sparse=new t(r)}Se.prototype.clear=function(){this.size=0};Se.prototype.has=function(r){var t=this.sparse[r];return t=this.size||this.dense[t]!==r?!1:(t=this.dense[this.size-1],this.dense[this.sparse[r]]=t,this.sparse[t]=this.sparse[r],this.size--,!0)};Se.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e,n=0;n{var sS=dt(),aS=2,uS=2,hS=new Set([0,1,2]),cS={0:"Returns only the top suggestion",1:"Returns suggestions with the smallest edit distance",2:"Returns every suggestion (no early termination)"};function Cs(r){var t=new Set;return typeof r=="number"&&t.add(r),{suggestions:t,count:0}}function Od(r,t,e){return{term:r||"",distance:t||0,count:e||0}}function Md(r,t,e,n){n=n||new Set,t++;var s,a=r.length,h;if(a>1)for(h=0;h0&&r[h].length-a.length>n.length-a.length&&(e.suggestions=new Set,e.count=0),(t===2||!e.suggestions.size||r[h].length-a.length>=n.length-a.length)&&e.suggestions.add(s)}function Dd(r,t){var e=r.length,n=t.length,s=[[]],a=e+n,h=new Map,l,p,d;for(s[0][0]=a,l=0;l<=e;l++)s[l+1]||(s[l+1]=[]),s[l+1][1]=l,s[l+1][0]=a;for(d=0;d<=n;d++)s[1][d+1]=d,s[0][d+1]=a;var y=r+t,b;for(l=0,p=y.length;ls)return[];for(var l=[a],p=new Set,d=new Set,y=[],b,x;l.length>0&&(b=l.shift(),!(e<2&&y.length>0&&h-b.length>y[0].distance));){if(x=r[b],x!==void 0){if(typeof x=="number"&&(x=Cs(x)),x.count>0&&!d.has(b)){d.add(b);var C=Od(b,h-b.length,x.count);if(y.push(C),e<2&&h-b.length===0)break}x.suggestions.forEach(H=>{var j=t[H];if(!d.has(j)){d.add(j);var Z=0;if(a!==j)if(j.length===b.length)Z=h-b.length;else if(h===b.length)Z=j.length-b.length;else{for(var ht=0,At=0,ze=j.length;ht0||At>0?Z=Dd(j.substr(ht,ze-ht-At),a.substr(ht,h-ht-At)):Z=Dd(j,a)}if(e<2&&y.length>0&&y[0].distance>Z&&(y=[]),!(e<2&&y.length>0&&Z>y[0].distance)&&Z<=n){var Ce=r[j];Ce!==void 0&&y.push(Od(j,Z,Ce.count))}}})}if(h-b.length0&&h-b.length>=y[0].distance)continue;for(var O=0,D=b.length;Othis.maxLength&&(this.maxLength=r.length)),t.count===1){var e=this.words.length;this.words.push(r);var n=Md(r,0,this.maxDistance);n.forEach(s=>{var a=this.dictionary[s];a!==void 0?(typeof a=="number"&&(a=Cs(a),this.dictionary[s]=a),a.suggestions.has(e)||lS(this.words,this.verbosity,a,r,e,s)):this.dictionary[s]=e})}return this.size++,this};dr.prototype.search=function(r){return fS(this.dictionary,this.words,this.verbosity,this.maxDistance,this.maxLength,r)};dr.prototype.inspect=function(){var r=[];r.size=this.size,r.maxDistance=this.maxDistance,r.verbosity=this.verbosity,r.behavior=cS[this.verbosity];for(var t in this.dictionary)typeof this.dictionary[t]=="object"&&this.dictionary[t].count&&r.push([t,this.dictionary[t].count]);return Object.defineProperty(r,"constructor",{value:dr,enumerable:!1}),r};typeof Symbol!="undefined"&&(dr.prototype[Symbol.for("nodejs.util.inspect.custom")]=dr.prototype.inspect);dr.from=function(r,t){var e=new dr(t);return sS(r,function(n){e.add(n)}),e};Id.exports=dr});var Yu=z((zA,Rd)=>{var pS=dt(),Wi=Nt(),jt=String.fromCharCode(0);function vt(r){this.mode=r===Array?"array":"string",this.clear()}vt.prototype.clear=function(){this.root={},this.size=0};vt.prototype.set=function(r,t){for(var e=this.root,n,s=0,a=r.length;s1&&(e=null,n=null):Object.keys(t).length<2&&(e=s,n=a)}return jt in t?(this.size--,e?delete e[n]:delete t[jt],!0):!1};vt.prototype.has=function(r){for(var t=this.root,e,n=0,s=r.length;n{var dS=dt(),Fd=Yu(),_s=String.fromCharCode(0);function Gt(r){this.mode=r===Array?"array":"string",this.clear()}for(Xu in Fd.prototype)Gt.prototype[Xu]=Fd.prototype[Xu];var Xu;delete Gt.prototype.set;delete Gt.prototype.get;delete Gt.prototype.values;delete Gt.prototype.entries;Gt.prototype.add=function(r){for(var t=this.root,e,n=0,s=r.length;n{var Nd=Nt(),mS=dt(),gS=pe(),Ud=oe(),yS=function(r){return Math.max(1,Math.ceil(r*1.5))},vS=function(r){var t=Ud.getPointerArray(r);return new t(r)};function J(r,t){if(arguments.length<1)throw new Error("mnemonist/vector: expecting at least a byte array constructor.");var e=t||0,n=yS,s=0,a=!1;typeof t=="object"&&(e=t.initialCapacity||0,s=t.initialLength||0,n=t.policy||n,a=t.factory===!0),this.factory=a?r:null,this.ArrayClass=r,this.length=s,this.capacity=Math.max(s,e),this.policy=n,this.array=new r(this.capacity)}J.prototype.set=function(r,t){if(this.lengththis.capacity)if(this.factory===null?this.array=new this.ArrayClass(r):this.array=this.factory(r),Ud.isTypedArray(this.array))this.array.set(t,0);else for(var e=0,n=this.length;e=r)return this;for(t=this.capacity;t=t)return{done:!0};var n=r[e];return e++,{value:n,done:!1}})};J.prototype.entries=function(){var r=this.array,t=this.length,e=0;return new Nd(function(){if(e>=t)return{done:!0};var n=r[e];return{value:[e++,n],done:!1}})};typeof Symbol!="undefined"&&(J.prototype[Symbol.iterator]=J.prototype.values);J.prototype.inspect=function(){var r=this.array.slice(0,this.length);return r.type=this.array.constructor.name,r.items=this.length,r.capacity=this.capacity,Object.defineProperty(r,"constructor",{value:J,enumerable:!1}),r};typeof Symbol!="undefined"&&(J.prototype[Symbol.for("nodejs.util.inspect.custom")]=J.prototype.inspect);J.from=function(r,t,e){if(arguments.length<3&&(e=gS.guessLength(r),typeof e!="number"))throw new Error("mnemonist/vector.from: could not guess iterable length. Please provide desired capacity as last argument.");var n=new J(t,e);return mS(r,function(s){n.push(s)}),n};function mr(r){var t=function(n){J.call(this,r,n)};for(var e in J.prototype)J.prototype.hasOwnProperty(e)&&(t.prototype[e]=J.prototype[e]);return t.from=function(n,s){return J.from(n,r,s)},typeof Symbol!="undefined"&&(t.prototype[Symbol.iterator]=t.prototype.values),t}J.Int8Vector=mr(Int8Array);J.Uint8Vector=mr(Uint8Array);J.Uint8ClampedVector=mr(Uint8ClampedArray);J.Int16Vector=mr(Int16Array);J.Uint16Vector=mr(Uint16Array);J.Int32Vector=mr(Int32Array);J.Uint32Vector=mr(Uint32Array);J.Float32Vector=mr(Float32Array);J.Float64Vector=mr(Float64Array);J.PointerVector=mr(vS);jd.exports=J});var Bd=z((UA,Hd)=>{var bS=pe(),wS=oe(),PS=Hu().inplaceQuickSortIndices,TS=ju().lowerBoundIndices,xS=ws(),SS=wS.getPointerArray;function CS(r,t){return r.distancet.distance?-1:0}function _S(r,t,e){for(var n=e.length,s=SS(n),a=0,h=new s(n),l=new s(n),p=new s(n),d=new Float64Array(n),y=[0,0,n],b=new Float64Array(n),x,C,O,D,R,H,j,Z,ht;y.length;)if(R=y.pop(),D=y.pop(),x=y.pop(),C=e[R-1],R--,ht=R-D,h[x]=C,ht!==0){if(ht===1){j=r(t[C],t[e[D]]),d[x]=j,a++,p[x]=a,h[a]=e[D];continue}for(Z=D;Z0&&(a++,p[x]=a,y.push(a,H,R)),H-D>0&&(a++,l[x]=a,y.push(a,D,H))}return{nodes:h,lefts:l,rights:p,mus:d}}function Er(r,t){if(typeof r!="function")throw new Error("mnemonist/VPTree.constructor: given `distance` must be a function.");if(!t)throw new Error("mnemonist/VPTree.constructor: you must provide items to the tree. A VPTree cannot be updated after its creation.");this.distance=r,this.heap=new xS(CS),this.D=0;var e=bS.toArrayWithIndices(t);this.items=e[0];var n=e[1];this.size=n.length;var s=_S(r,this.items,n);this.nodes=s.nodes,this.lefts=s.lefts,this.rights=s.rights,this.mus=s.mus}Er.prototype.nearestNeighbors=function(r,t){var e=this.heap,n=[0],s=1/0,a,h,l,p,d,y,b;for(this.D=0;n.length;)a=n.pop(),h=this.nodes[a],l=this.items[h],b=this.distance(l,t),this.D++,br&&e.pop(),e.size>=r&&(s=e.peek().distance)),p=this.lefts[a],d=this.rights[a],!(!p&&!d)&&(y=this.mus[a],b=y-s&&n.push(d)):(d&&b>=y-s&&n.push(d),p&&b=0;C--)x[C]=e.pop();return x};Er.prototype.neighbors=function(r,t){var e=[],n=[0],s,a,h,l,p,d,y;for(this.D=0;n.length;)s=n.pop(),a=this.nodes[s],h=this.items[a],y=this.distance(h,t),this.D++,y<=r&&e.push({distance:y,item:h}),l=this.lefts[s],p=this.rights[s],!(!l&&!p)&&(d=this.mus[s],y=d-r&&n.push(p)):(p&&y>=d-r&&n.push(p),l&&y{var Ju=ws(),Zu=fs(),Wd=Hf();qd.exports={BiMap:Qf(),BitSet:ep(),BitVector:op(),BloomFilter:lp(),BKTree:pp(),CircularBuffer:vp(),DefaultMap:wp(),DefaultWeakMap:Tp(),FixedDeque:Mu(),StaticDisjointSet:Sp(),FibonacciHeap:Zu,MinFibonacciHeap:Zu.MinFibonacciHeap,MaxFibonacciHeap:Zu.MaxFibonacciHeap,FixedReverseHeap:Ps(),FuzzyMap:Op(),FuzzyMultiMap:kp(),HashedArrayTree:zp(),Heap:Ju,MinHeap:Ju.MinHeap,MaxHeap:Ju.MaxHeap,StaticIntervalTree:jp(),InvertedIndex:Qp(),KDTree:Zp(),LinkedList:rd(),LRUCache:Ss(),LRUCacheWithDelete:od(),LRUMap:$u(),LRUMapWithDelete:ud(),MultiMap:zu(),MultiSet:cd(),PassjoinIndex:gd(),Queue:bd(),FixedStack:Nu(),Stack:Td(),SuffixArray:Wd,GeneralizedSuffixArray:Wd.GeneralizedSuffixArray,Set:xd(),SparseQueueSet:Cd(),SparseMap:Ld(),SparseSet:Ad(),SymSpell:kd(),Trie:Vd(),TrieMap:Yu(),Vector:Gd(),VPTree:Bd()}});var M=class r{static get ZERO(){return new r(0,0)}static get ONE(){return new r(1,1)}static get UP(){return new r(0,-1)}static get DOWN(){return new r(0,1)}static get LEFT(){return new r(-1,0)}static get RIGHT(){return new r(1,0)}static get UP_LEFT(){return new r(-1,-1)}static get UP_RIGHT(){return new r(1,-1)}static get DOWN_RIGHT(){return new r(1,1)}static get DOWN_LEFT(){return new r(-1,1)}constructor(t,e){typeof t=="number"?(this.x=t,this.y=e||0):(this.x=t.x,this.y=t.y)}clone(){return new r(this.x,this.y)}add(t){return new r(this.x+t.x,this.y+t.y)}multiply(t){return new r(this.x*t.x,this.y*t.y)}divide(t){return new r(this.x/t.x,this.y/t.y)}subtract(t){return new r(this.x-t.x,this.y-t.y)}equals(t){return this.x===t.x&&this.y===t.y}abs(){return new r(Math.abs(this.x),Math.abs(this.y))}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}modulo(t){return new r(this.x%t.x,this.y%t.y)}scalarModulo(t){return new r(this.x%t,this.y%t)}scalarMult(t){return new r(this.x*t,this.y*t)}toPosition(){return{x:this.x,y:this.y}}toString(){return`${this.x}#${this.y}`}};var G=class{static equal(t,e){return t.position.x===e.position.x&&t.position.y===e.position.y&&t.layer===e.layer}static copyOver(t,e){e.position.x=t.position.x,e.position.y=t.position.y,e.layer=t.layer}static clone(t){return{position:t.position.clone(),layer:t.layer}}static toString(t){return`${t.position.toString()}#${t.layer}`}static toInternal(t){return{position:new M(t.position.x,t.position.y),layer:t.charLayer}}static fromInternal(t){return{position:t.position.toPosition(),charLayer:t.layer}}};var we=(d=>(d.NONE="none",d.LEFT="left",d.UP_LEFT="up-left",d.UP="up",d.UP_RIGHT="up-right",d.RIGHT="right",d.DOWN_RIGHT="down-right",d.DOWN="down",d.DOWN_LEFT="down-left",d))(we||{}),sT={up:"down",down:"up",left:"right",right:"left",none:"none","up-left":"down-right","up-right":"down-left","down-right":"up-left","down-left":"up-right"},aT={up:M.UP,down:M.DOWN,left:M.LEFT,right:M.RIGHT,none:M.ZERO,"up-left":M.UP_LEFT,"up-right":M.UP_RIGHT,"down-right":M.DOWN_RIGHT,"down-left":M.DOWN_LEFT},uT={left:"up-left","up-left":"up",up:"up-right","up-right":"right",right:"down-right","down-right":"down",down:"down-left","down-left":"left",none:"none"},hT={left:"down-left","up-left":"left",up:"up-left","up-right":"up",right:"up-right","down-right":"right",down:"down-right","down-left":"down",none:"none"},cT=["down-left","down-right","up-right","up-left"];function bn(){return["up","down","left","right","none","up-left","up-right","down-right","down-left"]}function Ai(r){return cT.includes(r)}function cu(r){return["left","right"].includes(r)}function Ql(r){return["up","down"].includes(r)}function Kl(r){return hT[r]}function ko(r){return uT[r]}function We(r){return aT[r]}function Yl(r){return sT[r]}function re(r,t){if(r.x===t.x){if(r.y>t.y)return"up";if(r.yt.x)return"left";if(r.xt.x){if(r.yt.y)return"up-left"}else if(r.xt.y)return"up-right"}return"none"}var Ur=(e=>(e[e.FOUR=4]="FOUR",e[e.EIGHT=8]="EIGHT",e))(Ur||{});function jr(r){return typeof r=="string"&&bn().includes(r)}var lu=function(r,t){return lu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])},lu(r,t)};function Gr(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");lu(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function Xl(r,t,e,n){function s(a){return a instanceof e?a:new e(function(h){h(a)})}return new(e||(e=Promise))(function(a,h){function l(y){try{d(n.next(y))}catch(b){h(b)}}function p(y){try{d(n.throw(y))}catch(b){h(b)}}function d(y){y.done?a(y.value):s(y.value).then(l,p)}d((n=n.apply(r,t||[])).next())})}function Ro(r,t){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,s,a,h;return h={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function l(d){return function(y){return p([d,y])}}function p(d){if(n)throw new TypeError("Generator is already executing.");for(;h&&(h=0,d[0]&&(e=0)),e;)try{if(n=1,s&&(a=d[0]&2?s.return:d[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,d[1])).done)return a;switch(s=0,a&&(d=[d[0]&2,a.value]),d[0]){case 0:case 1:a=d;break;case 4:return e.label++,{value:d[1],done:!1};case 5:e.label++,s=d[1],d=[0];continue;case 7:d=e.ops.pop(),e.trys.pop();continue;default:if(a=e.trys,!(a=a.length>0&&a[a.length-1])&&(d[0]===6||d[0]===2)){e=0;continue}if(d[0]===3&&(!a||d[1]>a[0]&&d[1]=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function er(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],h;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){h={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(h)throw h.error}}return a}function rr(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n1||l(x,C)})})}function l(x,C){try{p(n[x](C))}catch(O){b(a[0][3],O)}}function p(x){x.value instanceof ni?Promise.resolve(x.value.v).then(d,y):b(a[0][2],x)}function d(x){l("next",x)}function y(x){l("throw",x)}function b(x,C){x(C),a.shift(),a.length&&l(a[0][0],a[0][1])}}function Zl(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof _r=="function"?_r(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(a){e[a]=r[a]&&function(h){return new Promise(function(l,p){h=r[a](h),s(l,p,h.done,h.value)})}}function s(a,h,l,p){Promise.resolve(p).then(function(d){a({value:d,done:l})},h)}}function tt(r){return typeof r=="function"}function Fo(r){var t=function(n){Error.call(n),n.stack=new Error().stack},e=r(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var zo=Fo(function(r){return function(e){r(this),this.message=e?e.length+` errors occurred during unsubscription: `+e.map(function(n,s){return s+1+") "+n.toString()}).join(` - `):"",this.name="UnsubscriptionError",this.errors=e}});function wn(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var Oi=function(){function r(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var t,e,n,s,a;if(!this.closed){this.closed=!0;var h=this._parentage;if(h)if(this._parentage=null,Array.isArray(h))try{for(var l=_r(h),p=l.next();!p.done;p=l.next()){var d=p.value;d.remove(this)}}catch(D){t={error:D}}finally{try{p&&!p.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}else h.remove(this);var y=this.initialTeardown;if(tt(y))try{y()}catch(D){a=D instanceof zo?D.errors:[D]}var b=this._finalizers;if(b){this._finalizers=null;try{for(var x=_r(b),C=x.next();!C.done;C=x.next()){var O=C.value;try{tf(O)}catch(D){a=a!=null?a:[],D instanceof zo?a=rr(rr([],er(a)),er(D.errors)):a.push(D)}}}catch(D){n={error:D}}finally{try{C&&!C.done&&(s=x.return)&&s.call(x)}finally{if(n)throw n.error}}}if(a)throw new zo(a)}},r.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)tf(t);else{if(t instanceof r){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},r.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},r.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},r.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&wn(e,t)},r.prototype.remove=function(t){var e=this._finalizers;e&&wn(e,t),t instanceof r&&t._removeParent(this)},r.EMPTY=function(){var t=new r;return t.closed=!0,t}(),r}();var fu=Oi.EMPTY;function Vo(r){return r instanceof Oi||r&&"closed"in r&&tt(r.remove)&&tt(r.add)&&tt(r.unsubscribe)}function tf(r){tt(r)?r():r.unsubscribe()}var qe={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Di={setTimeout:function(r,t){for(var e=[],n=2;n0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var n=this,s=this,a=s.hasError,h=s.isStopped,l=s.observers;return a||h?fu:(this.currentObservers=null,l.push(e),new Oi(function(){n.currentObservers=null,wn(l,e)}))},t.prototype._checkFinalizedStatuses=function(e){var n=this,s=n.hasError,a=n.thrownError,h=n.isStopped;s?e.error(a):h&&e.complete()},t.prototype.asObservable=function(){var e=new Vt;return e.source=this,e},t.create=function(e,n){return new uf(e,n)},t}(Vt);var uf=function(r){Gr(t,r);function t(e,n){var s=r.call(this)||this;return s.destination=e,s.source=n,s}return t.prototype.next=function(e){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.next)===null||s===void 0||s.call(n,e)},t.prototype.error=function(e){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.error)===null||s===void 0||s.call(n,e)},t.prototype.complete=function(){var e,n;(n=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||n===void 0||n.call(e)},t.prototype._subscribe=function(e){var n,s;return(s=(n=this.source)===null||n===void 0?void 0:n.subscribe(e))!==null&&s!==void 0?s:fu},t}(it);var Ho=new Vt(function(r){return r.complete()});function hf(r){return r&&tt(r.schedule)}function cf(r){return r[r.length-1]}function Bo(r){return hf(cf(r))?r.pop():void 0}function Wo(r,t){return typeof cf(r)=="number"?r.pop():t}var qo=function(r){return r&&typeof r.length=="number"&&typeof r!="function"};function $o(r){return tt(r==null?void 0:r.then)}function Qo(r){return tt(r[Ii])}function Ko(r){return Symbol.asyncIterator&&tt(r==null?void 0:r[Symbol.asyncIterator])}function Yo(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function bT(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Xo=bT();function Jo(r){return tt(r==null?void 0:r[Xo])}function Zo(r){return Jl(this,arguments,function(){var e,n,s,a;return Ro(this,function(h){switch(h.label){case 0:e=r.getReader(),h.label=1;case 1:h.trys.push([1,,9,10]),h.label=2;case 2:return[4,ni(e.read())];case 3:return n=h.sent(),s=n.value,a=n.done,a?[4,ni(void 0)]:[3,5];case 4:return[2,h.sent()];case 5:return[4,ni(s)];case 6:return[4,h.sent()];case 7:return h.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function ts(r){return tt(r==null?void 0:r.getReader)}function le(r){if(r instanceof Vt)return r;if(r!=null){if(Qo(r))return wT(r);if(qo(r))return PT(r);if($o(r))return TT(r);if(Ko(r))return lf(r);if(Jo(r))return xT(r);if(ts(r))return ST(r)}throw Yo(r)}function wT(r){return new Vt(function(t){var e=r[Ii]();if(tt(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function PT(r){return new Vt(function(t){for(var e=0;e{let a=this.tilePosInDirection(new M(n,s),t);return this.tilemap.hasBlockingTile(a,e,Yl(t),this.ignoreMissingTiles)})}isCharBlocking(t,e){return this.someCharTile((n,s)=>{let a=this.tilePosInDirection(new M(n,s),t);return this.tilemap.hasBlockingChar(a,e,this.getCollisionGroups(),new Set([this.getId()]))})}isMoving(){return this.movementDirection!="none"}turnTowards(t){this.isMoving()||t!="none"&&this.changeFacingDirection(t)}changeFacingDirection(t){this.facingDirection!==t&&(this.facingDirection=t,this.directionChanged$.next(t))}getFacingDirection(){return this.facingDirection}getFacingPosition(){return this._tilePos.position.add(We(this.facingDirection))}addCollisionGroup(t){this.collisionGroups.add(t)}setCollisionGroups(t){this.collisionGroups=new Set(t)}getCollisionGroups(){return Array.from(this.collisionGroups)}hasCollisionGroup(t){return this.collisionGroups.has(t)}removeCollisionGroup(t){this.collisionGroups.delete(t)}removeAllCollisionGroups(){this.collisionGroups.clear()}addLabels(t){for(let e of t)this.labels.add(e)}getLabels(){return[...this.labels.values()]}hasLabel(t){return this.labels.has(t)}clearLabels(){this.labels.clear()}removeLabels(t){for(let e of t)this.labels.delete(e)}getNumberOfDirections(){return this.numberOfDirections}movementStarted(){return this.movementStarted$}movementStopped(){return this.movementStopped$}directionChanged(){return this.directionChanged$}tilePositionSet(){return this.tilePositionSet$}positionChangeStarted(){return this.positionChangeStarted$}positionChangeFinished(){return this.positionChangeFinished$}autoMovementSet(){return this.autoMovementSet$}depthChanged(){return this.depthChanged$}getMovementProgress(){return this.movementProgress}hasWalkedHalfATile(){return this.movementProgress>si/2}willCrossTileBorderThisUpdate(t){return this.movementProgress+this.maxProgressForDelta(t)>=si}updateCharacterPosition(t){let e=this.willCrossTileBorderThisUpdate(t),s=1-(e?si-this.movementProgress:this.maxProgressForDelta(t))/this.maxProgressForDelta(t);this.movementProgress=Math.min(this.movementProgress+this.maxProgressForDelta(t),si),e&&(this.movementProgress=0,this.shouldContinueMoving()?(this.fire(this.positionChangeFinished$,this.tilePos,this.getNextTilePos()),this.tilePos=this.getNextTilePos(),this.startMoving(this.lastMovementImpulse),s>0&&this.updateCharacterPosition(t*s)):this.stopMoving())}maxProgressForDelta(t){let n=t/1e3;return Math.floor(n*this.speed*si)}get tilePos(){return G.clone(this._tilePos)}set tilePos(t){G.copyOver(t,this._tilePos)}startMoving(t){t!=="none"&&(t!=this.movementDirection&&this.movementStarted$.next(t),this.movementDirection=t,this.facingDirection=t,this.fire(this.positionChangeStarted$,this.tilePos,this.getNextTilePos()))}tilePosInDirection(t,e){return t.add(We(this.tilemap.toMapDirection(e)))}shouldContinueMoving(){return this.lastMovementImpulse!=="none"&&!this.isBlockingDirection(this.lastMovementImpulse)}stopMoving(){if(this.movementDirection==="none")return;let t=this.tilePos,e=this.getNextTilePos(),n=this.movementDirection;this.tilePos=this.getNextTilePos(),this.movementDirection="none",this.movementStopped$.next(n),this.fire(this.positionChangeFinished$,t,e)}fire(t,{position:e,layer:n},{position:s,layer:a}){t.next({exitTile:e,enterTile:s,exitLayer:n,enterLayer:a})}someCharTile(t){let e=this.getNextTilePos().position;for(let n=e.x;nh===this.charData.id)).subscribe(({direction:h})=>{var l;(l=this.animation)==null||l.setStandingFrame(h)}),this.sprite&&(this.sprite.setOrigin(0,0),this.resetAnimation(this.sprite),this.updateOverlaySprite(),this.updateGridChar())}destroy(){this.destroy$.next(),this.destroy$.complete(),this.newSpriteSet$.complete()}setSprite(t){t?(this.sprite&&(t.x=this.sprite.x,t.y=this.sprite.y),this.sprite=t,this.newSpriteSet$.next(),this.layerOverlaySprite=this.layerOverlaySprite?this.scene.add.sprite(0,0,this.sprite.texture):void 0,this.updateOverlaySprite(),this.resetAnimation(this.sprite),this.updateDepth()):(this.layerOverlaySprite=void 0,this.sprite=void 0)}getSprite(){return this.sprite}getLayerOverlaySprite(){return this.layerOverlaySprite}setContainer(t){this.container=t}getContainer(){return this.container}getOffsetX(){return this.customOffset.x}setOffsetX(t){this.customOffset.x=t}getOffsetY(){return this.customOffset.y}setOffsetY(t){this.customOffset.y=t}getWalkingAnimationMapping(){return this.walkingAnimationMapping}turnTowards(t){var e;this.geHeadless.isMoving(this.charData.id)||t!="none"&&(this.geHeadless.turnTowards(this.charData.id,t),(e=this.animation)==null||e.setStandingFrame(t))}getAnimation(){return this.animation}setAnimation(t){this.animation=t}update(t){this.updateGridChar()}getEngineOffset(){var n,s,a,h;if(!this.sprite)return M.ZERO;let t=this.tilemap.getTileWidth()/2-Math.floor(((s=(n=this.sprite)==null?void 0:n.displayWidth)!=null?s:0)/2),e=-((h=(a=this.sprite)==null?void 0:a.displayHeight)!=null?h:0)+this.tilemap.getTileHeight();return new M(t,e)}updatePixelPos(){let t=new M(this.geHeadless.getPosition(this.charData.id)),e=this.geHeadless.getMovementProgress(this.charData.id)/1e3,s=this.tilemap.tilePosToPixelPos(t).add(this.getEngineOffset()).add(this.customOffset).add(We(this.geHeadless.getFacingDirection(this.charData.id)).multiply(this.tilemap.getTileDistance(this.geHeadless.getFacingDirection(this.charData.id)).scalarMult(e))),a=this.getGameObj();a&&(a.x=Math.floor(s.x),a.y=Math.floor(s.y))}getGameObj(){return this.container||this.sprite}updateGridChar(){var t;if(this.updatePixelPos(),this.sprite&&this.geHeadless.isMoving(this.charData.id)){let e=this.geHeadless.getMovementProgress(this.charData.id)>si/2;(t=this.getAnimation())==null||t.updateCharacterFrame(this.geHeadless.getFacingDirection(this.charData.id),e,Number(this.sprite.frame.name))}this.updateDepth()}resetAnimation(t){let e=new xn(this.walkingAnimationMapping,t.texture.source[0].width/t.width/xn.FRAMES_CHAR_ROW);this.setAnimation(e),e.frameChange().pipe(Mt(this.newSpriteSet$)).subscribe(n=>{t==null||t.setFrame(n)}),e.setIsEnabled(this.walkingAnimationMapping!==void 0),e.setStandingFrame(this.geHeadless.getFacingDirection(this.charData.id))}updateOverlaySprite(){if(!this.layerOverlaySprite||!this.sprite)return;this.layerOverlaySprite.scale=this.sprite.scale;let t=this.tilemap.getTileHeight()/this.layerOverlaySprite.scale;this.layerOverlaySprite.setCrop(0,0,this.layerOverlaySprite.displayWidth,this.sprite.height-t),this.layerOverlaySprite.setOrigin(0,0)}updateDepth(){let t=this.getGameObj();if(!t)return;let e=new M(this.geHeadless.getPosition(this.charData.id)),n=this.geHeadless.getCharLayer(this.charData.id);this.setDepth(t,{position:e,layer:n});let s=this.getLayerOverlaySprite();if(s){let a=new M(Be(ot({},e),{y:e.y-1}));this.setDepth(s,{position:a,layer:n})}}setDepth(t,e){t.setDepth(this.tilemap.getDepthOfCharLayer(this.getTransitionLayer(e))+this.getPaddedPixelDepth(t))}getPaddedPixelDepth(t){return ki.shiftPad(t.y+t.displayHeight,7)}getTransitionLayer(t){if(t.layer)return this.geHeadless.getTransition(t.position,t.layer)||t.layer}};var us=(s=>(s.DONT_BLOCK="DONT_BLOCK",s.BLOCK_TWO_TILES="BLOCK_TWO_TILES",s.BLOCK_ONE_TILE_AHEAD="BLOCK_ONE_TILE_AHEAD",s.BLOCK_ONE_TILE_BEHIND="BLOCK_ONE_TILE_BEHIND",s))(us||{});var Ri=(n=>(n.STOP="STOP",n.CLOSEST_REACHABLE="CLOSEST_REACHABLE",n.RETRY="RETRY",n))(Ri||{});var xt=class r{static vec2str(t){return`${t.x}#${t.y}`}static equal(t,e){return r.vec2str(t)==r.vec2str(e)}static manhattanDistance(t,e){let n=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return n+s}static chebyshevDistance(t,e){let n=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return Math.max(n,s)}static scalarMult(t,e){return t.clone().multiply(new M(e,e))}};var hs=class{distance(t,e){return xt.manhattanDistance(t,e)}direction(t,e){if(xt.equal(t,e))return"none";let n=t.clone().subtract(e);return Math.abs(n.x)>Math.abs(n.y)?n.x>0?"left":"right":n.y>0?"up":"down"}neighbors(t){return[new M(t.x,t.y+1),new M(t.x+1,t.y),new M(t.x-1,t.y),new M(t.x,t.y-1)]}getDirections(){return["up","right","down","left"]}};var cs=class{distance(t,e){return xt.chebyshevDistance(t,e)}neighbors(t){let e=[new M(t.x,t.y+1),new M(t.x+1,t.y),new M(t.x-1,t.y),new M(t.x,t.y-1)],n=[new M(t.x+1,t.y+1),new M(t.x+1,t.y-1),new M(t.x-1,t.y+1),new M(t.x-1,t.y-1)];return[...e,...n]}direction(t,e){return e.x>t.x?e.y>t.y?"down-right":e.yt.y?"down-left":e.yt.y?"down":"none"}getDirections(){return["up","right","down","left","down-left","down-right","up-right","up-left"]}};var ie=class{static create(t){switch(t){case 4:return new hs;case 8:return new cs}}};var Sn=class{constructor(t,e,n){this.backoffMs=t;this.maxRetries=e;this.onFinished=n;this.retries=0;this.elapsed=0}retry(t,e){this.shouldRetry()?(this.elapsed+=t,this.elapsed>=this.backoffMs&&(this.elapsed=0,this.retries++,e())):this.onFinished()}reset(){this.retries=0,this.elapsed=0}getMaxRetries(){return this.maxRetries}getBackoffMs(){return this.backoffMs}shouldRetry(){return this.maxRetries===-1||this.retries(n.WAIT="WAIT",n.RETRY="RETRY",n.STOP="STOP",n))(Cn||{});var nr=class{constructor(t,{shortestPathAlgorithm:e="BFS",pathWidth:n=1,pathHeight:s=1,numberOfDirections:a=4,isPositionAllowed:h=(R,H)=>!0,collisionGroups:l=[],ignoredChars:p=[],ignoreTiles:d=!1,ignoreMapBounds:y=!1,ignoreBlockedTarget:b=!1,maxPathLength:x=1/0,ignoreLayers:C=!1,considerCosts:O=!1,calculateClosestToTarget:D=!0}={}){this.gridTilemap=t;this.options={shortestPathAlgorithm:e,pathWidth:n,pathHeight:s,numberOfDirections:a,isPositionAllowed:h,collisionGroups:l,ignoredChars:p,ignoreTiles:d,ignoreMapBounds:y,ignoreBlockedTarget:b,maxPathLength:x,ignoreLayers:C,considerCosts:O,calculateClosestToTarget:D}}findShortestPath(t,e){this.options.ignoreLayers&&(this.gridTilemap.fixCacheLayer(t.layer),e.layer=t.layer);let n=this.findShortestPathImpl(t,e);return this.gridTilemap.unfixCacheLayers(),n}getNeighbors(t,e){var h;return ie.create((h=this.options.numberOfDirections)!=null?h:4).neighbors(t.position).map(l=>{let p=t.layer;return this.options.ignoreLayers||(p=this.gridTilemap.getTransition(l,t.layer)),{position:l,layer:p||t.layer}}).filter(l=>!this.isBlocking(t,l)||this.options.ignoreBlockedTarget&&G.equal(l,e))}getTransition(t,e){if(!this.options.ignoreLayers)return this.gridTilemap.getTransition(t,e)}getCosts(t,e){if(!this.options.considerCosts)return 1;let n=re(e.position,t);return this.gridTilemap.getTileCosts(e,n)}isBlocking(t,e){return!(this.options.ignoreMapBounds||this.gridTilemap.isInRange(e.position))||!this.options.isPositionAllowed(e.position,e.layer)||!this.options.ignoreTiles&&this.hasBlockingTileFrom(t,e,this.options.pathWidth,this.options.pathHeight,this.options.ignoreMapBounds,this.gridTilemap)?!0:this.hasBlockingCharFrom(e,this.options.pathWidth,this.options.pathHeight,this.options.collisionGroups,this.options.ignoredChars,this.gridTilemap)}distance(t,e){return(this.options.numberOfDirections===4?xt.manhattanDistance:xt.chebyshevDistance)(t,e)}getTilePosInDir(t,e){return this.gridTilemap.getTilePosInDirection(t,e)}getReverseNeighbors(t,e){var l;let s=ie.create((l=this.options.numberOfDirections)!=null?l:4).neighbors(t.position),a;if(!this.options.ignoreLayers){let p=this.gridTilemap.getReverseTransitions(t.position,t.layer);a=p?[...p]:void 0}return s.map(p=>a?a.map(d=>({position:p,layer:d||t.layer})):[{position:p,layer:t.layer}]).flat().filter(p=>!this.isBlocking(p,t)||this.options.ignoreBlockedTarget&&G.equal(t,e))}hasBlockingCharFrom(t,e,n,s,a,h){for(let l=t.position.x;lEn(a,y)-En(a,b)),l=t,p=this.distance(t.position,e.position),d=0;for(h.push(t),s.set(G.toString(t),0),a.set(G.toString(t),this.distance(t.position,e.position));h.size>0;){let y=h.pop();if(!y)break;d++;let b=this.distance(y.position,e.position);if(bthis.options.maxPathLength)return{previous:new Map,closestToTarget:l,steps:d,maxPathLengthReached:!0};for(let x of this.getNeighbors(y,e)){let C=En(s,y)+this.getCosts(y.position,x),O=G.toString(x);(!s.has(O)||C0;){let d=a.dequeue();if(p++,!d)break;let{node:y,dist:b}=d;if(b>this.options.maxPathLength)return{previous:new Map,closestToTarget:h,steps:p,maxPathLengthReached:!0};let x=this.distance(y.position,e.position);if(xthis.lastDist)}step(t,e,n){var s;this.lastDist=n;for(let a of t){let h=G.toString(a);if(!this.visited.has(h)){this.previous.set(h,e),this.queue.enqueue({node:a,dist:n+1}),this.visited.set(h,n+1);let l=(s=this.otherBfs)==null?void 0:s.visited.get(h);l!==void 0&&l0,s.queue.size()>0);){let d=n.queue.dequeue();if(!d)break;let{node:y,dist:b}=d;if(b+1+(((p=s.queue.peek())==null?void 0:p.dist)||0)>this.options.maxPathLength)return{previous:n.previous,previous2:s.previous,closestToTarget:this.maybeClosestToTarget(h),steps:a,maxPathLengthReached:!0};let x=this.distance(y.position,e.position);if(xMn(this.f,h)-Mn(this.f,l)),this.openSet.push(e);let a=G.toString(e);for(this.g.set(a,0),this.f.set(a,this.distance(e.position,n.position)),this.maxFrontierSize=Math.max(this.maxFrontierSize,this.openSet.size);this.openSet.size>0;){let h=this.openSet.pop();if(!h)break;if(this.steps++,G.equal(h,n))return{previous:s,closestToTarget:n,steps:this.steps,maxPathLengthReached:!1};if(Mn(this.g,h)+1>this.options.maxPathLength)return{previous:new Map,closestToTarget:this.closestToTarget,steps:this.steps,maxPathLengthReached:!0};this.updateClosestToTarget(h,n);for(let l of this.getNeighborsInternal(h,s.get(G.toString(h)),n)){let p=G.toString(l.p),d=Mn(this.g,h)+l.dist;(!this.g.has(p)||d({p:l,dist:1}));let a=this.prune(n,e).map(l=>{let p=this.getTransition(l.position,e.layer);return{position:l.position,layer:p||e.layer}}),h=[];for(let l of a){let p=this.jump(e,l,s,1);p&&h.push(p)}return h}jump(e,n,s,a){let h=this.distanceUtils.direction(e.position,n.position);if(!(this.isBlocking(e,n)&&!(G.equal(n,s)&&this.options.ignoreBlockedTarget)))return G.equal(n,s)?{p:n,dist:a}:a>=this.maxJumpSize?{p:n,dist:a}:this.getTransition(n.position,e.layer)!==void 0?{p:n,dist:a}:cu(h)?{p:n,dist:a}:this.getForced(e,n).length>0?{p:n,dist:a}:(this.updateClosestToTarget(n,s),this.jump(n,this.getTilePosInDir(n,re(e.position,n.position)),s,a+1))}getForced(e,n){let s=[],a=this.posInDir(n,this.distanceUtils.direction(n.position,e.position)),{topLeft:h,downLeft:l,top:p,bottom:d}=this.normalizedPositions(a,n),y=(x,C)=>this.isBlocking(x,C)||this.getTransition(C.position,C.layer)!==void 0,b=this.distanceUtils.direction(e.position,n.position);return Ql(b)&&((y(a,l)||y(l,d))&&!this.isBlocking(n,d)&&s.push(d),(y(a,h)||y(h,p))&&!this.isBlocking(n,p)&&s.push(p)),s}prune(e,n){let{right:s,top:a,bottom:h}=this.normalizedPositions(e,n),l=this.getForced(e,n),p=re(e.position,n.position);return cu(p)?[s,a,h]:[s,...l]}normalizedPositions(e,n){var a,h,l,p,d,y,b;let s=re(e.position,n.position);return{topLeft:this.posInDir(n,((a=this.turnTimes.get("up-left"))==null?void 0:a.get(this.turnOrder[s]))||"up-left"),downLeft:this.posInDir(n,((h=this.turnTimes.get("down-left"))==null?void 0:h.get(this.turnOrder[s]))||"down-left"),downRight:this.posInDir(n,((l=this.turnTimes.get("down-right"))==null?void 0:l.get(this.turnOrder[s]))||"down-right"),topRight:this.posInDir(n,((p=this.turnTimes.get("up-right"))==null?void 0:p.get(this.turnOrder[s]))||"up-right"),top:this.posInDir(n,((d=this.turnTimes.get("up"))==null?void 0:d.get(this.turnOrder[s]))||"up"),bottom:this.posInDir(n,((y=this.turnTimes.get("down"))==null?void 0:y.get(this.turnOrder[s]))||"down"),right:this.posInDir(n,((b=this.turnTimes.get("right"))==null?void 0:b.get(this.turnOrder[s]))||"right")}}posInDir(e,n){return{position:e.position.add(We(n)),layer:e.layer}}returnPath(e,n,s){let a=[],h=s;for(a.push(h);!G.equal(h,n);){let l=e.get(G.toString(h));if(!l)return[];this.distance(l.position,h.position)>1?this.fillPath(h,l,a):a.push(l),h=l}return a.reverse()}fillPath(e,n,s){let a=e;do{let h=re(a.position,n.position);a=this.getTilePosInDir(a,h),s.push(a)}while(!xt.equal(a.position,n.position))}};function Mn(r,t){var e;return(e=r.get(G.toString(t)))!=null?e:Number.MAX_VALUE}function LS(){let r=["right","down-right","down","down-left","left","up-left","up","up-right"],t=new Map;for(let e=0;eh!==this),fe(1)))).subscribe(({enterTile:h,enterLayer:l})=>{this.updateTarget(h,l)})}update(t){var e;(e=this.targetMovement)==null||e.update(t)}getInfo(){return{type:"Follow",config:{charToFollow:this.charToFollow.getId(),distance:this.options.distance,noPathFoundStrategy:this.options.noPathFoundStrategy,maxPathLength:this.options.maxPathLength,ignoreLayers:this.options.ignoreLayers}}}updateTarget(t,e){this.targetMovement=new $i(this.character,this.gridTilemap,{position:new M(t),layer:e},{distance:this.options.distance+1,config:{algorithm:this.options.shortestPathAlgorithm,noPathFoundStrategy:this.options.noPathFoundStrategy,maxPathLength:this.options.maxPathLength,ignoreLayers:this.options.ignoreLayers,considerCosts:this.options.considerCosts},ignoreBlockedTarget:!0})}};var In=class{static getRandomInt(t){return Math.floor(Math.random()*Math.floor(t))}};var Es=class{constructor(t,e=0,n=-1){this.character=t;this.delay=e;this.radius=n;this.stepSize=0;this.delayLeft=this.delay,this.initialRow=t.getNextTilePos().position.y,this.initialCol=t.getNextTilePos().position.x,this.randomizeStepSize(),this.stepsWalked=0,this.currentMovementDirection="none",this.character.positionChangeStarted().pipe(Mt(this.character.autoMovementSet().pipe(Bt(s=>s!==this),fe(1)))).subscribe(()=>{this.stepsWalked++}),this.distanceUtils=ie.create(t.getNumberOfDirections())}update(t){if(this.shouldContinueWalkingCurrentDirection())this.character.move(this.currentMovementDirection);else if(this.delayLeft-=t,this.delayLeft<=0){this.delayLeft=this.delay;let e=this.getFreeRandomDirection();this.stepsWalked=0,this.character.move(e),this.currentMovementDirection=e,this.randomizeStepSize()}}getInfo(){return{type:"Random",config:{delay:this.delay,radius:this.radius}}}shouldContinueWalkingCurrentDirection(){return this.stepsWalked!this.character.isBlockingDirection(e)).filter(e=>this.isWithinRadius(e))}isWithinRadius(t){return this.radius==-1?!0:this.getDist(t)<=this.radius}getDist(t){return this.distanceUtils.distance(this.character.getNextTilePos().position.add(We(t)),new M(this.initialCol,this.initialRow))}getFreeRandomDirection(){let t=this.getFreeDirections();return t.length==0?"none":t[In.getRandomInt(t.length)]}randomizeStepSize(){this.stepSize=In.getRandomInt(this.radius)+1}};function Qd(r,t){return r.filter(e=>{var n,s,a,h,l,p;return(n=t.labels)!=null&&n.withAllLabels?(s=t.labels)==null?void 0:s.withAllLabels.every(d=>e.hasLabel(d)):(a=t.labels)!=null&&a.withOneOfLabels?(h=t.labels)==null?void 0:h.withOneOfLabels.some(d=>e.hasLabel(d)):(l=t.labels)!=null&&l.withNoneLabels?!((p=t.labels)!=null&&p.withNoneLabels.some(d=>e.hasLabel(d))):!0})}var As="2.36.0";var Os=class{constructor(t,e){this.collistionStrategy=t;this.collisionGroupRelation=e;this.tilePosToCharacters=new Map;this.charRemoved$=new it}isCharBlockingAt(t,e,n,s=new Set){if(n.length===0)return!1;let a=this.posToString(t,e),h=this.tilePosToCharacters.get(a);return!!(h&&h.size>0&&[...h].filter(l=>!s.has(l.getId())).some(l=>n.some(p=>l.getCollisionGroups().some(d=>this.collidesWith(p,d)))))}collidesWith(t,e){return this.collisionGroupRelation?(this.collisionGroupRelation.get(t)||new Set).has(e):t===e}getCharactersAt(t,e){let n=this.posToString(t,e),s=this.tilePosToCharacters.get(n);return new Set(s)}addCharacter(t){this.addTilePositions(t.getTilePos(),t),this.addTilePositions(t.getNextTilePos(),t),this.addPositionChangeSub(t),this.addPositionChangeFinishedSub(t),this.addTilePosSetSub(t)}removeCharacter(t){let e=t.getId();this.charRemoved$.next(e),this.deleteTilePositions(t.getTilePos(),t),this.deleteTilePositions(t.getNextTilePos(),t)}add(t,e){var n;this.tilePosToCharacters.has(t)||this.tilePosToCharacters.set(t,new Set),(n=this.tilePosToCharacters.get(t))==null||n.add(e)}addTilePosSetSub(t){t.tilePositionSet().pipe(Mt(this.charRemoved(t.getId()))).subscribe(e=>{this.deleteTilePositions(t.getNextTilePos(),t),this.addTilePositions(e,t)})}charRemoved(t){var e;return(e=this.charRemoved$)==null?void 0:e.pipe(fe(1),Bt(n=>n==t))}addPositionChangeSub(t){t.positionChangeStarted().pipe(Mt(this.charRemoved(t.getId())),this.posChangeToLayerPos()).subscribe(e=>{this.collistionStrategy==="BLOCK_ONE_TILE_AHEAD"&&this.deleteTilePositions(e.exit,t),this.addTilePositions(e.enter,t)})}addPositionChangeFinishedSub(t){t.positionChangeFinished().pipe(Mt(this.charRemoved(t.getId())),this.posChangeToLayerPos()).subscribe(e=>{this.deleteTilePositions(e.exit,t),this.addTilePositions(e.enter,t)})}addTilePositions(t,e){this.forEachCharTile(t,e,(n,s)=>{this.add(this.posToString(new M(n,s),t.layer),e)})}deleteTilePositions(t,e){this.forEachCharTile(t,e,(n,s)=>{var a;(a=this.tilePosToCharacters.get(this.posToString(new M(n,s),t.layer)))==null||a.delete(e)})}forEachCharTile(t,e,n){let s=t.position;for(let a=s.x;a({enter:{position:new M(t.enterTile),layer:t.enterLayer},exit:{position:new M(t.exitTile),layer:t.exitLayer}})))}posToString(t,e){return`${t.x}#${t.y}#${e}`}};var $r=class{constructor(t,e,n,s){this.x=t;this.y=e;this.width=n;this.height=s}getX(){return this.x}getY(){return this.y}getWidth(){return this.width}getHeight(){return this.height}isInRange(t){return t.x>=this.x&&t.x=this.y&&t.yn.isCharLayer());for(let n of[...e,void 0]){let s=this.tileCollisionCache.get(n==null?void 0:n.getName());if(s===void 0){s=new Array(this.tilemap.getWidth());for(let a=0;a>t&1)==1}var Yd="ge_cost",ks=class ks{constructor(t,e,n,s=void 0,a=!1){this.tilemap=t;this.collisionTilePropertyName=e;this.useTileCollisionCache=a;this.characters=new Map;this.transitions=new Map;this.reverseTransitions=new Map;this.collidesPropNames=new Map;this.tileCostPropNames=new Map;this.collisionRelevantLayersFrameCache=new Map;this.charBlockCache=new Os(n,s);for(let h of bn())this.collidesPropNames.set(h,ks.ONE_WAY_COLLIDE_PROP_PREFIX+h),this.tileCostPropNames.set(h,`${Yd}_${h}`);this.useTileCollisionCache&&(this.tileCollisionCache=new Ms(t,this),this.tileCollisionCache.rebuild())}fixCacheLayer(t){var e;(e=this.tileCollisionCache)==null||e.fixLayer(t)}unfixCacheLayers(){var t;(t=this.tileCollisionCache)==null||t.unfixLayers()}addCharacter(t){this.characters.set(t.getId(),t),t.getNextTilePos().layer===void 0&&t.setTilePosition(Be(ot({},t.getNextTilePos()),{layer:this.getLowestCharLayer()})),this.charBlockCache.addCharacter(t)}removeCharacter(t){let e=this.characters.get(t);e&&(this.charBlockCache.removeCharacter(e),this.characters.delete(t))}getCharacters(){return[...this.characters.values()]}getCharactersAt(t,e){return this.charBlockCache.getCharactersAt(t,e)}rebuildTileCollisionCache(t){var e;(e=this.tileCollisionCache)==null||e.rebuild(t)}hasBlockingTileUncached(t,e,n,s){if(!s&&this.hasNoTileUncached(t,e))return!0;let a=this.getCollisionRelevantLayers(e);for(let h of a)if(this.isLayerBlockingAt(h.getName(),t,n))return!0;return!1}hasBlockingTile(t,e,n,s){var h;let a=(h=this.tileCollisionCache)==null?void 0:h.isBlockingFrom(t.x,t.y,e,n,s);return a!==void 0?a:this.hasBlockingTileUncached(t,e,n,s)}getTransition(t,e){let n=this.transitions.get(t.toString());if(n)return n.get(e)}getReverseTransitions(t,e){let n=this.reverseTransitions.get(t.toString());if(n)return n.get(e)}setTransition(t,e,n){var s,a,h,l,p;this.transitions.has(t.toString())||this.transitions.set(t.toString(),new Map),this.reverseTransitions.has(t.toString())||this.reverseTransitions.set(t.toString(),new Map),(s=this.transitions.get(t.toString()))==null||s.set(e,n),(a=this.reverseTransitions.get(t.toString()))!=null&&a.has(n)||(h=this.reverseTransitions.get(t.toString()))==null||h.set(n,new Set),(p=(l=this.reverseTransitions.get(t.toString()))==null?void 0:l.get(n))==null||p.add(e)}getTransitions(){return new Map([...this.transitions].map(([t,e])=>[t,new Map(e)]))}getTileCosts(t,e){let n=this.getCollisionRelevantLayers(t.layer),s=1;for(let a of n)s=Math.max(s,this.getTileCostsForLayer(Be(ot({},t),{layer:a.getName()}),e));return s}getTileCostsForLayer(t,e){let n=this.tilemap.getTileAt(t.position.x,t.position.y,t.layer);return e&&(n==null?void 0:n.getProperty(this.tileCostPropNames.get(e)||""))||(n==null?void 0:n.getProperty(Yd))||1}hasNoTileUncached(t,e){return!this.getCollisionRelevantLayers(e).some(s=>this.tilemap.hasTileAt(t.x,t.y,s.getName()))}hasNoTile(t,e){var s;let n=(s=this.tileCollisionCache)==null?void 0:s.hasTileAt(t.x,t.y,e);return n!==void 0?n:this.hasNoTileUncached(t,e)}hasBlockingChar(t,e,n,s=new Set){return this.charBlockCache.isCharBlockingAt(t,e,n,s)}isInRange(t){return new $r(0,0,this.tilemap.getWidth(),this.tilemap.getHeight()).isInRange(t)}toMapDirection(t){return this.isIsometric()?Kl(t):t}fromMapDirection(t){return this.isIsometric()?ko(t):t}isIsometric(){return this.tilemap.getOrientation()==="isometric"}getTilePosInDirection(t,e){let n=t.position.add(We(this.toMapDirection(e))),s=this.getTransition(n,t.layer)||t.layer;return{position:n,layer:s}}invalidateFrameCache(){this.collisionRelevantLayersFrameCache.clear()}isLayerBlockingAt(t,e,n){let s=this.tilemap.getTileAt(e.x,e.y,t);return s?!!(s.getProperty(this.collisionTilePropertyName)||n&&s.getProperty(this.collidesPropNames.get(n)||"")):!1}getCharLayerIndexes(){return this.tilemap.getLayers().map((t,e)=>({layer:t,index:e})).filter(({layer:t})=>t.isCharLayer()).map(({index:t})=>t)}findPrevAndCharLayer(t){let e=this.getCharLayerIndexes(),n=this.tilemap.getLayers(),s=e.findIndex(a=>n[a].getProperty(kn)==t);return s==0?{prevIndex:-1,charLayerIndex:e[s]}:{prevIndex:e[s-1],charLayerIndex:e[s]}}getCollisionRelevantLayers(t){if(!t)return this.tilemap.getLayers();let e=this.collisionRelevantLayersFrameCache.get(t);if(e)return e;let{prevIndex:n,charLayerIndex:s}=this.findPrevAndCharLayer(t),a=this.tilemap.getLayers().slice(n+1,s+1);return this.collisionRelevantLayersFrameCache.set(t,a),a}getLowestCharLayer(){for(let t of this.tilemap.getLayers())if(t.isCharLayer())return t.getProperty(kn)}};ks.ONE_WAY_COLLIDE_PROP_PREFIX="ge_collide_";var Is=ks;var ih=(e=>(e.REMOVED="REMOVED",e.ADDED="ADDED",e))(ih||{});var Xd=(n=>(n.WAIT="WAIT",n.SKIP="SKIP",n.STOP="STOP",n))(Xd||{}),Rs=class{constructor(t,e){this.character=t;this.tilemap=e;this.queue=new Lr;this.finished$=new it;this.pathBlockedWaitElapsed=0;this.distanceUtils=ie.create(t.getNumberOfDirections()),this.character.autoMovementSet().pipe(Bt(n=>n!==this),fe(1)).subscribe(()=>{this.queue.size()>0&&this.finishMovementTerminated(),this.finished$.complete()})}update(t){(!this.character.isMoving()||this.character.willCrossTileBorderThisUpdate(t))&&this.queue.size()>0&&this.moveCharOnPath(t)}getInfo(){return{type:"Queue"}}enqueue(t,e={}){var s,a,h;let n={pathBlockedStrategy:(s=e.pathBlockedStrategy)!=null?s:"STOP",pathBlockedWaitTimeoutMs:(e==null?void 0:e.pathBlockedWaitTimeoutMs)||-1,ignoreInvalidPositions:(a=e.ignoreInvalidPositions)!=null?a:!1,skipInvalidPositions:(h=e.skipInvalidPositions)!=null?h:!1};for(let l of t){let p={command:l,config:n};if(jr(l)){this.queue.enqueue(p);continue}let d=this.queue.peekEnd(),y=d==null?void 0:d.command;if(y||(y=this.character.getNextTilePos()),jr(y)){this.queue.enqueue(p);continue}let b=this.distanceUtils.distance(y.position,l.position)===1;(!e.ignoreInvalidPositions||b)&&this.queue.enqueue(p)}}peekAll(){return this.queue.peekAll()}size(){return this.queue.size()}finished(){return this.finished$}clear(){this.queue.clear()}moveCharOnPath(t){let e=this.queue.peek();if(!e)return;let n=e.command,s=e.config;if(jr(n)&&(n=this.tilemap.getTilePosInDirection(this.character.getNextTilePos(),n)),s.skipInvalidPositions){if(n=this.getNextValidPosition(),!n){this.finishInvalidNextPos(n);return}}else if(!this.isNeighborPos(n)){this.finishInvalidNextPos(n);return}if(this.character.isBlockingDirection(re(this.character.getNextTilePos().position,n.position))){if(s.pathBlockedStrategy==="STOP")this.finishPathBlocked(n);else if(s.pathBlockedStrategy==="SKIP"){this.queue.dequeue(),this.moveCharOnPath(t);return}else s.pathBlockedStrategy==="WAIT"&&s.pathBlockedWaitTimeoutMs>-1&&(this.pathBlockedWaitElapsed+=t,this.pathBlockedWaitElapsed>=s.pathBlockedWaitTimeoutMs&&this.finishBlockedWaitTimeout(n,s.pathBlockedWaitTimeoutMs));return}this.pathBlockedWaitElapsed=0,this.queue.dequeue(),this.character.move(this.getDir(this.character.getNextTilePos().position,n.position)),this.isLastMovement()&&this.finish("SUCCESS","",n)}getNextValidPosition(){var t;for(;this.queue.size()>0;){let e=(t=this.queue.peek())==null?void 0:t.command;if(jr(e)&&(e=this.tilemap.getTilePosInDirection(this.character.getNextTilePos(),e)),e&&this.isNeighborPos(e))return e;this.queue.dequeue()}}isLastMovement(){return this.queue.size()===0}isNeighborPos(t){let e=this.distanceUtils.distance(this.character.getNextTilePos().position,t.position)===1,n=this.tilemap.getTransition(t.position,this.character.getNextTilePos().layer);if(this.character.getNextTilePos().layer!==t.layer)return e&&n===t.layer;let s=n!==void 0&&n!==t.layer;return e&&!s}finishMovementTerminated(){this.finish("MOVEMENT_TERMINATED","New automatic movement has been set to character.")}finishInvalidNextPos(t){t?this.finish("INVALID_NEXT_POS",`Position ${this.posToStr(t)} is not reachable from ${this.posToStr(this.character.getNextTilePos())}.`):this.finish("INVALID_NEXT_POS",`No enqueued position is reachable from ${this.posToStr(this.character.getNextTilePos())}.`)}finishPathBlocked(t){this.finish("PATH_BLOCKED",`Position ${this.posToStr(t)} is blocked.`)}finishBlockedWaitTimeout(t,e){this.finish("PATH_BLOCKED_WAIT_TIMEOUT",`Position ${this.posToStr(t)} is blocked and the wait timeout of ${e} ms has been exceeded.`)}finish(t,e="",n=this.character.getNextTilePos()){this.queue=new Lr,this.finished$.next({position:n.position,result:t,description:e,layer:n.layer})}getDir(t,e){return this.tilemap.fromMapDirection(re(t,e))}posToStr(t){return`(${t.position.x}, ${t.position.y}, ${t.layer})`}};var Fs=class{constructor(t=!0){this.isCreatedInternal=!1;t&&console.log(`Using GridEngine v${As}`)}getCharLayer(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getTilePos().layer}getTransition(t,e){var n;return this.initGuard(),(n=this.gridTilemap)==null?void 0:n.getTransition(new M(t),e)}setTransition(t,e,n){var s;return this.initGuard(),(s=this.gridTilemap)==null?void 0:s.setTransition(new M(t),e,n)}create(t,e){this.isCreatedInternal=!0,this.gridCharacters=new Map;let n=this.setConfigDefaults(e);this.config=n,this.movementStopped$=new it,this.movementStarted$=new it,this.directionChanged$=new it,this.positionChangeStarted$=new it,this.positionChangeFinished$=new it,this.queueMovementFinished$=new it,this.charRemoved$=new it,this.charAdded$=new it,this.gridTilemap=new Is(t,this.config.collisionTilePropertyName,this.config.characterCollisionStrategy,this.recordToMap(this.config.collisionGroupRelation),this.config.cacheTileCollisions),this.addCharacters()}recordToMap(t){return t?new Map(Object.entries(t).map(([n,s])=>[n,new Set(s)])):void 0}getPosition(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getTilePos().position}move(t,e){this.moveChar(t,e)}moveRandomly(t,e=0,n=-1){var h;this.initGuard();let s=(h=this.gridCharacters)==null?void 0:h.get(t);if(!s)throw this.createCharUnknownErr(t);let a=new Es(s,e,n);s.setMovement(a)}getMovement(t){var s;this.initGuard();let e=(s=this.gridCharacters)==null?void 0:s.get(t);if(!e)throw this.createCharUnknownErr(t);let n=e.getMovement();return n?n.getInfo():{type:"None"}}moveTo(t,e,n){var l;let s=this.assembleMoveToConfig(n);this.initGuard();let a=(l=this.gridCharacters)==null?void 0:l.get(t);if(!a)throw this.createCharUnknownErr(t);if(!this.gridTilemap)throw this.createUninitializedErr();let h=new $i(a,this.gridTilemap,{position:new M(e),layer:(n==null?void 0:n.targetLayer)||a.getNextTilePos().layer},{distance:0,config:s});return a.setMovement(h),h.finishedObs().pipe(ir(p=>({charId:t,position:p.position,result:p.result,description:p.description,layer:p.layer})))}stopMovement(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);e.setMovement(void 0)}setSpeed(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.setSpeed(e)}getSpeed(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getSpeed()}collidesWithTiles(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.collidesWithTiles()}update(t,e){var n;if(this.isCreatedInternal&&this.gridCharacters)for(let[s,a]of this.gridCharacters)a.update(e);(n=this.gridTilemap)==null||n.invalidateFrameCache()}addCharacter(t){var a,h,l,p,d;if(!this.gridTilemap)throw this.createUninitializedErr();if(!this.config)throw this.createUninitializedErr();let e={speed:t.speed||4,tilemap:this.gridTilemap,collidesWithTiles:!0,collisionGroups:["geDefault"],charLayer:t.charLayer,facingDirection:t.facingDirection,labels:t.labels,numberOfDirections:(a=t.numberOfDirections)!=null?a:this.config.numberOfDirections,tileWidth:t.tileWidth,tileHeight:t.tileHeight};typeof t.collides=="boolean"?t.collides===!1&&(e.collidesWithTiles=!1,e.collisionGroups=[]):t.collides!==void 0&&(t.collides.collidesWithTiles===!1&&(e.collidesWithTiles=!1),t.collides.collisionGroups&&(e.collisionGroups=t.collides.collisionGroups),e.ignoreMissingTiles=(l=(h=t.collides)==null?void 0:h.ignoreMissingTiles)!=null?l:!1);let n=new ss(t.id,e);t.startPosition&&n.setTilePosition({position:new M(t.startPosition),layer:n.getTilePos().layer}),(p=this.gridCharacters)==null||p.set(t.id,n),this.gridTilemap.addCharacter(n);let s=n.getId();n.movementStopped().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.movementStopped$)==null||b.next({charId:s,direction:y})}),n.movementStarted().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.movementStarted$)==null||b.next({charId:s,direction:y})}),n.directionChanged().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.directionChanged$)==null||b.next({charId:s,direction:y})}),n.positionChangeStarted().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.positionChangeStarted$)==null||b.next(ot({charId:s},y))}),n.positionChangeFinished().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.positionChangeFinished$)==null||b.next(ot({charId:s},y))}),(d=this.charAdded$)==null||d.next(s)}hasCharacter(t){var e;return this.initGuard(),!!((e=this.gridCharacters)!=null&&e.has(t))}removeCharacter(t){var n,s,a,h;if(this.initGuard(),!((n=this.gridCharacters)==null?void 0:n.get(t)))throw this.createCharUnknownErr(t);(s=this.gridTilemap)==null||s.removeCharacter(t),(a=this.gridCharacters)==null||a.delete(t),(h=this.charRemoved$)==null||h.next(t)}removeAllCharacters(){if(this.initGuard(),!!this.gridCharacters)for(let t of this.gridCharacters.keys())this.removeCharacter(t)}getAllCharacters(t){if(this.initGuard(),!this.gridCharacters)return[];let e=[...this.gridCharacters.values()];return(t?Qd(e,t):e).map(s=>s.getId())}getLabels(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getLabels()}addLabels(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.addLabels(e)}removeLabels(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.removeLabels(e)}clearLabels(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);e.clearLabels()}follow(t,e,n,s){var d,y,b,x;let a;n===void 0?a={distance:0,closestPointIfBlocked:!1}:typeof n=="number"?(a={distance:n,closestPointIfBlocked:!1},s&&(a.closestPointIfBlocked=!0)):a=n,this.initGuard();let h=(d=this.gridCharacters)==null?void 0:d.get(t),l=(y=this.gridCharacters)==null?void 0:y.get(e);if(!h)throw this.createCharUnknownErr(t);if(!l)throw this.createCharUnknownErr(e);if(!this.gridTilemap)throw this.createUninitializedErr();let p=new Ls(h,this.gridTilemap,l,{distance:a.distance,noPathFoundStrategy:a.closestPointIfBlocked?"CLOSEST_REACHABLE":"STOP",maxPathLength:(b=a.maxPathLength)!=null?b:1/0,shortestPathAlgorithm:(x=a.algorithm)!=null?x:"BIDIRECTIONAL_SEARCH",ignoreLayers:!!a.ignoreLayers});h.setMovement(p)}isMoving(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.isMoving()}getFacingDirection(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getFacingDirection()}getFacingPosition(t){var s;this.initGuard();let e=(s=this.gridCharacters)==null?void 0:s.get(t);if(!e)throw this.createCharUnknownErr(t);let n=e.getFacingPosition();return{x:n.x,y:n.y}}turnTowards(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);return n.turnTowards(e)}getCharactersAt(t,e){if(this.initGuard(),!this.gridTilemap)return[];let n=this.gridTilemap.getCharactersAt(new M(t),e);return Array.from(n).map(s=>s.getId())}setPosition(t,e,n){var a;this.initGuard();let s=(a=this.gridCharacters)==null?void 0:a.get(t);if(!s)throw this.createCharUnknownErr(t);n||s.setTilePosition({position:new M(e),layer:s.getTilePos().layer}),s.setTilePosition({position:new M(e),layer:n})}isBlocked(t,e,n=["geDefault"]){var a,h;this.initGuard();let s=new M(t);return!!((a=this.gridTilemap)!=null&&a.hasBlockingTile(s,e)||(h=this.gridTilemap)!=null&&h.hasBlockingChar(s,e,n))}isTileBlocked(t,e){var n;return this.initGuard(),!!((n=this.gridTilemap)!=null&&n.hasBlockingTile(new M(t),e))}getCollisionGroups(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getCollisionGroups()||[]}setCollisionGroups(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.setCollisionGroups(e)}getTilePosInDirection(t,e,n){if(!this.gridTilemap)throw this.createUninitializedErr();let s=this.gridTilemap.getTilePosInDirection({position:new M(t),layer:e},n);return{position:s.position.toPosition(),charLayer:s.layer}}findShortestPath(t,e,n={}){if(!this.gridTilemap)throw this.createUninitializedErr();let s=n.shortestPathAlgorithm||"BFS";n.considerCosts&&s!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${s}'. It can only be used with A* algorithm.`);let h=new Qi(this.gridTilemap).findShortestPath(G.toInternal(t),G.toInternal(e),Be(ot({},n),{shortestPathAlgorithm:s}));return{path:h.path.map(G.fromInternal),closestToTarget:h.closestToTarget?G.fromInternal(h.closestToTarget):void 0,reachedMaxPathLength:!1,steps:h.steps}}steppedOn(t,e,n){return this.positionChangeFinished().pipe(Bt(s=>t.includes(s.charId)&&e.some(a=>a.x===s.enterTile.x&&a.y===s.enterTile.y)&&(n===void 0||n.includes(s.enterLayer))))}characterShifted(){if(!this.charAdded$||!this.charRemoved$)throw this.createUninitializedErr();return this.charAdded$.pipe(ir(t=>({charId:t,action:"ADDED"})),wu(this.charRemoved$.pipe(ir(t=>({charId:t,action:"REMOVED"})))))}movementStarted(){if(!this.movementStarted$)throw this.createUninitializedErr();return this.movementStarted$}movementStopped(){if(!this.movementStopped$)throw this.createUninitializedErr();return this.movementStopped$}directionChanged(){if(!this.directionChanged$)throw this.createUninitializedErr();return this.directionChanged$}positionChangeStarted(){if(!this.positionChangeStarted$)throw this.createUninitializedErr();return this.positionChangeStarted$}positionChangeFinished(){if(!this.positionChangeFinished$)throw this.createUninitializedErr();return this.positionChangeFinished$}getMovementProgress(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getMovementProgress()}rebuildTileCollisionCache(t,e,n,s){var a;(a=this.gridTilemap)==null||a.rebuildTileCollisionCache(new $r(t,e,n,s))}addQueueMovements(t,e,n){var h,l;this.initGuard();let s=(h=this.gridCharacters)==null?void 0:h.get(t);if(!s)throw this.createCharUnknownErr(t);if(!this.gridTilemap)throw this.createUninitializedErr();let a;((l=s==null?void 0:s.getMovement())==null?void 0:l.getInfo().type)==="Queue"?a=s.getMovement():(a=new Rs(s,this.gridTilemap),s.setMovement(a),a.finished().pipe(Mt(bu(this.charRemoved(t),s.autoMovementSet()))).subscribe(p=>{var d;(d=this.queueMovementFinished$)==null||d.next(ot({charId:t},p))})),a.enqueue(e.map(p=>jr(p)?p:{position:new M(p.position),layer:p.charLayer}),n)}queueMovementFinished(){if(!this.queueMovementFinished$)throw this.createUninitializedErr();return this.queueMovementFinished$}getEnqueuedMovements(t){var n,s;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return((s=e.getMovement())==null?void 0:s.getInfo().type)==="Queue"?e.getMovement().peekAll().map(h=>({command:jr(h.command)?h.command:G.fromInternal(h.command),config:h.config})):[]}clearEnqueuedMovements(t){var n,s;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);((s=e.getMovement())==null?void 0:s.getInfo().type)==="Queue"&&e.getMovement().clear()}getTileCost(t,e,n){var s,a;return this.initGuard(),(a=(s=this.gridTilemap)==null?void 0:s.getTileCosts({position:new M(t),layer:e},n))!=null?a:1}charRemoved(t){var e;if(!this.charRemoved$)throw this.createUninitializedErr();return(e=this.charRemoved$)==null?void 0:e.pipe(fe(1),Bt(n=>n==t))}initGuard(){if(!this.isCreatedInternal)throw this.createUninitializedErr()}createUninitializedErr(){throw new Error("GridEngine not initialized. You need to call create() first.")}addCharacters(){var t;(t=this.config)==null||t.characters.forEach(e=>this.addCharacter(e))}moveChar(t,e){var s,a,h;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);if(n.getNumberOfDirections()===4){if(!((a=this.gridTilemap)!=null&&a.isIsometric())&&Ai(e)){console.warn(`GridEngine: Character '${t}' can't be moved '${e}' in 4 direction mode.`);return}else if((h=this.gridTilemap)!=null&&h.isIsometric()&&!Ai(e)){console.warn(`GridEngine: Character '${t}' can't be moved '${e}' in 4 direction isometric mode.`);return}}n.move(e)}createCharUnknownErr(t){return new Error(`Character unknown: ${t}`)}assembleMoveToConfig(t={}){let e=Be(ot({},t),{noPathFoundStrategy:"STOP",pathBlockedStrategy:"WAIT"});return t!=null&&t.noPathFoundStrategy&&(Object.values(Ri).includes(t.noPathFoundStrategy)?e.noPathFoundStrategy=t.noPathFoundStrategy:console.warn(`GridEngine: Unknown NoPathFoundStrategy '${t.noPathFoundStrategy}'. Falling back to 'STOP'`)),t!=null&&t.pathBlockedStrategy&&(Object.values(Cn).includes(t.pathBlockedStrategy)?e.pathBlockedStrategy=t.pathBlockedStrategy:console.warn(`GridEngine: Unknown PathBlockedStrategy '${t.pathBlockedStrategy}'. Falling back to 'WAIT'`)),e}setConfigDefaults(t){return ot({collisionTilePropertyName:"ge_collide",numberOfDirections:4,characterCollisionStrategy:"BLOCK_TWO_TILES",cacheTileCollisions:!1},t)}};var zs=class extends qi{constructor(t,e={}){super(t,e),this.distanceUtils=ie.create(8)}getForced(t,e){let n=[],s=this.posInDir(e,this.distanceUtils.direction(e.position,t.position)),{topLeft:a,downLeft:h,top:l,bottom:p,topRight:d,downRight:y}=this.normalizedPositions(s,e),b=this.distanceUtils.direction(t.position,e.position),x=(C,O)=>this.isBlocking(C,O)||this.getTransition(O.position,O.layer)!==void 0;return Ai(b)?(x(t,a)&&!this.isBlocking(e,l)&&n.push(l),x(t,a)&&(x(t,h)||x(h,a))&&!this.isBlocking(e,a)&&n.push(a),x(t,h)&&!this.isBlocking(e,p)&&n.push(p),x(t,h)&&(x(t,a)||x(a,h))&&!this.isBlocking(e,h)&&n.push(h)):(x(t,l)&&(x(t,a)||x(a,l))&&(this.isBlocking(e,a)||n.push(a),this.isBlocking(e,l)||n.push(l)),x(t,l)&&(x(t,a)||x(a,l)||x(l,d))&&!this.isBlocking(e,d)&&n.push(d),x(t,p)&&(x(t,h)||x(h,l))&&(this.isBlocking(e,h)||n.push(h),this.isBlocking(e,p)||n.push(p)),x(t,p)&&(x(t,h)||x(a,p)||x(l,y))&&!this.isBlocking(e,y)&&n.push(y)),n}prune(t,e){let{right:n,topRight:s,downRight:a}=this.normalizedPositions(t,e),h=this.getForced(t,e),l=re(t.position,e.position);return Ai(l)?[n,s,a,...h]:[n,...h]}jump(t,e,n,s){let a=this.distanceUtils.direction(t.position,e.position);if(!(this.isBlocking(t,e)&&!(G.equal(e,n)&&this.options.ignoreBlockedTarget))){if(G.equal(e,n))return{p:e,dist:s};if(s>=this.maxJumpSize)return{p:e,dist:s};if(this.getTransition(e.position,t.layer)!==void 0)return{p:e,dist:s};if(this.getForced(t,e).length>0)return{p:e,dist:s};if(this.updateClosestToTarget(e,n),a==="up-left"){if(this.jump(e,this.getTilePosInDir(e,"up"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"left"),n,s+1)!==void 0)return{p:e,dist:s}}else if(a==="down-left"){if(this.jump(e,this.getTilePosInDir(e,"down"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"left"),n,s+1)!==void 0)return{p:e,dist:s}}else if(a==="up-right"){if(this.jump(e,this.getTilePosInDir(e,"up"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"right"),n,s+1)!==void 0)return{p:e,dist:s}}else if(a==="down-right"){if(this.jump(e,this.getTilePosInDir(e,"down"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"right"),n,s+1)!==void 0)return{p:e,dist:s}}return this.jump(e,this.getTilePosInDir(e,re(t.position,e.position)),n,s+1)}}};var Qi=class{constructor(t){this.gridTilemap=t}findShortestPath(t,e,n={}){return OS(n.shortestPathAlgorithm||"BIDIRECTIONAL_SEARCH",this.gridTilemap,n).findShortestPath(t,e)}};function OS(r,t,e){switch(r){case"BIDIRECTIONAL_SEARCH":return new gs(t,e);case"A_STAR":return new ps(t,e);case"JPS":return e.numberOfDirections===8?new zs(t,e):new qi(t,e)}return new Fi(t,e)}var nh=(p=>(p.SUCCESS="SUCCESS",p.NO_PATH_FOUND_MAX_RETRIES_EXCEEDED="NO_PATH_FOUND_MAX_RETRIES_EXCEEDED",p.PATH_BLOCKED_MAX_RETRIES_EXCEEDED="PATH_BLOCKED_MAX_RETRIES_EXCEEDED",p.PATH_BLOCKED="PATH_BLOCKED",p.NO_PATH_FOUND="NO_PATH_FOUND",p.PATH_BLOCKED_WAIT_TIMEOUT="PATH_BLOCKED_WAIT_TIMEOUT",p.MOVEMENT_TERMINATED="MOVEMENT_TERMINATED",p.MAX_PATH_LENGTH_REACHED="MAX_PATH_LENGTH_REACHED",p))(nh||{}),$i=class{constructor(t,e,n,{config:s,ignoreBlockedTarget:a=!1,distance:h=0}={}){this.character=t;this.tilemap=e;this.targetPos=n;this.shortestPath=[];this.distOffset=0;this.posOnPath=0;this.stopped=!1;this.pathBlockedWaitElapsed=0;this.isPositionAllowed=()=>!0;this.shortestPathAlgorithm="BIDIRECTIONAL_SEARCH";this.maxPathLength=1/0;this.considerCosts=!1;this.isBlocking=(t,e)=>t?new Fi(this.tilemap,this.getPathfindingOptions()).isBlocking(this.character.getTilePos(),{position:t,layer:e}):!0;var l;this.shortestPathAlgorithm=(l=s==null?void 0:s.algorithm)!=null?l:this.shortestPathAlgorithm,this.ignoreBlockedTarget=a,this.distance=h,this.noPathFoundStrategy=(s==null?void 0:s.noPathFoundStrategy)||"STOP",this.pathBlockedStrategy=(s==null?void 0:s.pathBlockedStrategy)||"WAIT",this.noPathFoundRetryable=new Sn((s==null?void 0:s.noPathFoundRetryBackoffMs)||200,(s==null?void 0:s.noPathFoundMaxRetries)||-1,()=>{this.stop("NO_PATH_FOUND_MAX_RETRIES_EXCEEDED")}),this.pathBlockedRetryable=new Sn((s==null?void 0:s.pathBlockedRetryBackoffMs)||200,(s==null?void 0:s.pathBlockedMaxRetries)||-1,()=>{this.stop("PATH_BLOCKED_MAX_RETRIES_EXCEEDED")}),s!=null&&s.isPositionAllowedFn&&(this.isPositionAllowed=s.isPositionAllowedFn),s!=null&&s.maxPathLength&&(this.maxPathLength=s.maxPathLength),s!=null&&s.considerCosts&&this.shortestPathAlgorithm!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${this.shortestPathAlgorithm}'. It can only be used with A* algorithm.`),this.considerCosts=(s==null?void 0:s.considerCosts)||!1,this.ignoreLayers=!!(s!=null&&s.ignoreLayers),this.distanceUtils=ie.create(t.getNumberOfDirections()),this.pathBlockedWaitTimeoutMs=(s==null?void 0:s.pathBlockedWaitTimeoutMs)||-1,this.finished$=new it,this.setCharacter(t)}setPathBlockedStrategy(t){this.pathBlockedStrategy=t}getPathBlockedStrategy(){return this.pathBlockedStrategy}setCharacter(t){this.character=t,this.noPathFoundRetryable.reset(),this.pathBlockedRetryable.reset(),this.pathBlockedWaitElapsed=0,this.calcShortestPath(),this.character.autoMovementSet().pipe(Bt(e=>e!==this),fe(1)).subscribe(()=>{this.stop("MOVEMENT_TERMINATED")})}getPathfindingOptions(){return{shortestPathAlgorithm:this.shortestPathAlgorithm,pathWidth:this.character.getTileWidth(),pathHeight:this.character.getTileHeight(),numberOfDirections:this.character.getNumberOfDirections(),isPositionAllowed:this.isPositionAllowed,collisionGroups:this.character.getCollisionGroups(),ignoredChars:[this.character.getId()],ignoreTiles:!this.character.collidesWithTiles(),ignoreMapBounds:this.character.getIgnoreMissingTiles(),ignoreBlockedTarget:this.ignoreBlockedTarget,maxPathLength:this.maxPathLength,ignoreLayers:this.ignoreLayers,considerCosts:this.considerCosts,calculateClosestToTarget:!0}}update(t){var e,n,s,a;this.stopped||(this.noPathFound()&&(this.noPathFoundStrategy==="RETRY"?this.noPathFoundRetryable.retry(t,()=>this.calcShortestPath()):this.noPathFoundStrategy==="STOP"&&this.stop("NO_PATH_FOUND")),this.updatePosOnPath(),this.isBlocking((e=this.nextTileOnPath())==null?void 0:e.position,(n=this.character)==null?void 0:n.getNextTilePos().layer)?this.applyPathBlockedStrategy(t):this.pathBlockedWaitElapsed=0,this.hasArrived()?(this.stop("SUCCESS"),this.existsDistToTarget()&&this.turnTowardsTarget()):this.isBlocking((s=this.nextTileOnPath())==null?void 0:s.position,(a=this.character)==null?void 0:a.getNextTilePos().layer)||this.moveCharOnPath())}finishedObs(){return this.finished$}getInfo(){return{type:"Target",state:{pathAhead:this.shortestPath.slice(this.posOnPath).map(t=>G.fromInternal(t))},config:{algorithm:this.shortestPathAlgorithm,ignoreBlockedTarget:this.ignoreBlockedTarget,distance:this.distance,targetPos:G.fromInternal(this.targetPos),noPathFoundStrategy:this.noPathFoundStrategy,pathBlockedStrategy:this.pathBlockedStrategy,noPathFoundRetryBackoffMs:this.noPathFoundRetryable.getBackoffMs(),noPathFoundMaxRetries:this.noPathFoundRetryable.getMaxRetries()}}}resultToReason(t){switch(t){case"SUCCESS":return"Successfully arrived.";case"MOVEMENT_TERMINATED":return"Movement of character has been replaced before destination was reached.";case"PATH_BLOCKED":return"PathBlockedStrategy STOP: Path blocked.";case"NO_PATH_FOUND_MAX_RETRIES_EXCEEDED":return`NoPathFoundStrategy RETRY: Maximum retries of ${this.noPathFoundRetryable.getMaxRetries()} exceeded.`;case"NO_PATH_FOUND":return"NoPathFoundStrategy STOP: No path found.";case"PATH_BLOCKED_MAX_RETRIES_EXCEEDED":return`PathBlockedStrategy RETRY: Maximum retries of ${this.pathBlockedRetryable.getMaxRetries()} exceeded.`;case"PATH_BLOCKED_WAIT_TIMEOUT":return`PathBlockedStrategy WAIT: Wait timeout of ${this.pathBlockedWaitTimeoutMs}ms exceeded.`}}applyPathBlockedStrategy(t){this.pathBlockedStrategy==="RETRY"?this.pathBlockedRetryable.retry(t,()=>{let e=this.getShortestPath();e.path.length>0&&this.calcShortestPath(e)}):this.pathBlockedStrategy==="STOP"?this.stop("PATH_BLOCKED"):this.pathBlockedStrategy==="WAIT"&&this.pathBlockedWaitTimeoutMs>-1&&(this.pathBlockedWaitElapsed+=t,this.pathBlockedWaitElapsed>=this.pathBlockedWaitTimeoutMs&&this.stop("PATH_BLOCKED_WAIT_TIMEOUT"))}moveCharOnPath(){let t=this.nextTileOnPath();if(!t)return;let e=this.getDir(this.character.getNextTilePos().position,t.position);this.character.move(e)}nextTileOnPath(){return this.shortestPath[this.posOnPath+1]}stop(t){this.finished$.next({position:this.character.getTilePos().position,result:t,description:this.resultToReason(t),layer:this.character.getTilePos().layer}),this.finished$.complete(),this.stopped=!0}turnTowardsTarget(){let t=this.shortestPath[this.posOnPath+1],e=this.getDir(this.character.getNextTilePos().position,t.position);this.character.turnTowards(e)}existsDistToTarget(){return this.posOnPath=this.shortestPath.length-1}updatePosOnPath(){let t=this.shortestPath[this.posOnPath];for(;this.posOnPaththis.isLayerAlwaysOnTop(a));this.tilemap.layers.filter(a=>!this.isLayerAlwaysOnTop(a)).forEach(a=>{this.hasLayerProp(a,Fe.HEIGHT_SHIFT_PROP_NAME)?(this.createHeightShiftLayers(a,e),t.push(a.tilemapLayer)):this.setDepth(a,++e)}),this.charLayerDepths.set(void 0,e),n.forEach((a,h)=>{a.tilemapLayer.setDepth(h+1+e)}),t.forEach(a=>a.destroy())}setDepth(t,e){t.tilemapLayer.setDepth(e),this.isCharLayer(t)&&this.charLayerDepths.set(this.getLayerProp(t,Fe.CHAR_LAYER_PROP_NAME),e)}createHeightShiftLayers(t,e){let n=this.getLayerProp(t,Fe.HEIGHT_SHIFT_PROP_NAME);isNaN(n)&&(n=0);let s=1;for(let a=0;aa.name==e);return s==null?void 0:s.value}hasLayerProp(t,e){return this.getLayerProp(t,e)!=null}copyLayer(t,e){let n=`${t.name}#${e}`,s=this.tilemap.createBlankLayer(n,t.tilemapLayer.tileset);if(s){s.name=n;for(let a=0;a()=>(t||r((t={exports:{}}).exports,t),t.exports),zS=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of IS(t))!RS.call(r,s)&&s!==e&&Zd(r,s,{get:()=>t[s],enumerable:!(n=MS(t,s))||n.enumerable});return r},sh=(r,t,e)=>(e=r!=null?DS(kS(r)):{},zS(t||!r||!r.__esModule?Zd(e,"default",{value:r,enumerable:!0}):e,r)),ah=FS((r,t)=>{(function(){var e,n="4.17.21",s=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",h="Expected a function",l="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",d=500,y="__lodash_placeholder__",b=1,x=2,C=4,O=1,D=2,R=1,H=2,j=4,Z=8,ht=16,At=32,ze=64,Ce=128,Ki=256,js=512,im=30,nm="...",om=800,sm=16,fh=1,am=2,um=3,Qr=1/0,Ar=9007199254740991,hm=17976931348623157e292,Un=0/0,Xe=4294967295,cm=Xe-1,lm=Xe>>>1,fm=[["ary",Ce],["bind",R],["bindKey",H],["curry",Z],["curryRight",ht],["flip",js],["partial",At],["partialRight",ze],["rearg",Ki]],di="[object Arguments]",jn="[object Array]",pm="[object AsyncFunction]",Yi="[object Boolean]",Xi="[object Date]",dm="[object DOMException]",Gn="[object Error]",Hn="[object Function]",ph="[object GeneratorFunction]",Ve="[object Map]",Ji="[object Number]",mm="[object Null]",gr="[object Object]",dh="[object Promise]",gm="[object Proxy]",Zi="[object RegExp]",Ne="[object Set]",tn="[object String]",Bn="[object Symbol]",ym="[object Undefined]",en="[object WeakMap]",vm="[object WeakSet]",rn="[object ArrayBuffer]",mi="[object DataView]",Gs="[object Float32Array]",Hs="[object Float64Array]",Bs="[object Int8Array]",Ws="[object Int16Array]",qs="[object Int32Array]",$s="[object Uint8Array]",Qs="[object Uint8ClampedArray]",Ks="[object Uint16Array]",Ys="[object Uint32Array]",bm=/\b__p \+= '';/g,wm=/\b(__p \+=) '' \+/g,Pm=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mh=/&(?:amp|lt|gt|quot|#39);/g,gh=/[&<>"']/g,Tm=RegExp(mh.source),xm=RegExp(gh.source),Sm=/<%-([\s\S]+?)%>/g,Cm=/<%([\s\S]+?)%>/g,yh=/<%=([\s\S]+?)%>/g,_m=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Lm=/^\w*$/,Em=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Xs=/[\\^$.*+?()[\]{}|]/g,Am=RegExp(Xs.source),Js=/^\s+/,Om=/\s/,Dm=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Mm=/\{\n\/\* \[wrapped with (.+)\] \*/,Im=/,? & /,km=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Rm=/[()=,{}\[\]\/\s]/,Fm=/\\(\\)?/g,zm=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vh=/\w*$/,Vm=/^[-+]0x[0-9a-f]+$/i,Nm=/^0b[01]+$/i,Um=/^\[object .+?Constructor\]$/,jm=/^0o[0-7]+$/i,Gm=/^(?:0|[1-9]\d*)$/,Hm=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Wn=/($^)/,Bm=/['\n\r\u2028\u2029\\]/g,qn="\\ud800-\\udfff",Wm="\\u0300-\\u036f",qm="\\ufe20-\\ufe2f",$m="\\u20d0-\\u20ff",bh=Wm+qm+$m,wh="\\u2700-\\u27bf",Ph="a-z\\xdf-\\xf6\\xf8-\\xff",Qm="\\xac\\xb1\\xd7\\xf7",Km="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ym="\\u2000-\\u206f",Xm=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Th="A-Z\\xc0-\\xd6\\xd8-\\xde",xh="\\ufe0e\\ufe0f",Sh=Qm+Km+Ym+Xm,Zs="['\u2019]",Jm="["+qn+"]",Ch="["+Sh+"]",$n="["+bh+"]",_h="\\d+",Zm="["+wh+"]",Lh="["+Ph+"]",Eh="[^"+qn+Sh+_h+wh+Ph+Th+"]",ta="\\ud83c[\\udffb-\\udfff]",tg="(?:"+$n+"|"+ta+")",Ah="[^"+qn+"]",ea="(?:\\ud83c[\\udde6-\\uddff]){2}",ra="[\\ud800-\\udbff][\\udc00-\\udfff]",gi="["+Th+"]",Oh="\\u200d",Dh="(?:"+Lh+"|"+Eh+")",eg="(?:"+gi+"|"+Eh+")",Mh="(?:"+Zs+"(?:d|ll|m|re|s|t|ve))?",Ih="(?:"+Zs+"(?:D|LL|M|RE|S|T|VE))?",kh=tg+"?",Rh="["+xh+"]?",rg="(?:"+Oh+"(?:"+[Ah,ea,ra].join("|")+")"+Rh+kh+")*",ig="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ng="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Fh=Rh+kh+rg,og="(?:"+[Zm,ea,ra].join("|")+")"+Fh,sg="(?:"+[Ah+$n+"?",$n,ea,ra,Jm].join("|")+")",ag=RegExp(Zs,"g"),ug=RegExp($n,"g"),ia=RegExp(ta+"(?="+ta+")|"+sg+Fh,"g"),hg=RegExp([gi+"?"+Lh+"+"+Mh+"(?="+[Ch,gi,"$"].join("|")+")",eg+"+"+Ih+"(?="+[Ch,gi+Dh,"$"].join("|")+")",gi+"?"+Dh+"+"+Mh,gi+"+"+Ih,ng,ig,_h,og].join("|"),"g"),cg=RegExp("["+Oh+qn+bh+xh+"]"),lg=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fg=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],pg=-1,ft={};ft[Gs]=ft[Hs]=ft[Bs]=ft[Ws]=ft[qs]=ft[$s]=ft[Qs]=ft[Ks]=ft[Ys]=!0,ft[di]=ft[jn]=ft[rn]=ft[Yi]=ft[mi]=ft[Xi]=ft[Gn]=ft[Hn]=ft[Ve]=ft[Ji]=ft[gr]=ft[Zi]=ft[Ne]=ft[tn]=ft[en]=!1;var ct={};ct[di]=ct[jn]=ct[rn]=ct[mi]=ct[Yi]=ct[Xi]=ct[Gs]=ct[Hs]=ct[Bs]=ct[Ws]=ct[qs]=ct[Ve]=ct[Ji]=ct[gr]=ct[Zi]=ct[Ne]=ct[tn]=ct[Bn]=ct[$s]=ct[Qs]=ct[Ks]=ct[Ys]=!0,ct[Gn]=ct[Hn]=ct[en]=!1;var dg={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},mg={"&":"&","<":"<",">":">",'"':""","'":"'"},gg={"&":"&","<":"<",">":">",""":'"',"'":"'"},yg={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},vg=parseFloat,bg=parseInt,zh=typeof global=="object"&&global&&global.Object===Object&&global,wg=typeof self=="object"&&self&&self.Object===Object&&self,Ft=zh||wg||Function("return this")(),na=typeof r=="object"&&r&&!r.nodeType&&r,Kr=na&&typeof t=="object"&&t&&!t.nodeType&&t,Vh=Kr&&Kr.exports===na,oa=Vh&&zh.process,_e=function(){try{var P=Kr&&Kr.require&&Kr.require("util").types;return P||oa&&oa.binding&&oa.binding("util")}catch(_){}}(),Nh=_e&&_e.isArrayBuffer,Uh=_e&&_e.isDate,jh=_e&&_e.isMap,Gh=_e&&_e.isRegExp,Hh=_e&&_e.isSet,Bh=_e&&_e.isTypedArray;function de(P,_,S){switch(S.length){case 0:return P.call(_);case 1:return P.call(_,S[0]);case 2:return P.call(_,S[0],S[1]);case 3:return P.call(_,S[0],S[1],S[2])}return P.apply(_,S)}function Pg(P,_,S,k){for(var B=-1,rt=P==null?0:P.length;++B-1}function sa(P,_,S){for(var k=-1,B=P==null?0:P.length;++k-1;);return S}function Jh(P,_){for(var S=P.length;S--&&yi(_,P[S],0)>-1;);return S}function Og(P,_){for(var S=P.length,k=0;S--;)P[S]===_&&++k;return k}var Dg=ca(dg),Mg=ca(mg);function Ig(P){return"\\"+yg[P]}function kg(P,_){return P==null?e:P[_]}function vi(P){return cg.test(P)}function Rg(P){return lg.test(P)}function Fg(P){for(var _,S=[];!(_=P.next()).done;)S.push(_.value);return S}function da(P){var _=-1,S=Array(P.size);return P.forEach(function(k,B){S[++_]=[B,k]}),S}function Zh(P,_){return function(S){return P(_(S))}}function Mr(P,_){for(var S=-1,k=P.length,B=0,rt=[];++S-1}function xy(i,o){var u=this.__data__,c=lo(u,i);return c<0?(++this.size,u.push([i,o])):u[c][1]=o,this}yr.prototype.clear=by,yr.prototype.delete=wy,yr.prototype.get=Py,yr.prototype.has=Ty,yr.prototype.set=xy;function vr(i){var o=-1,u=i==null?0:i.length;for(this.clear();++o=o?i:o)),i}function Oe(i,o,u,c,f,g){var v,w=o&b,T=o&x,L=o&C;if(u&&(v=f?u(i,c,f,g):u(i)),v!==e)return v;if(!gt(i))return i;var E=W(i);if(E){if(v=Lv(i),!w)return ae(i,v)}else{var A=Qt(i),I=A==Hn||A==ph;if(Nr(i))return Rc(i,w);if(A==gr||A==di||I&&!f){if(v=T||I?{}:tl(i),!w)return T?gv(i,Ny(v,i)):mv(i,lc(v,i))}else{if(!ct[A])return f?i:{};v=Ev(i,A,w)}}g||(g=new je);var F=g.get(i);if(F)return F;g.set(i,v),Al(i)?i.forEach(function(U){v.add(Oe(U,o,u,U,i,g))}):Ll(i)&&i.forEach(function(U,K){v.set(K,Oe(U,o,u,K,i,g))});var N=L?T?Ua:Na:T?he:zt,$=E?e:N(i);return Le($||i,function(U,K){$&&(K=U,U=i[K]),cn(v,K,Oe(U,o,u,K,i,g))}),v}function Uy(i){var o=zt(i);return function(u){return fc(u,i,o)}}function fc(i,o,u){var c=u.length;if(i==null)return!c;for(i=ut(i);c--;){var f=u[c],g=o[f],v=i[f];if(v===e&&!(f in i)||!g(v))return!1}return!0}function pc(i,o,u){if(typeof i!="function")throw new Ee(h);return yn(function(){i.apply(e,u)},o)}function ln(i,o,u,c){var f=-1,g=Qn,v=!0,w=i.length,T=[],L=o.length;if(!w)return T;u&&(o=pt(o,me(u))),c?(g=sa,v=!1):o.length>=s&&(g=nn,v=!1,o=new Jr(o));t:for(;++ff?0:f+u),c=c===e||c>f?f:q(c),c<0&&(c+=f),c=u>c?0:Dl(c);u0&&u(w)?o>1?Ht(w,o-1,u,c,f):Dr(f,w):c||(f[f.length]=w)}return f}var Pa=jc(),gc=jc(!0);function Je(i,o){return i&&Pa(i,o,zt)}function Ta(i,o){return i&&gc(i,o,zt)}function po(i,o){return Or(o,function(u){return xr(i[u])})}function ti(i,o){o=zr(o,i);for(var u=0,c=o.length;i!=null&&uo}function Hy(i,o){return i!=null&&st.call(i,o)}function By(i,o){return i!=null&&o in ut(i)}function Wy(i,o,u){return i>=$t(o,u)&&i=120&&E.length>=120)?new Jr(v&&E):e}E=i[0];var A=-1,I=w[0];t:for(;++A-1;)w!==i&&no.call(w,T,1),no.call(i,T,1);return i}function Lc(i,o){for(var u=i?o.length:0,c=u-1;u--;){var f=o[u];if(u==c||f!==g){var g=f;Tr(f)?no.call(i,f,1):Ma(i,f)}}return i}function Aa(i,o){return i+ao(ac()*(o-i+1))}function nv(i,o,u,c){for(var f=-1,g=Dt(so((o-i)/(u||1)),0),v=S(g);g--;)v[c?g:++f]=i,i+=u;return v}function Oa(i,o){var u="";if(!i||o<1||o>Ar)return u;do o%2&&(u+=i),o=ao(o/2),o&&(i+=i);while(o);return u}function Q(i,o){return $a(il(i,o,ce),i+"")}function ov(i){return cc(Ei(i))}function sv(i,o){var u=Ei(i);return Co(u,Zr(o,0,u.length))}function dn(i,o,u,c){if(!gt(i))return i;o=zr(o,i);for(var f=-1,g=o.length,v=g-1,w=i;w!=null&&++ff?0:f+o),u=u>f?f:u,u<0&&(u+=f),f=o>u?0:u-o>>>0,o>>>=0;for(var g=S(f);++c>>1,v=i[g];v!==null&&!ye(v)&&(u?v<=o:v=s){var L=o?null:wv(i);if(L)return Yn(L);v=!1,f=nn,T=new Jr}else T=o?[]:w;t:for(;++c=c?i:De(i,o,u)}var kc=Xg||function(i){return Ft.clearTimeout(i)};function Rc(i,o){if(o)return i.slice();var u=i.length,c=rc?rc(u):new i.constructor(u);return i.copy(c),c}function Fa(i){var o=new i.constructor(i.byteLength);return new ro(o).set(new ro(i)),o}function lv(i,o){var u=o?Fa(i.buffer):i.buffer;return new i.constructor(u,i.byteOffset,i.byteLength)}function fv(i){var o=new i.constructor(i.source,vh.exec(i));return o.lastIndex=i.lastIndex,o}function pv(i){return hn?ut(hn.call(i)):{}}function Fc(i,o){var u=o?Fa(i.buffer):i.buffer;return new i.constructor(u,i.byteOffset,i.length)}function zc(i,o){if(i!==o){var u=i!==e,c=i===null,f=i===i,g=ye(i),v=o!==e,w=o===null,T=o===o,L=ye(o);if(!w&&!L&&!g&&i>o||g&&v&&T&&!w&&!L||c&&v&&T||!u&&T||!f)return 1;if(!c&&!g&&!L&&i=w)return T;var L=u[c];return T*(L=="desc"?-1:1)}}return i.index-o.index}function Vc(i,o,u,c){for(var f=-1,g=i.length,v=u.length,w=-1,T=o.length,L=Dt(g-v,0),E=S(T+L),A=!c;++w1?u[f-1]:e,v=f>2?u[2]:e;for(g=i.length>3&&typeof g=="function"?(f--,g):e,v&&te(u[0],u[1],v)&&(g=f<3?e:g,f=1),o=ut(o);++c-1?f[g?o[v]:v]:e}}function Bc(i){return Pr(function(o){var u=o.length,c=u,f=Ae.prototype.thru;for(i&&o.reverse();c--;){var g=o[c];if(typeof g!="function")throw new Ee(h);if(f&&!v&&xo(g)=="wrapper")var v=new Ae([],!0)}for(c=v?c:u;++c1&&X.reverse(),E&&Tw))return!1;var L=g.get(i),E=g.get(o);if(L&&E)return L==o&&E==i;var A=-1,I=!0,F=u&D?new Jr:e;for(g.set(i,o),g.set(o,i);++A1?"& ":"")+o[c],o=o.join(u>2?", ":" "),i.replace(Dm,`{ + `):"",this.name="UnsubscriptionError",this.errors=e}});function wn(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var Oi=function(){function r(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var t,e,n,s,a;if(!this.closed){this.closed=!0;var h=this._parentage;if(h)if(this._parentage=null,Array.isArray(h))try{for(var l=_r(h),p=l.next();!p.done;p=l.next()){var d=p.value;d.remove(this)}}catch(D){t={error:D}}finally{try{p&&!p.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}else h.remove(this);var y=this.initialTeardown;if(tt(y))try{y()}catch(D){a=D instanceof zo?D.errors:[D]}var b=this._finalizers;if(b){this._finalizers=null;try{for(var x=_r(b),C=x.next();!C.done;C=x.next()){var O=C.value;try{tf(O)}catch(D){a=a!=null?a:[],D instanceof zo?a=rr(rr([],er(a)),er(D.errors)):a.push(D)}}}catch(D){n={error:D}}finally{try{C&&!C.done&&(s=x.return)&&s.call(x)}finally{if(n)throw n.error}}}if(a)throw new zo(a)}},r.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)tf(t);else{if(t instanceof r){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},r.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},r.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},r.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&wn(e,t)},r.prototype.remove=function(t){var e=this._finalizers;e&&wn(e,t),t instanceof r&&t._removeParent(this)},r.EMPTY=function(){var t=new r;return t.closed=!0,t}(),r}();var fu=Oi.EMPTY;function Vo(r){return r instanceof Oi||r&&"closed"in r&&tt(r.remove)&&tt(r.add)&&tt(r.unsubscribe)}function tf(r){tt(r)?r():r.unsubscribe()}var qe={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Di={setTimeout:function(r,t){for(var e=[],n=2;n0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var n=this,s=this,a=s.hasError,h=s.isStopped,l=s.observers;return a||h?fu:(this.currentObservers=null,l.push(e),new Oi(function(){n.currentObservers=null,wn(l,e)}))},t.prototype._checkFinalizedStatuses=function(e){var n=this,s=n.hasError,a=n.thrownError,h=n.isStopped;s?e.error(a):h&&e.complete()},t.prototype.asObservable=function(){var e=new Vt;return e.source=this,e},t.create=function(e,n){return new uf(e,n)},t}(Vt);var uf=function(r){Gr(t,r);function t(e,n){var s=r.call(this)||this;return s.destination=e,s.source=n,s}return t.prototype.next=function(e){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.next)===null||s===void 0||s.call(n,e)},t.prototype.error=function(e){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.error)===null||s===void 0||s.call(n,e)},t.prototype.complete=function(){var e,n;(n=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||n===void 0||n.call(e)},t.prototype._subscribe=function(e){var n,s;return(s=(n=this.source)===null||n===void 0?void 0:n.subscribe(e))!==null&&s!==void 0?s:fu},t}(it);var Ho=new Vt(function(r){return r.complete()});function hf(r){return r&&tt(r.schedule)}function cf(r){return r[r.length-1]}function Bo(r){return hf(cf(r))?r.pop():void 0}function Wo(r,t){return typeof cf(r)=="number"?r.pop():t}var qo=function(r){return r&&typeof r.length=="number"&&typeof r!="function"};function $o(r){return tt(r==null?void 0:r.then)}function Qo(r){return tt(r[Ii])}function Ko(r){return Symbol.asyncIterator&&tt(r==null?void 0:r[Symbol.asyncIterator])}function Yo(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function bT(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Xo=bT();function Jo(r){return tt(r==null?void 0:r[Xo])}function Zo(r){return Jl(this,arguments,function(){var e,n,s,a;return Ro(this,function(h){switch(h.label){case 0:e=r.getReader(),h.label=1;case 1:h.trys.push([1,,9,10]),h.label=2;case 2:return[4,ni(e.read())];case 3:return n=h.sent(),s=n.value,a=n.done,a?[4,ni(void 0)]:[3,5];case 4:return[2,h.sent()];case 5:return[4,ni(s)];case 6:return[4,h.sent()];case 7:return h.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function ts(r){return tt(r==null?void 0:r.getReader)}function le(r){if(r instanceof Vt)return r;if(r!=null){if(Qo(r))return wT(r);if(qo(r))return PT(r);if($o(r))return TT(r);if(Ko(r))return lf(r);if(Jo(r))return xT(r);if(ts(r))return ST(r)}throw Yo(r)}function wT(r){return new Vt(function(t){var e=r[Ii]();if(tt(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function PT(r){return new Vt(function(t){for(var e=0;e{let a=this.tilePosInDirection(new M(n,s),t);return this.tilemap.hasBlockingTile(a,e,Yl(t),this.ignoreMissingTiles)})}isCharBlocking(t,e){return this.someCharTile((n,s)=>{let a=this.tilePosInDirection(new M(n,s),t);return this.tilemap.hasBlockingChar(a,e,this.getCollisionGroups(),new Set([this.getId()]))})}isMoving(){return this.movementDirection!="none"}turnTowards(t){this.isMoving()||t!="none"&&this.changeFacingDirection(t)}changeFacingDirection(t){this.facingDirection!==t&&(this.facingDirection=t,this.directionChanged$.next(t))}getFacingDirection(){return this.facingDirection}getFacingPosition(){return this._tilePos.position.add(We(this.facingDirection))}addCollisionGroup(t){this.collisionGroups.add(t)}setCollisionGroups(t){this.collisionGroups=new Set(t)}getCollisionGroups(){return Array.from(this.collisionGroups)}hasCollisionGroup(t){return this.collisionGroups.has(t)}removeCollisionGroup(t){this.collisionGroups.delete(t)}removeAllCollisionGroups(){this.collisionGroups.clear()}addLabels(t){for(let e of t)this.labels.add(e)}getLabels(){return[...this.labels.values()]}hasLabel(t){return this.labels.has(t)}clearLabels(){this.labels.clear()}removeLabels(t){for(let e of t)this.labels.delete(e)}getNumberOfDirections(){return this.numberOfDirections}movementStarted(){return this.movementStarted$}movementStopped(){return this.movementStopped$}directionChanged(){return this.directionChanged$}tilePositionSet(){return this.tilePositionSet$}positionChangeStarted(){return this.positionChangeStarted$}positionChangeFinished(){return this.positionChangeFinished$}autoMovementSet(){return this.autoMovementSet$}depthChanged(){return this.depthChanged$}getMovementProgress(){return this.movementProgress}hasWalkedHalfATile(){return this.movementProgress>si/2}willCrossTileBorderThisUpdate(t){return this.movementProgress+this.maxProgressForDelta(t)>=si}updateCharacterPosition(t){let e=this.willCrossTileBorderThisUpdate(t),s=1-(e?si-this.movementProgress:this.maxProgressForDelta(t))/this.maxProgressForDelta(t);this.movementProgress=Math.min(this.movementProgress+this.maxProgressForDelta(t),si),e&&(this.movementProgress=0,this.shouldContinueMoving()?(this.fire(this.positionChangeFinished$,this.tilePos,this.getNextTilePos()),this.tilePos=this.getNextTilePos(),this.startMoving(this.lastMovementImpulse),s>0&&this.updateCharacterPosition(t*s)):this.stopMoving())}maxProgressForDelta(t){let n=t/1e3;return Math.floor(n*this.speed*si)}get tilePos(){return G.clone(this._tilePos)}set tilePos(t){G.copyOver(t,this._tilePos)}startMoving(t){t!=="none"&&(t!=this.movementDirection&&this.movementStarted$.next(t),this.movementDirection=t,this.facingDirection=t,this.fire(this.positionChangeStarted$,this.tilePos,this.getNextTilePos()))}tilePosInDirection(t,e){return t.add(We(this.tilemap.toMapDirection(e)))}shouldContinueMoving(){return this.lastMovementImpulse!=="none"&&!this.isBlockingDirection(this.lastMovementImpulse)}stopMoving(){if(this.movementDirection==="none")return;let t=this.tilePos,e=this.getNextTilePos(),n=this.movementDirection;this.tilePos=this.getNextTilePos(),this.movementDirection="none",this.movementStopped$.next(n),this.fire(this.positionChangeFinished$,t,e)}fire(t,{position:e,layer:n},{position:s,layer:a}){t.next({exitTile:e,enterTile:s,exitLayer:n,enterLayer:a})}someCharTile(t){let e=this.getNextTilePos().position;for(let n=e.x;nh===this.charData.id)).subscribe(({direction:h})=>{var l;(l=this.animation)==null||l.setStandingFrame(h)}),this.sprite&&(this.sprite.setOrigin(0,0),this.resetAnimation(this.sprite),this.updateOverlaySprite(),this.updateGridChar())}destroy(){this.destroy$.next(),this.destroy$.complete(),this.newSpriteSet$.complete()}setSprite(t){t?(this.sprite&&(t.x=this.sprite.x,t.y=this.sprite.y),this.sprite=t,this.newSpriteSet$.next(),this.layerOverlaySprite=this.layerOverlaySprite?this.scene.add.sprite(0,0,this.sprite.texture):void 0,this.updateOverlaySprite(),this.resetAnimation(this.sprite),this.updateDepth()):(this.layerOverlaySprite=void 0,this.sprite=void 0)}getSprite(){return this.sprite}getLayerOverlaySprite(){return this.layerOverlaySprite}setContainer(t){this.container=t}getContainer(){return this.container}getOffsetX(){return this.customOffset.x}setOffsetX(t){this.customOffset.x=t}getOffsetY(){return this.customOffset.y}setOffsetY(t){this.customOffset.y=t}getWalkingAnimationMapping(){return this.walkingAnimationMapping}turnTowards(t){var e;this.geHeadless.isMoving(this.charData.id)||t!="none"&&(this.geHeadless.turnTowards(this.charData.id,t),(e=this.animation)==null||e.setStandingFrame(t))}getAnimation(){return this.animation}setAnimation(t){this.animation=t}update(t){this.updateGridChar()}getEngineOffset(){var n,s,a,h;if(!this.sprite)return M.ZERO;let t=this.tilemap.getTileWidth()/2-Math.floor(((s=(n=this.sprite)==null?void 0:n.displayWidth)!=null?s:0)/2),e=-((h=(a=this.sprite)==null?void 0:a.displayHeight)!=null?h:0)+this.tilemap.getTileHeight();return new M(t,e)}updatePixelPos(){let t=new M(this.geHeadless.getPosition(this.charData.id)),e=this.geHeadless.getMovementProgress(this.charData.id)/1e3,s=this.tilemap.tilePosToPixelPos(t).add(this.getEngineOffset()).add(this.customOffset).add(We(this.geHeadless.getFacingDirection(this.charData.id)).multiply(this.tilemap.getTileDistance(this.geHeadless.getFacingDirection(this.charData.id)).scalarMult(e))),a=this.getGameObj();a&&(a.x=Math.floor(s.x),a.y=Math.floor(s.y))}getGameObj(){return this.container||this.sprite}updateGridChar(){var t;if(this.updatePixelPos(),this.sprite&&this.geHeadless.isMoving(this.charData.id)){let e=this.geHeadless.getMovementProgress(this.charData.id)>si/2;(t=this.getAnimation())==null||t.updateCharacterFrame(this.geHeadless.getFacingDirection(this.charData.id),e,Number(this.sprite.frame.name))}this.updateDepth()}resetAnimation(t){let e=new xn(this.walkingAnimationMapping,t.texture.source[0].width/t.width/xn.FRAMES_CHAR_ROW);this.setAnimation(e),e.frameChange().pipe(Mt(this.newSpriteSet$)).subscribe(n=>{t==null||t.setFrame(n)}),e.setIsEnabled(this.walkingAnimationMapping!==void 0),e.setStandingFrame(this.geHeadless.getFacingDirection(this.charData.id))}updateOverlaySprite(){if(!this.layerOverlaySprite||!this.sprite)return;this.layerOverlaySprite.scale=this.sprite.scale;let t=this.tilemap.getTileHeight()/this.layerOverlaySprite.scale;this.layerOverlaySprite.setCrop(0,0,this.layerOverlaySprite.displayWidth,this.sprite.height-t),this.layerOverlaySprite.setOrigin(0,0)}updateDepth(){let t=this.getGameObj();if(!t)return;let e=new M(this.geHeadless.getPosition(this.charData.id)),n=this.geHeadless.getCharLayer(this.charData.id);this.setDepth(t,{position:e,layer:n});let s=this.getLayerOverlaySprite();if(s){let a=new M(Be(ot({},e),{y:e.y-1}));this.setDepth(s,{position:a,layer:n})}}setDepth(t,e){t.setDepth(this.tilemap.getDepthOfCharLayer(this.getTransitionLayer(e))+this.getPaddedPixelDepth(t))}getPaddedPixelDepth(t){return ki.shiftPad(t.y+t.displayHeight,7)}getTransitionLayer(t){if(t.layer)return this.geHeadless.getTransition(t.position,t.layer)||t.layer}};var us=(s=>(s.DONT_BLOCK="DONT_BLOCK",s.BLOCK_TWO_TILES="BLOCK_TWO_TILES",s.BLOCK_ONE_TILE_AHEAD="BLOCK_ONE_TILE_AHEAD",s.BLOCK_ONE_TILE_BEHIND="BLOCK_ONE_TILE_BEHIND",s))(us||{});var Ri=(n=>(n.STOP="STOP",n.CLOSEST_REACHABLE="CLOSEST_REACHABLE",n.RETRY="RETRY",n))(Ri||{});var xt=class r{static vec2str(t){return`${t.x}#${t.y}`}static equal(t,e){return r.vec2str(t)==r.vec2str(e)}static manhattanDistance(t,e){let n=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return n+s}static chebyshevDistance(t,e){let n=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return Math.max(n,s)}static scalarMult(t,e){return t.clone().multiply(new M(e,e))}};var hs=class{distance(t,e){return xt.manhattanDistance(t,e)}direction(t,e){if(xt.equal(t,e))return"none";let n=t.clone().subtract(e);return Math.abs(n.x)>Math.abs(n.y)?n.x>0?"left":"right":n.y>0?"up":"down"}neighbors(t){return[new M(t.x,t.y+1),new M(t.x+1,t.y),new M(t.x-1,t.y),new M(t.x,t.y-1)]}getDirections(){return["up","right","down","left"]}};var cs=class{distance(t,e){return xt.chebyshevDistance(t,e)}neighbors(t){let e=[new M(t.x,t.y+1),new M(t.x+1,t.y),new M(t.x-1,t.y),new M(t.x,t.y-1)],n=[new M(t.x+1,t.y+1),new M(t.x+1,t.y-1),new M(t.x-1,t.y+1),new M(t.x-1,t.y-1)];return[...e,...n]}direction(t,e){return e.x>t.x?e.y>t.y?"down-right":e.yt.y?"down-left":e.yt.y?"down":"none"}getDirections(){return["up","right","down","left","down-left","down-right","up-right","up-left"]}};var ie=class{static create(t){switch(t){case 4:return new hs;case 8:return new cs}}};var Sn=class{constructor(t,e,n){this.backoffMs=t;this.maxRetries=e;this.onFinished=n;this.retries=0;this.elapsed=0}retry(t,e){this.shouldRetry()?(this.elapsed+=t,this.elapsed>=this.backoffMs&&(this.elapsed=0,this.retries++,e())):this.onFinished()}reset(){this.retries=0,this.elapsed=0}getMaxRetries(){return this.maxRetries}getBackoffMs(){return this.backoffMs}shouldRetry(){return this.maxRetries===-1||this.retries(n.WAIT="WAIT",n.RETRY="RETRY",n.STOP="STOP",n))(Cn||{});var nr=class{constructor(t,{shortestPathAlgorithm:e="BFS",pathWidth:n=1,pathHeight:s=1,numberOfDirections:a=4,isPositionAllowed:h=(R,H)=>!0,collisionGroups:l=[],ignoredChars:p=[],ignoreTiles:d=!1,ignoreMapBounds:y=!1,ignoreBlockedTarget:b=!1,maxPathLength:x=1/0,ignoreLayers:C=!1,considerCosts:O=!1,calculateClosestToTarget:D=!0}={}){this.gridTilemap=t;this.options={shortestPathAlgorithm:e,pathWidth:n,pathHeight:s,numberOfDirections:a,isPositionAllowed:h,collisionGroups:l,ignoredChars:p,ignoreTiles:d,ignoreMapBounds:y,ignoreBlockedTarget:b,maxPathLength:x,ignoreLayers:C,considerCosts:O,calculateClosestToTarget:D}}findShortestPath(t,e){this.options.ignoreLayers&&(this.gridTilemap.fixCacheLayer(t.layer),e.layer=t.layer);let n=this.findShortestPathImpl(t,e);return this.gridTilemap.unfixCacheLayers(),n}getNeighbors(t,e){var h;return ie.create((h=this.options.numberOfDirections)!=null?h:4).neighbors(t.position).map(l=>{let p=t.layer;return this.options.ignoreLayers||(p=this.gridTilemap.getTransition(l,t.layer)),{position:l,layer:p||t.layer}}).filter(l=>!this.isBlocking(t,l)||this.options.ignoreBlockedTarget&&G.equal(l,e))}getTransition(t,e){if(!this.options.ignoreLayers)return this.gridTilemap.getTransition(t,e)}getCosts(t,e){if(!this.options.considerCosts)return 1;let n=re(e.position,t);return this.gridTilemap.getTileCosts(e,n)}isBlocking(t,e){return!(this.options.ignoreMapBounds||this.gridTilemap.isInRange(e.position))||!this.options.isPositionAllowed(e.position,e.layer)||!this.options.ignoreTiles&&this.hasBlockingTileFrom(t,e,this.options.pathWidth,this.options.pathHeight,this.options.ignoreMapBounds,this.gridTilemap)?!0:this.hasBlockingCharFrom(e,this.options.pathWidth,this.options.pathHeight,this.options.collisionGroups,this.options.ignoredChars,this.gridTilemap)}distance(t,e){return(this.options.numberOfDirections===4?xt.manhattanDistance:xt.chebyshevDistance)(t,e)}getTilePosInDir(t,e){return this.gridTilemap.getTilePosInDirection(t,e)}getReverseNeighbors(t,e){var l;let s=ie.create((l=this.options.numberOfDirections)!=null?l:4).neighbors(t.position),a;if(!this.options.ignoreLayers){let p=this.gridTilemap.getReverseTransitions(t.position,t.layer);a=p?[...p]:void 0}return s.map(p=>a?a.map(d=>({position:p,layer:d||t.layer})):[{position:p,layer:t.layer}]).flat().filter(p=>!this.isBlocking(p,t)||this.options.ignoreBlockedTarget&&G.equal(t,e))}hasBlockingCharFrom(t,e,n,s,a,h){for(let l=t.position.x;lEn(a,y)-En(a,b)),l=t,p=this.distance(t.position,e.position),d=0;for(h.push(t),s.set(G.toString(t),0),a.set(G.toString(t),this.distance(t.position,e.position));h.size>0;){let y=h.pop();if(!y)break;d++;let b=this.distance(y.position,e.position);if(bthis.options.maxPathLength)return{previous:new Map,closestToTarget:l,steps:d,maxPathLengthReached:!0};for(let x of this.getNeighbors(y,e)){let C=En(s,y)+this.getCosts(y.position,x),O=G.toString(x);(!s.has(O)||C0;){let d=a.dequeue();if(p++,!d)break;let{node:y,dist:b}=d;if(b>this.options.maxPathLength)return{previous:new Map,closestToTarget:h,steps:p,maxPathLengthReached:!0};let x=this.distance(y.position,e.position);if(xthis.lastDist)}step(t,e,n){var s;this.lastDist=n;for(let a of t){let h=G.toString(a);if(!this.visited.has(h)){this.previous.set(h,e),this.queue.enqueue({node:a,dist:n+1}),this.visited.set(h,n+1);let l=(s=this.otherBfs)==null?void 0:s.visited.get(h);l!==void 0&&l0,s.queue.size()>0);){let d=n.queue.dequeue();if(!d)break;let{node:y,dist:b}=d;if(b+1+(((p=s.queue.peek())==null?void 0:p.dist)||0)>this.options.maxPathLength)return{previous:n.previous,previous2:s.previous,closestToTarget:this.maybeClosestToTarget(h),steps:a,maxPathLengthReached:!0};let x=this.distance(y.position,e.position);if(xMn(this.f,h)-Mn(this.f,l)),this.openSet.push(e);let a=G.toString(e);for(this.g.set(a,0),this.f.set(a,this.distance(e.position,n.position)),this.maxFrontierSize=Math.max(this.maxFrontierSize,this.openSet.size);this.openSet.size>0;){let h=this.openSet.pop();if(!h)break;if(this.steps++,G.equal(h,n))return{previous:s,closestToTarget:n,steps:this.steps,maxPathLengthReached:!1};if(Mn(this.g,h)+1>this.options.maxPathLength)return{previous:new Map,closestToTarget:this.closestToTarget,steps:this.steps,maxPathLengthReached:!0};this.updateClosestToTarget(h,n);for(let l of this.getNeighborsInternal(h,s.get(G.toString(h)),n)){let p=G.toString(l.p),d=Mn(this.g,h)+l.dist;(!this.g.has(p)||d({p:l,dist:1}));let a=this.prune(n,e).map(l=>{let p=this.getTransition(l.position,e.layer);return{position:l.position,layer:p||e.layer}}),h=[];for(let l of a){let p=this.jump(e,l,s,1);p&&h.push(p)}return h}jump(e,n,s,a){let h=this.distanceUtils.direction(e.position,n.position);if(!(this.isBlocking(e,n)&&!(G.equal(n,s)&&this.options.ignoreBlockedTarget)))return G.equal(n,s)?{p:n,dist:a}:a>=this.maxJumpSize?{p:n,dist:a}:this.getTransition(n.position,e.layer)!==void 0?{p:n,dist:a}:cu(h)?{p:n,dist:a}:this.getForced(e,n).length>0?{p:n,dist:a}:(this.updateClosestToTarget(n,s),this.jump(n,this.getTilePosInDir(n,re(e.position,n.position)),s,a+1))}getForced(e,n){let s=[],a=this.posInDir(n,this.distanceUtils.direction(n.position,e.position)),{topLeft:h,downLeft:l,top:p,bottom:d}=this.normalizedPositions(a,n),y=(x,C)=>this.isBlocking(x,C)||this.getTransition(C.position,C.layer)!==void 0,b=this.distanceUtils.direction(e.position,n.position);return Ql(b)&&((y(a,l)||y(l,d))&&!this.isBlocking(n,d)&&s.push(d),(y(a,h)||y(h,p))&&!this.isBlocking(n,p)&&s.push(p)),s}prune(e,n){let{right:s,top:a,bottom:h}=this.normalizedPositions(e,n),l=this.getForced(e,n),p=re(e.position,n.position);return cu(p)?[s,a,h]:[s,...l]}normalizedPositions(e,n){var a,h,l,p,d,y,b;let s=re(e.position,n.position);return{topLeft:this.posInDir(n,((a=this.turnTimes.get("up-left"))==null?void 0:a.get(this.turnOrder[s]))||"up-left"),downLeft:this.posInDir(n,((h=this.turnTimes.get("down-left"))==null?void 0:h.get(this.turnOrder[s]))||"down-left"),downRight:this.posInDir(n,((l=this.turnTimes.get("down-right"))==null?void 0:l.get(this.turnOrder[s]))||"down-right"),topRight:this.posInDir(n,((p=this.turnTimes.get("up-right"))==null?void 0:p.get(this.turnOrder[s]))||"up-right"),top:this.posInDir(n,((d=this.turnTimes.get("up"))==null?void 0:d.get(this.turnOrder[s]))||"up"),bottom:this.posInDir(n,((y=this.turnTimes.get("down"))==null?void 0:y.get(this.turnOrder[s]))||"down"),right:this.posInDir(n,((b=this.turnTimes.get("right"))==null?void 0:b.get(this.turnOrder[s]))||"right")}}posInDir(e,n){return{position:e.position.add(We(n)),layer:e.layer}}returnPath(e,n,s){let a=[],h=s;for(a.push(h);!G.equal(h,n);){let l=e.get(G.toString(h));if(!l)return[];this.distance(l.position,h.position)>1?this.fillPath(h,l,a):a.push(l),h=l}return a.reverse()}fillPath(e,n,s){let a=e;do{let h=re(a.position,n.position);a=this.getTilePosInDir(a,h),s.push(a)}while(!xt.equal(a.position,n.position))}};function Mn(r,t){var e;return(e=r.get(G.toString(t)))!=null?e:Number.MAX_VALUE}function LS(){let r=["right","down-right","down","down-left","left","up-left","up","up-right"],t=new Map;for(let e=0;eh!==this),fe(1)))).subscribe(({enterTile:h,enterLayer:l})=>{this.updateTarget(h,l)})}update(t){var e;(e=this.targetMovement)==null||e.update(t)}getInfo(){return{type:"Follow",config:{charToFollow:this.charToFollow.getId(),distance:this.options.distance,noPathFoundStrategy:this.options.noPathFoundStrategy,maxPathLength:this.options.maxPathLength,ignoreLayers:this.options.ignoreLayers}}}updateTarget(t,e){this.targetMovement=new $i(this.character,this.gridTilemap,{position:new M(t),layer:e},{distance:this.options.distance+1,config:{algorithm:this.options.shortestPathAlgorithm,noPathFoundStrategy:this.options.noPathFoundStrategy,maxPathLength:this.options.maxPathLength,ignoreLayers:this.options.ignoreLayers,considerCosts:this.options.considerCosts},ignoreBlockedTarget:!0})}};var In=class{static getRandomInt(t){return Math.floor(Math.random()*Math.floor(t))}};var Es=class{constructor(t,e=0,n=-1){this.character=t;this.delay=e;this.radius=n;this.stepSize=0;this.delayLeft=this.delay,this.initialRow=t.getNextTilePos().position.y,this.initialCol=t.getNextTilePos().position.x,this.randomizeStepSize(),this.stepsWalked=0,this.currentMovementDirection="none",this.character.positionChangeStarted().pipe(Mt(this.character.autoMovementSet().pipe(Bt(s=>s!==this),fe(1)))).subscribe(()=>{this.stepsWalked++}),this.distanceUtils=ie.create(t.getNumberOfDirections())}update(t){if(this.shouldContinueWalkingCurrentDirection())this.character.move(this.currentMovementDirection);else if(this.delayLeft-=t,this.delayLeft<=0){this.delayLeft=this.delay;let e=this.getFreeRandomDirection();this.stepsWalked=0,this.character.move(e),this.currentMovementDirection=e,this.randomizeStepSize()}}getInfo(){return{type:"Random",config:{delay:this.delay,radius:this.radius}}}shouldContinueWalkingCurrentDirection(){return this.stepsWalked!this.character.isBlockingDirection(e)).filter(e=>this.isWithinRadius(e))}isWithinRadius(t){return this.radius==-1?!0:this.getDist(t)<=this.radius}getDist(t){return this.distanceUtils.distance(this.character.getNextTilePos().position.add(We(t)),new M(this.initialCol,this.initialRow))}getFreeRandomDirection(){let t=this.getFreeDirections();return t.length==0?"none":t[In.getRandomInt(t.length)]}randomizeStepSize(){this.stepSize=In.getRandomInt(this.radius)+1}};function Qd(r,t){return r.filter(e=>{var n,s,a,h,l,p;return(n=t.labels)!=null&&n.withAllLabels?(s=t.labels)==null?void 0:s.withAllLabels.every(d=>e.hasLabel(d)):(a=t.labels)!=null&&a.withOneOfLabels?(h=t.labels)==null?void 0:h.withOneOfLabels.some(d=>e.hasLabel(d)):(l=t.labels)!=null&&l.withNoneLabels?!((p=t.labels)!=null&&p.withNoneLabels.some(d=>e.hasLabel(d))):!0})}var As="2.38.1";var Os=class{constructor(t,e){this.collistionStrategy=t;this.collisionGroupRelation=e;this.tilePosToCharacters=new Map;this.charRemoved$=new it}isCharBlockingAt(t,e,n,s=new Set){if(n.length===0)return!1;let a=this.posToString(t,e),h=this.tilePosToCharacters.get(a);return!!(h&&h.size>0&&[...h].filter(l=>!s.has(l.getId())).some(l=>n.some(p=>l.getCollisionGroups().some(d=>this.collidesWith(p,d)))))}collidesWith(t,e){return this.collisionGroupRelation?(this.collisionGroupRelation.get(t)||new Set).has(e):t===e}getCharactersAt(t,e){let n=this.posToString(t,e),s=this.tilePosToCharacters.get(n);return new Set(s)}addCharacter(t){this.addTilePositions(t.getTilePos(),t),this.addTilePositions(t.getNextTilePos(),t),this.addPositionChangeSub(t),this.addPositionChangeFinishedSub(t),this.addTilePosSetSub(t)}removeCharacter(t){let e=t.getId();this.charRemoved$.next(e),this.deleteTilePositions(t.getTilePos(),t),this.deleteTilePositions(t.getNextTilePos(),t)}add(t,e){var n;this.tilePosToCharacters.has(t)||this.tilePosToCharacters.set(t,new Set),(n=this.tilePosToCharacters.get(t))==null||n.add(e)}addTilePosSetSub(t){t.tilePositionSet().pipe(Mt(this.charRemoved(t.getId()))).subscribe(e=>{this.deleteTilePositions(t.getNextTilePos(),t),this.addTilePositions(e,t)})}charRemoved(t){var e;return(e=this.charRemoved$)==null?void 0:e.pipe(fe(1),Bt(n=>n==t))}addPositionChangeSub(t){t.positionChangeStarted().pipe(Mt(this.charRemoved(t.getId())),this.posChangeToLayerPos()).subscribe(e=>{this.collistionStrategy==="BLOCK_ONE_TILE_AHEAD"&&this.deleteTilePositions(e.exit,t),this.addTilePositions(e.enter,t)})}addPositionChangeFinishedSub(t){t.positionChangeFinished().pipe(Mt(this.charRemoved(t.getId())),this.posChangeToLayerPos()).subscribe(e=>{this.deleteTilePositions(e.exit,t),this.addTilePositions(e.enter,t)})}addTilePositions(t,e){this.forEachCharTile(t,e,(n,s)=>{this.add(this.posToString(new M(n,s),t.layer),e)})}deleteTilePositions(t,e){this.forEachCharTile(t,e,(n,s)=>{var a;(a=this.tilePosToCharacters.get(this.posToString(new M(n,s),t.layer)))==null||a.delete(e)})}forEachCharTile(t,e,n){let s=t.position;for(let a=s.x;a({enter:{position:new M(t.enterTile),layer:t.enterLayer},exit:{position:new M(t.exitTile),layer:t.exitLayer}})))}posToString(t,e){return`${t.x}#${t.y}#${e}`}};var $r=class{constructor(t,e,n,s){this.x=t;this.y=e;this.width=n;this.height=s}getX(){return this.x}getY(){return this.y}getWidth(){return this.width}getHeight(){return this.height}isInRange(t){return t.x>=this.x&&t.x=this.y&&t.yn.isCharLayer());for(let n of[...e,void 0]){let s=this.tileCollisionCache.get(n==null?void 0:n.getName());if(s===void 0){s=new Array(this.tilemap.getWidth());for(let a=0;a>t&1)==1}var Yd="ge_cost",ks=class ks{constructor(t,e,n,s=void 0,a=!1){this.tilemap=t;this.collisionTilePropertyName=e;this.useTileCollisionCache=a;this.characters=new Map;this.transitions=new Map;this.reverseTransitions=new Map;this.collidesPropNames=new Map;this.tileCostPropNames=new Map;this.collisionRelevantLayersFrameCache=new Map;this.charBlockCache=new Os(n,s);for(let h of bn())this.collidesPropNames.set(h,ks.ONE_WAY_COLLIDE_PROP_PREFIX+h),this.tileCostPropNames.set(h,`${Yd}_${h}`);this.useTileCollisionCache&&(this.tileCollisionCache=new Ms(t,this),this.tileCollisionCache.rebuild())}fixCacheLayer(t){var e;(e=this.tileCollisionCache)==null||e.fixLayer(t)}unfixCacheLayers(){var t;(t=this.tileCollisionCache)==null||t.unfixLayers()}addCharacter(t){this.characters.set(t.getId(),t),t.getNextTilePos().layer===void 0&&t.setTilePosition(Be(ot({},t.getNextTilePos()),{layer:this.getLowestCharLayer()})),this.charBlockCache.addCharacter(t)}removeCharacter(t){let e=this.characters.get(t);e&&(this.charBlockCache.removeCharacter(e),this.characters.delete(t))}getCharacters(){return[...this.characters.values()]}getCharactersAt(t,e){return this.charBlockCache.getCharactersAt(t,e)}rebuildTileCollisionCache(t){var e;(e=this.tileCollisionCache)==null||e.rebuild(t)}hasBlockingTileUncached(t,e,n,s){if(!s&&this.hasNoTileUncached(t,e))return!0;let a=this.getCollisionRelevantLayers(e);for(let h of a)if(this.isLayerBlockingAt(h.getName(),t,n))return!0;return!1}hasBlockingTile(t,e,n,s){var h;let a=(h=this.tileCollisionCache)==null?void 0:h.isBlockingFrom(t.x,t.y,e,n,s);return a!==void 0?a:this.hasBlockingTileUncached(t,e,n,s)}getTransition(t,e){let n=this.transitions.get(t.toString());if(n)return n.get(e)}getReverseTransitions(t,e){let n=this.reverseTransitions.get(t.toString());if(n)return n.get(e)}setTransition(t,e,n){var s,a,h,l,p;this.transitions.has(t.toString())||this.transitions.set(t.toString(),new Map),this.reverseTransitions.has(t.toString())||this.reverseTransitions.set(t.toString(),new Map),(s=this.transitions.get(t.toString()))==null||s.set(e,n),(a=this.reverseTransitions.get(t.toString()))!=null&&a.has(n)||(h=this.reverseTransitions.get(t.toString()))==null||h.set(n,new Set),(p=(l=this.reverseTransitions.get(t.toString()))==null?void 0:l.get(n))==null||p.add(e)}getTransitions(){return new Map([...this.transitions].map(([t,e])=>[t,new Map(e)]))}getTileCosts(t,e){let n=this.getCollisionRelevantLayers(t.layer),s=1;for(let a of n)s=Math.max(s,this.getTileCostsForLayer(Be(ot({},t),{layer:a.getName()}),e));return s}getTileCostsForLayer(t,e){let n=this.tilemap.getTileAt(t.position.x,t.position.y,t.layer);return e&&(n==null?void 0:n.getProperty(this.tileCostPropNames.get(e)||""))||(n==null?void 0:n.getProperty(Yd))||1}hasNoTileUncached(t,e){return!this.getCollisionRelevantLayers(e).some(s=>this.tilemap.hasTileAt(t.x,t.y,s.getName()))}hasNoTile(t,e){var s;let n=(s=this.tileCollisionCache)==null?void 0:s.hasTileAt(t.x,t.y,e);return n!==void 0?n:this.hasNoTileUncached(t,e)}hasBlockingChar(t,e,n,s=new Set){return this.charBlockCache.isCharBlockingAt(t,e,n,s)}isInRange(t){return new $r(0,0,this.tilemap.getWidth(),this.tilemap.getHeight()).isInRange(t)}toMapDirection(t){return this.isIsometric()?Kl(t):t}fromMapDirection(t){return this.isIsometric()?ko(t):t}isIsometric(){return this.tilemap.getOrientation()==="isometric"}getTilePosInDirection(t,e){let n=t.position.add(We(this.toMapDirection(e))),s=this.getTransition(n,t.layer)||t.layer;return{position:n,layer:s}}invalidateFrameCache(){this.collisionRelevantLayersFrameCache.clear()}isLayerBlockingAt(t,e,n){let s=this.tilemap.getTileAt(e.x,e.y,t);return s?!!(s.getProperty(this.collisionTilePropertyName)||n&&s.getProperty(this.collidesPropNames.get(n)||"")):!1}getCharLayerIndexes(){return this.tilemap.getLayers().map((t,e)=>({layer:t,index:e})).filter(({layer:t})=>t.isCharLayer()).map(({index:t})=>t)}findPrevAndCharLayer(t){let e=this.getCharLayerIndexes(),n=this.tilemap.getLayers(),s=e.findIndex(a=>n[a].getProperty(kn)==t);return s==0?{prevIndex:-1,charLayerIndex:e[s]}:{prevIndex:e[s-1],charLayerIndex:e[s]}}getCollisionRelevantLayers(t){if(!t)return this.tilemap.getLayers();let e=this.collisionRelevantLayersFrameCache.get(t);if(e)return e;let{prevIndex:n,charLayerIndex:s}=this.findPrevAndCharLayer(t),a=this.tilemap.getLayers().slice(n+1,s+1);return this.collisionRelevantLayersFrameCache.set(t,a),a}getLowestCharLayer(){for(let t of this.tilemap.getLayers())if(t.isCharLayer())return t.getProperty(kn)}};ks.ONE_WAY_COLLIDE_PROP_PREFIX="ge_collide_";var Is=ks;var ih=(e=>(e.REMOVED="REMOVED",e.ADDED="ADDED",e))(ih||{});var Xd=(n=>(n.WAIT="WAIT",n.SKIP="SKIP",n.STOP="STOP",n))(Xd||{}),Rs=class{constructor(t,e){this.character=t;this.tilemap=e;this.queue=new Lr;this.finished$=new it;this.pathBlockedWaitElapsed=0;this.distanceUtils=ie.create(t.getNumberOfDirections()),this.character.autoMovementSet().pipe(Bt(n=>n!==this),fe(1)).subscribe(()=>{this.queue.size()>0&&this.finishMovementTerminated(),this.finished$.complete()})}update(t){(!this.character.isMoving()||this.character.willCrossTileBorderThisUpdate(t))&&this.queue.size()>0&&this.moveCharOnPath(t)}getInfo(){return{type:"Queue"}}enqueue(t,e={}){var s,a,h;let n={pathBlockedStrategy:(s=e.pathBlockedStrategy)!=null?s:"STOP",pathBlockedWaitTimeoutMs:(e==null?void 0:e.pathBlockedWaitTimeoutMs)||-1,ignoreInvalidPositions:(a=e.ignoreInvalidPositions)!=null?a:!1,skipInvalidPositions:(h=e.skipInvalidPositions)!=null?h:!1};for(let l of t){let p={command:l,config:n};if(jr(l)){this.queue.enqueue(p);continue}let d=this.queue.peekEnd(),y=d==null?void 0:d.command;if(y||(y=this.character.getNextTilePos()),jr(y)){this.queue.enqueue(p);continue}let b=this.distanceUtils.distance(y.position,l.position)===1;(!e.ignoreInvalidPositions||b)&&this.queue.enqueue(p)}}peekAll(){return this.queue.peekAll()}size(){return this.queue.size()}finished(){return this.finished$}clear(){this.queue.clear()}moveCharOnPath(t){let e=this.queue.peek();if(!e)return;let n=e.command,s=e.config;if(jr(n)&&(n=this.tilemap.getTilePosInDirection(this.character.getNextTilePos(),n)),s.skipInvalidPositions){if(n=this.getNextValidPosition(),!n){this.finishInvalidNextPos(n);return}}else if(!this.isNeighborPos(n)){this.finishInvalidNextPos(n);return}if(this.character.isBlockingDirection(re(this.character.getNextTilePos().position,n.position))){if(s.pathBlockedStrategy==="STOP")this.finishPathBlocked(n);else if(s.pathBlockedStrategy==="SKIP"){this.queue.dequeue(),this.moveCharOnPath(t);return}else s.pathBlockedStrategy==="WAIT"&&s.pathBlockedWaitTimeoutMs>-1&&(this.pathBlockedWaitElapsed+=t,this.pathBlockedWaitElapsed>=s.pathBlockedWaitTimeoutMs&&this.finishBlockedWaitTimeout(n,s.pathBlockedWaitTimeoutMs));return}this.pathBlockedWaitElapsed=0,this.queue.dequeue(),this.character.move(this.getDir(this.character.getNextTilePos().position,n.position)),this.isLastMovement()&&this.finish("SUCCESS","",n)}getNextValidPosition(){var t;for(;this.queue.size()>0;){let e=(t=this.queue.peek())==null?void 0:t.command;if(jr(e)&&(e=this.tilemap.getTilePosInDirection(this.character.getNextTilePos(),e)),e&&this.isNeighborPos(e))return e;this.queue.dequeue()}}isLastMovement(){return this.queue.size()===0}isNeighborPos(t){let e=this.distanceUtils.distance(this.character.getNextTilePos().position,t.position)===1,n=this.tilemap.getTransition(t.position,this.character.getNextTilePos().layer);if(this.character.getNextTilePos().layer!==t.layer)return e&&n===t.layer;let s=n!==void 0&&n!==t.layer;return e&&!s}finishMovementTerminated(){this.finish("MOVEMENT_TERMINATED","New automatic movement has been set to character.")}finishInvalidNextPos(t){t?this.finish("INVALID_NEXT_POS",`Position ${this.posToStr(t)} is not reachable from ${this.posToStr(this.character.getNextTilePos())}.`):this.finish("INVALID_NEXT_POS",`No enqueued position is reachable from ${this.posToStr(this.character.getNextTilePos())}.`)}finishPathBlocked(t){this.finish("PATH_BLOCKED",`Position ${this.posToStr(t)} is blocked.`)}finishBlockedWaitTimeout(t,e){this.finish("PATH_BLOCKED_WAIT_TIMEOUT",`Position ${this.posToStr(t)} is blocked and the wait timeout of ${e} ms has been exceeded.`)}finish(t,e="",n=this.character.getNextTilePos()){this.queue=new Lr,this.finished$.next({position:n.position,result:t,description:e,layer:n.layer})}getDir(t,e){return this.tilemap.fromMapDirection(re(t,e))}posToStr(t){return`(${t.position.x}, ${t.position.y}, ${t.layer})`}};var Fs=class{constructor(t=!0){this.isCreatedInternal=!1;t&&console.log(`Using GridEngine v${As}`)}getCharLayer(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getTilePos().layer}getTransition(t,e){var n;return this.initGuard(),(n=this.gridTilemap)==null?void 0:n.getTransition(new M(t),e)}setTransition(t,e,n){var s;return this.initGuard(),(s=this.gridTilemap)==null?void 0:s.setTransition(new M(t),e,n)}create(t,e){this.isCreatedInternal=!0,this.gridCharacters=new Map;let n=this.setConfigDefaults(e);this.config=n,this.movementStopped$=new it,this.movementStarted$=new it,this.directionChanged$=new it,this.positionChangeStarted$=new it,this.positionChangeFinished$=new it,this.queueMovementFinished$=new it,this.charRemoved$=new it,this.charAdded$=new it,this.gridTilemap=new Is(t,this.config.collisionTilePropertyName,this.config.characterCollisionStrategy,this.recordToMap(this.config.collisionGroupRelation),this.config.cacheTileCollisions),this.addCharacters()}recordToMap(t){return t?new Map(Object.entries(t).map(([n,s])=>[n,new Set(s)])):void 0}getPosition(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getTilePos().position}move(t,e){this.moveChar(t,e)}moveRandomly(t,e=0,n=-1){var h;this.initGuard();let s=(h=this.gridCharacters)==null?void 0:h.get(t);if(!s)throw this.createCharUnknownErr(t);let a=new Es(s,e,n);s.setMovement(a)}getMovement(t){var s;this.initGuard();let e=(s=this.gridCharacters)==null?void 0:s.get(t);if(!e)throw this.createCharUnknownErr(t);let n=e.getMovement();return n?n.getInfo():{type:"None"}}moveTo(t,e,n){var l;let s=this.assembleMoveToConfig(n);this.initGuard();let a=(l=this.gridCharacters)==null?void 0:l.get(t);if(!a)throw this.createCharUnknownErr(t);if(!this.gridTilemap)throw this.createUninitializedErr();let h=new $i(a,this.gridTilemap,{position:new M(e),layer:(n==null?void 0:n.targetLayer)||a.getNextTilePos().layer},{distance:0,config:s});return a.setMovement(h),h.finishedObs().pipe(ir(p=>({charId:t,position:p.position,result:p.result,description:p.description,layer:p.layer})))}stopMovement(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);e.setMovement(void 0)}setSpeed(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.setSpeed(e)}getSpeed(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getSpeed()}collidesWithTiles(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.collidesWithTiles()}update(t,e){var n;if(this.isCreatedInternal&&this.gridCharacters)for(let[s,a]of this.gridCharacters)a.update(e);(n=this.gridTilemap)==null||n.invalidateFrameCache()}addCharacter(t){var a,h,l,p,d;if(!this.gridTilemap)throw this.createUninitializedErr();if(!this.config)throw this.createUninitializedErr();let e={speed:t.speed||4,tilemap:this.gridTilemap,collidesWithTiles:!0,collisionGroups:["geDefault"],charLayer:t.charLayer,facingDirection:t.facingDirection,labels:t.labels,numberOfDirections:(a=t.numberOfDirections)!=null?a:this.config.numberOfDirections,tileWidth:t.tileWidth,tileHeight:t.tileHeight};typeof t.collides=="boolean"?t.collides===!1&&(e.collidesWithTiles=!1,e.collisionGroups=[]):t.collides!==void 0&&(t.collides.collidesWithTiles===!1&&(e.collidesWithTiles=!1),t.collides.collisionGroups&&(e.collisionGroups=t.collides.collisionGroups),e.ignoreMissingTiles=(l=(h=t.collides)==null?void 0:h.ignoreMissingTiles)!=null?l:!1);let n=new ss(t.id,e);t.startPosition&&n.setTilePosition({position:new M(t.startPosition),layer:n.getTilePos().layer}),(p=this.gridCharacters)==null||p.set(t.id,n),this.gridTilemap.addCharacter(n);let s=n.getId();n.movementStopped().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.movementStopped$)==null||b.next({charId:s,direction:y})}),n.movementStarted().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.movementStarted$)==null||b.next({charId:s,direction:y})}),n.directionChanged().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.directionChanged$)==null||b.next({charId:s,direction:y})}),n.positionChangeStarted().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.positionChangeStarted$)==null||b.next(ot({charId:s},y))}),n.positionChangeFinished().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.positionChangeFinished$)==null||b.next(ot({charId:s},y))}),(d=this.charAdded$)==null||d.next(s)}hasCharacter(t){var e;return this.initGuard(),!!((e=this.gridCharacters)!=null&&e.has(t))}removeCharacter(t){var n,s,a,h;if(this.initGuard(),!((n=this.gridCharacters)==null?void 0:n.get(t)))throw this.createCharUnknownErr(t);(s=this.gridTilemap)==null||s.removeCharacter(t),(a=this.gridCharacters)==null||a.delete(t),(h=this.charRemoved$)==null||h.next(t)}removeAllCharacters(){if(this.initGuard(),!!this.gridCharacters)for(let t of this.gridCharacters.keys())this.removeCharacter(t)}getAllCharacters(t){if(this.initGuard(),!this.gridCharacters)return[];let e=[...this.gridCharacters.values()];return(t?Qd(e,t):e).map(s=>s.getId())}getLabels(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getLabels()}addLabels(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.addLabels(e)}removeLabels(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.removeLabels(e)}clearLabels(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);e.clearLabels()}follow(t,e,n,s){var d,y,b,x;let a;n===void 0?a={distance:0,closestPointIfBlocked:!1}:typeof n=="number"?(a={distance:n,closestPointIfBlocked:!1},s&&(a.closestPointIfBlocked=!0)):a=n,this.initGuard();let h=(d=this.gridCharacters)==null?void 0:d.get(t),l=(y=this.gridCharacters)==null?void 0:y.get(e);if(!h)throw this.createCharUnknownErr(t);if(!l)throw this.createCharUnknownErr(e);if(!this.gridTilemap)throw this.createUninitializedErr();let p=new Ls(h,this.gridTilemap,l,{distance:a.distance,noPathFoundStrategy:a.closestPointIfBlocked?"CLOSEST_REACHABLE":"STOP",maxPathLength:(b=a.maxPathLength)!=null?b:1/0,shortestPathAlgorithm:(x=a.algorithm)!=null?x:"BIDIRECTIONAL_SEARCH",ignoreLayers:!!a.ignoreLayers});h.setMovement(p)}isMoving(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.isMoving()}getFacingDirection(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getFacingDirection()}getFacingPosition(t){var s;this.initGuard();let e=(s=this.gridCharacters)==null?void 0:s.get(t);if(!e)throw this.createCharUnknownErr(t);let n=e.getFacingPosition();return{x:n.x,y:n.y}}turnTowards(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);return n.turnTowards(e)}getCharactersAt(t,e){if(this.initGuard(),!this.gridTilemap)return[];let n=this.gridTilemap.getCharactersAt(new M(t),e);return Array.from(n).map(s=>s.getId())}setPosition(t,e,n){var a;this.initGuard();let s=(a=this.gridCharacters)==null?void 0:a.get(t);if(!s)throw this.createCharUnknownErr(t);n||s.setTilePosition({position:new M(e),layer:s.getTilePos().layer}),s.setTilePosition({position:new M(e),layer:n})}isBlocked(t,e,n=["geDefault"]){var a,h;this.initGuard();let s=new M(t);return!!((a=this.gridTilemap)!=null&&a.hasBlockingTile(s,e)||(h=this.gridTilemap)!=null&&h.hasBlockingChar(s,e,n))}isTileBlocked(t,e){var n;return this.initGuard(),!!((n=this.gridTilemap)!=null&&n.hasBlockingTile(new M(t),e))}getCollisionGroups(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getCollisionGroups()||[]}setCollisionGroups(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.setCollisionGroups(e)}getTilePosInDirection(t,e,n){if(!this.gridTilemap)throw this.createUninitializedErr();let s=this.gridTilemap.getTilePosInDirection({position:new M(t),layer:e},n);return{position:s.position.toPosition(),charLayer:s.layer}}findShortestPath(t,e,n={}){if(!this.gridTilemap)throw this.createUninitializedErr();let s=n.shortestPathAlgorithm||"BFS";n.considerCosts&&s!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${s}'. It can only be used with A* algorithm.`);let h=new Qi(this.gridTilemap).findShortestPath(G.toInternal(t),G.toInternal(e),Be(ot({},n),{shortestPathAlgorithm:s}));return{path:h.path.map(G.fromInternal),closestToTarget:h.closestToTarget?G.fromInternal(h.closestToTarget):void 0,reachedMaxPathLength:!1,steps:h.steps}}steppedOn(t,e,n){return this.positionChangeFinished().pipe(Bt(s=>t.includes(s.charId)&&e.some(a=>a.x===s.enterTile.x&&a.y===s.enterTile.y)&&(n===void 0||n.includes(s.enterLayer))))}characterShifted(){if(!this.charAdded$||!this.charRemoved$)throw this.createUninitializedErr();return this.charAdded$.pipe(ir(t=>({charId:t,action:"ADDED"})),wu(this.charRemoved$.pipe(ir(t=>({charId:t,action:"REMOVED"})))))}movementStarted(){if(!this.movementStarted$)throw this.createUninitializedErr();return this.movementStarted$}movementStopped(){if(!this.movementStopped$)throw this.createUninitializedErr();return this.movementStopped$}directionChanged(){if(!this.directionChanged$)throw this.createUninitializedErr();return this.directionChanged$}positionChangeStarted(){if(!this.positionChangeStarted$)throw this.createUninitializedErr();return this.positionChangeStarted$}positionChangeFinished(){if(!this.positionChangeFinished$)throw this.createUninitializedErr();return this.positionChangeFinished$}getMovementProgress(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getMovementProgress()}rebuildTileCollisionCache(t,e,n,s){var a;(a=this.gridTilemap)==null||a.rebuildTileCollisionCache(new $r(t,e,n,s))}addQueueMovements(t,e,n){var h,l;this.initGuard();let s=(h=this.gridCharacters)==null?void 0:h.get(t);if(!s)throw this.createCharUnknownErr(t);if(!this.gridTilemap)throw this.createUninitializedErr();let a;((l=s==null?void 0:s.getMovement())==null?void 0:l.getInfo().type)==="Queue"?a=s.getMovement():(a=new Rs(s,this.gridTilemap),s.setMovement(a),a.finished().pipe(Mt(bu(this.charRemoved(t),s.autoMovementSet()))).subscribe(p=>{var d;(d=this.queueMovementFinished$)==null||d.next(ot({charId:t},p))})),a.enqueue(e.map(p=>jr(p)?p:{position:new M(p.position),layer:p.charLayer}),n)}queueMovementFinished(){if(!this.queueMovementFinished$)throw this.createUninitializedErr();return this.queueMovementFinished$}getEnqueuedMovements(t){var n,s;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return((s=e.getMovement())==null?void 0:s.getInfo().type)==="Queue"?e.getMovement().peekAll().map(h=>({command:jr(h.command)?h.command:G.fromInternal(h.command),config:h.config})):[]}clearEnqueuedMovements(t){var n,s;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);((s=e.getMovement())==null?void 0:s.getInfo().type)==="Queue"&&e.getMovement().clear()}getTileCost(t,e,n){var s,a;return this.initGuard(),(a=(s=this.gridTilemap)==null?void 0:s.getTileCosts({position:new M(t),layer:e},n))!=null?a:1}charRemoved(t){var e;if(!this.charRemoved$)throw this.createUninitializedErr();return(e=this.charRemoved$)==null?void 0:e.pipe(fe(1),Bt(n=>n==t))}initGuard(){if(!this.isCreatedInternal)throw this.createUninitializedErr()}createUninitializedErr(){throw new Error("GridEngine not initialized. You need to call create() first.")}addCharacters(){var t;(t=this.config)==null||t.characters.forEach(e=>this.addCharacter(e))}moveChar(t,e){var s,a,h;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);if(n.getNumberOfDirections()===4){if(!((a=this.gridTilemap)!=null&&a.isIsometric())&&Ai(e)){console.warn(`GridEngine: Character '${t}' can't be moved '${e}' in 4 direction mode.`);return}else if((h=this.gridTilemap)!=null&&h.isIsometric()&&!Ai(e)){console.warn(`GridEngine: Character '${t}' can't be moved '${e}' in 4 direction isometric mode.`);return}}n.move(e)}createCharUnknownErr(t){return new Error(`Character unknown: ${t}`)}assembleMoveToConfig(t={}){let e=Be(ot({},t),{noPathFoundStrategy:"STOP",pathBlockedStrategy:"WAIT"});return t!=null&&t.noPathFoundStrategy&&(Object.values(Ri).includes(t.noPathFoundStrategy)?e.noPathFoundStrategy=t.noPathFoundStrategy:console.warn(`GridEngine: Unknown NoPathFoundStrategy '${t.noPathFoundStrategy}'. Falling back to 'STOP'`)),t!=null&&t.pathBlockedStrategy&&(Object.values(Cn).includes(t.pathBlockedStrategy)?e.pathBlockedStrategy=t.pathBlockedStrategy:console.warn(`GridEngine: Unknown PathBlockedStrategy '${t.pathBlockedStrategy}'. Falling back to 'WAIT'`)),e}setConfigDefaults(t){return ot({collisionTilePropertyName:"ge_collide",numberOfDirections:4,characterCollisionStrategy:"BLOCK_TWO_TILES",cacheTileCollisions:!1},t)}};var zs=class extends qi{constructor(t,e={}){super(t,e),this.distanceUtils=ie.create(8)}getForced(t,e){let n=[],s=this.posInDir(e,this.distanceUtils.direction(e.position,t.position)),{topLeft:a,downLeft:h,top:l,bottom:p,topRight:d,downRight:y}=this.normalizedPositions(s,e),b=this.distanceUtils.direction(t.position,e.position),x=(C,O)=>this.isBlocking(C,O)||this.getTransition(O.position,O.layer)!==void 0;return Ai(b)?(x(t,a)&&!this.isBlocking(e,l)&&n.push(l),x(t,a)&&(x(t,h)||x(h,a))&&!this.isBlocking(e,a)&&n.push(a),x(t,h)&&!this.isBlocking(e,p)&&n.push(p),x(t,h)&&(x(t,a)||x(a,h))&&!this.isBlocking(e,h)&&n.push(h)):(x(t,l)&&(x(t,a)||x(a,l))&&(this.isBlocking(e,a)||n.push(a),this.isBlocking(e,l)||n.push(l)),x(t,l)&&(x(t,a)||x(a,l)||x(l,d))&&!this.isBlocking(e,d)&&n.push(d),x(t,p)&&(x(t,h)||x(h,l))&&(this.isBlocking(e,h)||n.push(h),this.isBlocking(e,p)||n.push(p)),x(t,p)&&(x(t,h)||x(a,p)||x(l,y))&&!this.isBlocking(e,y)&&n.push(y)),n}prune(t,e){let{right:n,topRight:s,downRight:a}=this.normalizedPositions(t,e),h=this.getForced(t,e),l=re(t.position,e.position);return Ai(l)?[n,s,a,...h]:[n,...h]}jump(t,e,n,s){let a=this.distanceUtils.direction(t.position,e.position);if(!(this.isBlocking(t,e)&&!(G.equal(e,n)&&this.options.ignoreBlockedTarget))){if(G.equal(e,n))return{p:e,dist:s};if(s>=this.maxJumpSize)return{p:e,dist:s};if(this.getTransition(e.position,t.layer)!==void 0)return{p:e,dist:s};if(this.getForced(t,e).length>0)return{p:e,dist:s};if(this.updateClosestToTarget(e,n),a==="up-left"){if(this.jump(e,this.getTilePosInDir(e,"up"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"left"),n,s+1)!==void 0)return{p:e,dist:s}}else if(a==="down-left"){if(this.jump(e,this.getTilePosInDir(e,"down"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"left"),n,s+1)!==void 0)return{p:e,dist:s}}else if(a==="up-right"){if(this.jump(e,this.getTilePosInDir(e,"up"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"right"),n,s+1)!==void 0)return{p:e,dist:s}}else if(a==="down-right"){if(this.jump(e,this.getTilePosInDir(e,"down"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"right"),n,s+1)!==void 0)return{p:e,dist:s}}return this.jump(e,this.getTilePosInDir(e,re(t.position,e.position)),n,s+1)}}};var Qi=class{constructor(t){this.gridTilemap=t}findShortestPath(t,e,n={}){return OS(n.shortestPathAlgorithm||"BIDIRECTIONAL_SEARCH",this.gridTilemap,n).findShortestPath(t,e)}};function OS(r,t,e){switch(r){case"BIDIRECTIONAL_SEARCH":return new gs(t,e);case"A_STAR":return new ps(t,e);case"JPS":return e.numberOfDirections===8?new zs(t,e):new qi(t,e)}return new Fi(t,e)}var nh=(p=>(p.SUCCESS="SUCCESS",p.NO_PATH_FOUND_MAX_RETRIES_EXCEEDED="NO_PATH_FOUND_MAX_RETRIES_EXCEEDED",p.PATH_BLOCKED_MAX_RETRIES_EXCEEDED="PATH_BLOCKED_MAX_RETRIES_EXCEEDED",p.PATH_BLOCKED="PATH_BLOCKED",p.NO_PATH_FOUND="NO_PATH_FOUND",p.PATH_BLOCKED_WAIT_TIMEOUT="PATH_BLOCKED_WAIT_TIMEOUT",p.MOVEMENT_TERMINATED="MOVEMENT_TERMINATED",p.MAX_PATH_LENGTH_REACHED="MAX_PATH_LENGTH_REACHED",p))(nh||{}),$i=class{constructor(t,e,n,{config:s,ignoreBlockedTarget:a=!1,distance:h=0}={}){this.character=t;this.tilemap=e;this.targetPos=n;this.shortestPath=[];this.distOffset=0;this.posOnPath=0;this.stopped=!1;this.pathBlockedWaitElapsed=0;this.isPositionAllowed=()=>!0;this.shortestPathAlgorithm="BIDIRECTIONAL_SEARCH";this.maxPathLength=1/0;this.considerCosts=!1;this.isBlocking=(t,e)=>t?new Fi(this.tilemap,this.getPathfindingOptions()).isBlocking(this.character.getTilePos(),{position:t,layer:e}):!0;var l;this.shortestPathAlgorithm=(l=s==null?void 0:s.algorithm)!=null?l:this.shortestPathAlgorithm,this.ignoreBlockedTarget=a,this.distance=h,this.noPathFoundStrategy=(s==null?void 0:s.noPathFoundStrategy)||"STOP",this.pathBlockedStrategy=(s==null?void 0:s.pathBlockedStrategy)||"WAIT",this.noPathFoundRetryable=new Sn((s==null?void 0:s.noPathFoundRetryBackoffMs)||200,(s==null?void 0:s.noPathFoundMaxRetries)||-1,()=>{this.stop("NO_PATH_FOUND_MAX_RETRIES_EXCEEDED")}),this.pathBlockedRetryable=new Sn((s==null?void 0:s.pathBlockedRetryBackoffMs)||200,(s==null?void 0:s.pathBlockedMaxRetries)||-1,()=>{this.stop("PATH_BLOCKED_MAX_RETRIES_EXCEEDED")}),s!=null&&s.isPositionAllowedFn&&(this.isPositionAllowed=s.isPositionAllowedFn),s!=null&&s.maxPathLength&&(this.maxPathLength=s.maxPathLength),s!=null&&s.considerCosts&&this.shortestPathAlgorithm!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${this.shortestPathAlgorithm}'. It can only be used with A* algorithm.`),this.considerCosts=(s==null?void 0:s.considerCosts)||!1,this.ignoreLayers=!!(s!=null&&s.ignoreLayers),this.distanceUtils=ie.create(t.getNumberOfDirections()),this.pathBlockedWaitTimeoutMs=(s==null?void 0:s.pathBlockedWaitTimeoutMs)||-1,this.finished$=new it,this.setCharacter(t)}setPathBlockedStrategy(t){this.pathBlockedStrategy=t}getPathBlockedStrategy(){return this.pathBlockedStrategy}setCharacter(t){this.character=t,this.noPathFoundRetryable.reset(),this.pathBlockedRetryable.reset(),this.pathBlockedWaitElapsed=0,this.calcShortestPath(),this.character.autoMovementSet().pipe(Bt(e=>e!==this),fe(1)).subscribe(()=>{this.stop("MOVEMENT_TERMINATED")})}getPathfindingOptions(){return{shortestPathAlgorithm:this.shortestPathAlgorithm,pathWidth:this.character.getTileWidth(),pathHeight:this.character.getTileHeight(),numberOfDirections:this.character.getNumberOfDirections(),isPositionAllowed:this.isPositionAllowed,collisionGroups:this.character.getCollisionGroups(),ignoredChars:[this.character.getId()],ignoreTiles:!this.character.collidesWithTiles(),ignoreMapBounds:this.character.getIgnoreMissingTiles(),ignoreBlockedTarget:this.ignoreBlockedTarget,maxPathLength:this.maxPathLength,ignoreLayers:this.ignoreLayers,considerCosts:this.considerCosts,calculateClosestToTarget:!0}}update(t){var e,n,s,a;this.stopped||(this.noPathFound()&&(this.noPathFoundStrategy==="RETRY"?this.noPathFoundRetryable.retry(t,()=>this.calcShortestPath()):this.noPathFoundStrategy==="STOP"&&this.stop("NO_PATH_FOUND")),this.updatePosOnPath(),this.isBlocking((e=this.nextTileOnPath())==null?void 0:e.position,(n=this.character)==null?void 0:n.getNextTilePos().layer)?this.applyPathBlockedStrategy(t):this.pathBlockedWaitElapsed=0,this.hasArrived()?(this.stop("SUCCESS"),this.existsDistToTarget()&&this.turnTowardsTarget()):this.isBlocking((s=this.nextTileOnPath())==null?void 0:s.position,(a=this.character)==null?void 0:a.getNextTilePos().layer)||this.moveCharOnPath())}finishedObs(){return this.finished$}getInfo(){return{type:"Target",state:{pathAhead:this.shortestPath.slice(this.posOnPath).map(t=>G.fromInternal(t))},config:{algorithm:this.shortestPathAlgorithm,ignoreBlockedTarget:this.ignoreBlockedTarget,distance:this.distance,targetPos:G.fromInternal(this.targetPos),noPathFoundStrategy:this.noPathFoundStrategy,pathBlockedStrategy:this.pathBlockedStrategy,noPathFoundRetryBackoffMs:this.noPathFoundRetryable.getBackoffMs(),noPathFoundMaxRetries:this.noPathFoundRetryable.getMaxRetries()}}}resultToReason(t){switch(t){case"SUCCESS":return"Successfully arrived.";case"MOVEMENT_TERMINATED":return"Movement of character has been replaced before destination was reached.";case"PATH_BLOCKED":return"PathBlockedStrategy STOP: Path blocked.";case"NO_PATH_FOUND_MAX_RETRIES_EXCEEDED":return`NoPathFoundStrategy RETRY: Maximum retries of ${this.noPathFoundRetryable.getMaxRetries()} exceeded.`;case"NO_PATH_FOUND":return"NoPathFoundStrategy STOP: No path found.";case"PATH_BLOCKED_MAX_RETRIES_EXCEEDED":return`PathBlockedStrategy RETRY: Maximum retries of ${this.pathBlockedRetryable.getMaxRetries()} exceeded.`;case"PATH_BLOCKED_WAIT_TIMEOUT":return`PathBlockedStrategy WAIT: Wait timeout of ${this.pathBlockedWaitTimeoutMs}ms exceeded.`}}applyPathBlockedStrategy(t){this.pathBlockedStrategy==="RETRY"?this.pathBlockedRetryable.retry(t,()=>{let e=this.getShortestPath();e.path.length>0&&this.calcShortestPath(e)}):this.pathBlockedStrategy==="STOP"?this.stop("PATH_BLOCKED"):this.pathBlockedStrategy==="WAIT"&&this.pathBlockedWaitTimeoutMs>-1&&(this.pathBlockedWaitElapsed+=t,this.pathBlockedWaitElapsed>=this.pathBlockedWaitTimeoutMs&&this.stop("PATH_BLOCKED_WAIT_TIMEOUT"))}moveCharOnPath(){let t=this.nextTileOnPath();if(!t)return;let e=this.getDir(this.character.getNextTilePos().position,t.position);this.character.move(e)}nextTileOnPath(){return this.shortestPath[this.posOnPath+1]}stop(t){this.finished$.next({position:this.character.getTilePos().position,result:t,description:this.resultToReason(t),layer:this.character.getTilePos().layer}),this.finished$.complete(),this.stopped=!0}turnTowardsTarget(){let t=this.shortestPath[this.posOnPath+1],e=this.getDir(this.character.getNextTilePos().position,t.position);this.character.turnTowards(e)}existsDistToTarget(){return this.posOnPath=this.shortestPath.length-1}updatePosOnPath(){let t=this.shortestPath[this.posOnPath];for(;this.posOnPaththis.isLayerAlwaysOnTop(a));this.tilemap.layers.filter(a=>!this.isLayerAlwaysOnTop(a)).forEach(a=>{this.hasLayerProp(a,Fe.HEIGHT_SHIFT_PROP_NAME)?(this.createHeightShiftLayers(a,e),t.push(a.tilemapLayer)):this.setDepth(a,++e)}),this.charLayerDepths.set(void 0,e),n.forEach((a,h)=>{a.tilemapLayer.setDepth(h+1+e)}),t.forEach(a=>a.destroy())}setDepth(t,e){t.tilemapLayer.setDepth(e),this.isCharLayer(t)&&this.charLayerDepths.set(this.getLayerProp(t,Fe.CHAR_LAYER_PROP_NAME),e)}createHeightShiftLayers(t,e){let n=this.getLayerProp(t,Fe.HEIGHT_SHIFT_PROP_NAME);isNaN(n)&&(n=0);let s=1;for(let a=0;aa.name==e);return s==null?void 0:s.value}hasLayerProp(t,e){return this.getLayerProp(t,e)!=null}copyLayer(t,e){let n=`${t.name}#${e}`,s=this.tilemap.createBlankLayer(n,t.tilemapLayer.tileset);if(s){s.name=n;for(let a=0;a()=>(t||r((t={exports:{}}).exports,t),t.exports),zS=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of IS(t))!RS.call(r,s)&&s!==e&&Zd(r,s,{get:()=>t[s],enumerable:!(n=MS(t,s))||n.enumerable});return r},sh=(r,t,e)=>(e=r!=null?DS(kS(r)):{},zS(t||!r||!r.__esModule?Zd(e,"default",{value:r,enumerable:!0}):e,r)),ah=FS((r,t)=>{(function(){var e,n="4.17.21",s=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",h="Expected a function",l="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",d=500,y="__lodash_placeholder__",b=1,x=2,C=4,O=1,D=2,R=1,H=2,j=4,Z=8,ht=16,At=32,ze=64,Ce=128,Ki=256,js=512,im=30,nm="...",om=800,sm=16,fh=1,am=2,um=3,Qr=1/0,Ar=9007199254740991,hm=17976931348623157e292,Un=0/0,Xe=4294967295,cm=Xe-1,lm=Xe>>>1,fm=[["ary",Ce],["bind",R],["bindKey",H],["curry",Z],["curryRight",ht],["flip",js],["partial",At],["partialRight",ze],["rearg",Ki]],di="[object Arguments]",jn="[object Array]",pm="[object AsyncFunction]",Yi="[object Boolean]",Xi="[object Date]",dm="[object DOMException]",Gn="[object Error]",Hn="[object Function]",ph="[object GeneratorFunction]",Ve="[object Map]",Ji="[object Number]",mm="[object Null]",gr="[object Object]",dh="[object Promise]",gm="[object Proxy]",Zi="[object RegExp]",Ne="[object Set]",tn="[object String]",Bn="[object Symbol]",ym="[object Undefined]",en="[object WeakMap]",vm="[object WeakSet]",rn="[object ArrayBuffer]",mi="[object DataView]",Gs="[object Float32Array]",Hs="[object Float64Array]",Bs="[object Int8Array]",Ws="[object Int16Array]",qs="[object Int32Array]",$s="[object Uint8Array]",Qs="[object Uint8ClampedArray]",Ks="[object Uint16Array]",Ys="[object Uint32Array]",bm=/\b__p \+= '';/g,wm=/\b(__p \+=) '' \+/g,Pm=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mh=/&(?:amp|lt|gt|quot|#39);/g,gh=/[&<>"']/g,Tm=RegExp(mh.source),xm=RegExp(gh.source),Sm=/<%-([\s\S]+?)%>/g,Cm=/<%([\s\S]+?)%>/g,yh=/<%=([\s\S]+?)%>/g,_m=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Lm=/^\w*$/,Em=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Xs=/[\\^$.*+?()[\]{}|]/g,Am=RegExp(Xs.source),Js=/^\s+/,Om=/\s/,Dm=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Mm=/\{\n\/\* \[wrapped with (.+)\] \*/,Im=/,? & /,km=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Rm=/[()=,{}\[\]\/\s]/,Fm=/\\(\\)?/g,zm=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vh=/\w*$/,Vm=/^[-+]0x[0-9a-f]+$/i,Nm=/^0b[01]+$/i,Um=/^\[object .+?Constructor\]$/,jm=/^0o[0-7]+$/i,Gm=/^(?:0|[1-9]\d*)$/,Hm=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Wn=/($^)/,Bm=/['\n\r\u2028\u2029\\]/g,qn="\\ud800-\\udfff",Wm="\\u0300-\\u036f",qm="\\ufe20-\\ufe2f",$m="\\u20d0-\\u20ff",bh=Wm+qm+$m,wh="\\u2700-\\u27bf",Ph="a-z\\xdf-\\xf6\\xf8-\\xff",Qm="\\xac\\xb1\\xd7\\xf7",Km="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ym="\\u2000-\\u206f",Xm=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Th="A-Z\\xc0-\\xd6\\xd8-\\xde",xh="\\ufe0e\\ufe0f",Sh=Qm+Km+Ym+Xm,Zs="['\u2019]",Jm="["+qn+"]",Ch="["+Sh+"]",$n="["+bh+"]",_h="\\d+",Zm="["+wh+"]",Lh="["+Ph+"]",Eh="[^"+qn+Sh+_h+wh+Ph+Th+"]",ta="\\ud83c[\\udffb-\\udfff]",tg="(?:"+$n+"|"+ta+")",Ah="[^"+qn+"]",ea="(?:\\ud83c[\\udde6-\\uddff]){2}",ra="[\\ud800-\\udbff][\\udc00-\\udfff]",gi="["+Th+"]",Oh="\\u200d",Dh="(?:"+Lh+"|"+Eh+")",eg="(?:"+gi+"|"+Eh+")",Mh="(?:"+Zs+"(?:d|ll|m|re|s|t|ve))?",Ih="(?:"+Zs+"(?:D|LL|M|RE|S|T|VE))?",kh=tg+"?",Rh="["+xh+"]?",rg="(?:"+Oh+"(?:"+[Ah,ea,ra].join("|")+")"+Rh+kh+")*",ig="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ng="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Fh=Rh+kh+rg,og="(?:"+[Zm,ea,ra].join("|")+")"+Fh,sg="(?:"+[Ah+$n+"?",$n,ea,ra,Jm].join("|")+")",ag=RegExp(Zs,"g"),ug=RegExp($n,"g"),ia=RegExp(ta+"(?="+ta+")|"+sg+Fh,"g"),hg=RegExp([gi+"?"+Lh+"+"+Mh+"(?="+[Ch,gi,"$"].join("|")+")",eg+"+"+Ih+"(?="+[Ch,gi+Dh,"$"].join("|")+")",gi+"?"+Dh+"+"+Mh,gi+"+"+Ih,ng,ig,_h,og].join("|"),"g"),cg=RegExp("["+Oh+qn+bh+xh+"]"),lg=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,fg=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],pg=-1,ft={};ft[Gs]=ft[Hs]=ft[Bs]=ft[Ws]=ft[qs]=ft[$s]=ft[Qs]=ft[Ks]=ft[Ys]=!0,ft[di]=ft[jn]=ft[rn]=ft[Yi]=ft[mi]=ft[Xi]=ft[Gn]=ft[Hn]=ft[Ve]=ft[Ji]=ft[gr]=ft[Zi]=ft[Ne]=ft[tn]=ft[en]=!1;var ct={};ct[di]=ct[jn]=ct[rn]=ct[mi]=ct[Yi]=ct[Xi]=ct[Gs]=ct[Hs]=ct[Bs]=ct[Ws]=ct[qs]=ct[Ve]=ct[Ji]=ct[gr]=ct[Zi]=ct[Ne]=ct[tn]=ct[Bn]=ct[$s]=ct[Qs]=ct[Ks]=ct[Ys]=!0,ct[Gn]=ct[Hn]=ct[en]=!1;var dg={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},mg={"&":"&","<":"<",">":">",'"':""","'":"'"},gg={"&":"&","<":"<",">":">",""":'"',"'":"'"},yg={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},vg=parseFloat,bg=parseInt,zh=typeof global=="object"&&global&&global.Object===Object&&global,wg=typeof self=="object"&&self&&self.Object===Object&&self,Ft=zh||wg||Function("return this")(),na=typeof r=="object"&&r&&!r.nodeType&&r,Kr=na&&typeof t=="object"&&t&&!t.nodeType&&t,Vh=Kr&&Kr.exports===na,oa=Vh&&zh.process,_e=function(){try{var P=Kr&&Kr.require&&Kr.require("util").types;return P||oa&&oa.binding&&oa.binding("util")}catch(_){}}(),Nh=_e&&_e.isArrayBuffer,Uh=_e&&_e.isDate,jh=_e&&_e.isMap,Gh=_e&&_e.isRegExp,Hh=_e&&_e.isSet,Bh=_e&&_e.isTypedArray;function de(P,_,S){switch(S.length){case 0:return P.call(_);case 1:return P.call(_,S[0]);case 2:return P.call(_,S[0],S[1]);case 3:return P.call(_,S[0],S[1],S[2])}return P.apply(_,S)}function Pg(P,_,S,k){for(var B=-1,rt=P==null?0:P.length;++B-1}function sa(P,_,S){for(var k=-1,B=P==null?0:P.length;++k-1;);return S}function Jh(P,_){for(var S=P.length;S--&&yi(_,P[S],0)>-1;);return S}function Og(P,_){for(var S=P.length,k=0;S--;)P[S]===_&&++k;return k}var Dg=ca(dg),Mg=ca(mg);function Ig(P){return"\\"+yg[P]}function kg(P,_){return P==null?e:P[_]}function vi(P){return cg.test(P)}function Rg(P){return lg.test(P)}function Fg(P){for(var _,S=[];!(_=P.next()).done;)S.push(_.value);return S}function da(P){var _=-1,S=Array(P.size);return P.forEach(function(k,B){S[++_]=[B,k]}),S}function Zh(P,_){return function(S){return P(_(S))}}function Mr(P,_){for(var S=-1,k=P.length,B=0,rt=[];++S-1}function xy(i,o){var u=this.__data__,c=lo(u,i);return c<0?(++this.size,u.push([i,o])):u[c][1]=o,this}yr.prototype.clear=by,yr.prototype.delete=wy,yr.prototype.get=Py,yr.prototype.has=Ty,yr.prototype.set=xy;function vr(i){var o=-1,u=i==null?0:i.length;for(this.clear();++o=o?i:o)),i}function Oe(i,o,u,c,f,g){var v,w=o&b,T=o&x,L=o&C;if(u&&(v=f?u(i,c,f,g):u(i)),v!==e)return v;if(!gt(i))return i;var E=W(i);if(E){if(v=Lv(i),!w)return ae(i,v)}else{var A=Qt(i),I=A==Hn||A==ph;if(Nr(i))return Rc(i,w);if(A==gr||A==di||I&&!f){if(v=T||I?{}:tl(i),!w)return T?gv(i,Ny(v,i)):mv(i,lc(v,i))}else{if(!ct[A])return f?i:{};v=Ev(i,A,w)}}g||(g=new je);var F=g.get(i);if(F)return F;g.set(i,v),Al(i)?i.forEach(function(U){v.add(Oe(U,o,u,U,i,g))}):Ll(i)&&i.forEach(function(U,K){v.set(K,Oe(U,o,u,K,i,g))});var N=L?T?Ua:Na:T?he:zt,$=E?e:N(i);return Le($||i,function(U,K){$&&(K=U,U=i[K]),cn(v,K,Oe(U,o,u,K,i,g))}),v}function Uy(i){var o=zt(i);return function(u){return fc(u,i,o)}}function fc(i,o,u){var c=u.length;if(i==null)return!c;for(i=ut(i);c--;){var f=u[c],g=o[f],v=i[f];if(v===e&&!(f in i)||!g(v))return!1}return!0}function pc(i,o,u){if(typeof i!="function")throw new Ee(h);return yn(function(){i.apply(e,u)},o)}function ln(i,o,u,c){var f=-1,g=Qn,v=!0,w=i.length,T=[],L=o.length;if(!w)return T;u&&(o=pt(o,me(u))),c?(g=sa,v=!1):o.length>=s&&(g=nn,v=!1,o=new Jr(o));t:for(;++ff?0:f+u),c=c===e||c>f?f:q(c),c<0&&(c+=f),c=u>c?0:Dl(c);u0&&u(w)?o>1?Ht(w,o-1,u,c,f):Dr(f,w):c||(f[f.length]=w)}return f}var Pa=jc(),gc=jc(!0);function Je(i,o){return i&&Pa(i,o,zt)}function Ta(i,o){return i&&gc(i,o,zt)}function po(i,o){return Or(o,function(u){return xr(i[u])})}function ti(i,o){o=zr(o,i);for(var u=0,c=o.length;i!=null&&uo}function Hy(i,o){return i!=null&&st.call(i,o)}function By(i,o){return i!=null&&o in ut(i)}function Wy(i,o,u){return i>=$t(o,u)&&i=120&&E.length>=120)?new Jr(v&&E):e}E=i[0];var A=-1,I=w[0];t:for(;++A-1;)w!==i&&no.call(w,T,1),no.call(i,T,1);return i}function Lc(i,o){for(var u=i?o.length:0,c=u-1;u--;){var f=o[u];if(u==c||f!==g){var g=f;Tr(f)?no.call(i,f,1):Ma(i,f)}}return i}function Aa(i,o){return i+ao(ac()*(o-i+1))}function nv(i,o,u,c){for(var f=-1,g=Dt(so((o-i)/(u||1)),0),v=S(g);g--;)v[c?g:++f]=i,i+=u;return v}function Oa(i,o){var u="";if(!i||o<1||o>Ar)return u;do o%2&&(u+=i),o=ao(o/2),o&&(i+=i);while(o);return u}function Q(i,o){return $a(il(i,o,ce),i+"")}function ov(i){return cc(Ei(i))}function sv(i,o){var u=Ei(i);return Co(u,Zr(o,0,u.length))}function dn(i,o,u,c){if(!gt(i))return i;o=zr(o,i);for(var f=-1,g=o.length,v=g-1,w=i;w!=null&&++ff?0:f+o),u=u>f?f:u,u<0&&(u+=f),f=o>u?0:u-o>>>0,o>>>=0;for(var g=S(f);++c>>1,v=i[g];v!==null&&!ye(v)&&(u?v<=o:v=s){var L=o?null:wv(i);if(L)return Yn(L);v=!1,f=nn,T=new Jr}else T=o?[]:w;t:for(;++c=c?i:De(i,o,u)}var kc=Xg||function(i){return Ft.clearTimeout(i)};function Rc(i,o){if(o)return i.slice();var u=i.length,c=rc?rc(u):new i.constructor(u);return i.copy(c),c}function Fa(i){var o=new i.constructor(i.byteLength);return new ro(o).set(new ro(i)),o}function lv(i,o){var u=o?Fa(i.buffer):i.buffer;return new i.constructor(u,i.byteOffset,i.byteLength)}function fv(i){var o=new i.constructor(i.source,vh.exec(i));return o.lastIndex=i.lastIndex,o}function pv(i){return hn?ut(hn.call(i)):{}}function Fc(i,o){var u=o?Fa(i.buffer):i.buffer;return new i.constructor(u,i.byteOffset,i.length)}function zc(i,o){if(i!==o){var u=i!==e,c=i===null,f=i===i,g=ye(i),v=o!==e,w=o===null,T=o===o,L=ye(o);if(!w&&!L&&!g&&i>o||g&&v&&T&&!w&&!L||c&&v&&T||!u&&T||!f)return 1;if(!c&&!g&&!L&&i=w)return T;var L=u[c];return T*(L=="desc"?-1:1)}}return i.index-o.index}function Vc(i,o,u,c){for(var f=-1,g=i.length,v=u.length,w=-1,T=o.length,L=Dt(g-v,0),E=S(T+L),A=!c;++w1?u[f-1]:e,v=f>2?u[2]:e;for(g=i.length>3&&typeof g=="function"?(f--,g):e,v&&te(u[0],u[1],v)&&(g=f<3?e:g,f=1),o=ut(o);++c-1?f[g?o[v]:v]:e}}function Bc(i){return Pr(function(o){var u=o.length,c=u,f=Ae.prototype.thru;for(i&&o.reverse();c--;){var g=o[c];if(typeof g!="function")throw new Ee(h);if(f&&!v&&xo(g)=="wrapper")var v=new Ae([],!0)}for(c=v?c:u;++c1&&X.reverse(),E&&Tw))return!1;var L=g.get(i),E=g.get(o);if(L&&E)return L==o&&E==i;var A=-1,I=!0,F=u&D?new Jr:e;for(g.set(i,o),g.set(o,i);++A1?"& ":"")+o[c],o=o.join(u>2?", ":" "),i.replace(Dm,`{ /* [wrapped with `+o+`] */ `)}function Ov(i){return W(i)||ii(i)||!!(oc&&i&&i[oc])}function Tr(i,o){var u=typeof i;return o=o!=null?o:Ar,!!o&&(u=="number"||u!="symbol"&&Gm.test(i))&&i>-1&&i%1==0&&i0){if(++o>=om)return arguments[0]}else o=0;return i.apply(e,arguments)}}function Co(i,o){var u=-1,c=i.length,f=c-1;for(o=o===e?c:o;++u1?i[o-1]:e;return u=typeof u=="function"?(i.pop(),u):e,ml(i,u)});function gl(i){var o=m(i);return o.__chain__=!0,o}function j0(i,o){return o(i),i}function _o(i,o){return o(i)}var G0=Pr(function(i){var o=i.length,u=o?i[0]:0,c=this.__wrapped__,f=function(g){return wa(g,i)};return o>1||this.__actions__.length||!(c instanceof Y)||!Tr(u)?this.thru(f):(c=c.slice(u,+u+(o?1:0)),c.__actions__.push({func:_o,args:[f],thisArg:e}),new Ae(c,this.__chain__).thru(function(g){return o&&!g.length&&g.push(e),g}))});function H0(){return gl(this)}function B0(){return new Ae(this.value(),this.__chain__)}function W0(){this.__values__===e&&(this.__values__=Ol(this.value()));var i=this.__index__>=this.__values__.length,o=i?e:this.__values__[this.__index__++];return{done:i,value:o}}function q0(){return this}function $0(i){for(var o,u=this;u instanceof co;){var c=hl(u);c.__index__=0,c.__values__=e,o?f.__wrapped__=c:o=c;var f=c;u=u.__wrapped__}return f.__wrapped__=i,o}function Q0(){var i=this.__wrapped__;if(i instanceof Y){var o=i;return this.__actions__.length&&(o=new Y(this)),o=o.reverse(),o.__actions__.push({func:_o,args:[Qa],thisArg:e}),new Ae(o,this.__chain__)}return this.thru(Qa)}function K0(){return Mc(this.__wrapped__,this.__actions__)}var Y0=vo(function(i,o,u){st.call(i,u)?++i[u]:br(i,u,1)});function X0(i,o,u){var c=W(i)?Wh:jy;return u&&te(i,o,u)&&(o=e),c(i,V(o,3))}function J0(i,o){var u=W(i)?Or:mc;return u(i,V(o,3))}var Z0=Hc(cl),tb=Hc(ll);function eb(i,o){return Ht(Lo(i,o),1)}function rb(i,o){return Ht(Lo(i,o),Qr)}function ib(i,o,u){return u=u===e?1:q(u),Ht(Lo(i,o),u)}function yl(i,o){var u=W(i)?Le:Rr;return u(i,V(o,3))}function vl(i,o){var u=W(i)?Tg:dc;return u(i,V(o,3))}var nb=vo(function(i,o,u){st.call(i,u)?i[u].push(o):br(i,u,[o])});function ob(i,o,u,c){i=ue(i)?i:Ei(i),u=u&&!c?q(u):0;var f=i.length;return u<0&&(u=Dt(f+u,0)),Mo(i)?u<=f&&i.indexOf(o,u)>-1:!!f&&yi(i,o,u)>-1}var sb=Q(function(i,o,u){var c=-1,f=typeof o=="function",g=ue(i)?S(i.length):[];return Rr(i,function(v){g[++c]=f?de(o,v,u):fn(v,o,u)}),g}),ab=vo(function(i,o,u){br(i,u,o)});function Lo(i,o){var u=W(i)?pt:Pc;return u(i,V(o,3))}function ub(i,o,u,c){return i==null?[]:(W(o)||(o=o==null?[]:[o]),u=c?e:u,W(u)||(u=u==null?[]:[u]),Cc(i,o,u))}var hb=vo(function(i,o,u){i[u?0:1].push(o)},function(){return[[],[]]});function cb(i,o,u){var c=W(i)?aa:Kh,f=arguments.length<3;return c(i,V(o,4),u,f,Rr)}function lb(i,o,u){var c=W(i)?xg:Kh,f=arguments.length<3;return c(i,V(o,4),u,f,dc)}function fb(i,o){var u=W(i)?Or:mc;return u(i,Oo(V(o,3)))}function pb(i){var o=W(i)?cc:ov;return o(i)}function db(i,o,u){(u?te(i,o,u):o===e)?o=1:o=q(o);var c=W(i)?Fy:sv;return c(i,o)}function mb(i){var o=W(i)?zy:uv;return o(i)}function gb(i){if(i==null)return 0;if(ue(i))return Mo(i)?bi(i):i.length;var o=Qt(i);return o==Ve||o==Ne?i.size:_a(i).length}function yb(i,o,u){var c=W(i)?ua:hv;return u&&te(i,o,u)&&(o=e),c(i,V(o,3))}var vb=Q(function(i,o){if(i==null)return[];var u=o.length;return u>1&&te(i,o[0],o[1])?o=[]:u>2&&te(o[0],o[1],o[2])&&(o=[o[0]]),Cc(i,Ht(o,1),[])}),Eo=Jg||function(){return Ft.Date.now()};function bb(i,o){if(typeof o!="function")throw new Ee(h);return i=q(i),function(){if(--i<1)return o.apply(this,arguments)}}function bl(i,o,u){return o=u?e:o,o=i&&o==null?i.length:o,wr(i,Ce,e,e,e,e,o)}function wl(i,o){var u;if(typeof o!="function")throw new Ee(h);return i=q(i),function(){return--i>0&&(u=o.apply(this,arguments)),i<=1&&(o=e),u}}var Ya=Q(function(i,o,u){var c=R;if(u.length){var f=Mr(u,_i(Ya));c|=At}return wr(i,c,o,u,f)}),Pl=Q(function(i,o,u){var c=R|H;if(u.length){var f=Mr(u,_i(Pl));c|=At}return wr(o,c,i,u,f)});function Tl(i,o,u){o=u?e:o;var c=wr(i,Z,e,e,e,e,e,o);return c.placeholder=Tl.placeholder,c}function xl(i,o,u){o=u?e:o;var c=wr(i,ht,e,e,e,e,e,o);return c.placeholder=xl.placeholder,c}function Sl(i,o,u){var c,f,g,v,w,T,L=0,E=!1,A=!1,I=!0;if(typeof i!="function")throw new Ee(h);o=Ie(o)||0,gt(u)&&(E=!!u.leading,A="maxWait"in u,g=A?Dt(Ie(u.maxWait)||0,o):g,I="trailing"in u?!!u.trailing:I);function F(Tt){var He=c,Cr=f;return c=f=e,L=Tt,v=i.apply(Cr,He),v}function N(Tt){return L=Tt,w=yn(K,o),E?F(Tt):v}function $(Tt){var He=Tt-T,Cr=Tt-L,Hl=o-He;return A?$t(Hl,g-Cr):Hl}function U(Tt){var He=Tt-T,Cr=Tt-L;return T===e||He>=o||He<0||A&&Cr>=g}function K(){var Tt=Eo();if(U(Tt))return X(Tt);w=yn(K,$(Tt))}function X(Tt){return w=e,I&&c?F(Tt):(c=f=e,v)}function ve(){w!==e&&kc(w),L=0,c=T=f=w=e}function ee(){return w===e?v:X(Eo())}function be(){var Tt=Eo(),He=U(Tt);if(c=arguments,f=this,T=Tt,He){if(w===e)return N(T);if(A)return kc(w),w=yn(K,o),F(T)}return w===e&&(w=yn(K,o)),v}return be.cancel=ve,be.flush=ee,be}var wb=Q(function(i,o){return pc(i,1,o)}),Pb=Q(function(i,o,u){return pc(i,Ie(o)||0,u)});function Tb(i){return wr(i,js)}function Ao(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new Ee(h);var u=function(){var c=arguments,f=o?o.apply(this,c):c[0],g=u.cache;if(g.has(f))return g.get(f);var v=i.apply(this,c);return u.cache=g.set(f,v)||g,v};return u.cache=new(Ao.Cache||vr),u}Ao.Cache=vr;function Oo(i){if(typeof i!="function")throw new Ee(h);return function(){var o=arguments;switch(o.length){case 0:return!i.call(this);case 1:return!i.call(this,o[0]);case 2:return!i.call(this,o[0],o[1]);case 3:return!i.call(this,o[0],o[1],o[2])}return!i.apply(this,o)}}function xb(i){return wl(2,i)}var Sb=cv(function(i,o){o=o.length==1&&W(o[0])?pt(o[0],me(V())):pt(Ht(o,1),me(V()));var u=o.length;return Q(function(c){for(var f=-1,g=$t(c.length,u);++f=o}),ii=vc(function(){return arguments}())?vc:function(i){return bt(i)&&st.call(i,"callee")&&!nc.call(i,"callee")},W=S.isArray,Nb=Nh?me(Nh):$y;function ue(i){return i!=null&&Do(i.length)&&!xr(i)}function Pt(i){return bt(i)&&ue(i)}function Ub(i){return i===!0||i===!1||bt(i)&&Zt(i)==Yi}var Nr=ty||uu,jb=Uh?me(Uh):Qy;function Gb(i){return bt(i)&&i.nodeType===1&&!vn(i)}function Hb(i){if(i==null)return!0;if(ue(i)&&(W(i)||typeof i=="string"||typeof i.splice=="function"||Nr(i)||Li(i)||ii(i)))return!i.length;var o=Qt(i);if(o==Ve||o==Ne)return!i.size;if(gn(i))return!_a(i).length;for(var u in i)if(st.call(i,u))return!1;return!0}function Bb(i,o){return pn(i,o)}function Wb(i,o,u){u=typeof u=="function"?u:e;var c=u?u(i,o):e;return c===e?pn(i,o,e,u):!!c}function Ja(i){if(!bt(i))return!1;var o=Zt(i);return o==Gn||o==dm||typeof i.message=="string"&&typeof i.name=="string"&&!vn(i)}function qb(i){return typeof i=="number"&&sc(i)}function xr(i){if(!gt(i))return!1;var o=Zt(i);return o==Hn||o==ph||o==pm||o==gm}function _l(i){return typeof i=="number"&&i==q(i)}function Do(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=Ar}function gt(i){var o=typeof i;return i!=null&&(o=="object"||o=="function")}function bt(i){return i!=null&&typeof i=="object"}var Ll=jh?me(jh):Yy;function $b(i,o){return i===o||Ca(i,o,Ga(o))}function Qb(i,o,u){return u=typeof u=="function"?u:e,Ca(i,o,Ga(o),u)}function Kb(i){return El(i)&&i!=+i}function Yb(i){if(Iv(i))throw new B(a);return bc(i)}function Xb(i){return i===null}function Jb(i){return i==null}function El(i){return typeof i=="number"||bt(i)&&Zt(i)==Ji}function vn(i){if(!bt(i)||Zt(i)!=gr)return!1;var o=io(i);if(o===null)return!0;var u=st.call(o,"constructor")&&o.constructor;return typeof u=="function"&&u instanceof u&&Zn.call(u)==Qg}var Za=Gh?me(Gh):Xy;function Zb(i){return _l(i)&&i>=-Ar&&i<=Ar}var Al=Hh?me(Hh):Jy;function Mo(i){return typeof i=="string"||!W(i)&&bt(i)&&Zt(i)==tn}function ye(i){return typeof i=="symbol"||bt(i)&&Zt(i)==Bn}var Li=Bh?me(Bh):Zy;function tw(i){return i===e}function ew(i){return bt(i)&&Qt(i)==en}function rw(i){return bt(i)&&Zt(i)==vm}var iw=To(La),nw=To(function(i,o){return i<=o});function Ol(i){if(!i)return[];if(ue(i))return Mo(i)?Ue(i):ae(i);if(on&&i[on])return Fg(i[on]());var o=Qt(i),u=o==Ve?da:o==Ne?Yn:Ei;return u(i)}function Sr(i){if(!i)return i===0?i:0;if(i=Ie(i),i===Qr||i===-Qr){var o=i<0?-1:1;return o*hm}return i===i?i:0}function q(i){var o=Sr(i),u=o%1;return o===o?u?o-u:o:0}function Dl(i){return i?Zr(q(i),0,Xe):0}function Ie(i){if(typeof i=="number")return i;if(ye(i))return Un;if(gt(i)){var o=typeof i.valueOf=="function"?i.valueOf():i;i=gt(o)?o+"":o}if(typeof i!="string")return i===0?i:+i;i=Yh(i);var u=Nm.test(i);return u||jm.test(i)?bg(i.slice(2),u?2:8):Vm.test(i)?Un:+i}function Ml(i){return Ze(i,he(i))}function ow(i){return i?Zr(q(i),-Ar,Ar):i===0?i:0}function nt(i){return i==null?"":ge(i)}var sw=Si(function(i,o){if(gn(o)||ue(o)){Ze(o,zt(o),i);return}for(var u in o)st.call(o,u)&&cn(i,u,o[u])}),Il=Si(function(i,o){Ze(o,he(o),i)}),Io=Si(function(i,o,u,c){Ze(o,he(o),i,c)}),aw=Si(function(i,o,u,c){Ze(o,zt(o),i,c)}),uw=Pr(wa);function hw(i,o){var u=xi(i);return o==null?u:lc(u,o)}var cw=Q(function(i,o){i=ut(i);var u=-1,c=o.length,f=c>2?o[2]:e;for(f&&te(o[0],o[1],f)&&(c=1);++u1),g}),Ze(i,Ua(i),u),c&&(u=Oe(u,b|x|C,Pv));for(var f=o.length;f--;)Ma(u,o[f]);return u});function Ew(i,o){return Rl(i,Oo(V(o)))}var Aw=Pr(function(i,o){return i==null?{}:rv(i,o)});function Rl(i,o){if(i==null)return{};var u=pt(Ua(i),function(c){return[c]});return o=V(o),_c(i,u,function(c,f){return o(c,f[0])})}function Ow(i,o,u){o=zr(o,i);var c=-1,f=o.length;for(f||(f=1,i=e);++co){var c=i;i=o,o=c}if(u||i%1||o%1){var f=ac();return $t(i+f*(o-i+vg("1e-"+((f+"").length-1))),o)}return Aa(i,o)}var jw=Ci(function(i,o,u){return o=o.toLowerCase(),i+(u?Vl(o):o)});function Vl(i){return ru(nt(i).toLowerCase())}function Nl(i){return i=nt(i),i&&i.replace(Hm,Dg).replace(ug,"")}function Gw(i,o,u){i=nt(i),o=ge(o);var c=i.length;u=u===e?c:Zr(q(u),0,c);var f=u;return u-=o.length,u>=0&&i.slice(u,f)==o}function Hw(i){return i=nt(i),i&&xm.test(i)?i.replace(gh,Mg):i}function Bw(i){return i=nt(i),i&&Am.test(i)?i.replace(Xs,"\\$&"):i}var Ww=Ci(function(i,o,u){return i+(u?"-":"")+o.toLowerCase()}),qw=Ci(function(i,o,u){return i+(u?" ":"")+o.toLowerCase()}),$w=Gc("toLowerCase");function Qw(i,o,u){i=nt(i),o=q(o);var c=o?bi(i):0;if(!o||c>=o)return i;var f=(o-c)/2;return Po(ao(f),u)+i+Po(so(f),u)}function Kw(i,o,u){i=nt(i),o=q(o);var c=o?bi(i):0;return o&&c>>0,u?(i=nt(i),i&&(typeof o=="string"||o!=null&&!Za(o))&&(o=ge(o),!o&&vi(i))?Vr(Ue(i),0,u):i.split(o,u)):[]}var rP=Ci(function(i,o,u){return i+(u?" ":"")+ru(o)});function iP(i,o,u){return i=nt(i),u=u==null?0:Zr(q(u),0,i.length),o=ge(o),i.slice(u,u+o.length)==o}function nP(i,o,u){var c=m.templateSettings;u&&te(i,o,u)&&(o=e),i=nt(i),o=Io({},o,c,Kc);var f=Io({},o.imports,c.imports,Kc),g=zt(f),v=pa(f,g),w,T,L=0,E=o.interpolate||Wn,A="__p += '",I=ma((o.escape||Wn).source+"|"+E.source+"|"+(E===yh?zm:Wn).source+"|"+(o.evaluate||Wn).source+"|$","g"),F="//# sourceURL="+(st.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++pg+"]")+` `;i.replace(I,function(U,K,X,ve,ee,be){return X||(X=ve),A+=i.slice(L,be).replace(Bm,Ig),K&&(w=!0,A+=`' + diff --git a/dist/GridEngine.min.cjs b/dist/GridEngine.min.cjs new file mode 100644 index 00000000..8573213a --- /dev/null +++ b/dist/GridEngine.min.cjs @@ -0,0 +1,38 @@ +var RM=Object.create;var Ls=Object.defineProperty;var zM=Object.getOwnPropertyDescriptor;var NM=Object.getOwnPropertyNames;var VM=Object.getPrototypeOf,WM=Object.prototype.hasOwnProperty;var _=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),UM=(r,e)=>{for(var t in e)Ls(r,t,{get:e[t],enumerable:!0})},eb=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of NM(e))!WM.call(r,n)&&n!==t&&Ls(r,n,{get:()=>e[n],enumerable:!(i=zM(e,n))||i.enumerable});return r};var gt=(r,e,t)=>(t=r!=null?RM(VM(r)):{},eb(e||!r||!r.__esModule?Ls(t,"default",{value:r,enumerable:!0}):t,r)),BM=r=>eb(Ls({},"__esModule",{value:!0}),r);var le=_(Is=>{"use strict";Object.defineProperty(Is,"__esModule",{value:!0});Is.isFunction=void 0;function YM(r){return typeof r=="function"}Is.isFunction=YM});var si=_(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.createErrorClass=void 0;function XM(r){var e=function(i){Error.call(i),i.stack=new Error().stack},t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}Fs.createErrorClass=XM});var cp=_(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.UnsubscriptionError=void 0;var JM=si();Ds.UnsubscriptionError=JM.createErrorClass(function(r){return function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription: +`+t.map(function(i,n){return n+1+") "+i.toString()}).join(` + `):"",this.name="UnsubscriptionError",this.errors=t}})});var Nr=_(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.arrRemove=void 0;function ZM(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}ks.arrRemove=ZM});var xt=_(_t=>{"use strict";var nb=_t&&_t.__values||function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},ob=_t&&_t.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},ab=_t&&_t.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.config=void 0;Rs.config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}});var hp=_(lr=>{"use strict";var cb=lr&&lr.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},lb=lr&&lr.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.reportUnhandledError=void 0;var tx=qn(),rx=hp();function ix(r){rx.timeoutProvider.setTimeout(function(){var e=tx.config.onUnhandledError;if(e)e(r);else throw r})}zs.reportUnhandledError=ix});var Ke=_(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.noop=void 0;function nx(){}Ns.noop=nx});var fb=_(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.createNotification=fr.nextNotification=fr.errorNotification=fr.COMPLETE_NOTIFICATION=void 0;fr.COMPLETE_NOTIFICATION=function(){return Vs("C",void 0,void 0)}();function ox(r){return Vs("E",void 0,r)}fr.errorNotification=ox;function ax(r){return Vs("N",r,void 0)}fr.nextNotification=ax;function Vs(r,e,t){return{kind:r,value:e,error:t}}fr.createNotification=Vs});var Ws=_(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.captureError=Cn.errorContext=void 0;var hb=qn(),Qi=null;function sx(r){if(hb.config.useDeprecatedSynchronousErrorHandling){var e=!Qi;if(e&&(Qi={errorThrown:!1,error:null}),r(),e){var t=Qi,i=t.errorThrown,n=t.error;if(Qi=null,i)throw n}}else r()}Cn.errorContext=sx;function ux(r){hb.config.useDeprecatedSynchronousErrorHandling&&Qi&&(Qi.errorThrown=!0,Qi.error=r)}Cn.captureError=ux});var Mn=_(Jt=>{"use strict";var vb=Jt&&Jt.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Jt,"__esModule",{value:!0});Jt.EMPTY_OBSERVER=Jt.SafeSubscriber=Jt.Subscriber=void 0;var cx=le(),pb=xt(),yp=qn(),lx=pp(),db=Ke(),dp=fb(),fx=hp(),hx=Ws(),mb=function(r){vb(e,r);function e(t){var i=r.call(this)||this;return i.isStopped=!1,t?(i.destination=t,pb.isSubscription(t)&&t.add(i)):i.destination=Jt.EMPTY_OBSERVER,i}return e.create=function(t,i,n){return new yb(t,i,n)},e.prototype.next=function(t){this.isStopped?mp(dp.nextNotification(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?mp(dp.errorNotification(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?mp(dp.COMPLETE_NOTIFICATION,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(pb.Subscription);Jt.Subscriber=mb;var px=Function.prototype.bind;function vp(r,e){return px.call(r,e)}var dx=function(){function r(e){this.partialObserver=e}return r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(i){Us(i)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(i){Us(i)}else Us(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Us(t)}},r}(),yb=function(r){vb(e,r);function e(t,i,n){var s=r.call(this)||this,c;if(cx.isFunction(t)||!t)c={next:t??void 0,error:i??void 0,complete:n??void 0};else{var l;s&&yp.config.useDeprecatedNextContext?(l=Object.create(t),l.unsubscribe=function(){return s.unsubscribe()},c={next:t.next&&vp(t.next,l),error:t.error&&vp(t.error,l),complete:t.complete&&vp(t.complete,l)}):c=t}return s.destination=new dx(c),s}return e}(mb);Jt.SafeSubscriber=yb;function Us(r){yp.config.useDeprecatedSynchronousErrorHandling?hx.captureError(r):lx.reportUnhandledError(r)}function vx(r){throw r}function mp(r,e){var t=yp.config.onStoppedNotification;t&&fx.timeoutProvider.setTimeout(function(){return t(r,e)})}Jt.EMPTY_OBSERVER={closed:!0,next:db.noop,error:vx,complete:db.noop}});var fa=_(Bs=>{"use strict";Object.defineProperty(Bs,"__esModule",{value:!0});Bs.observable=void 0;Bs.observable=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}()});var Ye=_(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.identity=void 0;function mx(r){return r}Gs.identity=mx});var ha=_(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.pipeFromArray=xn.pipe=void 0;var yx=Ye();function gx(){for(var r=[],e=0;e{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});Hs.Observable=void 0;var bp=Mn(),bx=xt(),_x=fa(),Px=ha(),wx=qn(),gp=le(),Ox=Ws(),Sx=function(){function r(e){e&&(this._subscribe=e)}return r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,i){var n=this,s=Ax(e)?e:new bp.SafeSubscriber(e,t,i);return Ox.errorContext(function(){var c=n,l=c.operator,h=c.source;s.add(l?l.call(s,h):h?n._subscribe(s):n._trySubscribe(s))}),s},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var i=this;return t=bb(t),new t(function(n,s){var c=new bp.SafeSubscriber({next:function(l){try{e(l)}catch(h){s(h),c.unsubscribe()}},error:s,complete:n});i.subscribe(c)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[_x.observable]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.operate=Ln.hasLift=void 0;var Ex=le();function _b(r){return Ex.isFunction(r?.lift)}Ln.hasLift=_b;function qx(r){return function(e){if(_b(e))return e.lift(function(t){try{return r(t,this)}catch(i){this.error(i)}});throw new TypeError("Unable to lift unknown Observable type")}}Ln.operate=qx});var U=_(ui=>{"use strict";var Cx=ui&&ui.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(ui,"__esModule",{value:!0});ui.OperatorSubscriber=ui.createOperatorSubscriber=void 0;var Mx=Mn();function xx(r,e,t,i,n){return new Pb(r,e,t,i,n)}ui.createOperatorSubscriber=xx;var Pb=function(r){Cx(e,r);function e(t,i,n,s,c,l){var h=r.call(this,t)||this;return h.onFinalize=c,h.shouldUnsubscribe=l,h._next=i?function(p){try{i(p)}catch(v){t.error(v)}}:r.prototype._next,h._error=s?function(p){try{s(p)}catch(v){t.error(v)}finally{this.unsubscribe()}}:r.prototype._error,h._complete=n?function(){try{n()}catch(p){t.error(p)}finally{this.unsubscribe()}}:r.prototype._complete,h}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var i=this.closed;r.prototype.unsubscribe.call(this),!i&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(Mx.Subscriber);ui.OperatorSubscriber=Pb});var Qs=_($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});$s.refCount=void 0;var Lx=z(),jx=U();function Ix(){return Lx.operate(function(r,e){var t=null;r._refCount++;var i=jx.createOperatorSubscriber(e,void 0,void 0,void 0,function(){if(!r||r._refCount<=0||0<--r._refCount){t=null;return}var n=r._connection,s=t;t=null,n&&(!s||n===s)&&n.unsubscribe(),e.unsubscribe()});r.subscribe(i),i.closed||(t=r.connect())})}$s.refCount=Ix});var pa=_(jn=>{"use strict";var Fx=jn&&jn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(jn,"__esModule",{value:!0});jn.ConnectableObservable=void 0;var Dx=he(),wb=xt(),kx=Qs(),Rx=U(),zx=z(),Nx=function(r){Fx(e,r);function e(t,i){var n=r.call(this)||this;return n.source=t,n.subjectFactory=i,n._subject=null,n._refCount=0,n._connection=null,zx.hasLift(t)&&(n.lift=t.lift),n}return e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return(!t||t.isStopped)&&(this._subject=this.subjectFactory()),this._subject},e.prototype._teardown=function(){this._refCount=0;var t=this._connection;this._subject=this._connection=null,t?.unsubscribe()},e.prototype.connect=function(){var t=this,i=this._connection;if(!i){i=this._connection=new wb.Subscription;var n=this.getSubject();i.add(this.source.subscribe(Rx.createOperatorSubscriber(n,void 0,function(){t._teardown(),n.complete()},function(s){t._teardown(),n.error(s)},function(){return t._teardown()}))),i.closed&&(this._connection=null,i=wb.Subscription.EMPTY)}return i},e.prototype.refCount=function(){return kx.refCount()(this)},e}(Dx.Observable);jn.ConnectableObservable=Nx});var Ob=_(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});da.performanceTimestampProvider=void 0;da.performanceTimestampProvider={now:function(){return(da.performanceTimestampProvider.delegate||performance).now()},delegate:void 0}});var _p=_(Zt=>{"use strict";var Sb=Zt&&Zt.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},Tb=Zt&&Zt.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";Object.defineProperty(Ks,"__esModule",{value:!0});Ks.animationFrames=void 0;var Wx=he(),Ux=Ob(),Ab=_p();function Bx(r){return r?Eb(r):Gx}Ks.animationFrames=Bx;function Eb(r){return new Wx.Observable(function(e){var t=r||Ux.performanceTimestampProvider,i=t.now(),n=0,s=function(){e.closed||(n=Ab.animationFrameProvider.requestAnimationFrame(function(c){n=0;var l=t.now();e.next({timestamp:r?l:c,elapsed:l-i}),s()}))};return s(),function(){n&&Ab.animationFrameProvider.cancelAnimationFrame(n)}})}var Gx=Eb()});var Pp=_(Ys=>{"use strict";Object.defineProperty(Ys,"__esModule",{value:!0});Ys.ObjectUnsubscribedError=void 0;var Hx=si();Ys.ObjectUnsubscribedError=Hx.createErrorClass(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})});var Xe=_(hr=>{"use strict";var Mb=hr&&hr.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}(),$x=hr&&hr.__values||function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(hr,"__esModule",{value:!0});hr.AnonymousSubject=hr.Subject=void 0;var Cb=he(),Op=xt(),Qx=Pp(),Kx=Nr(),wp=Ws(),xb=function(r){Mb(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var i=new Sp(this,this);return i.operator=t,i},e.prototype._throwIfClosed=function(){if(this.closed)throw new Qx.ObjectUnsubscribedError},e.prototype.next=function(t){var i=this;wp.errorContext(function(){var n,s;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var c=$x(i.currentObservers),l=c.next();!l.done;l=c.next()){var h=l.value;h.next(t)}}catch(p){n={error:p}}finally{try{l&&!l.done&&(s=c.return)&&s.call(c)}finally{if(n)throw n.error}}}})},e.prototype.error=function(t){var i=this;wp.errorContext(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=t;for(var n=i.observers;n.length;)n.shift().error(t)}})},e.prototype.complete=function(){var t=this;wp.errorContext(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var i=t.observers;i.length;)i.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var i=this,n=this,s=n.hasError,c=n.isStopped,l=n.observers;return s||c?Op.EMPTY_SUBSCRIPTION:(this.currentObservers=null,l.push(t),new Op.Subscription(function(){i.currentObservers=null,Kx.arrRemove(l,t)}))},e.prototype._checkFinalizedStatuses=function(t){var i=this,n=i.hasError,s=i.thrownError,c=i.isStopped;n?t.error(s):c&&t.complete()},e.prototype.asObservable=function(){var t=new Cb.Observable;return t.source=this,t},e.create=function(t,i){return new Sp(t,i)},e}(Cb.Observable);hr.Subject=xb;var Sp=function(r){Mb(e,r);function e(t,i){var n=r.call(this)||this;return n.destination=t,n.source=i,n}return e.prototype.next=function(t){var i,n;(n=(i=this.destination)===null||i===void 0?void 0:i.next)===null||n===void 0||n.call(i,t)},e.prototype.error=function(t){var i,n;(n=(i=this.destination)===null||i===void 0?void 0:i.error)===null||n===void 0||n.call(i,t)},e.prototype.complete=function(){var t,i;(i=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||i===void 0||i.call(t)},e.prototype._subscribe=function(t){var i,n;return(n=(i=this.source)===null||i===void 0?void 0:i.subscribe(t))!==null&&n!==void 0?n:Op.EMPTY_SUBSCRIPTION},e}(xb);hr.AnonymousSubject=Sp});var Tp=_(In=>{"use strict";var Yx=In&&In.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(In,"__esModule",{value:!0});In.BehaviorSubject=void 0;var Xx=Xe(),Jx=function(r){Yx(e,r);function e(t){var i=r.call(this)||this;return i._value=t,i}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var i=r.prototype._subscribe.call(this,t);return!i.closed&&t.next(this._value),i},e.prototype.getValue=function(){var t=this,i=t.hasError,n=t.thrownError,s=t._value;if(i)throw n;return this._throwIfClosed(),s},e.prototype.next=function(t){r.prototype.next.call(this,this._value=t)},e}(Xx.Subject);In.BehaviorSubject=Jx});var Xs=_(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.dateTimestampProvider=void 0;va.dateTimestampProvider={now:function(){return(va.dateTimestampProvider.delegate||Date).now()},delegate:void 0}});var Js=_(Fn=>{"use strict";var Zx=Fn&&Fn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Fn,"__esModule",{value:!0});Fn.ReplaySubject=void 0;var eL=Xe(),tL=Xs(),rL=function(r){Zx(e,r);function e(t,i,n){t===void 0&&(t=1/0),i===void 0&&(i=1/0),n===void 0&&(n=tL.dateTimestampProvider);var s=r.call(this)||this;return s._bufferSize=t,s._windowTime=i,s._timestampProvider=n,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=i===1/0,s._bufferSize=Math.max(1,t),s._windowTime=Math.max(1,i),s}return e.prototype.next=function(t){var i=this,n=i.isStopped,s=i._buffer,c=i._infiniteTimeWindow,l=i._timestampProvider,h=i._windowTime;n||(s.push(t),!c&&s.push(l.now()+h)),this._trimBuffer(),r.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var i=this._innerSubscribe(t),n=this,s=n._infiniteTimeWindow,c=n._buffer,l=c.slice(),h=0;h{"use strict";var iL=Dn&&Dn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Dn,"__esModule",{value:!0});Dn.AsyncSubject=void 0;var nL=Xe(),oL=function(r){iL(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}return e.prototype._checkFinalizedStatuses=function(t){var i=this,n=i.hasError,s=i._hasValue,c=i._value,l=i.thrownError,h=i.isStopped,p=i._isComplete;n?t.error(l):(h||p)&&(s&&t.next(c),t.complete())},e.prototype.next=function(t){this.isStopped||(this._value=t,this._hasValue=!0)},e.prototype.complete=function(){var t=this,i=t._hasValue,n=t._value,s=t._isComplete;s||(this._isComplete=!0,i&&r.prototype.next.call(this,n),r.prototype.complete.call(this))},e}(nL.Subject);Dn.AsyncSubject=oL});var Lb=_(kn=>{"use strict";var aL=kn&&kn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(kn,"__esModule",{value:!0});kn.Action=void 0;var sL=xt(),uL=function(r){aL(e,r);function e(t,i){return r.call(this)||this}return e.prototype.schedule=function(t,i){return i===void 0&&(i=0),this},e}(sL.Subscription);kn.Action=uL});var Fb=_(pr=>{"use strict";var jb=pr&&pr.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},Ib=pr&&pr.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";var cL=Rn&&Rn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Rn,"__esModule",{value:!0});Rn.AsyncAction=void 0;var lL=Lb(),Db=Fb(),fL=Nr(),hL=function(r){cL(e,r);function e(t,i){var n=r.call(this,t,i)||this;return n.scheduler=t,n.work=i,n.pending=!1,n}return e.prototype.schedule=function(t,i){var n;if(i===void 0&&(i=0),this.closed)return this;this.state=t;var s=this.id,c=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(c,s,i)),this.pending=!0,this.delay=i,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(c,this.id,i),this},e.prototype.requestAsyncId=function(t,i,n){return n===void 0&&(n=0),Db.intervalProvider.setInterval(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,i,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return i;i!=null&&Db.intervalProvider.clearInterval(i)},e.prototype.execute=function(t,i){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,i);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,i){var n=!1,s;try{this.work(t)}catch(c){n=!0,s=c||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,i=t.id,n=t.scheduler,s=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,fL.arrRemove(s,this),i!=null&&(this.id=this.recycleAsyncId(n,i,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e}(lL.Action);Rn.AsyncAction=hL});var Rb=_(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.TestTools=Nn.Immediate=void 0;var pL=1,Ap,eu={};function kb(r){return r in eu?(delete eu[r],!0):!1}Nn.Immediate={setImmediate:function(r){var e=pL++;return eu[e]=!0,Ap||(Ap=Promise.resolve()),Ap.then(function(){return kb(e)&&r()}),e},clearImmediate:function(r){kb(r)}};Nn.TestTools={pending:function(){return Object.keys(eu).length}}});var Nb=_(dr=>{"use strict";var dL=dr&&dr.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},vL=dr&&dr.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";var gL=Vn&&Vn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Vn,"__esModule",{value:!0});Vn.AsapAction=void 0;var bL=zn(),Vb=Nb(),_L=function(r){gL(e,r);function e(t,i){var n=r.call(this,t,i)||this;return n.scheduler=t,n.work=i,n}return e.prototype.requestAsyncId=function(t,i,n){return n===void 0&&(n=0),n!==null&&n>0?r.prototype.requestAsyncId.call(this,t,i,n):(t.actions.push(this),t._scheduled||(t._scheduled=Vb.immediateProvider.setImmediate(t.flush.bind(t,void 0))))},e.prototype.recycleAsyncId=function(t,i,n){var s;if(n===void 0&&(n=0),n!=null?n>0:this.delay>0)return r.prototype.recycleAsyncId.call(this,t,i,n);var c=t.actions;i!=null&&((s=c[c.length-1])===null||s===void 0?void 0:s.id)!==i&&(Vb.immediateProvider.clearImmediate(i),t._scheduled===i&&(t._scheduled=void 0))},e}(bL.AsyncAction);Vn.AsapAction=_L});var Ep=_(tu=>{"use strict";Object.defineProperty(tu,"__esModule",{value:!0});tu.Scheduler=void 0;var PL=Xs(),wL=function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return r.prototype.schedule=function(e,t,i){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(i,t)},r.now=PL.dateTimestampProvider.now,r}();tu.Scheduler=wL});var Un=_(Wn=>{"use strict";var OL=Wn&&Wn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Wn,"__esModule",{value:!0});Wn.AsyncScheduler=void 0;var Ub=Ep(),SL=function(r){OL(e,r);function e(t,i){i===void 0&&(i=Ub.Scheduler.now);var n=r.call(this,t,i)||this;return n.actions=[],n._active=!1,n}return e.prototype.flush=function(t){var i=this.actions;if(this._active){i.push(t);return}var n;this._active=!0;do if(n=t.execute(t.state,t.delay))break;while(t=i.shift());if(this._active=!1,n){for(;t=i.shift();)t.unsubscribe();throw n}},e}(Ub.Scheduler);Wn.AsyncScheduler=SL});var Bb=_(Bn=>{"use strict";var TL=Bn&&Bn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Bn,"__esModule",{value:!0});Bn.AsapScheduler=void 0;var AL=Un(),EL=function(r){TL(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.flush=function(t){this._active=!0;var i=this._scheduled;this._scheduled=void 0;var n=this.actions,s;t=t||n.shift();do if(s=t.execute(t.state,t.delay))break;while((t=n[0])&&t.id===i&&n.shift());if(this._active=!1,s){for(;(t=n[0])&&t.id===i&&n.shift();)t.unsubscribe();throw s}},e}(AL.AsyncScheduler);Bn.AsapScheduler=EL});var Gb=_(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.asap=Ki.asapScheduler=void 0;var qL=Wb(),CL=Bb();Ki.asapScheduler=new CL.AsapScheduler(qL.AsapAction);Ki.asap=Ki.asapScheduler});var Pt=_(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.async=Yi.asyncScheduler=void 0;var ML=zn(),xL=Un();Yi.asyncScheduler=new xL.AsyncScheduler(ML.AsyncAction);Yi.async=Yi.asyncScheduler});var Hb=_(Gn=>{"use strict";var LL=Gn&&Gn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Gn,"__esModule",{value:!0});Gn.QueueAction=void 0;var jL=zn(),IL=function(r){LL(e,r);function e(t,i){var n=r.call(this,t,i)||this;return n.scheduler=t,n.work=i,n}return e.prototype.schedule=function(t,i){return i===void 0&&(i=0),i>0?r.prototype.schedule.call(this,t,i):(this.delay=i,this.state=t,this.scheduler.flush(this),this)},e.prototype.execute=function(t,i){return i>0||this.closed?r.prototype.execute.call(this,t,i):this._execute(t,i)},e.prototype.requestAsyncId=function(t,i,n){return n===void 0&&(n=0),n!=null&&n>0||n==null&&this.delay>0?r.prototype.requestAsyncId.call(this,t,i,n):(t.flush(this),0)},e}(jL.AsyncAction);Gn.QueueAction=IL});var $b=_(Hn=>{"use strict";var FL=Hn&&Hn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Hn,"__esModule",{value:!0});Hn.QueueScheduler=void 0;var DL=Un(),kL=function(r){FL(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(DL.AsyncScheduler);Hn.QueueScheduler=kL});var Qb=_(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.queue=Xi.queueScheduler=void 0;var RL=Hb(),zL=$b();Xi.queueScheduler=new zL.QueueScheduler(RL.QueueAction);Xi.queue=Xi.queueScheduler});var Yb=_($n=>{"use strict";var NL=$n&&$n.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty($n,"__esModule",{value:!0});$n.AnimationFrameAction=void 0;var VL=zn(),Kb=_p(),WL=function(r){NL(e,r);function e(t,i){var n=r.call(this,t,i)||this;return n.scheduler=t,n.work=i,n}return e.prototype.requestAsyncId=function(t,i,n){return n===void 0&&(n=0),n!==null&&n>0?r.prototype.requestAsyncId.call(this,t,i,n):(t.actions.push(this),t._scheduled||(t._scheduled=Kb.animationFrameProvider.requestAnimationFrame(function(){return t.flush(void 0)})))},e.prototype.recycleAsyncId=function(t,i,n){var s;if(n===void 0&&(n=0),n!=null?n>0:this.delay>0)return r.prototype.recycleAsyncId.call(this,t,i,n);var c=t.actions;i!=null&&((s=c[c.length-1])===null||s===void 0?void 0:s.id)!==i&&(Kb.animationFrameProvider.cancelAnimationFrame(i),t._scheduled=void 0)},e}(VL.AsyncAction);$n.AnimationFrameAction=WL});var Xb=_(Qn=>{"use strict";var UL=Qn&&Qn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Qn,"__esModule",{value:!0});Qn.AnimationFrameScheduler=void 0;var BL=Un(),GL=function(r){UL(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.flush=function(t){this._active=!0;var i=this._scheduled;this._scheduled=void 0;var n=this.actions,s;t=t||n.shift();do if(s=t.execute(t.state,t.delay))break;while((t=n[0])&&t.id===i&&n.shift());if(this._active=!1,s){for(;(t=n[0])&&t.id===i&&n.shift();)t.unsubscribe();throw s}},e}(BL.AsyncScheduler);Qn.AnimationFrameScheduler=GL});var Jb=_(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.animationFrame=Ji.animationFrameScheduler=void 0;var HL=Yb(),$L=Xb();Ji.animationFrameScheduler=new $L.AnimationFrameScheduler(HL.AnimationFrameAction);Ji.animationFrame=Ji.animationFrameScheduler});var t_=_(ci=>{"use strict";var Zb=ci&&ci.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(ci,"__esModule",{value:!0});ci.VirtualAction=ci.VirtualTimeScheduler=void 0;var QL=zn(),KL=xt(),YL=Un(),XL=function(r){Zb(e,r);function e(t,i){t===void 0&&(t=e_),i===void 0&&(i=1/0);var n=r.call(this,t,function(){return n.frame})||this;return n.maxFrames=i,n.frame=0,n.index=-1,n}return e.prototype.flush=function(){for(var t=this,i=t.actions,n=t.maxFrames,s,c;(c=i[0])&&c.delay<=n&&(i.shift(),this.frame=c.delay,!(s=c.execute(c.state,c.delay))););if(s){for(;c=i.shift();)c.unsubscribe();throw s}},e.frameTimeFactor=10,e}(YL.AsyncScheduler);ci.VirtualTimeScheduler=XL;var e_=function(r){Zb(e,r);function e(t,i,n){n===void 0&&(n=t.index+=1);var s=r.call(this,t,i)||this;return s.scheduler=t,s.work=i,s.index=n,s.active=!0,s.index=t.index=n,s}return e.prototype.schedule=function(t,i){if(i===void 0&&(i=0),Number.isFinite(i)){if(!this.id)return r.prototype.schedule.call(this,t,i);this.active=!1;var n=new e(this.scheduler,this.work);return this.add(n),n.schedule(t,i)}else return KL.Subscription.EMPTY},e.prototype.requestAsyncId=function(t,i,n){n===void 0&&(n=0),this.delay=t.frame+n;var s=t.actions;return s.push(this),s.sort(e.sortActions),1},e.prototype.recycleAsyncId=function(t,i,n){n===void 0&&(n=0)},e.prototype._execute=function(t,i){if(this.active===!0)return r.prototype._execute.call(this,t,i)},e.sortActions=function(t,i){return t.delay===i.delay?t.index===i.index?0:t.index>i.index?1:-1:t.delay>i.delay?1:-1},e}(QL.AsyncAction);ci.VirtualAction=e_});var er=_(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.empty=Zi.EMPTY=void 0;var r_=he();Zi.EMPTY=new r_.Observable(function(r){return r.complete()});function JL(r){return r?ZL(r):Zi.EMPTY}Zi.empty=JL;function ZL(r){return new r_.Observable(function(e){return r.schedule(function(){return e.complete()})})}});var ma=_(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});ru.isScheduler=void 0;var ej=le();function tj(r){return r&&ej.isFunction(r.schedule)}ru.isScheduler=tj});var wt=_(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.popNumber=li.popScheduler=li.popResultSelector=void 0;var rj=le(),ij=ma();function qp(r){return r[r.length-1]}function nj(r){return rj.isFunction(qp(r))?r.pop():void 0}li.popResultSelector=nj;function oj(r){return ij.isScheduler(qp(r))?r.pop():void 0}li.popScheduler=oj;function aj(r,e){return typeof qp(r)=="number"?r.pop():e}li.popNumber=aj});var nu=_(iu=>{"use strict";Object.defineProperty(iu,"__esModule",{value:!0});iu.isArrayLike=void 0;iu.isArrayLike=function(r){return r&&typeof r.length=="number"&&typeof r!="function"}});var Cp=_(ou=>{"use strict";Object.defineProperty(ou,"__esModule",{value:!0});ou.isPromise=void 0;var sj=le();function uj(r){return sj.isFunction(r?.then)}ou.isPromise=uj});var Mp=_(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.isInteropObservable=void 0;var cj=fa(),lj=le();function fj(r){return lj.isFunction(r[cj.observable])}au.isInteropObservable=fj});var xp=_(su=>{"use strict";Object.defineProperty(su,"__esModule",{value:!0});su.isAsyncIterable=void 0;var hj=le();function pj(r){return Symbol.asyncIterator&&hj.isFunction(r?.[Symbol.asyncIterator])}su.isAsyncIterable=pj});var Lp=_(uu=>{"use strict";Object.defineProperty(uu,"__esModule",{value:!0});uu.createInvalidObservableTypeError=void 0;function dj(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}uu.createInvalidObservableTypeError=dj});var jp=_(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.iterator=Kn.getSymbolIterator=void 0;function i_(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}Kn.getSymbolIterator=i_;Kn.iterator=i_()});var Ip=_(cu=>{"use strict";Object.defineProperty(cu,"__esModule",{value:!0});cu.isIterable=void 0;var vj=jp(),mj=le();function yj(r){return mj.isFunction(r?.[vj.iterator])}cu.isIterable=yj});var lu=_(Ut=>{"use strict";var gj=Ut&&Ut.__generator||function(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(p){return function(v){return h([p,v])}}function h(p){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=p[0]&2?n.return:p[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,p[1])).done)return s;switch(n=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,n=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]1||l(w,T)})})}function l(w,T){try{h(i[w](T))}catch(q){b(s[0][3],q)}}function h(w){w.value instanceof Yn?Promise.resolve(w.value.v).then(p,v):b(s[0][2],w)}function p(w){l("next",w)}function v(w){l("throw",w)}function b(w,T){w(T),s.shift(),s.length&&l(s[0][0],s[0][1])}};Object.defineProperty(Ut,"__esModule",{value:!0});Ut.isReadableStreamLike=Ut.readableStreamLikeToAsyncGenerator=void 0;var _j=le();function Pj(r){return bj(this,arguments,function(){var t,i,n,s;return gj(this,function(c){switch(c.label){case 0:t=r.getReader(),c.label=1;case 1:c.trys.push([1,,9,10]),c.label=2;case 2:return[4,Yn(t.read())];case 3:return i=c.sent(),n=i.value,s=i.done,s?[4,Yn(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,Yn(n)];case 6:return[4,c.sent()];case 7:return c.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}Ut.readableStreamLikeToAsyncGenerator=Pj;function wj(r){return _j.isFunction(r?.getReader)}Ut.isReadableStreamLike=wj});var X=_(be=>{"use strict";var Oj=be&&be.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(c){c(s)})}return new(t||(t=Promise))(function(s,c){function l(v){try{p(i.next(v))}catch(b){c(b)}}function h(v){try{p(i.throw(v))}catch(b){c(b)}}function p(v){v.done?s(v.value):n(v.value).then(l,h)}p((i=i.apply(r,e||[])).next())})},Sj=be&&be.__generator||function(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(p){return function(v){return h([p,v])}}function h(p){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=p[0]&2?n.return:p[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,p[1])).done)return s;switch(n=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,n=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(be,"__esModule",{value:!0});be.fromReadableStreamLike=be.fromAsyncIterable=be.fromIterable=be.fromPromise=be.fromArrayLike=be.fromInteropObservable=be.innerFrom=void 0;var Aj=nu(),Ej=Cp(),Xn=he(),qj=Mp(),Cj=xp(),Mj=Lp(),xj=Ip(),n_=lu(),Lj=le(),jj=pp(),Ij=fa();function Fj(r){if(r instanceof Xn.Observable)return r;if(r!=null){if(qj.isInteropObservable(r))return o_(r);if(Aj.isArrayLike(r))return a_(r);if(Ej.isPromise(r))return s_(r);if(Cj.isAsyncIterable(r))return Dp(r);if(xj.isIterable(r))return u_(r);if(n_.isReadableStreamLike(r))return c_(r)}throw Mj.createInvalidObservableTypeError(r)}be.innerFrom=Fj;function o_(r){return new Xn.Observable(function(e){var t=r[Ij.observable]();if(Lj.isFunction(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}be.fromInteropObservable=o_;function a_(r){return new Xn.Observable(function(e){for(var t=0;t{"use strict";Object.defineProperty(fu,"__esModule",{value:!0});fu.executeSchedule=void 0;function kj(r,e,t,i,n){i===void 0&&(i=0),n===void 0&&(n=!1);var s=e.schedule(function(){t(),n?r.add(this.schedule(null,i)):this.unsubscribe()},i);if(r.add(s),!n)return s}fu.executeSchedule=kj});var Jn=_(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.observeOn=void 0;var kp=Vr(),Rj=z(),zj=U();function Nj(r,e){return e===void 0&&(e=0),Rj.operate(function(t,i){t.subscribe(zj.createOperatorSubscriber(i,function(n){return kp.executeSchedule(i,r,function(){return i.next(n)},e)},function(){return kp.executeSchedule(i,r,function(){return i.complete()},e)},function(n){return kp.executeSchedule(i,r,function(){return i.error(n)},e)}))})}hu.observeOn=Nj});var Zn=_(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu.subscribeOn=void 0;var Vj=z();function Wj(r,e){return e===void 0&&(e=0),Vj.operate(function(t,i){i.add(r.schedule(function(){return t.subscribe(i)},e))})}pu.subscribeOn=Wj});var l_=_(du=>{"use strict";Object.defineProperty(du,"__esModule",{value:!0});du.scheduleObservable=void 0;var Uj=X(),Bj=Jn(),Gj=Zn();function Hj(r,e){return Uj.innerFrom(r).pipe(Gj.subscribeOn(e),Bj.observeOn(e))}du.scheduleObservable=Hj});var f_=_(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.schedulePromise=void 0;var $j=X(),Qj=Jn(),Kj=Zn();function Yj(r,e){return $j.innerFrom(r).pipe(Kj.subscribeOn(e),Qj.observeOn(e))}vu.schedulePromise=Yj});var h_=_(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.scheduleArray=void 0;var Xj=he();function Jj(r,e){return new Xj.Observable(function(t){var i=0;return e.schedule(function(){i===r.length?t.complete():(t.next(r[i++]),t.closed||this.schedule())})})}mu.scheduleArray=Jj});var Rp=_(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.scheduleIterable=void 0;var Zj=he(),eI=jp(),tI=le(),p_=Vr();function rI(r,e){return new Zj.Observable(function(t){var i;return p_.executeSchedule(t,e,function(){i=r[eI.iterator](),p_.executeSchedule(t,e,function(){var n,s,c;try{n=i.next(),s=n.value,c=n.done}catch(l){t.error(l);return}c?t.complete():t.next(s)},0,!0)}),function(){return tI.isFunction(i?.return)&&i.return()}})}yu.scheduleIterable=rI});var zp=_(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.scheduleAsyncIterable=void 0;var iI=he(),d_=Vr();function nI(r,e){if(!r)throw new Error("Iterable cannot be null");return new iI.Observable(function(t){d_.executeSchedule(t,e,function(){var i=r[Symbol.asyncIterator]();d_.executeSchedule(t,e,function(){i.next().then(function(n){n.done?t.complete():t.next(n.value)})},0,!0)})})}gu.scheduleAsyncIterable=nI});var v_=_(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.scheduleReadableStreamLike=void 0;var oI=zp(),aI=lu();function sI(r,e){return oI.scheduleAsyncIterable(aI.readableStreamLikeToAsyncGenerator(r),e)}bu.scheduleReadableStreamLike=sI});var Np=_(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.scheduled=void 0;var uI=l_(),cI=f_(),lI=h_(),fI=Rp(),hI=zp(),pI=Mp(),dI=Cp(),vI=nu(),mI=Ip(),yI=xp(),gI=Lp(),bI=lu(),_I=v_();function PI(r,e){if(r!=null){if(pI.isInteropObservable(r))return uI.scheduleObservable(r,e);if(vI.isArrayLike(r))return lI.scheduleArray(r,e);if(dI.isPromise(r))return cI.schedulePromise(r,e);if(yI.isAsyncIterable(r))return hI.scheduleAsyncIterable(r,e);if(mI.isIterable(r))return fI.scheduleIterable(r,e);if(bI.isReadableStreamLike(r))return _I.scheduleReadableStreamLike(r,e)}throw gI.createInvalidObservableTypeError(r)}_u.scheduled=PI});var Wr=_(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.from=void 0;var wI=Np(),OI=X();function SI(r,e){return e?wI.scheduled(r,e):OI.innerFrom(r)}Pu.from=SI});var Ou=_(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.of=void 0;var TI=wt(),AI=Wr();function EI(){for(var r=[],e=0;e{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.throwError=void 0;var qI=he(),CI=le();function MI(r,e){var t=CI.isFunction(r)?r:function(){return r},i=function(n){return n.error(t())};return new qI.Observable(e?function(n){return e.schedule(i,0,n)}:i)}Su.throwError=MI});var Tu=_(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.observeNotification=Ur.Notification=Ur.NotificationKind=void 0;var xI=er(),LI=Ou(),jI=Vp(),II=le(),FI;(function(r){r.NEXT="N",r.ERROR="E",r.COMPLETE="C"})(FI=Ur.NotificationKind||(Ur.NotificationKind={}));var DI=function(){function r(e,t,i){this.kind=e,this.value=t,this.error=i,this.hasValue=e==="N"}return r.prototype.observe=function(e){return m_(this,e)},r.prototype.do=function(e,t,i){var n=this,s=n.kind,c=n.value,l=n.error;return s==="N"?e?.(c):s==="E"?t?.(l):i?.()},r.prototype.accept=function(e,t,i){var n;return II.isFunction((n=e)===null||n===void 0?void 0:n.next)?this.observe(e):this.do(e,t,i)},r.prototype.toObservable=function(){var e=this,t=e.kind,i=e.value,n=e.error,s=t==="N"?LI.of(i):t==="E"?jI.throwError(function(){return n}):t==="C"?xI.EMPTY:0;if(!s)throw new TypeError("Unexpected notification kind "+t);return s},r.createNext=function(e){return new r("N",e)},r.createError=function(e){return new r("E",void 0,e)},r.createComplete=function(){return r.completeNotification},r.completeNotification=new r("C"),r}();Ur.Notification=DI;function m_(r,e){var t,i,n,s=r,c=s.kind,l=s.value,h=s.error;if(typeof c!="string")throw new TypeError('Invalid notification, missing "kind"');c==="N"?(t=e.next)===null||t===void 0||t.call(e,l):c==="E"?(i=e.error)===null||i===void 0||i.call(e,h):(n=e.complete)===null||n===void 0||n.call(e)}Ur.observeNotification=m_});var g_=_(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.isObservable=void 0;var kI=he(),y_=le();function RI(r){return!!r&&(r instanceof kI.Observable||y_.isFunction(r.lift)&&y_.isFunction(r.subscribe))}Au.isObservable=RI});var fi=_(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.EmptyError=void 0;var zI=si();Eu.EmptyError=zI.createErrorClass(function(r){return function(){r(this),this.name="EmptyError",this.message="no elements in sequence"}})});var b_=_(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.lastValueFrom=void 0;var NI=fi();function VI(r,e){var t=typeof e=="object";return new Promise(function(i,n){var s=!1,c;r.subscribe({next:function(l){c=l,s=!0},error:n,complete:function(){s?i(c):t?i(e.defaultValue):n(new NI.EmptyError)}})})}qu.lastValueFrom=VI});var __=_(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.firstValueFrom=void 0;var WI=fi(),UI=Mn();function BI(r,e){var t=typeof e=="object";return new Promise(function(i,n){var s=new UI.SafeSubscriber({next:function(c){i(c),s.unsubscribe()},error:n,complete:function(){t?i(e.defaultValue):n(new WI.EmptyError)}});r.subscribe(s)})}Cu.firstValueFrom=BI});var Wp=_(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.ArgumentOutOfRangeError=void 0;var GI=si();Mu.ArgumentOutOfRangeError=GI.createErrorClass(function(r){return function(){r(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})});var Up=_(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.NotFoundError=void 0;var HI=si();xu.NotFoundError=HI.createErrorClass(function(r){return function(t){r(this),this.name="NotFoundError",this.message=t}})});var Bp=_(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.SequenceError=void 0;var $I=si();Lu.SequenceError=$I.createErrorClass(function(r){return function(t){r(this),this.name="SequenceError",this.message=t}})});var Iu=_(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.isValidDate=void 0;function QI(r){return r instanceof Date&&!isNaN(r)}ju.isValidDate=QI});var ya=_(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.timeout=en.TimeoutError=void 0;var KI=Pt(),YI=Iu(),XI=z(),JI=X(),ZI=si(),eF=U(),tF=Vr();en.TimeoutError=ZI.createErrorClass(function(r){return function(t){t===void 0&&(t=null),r(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function rF(r,e){var t=YI.isValidDate(r)?{first:r}:typeof r=="number"?{each:r}:r,i=t.first,n=t.each,s=t.with,c=s===void 0?iF:s,l=t.scheduler,h=l===void 0?e??KI.asyncScheduler:l,p=t.meta,v=p===void 0?null:p;if(i==null&&n==null)throw new TypeError("No timeout provided.");return XI.operate(function(b,w){var T,q,M=null,L=0,D=function(N){q=tF.executeSchedule(w,h,function(){try{T.unsubscribe(),JI.innerFrom(c({meta:v,lastValue:M,seen:L})).subscribe(w)}catch(Q){w.error(Q)}},N)};T=b.subscribe(eF.createOperatorSubscriber(w,function(N){q?.unsubscribe(),L++,w.next(M=N),n>0&&D(n)},void 0,void 0,function(){q?.closed||q?.unsubscribe(),M=null})),!L&&D(i!=null?typeof i=="number"?i:+i-h.now():n)})}en.timeout=rF;function iF(r){throw new en.TimeoutError(r)}});var Br=_(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.map=void 0;var nF=z(),oF=U();function aF(r,e){return nF.operate(function(t,i){var n=0;t.subscribe(oF.createOperatorSubscriber(i,function(s){i.next(r.call(e,s,n++))}))})}Fu.map=aF});var pi=_(hi=>{"use strict";var sF=hi&&hi.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},uF=hi&&hi.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";var pF=di&&di.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},P_=di&&di.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.bindCallback=void 0;var _F=Hp();function PF(r,e,t){return _F.bindCallbackInternals(!1,r,e,t)}Du.bindCallback=PF});var O_=_(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.bindNodeCallback=void 0;var wF=Hp();function OF(r,e,t){return wF.bindCallbackInternals(!0,r,e,t)}ku.bindNodeCallback=OF});var $p=_(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.argsArgArrayOrObject=void 0;var SF=Array.isArray,TF=Object.getPrototypeOf,AF=Object.prototype,EF=Object.keys;function qF(r){if(r.length===1){var e=r[0];if(SF(e))return{args:e,keys:null};if(CF(e)){var t=EF(e);return{args:t.map(function(i){return e[i]}),keys:t}}}return{args:r,keys:null}}Ru.argsArgArrayOrObject=qF;function CF(r){return r&&typeof r=="object"&&TF(r)===AF}});var Qp=_(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.createObject=void 0;function MF(r,e){return r.reduce(function(t,i,n){return t[i]=e[n],t},{})}zu.createObject=MF});var Nu=_(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.combineLatestInit=eo.combineLatest=void 0;var xF=he(),LF=$p(),A_=Wr(),E_=Ye(),jF=pi(),S_=wt(),IF=Qp(),FF=U(),DF=Vr();function kF(){for(var r=[],e=0;e{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.mergeInternals=void 0;var RF=X(),zF=Vr(),C_=U();function NF(r,e,t,i,n,s,c,l){var h=[],p=0,v=0,b=!1,w=function(){b&&!h.length&&!p&&e.complete()},T=function(M){return p{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.mergeMap=void 0;var VF=Br(),WF=X(),UF=z(),BF=Wu(),GF=le();function M_(r,e,t){return t===void 0&&(t=1/0),GF.isFunction(e)?M_(function(i,n){return VF.map(function(s,c){return e(i,s,n,c)})(WF.innerFrom(r(i,n)))},t):(typeof e=="number"&&(t=e),UF.operate(function(i,n){return BF.mergeInternals(i,n,r,t)}))}Uu.mergeMap=M_});var to=_(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.mergeAll=void 0;var HF=vr(),$F=Ye();function QF(r){return r===void 0&&(r=1/0),HF.mergeMap($F.identity,r)}Bu.mergeAll=QF});var ga=_(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.concatAll=void 0;var KF=to();function YF(){return KF.mergeAll(1)}Gu.concatAll=YF});var ba=_(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.concat=void 0;var XF=ga(),JF=wt(),ZF=Wr();function eD(){for(var r=[],e=0;e{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.defer=void 0;var tD=he(),rD=X();function iD(r){return new tD.Observable(function(e){rD.innerFrom(r()).subscribe(e)})}$u.defer=iD});var x_=_(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.connectable=void 0;var nD=Xe(),oD=he(),aD=_a(),sD={connector:function(){return new nD.Subject},resetOnDisconnect:!0};function uD(r,e){e===void 0&&(e=sD);var t=null,i=e.connector,n=e.resetOnDisconnect,s=n===void 0?!0:n,c=i(),l=new oD.Observable(function(h){return c.subscribe(h)});return l.connect=function(){return(!t||t.closed)&&(t=aD.defer(function(){return r}).subscribe(c),s&&t.add(function(){return c=i()})),t},l}Qu.connectable=uD});var L_=_(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.forkJoin=void 0;var cD=he(),lD=$p(),fD=X(),hD=wt(),pD=U(),dD=pi(),vD=Qp();function mD(){for(var r=[],e=0;e{"use strict";var yD=ro&&ro.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s};Object.defineProperty(ro,"__esModule",{value:!0});ro.fromEvent=void 0;var gD=X(),bD=he(),_D=vr(),PD=nu(),tn=le(),wD=pi(),OD=["addListener","removeListener"],SD=["addEventListener","removeEventListener"],TD=["on","off"];function Kp(r,e,t,i){if(tn.isFunction(t)&&(i=t,t=void 0),i)return Kp(r,e,t).pipe(wD.mapOneOrManyArgs(i));var n=yD(qD(r)?SD.map(function(l){return function(h){return r[l](e,h,t)}}):AD(r)?OD.map(j_(r,e)):ED(r)?TD.map(j_(r,e)):[],2),s=n[0],c=n[1];if(!s&&PD.isArrayLike(r))return _D.mergeMap(function(l){return Kp(l,e,t)})(gD.innerFrom(r));if(!s)throw new TypeError("Invalid event target");return new bD.Observable(function(l){var h=function(){for(var p=[],v=0;v{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.fromEventPattern=void 0;var CD=he(),MD=le(),xD=pi();function F_(r,e,t){return t?F_(r,e).pipe(xD.mapOneOrManyArgs(t)):new CD.Observable(function(i){var n=function(){for(var c=[],l=0;l{"use strict";var LD=io&&io.__generator||function(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(p){return function(v){return h([p,v])}}function h(p){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=p[0]&2?n.return:p[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,p[1])).done)return s;switch(n=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,n=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.iif=void 0;var kD=_a();function RD(r,e,t){return kD.defer(function(){return r()?e:t})}Xu.iif=RD});var vi=_(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});Ju.timer=void 0;var zD=he(),ND=Pt(),VD=ma(),WD=Iu();function UD(r,e,t){r===void 0&&(r=0),t===void 0&&(t=ND.async);var i=-1;return e!=null&&(VD.isScheduler(e)?t=e:i=e),new zD.Observable(function(n){var s=WD.isValidDate(r)?+r-t.now():r;s<0&&(s=0);var c=0;return t.schedule(function(){n.closed||(n.next(c++),0<=i?this.schedule(void 0,i):n.complete())},s)})}Ju.timer=UD});var Yp=_(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.interval=void 0;var BD=Pt(),GD=vi();function HD(r,e){return r===void 0&&(r=0),e===void 0&&(e=BD.asyncScheduler),r<0&&(r=0),GD.timer(r,r,e)}Zu.interval=HD});var V_=_(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.merge=void 0;var $D=to(),QD=X(),KD=er(),N_=wt(),YD=Wr();function XD(){for(var r=[],e=0;e{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.never=rn.NEVER=void 0;var JD=he(),ZD=Ke();rn.NEVER=new JD.Observable(ZD.noop);function ek(){return rn.NEVER}rn.never=ek});var mi=_(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});tc.argsOrArgArray=void 0;var tk=Array.isArray;function rk(r){return r.length===1&&tk(r[0])?r[0]:r}tc.argsOrArgArray=rk});var Jp=_(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.onErrorResumeNext=void 0;var ik=he(),nk=mi(),ok=U(),W_=Ke(),ak=X();function sk(){for(var r=[],e=0;e{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.pairs=void 0;var uk=Wr();function ck(r,e){return uk.from(Object.entries(r),e)}ic.pairs=ck});var Zp=_(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.not=void 0;function lk(r,e){return function(t,i){return!r.call(e,t,i)}}nc.not=lk});var Gr=_(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.filter=void 0;var fk=z(),hk=U();function pk(r,e){return fk.operate(function(t,i){var n=0;t.subscribe(hk.createOperatorSubscriber(i,function(s){return r.call(e,s,n++)&&i.next(s)}))})}oc.filter=pk});var H_=_(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.partition=void 0;var dk=Zp(),B_=Gr(),G_=X();function vk(r,e,t){return[B_.filter(e,t)(G_.innerFrom(r)),B_.filter(dk.not(e,t))(G_.innerFrom(r))]}ac.partition=vk});var ed=_(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no.raceInit=no.race=void 0;var mk=he(),$_=X(),yk=mi(),gk=U();function bk(){for(var r=[],e=0;e{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.range=void 0;var _k=he(),Pk=er();function wk(r,e,t){if(e==null&&(e=r,r=0),e<=0)return Pk.EMPTY;var i=e+r;return new _k.Observable(t?function(n){var s=r;return t.schedule(function(){s{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});uc.using=void 0;var Ok=he(),Sk=X(),Tk=er();function Ak(r,e){return new Ok.Observable(function(t){var i=r(),n=e(i),s=n?Sk.innerFrom(n):Tk.EMPTY;return s.subscribe(t),function(){i&&i.unsubscribe()}})}uc.using=Ak});var cc=_(yi=>{"use strict";var Ek=yi&&yi.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},qk=yi&&yi.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";Object.defineProperty(X_,"__esModule",{value:!0})});var fc=_(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.audit=void 0;var Dk=z(),kk=X(),Z_=U();function Rk(r){return Dk.operate(function(e,t){var i=!1,n=null,s=null,c=!1,l=function(){if(s?.unsubscribe(),s=null,i){i=!1;var p=n;n=null,t.next(p)}c&&t.complete()},h=function(){s=null,c&&t.complete()};e.subscribe(Z_.createOperatorSubscriber(t,function(p){i=!0,n=p,s||kk.innerFrom(r(p)).subscribe(s=Z_.createOperatorSubscriber(t,l,h))},function(){c=!0,(!i||!s||s.closed)&&t.complete()}))})}lc.audit=Rk});var td=_(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.auditTime=void 0;var zk=Pt(),Nk=fc(),Vk=vi();function Wk(r,e){return e===void 0&&(e=zk.asyncScheduler),Nk.audit(function(){return Vk.timer(r,e)})}hc.auditTime=Wk});var rd=_(pc=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});pc.buffer=void 0;var Uk=z(),Bk=Ke(),e0=U(),Gk=X();function Hk(r){return Uk.operate(function(e,t){var i=[];return e.subscribe(e0.createOperatorSubscriber(t,function(n){return i.push(n)},function(){t.next(i),t.complete()})),Gk.innerFrom(r).subscribe(e0.createOperatorSubscriber(t,function(){var n=i;i=[],t.next(n)},Bk.noop)),function(){i=null}})}pc.buffer=Hk});var nd=_(oo=>{"use strict";var id=oo&&oo.__values||function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(oo,"__esModule",{value:!0});oo.bufferCount=void 0;var $k=z(),Qk=U(),Kk=Nr();function Yk(r,e){return e===void 0&&(e=null),e=e??r,$k.operate(function(t,i){var n=[],s=0;t.subscribe(Qk.createOperatorSubscriber(i,function(c){var l,h,p,v,b=null;s++%e===0&&n.push([]);try{for(var w=id(n),T=w.next();!T.done;T=w.next()){var q=T.value;q.push(c),r<=q.length&&(b=b??[],b.push(q))}}catch(D){l={error:D}}finally{try{T&&!T.done&&(h=w.return)&&h.call(w)}finally{if(l)throw l.error}}if(b)try{for(var M=id(b),L=M.next();!L.done;L=M.next()){var q=L.value;Kk.arrRemove(n,q),i.next(q)}}catch(D){p={error:D}}finally{try{L&&!L.done&&(v=M.return)&&v.call(M)}finally{if(p)throw p.error}}},function(){var c,l;try{for(var h=id(n),p=h.next();!p.done;p=h.next()){var v=p.value;i.next(v)}}catch(b){c={error:b}}finally{try{p&&!p.done&&(l=h.return)&&l.call(h)}finally{if(c)throw c.error}}i.complete()},void 0,function(){n=null}))})}oo.bufferCount=Yk});var od=_(ao=>{"use strict";var Xk=ao&&ao.__values||function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(ao,"__esModule",{value:!0});ao.bufferTime=void 0;var Jk=xt(),Zk=z(),eR=U(),tR=Nr(),rR=Pt(),iR=wt(),t0=Vr();function nR(r){for(var e,t,i=[],n=1;n=0?t0.executeSchedule(p,s,T,c,!0):b=!0,T();var q=eR.createOperatorSubscriber(p,function(M){var L,D,N=v.slice();try{for(var Q=Xk(N),ie=Q.next();!ie.done;ie=Q.next()){var pe=ie.value,Fe=pe.buffer;Fe.push(M),l<=Fe.length&&w(pe)}}catch(pt){L={error:pt}}finally{try{ie&&!ie.done&&(D=Q.return)&&D.call(Q)}finally{if(L)throw L.error}}},function(){for(;v?.length;)p.next(v.shift().buffer);q?.unsubscribe(),p.complete(),p.unsubscribe()},void 0,function(){return v=null});h.subscribe(q)})}ao.bufferTime=nR});var sd=_(so=>{"use strict";var oR=so&&so.__values||function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(so,"__esModule",{value:!0});so.bufferToggle=void 0;var aR=xt(),sR=z(),r0=X(),ad=U(),i0=Ke(),uR=Nr();function cR(r,e){return sR.operate(function(t,i){var n=[];r0.innerFrom(r).subscribe(ad.createOperatorSubscriber(i,function(s){var c=[];n.push(c);var l=new aR.Subscription,h=function(){uR.arrRemove(n,c),i.next(c),l.unsubscribe()};l.add(r0.innerFrom(e(s)).subscribe(ad.createOperatorSubscriber(i,h,i0.noop)))},i0.noop)),t.subscribe(ad.createOperatorSubscriber(i,function(s){var c,l;try{for(var h=oR(n),p=h.next();!p.done;p=h.next()){var v=p.value;v.push(s)}}catch(b){c={error:b}}finally{try{p&&!p.done&&(l=h.return)&&l.call(h)}finally{if(c)throw c.error}}},function(){for(;n.length>0;)i.next(n.shift());i.complete()}))})}so.bufferToggle=cR});var ud=_(dc=>{"use strict";Object.defineProperty(dc,"__esModule",{value:!0});dc.bufferWhen=void 0;var lR=z(),fR=Ke(),n0=U(),hR=X();function pR(r){return lR.operate(function(e,t){var i=null,n=null,s=function(){n?.unsubscribe();var c=i;i=[],c&&t.next(c),hR.innerFrom(r()).subscribe(n=n0.createOperatorSubscriber(t,s,fR.noop))};s(),e.subscribe(n0.createOperatorSubscriber(t,function(c){return i?.push(c)},function(){i&&t.next(i),t.complete()},void 0,function(){return i=n=null}))})}dc.bufferWhen=pR});var cd=_(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});vc.catchError=void 0;var dR=X(),vR=U(),mR=z();function o0(r){return mR.operate(function(e,t){var i=null,n=!1,s;i=e.subscribe(vR.createOperatorSubscriber(t,void 0,void 0,function(c){s=dR.innerFrom(r(c,o0(r)(e))),i?(i.unsubscribe(),i=null,s.subscribe(t)):n=!0})),n&&(i.unsubscribe(),i=null,s.subscribe(t))})}vc.catchError=o0});var ld=_(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.scanInternals=void 0;var yR=U();function gR(r,e,t,i,n){return function(s,c){var l=t,h=e,p=0;s.subscribe(yR.createOperatorSubscriber(c,function(v){var b=p++;h=l?r(h,v,b):(l=!0,v),i&&c.next(h)},n&&function(){l&&c.next(h),c.complete()}))}}mc.scanInternals=gR});var nn=_(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});yc.reduce=void 0;var bR=ld(),_R=z();function PR(r,e){return _R.operate(bR.scanInternals(r,e,arguments.length>=2,!1,!0))}yc.reduce=PR});var bc=_(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.toArray=void 0;var wR=nn(),OR=z(),SR=function(r,e){return r.push(e),r};function TR(){return OR.operate(function(r,e){wR.reduce(SR,[])(r).subscribe(e)})}gc.toArray=TR});var fd=_(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});_c.joinAllInternals=void 0;var AR=Ye(),ER=pi(),qR=ha(),CR=vr(),MR=bc();function xR(r,e){return qR.pipe(MR.toArray(),CR.mergeMap(function(t){return r(t)}),e?ER.mapOneOrManyArgs(e):AR.identity)}_c.joinAllInternals=xR});var wc=_(Pc=>{"use strict";Object.defineProperty(Pc,"__esModule",{value:!0});Pc.combineLatestAll=void 0;var LR=Nu(),jR=fd();function IR(r){return jR.joinAllInternals(LR.combineLatest,r)}Pc.combineLatestAll=IR});var hd=_(Oc=>{"use strict";Object.defineProperty(Oc,"__esModule",{value:!0});Oc.combineAll=void 0;var FR=wc();Oc.combineAll=FR.combineLatestAll});var pd=_(gi=>{"use strict";var a0=gi&&gi.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},s0=gi&&gi.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";var WR=bi&&bi.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},UR=bi&&bi.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});Sc.concatMap=void 0;var c0=vr(),HR=le();function $R(r,e){return HR.isFunction(e)?c0.mergeMap(r,e,1):c0.mergeMap(r,1)}Sc.concatMap=$R});var vd=_(Ac=>{"use strict";Object.defineProperty(Ac,"__esModule",{value:!0});Ac.concatMapTo=void 0;var l0=Tc(),QR=le();function KR(r,e){return QR.isFunction(e)?l0.concatMap(function(){return r},e):l0.concatMap(function(){return r})}Ac.concatMapTo=KR});var md=_(_i=>{"use strict";var YR=_i&&_i.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},XR=_i&&_i.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";var iz=Pi&&Pi.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},nz=Pi&&Pi.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.fromSubscribable=void 0;var sz=he();function uz(r){return new sz.Observable(function(e){return r.subscribe(e)})}Ec.fromSubscribable=uz});var Pa=_(qc=>{"use strict";Object.defineProperty(qc,"__esModule",{value:!0});qc.connect=void 0;var cz=Xe(),lz=X(),fz=z(),hz=f0(),pz={connector:function(){return new cz.Subject}};function dz(r,e){e===void 0&&(e=pz);var t=e.connector;return fz.operate(function(i,n){var s=t();lz.innerFrom(r(hz.fromSubscribable(s))).subscribe(n),n.add(i.subscribe(s))})}qc.connect=dz});var gd=_(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.count=void 0;var vz=nn();function mz(r){return vz.reduce(function(e,t,i){return!r||r(t,i)?e+1:e},0)}Cc.count=mz});var bd=_(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});Mc.debounce=void 0;var yz=z(),gz=Ke(),h0=U(),bz=X();function _z(r){return yz.operate(function(e,t){var i=!1,n=null,s=null,c=function(){if(s?.unsubscribe(),s=null,i){i=!1;var l=n;n=null,t.next(l)}};e.subscribe(h0.createOperatorSubscriber(t,function(l){s?.unsubscribe(),i=!0,n=l,s=h0.createOperatorSubscriber(t,c,gz.noop),bz.innerFrom(r(l)).subscribe(s)},function(){c(),t.complete()},void 0,function(){n=s=null}))})}Mc.debounce=_z});var _d=_(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});xc.debounceTime=void 0;var Pz=Pt(),wz=z(),Oz=U();function Sz(r,e){return e===void 0&&(e=Pz.asyncScheduler),wz.operate(function(t,i){var n=null,s=null,c=null,l=function(){if(n){n.unsubscribe(),n=null;var p=s;s=null,i.next(p)}};function h(){var p=c+r,v=e.now();if(v{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});Lc.defaultIfEmpty=void 0;var Tz=z(),Az=U();function Ez(r){return Tz.operate(function(e,t){var i=!1;e.subscribe(Az.createOperatorSubscriber(t,function(n){i=!0,t.next(n)},function(){i||t.next(r),t.complete()}))})}Lc.defaultIfEmpty=Ez});var co=_(jc=>{"use strict";Object.defineProperty(jc,"__esModule",{value:!0});jc.take=void 0;var qz=er(),Cz=z(),Mz=U();function xz(r){return r<=0?function(){return qz.EMPTY}:Cz.operate(function(e,t){var i=0;e.subscribe(Mz.createOperatorSubscriber(t,function(n){++i<=r&&(t.next(n),r<=i&&t.complete())}))})}jc.take=xz});var Fc=_(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.ignoreElements=void 0;var Lz=z(),jz=U(),Iz=Ke();function Fz(){return Lz.operate(function(r,e){r.subscribe(jz.createOperatorSubscriber(e,Iz.noop))})}Ic.ignoreElements=Fz});var kc=_(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.mapTo=void 0;var Dz=Br();function kz(r){return Dz.map(function(){return r})}Dc.mapTo=kz});var zc=_(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});Rc.delayWhen=void 0;var Rz=ba(),p0=co(),zz=Fc(),Nz=kc(),Vz=vr(),Wz=X();function d0(r,e){return e?function(t){return Rz.concat(e.pipe(p0.take(1),zz.ignoreElements()),t.pipe(d0(r)))}:Vz.mergeMap(function(t,i){return Wz.innerFrom(r(t,i)).pipe(p0.take(1),Nz.mapTo(t))})}Rc.delayWhen=d0});var Pd=_(Nc=>{"use strict";Object.defineProperty(Nc,"__esModule",{value:!0});Nc.delay=void 0;var Uz=Pt(),Bz=zc(),Gz=vi();function Hz(r,e){e===void 0&&(e=Uz.asyncScheduler);var t=Gz.timer(r,e);return Bz.delayWhen(function(){return t})}Nc.delay=Hz});var wd=_(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.dematerialize=void 0;var $z=Tu(),Qz=z(),Kz=U();function Yz(){return Qz.operate(function(r,e){r.subscribe(Kz.createOperatorSubscriber(e,function(t){return $z.observeNotification(t,e)}))})}Vc.dematerialize=Yz});var Od=_(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.distinct=void 0;var Xz=z(),v0=U(),Jz=Ke(),Zz=X();function eN(r,e){return Xz.operate(function(t,i){var n=new Set;t.subscribe(v0.createOperatorSubscriber(i,function(s){var c=r?r(s):s;n.has(c)||(n.add(c),i.next(s))})),e&&Zz.innerFrom(e).subscribe(v0.createOperatorSubscriber(i,function(){return n.clear()},Jz.noop))})}Wc.distinct=eN});var Bc=_(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});Uc.distinctUntilChanged=void 0;var tN=Ye(),rN=z(),iN=U();function nN(r,e){return e===void 0&&(e=tN.identity),r=r??oN,rN.operate(function(t,i){var n,s=!0;t.subscribe(iN.createOperatorSubscriber(i,function(c){var l=e(c);(s||!r(n,l))&&(s=!1,n=l,i.next(c))}))})}Uc.distinctUntilChanged=nN;function oN(r,e){return r===e}});var Sd=_(Gc=>{"use strict";Object.defineProperty(Gc,"__esModule",{value:!0});Gc.distinctUntilKeyChanged=void 0;var aN=Bc();function sN(r,e){return aN.distinctUntilChanged(function(t,i){return e?e(t[r],i[r]):t[r]===i[r]})}Gc.distinctUntilKeyChanged=sN});var lo=_(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});Hc.throwIfEmpty=void 0;var uN=fi(),cN=z(),lN=U();function fN(r){return r===void 0&&(r=hN),cN.operate(function(e,t){var i=!1;e.subscribe(lN.createOperatorSubscriber(t,function(n){i=!0,t.next(n)},function(){return i?t.complete():t.error(r())}))})}Hc.throwIfEmpty=fN;function hN(){return new uN.EmptyError}});var Td=_($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.elementAt=void 0;var m0=Wp(),pN=Gr(),dN=lo(),vN=uo(),mN=co();function yN(r,e){if(r<0)throw new m0.ArgumentOutOfRangeError;var t=arguments.length>=2;return function(i){return i.pipe(pN.filter(function(n,s){return s===r}),mN.take(1),t?vN.defaultIfEmpty(e):dN.throwIfEmpty(function(){return new m0.ArgumentOutOfRangeError}))}}$c.elementAt=yN});var Ad=_(wi=>{"use strict";var gN=wi&&wi.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},bN=wi&&wi.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});Qc.every=void 0;var ON=z(),SN=U();function TN(r,e){return ON.operate(function(t,i){var n=0;t.subscribe(SN.createOperatorSubscriber(i,function(s){r.call(e,s,n++,t)||(i.next(!1),i.complete())},function(){i.next(!0),i.complete()}))})}Qc.every=TN});var Yc=_(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.exhaustMap=void 0;var AN=Br(),y0=X(),EN=z(),g0=U();function b0(r,e){return e?function(t){return t.pipe(b0(function(i,n){return y0.innerFrom(r(i,n)).pipe(AN.map(function(s,c){return e(i,s,n,c)}))}))}:EN.operate(function(t,i){var n=0,s=null,c=!1;t.subscribe(g0.createOperatorSubscriber(i,function(l){s||(s=g0.createOperatorSubscriber(i,void 0,function(){s=null,c&&i.complete()}),y0.innerFrom(r(l,n++)).subscribe(s))},function(){c=!0,!s&&i.complete()}))})}Kc.exhaustMap=b0});var Jc=_(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc.exhaustAll=void 0;var qN=Yc(),CN=Ye();function MN(){return qN.exhaustMap(CN.identity)}Xc.exhaustAll=MN});var qd=_(Zc=>{"use strict";Object.defineProperty(Zc,"__esModule",{value:!0});Zc.exhaust=void 0;var xN=Jc();Zc.exhaust=xN.exhaustAll});var Cd=_(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.expand=void 0;var LN=z(),jN=Wu();function IN(r,e,t){return e===void 0&&(e=1/0),e=(e||0)<1?1/0:e,LN.operate(function(i,n){return jN.mergeInternals(i,n,r,e,void 0,!0,t)})}el.expand=IN});var Md=_(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.finalize=void 0;var FN=z();function DN(r){return FN.operate(function(e,t){try{e.subscribe(t)}finally{t.add(r)}})}tl.finalize=DN});var rl=_(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.createFind=fo.find=void 0;var kN=z(),RN=U();function zN(r,e){return kN.operate(_0(r,e,"value"))}fo.find=zN;function _0(r,e,t){var i=t==="index";return function(n,s){var c=0;n.subscribe(RN.createOperatorSubscriber(s,function(l){var h=c++;r.call(e,l,h,n)&&(s.next(i?h:l),s.complete())},function(){s.next(i?-1:void 0),s.complete()}))}}fo.createFind=_0});var xd=_(il=>{"use strict";Object.defineProperty(il,"__esModule",{value:!0});il.findIndex=void 0;var NN=z(),VN=rl();function WN(r,e){return NN.operate(VN.createFind(r,e,"index"))}il.findIndex=WN});var Ld=_(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.first=void 0;var UN=fi(),BN=Gr(),GN=co(),HN=uo(),$N=lo(),QN=Ye();function KN(r,e){var t=arguments.length>=2;return function(i){return i.pipe(r?BN.filter(function(n,s){return r(n,s,i)}):QN.identity,GN.take(1),t?HN.defaultIfEmpty(e):$N.throwIfEmpty(function(){return new UN.EmptyError}))}}nl.first=KN});var jd=_(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.groupBy=void 0;var YN=he(),XN=X(),JN=Xe(),ZN=z(),P0=U();function eV(r,e,t,i){return ZN.operate(function(n,s){var c;!e||typeof e=="function"?c=e:(t=e.duration,c=e.element,i=e.connector);var l=new Map,h=function(q){l.forEach(q),q(s)},p=function(q){return h(function(M){return M.error(q)})},v=0,b=!1,w=new P0.OperatorSubscriber(s,function(q){try{var M=r(q),L=l.get(M);if(!L){l.set(M,L=i?i():new JN.Subject);var D=T(M,L);if(s.next(D),t){var N=P0.createOperatorSubscriber(L,function(){L.complete(),N?.unsubscribe()},void 0,void 0,function(){return l.delete(M)});w.add(XN.innerFrom(t(D)).subscribe(N))}}L.next(c?c(q):q)}catch(Q){p(Q)}},function(){return h(function(q){return q.complete()})},p,function(){return l.clear()},function(){return b=!0,v===0});n.subscribe(w);function T(q,M){var L=new YN.Observable(function(D){v++;var N=M.subscribe(D);return function(){N.unsubscribe(),--v===0&&b&&w.unsubscribe()}});return L.key=q,L}})}ol.groupBy=eV});var Id=_(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.isEmpty=void 0;var tV=z(),rV=U();function iV(){return tV.operate(function(r,e){r.subscribe(rV.createOperatorSubscriber(e,function(){e.next(!1),e.complete()},function(){e.next(!0),e.complete()}))})}al.isEmpty=iV});var sl=_(ho=>{"use strict";var nV=ho&&ho.__values||function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(ho,"__esModule",{value:!0});ho.takeLast=void 0;var oV=er(),aV=z(),sV=U();function uV(r){return r<=0?function(){return oV.EMPTY}:aV.operate(function(e,t){var i=[];e.subscribe(sV.createOperatorSubscriber(t,function(n){i.push(n),r{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul.last=void 0;var cV=fi(),lV=Gr(),fV=sl(),hV=lo(),pV=uo(),dV=Ye();function vV(r,e){var t=arguments.length>=2;return function(i){return i.pipe(r?lV.filter(function(n,s){return r(n,s,i)}):dV.identity,fV.takeLast(1),t?pV.defaultIfEmpty(e):hV.throwIfEmpty(function(){return new cV.EmptyError}))}}ul.last=vV});var kd=_(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});cl.materialize=void 0;var Dd=Tu(),mV=z(),yV=U();function gV(){return mV.operate(function(r,e){r.subscribe(yV.createOperatorSubscriber(e,function(t){e.next(Dd.Notification.createNext(t))},function(){e.next(Dd.Notification.createComplete()),e.complete()},function(t){e.next(Dd.Notification.createError(t)),e.complete()}))})}cl.materialize=gV});var Rd=_(ll=>{"use strict";Object.defineProperty(ll,"__esModule",{value:!0});ll.max=void 0;var bV=nn(),_V=le();function PV(r){return bV.reduce(_V.isFunction(r)?function(e,t){return r(e,t)>0?e:t}:function(e,t){return e>t?e:t})}ll.max=PV});var zd=_(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.flatMap=void 0;var wV=vr();fl.flatMap=wV.mergeMap});var Nd=_(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});hl.mergeMapTo=void 0;var w0=vr(),OV=le();function SV(r,e,t){return t===void 0&&(t=1/0),OV.isFunction(e)?w0.mergeMap(function(){return r},e,t):(typeof e=="number"&&(t=e),w0.mergeMap(function(){return r},t))}hl.mergeMapTo=SV});var Vd=_(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});pl.mergeScan=void 0;var TV=z(),AV=Wu();function EV(r,e,t){return t===void 0&&(t=1/0),TV.operate(function(i,n){var s=e;return AV.mergeInternals(i,n,function(c,l){return r(s,c,l)},t,function(c){s=c},!1,void 0,function(){return s=null})})}pl.mergeScan=EV});var Wd=_(Oi=>{"use strict";var qV=Oi&&Oi.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},CV=Oi&&Oi.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";var FV=Si&&Si.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},DV=Si&&Si.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});dl.min=void 0;var zV=nn(),NV=le();function VV(r){return zV.reduce(NV.isFunction(r)?function(e,t){return r(e,t)<0?e:t}:function(e,t){return e{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.multicast=void 0;var WV=pa(),S0=le(),UV=Pa();function BV(r,e){var t=S0.isFunction(r)?r:function(){return r};return S0.isFunction(e)?UV.connect(e,{connector:t}):function(i){return new WV.ConnectableObservable(i,t)}}vl.multicast=BV});var Gd=_(mr=>{"use strict";var GV=mr&&mr.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},HV=mr&&mr.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";Object.defineProperty(ml,"__esModule",{value:!0});ml.pairwise=void 0;var KV=z(),YV=U();function XV(){return KV.operate(function(r,e){var t,i=!1;r.subscribe(YV.createOperatorSubscriber(e,function(n){var s=t;t=n,i&&e.next([s,n]),i=!0}))})}ml.pairwise=XV});var $d=_(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});yl.pluck=void 0;var JV=Br();function ZV(){for(var r=[],e=0;e{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});gl.publish=void 0;var e2=Xe(),t2=wa(),r2=Pa();function i2(r){return r?function(e){return r2.connect(r)(e)}:function(e){return t2.multicast(new e2.Subject)(e)}}gl.publish=i2});var Kd=_(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.publishBehavior=void 0;var n2=Tp(),o2=pa();function a2(r){return function(e){var t=new n2.BehaviorSubject(r);return new o2.ConnectableObservable(e,function(){return t})}}bl.publishBehavior=a2});var Yd=_(_l=>{"use strict";Object.defineProperty(_l,"__esModule",{value:!0});_l.publishLast=void 0;var s2=Zs(),u2=pa();function c2(){return function(r){var e=new s2.AsyncSubject;return new u2.ConnectableObservable(r,function(){return e})}}_l.publishLast=c2});var Xd=_(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});Pl.publishReplay=void 0;var l2=Js(),f2=wa(),A0=le();function h2(r,e,t,i){t&&!A0.isFunction(t)&&(i=t);var n=A0.isFunction(t)?t:void 0;return function(s){return f2.multicast(new l2.ReplaySubject(r,e,i),n)(s)}}Pl.publishReplay=h2});var wl=_(Ti=>{"use strict";var p2=Ti&&Ti.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},d2=Ti&&Ti.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol.repeat=void 0;var b2=er(),_2=z(),E0=U(),P2=X(),w2=vi();function O2(r){var e,t=1/0,i;return r!=null&&(typeof r=="object"?(e=r.count,t=e===void 0?1/0:e,i=r.delay):t=r),t<=0?function(){return b2.EMPTY}:_2.operate(function(n,s){var c=0,l,h=function(){if(l?.unsubscribe(),l=null,i!=null){var v=typeof i=="number"?w2.timer(i):P2.innerFrom(i(c)),b=E0.createOperatorSubscriber(s,function(){b.unsubscribe(),p()});v.subscribe(b)}else p()},p=function(){var v=!1;l=n.subscribe(E0.createOperatorSubscriber(s,void 0,function(){++c{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});Sl.repeatWhen=void 0;var S2=X(),T2=Xe(),A2=z(),q0=U();function E2(r){return A2.operate(function(e,t){var i,n=!1,s,c=!1,l=!1,h=function(){return l&&c&&(t.complete(),!0)},p=function(){return s||(s=new T2.Subject,S2.innerFrom(r(s)).subscribe(q0.createOperatorSubscriber(t,function(){i?v():n=!0},function(){c=!0,h()}))),s},v=function(){l=!1,i=e.subscribe(q0.createOperatorSubscriber(t,void 0,function(){l=!0,!h()&&p().next()})),n&&(i.unsubscribe(),i=null,n=!1,v())};v()})}Sl.repeatWhen=E2});var ev=_(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.retry=void 0;var q2=z(),C0=U(),C2=Ye(),M2=vi(),x2=X();function L2(r){r===void 0&&(r=1/0);var e;r&&typeof r=="object"?e=r:e={count:r};var t=e.count,i=t===void 0?1/0:t,n=e.delay,s=e.resetOnSuccess,c=s===void 0?!1:s;return i<=0?C2.identity:q2.operate(function(l,h){var p=0,v,b=function(){var w=!1;v=l.subscribe(C0.createOperatorSubscriber(h,function(T){c&&(p=0),h.next(T)},void 0,function(T){if(p++{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.retryWhen=void 0;var j2=X(),I2=Xe(),F2=z(),M0=U();function D2(r){return F2.operate(function(e,t){var i,n=!1,s,c=function(){i=e.subscribe(M0.createOperatorSubscriber(t,void 0,void 0,function(l){s||(s=new I2.Subject,j2.innerFrom(r(s)).subscribe(M0.createOperatorSubscriber(t,function(){return i?c():n=!0}))),s&&s.next(l)})),n&&(i.unsubscribe(),i=null,n=!1,c())};c()})}Al.retryWhen=D2});var ql=_(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.sample=void 0;var k2=X(),R2=z(),z2=Ke(),x0=U();function N2(r){return R2.operate(function(e,t){var i=!1,n=null;e.subscribe(x0.createOperatorSubscriber(t,function(s){i=!0,n=s})),k2.innerFrom(r).subscribe(x0.createOperatorSubscriber(t,function(){if(i){i=!1;var s=n;n=null,t.next(s)}},z2.noop))})}El.sample=N2});var rv=_(Cl=>{"use strict";Object.defineProperty(Cl,"__esModule",{value:!0});Cl.sampleTime=void 0;var V2=Pt(),W2=ql(),U2=Yp();function B2(r,e){return e===void 0&&(e=V2.asyncScheduler),W2.sample(U2.interval(r,e))}Cl.sampleTime=B2});var iv=_(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});Ml.scan=void 0;var G2=z(),H2=ld();function $2(r,e){return G2.operate(H2.scanInternals(r,e,arguments.length>=2,!0))}Ml.scan=$2});var nv=_(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});xl.sequenceEqual=void 0;var Q2=z(),K2=U(),Y2=X();function X2(r,e){return e===void 0&&(e=function(t,i){return t===i}),Q2.operate(function(t,i){var n=L0(),s=L0(),c=function(h){i.next(h),i.complete()},l=function(h,p){var v=K2.createOperatorSubscriber(i,function(b){var w=p.buffer,T=p.complete;w.length===0?T?c(!1):h.buffer.push(b):!e(b,w.shift())&&c(!1)},function(){h.complete=!0;var b=p.complete,w=p.buffer;b&&c(w.length===0),v?.unsubscribe()});return v};t.subscribe(l(n,s)),Y2.innerFrom(r).subscribe(l(s,n))})}xl.sequenceEqual=X2;function L0(){return{buffer:[],complete:!1}}});var Ll=_(Ai=>{"use strict";var J2=Ai&&Ai.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},Z2=Ai&&Ai.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t0&&(v=new I0.SafeSubscriber({next:function(Fe){return pe.next(Fe)},error:function(Fe){M=!0,L(),b=ov(D,n,Fe),pe.error(Fe)},complete:function(){q=!0,L(),b=ov(D,c),pe.complete()}}),j0.innerFrom(Q).subscribe(v))})(p)}}Ai.share=rW;function ov(r,e){for(var t=[],i=2;i{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});jl.shareReplay=void 0;var iW=Js(),nW=Ll();function oW(r,e,t){var i,n,s,c,l=!1;return r&&typeof r=="object"?(i=r.bufferSize,c=i===void 0?1/0:i,n=r.windowTime,e=n===void 0?1/0:n,s=r.refCount,l=s===void 0?!1:s,t=r.scheduler):c=r??1/0,nW.share({connector:function(){return new iW.ReplaySubject(c,e,t)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:l})}jl.shareReplay=oW});var sv=_(Il=>{"use strict";Object.defineProperty(Il,"__esModule",{value:!0});Il.single=void 0;var aW=fi(),sW=Bp(),uW=Up(),cW=z(),lW=U();function fW(r){return cW.operate(function(e,t){var i=!1,n,s=!1,c=0;e.subscribe(lW.createOperatorSubscriber(t,function(l){s=!0,(!r||r(l,c++,e))&&(i&&t.error(new sW.SequenceError("Too many matching values")),i=!0,n=l)},function(){i?(t.next(n),t.complete()):t.error(s?new uW.NotFoundError("No matching values"):new aW.EmptyError)}))})}Il.single=fW});var uv=_(Fl=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});Fl.skip=void 0;var hW=Gr();function pW(r){return hW.filter(function(e,t){return r<=t})}Fl.skip=pW});var cv=_(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.skipLast=void 0;var dW=Ye(),vW=z(),mW=U();function yW(r){return r<=0?dW.identity:vW.operate(function(e,t){var i=new Array(r),n=0;return e.subscribe(mW.createOperatorSubscriber(t,function(s){var c=n++;if(c{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.skipUntil=void 0;var gW=z(),F0=U(),bW=X(),_W=Ke();function PW(r){return gW.operate(function(e,t){var i=!1,n=F0.createOperatorSubscriber(t,function(){n?.unsubscribe(),i=!0},_W.noop);bW.innerFrom(r).subscribe(n),e.subscribe(F0.createOperatorSubscriber(t,function(s){return i&&t.next(s)}))})}kl.skipUntil=PW});var fv=_(Rl=>{"use strict";Object.defineProperty(Rl,"__esModule",{value:!0});Rl.skipWhile=void 0;var wW=z(),OW=U();function SW(r){return wW.operate(function(e,t){var i=!1,n=0;e.subscribe(OW.createOperatorSubscriber(t,function(s){return(i||(i=!r(s,n++)))&&t.next(s)}))})}Rl.skipWhile=SW});var hv=_(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});zl.startWith=void 0;var D0=ba(),TW=wt(),AW=z();function EW(){for(var r=[],e=0;e{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.switchMap=void 0;var qW=X(),CW=z(),k0=U();function MW(r,e){return CW.operate(function(t,i){var n=null,s=0,c=!1,l=function(){return c&&!n&&i.complete()};t.subscribe(k0.createOperatorSubscriber(i,function(h){n?.unsubscribe();var p=0,v=s++;qW.innerFrom(r(h,v)).subscribe(n=k0.createOperatorSubscriber(i,function(b){return i.next(e?e(h,b,v,p++):b)},function(){n=null,l()}))},function(){c=!0,l()}))})}Nl.switchMap=MW});var pv=_(Vl=>{"use strict";Object.defineProperty(Vl,"__esModule",{value:!0});Vl.switchAll=void 0;var xW=po(),LW=Ye();function jW(){return xW.switchMap(LW.identity)}Vl.switchAll=jW});var dv=_(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});Wl.switchMapTo=void 0;var R0=po(),IW=le();function FW(r,e){return IW.isFunction(e)?R0.switchMap(function(){return r},e):R0.switchMap(function(){return r})}Wl.switchMapTo=FW});var vv=_(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});Ul.switchScan=void 0;var DW=po(),kW=z();function RW(r,e){return kW.operate(function(t,i){var n=e;return DW.switchMap(function(s,c){return r(n,s,c)},function(s,c){return n=c,c})(t).subscribe(i),function(){n=null}})}Ul.switchScan=RW});var mv=_(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});Bl.takeUntil=void 0;var zW=z(),NW=U(),VW=X(),WW=Ke();function UW(r){return zW.operate(function(e,t){VW.innerFrom(r).subscribe(NW.createOperatorSubscriber(t,function(){return t.complete()},WW.noop)),!t.closed&&e.subscribe(t)})}Bl.takeUntil=UW});var yv=_(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});Gl.takeWhile=void 0;var BW=z(),GW=U();function HW(r,e){return e===void 0&&(e=!1),BW.operate(function(t,i){var n=0;t.subscribe(GW.createOperatorSubscriber(i,function(s){var c=r(s,n++);(c||e)&&i.next(s),!c&&i.complete()}))})}Gl.takeWhile=HW});var gv=_(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});Hl.tap=void 0;var $W=le(),QW=z(),KW=U(),YW=Ye();function XW(r,e,t){var i=$W.isFunction(r)||e||t?{next:r,error:e,complete:t}:r;return i?QW.operate(function(n,s){var c;(c=i.subscribe)===null||c===void 0||c.call(i);var l=!0;n.subscribe(KW.createOperatorSubscriber(s,function(h){var p;(p=i.next)===null||p===void 0||p.call(i,h),s.next(h)},function(){var h;l=!1,(h=i.complete)===null||h===void 0||h.call(i),s.complete()},function(h){var p;l=!1,(p=i.error)===null||p===void 0||p.call(i,h),s.error(h)},function(){var h,p;l&&((h=i.unsubscribe)===null||h===void 0||h.call(i)),(p=i.finalize)===null||p===void 0||p.call(i)}))}):YW.identity}Hl.tap=XW});var Ql=_($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});$l.throttle=void 0;var JW=z(),z0=U(),ZW=X();function eU(r,e){return JW.operate(function(t,i){var n=e??{},s=n.leading,c=s===void 0?!0:s,l=n.trailing,h=l===void 0?!1:l,p=!1,v=null,b=null,w=!1,T=function(){b?.unsubscribe(),b=null,h&&(L(),w&&i.complete())},q=function(){b=null,w&&i.complete()},M=function(D){return b=ZW.innerFrom(r(D)).subscribe(z0.createOperatorSubscriber(i,T,q))},L=function(){if(p){p=!1;var D=v;v=null,i.next(D),!w&&M(D)}};t.subscribe(z0.createOperatorSubscriber(i,function(D){p=!0,v=D,!(b&&!b.closed)&&(c?L():M(D))},function(){w=!0,!(h&&p&&b&&!b.closed)&&i.complete()}))})}$l.throttle=eU});var bv=_(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});Kl.throttleTime=void 0;var tU=Pt(),rU=Ql(),iU=vi();function nU(r,e,t){e===void 0&&(e=tU.asyncScheduler);var i=iU.timer(r,e);return rU.throttle(function(){return i},t)}Kl.throttleTime=nU});var _v=_(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.TimeInterval=vo.timeInterval=void 0;var oU=Pt(),aU=z(),sU=U();function uU(r){return r===void 0&&(r=oU.asyncScheduler),aU.operate(function(e,t){var i=r.now();e.subscribe(sU.createOperatorSubscriber(t,function(n){var s=r.now(),c=s-i;i=s,t.next(new N0(n,c))}))})}vo.timeInterval=uU;var N0=function(){function r(e,t){this.value=e,this.interval=t}return r}();vo.TimeInterval=N0});var Pv=_(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});Yl.timeoutWith=void 0;var cU=Pt(),lU=Iu(),fU=ya();function hU(r,e,t){var i,n,s;if(t=t??cU.async,lU.isValidDate(r)?i=r:typeof r=="number"&&(n=r),e)s=function(){return e};else throw new TypeError("No observable provided to switch to");if(i==null&&n==null)throw new TypeError("No timeout provided.");return fU.timeout({first:i,each:n,scheduler:t,with:s})}Yl.timeoutWith=hU});var wv=_(Xl=>{"use strict";Object.defineProperty(Xl,"__esModule",{value:!0});Xl.timestamp=void 0;var pU=Xs(),dU=Br();function vU(r){return r===void 0&&(r=pU.dateTimestampProvider),dU.map(function(e){return{value:e,timestamp:r.now()}})}Xl.timestamp=vU});var Ov=_(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});Jl.window=void 0;var V0=Xe(),mU=z(),W0=U(),yU=Ke(),gU=X();function bU(r){return mU.operate(function(e,t){var i=new V0.Subject;t.next(i.asObservable());var n=function(s){i.error(s),t.error(s)};return e.subscribe(W0.createOperatorSubscriber(t,function(s){return i?.next(s)},function(){i.complete(),t.complete()},n)),gU.innerFrom(r).subscribe(W0.createOperatorSubscriber(t,function(){i.complete(),t.next(i=new V0.Subject)},yU.noop,n)),function(){i?.unsubscribe(),i=null}})}Jl.window=bU});var Sv=_(mo=>{"use strict";var _U=mo&&mo.__values||function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(mo,"__esModule",{value:!0});mo.windowCount=void 0;var U0=Xe(),PU=z(),wU=U();function OU(r,e){e===void 0&&(e=0);var t=e>0?e:r;return PU.operate(function(i,n){var s=[new U0.Subject],c=[],l=0;n.next(s[0].asObservable()),i.subscribe(wU.createOperatorSubscriber(n,function(h){var p,v;try{for(var b=_U(s),w=b.next();!w.done;w=b.next()){var T=w.value;T.next(h)}}catch(L){p={error:L}}finally{try{w&&!w.done&&(v=b.return)&&v.call(b)}finally{if(p)throw p.error}}var q=l-r+1;if(q>=0&&q%t===0&&s.shift().complete(),++l%t===0){var M=new U0.Subject;s.push(M),n.next(M.asObservable())}},function(){for(;s.length>0;)s.shift().complete();n.complete()},function(h){for(;s.length>0;)s.shift().error(h);n.error(h)},function(){c=null,s=null}))})}mo.windowCount=OU});var Tv=_(Zl=>{"use strict";Object.defineProperty(Zl,"__esModule",{value:!0});Zl.windowTime=void 0;var SU=Xe(),TU=Pt(),AU=xt(),EU=z(),qU=U(),CU=Nr(),MU=wt(),B0=Vr();function xU(r){for(var e,t,i=[],n=1;n=0?B0.executeSchedule(p,s,T,c,!0):b=!0,T();var q=function(L){return v.slice().forEach(L)},M=function(L){q(function(D){var N=D.window;return L(N)}),L(p),p.unsubscribe()};return h.subscribe(qU.createOperatorSubscriber(p,function(L){q(function(D){D.window.next(L),l<=++D.seen&&w(D)})},function(){return M(function(L){return L.complete()})},function(L){return M(function(D){return D.error(L)})})),function(){v=null}})}Zl.windowTime=xU});var Ev=_(yo=>{"use strict";var LU=yo&&yo.__values||function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(yo,"__esModule",{value:!0});yo.windowToggle=void 0;var jU=Xe(),IU=xt(),FU=z(),G0=X(),Av=U(),H0=Ke(),DU=Nr();function kU(r,e){return FU.operate(function(t,i){var n=[],s=function(c){for(;0{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.windowWhen=void 0;var RU=Xe(),zU=z(),$0=U(),NU=X();function VU(r){return zU.operate(function(e,t){var i,n,s=function(l){i.error(l),t.error(l)},c=function(){n?.unsubscribe(),i?.complete(),i=new RU.Subject,t.next(i.asObservable());var l;try{l=NU.innerFrom(r())}catch(h){s(h);return}l.subscribe(n=$0.createOperatorSubscriber(t,c,c,s))};c(),e.subscribe($0.createOperatorSubscriber(t,function(l){return i.next(l)},function(){i.complete(),t.complete()},s,function(){n?.unsubscribe(),i=null}))})}ef.windowWhen=VU});var Cv=_(Ei=>{"use strict";var Q0=Ei&&Ei.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},K0=Ei&&Ei.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.zipAll=void 0;var QU=cc(),KU=fd();function YU(r){return KU.joinAllInternals(QU.zip,r)}tf.zipAll=YU});var xv=_(qi=>{"use strict";var XU=qi&&qi.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},JU=qi&&qi.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";var rB=Ci&&Ci.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},iB=Ci&&Ci.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";var aB=m&&m.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),sB=m&&m.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&aB(e,r,t)};Object.defineProperty(m,"__esModule",{value:!0});m.interval=m.iif=m.generate=m.fromEventPattern=m.fromEvent=m.from=m.forkJoin=m.empty=m.defer=m.connectable=m.concat=m.combineLatest=m.bindNodeCallback=m.bindCallback=m.UnsubscriptionError=m.TimeoutError=m.SequenceError=m.ObjectUnsubscribedError=m.NotFoundError=m.EmptyError=m.ArgumentOutOfRangeError=m.firstValueFrom=m.lastValueFrom=m.isObservable=m.identity=m.noop=m.pipe=m.NotificationKind=m.Notification=m.Subscriber=m.Subscription=m.Scheduler=m.VirtualAction=m.VirtualTimeScheduler=m.animationFrameScheduler=m.animationFrame=m.queueScheduler=m.queue=m.asyncScheduler=m.async=m.asapScheduler=m.asap=m.AsyncSubject=m.ReplaySubject=m.BehaviorSubject=m.Subject=m.animationFrames=m.observable=m.ConnectableObservable=m.Observable=void 0;m.filter=m.expand=m.exhaustMap=m.exhaustAll=m.exhaust=m.every=m.endWith=m.elementAt=m.distinctUntilKeyChanged=m.distinctUntilChanged=m.distinct=m.dematerialize=m.delayWhen=m.delay=m.defaultIfEmpty=m.debounceTime=m.debounce=m.count=m.connect=m.concatWith=m.concatMapTo=m.concatMap=m.concatAll=m.combineLatestWith=m.combineLatestAll=m.combineAll=m.catchError=m.bufferWhen=m.bufferToggle=m.bufferTime=m.bufferCount=m.buffer=m.auditTime=m.audit=m.config=m.NEVER=m.EMPTY=m.scheduled=m.zip=m.using=m.timer=m.throwError=m.range=m.race=m.partition=m.pairs=m.onErrorResumeNext=m.of=m.never=m.merge=void 0;m.switchMap=m.switchAll=m.subscribeOn=m.startWith=m.skipWhile=m.skipUntil=m.skipLast=m.skip=m.single=m.shareReplay=m.share=m.sequenceEqual=m.scan=m.sampleTime=m.sample=m.refCount=m.retryWhen=m.retry=m.repeatWhen=m.repeat=m.reduce=m.raceWith=m.publishReplay=m.publishLast=m.publishBehavior=m.publish=m.pluck=m.pairwise=m.onErrorResumeNextWith=m.observeOn=m.multicast=m.min=m.mergeWith=m.mergeScan=m.mergeMapTo=m.mergeMap=m.flatMap=m.mergeAll=m.max=m.materialize=m.mapTo=m.map=m.last=m.isEmpty=m.ignoreElements=m.groupBy=m.first=m.findIndex=m.find=m.finalize=void 0;m.zipWith=m.zipAll=m.withLatestFrom=m.windowWhen=m.windowToggle=m.windowTime=m.windowCount=m.window=m.toArray=m.timestamp=m.timeoutWith=m.timeout=m.timeInterval=m.throwIfEmpty=m.throttleTime=m.throttle=m.tap=m.takeWhile=m.takeUntil=m.takeLast=m.take=m.switchScan=m.switchMapTo=void 0;var uB=he();Object.defineProperty(m,"Observable",{enumerable:!0,get:function(){return uB.Observable}});var cB=pa();Object.defineProperty(m,"ConnectableObservable",{enumerable:!0,get:function(){return cB.ConnectableObservable}});var lB=fa();Object.defineProperty(m,"observable",{enumerable:!0,get:function(){return lB.observable}});var fB=qb();Object.defineProperty(m,"animationFrames",{enumerable:!0,get:function(){return fB.animationFrames}});var hB=Xe();Object.defineProperty(m,"Subject",{enumerable:!0,get:function(){return hB.Subject}});var pB=Tp();Object.defineProperty(m,"BehaviorSubject",{enumerable:!0,get:function(){return pB.BehaviorSubject}});var dB=Js();Object.defineProperty(m,"ReplaySubject",{enumerable:!0,get:function(){return dB.ReplaySubject}});var vB=Zs();Object.defineProperty(m,"AsyncSubject",{enumerable:!0,get:function(){return vB.AsyncSubject}});var X0=Gb();Object.defineProperty(m,"asap",{enumerable:!0,get:function(){return X0.asap}});Object.defineProperty(m,"asapScheduler",{enumerable:!0,get:function(){return X0.asapScheduler}});var J0=Pt();Object.defineProperty(m,"async",{enumerable:!0,get:function(){return J0.async}});Object.defineProperty(m,"asyncScheduler",{enumerable:!0,get:function(){return J0.asyncScheduler}});var Z0=Qb();Object.defineProperty(m,"queue",{enumerable:!0,get:function(){return Z0.queue}});Object.defineProperty(m,"queueScheduler",{enumerable:!0,get:function(){return Z0.queueScheduler}});var eP=Jb();Object.defineProperty(m,"animationFrame",{enumerable:!0,get:function(){return eP.animationFrame}});Object.defineProperty(m,"animationFrameScheduler",{enumerable:!0,get:function(){return eP.animationFrameScheduler}});var tP=t_();Object.defineProperty(m,"VirtualTimeScheduler",{enumerable:!0,get:function(){return tP.VirtualTimeScheduler}});Object.defineProperty(m,"VirtualAction",{enumerable:!0,get:function(){return tP.VirtualAction}});var mB=Ep();Object.defineProperty(m,"Scheduler",{enumerable:!0,get:function(){return mB.Scheduler}});var yB=xt();Object.defineProperty(m,"Subscription",{enumerable:!0,get:function(){return yB.Subscription}});var gB=Mn();Object.defineProperty(m,"Subscriber",{enumerable:!0,get:function(){return gB.Subscriber}});var rP=Tu();Object.defineProperty(m,"Notification",{enumerable:!0,get:function(){return rP.Notification}});Object.defineProperty(m,"NotificationKind",{enumerable:!0,get:function(){return rP.NotificationKind}});var bB=ha();Object.defineProperty(m,"pipe",{enumerable:!0,get:function(){return bB.pipe}});var _B=Ke();Object.defineProperty(m,"noop",{enumerable:!0,get:function(){return _B.noop}});var PB=Ye();Object.defineProperty(m,"identity",{enumerable:!0,get:function(){return PB.identity}});var wB=g_();Object.defineProperty(m,"isObservable",{enumerable:!0,get:function(){return wB.isObservable}});var OB=b_();Object.defineProperty(m,"lastValueFrom",{enumerable:!0,get:function(){return OB.lastValueFrom}});var SB=__();Object.defineProperty(m,"firstValueFrom",{enumerable:!0,get:function(){return SB.firstValueFrom}});var TB=Wp();Object.defineProperty(m,"ArgumentOutOfRangeError",{enumerable:!0,get:function(){return TB.ArgumentOutOfRangeError}});var AB=fi();Object.defineProperty(m,"EmptyError",{enumerable:!0,get:function(){return AB.EmptyError}});var EB=Up();Object.defineProperty(m,"NotFoundError",{enumerable:!0,get:function(){return EB.NotFoundError}});var qB=Pp();Object.defineProperty(m,"ObjectUnsubscribedError",{enumerable:!0,get:function(){return qB.ObjectUnsubscribedError}});var CB=Bp();Object.defineProperty(m,"SequenceError",{enumerable:!0,get:function(){return CB.SequenceError}});var MB=ya();Object.defineProperty(m,"TimeoutError",{enumerable:!0,get:function(){return MB.TimeoutError}});var xB=cp();Object.defineProperty(m,"UnsubscriptionError",{enumerable:!0,get:function(){return xB.UnsubscriptionError}});var LB=w_();Object.defineProperty(m,"bindCallback",{enumerable:!0,get:function(){return LB.bindCallback}});var jB=O_();Object.defineProperty(m,"bindNodeCallback",{enumerable:!0,get:function(){return jB.bindNodeCallback}});var IB=Nu();Object.defineProperty(m,"combineLatest",{enumerable:!0,get:function(){return IB.combineLatest}});var FB=ba();Object.defineProperty(m,"concat",{enumerable:!0,get:function(){return FB.concat}});var DB=x_();Object.defineProperty(m,"connectable",{enumerable:!0,get:function(){return DB.connectable}});var kB=_a();Object.defineProperty(m,"defer",{enumerable:!0,get:function(){return kB.defer}});var RB=er();Object.defineProperty(m,"empty",{enumerable:!0,get:function(){return RB.empty}});var zB=L_();Object.defineProperty(m,"forkJoin",{enumerable:!0,get:function(){return zB.forkJoin}});var NB=Wr();Object.defineProperty(m,"from",{enumerable:!0,get:function(){return NB.from}});var VB=I_();Object.defineProperty(m,"fromEvent",{enumerable:!0,get:function(){return VB.fromEvent}});var WB=D_();Object.defineProperty(m,"fromEventPattern",{enumerable:!0,get:function(){return WB.fromEventPattern}});var UB=R_();Object.defineProperty(m,"generate",{enumerable:!0,get:function(){return UB.generate}});var BB=z_();Object.defineProperty(m,"iif",{enumerable:!0,get:function(){return BB.iif}});var GB=Yp();Object.defineProperty(m,"interval",{enumerable:!0,get:function(){return GB.interval}});var HB=V_();Object.defineProperty(m,"merge",{enumerable:!0,get:function(){return HB.merge}});var $B=Xp();Object.defineProperty(m,"never",{enumerable:!0,get:function(){return $B.never}});var QB=Ou();Object.defineProperty(m,"of",{enumerable:!0,get:function(){return QB.of}});var KB=Jp();Object.defineProperty(m,"onErrorResumeNext",{enumerable:!0,get:function(){return KB.onErrorResumeNext}});var YB=U_();Object.defineProperty(m,"pairs",{enumerable:!0,get:function(){return YB.pairs}});var XB=H_();Object.defineProperty(m,"partition",{enumerable:!0,get:function(){return XB.partition}});var JB=ed();Object.defineProperty(m,"race",{enumerable:!0,get:function(){return JB.race}});var ZB=K_();Object.defineProperty(m,"range",{enumerable:!0,get:function(){return ZB.range}});var eG=Vp();Object.defineProperty(m,"throwError",{enumerable:!0,get:function(){return eG.throwError}});var tG=vi();Object.defineProperty(m,"timer",{enumerable:!0,get:function(){return tG.timer}});var rG=Y_();Object.defineProperty(m,"using",{enumerable:!0,get:function(){return rG.using}});var iG=cc();Object.defineProperty(m,"zip",{enumerable:!0,get:function(){return iG.zip}});var nG=Np();Object.defineProperty(m,"scheduled",{enumerable:!0,get:function(){return nG.scheduled}});var oG=er();Object.defineProperty(m,"EMPTY",{enumerable:!0,get:function(){return oG.EMPTY}});var aG=Xp();Object.defineProperty(m,"NEVER",{enumerable:!0,get:function(){return aG.NEVER}});sB(J_(),m);var sG=qn();Object.defineProperty(m,"config",{enumerable:!0,get:function(){return sG.config}});var uG=fc();Object.defineProperty(m,"audit",{enumerable:!0,get:function(){return uG.audit}});var cG=td();Object.defineProperty(m,"auditTime",{enumerable:!0,get:function(){return cG.auditTime}});var lG=rd();Object.defineProperty(m,"buffer",{enumerable:!0,get:function(){return lG.buffer}});var fG=nd();Object.defineProperty(m,"bufferCount",{enumerable:!0,get:function(){return fG.bufferCount}});var hG=od();Object.defineProperty(m,"bufferTime",{enumerable:!0,get:function(){return hG.bufferTime}});var pG=sd();Object.defineProperty(m,"bufferToggle",{enumerable:!0,get:function(){return pG.bufferToggle}});var dG=ud();Object.defineProperty(m,"bufferWhen",{enumerable:!0,get:function(){return dG.bufferWhen}});var vG=cd();Object.defineProperty(m,"catchError",{enumerable:!0,get:function(){return vG.catchError}});var mG=hd();Object.defineProperty(m,"combineAll",{enumerable:!0,get:function(){return mG.combineAll}});var yG=wc();Object.defineProperty(m,"combineLatestAll",{enumerable:!0,get:function(){return yG.combineLatestAll}});var gG=dd();Object.defineProperty(m,"combineLatestWith",{enumerable:!0,get:function(){return gG.combineLatestWith}});var bG=ga();Object.defineProperty(m,"concatAll",{enumerable:!0,get:function(){return bG.concatAll}});var _G=Tc();Object.defineProperty(m,"concatMap",{enumerable:!0,get:function(){return _G.concatMap}});var PG=vd();Object.defineProperty(m,"concatMapTo",{enumerable:!0,get:function(){return PG.concatMapTo}});var wG=yd();Object.defineProperty(m,"concatWith",{enumerable:!0,get:function(){return wG.concatWith}});var OG=Pa();Object.defineProperty(m,"connect",{enumerable:!0,get:function(){return OG.connect}});var SG=gd();Object.defineProperty(m,"count",{enumerable:!0,get:function(){return SG.count}});var TG=bd();Object.defineProperty(m,"debounce",{enumerable:!0,get:function(){return TG.debounce}});var AG=_d();Object.defineProperty(m,"debounceTime",{enumerable:!0,get:function(){return AG.debounceTime}});var EG=uo();Object.defineProperty(m,"defaultIfEmpty",{enumerable:!0,get:function(){return EG.defaultIfEmpty}});var qG=Pd();Object.defineProperty(m,"delay",{enumerable:!0,get:function(){return qG.delay}});var CG=zc();Object.defineProperty(m,"delayWhen",{enumerable:!0,get:function(){return CG.delayWhen}});var MG=wd();Object.defineProperty(m,"dematerialize",{enumerable:!0,get:function(){return MG.dematerialize}});var xG=Od();Object.defineProperty(m,"distinct",{enumerable:!0,get:function(){return xG.distinct}});var LG=Bc();Object.defineProperty(m,"distinctUntilChanged",{enumerable:!0,get:function(){return LG.distinctUntilChanged}});var jG=Sd();Object.defineProperty(m,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return jG.distinctUntilKeyChanged}});var IG=Td();Object.defineProperty(m,"elementAt",{enumerable:!0,get:function(){return IG.elementAt}});var FG=Ad();Object.defineProperty(m,"endWith",{enumerable:!0,get:function(){return FG.endWith}});var DG=Ed();Object.defineProperty(m,"every",{enumerable:!0,get:function(){return DG.every}});var kG=qd();Object.defineProperty(m,"exhaust",{enumerable:!0,get:function(){return kG.exhaust}});var RG=Jc();Object.defineProperty(m,"exhaustAll",{enumerable:!0,get:function(){return RG.exhaustAll}});var zG=Yc();Object.defineProperty(m,"exhaustMap",{enumerable:!0,get:function(){return zG.exhaustMap}});var NG=Cd();Object.defineProperty(m,"expand",{enumerable:!0,get:function(){return NG.expand}});var VG=Gr();Object.defineProperty(m,"filter",{enumerable:!0,get:function(){return VG.filter}});var WG=Md();Object.defineProperty(m,"finalize",{enumerable:!0,get:function(){return WG.finalize}});var UG=rl();Object.defineProperty(m,"find",{enumerable:!0,get:function(){return UG.find}});var BG=xd();Object.defineProperty(m,"findIndex",{enumerable:!0,get:function(){return BG.findIndex}});var GG=Ld();Object.defineProperty(m,"first",{enumerable:!0,get:function(){return GG.first}});var HG=jd();Object.defineProperty(m,"groupBy",{enumerable:!0,get:function(){return HG.groupBy}});var $G=Fc();Object.defineProperty(m,"ignoreElements",{enumerable:!0,get:function(){return $G.ignoreElements}});var QG=Id();Object.defineProperty(m,"isEmpty",{enumerable:!0,get:function(){return QG.isEmpty}});var KG=Fd();Object.defineProperty(m,"last",{enumerable:!0,get:function(){return KG.last}});var YG=Br();Object.defineProperty(m,"map",{enumerable:!0,get:function(){return YG.map}});var XG=kc();Object.defineProperty(m,"mapTo",{enumerable:!0,get:function(){return XG.mapTo}});var JG=kd();Object.defineProperty(m,"materialize",{enumerable:!0,get:function(){return JG.materialize}});var ZG=Rd();Object.defineProperty(m,"max",{enumerable:!0,get:function(){return ZG.max}});var eH=to();Object.defineProperty(m,"mergeAll",{enumerable:!0,get:function(){return eH.mergeAll}});var tH=zd();Object.defineProperty(m,"flatMap",{enumerable:!0,get:function(){return tH.flatMap}});var rH=vr();Object.defineProperty(m,"mergeMap",{enumerable:!0,get:function(){return rH.mergeMap}});var iH=Nd();Object.defineProperty(m,"mergeMapTo",{enumerable:!0,get:function(){return iH.mergeMapTo}});var nH=Vd();Object.defineProperty(m,"mergeScan",{enumerable:!0,get:function(){return nH.mergeScan}});var oH=Ud();Object.defineProperty(m,"mergeWith",{enumerable:!0,get:function(){return oH.mergeWith}});var aH=Bd();Object.defineProperty(m,"min",{enumerable:!0,get:function(){return aH.min}});var sH=wa();Object.defineProperty(m,"multicast",{enumerable:!0,get:function(){return sH.multicast}});var uH=Jn();Object.defineProperty(m,"observeOn",{enumerable:!0,get:function(){return uH.observeOn}});var cH=Gd();Object.defineProperty(m,"onErrorResumeNextWith",{enumerable:!0,get:function(){return cH.onErrorResumeNextWith}});var lH=Hd();Object.defineProperty(m,"pairwise",{enumerable:!0,get:function(){return lH.pairwise}});var fH=$d();Object.defineProperty(m,"pluck",{enumerable:!0,get:function(){return fH.pluck}});var hH=Qd();Object.defineProperty(m,"publish",{enumerable:!0,get:function(){return hH.publish}});var pH=Kd();Object.defineProperty(m,"publishBehavior",{enumerable:!0,get:function(){return pH.publishBehavior}});var dH=Yd();Object.defineProperty(m,"publishLast",{enumerable:!0,get:function(){return dH.publishLast}});var vH=Xd();Object.defineProperty(m,"publishReplay",{enumerable:!0,get:function(){return vH.publishReplay}});var mH=wl();Object.defineProperty(m,"raceWith",{enumerable:!0,get:function(){return mH.raceWith}});var yH=nn();Object.defineProperty(m,"reduce",{enumerable:!0,get:function(){return yH.reduce}});var gH=Jd();Object.defineProperty(m,"repeat",{enumerable:!0,get:function(){return gH.repeat}});var bH=Zd();Object.defineProperty(m,"repeatWhen",{enumerable:!0,get:function(){return bH.repeatWhen}});var _H=ev();Object.defineProperty(m,"retry",{enumerable:!0,get:function(){return _H.retry}});var PH=tv();Object.defineProperty(m,"retryWhen",{enumerable:!0,get:function(){return PH.retryWhen}});var wH=Qs();Object.defineProperty(m,"refCount",{enumerable:!0,get:function(){return wH.refCount}});var OH=ql();Object.defineProperty(m,"sample",{enumerable:!0,get:function(){return OH.sample}});var SH=rv();Object.defineProperty(m,"sampleTime",{enumerable:!0,get:function(){return SH.sampleTime}});var TH=iv();Object.defineProperty(m,"scan",{enumerable:!0,get:function(){return TH.scan}});var AH=nv();Object.defineProperty(m,"sequenceEqual",{enumerable:!0,get:function(){return AH.sequenceEqual}});var EH=Ll();Object.defineProperty(m,"share",{enumerable:!0,get:function(){return EH.share}});var qH=av();Object.defineProperty(m,"shareReplay",{enumerable:!0,get:function(){return qH.shareReplay}});var CH=sv();Object.defineProperty(m,"single",{enumerable:!0,get:function(){return CH.single}});var MH=uv();Object.defineProperty(m,"skip",{enumerable:!0,get:function(){return MH.skip}});var xH=cv();Object.defineProperty(m,"skipLast",{enumerable:!0,get:function(){return xH.skipLast}});var LH=lv();Object.defineProperty(m,"skipUntil",{enumerable:!0,get:function(){return LH.skipUntil}});var jH=fv();Object.defineProperty(m,"skipWhile",{enumerable:!0,get:function(){return jH.skipWhile}});var IH=hv();Object.defineProperty(m,"startWith",{enumerable:!0,get:function(){return IH.startWith}});var FH=Zn();Object.defineProperty(m,"subscribeOn",{enumerable:!0,get:function(){return FH.subscribeOn}});var DH=pv();Object.defineProperty(m,"switchAll",{enumerable:!0,get:function(){return DH.switchAll}});var kH=po();Object.defineProperty(m,"switchMap",{enumerable:!0,get:function(){return kH.switchMap}});var RH=dv();Object.defineProperty(m,"switchMapTo",{enumerable:!0,get:function(){return RH.switchMapTo}});var zH=vv();Object.defineProperty(m,"switchScan",{enumerable:!0,get:function(){return zH.switchScan}});var NH=co();Object.defineProperty(m,"take",{enumerable:!0,get:function(){return NH.take}});var VH=sl();Object.defineProperty(m,"takeLast",{enumerable:!0,get:function(){return VH.takeLast}});var WH=mv();Object.defineProperty(m,"takeUntil",{enumerable:!0,get:function(){return WH.takeUntil}});var UH=yv();Object.defineProperty(m,"takeWhile",{enumerable:!0,get:function(){return UH.takeWhile}});var BH=gv();Object.defineProperty(m,"tap",{enumerable:!0,get:function(){return BH.tap}});var GH=Ql();Object.defineProperty(m,"throttle",{enumerable:!0,get:function(){return GH.throttle}});var HH=bv();Object.defineProperty(m,"throttleTime",{enumerable:!0,get:function(){return HH.throttleTime}});var $H=lo();Object.defineProperty(m,"throwIfEmpty",{enumerable:!0,get:function(){return $H.throwIfEmpty}});var QH=_v();Object.defineProperty(m,"timeInterval",{enumerable:!0,get:function(){return QH.timeInterval}});var KH=ya();Object.defineProperty(m,"timeout",{enumerable:!0,get:function(){return KH.timeout}});var YH=Pv();Object.defineProperty(m,"timeoutWith",{enumerable:!0,get:function(){return YH.timeoutWith}});var XH=wv();Object.defineProperty(m,"timestamp",{enumerable:!0,get:function(){return XH.timestamp}});var JH=bc();Object.defineProperty(m,"toArray",{enumerable:!0,get:function(){return JH.toArray}});var ZH=Ov();Object.defineProperty(m,"window",{enumerable:!0,get:function(){return ZH.window}});var e3=Sv();Object.defineProperty(m,"windowCount",{enumerable:!0,get:function(){return e3.windowCount}});var t3=Tv();Object.defineProperty(m,"windowTime",{enumerable:!0,get:function(){return t3.windowTime}});var r3=Ev();Object.defineProperty(m,"windowToggle",{enumerable:!0,get:function(){return r3.windowToggle}});var i3=qv();Object.defineProperty(m,"windowWhen",{enumerable:!0,get:function(){return i3.windowWhen}});var n3=Cv();Object.defineProperty(m,"withLatestFrom",{enumerable:!0,get:function(){return n3.withLatestFrom}});var o3=Mv();Object.defineProperty(m,"zipAll",{enumerable:!0,get:function(){return o3.zipAll}});var a3=Lv();Object.defineProperty(m,"zipWith",{enumerable:!0,get:function(){return a3.zipWith}})});var oP=_(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});nf.partition=void 0;var s3=Zp(),nP=Gr();function u3(r,e){return function(t){return[nP.filter(r,e)(t),nP.filter(s3.not(r,e))(t)]}}nf.partition=u3});var aP=_(xi=>{"use strict";var c3=xi&&xi.__read||function(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(l){c={error:l}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s},l3=xi&&xi.__spreadArray||function(r,e){for(var t=0,i=e.length,n=r.length;t{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.mergeAll=O.merge=O.max=O.materialize=O.mapTo=O.map=O.last=O.isEmpty=O.ignoreElements=O.groupBy=O.first=O.findIndex=O.find=O.finalize=O.filter=O.expand=O.exhaustMap=O.exhaustAll=O.exhaust=O.every=O.endWith=O.elementAt=O.distinctUntilKeyChanged=O.distinctUntilChanged=O.distinct=O.dematerialize=O.delayWhen=O.delay=O.defaultIfEmpty=O.debounceTime=O.debounce=O.count=O.connect=O.concatWith=O.concatMapTo=O.concatMap=O.concatAll=O.concat=O.combineLatestWith=O.combineLatest=O.combineLatestAll=O.combineAll=O.catchError=O.bufferWhen=O.bufferToggle=O.bufferTime=O.bufferCount=O.buffer=O.auditTime=O.audit=void 0;O.timeInterval=O.throwIfEmpty=O.throttleTime=O.throttle=O.tap=O.takeWhile=O.takeUntil=O.takeLast=O.take=O.switchScan=O.switchMapTo=O.switchMap=O.switchAll=O.subscribeOn=O.startWith=O.skipWhile=O.skipUntil=O.skipLast=O.skip=O.single=O.shareReplay=O.share=O.sequenceEqual=O.scan=O.sampleTime=O.sample=O.refCount=O.retryWhen=O.retry=O.repeatWhen=O.repeat=O.reduce=O.raceWith=O.race=O.publishReplay=O.publishLast=O.publishBehavior=O.publish=O.pluck=O.partition=O.pairwise=O.onErrorResumeNext=O.observeOn=O.multicast=O.min=O.mergeWith=O.mergeScan=O.mergeMapTo=O.mergeMap=O.flatMap=void 0;O.zipWith=O.zipAll=O.zip=O.withLatestFrom=O.windowWhen=O.windowToggle=O.windowTime=O.windowCount=O.window=O.toArray=O.timestamp=O.timeoutWith=O.timeout=void 0;var d3=fc();Object.defineProperty(O,"audit",{enumerable:!0,get:function(){return d3.audit}});var v3=td();Object.defineProperty(O,"auditTime",{enumerable:!0,get:function(){return v3.auditTime}});var m3=rd();Object.defineProperty(O,"buffer",{enumerable:!0,get:function(){return m3.buffer}});var y3=nd();Object.defineProperty(O,"bufferCount",{enumerable:!0,get:function(){return y3.bufferCount}});var g3=od();Object.defineProperty(O,"bufferTime",{enumerable:!0,get:function(){return g3.bufferTime}});var b3=sd();Object.defineProperty(O,"bufferToggle",{enumerable:!0,get:function(){return b3.bufferToggle}});var _3=ud();Object.defineProperty(O,"bufferWhen",{enumerable:!0,get:function(){return _3.bufferWhen}});var P3=cd();Object.defineProperty(O,"catchError",{enumerable:!0,get:function(){return P3.catchError}});var w3=hd();Object.defineProperty(O,"combineAll",{enumerable:!0,get:function(){return w3.combineAll}});var O3=wc();Object.defineProperty(O,"combineLatestAll",{enumerable:!0,get:function(){return O3.combineLatestAll}});var S3=pd();Object.defineProperty(O,"combineLatest",{enumerable:!0,get:function(){return S3.combineLatest}});var T3=dd();Object.defineProperty(O,"combineLatestWith",{enumerable:!0,get:function(){return T3.combineLatestWith}});var A3=md();Object.defineProperty(O,"concat",{enumerable:!0,get:function(){return A3.concat}});var E3=ga();Object.defineProperty(O,"concatAll",{enumerable:!0,get:function(){return E3.concatAll}});var q3=Tc();Object.defineProperty(O,"concatMap",{enumerable:!0,get:function(){return q3.concatMap}});var C3=vd();Object.defineProperty(O,"concatMapTo",{enumerable:!0,get:function(){return C3.concatMapTo}});var M3=yd();Object.defineProperty(O,"concatWith",{enumerable:!0,get:function(){return M3.concatWith}});var x3=Pa();Object.defineProperty(O,"connect",{enumerable:!0,get:function(){return x3.connect}});var L3=gd();Object.defineProperty(O,"count",{enumerable:!0,get:function(){return L3.count}});var j3=bd();Object.defineProperty(O,"debounce",{enumerable:!0,get:function(){return j3.debounce}});var I3=_d();Object.defineProperty(O,"debounceTime",{enumerable:!0,get:function(){return I3.debounceTime}});var F3=uo();Object.defineProperty(O,"defaultIfEmpty",{enumerable:!0,get:function(){return F3.defaultIfEmpty}});var D3=Pd();Object.defineProperty(O,"delay",{enumerable:!0,get:function(){return D3.delay}});var k3=zc();Object.defineProperty(O,"delayWhen",{enumerable:!0,get:function(){return k3.delayWhen}});var R3=wd();Object.defineProperty(O,"dematerialize",{enumerable:!0,get:function(){return R3.dematerialize}});var z3=Od();Object.defineProperty(O,"distinct",{enumerable:!0,get:function(){return z3.distinct}});var N3=Bc();Object.defineProperty(O,"distinctUntilChanged",{enumerable:!0,get:function(){return N3.distinctUntilChanged}});var V3=Sd();Object.defineProperty(O,"distinctUntilKeyChanged",{enumerable:!0,get:function(){return V3.distinctUntilKeyChanged}});var W3=Td();Object.defineProperty(O,"elementAt",{enumerable:!0,get:function(){return W3.elementAt}});var U3=Ad();Object.defineProperty(O,"endWith",{enumerable:!0,get:function(){return U3.endWith}});var B3=Ed();Object.defineProperty(O,"every",{enumerable:!0,get:function(){return B3.every}});var G3=qd();Object.defineProperty(O,"exhaust",{enumerable:!0,get:function(){return G3.exhaust}});var H3=Jc();Object.defineProperty(O,"exhaustAll",{enumerable:!0,get:function(){return H3.exhaustAll}});var $3=Yc();Object.defineProperty(O,"exhaustMap",{enumerable:!0,get:function(){return $3.exhaustMap}});var Q3=Cd();Object.defineProperty(O,"expand",{enumerable:!0,get:function(){return Q3.expand}});var K3=Gr();Object.defineProperty(O,"filter",{enumerable:!0,get:function(){return K3.filter}});var Y3=Md();Object.defineProperty(O,"finalize",{enumerable:!0,get:function(){return Y3.finalize}});var X3=rl();Object.defineProperty(O,"find",{enumerable:!0,get:function(){return X3.find}});var J3=xd();Object.defineProperty(O,"findIndex",{enumerable:!0,get:function(){return J3.findIndex}});var Z3=Ld();Object.defineProperty(O,"first",{enumerable:!0,get:function(){return Z3.first}});var e$=jd();Object.defineProperty(O,"groupBy",{enumerable:!0,get:function(){return e$.groupBy}});var t$=Fc();Object.defineProperty(O,"ignoreElements",{enumerable:!0,get:function(){return t$.ignoreElements}});var r$=Id();Object.defineProperty(O,"isEmpty",{enumerable:!0,get:function(){return r$.isEmpty}});var i$=Fd();Object.defineProperty(O,"last",{enumerable:!0,get:function(){return i$.last}});var n$=Br();Object.defineProperty(O,"map",{enumerable:!0,get:function(){return n$.map}});var o$=kc();Object.defineProperty(O,"mapTo",{enumerable:!0,get:function(){return o$.mapTo}});var a$=kd();Object.defineProperty(O,"materialize",{enumerable:!0,get:function(){return a$.materialize}});var s$=Rd();Object.defineProperty(O,"max",{enumerable:!0,get:function(){return s$.max}});var u$=Wd();Object.defineProperty(O,"merge",{enumerable:!0,get:function(){return u$.merge}});var c$=to();Object.defineProperty(O,"mergeAll",{enumerable:!0,get:function(){return c$.mergeAll}});var l$=zd();Object.defineProperty(O,"flatMap",{enumerable:!0,get:function(){return l$.flatMap}});var f$=vr();Object.defineProperty(O,"mergeMap",{enumerable:!0,get:function(){return f$.mergeMap}});var h$=Nd();Object.defineProperty(O,"mergeMapTo",{enumerable:!0,get:function(){return h$.mergeMapTo}});var p$=Vd();Object.defineProperty(O,"mergeScan",{enumerable:!0,get:function(){return p$.mergeScan}});var d$=Ud();Object.defineProperty(O,"mergeWith",{enumerable:!0,get:function(){return d$.mergeWith}});var v$=Bd();Object.defineProperty(O,"min",{enumerable:!0,get:function(){return v$.min}});var m$=wa();Object.defineProperty(O,"multicast",{enumerable:!0,get:function(){return m$.multicast}});var y$=Jn();Object.defineProperty(O,"observeOn",{enumerable:!0,get:function(){return y$.observeOn}});var g$=Gd();Object.defineProperty(O,"onErrorResumeNext",{enumerable:!0,get:function(){return g$.onErrorResumeNext}});var b$=Hd();Object.defineProperty(O,"pairwise",{enumerable:!0,get:function(){return b$.pairwise}});var _$=oP();Object.defineProperty(O,"partition",{enumerable:!0,get:function(){return _$.partition}});var P$=$d();Object.defineProperty(O,"pluck",{enumerable:!0,get:function(){return P$.pluck}});var w$=Qd();Object.defineProperty(O,"publish",{enumerable:!0,get:function(){return w$.publish}});var O$=Kd();Object.defineProperty(O,"publishBehavior",{enumerable:!0,get:function(){return O$.publishBehavior}});var S$=Yd();Object.defineProperty(O,"publishLast",{enumerable:!0,get:function(){return S$.publishLast}});var T$=Xd();Object.defineProperty(O,"publishReplay",{enumerable:!0,get:function(){return T$.publishReplay}});var A$=aP();Object.defineProperty(O,"race",{enumerable:!0,get:function(){return A$.race}});var E$=wl();Object.defineProperty(O,"raceWith",{enumerable:!0,get:function(){return E$.raceWith}});var q$=nn();Object.defineProperty(O,"reduce",{enumerable:!0,get:function(){return q$.reduce}});var C$=Jd();Object.defineProperty(O,"repeat",{enumerable:!0,get:function(){return C$.repeat}});var M$=Zd();Object.defineProperty(O,"repeatWhen",{enumerable:!0,get:function(){return M$.repeatWhen}});var x$=ev();Object.defineProperty(O,"retry",{enumerable:!0,get:function(){return x$.retry}});var L$=tv();Object.defineProperty(O,"retryWhen",{enumerable:!0,get:function(){return L$.retryWhen}});var j$=Qs();Object.defineProperty(O,"refCount",{enumerable:!0,get:function(){return j$.refCount}});var I$=ql();Object.defineProperty(O,"sample",{enumerable:!0,get:function(){return I$.sample}});var F$=rv();Object.defineProperty(O,"sampleTime",{enumerable:!0,get:function(){return F$.sampleTime}});var D$=iv();Object.defineProperty(O,"scan",{enumerable:!0,get:function(){return D$.scan}});var k$=nv();Object.defineProperty(O,"sequenceEqual",{enumerable:!0,get:function(){return k$.sequenceEqual}});var R$=Ll();Object.defineProperty(O,"share",{enumerable:!0,get:function(){return R$.share}});var z$=av();Object.defineProperty(O,"shareReplay",{enumerable:!0,get:function(){return z$.shareReplay}});var N$=sv();Object.defineProperty(O,"single",{enumerable:!0,get:function(){return N$.single}});var V$=uv();Object.defineProperty(O,"skip",{enumerable:!0,get:function(){return V$.skip}});var W$=cv();Object.defineProperty(O,"skipLast",{enumerable:!0,get:function(){return W$.skipLast}});var U$=lv();Object.defineProperty(O,"skipUntil",{enumerable:!0,get:function(){return U$.skipUntil}});var B$=fv();Object.defineProperty(O,"skipWhile",{enumerable:!0,get:function(){return B$.skipWhile}});var G$=hv();Object.defineProperty(O,"startWith",{enumerable:!0,get:function(){return G$.startWith}});var H$=Zn();Object.defineProperty(O,"subscribeOn",{enumerable:!0,get:function(){return H$.subscribeOn}});var $$=pv();Object.defineProperty(O,"switchAll",{enumerable:!0,get:function(){return $$.switchAll}});var Q$=po();Object.defineProperty(O,"switchMap",{enumerable:!0,get:function(){return Q$.switchMap}});var K$=dv();Object.defineProperty(O,"switchMapTo",{enumerable:!0,get:function(){return K$.switchMapTo}});var Y$=vv();Object.defineProperty(O,"switchScan",{enumerable:!0,get:function(){return Y$.switchScan}});var X$=co();Object.defineProperty(O,"take",{enumerable:!0,get:function(){return X$.take}});var J$=sl();Object.defineProperty(O,"takeLast",{enumerable:!0,get:function(){return J$.takeLast}});var Z$=mv();Object.defineProperty(O,"takeUntil",{enumerable:!0,get:function(){return Z$.takeUntil}});var e6=yv();Object.defineProperty(O,"takeWhile",{enumerable:!0,get:function(){return e6.takeWhile}});var t6=gv();Object.defineProperty(O,"tap",{enumerable:!0,get:function(){return t6.tap}});var r6=Ql();Object.defineProperty(O,"throttle",{enumerable:!0,get:function(){return r6.throttle}});var i6=bv();Object.defineProperty(O,"throttleTime",{enumerable:!0,get:function(){return i6.throttleTime}});var n6=lo();Object.defineProperty(O,"throwIfEmpty",{enumerable:!0,get:function(){return n6.throwIfEmpty}});var o6=_v();Object.defineProperty(O,"timeInterval",{enumerable:!0,get:function(){return o6.timeInterval}});var a6=ya();Object.defineProperty(O,"timeout",{enumerable:!0,get:function(){return a6.timeout}});var s6=Pv();Object.defineProperty(O,"timeoutWith",{enumerable:!0,get:function(){return s6.timeoutWith}});var u6=wv();Object.defineProperty(O,"timestamp",{enumerable:!0,get:function(){return u6.timestamp}});var c6=bc();Object.defineProperty(O,"toArray",{enumerable:!0,get:function(){return c6.toArray}});var l6=Ov();Object.defineProperty(O,"window",{enumerable:!0,get:function(){return l6.window}});var f6=Sv();Object.defineProperty(O,"windowCount",{enumerable:!0,get:function(){return f6.windowCount}});var h6=Tv();Object.defineProperty(O,"windowTime",{enumerable:!0,get:function(){return h6.windowTime}});var p6=Ev();Object.defineProperty(O,"windowToggle",{enumerable:!0,get:function(){return p6.windowToggle}});var d6=qv();Object.defineProperty(O,"windowWhen",{enumerable:!0,get:function(){return d6.windowWhen}});var v6=Cv();Object.defineProperty(O,"withLatestFrom",{enumerable:!0,get:function(){return v6.withLatestFrom}});var m6=xv();Object.defineProperty(O,"zip",{enumerable:!0,get:function(){return m6.zip}});var y6=Mv();Object.defineProperty(O,"zipAll",{enumerable:!0,get:function(){return y6.zipAll}});var g6=Lv();Object.defineProperty(O,"zipWith",{enumerable:!0,get:function(){return g6.zipWith}})});var Ea=_(Aa=>{var b6=function(r,e){return re?1:0},_6=function(r,e){return re?-1:0};function P6(r){return function(e,t){return r(t,e)}}function w6(r){return r===2?function(e,t){return e[0]t[0]?1:e[1]t[1]?1:0}:function(e,t){for(var i=0;it[i])return 1;i++}return 0}}Aa.DEFAULT_COMPARATOR=b6;Aa.DEFAULT_REVERSE_COMPARATOR=_6;Aa.reverseComparator=P6;Aa.createTupleComparator=w6});var sP=_(Iv=>{Iv.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u";Iv.SYMBOL_SUPPORT=typeof Symbol<"u"});var _e=_((W7,cP)=>{var uP=sP(),O6=uP.ARRAY_BUFFER_SUPPORT,S6=uP.SYMBOL_SUPPORT;cP.exports=function(e,t){var i,n,s,c,l;if(!e)throw new Error("obliterator/forEach: invalid iterable.");if(typeof t!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(e)||O6&&ArrayBuffer.isView(e)||typeof e=="string"||e.toString()==="[object Arguments]"){for(s=0,c=e.length;s{var lP=Ea(),fP=_e(),hP=lP.DEFAULT_COMPARATOR,T6=lP.reverseComparator;function lt(r){if(this.clear(),this.comparator=r||hP,typeof this.comparator!="function")throw new Error("mnemonist/FibonacciHeap.constructor: given comparator should be a function.")}lt.prototype.clear=function(){this.root=null,this.min=null,this.size=0};function A6(r){return{item:r,degree:0}}function pP(r,e){r.root?(e.right=r.root.right,e.left=r.root,r.root.right.left=e,r.root.right=e):r.root=e}lt.prototype.push=function(r){var e=A6(r);return e.left=e,e.right=e,pP(this,e),(!this.min||this.comparator(e.item,this.min.item)<=0)&&(this.min=e),++this.size};lt.prototype.peek=function(){return this.min?this.min.item:void 0};function dP(r){for(var e=[],t=r,i=!1;!(t===r&&i);)t===r&&(i=!0),e.push(t),t=t.right;return e}function vP(r,e){r.root===e&&(r.root=e.right),e.left.right=e.right,e.right.left=e.left}function E6(r,e){r.child?(e.right=r.child.right,e.left=r.child,r.child.right.left=e,r.child.right=e):r.child=e}function q6(r,e,t){vP(r,e),e.left=e,e.right=e,E6(t,e),t.degree++,e.parent=t}function C6(r){var e=new Array(r.size),t=dP(r.root),i,n,s,c,l,h;for(i=0,n=t.length;i0&&(h=s,s=c,c=h),q6(r,c,s),e[l]=null,l++;e[l]=s}for(i=0;i{var M6=Math.pow(2,8)-1,x6=Math.pow(2,16)-1,L6=Math.pow(2,32)-1,j6=Math.pow(2,7)-1,I6=Math.pow(2,15)-1,F6=Math.pow(2,31)-1;gr.getPointerArray=function(r){var e=r-1;if(e<=M6)return Uint8Array;if(e<=x6)return Uint16Array;if(e<=L6)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")};gr.getSignedPointerArray=function(r){var e=r-1;return e<=j6?Int8Array:e<=I6?Int16Array:e<=F6?Int32Array:Float64Array};gr.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 D6={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};gr.getMinimalRepresentation=function(r,e){var t=null,i=0,n,s,c,l,h;for(l=0,h=r.length;li&&(i=n,t=s);return t};gr.isTypedArray=function(r){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(r)};gr.concat=function(){var r=0,e,t,i;for(e=0,i=arguments.length;e{var bP=_e(),_P=ft();function k6(r){return Array.isArray(r)||_P.isTypedArray(r)}function Fv(r){if(typeof r.length=="number")return r.length;if(typeof r.size=="number")return r.size}function R6(r){var e=Fv(r),t=typeof e=="number"?new Array(e):[],i=0;return bP(r,function(n){t[i++]=n}),t}function z6(r){var e=Fv(r),t=typeof e=="number"?_P.getPointerArray(e):Array,i=typeof e=="number"?new Array(e):[],n=typeof e=="number"?new t(e):[],s=0;return bP(r,function(c){i[s]=c,n[s]=s++}),[i,n]}Ca.isArrayLike=k6;Ca.guessLength=Fv;Ca.toArray=R6;Ca.toArrayWithIndices=z6});var gf=_((pX,SP)=>{var vf=_e(),PP=Ea(),br=Ot(),yf=PP.DEFAULT_COMPARATOR,Dv=PP.reverseComparator;function kv(r,e,t,i){for(var n=e[i],s,c;i>t;){if(s=i-1>>1,c=e[s],r(n,c)<0){e[i]=c,i=s;continue}break}e[i]=n}function Ma(r,e,t){for(var i=e.length,n=t,s=e[t],c=2*t+1,l;c=0&&(c=l),e[t]=e[c],t=c,c=2*t+1;e[t]=s,kv(r,e,n,t)}function wP(r,e,t){e.push(t),kv(r,e,0,e.length-1)}function Rv(r,e){var t=e.pop();if(e.length!==0){var i=e[0];return e[0]=t,Ma(r,e,0),i}return t}function wo(r,e,t){if(e.length===0)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var i=e[0];return e[0]=t,Ma(r,e,0),i}function OP(r,e,t){var i;return e.length!==0&&r(e[0],t)<0&&(i=e[0],e[0]=t,t=i,Ma(r,e,0)),t}function sn(r,e){for(var t=e.length,i=t>>1,n=i;--n>=0;)Ma(r,e,n)}function zv(r,e){for(var t=e.length,i=0,n=new Array(t);i=t.length)return t.slice().sort(r);for(h=t.slice(0,e),sn(i,h),n=e,s=t.length;n0&&wo(i,h,t[n]);return h.sort(r)}var p=br.guessLength(t);return p!==null&&p0&&wo(i,h,v)),n++}),h.length>n&&(h.length=n),h.sort(r)}function V6(r,e,t){arguments.length===2&&(t=e,e=r,r=yf);var i=Dv(r),n,s,c,l=-1/0,h;if(e===1){if(br.isArrayLike(t)){for(n=0,s=t.length;n0)&&(l=c);return h=new t.constructor(1),h[0]=l,h}return vf(t,function(v){(l===-1/0||r(v,l)>0)&&(l=v)}),[l]}if(br.isArrayLike(t)){if(e>=t.length)return t.slice().sort(i);for(h=t.slice(0,e),sn(r,h),n=e,s=t.length;n0&&wo(r,h,t[n]);return h.sort(i)}var p=br.guessLength(t);return p!==null&&p0&&wo(r,h,v)),n++}),h.length>n&&(h.length=n),h.sort(i)}function fe(r){if(this.clear(),this.comparator=r||yf,typeof this.comparator!="function")throw new Error("mnemonist/Heap.constructor: given comparator should be a function.")}fe.prototype.clear=function(){this.items=[],this.size=0};fe.prototype.push=function(r){return wP(this.comparator,this.items,r),++this.size};fe.prototype.peek=function(){return this.items[0]};fe.prototype.pop=function(){return this.size!==0&&this.size--,Rv(this.comparator,this.items)};fe.prototype.replace=function(r){return wo(this.comparator,this.items,r)};fe.prototype.pushpop=function(r){return OP(this.comparator,this.items,r)};fe.prototype.consume=function(){return this.size=0,zv(this.comparator,this.items)};fe.prototype.toArray=function(){return zv(this.comparator,this.items.slice())};fe.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:fe,enumerable:!1}),r};typeof Symbol<"u"&&(fe.prototype[Symbol.for("nodejs.util.inspect.custom")]=fe.prototype.inspect);function mf(r){if(this.clear(),this.comparator=r||yf,typeof this.comparator!="function")throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=Dv(this.comparator)}mf.prototype=fe.prototype;fe.from=function(r,e){var t=new fe(e),i;return br.isArrayLike(r)?i=r.slice():i=br.toArray(r),sn(t.comparator,i),t.items=i,t.size=i.length,t};mf.from=function(r,e){var t=new mf(e),i;return br.isArrayLike(r)?i=r.slice():i=br.toArray(r),sn(t.comparator,i),t.items=i,t.size=i.length,t};fe.siftUp=Ma;fe.siftDown=kv;fe.push=wP;fe.pop=Rv;fe.replace=wo;fe.pushpop=OP;fe.heapify=sn;fe.consume=zv;fe.nsmallest=N6;fe.nlargest=V6;fe.MinHeap=fe;fe.MaxHeap=mf;SP.exports=fe});var CP=_((dX,qP)=>{var TP="";function AP(r,e,t){for(var i=e.length,n=[],s=i,c=-1,l,h=0,p;s--;)c=Math.max(r[e[s]+t],c);for(p=c>>24&&32||c>>16&&24||c>>8&&16||8;h>h&15].push(e[s]);for(l=0;l<16;l++)for(c=n[l].length;c--;)e[++s]=n[l][c]}}function W6(r,e,t,i){return r[t]-r[i]||(t%3===2?r[t+1]-r[i+1]||e[t+2]-e[i+2]:e[t+1]-e[i+1])}function Nv(r,e){var t=[],i=[],n=2*e/3|0,s=e-n,c=n+1>>1,l=n,h=0,p,v=[],b=[];if(e===1)return[0];for(;l--;)t[l]=(l*3>>1)+1;for(l=3;l--;)AP(r,t,l);for(h=i[(t[0]/3|0)+(t[0]%3===1?0:c)]=1,l=1;lthis.firstLength&&s>this.firstLength)){for(e=Math.min(this.length-n,this.length-s),i=0;ir.length&&(r=this.text.slice(n,n+e))}return r};ji.prototype.toString=function(){return this.array.join(",")};ji.prototype.toJSON=function(){return this.array};ji.prototype.inspect=function(){for(var r=new Array(this.length),e=0;e{var U6=_e();function tr(r){this.size=0,this.items=new Map,this.inverse=r}function Lt(){this.size=0,this.items=new Map,this.inverse=new tr(this)}function MP(){this.size=0,this.items.clear(),this.inverse.items.clear()}Lt.prototype.clear=MP;tr.prototype.clear=MP;function xP(r,e){if(this.items.has(r)){var t=this.items.get(r);if(t===e)return this;this.inverse.items.delete(t)}if(this.inverse.items.has(e)){var i=this.inverse.items.get(e);if(i===r)return this;this.items.delete(i)}return this.items.set(r,e),this.inverse.items.set(e,r),this.size=this.items.size,this.inverse.size=this.inverse.items.size,this}Lt.prototype.set=xP;tr.prototype.set=xP;function LP(r){if(this.items.has(r)){var e=this.items.get(r);return this.items.delete(r),this.inverse.items.delete(e),this.size=this.items.size,this.inverse.size=this.inverse.items.size,!0}return!1}Lt.prototype.delete=LP;tr.prototype.delete=LP;var B6=["has","get","forEach","keys","values","entries"];B6.forEach(function(r){Lt.prototype[r]=tr.prototype[r]=function(){return Map.prototype[r].apply(this.items,arguments)}});typeof Symbol<"u"&&(Lt.prototype[Symbol.iterator]=Lt.prototype.entries,tr.prototype[Symbol.iterator]=tr.prototype.entries);Lt.prototype.inspect=function(){var r={left:this.items,right:this.inverse.items};return Object.defineProperty(r,"constructor",{value:Lt,enumerable:!1}),r};typeof Symbol<"u"&&(Lt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Lt.prototype.inspect);tr.prototype.inspect=function(){var r={left:this.inverse.items,right:this.items};return Object.defineProperty(r,"constructor",{value:tr,enumerable:!1}),r};typeof Symbol<"u"&&(tr.prototype[Symbol.for("nodejs.util.inspect.custom")]=tr.prototype.inspect);Lt.from=function(r){var e=new Lt;return U6(r,function(t,i){e.set(i,t)}),e};jP.exports=Lt});var Ue=_((mX,FP)=>{function _r(r){if(typeof r!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=r}typeof Symbol<"u"&&(_r.prototype[Symbol.iterator]=function(){return this});_r.of=function(){var r=arguments,e=r.length,t=0;return new _r(function(){return t>=e?{done:!0}:{done:!1,value:r[t++]}})};_r.empty=function(){var r=new _r(function(){return{done:!0}});return r};_r.fromSequence=function(r){var e=0,t=r.length;return new _r(function(){return e>=t?{done:!0}:{done:!1,value:r[e++]}})};_r.is=function(r){return r instanceof _r?!0:typeof r=="object"&&r!==null&&typeof r.next=="function"};FP.exports=_r});var Wv=_(rr=>{function kP(r){return r|=r>>1,r|=r>>2,r|=r>>4,r|=r>>8,r|=r>>16,r&~(r>>1)}rr.msb32=kP;function Vv(r){return r|=r>>1,r|=r>>2,r|=r>>4,r&~(r>>1)}rr.msb8=Vv;rr.test=function(r,e){return r>>e&1};rr.criticalBit8=function(r,e){return Vv(r^e)};rr.criticalBit8Mask=function(r,e){return~Vv(r^e)>>>0&255};rr.testCriticalBit8=function(r,e){return 1+(r|e)>>8};rr.criticalBit32Mask=function(r,e){return~kP(r^e)>>>0&4294967295};rr.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 Oo=new Uint8Array(Math.pow(2,8));for(xa=0,DP=Oo.length;xa>8&255]+Oo[r>>16&255]+Oo[r>>24&255]}});var VP=_((gX,NP)=>{var zP=Ue(),RP=Wv();function Re(r){this.length=r,this.clear()}Re.prototype.clear=function(){this.size=0,this.array=new Uint32Array(Math.ceil(this.length/32))};Re.prototype.set=function(r,e){var t=r>>5,i=r&31,n=this.array[t],s;return e===0||e===!1?s=this.array[t]&=~(1<>>0,s>n?this.size++:s>5,t=r&31,i=this.array[e],n;return n=this.array[e]&=~(1<>5,t=r&31,i=this.array[e],n=this.array[e]^=1<>>0,n>i?this.size++:n>5,t=r&31;return this.array[e]>>t&1};Re.prototype.test=function(r){return!!this.get(r)};Re.prototype.rank=function(r){if(this.size===0)return 0;for(var e=r>>5,t=r&31,i=0,n=0;n=this.length)return-1;for(var e,t=32,i=0,n=0,s=0,c=this.array.length;s>l&1,n===r)return i}};Re.prototype.forEach=function(r,e){e=arguments.length>1?e:this;for(var t=this.length,i,n,s=32,c=0,l=this.array.length;c>h&1,r.call(e,n,c*32+h)}};Re.prototype.values=function(){var r=this.length,e=!1,t,i,n=this.array,s=n.length,c=0,l=-1,h=32;return new zP(function p(){if(!e){if(c>=s)return{done:!0};c===s-1&&(h=r%32||32),t=n[c++],e=!0,l=-1}return l++,l>=h?(e=!1,p()):(i=t>>l&1,{value:i})})};Re.prototype.entries=function(){var r=this.length,e=!1,t,i,n=this.array,s,c=n.length,l=0,h=-1,p=32;return new zP(function v(){if(!e){if(l>=c)return{done:!0};l===c-1&&(p=r%32||32),t=n[l++],e=!0,h=-1}return h++,s=~-l*32+h,h>=p?(e=!1,v()):(i=t>>h&1,{value:[s,i]})})};typeof Symbol<"u"&&(Re.prototype[Symbol.iterator]=Re.prototype.values);Re.prototype.inspect=function(){var r=new Uint8Array(this.length);return this.forEach(function(e,t){r[t]=e}),Object.defineProperty(r,"constructor",{value:Re,enumerable:!1}),r};typeof Symbol<"u"&&(Re.prototype[Symbol.for("nodejs.util.inspect.custom")]=Re.prototype.inspect);Re.prototype.toJSON=function(){return Array.from(this.array)};NP.exports=Re});var GP=_((bX,BP)=>{var UP=Ue(),WP=Wv(),G6=function(r){return Math.max(1,Math.ceil(r*1.5))};function H6(r){return new Uint32Array(Math.ceil(r/32))}function Pe(r){var e=r||0,t=G6;typeof r=="object"&&(e=r.initialLength||r.initialCapacity||0,t=r.policy||t),this.size=0,this.length=e,this.capacity=Math.ceil(this.length/32)*32,this.policy=t,this.array=H6(this.capacity)}Pe.prototype.set=function(r,e){if(this.length>5,i=r&31,n=this.array[t],s;return e===0||e===!1?s=this.array[t]&=~(1<>>0,s>n?this.size++:s>5,t=r&31,i=this.array[e],n;return n=this.array[e]&=~(1<>5,t=r&31,i=this.array[e],n=this.array[e]^=1<>>0,n>i?this.size++:nthis.array.length?(this.array=new Uint32Array(i),this.array.set(t,0)):this.array=t.slice(0,i),this.capacity=r,this)};Pe.prototype.grow=function(r){var e;if(typeof r=="number"){if(this.capacity>=r)return this;for(e=this.capacity;e>5,i=e&31;return this.array[t]|=1<>5,t=r&31;return this.array[e]>>t&1}};Pe.prototype.get=function(r){if(!(this.length>5,t=r&31;return this.array[e]>>t&1}};Pe.prototype.test=function(r){return this.length>5,t=r&31,i=0,n=0;n=this.length)return-1;for(var e,t=32,i=0,n=0,s=0,c=this.array.length;s>l&1,n===r)return i}};Pe.prototype.forEach=function(r,e){e=arguments.length>1?e:this;for(var t=this.length,i,n,s=32,c=0,l=this.array.length;c>h&1,r.call(e,n,c*32+h)}};Pe.prototype.values=function(){var r=this.length,e=!1,t,i,n=this.array,s=n.length,c=0,l=-1,h=32;return new UP(function p(){if(!e){if(c>=s)return{done:!0};c===s-1&&(h=r%32||32),t=n[c++],e=!0,l=-1}return l++,l>=h?(e=!1,p()):(i=t>>l&1,{value:i})})};Pe.prototype.entries=function(){var r=this.length,e=!1,t,i,n=this.array,s,c=n.length,l=0,h=-1,p=32;return new UP(function v(){if(!e){if(l>=c)return{done:!0};l===c-1&&(p=r%32||32),t=n[l++],e=!0,h=-1}return h++,s=~-l*32+h,h>=p?(e=!1,v()):(i=t>>h&1,{value:[s,i]})})};typeof Symbol<"u"&&(Pe.prototype[Symbol.iterator]=Pe.prototype.values);Pe.prototype.inspect=function(){var r=new Uint8Array(this.length);return this.forEach(function(e,t){r[t]=e}),Object.defineProperty(r,"constructor",{value:Pe,enumerable:!1}),r};typeof Symbol<"u"&&(Pe.prototype[Symbol.for("nodejs.util.inspect.custom")]=Pe.prototype.inspect);Pe.prototype.toJSON=function(){return Array.from(this.array.slice(0,(this.length>>5)+1))};BP.exports=Pe});var $P=_((_X,HP)=>{function un(r,e){return(r&65535)*e+(((r>>>16)*e&65535)<<16)&4294967295}function $6(r,e){return(r&65535)+(e>>>16)+(((r>>>16)+e&65535)<<16)&4294967295}function Uv(r,e){return r<>>32-e}HP.exports=function(e,t){var i=3432918353,n=461845907,s=15,c=13,l=5,h=1801774676,p=e,v,b,w;for(b=0,w=t.length-4;b<=w;b+=4)v=t[b]|t[b+1]<<8|t[b+2]<<16|t[b+3]<<24,v=un(v,i),v=Uv(v,s),v=un(v,n),p^=v,p=Uv(p,c),p=un(p,l),p=$6(p,h);switch(v=0,t.length&3){case 3:v^=t[b+2]<<16;case 2:v^=t[b+1]<<8;case 1:v^=t[b],v=un(v,i),v=Uv(v,s),v=un(v,n),p^=v;default:}return p^=t.length,p^=p>>>16,p=un(p,2246822507),p^=p>>>13,p=un(p,3266489909),p^=p>>>16,p>>>0}});var XP=_((PX,YP)=>{var Q6=$P(),K6=_e(),Y6=Math.LN2*Math.LN2,X6={errorRate:.005};function QP(r){var e=new Uint16Array(r.length),t,i;for(t=0,i=r.length;t>3]|=s}return this};cn.prototype.test=function(r){for(var e=QP(r),t=0,i=this.hashFunctions;t>3]&1<<(7&n)))return!1}return!0};cn.prototype.toJSON=function(){return this.data};cn.from=function(r,e){if(!e&&(e=r.length||r.size,typeof e!="number"))throw new Error("BloomFilter.from: could not infer the filter's capacity. Try passing it as second argument.");var t=new cn(e);return K6(r,function(i){t.add(i)}),t};YP.exports=cn});var ZP=_((wX,JP)=>{var J6=_e();function ir(r){if(typeof r!="function")throw new Error("mnemonist/BKTree.constructor: given `distance` should be a function.");this.distance=r,this.clear()}ir.prototype.add=function(r){if(!this.root)return this.root={item:r,children:{}},this.size++,this;for(var e=this.root,t;t=this.distance(r,e.item),!!e.children[t];)e=e.children[t];return e.children[t]={item:r,children:{}},this.size++,this};ir.prototype.search=function(r,e){if(!this.root)return[];for(var t=[],i=[this.root],n,s,c,l,h;i.length;)for(n=i.pop(),c=this.distance(e,n.item),c<=r&&t.push({item:n.item,distance:c}),l=c-r,h=c+r+1;l{var Bv=Ot(),e1=Ue();function Me(r,e){if(arguments.length<2)throw new Error("mnemonist/fixed-deque: expecting an Array class and a capacity.");if(typeof e!="number"||e<=0)throw new Error("mnemonist/fixed-deque: `capacity` should be a positive number.");this.ArrayClass=r,this.capacity=e,this.items=new r(this.capacity),this.clear()}Me.prototype.clear=function(){this.start=0,this.size=0};Me.prototype.push=function(r){if(this.size===this.capacity)throw new Error("mnemonist/fixed-deque.push: deque capacity ("+this.capacity+") exceeded!");var e=(this.start+this.size)%this.capacity;return this.items[e]=r,++this.size};Me.prototype.unshift=function(r){if(this.size===this.capacity)throw new Error("mnemonist/fixed-deque.unshift: deque capacity ("+this.capacity+") exceeded!");var e=this.start-1;return this.start===0&&(e=this.capacity-1),this.items[e]=r,this.start=e,++this.size};Me.prototype.pop=function(){if(this.size===0)return;let r=(this.start+this.size-1)%this.capacity;return this.size--,this.items[r]};Me.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]}};Me.prototype.peekFirst=function(){if(this.size!==0)return this.items[this.start]};Me.prototype.peekLast=function(){if(this.size!==0){var r=this.start+this.size-1;return r>this.capacity&&(r-=this.capacity),this.items[r]}};Me.prototype.get=function(r){if(this.size!==0)return r=this.start+r,r>this.capacity&&(r-=this.capacity),this.items[r]};Me.prototype.forEach=function(r,e){e=arguments.length>1?e:this;for(var t=this.capacity,i=this.size,n=this.start,s=0;s=t)return{done:!0};var s=r[i];return i++,n++,i===e&&(i=0),{value:s,done:!1}})};Me.prototype.entries=function(){var r=this.items,e=this.capacity,t=this.size,i=this.start,n=0;return new e1(function(){if(n>=t)return{done:!0};var s=r[i];return i++,i===e&&(i=0),{value:[n++,s],done:!1}})};typeof Symbol<"u"&&(Me.prototype[Symbol.iterator]=Me.prototype.values);Me.prototype.inspect=function(){var r=this.toArray();return r.type=this.ArrayClass.name,r.capacity=this.capacity,Object.defineProperty(r,"constructor",{value:Me,enumerable:!1}),r};typeof Symbol<"u"&&(Me.prototype[Symbol.for("nodejs.util.inspect.custom")]=Me.prototype.inspect);Me.from=function(r,e,t){if(arguments.length<3&&(t=Bv.guessLength(r),typeof t!="number"))throw new Error("mnemonist/fixed-deque.from: could not guess iterable length. Please provide desired capacity as last argument.");var i=new Me(e,t);if(Bv.isArrayLike(r)){var n,s;for(n=0,s=r.length;n{var Hv=Ot(),$v=Gv();function So(r,e){if(arguments.length<2)throw new Error("mnemonist/circular-buffer: expecting an Array class and a capacity.");if(typeof e!="number"||e<=0)throw new Error("mnemonist/circular-buffer: `capacity` should be a positive number.");this.ArrayClass=r,this.capacity=e,this.items=new r(this.capacity),this.clear()}function r1(r){So.prototype[r]=$v.prototype[r]}Object.keys($v.prototype).forEach(r1);typeof Symbol<"u"&&Object.getOwnPropertySymbols($v.prototype).forEach(r1);So.prototype.push=function(r){var e=(this.start+this.size)%this.capacity;return this.items[e]=r,this.size===this.capacity?(this.start=(e+1)%this.capacity,this.size):++this.size};So.prototype.unshift=function(r){var e=this.start-1;return this.start===0&&(e=this.capacity-1),this.items[e]=r,this.size===this.capacity?(this.start=e,this.size):(this.start=e,++this.size)};So.from=function(r,e,t){if(arguments.length<3&&(t=Hv.guessLength(r),typeof t!="number"))throw new Error("mnemonist/circular-buffer.from: could not guess iterable length. Please provide desired capacity as last argument.");var i=new So(e,t);if(Hv.isArrayLike(r)){var n,s;for(n=0,s=r.length;n{function Je(r){if(typeof r!="function")throw new Error("mnemonist/DefaultMap.constructor: expecting a function.");this.items=new Map,this.factory=r,this.size=0}Je.prototype.clear=function(){this.items.clear(),this.size=0};Je.prototype.get=function(r){var e=this.items.get(r);return typeof e>"u"&&(e=this.factory(r,this.size),this.items.set(r,e),this.size++),e};Je.prototype.peek=function(r){return this.items.get(r)};Je.prototype.set=function(r,e){return this.items.set(r,e),this.size=this.items.size,this};Je.prototype.has=function(r){return this.items.has(r)};Je.prototype.delete=function(r){var e=this.items.delete(r);return this.size=this.items.size,e};Je.prototype.forEach=function(r,e){e=arguments.length>1?e:this,this.items.forEach(r,e)};Je.prototype.entries=function(){return this.items.entries()};Je.prototype.keys=function(){return this.items.keys()};Je.prototype.values=function(){return this.items.values()};typeof Symbol<"u"&&(Je.prototype[Symbol.iterator]=Je.prototype.entries);Je.prototype.inspect=function(){return this.items};typeof Symbol<"u"&&(Je.prototype[Symbol.for("nodejs.util.inspect.custom")]=Je.prototype.inspect);Je.autoIncrement=function(){var r=0;return function(){return r++}};o1.exports=Je});var u1=_((AX,s1)=>{function Pr(r){if(typeof r!="function")throw new Error("mnemonist/DefaultWeakMap.constructor: expecting a function.");this.items=new WeakMap,this.factory=r}Pr.prototype.clear=function(){this.items=new WeakMap};Pr.prototype.get=function(r){var e=this.items.get(r);return typeof e>"u"&&(e=this.factory(r),this.items.set(r,e)),e};Pr.prototype.peek=function(r){return this.items.get(r)};Pr.prototype.set=function(r,e){return this.items.set(r,e),this};Pr.prototype.has=function(r){return this.items.has(r)};Pr.prototype.delete=function(r){return this.items.delete(r)};Pr.prototype.inspect=function(){return this.items};typeof Symbol<"u"&&(Pr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Pr.prototype.inspect);s1.exports=Pr});var l1=_((EX,c1)=>{var Qv=ft();function wr(r){var e=Qv.getPointerArray(r),t=Qv.getPointerArray(Math.log2(r));this.size=r,this.dimension=r,this.parents=new e(r),this.ranks=new t(r);for(var i=0;is?this.parents[i]=t:(this.parents[i]=t,this.ranks[t]++),this};wr.prototype.connected=function(r,e){var t=this.find(r);return t===this.find(e)};wr.prototype.mapping=function(){for(var r=Qv.getPointerArray(this.dimension),e={},t=new r(this.size),i=0,n,s=0,c=this.parents.length;s"u"?(t[s]=i,e[n]=i++):t[s]=e[n];return t};wr.prototype.compile=function(){for(var r={},e=new Array(this.dimension),t=0,i,n=0,s=this.parents.length;n"u"?(e[t]=[n],r[i]=t++):e[r[i]].push(n);return e};wr.prototype.inspect=function(){var r=this.compile();return Object.defineProperty(r,"constructor",{value:wr,enumerable:!1}),r};typeof Symbol<"u"&&(wr.prototype[Symbol.for("nodejs.util.inspect.custom")]=wr.prototype.inspect);c1.exports=wr});var bf=_((qX,p1)=>{var f1=Ea(),Kv=gf(),Z6=f1.DEFAULT_COMPARATOR,e4=f1.reverseComparator;function t4(r,e,t,i){for(var n=t,s=i,c=e[i],l=2*i+1,h;l=0&&(l=h),e[i]=e[l],i=l,l=2*i+1;e[i]=c,Kv.siftDown(r,e,s,i)}function h1(r,e,t,i){for(var n=i,s=n,c=new r(i),l,h;s>0;)l=t[--s],s!==0&&(h=t[0],t[0]=l,t4(e,t,--i,0),l=h),c[s]=l;return c}function Or(r,e,t){if(arguments.length===2&&(t=e,e=null),this.ArrayClass=r,this.capacity=t,this.items=new r(t),this.clear(),this.comparator=e||Z6,typeof t!="number"&&t<=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=e4(this.comparator)}Or.prototype.clear=function(){this.size=0};Or.prototype.push=function(r){return this.size0&&Kv.replace(this.comparator,this.items,r),this.size};Or.prototype.peek=function(){return this.items[0]};Or.prototype.consume=function(){var r=h1(this.ArrayClass,this.comparator,this.items,this.size);return this.size=0,r};Or.prototype.toArray=function(){return h1(this.ArrayClass,this.comparator,this.items.slice(0,this.size),this.size)};Or.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:Or,enumerable:!1}),r};typeof Symbol<"u"&&(Or.prototype[Symbol.for("nodejs.util.inspect.custom")]=Or.prototype.inspect);p1.exports=Or});var m1=_((CX,v1)=>{var r4=_e(),d1=function(r){return r};function it(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=d1),this.readHashFunction||(this.readHashFunction=d1),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.")}it.prototype.clear=function(){this.items.clear(),this.size=0};it.prototype.add=function(r){var e=this.writeHashFunction(r);return this.items.set(e,r),this.size=this.items.size,this};it.prototype.set=function(r,e){return r=this.writeHashFunction(r),this.items.set(r,e),this.size=this.items.size,this};it.prototype.get=function(r){return r=this.readHashFunction(r),this.items.get(r)};it.prototype.has=function(r){return r=this.readHashFunction(r),this.items.has(r)};it.prototype.forEach=function(r,e){e=arguments.length>1?e:this,this.items.forEach(function(t){r.call(e,t,t)})};it.prototype.values=function(){return this.items.values()};typeof Symbol<"u"&&(it.prototype[Symbol.iterator]=it.prototype.values);it.prototype.inspect=function(){var r=Array.from(this.items.values());return Object.defineProperty(r,"constructor",{value:it,enumerable:!1}),r};typeof Symbol<"u"&&(it.prototype[Symbol.for("nodejs.util.inspect.custom")]=it.prototype.inspect);it.from=function(r,e,t){var i=new it(e);return r4(r,function(n,s){t?i.set(s,n):i.add(n)}),i};v1.exports=it});var Yv=_((MX,y1)=>{var _f=Ue(),i4=_e();function me(r){this.Container=r||Array,this.items=new Map,this.clear(),Object.defineProperty(this.items,"constructor",{value:me,enumerable:!1})}me.prototype.clear=function(){this.size=0,this.dimension=0,this.items.clear()};me.prototype.set=function(r,e){var t=this.items.get(r),i;return t||(this.dimension++,t=new this.Container,this.items.set(r,t)),this.Container===Set?(i=t.size,t.add(e),i"u"?0:this.Container===Set?e.size:e.length};me.prototype.count=me.prototype.multiplicity;me.prototype.forEach=function(r,e){e=arguments.length>1?e:this;var t;function i(n){r.call(e,n,t)}this.items.forEach(function(n,s){t=s,n.forEach(i)})};me.prototype.forEachAssociation=function(r,e){e=arguments.length>1?e:this,this.items.forEach(r,e)};me.prototype.keys=function(){return this.items.keys()};me.prototype.values=function(){var r=this.items.values(),e=!1,t,i,n,s;return this.Container===Set?new _f(function c(){if(!e){if(i=r.next(),i.done)return{done:!0};e=!0,t=i.value.values()}return i=t.next(),i.done?(e=!1,c()):{done:!1,value:i.value}}):new _f(function c(){if(!e){if(i=r.next(),i.done)return{done:!0};e=!0,t=i.value,n=0,s=t.length}return n>=s?(e=!1,c()):{done:!1,value:t[n++]}})};me.prototype.entries=function(){var r=this.items.entries(),e=!1,t,i,n,s,c;return this.Container===Set?new _f(function l(){if(!e){if(i=r.next(),i.done)return{done:!0};e=!0,n=i.value[0],t=i.value[1].values()}return i=t.next(),i.done?(e=!1,l()):{done:!1,value:[n,i.value]}}):new _f(function l(){if(!e){if(i=r.next(),i.done)return{done:!0};e=!0,n=i.value[0],t=i.value[1],s=0,c=t.length}return s>=c?(e=!1,l()):{done:!1,value:[n,t[s++]]}})};me.prototype.containers=function(){return this.items.values()};me.prototype.associations=function(){return this.items.entries()};typeof Symbol<"u"&&(me.prototype[Symbol.iterator]=me.prototype.entries);me.prototype.inspect=function(){return this.items};typeof Symbol<"u"&&(me.prototype[Symbol.for("nodejs.util.inspect.custom")]=me.prototype.inspect);me.prototype.toJSON=function(){return this.items};me.from=function(r,e){var t=new me(e);return i4(r,function(i,n){t.set(n,i)}),t};y1.exports=me});var _1=_((xX,b1)=>{var n4=Yv(),o4=_e(),g1=function(r){return r};function nt(r,e){if(this.items=new n4(e),this.clear(),Array.isArray(r)?(this.writeHashFunction=r[0],this.readHashFunction=r[1]):(this.writeHashFunction=r,this.readHashFunction=r),this.writeHashFunction||(this.writeHashFunction=g1),this.readHashFunction||(this.readHashFunction=g1),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.")}nt.prototype.clear=function(){this.items.clear(),this.size=0,this.dimension=0};nt.prototype.add=function(r){var e=this.writeHashFunction(r);return this.items.set(e,r),this.size=this.items.size,this.dimension=this.items.dimension,this};nt.prototype.set=function(r,e){return r=this.writeHashFunction(r),this.items.set(r,e),this.size=this.items.size,this.dimension=this.items.dimension,this};nt.prototype.get=function(r){return r=this.readHashFunction(r),this.items.get(r)};nt.prototype.has=function(r){return r=this.readHashFunction(r),this.items.has(r)};nt.prototype.forEach=function(r,e){e=arguments.length>1?e:this,this.items.forEach(function(t){r.call(e,t,t)})};nt.prototype.values=function(){return this.items.values()};typeof Symbol<"u"&&(nt.prototype[Symbol.iterator]=nt.prototype.values);nt.prototype.inspect=function(){var r=Array.from(this);return Object.defineProperty(r,"constructor",{value:nt,enumerable:!1}),r};typeof Symbol<"u"&&(nt.prototype[Symbol.for("nodejs.util.inspect.custom")]=nt.prototype.inspect);nt.from=function(r,e,t,i){arguments.length===3&&typeof t=="boolean"&&(i=t,t=Array);var n=new nt(e,t);return o4(r,function(s,c){i?n.set(c,s):n.add(s)}),n};b1.exports=nt});var O1=_((LX,w1)=>{var P1=1024;function a4(r){return(r&r-1)===0}function nr(r,e){if(arguments.length<1)throw new Error("mnemonist/hashed-array-tree: expecting at least a byte array constructor.");var t=e||0,i=P1,n=0;if(typeof e=="object"&&(t=e.initialCapacity||0,n=e.initialLength||0,i=e.blockSize||P1),!i||!a4(i))throw new Error("mnemonist/hashed-array-tree: block size should be a power of two.");var s=Math.max(n,t),c=Math.ceil(s/i);this.ArrayClass=r,this.length=n,this.capacity=c*i,this.blockSize=i,this.offsetMask=i-1,this.blockMask=Math.log2(i),this.blocks=new Array(c);for(var l=0;l>this.blockMask,i=r&this.offsetMask;return this.blocks[t][i]=e,this};nr.prototype.get=function(r){if(!(this.length>this.blockMask,t=r&this.offsetMask;return this.blocks[e][t]}};nr.prototype.grow=function(r){if(typeof r!="number"&&(r=this.capacity+this.blockSize),this.capacity>=r)return this;for(;this.capacity>this.blockMask,i=e&this.offsetMask;return this.blocks[t][i]=r,++this.length};nr.prototype.pop=function(){if(this.length!==0){var r=this.blocks[this.blocks.length-1],e=--this.length&this.offsetMask;return r[e]}};nr.prototype.inspect=function(){for(var r=new this.ArrayClass(this.length),e,t=0,i=this.length;t>this.blockMask,r[t]=this.blocks[e][t&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:nr,enumerable:!1}),r};typeof Symbol<"u"&&(nr.prototype[Symbol.for("nodejs.util.inspect.custom")]=nr.prototype.inspect);w1.exports=nr});var Jv=_((jX,T1)=>{var S1=Ue(),Xv=Ot();function ze(r,e){if(arguments.length<2)throw new Error("mnemonist/fixed-stack: expecting an Array class and a capacity.");if(typeof e!="number"||e<=0)throw new Error("mnemonist/fixed-stack: `capacity` should be a positive number.");this.capacity=e,this.ArrayClass=r,this.items=new this.ArrayClass(this.capacity),this.clear()}ze.prototype.clear=function(){this.size=0};ze.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};ze.prototype.pop=function(){if(this.size!==0)return this.items[--this.size]};ze.prototype.peek=function(){return this.items[this.size-1]};ze.prototype.forEach=function(r,e){e=arguments.length>1?e:this;for(var t=0,i=this.items.length;t=e)return{done:!0};var i=r[e-t-1];return t++,{value:i,done:!1}})};ze.prototype.entries=function(){var r=this.items,e=this.size,t=0;return new S1(function(){if(t>=e)return{done:!0};var i=r[e-t-1];return{value:[t++,i],done:!1}})};typeof Symbol<"u"&&(ze.prototype[Symbol.iterator]=ze.prototype.values);ze.prototype.toString=function(){return this.toArray().join(",")};ze.prototype.toJSON=function(){return this.toArray()};ze.prototype.inspect=function(){var r=this.toArray();return r.type=this.ArrayClass.name,r.capacity=this.capacity,Object.defineProperty(r,"constructor",{value:ze,enumerable:!1}),r};typeof Symbol<"u"&&(ze.prototype[Symbol.for("nodejs.util.inspect.custom")]=ze.prototype.inspect);ze.from=function(r,e,t){if(arguments.length<3&&(t=Xv.guessLength(r),typeof t!="number"))throw new Error("mnemonist/fixed-stack.from: could not guess iterable length. Please provide desired capacity as last argument.");var i=new ze(e,t);if(Xv.isArrayLike(r)){var n,s;for(n=0,s=r.length;n{var s4=Ot(),u4=ft(),c4=Jv();function Zv(r,e,t,i,n,s,c,l){var h=c+(l-c)/2|0,p=~-h,v=-~h,b=t[h];i[s]=b+1;var w=e?e(r[b]):r[b][1],T=s*2+1,q=s*2+2,M=-1/0,L=-1/0;c<=p&&(M=Zv(r,e,t,i,n,T,c,p)),v<=l&&(L=Zv(r,e,t,i,n,q,v,l));var D=Math.max(w,M,L),N=b;return D===M?N=n[i[T]-1]:D===L&&(N=n[i[q]-1]),n[b]=N,D}function Sr(r,e){this.size=r.length,this.intervals=r;var t=null,i=null;Array.isArray(e)&&(t=e[0],i=e[1]);var n=r.length,s=u4.getPointerArray(n+1),c=new s(n),l;for(l=1;lT?1:0});var h=Math.ceil(Math.log2(n+1)),p=Math.pow(2,h)-1,v=new s(p),b=new s(n);Zv(r,i,c,v,b,0,0,n-1),c=null,this.height=h,this.tree=v,this.augmentations=b,this.startGetter=t,this.endGetter=i,this.stack=new c4(s,this.height)}Sr.prototype.intervalsContainingPoint=function(r){var e=[],t=this.stack;t.clear(),t.push(0);for(var i=this.tree.length,n,s,c,l,h,p,v,b,w;t.size;)n=t.pop(),s=this.tree[n]-1,c=this.intervals[s],l=this.intervals[this.augmentations[s]],v=this.endGetter?this.endGetter(l):l[1],!(r>v)&&(b=n*2+1,b=h&&r<=p&&e.push(c),!(rw)&&(T=c*2+1,T=v&&e<=b&&i.push(h),!(t{Ii.search=function(r,e,t,i){var n=0;t=typeof t<"u"?t:0,i=typeof i<"u"?i:r.length,i--;for(var s;t<=i;)if(n=t+i>>>1,s=r[n],s>e)i=~-n;else if(s>>1,c=r(e[i],t),c>0)s=~-i;else if(c<0)n=-~i;else return i;return-1};Ii.lowerBound=function(r,e,t,i){var n=0;for(t=typeof t<"u"?t:0,i=typeof i<"u"?i:r.length;t>>1,e<=r[n]?i=n:t=-~n;return t};Ii.lowerBoundWithComparator=function(r,e,t){for(var i=0,n=0,s=e.length;n>>1,r(t,e[i])<=0?s=i:n=-~i;return n};Ii.lowerBoundIndices=function(r,e,t,i,n){var s=0;for(i=typeof i<"u"?i:0,n=typeof n<"u"?n:r.length;i>>1,t<=r[e[s]]?n=s:i=-~s;return i};Ii.upperBound=function(r,e,t,i){var n=0;for(t=typeof t<"u"?t:0,i=typeof i<"u"?i:r.length;t>>1,e>=r[n]?t=-~n:i=n;return t};Ii.upperBoundWithComparator=function(r,e,t){for(var i=0,n=0,s=e.length;n>>1,r(t,e[i])>=0?n=-~i:s=i;return n}});var x1=_(Fi=>{var To=ft(),Ao=Ot().isArrayLike,ln=em(),q1=lf();function C1(r,e){if(r.length===0)return e.slice();if(e.length===0)return r.slice();var t;r[0]>e[0]&&(t=r,r=e,e=t);var i=r[r.length-1],n=e[0];if(i<=n)return To.isTypedArray(r)?To.concat(r,e):r.concat(e);var s=new r.constructor(r.length+e.length),c,l,h;for(c=0,l=r.length;ce[0]&&(t=r,r=e,e=t);var i=r[r.length-1],n=e[0];if(ie[0]&&(t=r,r=e,e=t);var i=r[r.length-1],n=e[0];if(ib?h=ln.lowerBound(e,v,h+1):(s.push(v),c++,h++);return s};function l4(r){var e=0,t=-1/0,i,n,s,c=[];for(n=0,s=r.length;nt&&(t=i));if(c.length===0)return new r[0].constructor(0);if(c.length===1)return c[0].slice();if(c.length===2)return C1(c[0],c[1]);r=c;var l=new r[0].constructor(e),h=To.getPointerArray(t),p=new h(r.length),v=new q1(function(T,q){return T=r[T][p[T]],q=r[q][p[q]],Tq?1:0});for(n=0;ne&&(e=t));if(s.length===0)return new r[0].constructor(0);if(s.length===1)return s[0].slice();if(s.length===2)return M1(s[0],s[1]);r=s;var c=new r[0].constructor,l=To.getPointerArray(e),h=new l(r.length),p=new q1(function(w,T){return w=r[w][h[w]],T=r[T][h[T]],wT?1:0});for(i=0;ie&&(e=c),n=r[l][0],s=r[l][c-1],n>t&&(t=n),si)return[];if(t===i)return[t];var p,v,b=r[0],w,T,q,M,L,D,N=t;for(l=1;lD?T=ln.lowerBound(v,L,T+1):(b.push(L),w++,T++);if(b.length===0)return b;N=b[0]}return b};Fi.merge=function(){if(arguments.length===2){if(Ao(arguments[0]))return C1(arguments[0],arguments[1])}else if(Ao(arguments[0]))return l4(arguments);return null};Fi.unionUnique=function(){if(arguments.length===2){if(Ao(arguments[0]))return M1(arguments[0],arguments[1])}else if(Ao(arguments[0]))return f4(arguments);return null};Fi.intersectionUnique=function(){if(arguments.length===2){if(Ao(arguments[0]))return Fi.intersectionUniqueArrays(arguments[0],arguments[1])}else if(Ao(arguments[0]))return Fi.kWayIntersectionUniqueArrays(arguments);return null}});var I1=_((kX,j1)=>{var h4=Ue(),p4=_e(),d4=x1();function L1(r){return r}function ht(r){if(this.clear(),Array.isArray(r)?(this.documentTokenizer=r[0],this.queryTokenizer=r[1]):(this.documentTokenizer=r,this.queryTokenizer=r),this.documentTokenizer||(this.documentTokenizer=L1),this.queryTokenizer||(this.queryTokenizer=L1),typeof this.documentTokenizer!="function")throw new Error("mnemonist/InvertedIndex.constructor: document tokenizer is not a function.");if(typeof this.queryTokenizer!="function")throw new Error("mnemonist/InvertedIndex.constructor: query tokenizer is not a function.")}ht.prototype.clear=function(){this.items=[],this.mapping=new Map,this.size=0,this.dimension=0};ht.prototype.add=function(r){this.size++;var e=this.items.length;this.items.push(r);var t=this.documentTokenizer(r);if(!Array.isArray(t))throw new Error("mnemonist/InvertedIndex.add: tokenizer function should return an array of tokens.");for(var i=new Set,n,s,c=0,l=t.length;c"u"||t.length===0)return[];if(e.length>1)for(n=1,s=e.length;n"u"||i.length===0)return[];t=d4.intersectionUniqueArrays(t,i)}var c=new Array(t.length);for(n=0,s=c.length;n1?e:this;for(var t=0,i=this.documents.length;t=e)return{done:!0};var i=r[t++];return{value:i,done:!1}})};ht.prototype.tokens=function(){return this.mapping.keys()};typeof Symbol<"u"&&(ht.prototype[Symbol.iterator]=ht.prototype.documents);ht.prototype.inspect=function(){var r=this.items.slice();return Object.defineProperty(r,"constructor",{value:ht,enumerable:!1}),r};typeof Symbol<"u"&&(ht.prototype[Symbol.for("nodejs.util.inspect.custom")]=ht.prototype.inspect);ht.from=function(r,e){var t=new ht(e);return p4(r,function(i){t.add(i)}),t};j1.exports=ht});var rm=_(tm=>{var Be=new Float64Array(64),Ae=new Float64Array(64);function v4(r,e,t){var i,n,s,c,l;for(Be[0]=e,Ae[0]=t,n=0;n>=0;)if(s=Be[n],c=Ae[n]-1,s=i&&sAe[n-1]-Be[n-1]&&(l=Be[n],Be[n]=Be[n-1],Be[n-1]=l,l=Ae[n],Ae[n]=Ae[n-1],Ae[n-1]=l)}else n--;return r}tm.inplaceQuickSort=v4;function m4(r,e,t,i){var n,s,c,l,h,p;for(Be[0]=t,Ae[0]=i,s=0;s>=0;)if(c=Be[s],l=Ae[s]-1,c=n&&cAe[s-1]-Be[s-1]&&(p=Be[s],Be[s]=Be[s-1],Be[s-1]=p,p=Ae[s],Ae[s]=Ae[s-1],Ae[s-1]=p)}else s--;return e}tm.inplaceQuickSortIndices=m4});var z1=_((zX,R1)=>{var y4=Ot(),Pf=ft(),F1=Ea().createTupleComparator,D1=bf(),g4=rm().inplaceQuickSortIndices;function im(r,e,t,i){var n,s=0,c;for(n=0;n>>1),q=t[T],c[N]=q,b>-1&&(w===0?l[b]=N+1:h[b]=N+1),D=(D+1)%r,T!==M&&T!==L-1&&p.push([D,T+1,L,N,1]),T!==M&&p.push([D,M,T,N,0]),N++;return{axes:e,labels:i,pivots:c,lefts:l,rights:h}}function Bt(r,e){this.dimensions=r,this.visited=0,this.axes=e.axes,this.labels=e.labels,this.pivots=e.pivots,this.lefts=e.lefts,this.rights=e.rights,this.size=this.labels.length}Bt.prototype.nearestNeighbor=function(r){var e=1/0,t=null,i=this.dimensions,n=this.axes,s=this.pivots,c=this.lefts,l=this.rights,h=0;function p(v,b){h++;var w=c[b],T=l[b],q=s[b],M=im(i,n,q,r);if(!(M0?w!==0&&p(v,w-1):T!==0&&p(v,T-1),L*L0?T!==0&&p(v,T-1):w!==0&&p(v,w-1))}}return p(0,0),this.visited=h,this.labels[t]};var _4=F1(3),P4=F1(2);Bt.prototype.kNearestNeighbors=function(r,e){if(r<=0)throw new Error("mnemonist/kd-tree.kNearestNeighbors: k should be a positive number.");if(r=Math.min(r,this.size),r===1)return[this.nearestNeighbor(e)];var t=new D1(Array,_4,r),i=this.dimensions,n=this.axes,s=this.pivots,c=this.lefts,l=this.rights,h=0;function p(w,T){var q=c[T],M=l[T],L=s[T],D=im(i,n,L,e);t.push([D,h++,L]);var N=e[w],Q=n[w][L],ie=N-Q;w=(w+1)%i,N{var N1=Ue(),w4=_e();function Oe(){this.clear()}Oe.prototype.clear=function(){this.head=null,this.tail=null,this.size=0};Oe.prototype.first=function(){return this.head?this.head.item:void 0};Oe.prototype.peek=Oe.prototype.first;Oe.prototype.last=function(){return this.tail?this.tail.item:void 0};Oe.prototype.push=function(r){var e={item:r,next:null};return this.head?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),this.size++,this.size};Oe.prototype.unshift=function(r){var e={item:r,next:null};return this.head?(this.head.next||(this.tail=this.head),e.next=this.head,this.head=e):(this.head=e,this.tail=e),this.size++,this.size};Oe.prototype.shift=function(){if(this.size){var r=this.head;return this.head=r.next,this.size--,r.item}};Oe.prototype.forEach=function(r,e){if(this.size){e=arguments.length>1?e:this;for(var t=this.head,i=0;t;)r.call(e,t.item,i,this),t=t.next,i++}};Oe.prototype.toArray=function(){if(!this.size)return[];for(var r=new Array(this.size),e=0,t=this.size,i=this.head;e{var nm=Ue(),O4=_e(),S4=ft(),T4=Ot();function Ie(r,e,t){if(arguments.length<2&&(t=r,r=null,e=null),this.capacity=t,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-cache: capacity should be a finite positive integer.");var i=S4.getPointerArray(t);this.forward=new i(t),this.backward=new i(t),this.K=typeof r=="function"?new r(t):new Array(t),this.V=typeof e=="function"?new e(t):new Array(t),this.size=0,this.head=0,this.tail=0,this.items={}}Ie.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}};Ie.prototype.splayOnTop=function(r){var e=this.head;if(this.head===r)return this;var t=this.backward[r],i=this.forward[r];return this.tail===r?this.tail=t:this.backward[i]=t,this.forward[t]=i,this.backward[e]=r,this.head=r,this.forward[r]=e,this};Ie.prototype.set=function(r,e){var t=this.items[r];if(typeof t<"u"){this.splayOnTop(t),this.V[t]=e;return}this.size"u"))return this.splayOnTop(e),this.V[e]};Ie.prototype.peek=function(r){var e=this.items[r];if(!(typeof e>"u"))return this.V[e]};Ie.prototype.forEach=function(r,e){e=arguments.length>1?e:this;for(var t=0,i=this.size,n=this.head,s=this.K,c=this.V,l=this.forward;t=e)return{done:!0};var s=i[t];return r++,r=e)return{done:!0};var s=i[t];return r++,r=e)return{done:!0};var c=i[t],l=n[t];return r++,r{var Eo=wf(),A4=_e(),E4=ft(),q4=Ot();function Tr(r,e,t){arguments.length<2?Eo.call(this,r):Eo.call(this,r,e,t);var i=E4.getPointerArray(this.capacity);this.deleted=new i(this.capacity),this.deletedSize=0}for(om in Eo.prototype)Tr.prototype[om]=Eo.prototype[om];var om;typeof Symbol<"u"&&(Tr.prototype[Symbol.iterator]=Eo.prototype[Symbol.iterator]);Tr.prototype.clear=function(){Eo.prototype.clear.call(this),this.deletedSize=0};Tr.prototype.set=function(r,e){var t=this.items[r];if(typeof t<"u"){this.splayOnTop(t),this.V[t]=e;return}this.size0?t=this.deleted[--this.deletedSize]:t=this.size,this.size++):(t=this.tail,this.tail=this.backward[t],delete this.items[this.K[t]]),this.items[r]=t,this.K[t]=r,this.V[t]=e,this.forward[t]=this.head,this.backward[this.head]=t,this.head=t};Tr.prototype.setpop=function(r,e){var t=null,i=null,n=this.items[r];return typeof n<"u"?(this.splayOnTop(n),t=this.V[n],this.V[n]=e,{evicted:!1,key:r,value:t}):(this.size0?n=this.deleted[--this.deletedSize]:n=this.size,this.size++):(n=this.tail,this.tail=this.backward[n],t=this.V[n],i=this.K[n],delete this.items[this.K[n]]),this.items[r]=n,this.K[n]=r,this.V[n]=e,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n,i?{evicted:!0,key:i,value:t}:null)};Tr.prototype.delete=function(r){var e=this.items[r];if(typeof e>"u")return!1;if(delete this.items[r],this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,!0;var t=this.backward[e],i=this.forward[e];return this.head===e&&(this.head=i),this.tail===e&&(this.tail=t),this.forward[t]=i,this.backward[i]=t,this.size--,this.deleted[this.deletedSize++]=e,!0};Tr.prototype.remove=function(r,e=void 0){var t=this.items[r];if(typeof t>"u")return e;var i=this.V[t];if(delete this.items[r],this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,i;var n=this.backward[t],s=this.forward[t];return this.head===t&&(this.head=s),this.tail===t&&(this.tail=n),this.forward[n]=s,this.backward[s]=n,this.size--,this.deleted[this.deletedSize++]=t,i};Tr.from=function(r,e,t,i){if(arguments.length<2){if(i=q4.guessLength(r),typeof i!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(i=e,e=null,t=null);var n=new Tr(e,t,i);return A4(r,function(s,c){n.set(c,s)}),n};B1.exports=Tr});var am=_((UX,H1)=>{var qo=wf(),C4=_e(),M4=ft(),x4=Ot();function Ze(r,e,t){if(arguments.length<2&&(t=r,r=null,e=null),this.capacity=t,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-map: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-map: capacity should be a finite positive integer.");var i=M4.getPointerArray(t);this.forward=new i(t),this.backward=new i(t),this.K=typeof r=="function"?new r(t):new Array(t),this.V=typeof e=="function"?new e(t):new Array(t),this.size=0,this.head=0,this.tail=0,this.items=new Map}Ze.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()};Ze.prototype.set=function(r,e){var t=this.items.get(r);if(typeof t<"u"){this.splayOnTop(t),this.V[t]=e;return}this.size"u"))return this.splayOnTop(e),this.V[e]};Ze.prototype.peek=function(r){var e=this.items.get(r);if(!(typeof e>"u"))return this.V[e]};Ze.prototype.splayOnTop=qo.prototype.splayOnTop;Ze.prototype.forEach=qo.prototype.forEach;Ze.prototype.keys=qo.prototype.keys;Ze.prototype.values=qo.prototype.values;Ze.prototype.entries=qo.prototype.entries;typeof Symbol<"u"&&(Ze.prototype[Symbol.iterator]=Ze.prototype.entries);Ze.prototype.inspect=qo.prototype.inspect;Ze.from=function(r,e,t,i){if(arguments.length<2){if(i=x4.guessLength(r),typeof i!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(i=e,e=null,t=null);var n=new Ze(e,t,i);return C4(r,function(s,c){n.set(c,s)}),n};H1.exports=Ze});var Q1=_((BX,$1)=>{var Co=am(),L4=_e(),j4=ft(),I4=Ot();function Ar(r,e,t){arguments.length<2?Co.call(this,r):Co.call(this,r,e,t);var i=j4.getPointerArray(this.capacity);this.deleted=new i(this.capacity),this.deletedSize=0}for(sm in Co.prototype)Ar.prototype[sm]=Co.prototype[sm];var sm;typeof Symbol<"u"&&(Ar.prototype[Symbol.iterator]=Co.prototype[Symbol.iterator]);Ar.prototype.clear=function(){Co.prototype.clear.call(this),this.deletedSize=0};Ar.prototype.set=function(r,e){var t=this.items.get(r);if(typeof t<"u"){this.splayOnTop(t),this.V[t]=e;return}this.size0?t=this.deleted[--this.deletedSize]:t=this.size,this.size++):(t=this.tail,this.tail=this.backward[t],this.items.delete(this.K[t])),this.items.set(r,t),this.K[t]=r,this.V[t]=e,this.forward[t]=this.head,this.backward[this.head]=t,this.head=t};Ar.prototype.setpop=function(r,e){var t=null,i=null,n=this.items.get(r);return typeof n<"u"?(this.splayOnTop(n),t=this.V[n],this.V[n]=e,{evicted:!1,key:r,value:t}):(this.size0?n=this.deleted[--this.deletedSize]:n=this.size,this.size++):(n=this.tail,this.tail=this.backward[n],t=this.V[n],i=this.K[n],this.items.delete(this.K[n])),this.items.set(r,n),this.K[n]=r,this.V[n]=e,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n,i?{evicted:!0,key:i,value:t}:null)};Ar.prototype.delete=function(r){var e=this.items.get(r);if(typeof e>"u")return!1;if(this.items.delete(r),this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,!0;var t=this.backward[e],i=this.forward[e];return this.head===e&&(this.head=i),this.tail===e&&(this.tail=t),this.forward[t]=i,this.backward[i]=t,this.size--,this.deleted[this.deletedSize++]=e,!0};Ar.prototype.remove=function(r,e=void 0){var t=this.items.get(r);if(typeof t>"u")return e;var i=this.V[t];if(this.items.delete(r),this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,i;var n=this.backward[t],s=this.forward[t];return this.head===t&&(this.head=s),this.tail===t&&(this.tail=n),this.forward[n]=s,this.backward[s]=n,this.size--,this.deleted[this.deletedSize++]=t,i};Ar.from=function(r,e,t,i){if(arguments.length<2){if(i=I4.guessLength(r),typeof i!="number")throw new Error("mnemonist/lru-map.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(i=e,e=null,t=null);var n=new Ar(e,t,i);return L4(r,function(s,c){n.set(c,s)}),n};$1.exports=Ar});var Y1=_((GX,K1)=>{var F4=Ue(),D4=_e(),k4=bf(),R4=function(r,e){return r[1]>e[1]?-1:r[1]"u")){var i=Math.max(0,t-e);i===0?(this.items.delete(r),this.size-=t,this.dimension--):(this.items.set(r,i),this.size-=e)}}};ae.prototype.edit=function(r,e){var t=this.multiplicity(r);if(t!==0){var i=this.multiplicity(e);return this.items.set(e,t+i),this.items.delete(r),this}};ae.prototype.multiplicity=function(r){var e=this.items.get(r);return typeof e>"u"?0:e};ae.prototype.get=ae.prototype.multiplicity;ae.prototype.count=ae.prototype.multiplicity;ae.prototype.frequency=function(r){if(this.size===0)return 0;var e=this.multiplicity(r);return e/this.size};ae.prototype.top=function(r){if(typeof r!="number"||r<=0)throw new Error("mnemonist/multi-set.top: n must be a number > 0.");for(var e=new k4(Array,R4,r),t=this.items.entries(),i;i=t.next(),!i.done;)e.push(i.value);return e.consume()};ae.prototype.forEach=function(r,e){e=arguments.length>1?e:this;var t;this.items.forEach(function(i,n){for(t=0;t1?e:this,this.items.forEach(r,e)};ae.prototype.keys=function(){return this.items.keys()};ae.prototype.values=function(){var r=this.items.entries(),e=!1,t,i,n,s;return new F4(function c(){if(!e){if(t=r.next(),t.done)return{done:!0};e=!0,i=t.value[0],n=t.value[1],s=0}return s>=n?(e=!1,c()):(s++,{done:!1,value:i})})};ae.prototype.multiplicities=function(){return this.items.entries()};typeof Symbol<"u"&&(ae.prototype[Symbol.iterator]=ae.prototype.values);ae.prototype.inspect=function(){return this.items};typeof Symbol<"u"&&(ae.prototype[Symbol.for("nodejs.util.inspect.custom")]=ae.prototype.inspect);ae.prototype.toJSON=function(){return this.items};ae.from=function(r){var e=new ae;return D4(r,function(t){e.add(t)}),e};ae.isSubset=function(r,e){var t=r.multiplicities(),i,n,s;if(r===e)return!0;if(r.dimension>e.dimension)return!1;for(;i=t.next(),!i.done;)if(n=i.value[0],s=i.value[1],e.multiplicity(n){var z4=Ue(),N4=_e();function V4(r,e,t){return((Math.pow(r,2)-Math.pow(Math.abs(e-t),2))/2|0)+r+1}function W4(r,e){for(var t=0,i=0,n=e+1;ie.length?-1:r.lengthe?1:0}function X1(r,e){var t=r+1,i=e/t|0,n=i+1,s,c,l=e-i*t,h=t-l,p=new Array(r+1);for(s=0;s 0");this.levenshtein=r,this.k=e,this.clear()}xe.prototype.clear=function(){this.size=0,this.strings=[],this.invertedIndices={}};xe.prototype.add=function(r){var e=r.length,t=this.size;this.strings.push(r),this.size++;var i=J1(this.k,r),n=this.invertedIndices[e];typeof n>"u"&&(n={},this.invertedIndices[e]=n);var s,c,l,h,p;for(h=0,p=i.length;h"u"?(c=[t],n[l]=c):c.push(t);return this};xe.prototype.search=function(r){var e=r.length,t=this.k,i=new Set,n,s,c,l,h,p,v,b,w,T,q,M,L,D,N;for(b=Math.max(0,e-t),w=e+t+1;b"u")){for(v=X1(t,b),T=0,q=v.length;T"u"))for(D=0,N=n.length;D1?e:this;for(var t=0,i=this.strings.length;t=e)return{done:!0};var i=r[t];return t++,{value:i,done:!1}})};typeof Symbol<"u"&&(xe.prototype[Symbol.iterator]=xe.prototype.values);xe.prototype.inspect=function(){var r=this.strings.slice();return Object.defineProperty(r,"constructor",{value:xe,enumerable:!1}),r};typeof Symbol<"u"&&(xe.prototype[Symbol.for("nodejs.util.inspect.custom")]=xe.prototype.inspect);xe.from=function(r,e,t){var i=new xe(e,t);return N4(r,function(n){i.add(n)}),i};xe.countKeys=W4;xe.comparator=U4;xe.partition=X1;xe.segments=J1;xe.segmentPos=B4;xe.multiMatchAwareInterval=Z1;xe.multiMatchAwareSubstrings=ew;tw.exports=xe});var ow=_(($X,nw)=>{var iw=Ue(),G4=_e();function Le(){this.clear()}Le.prototype.clear=function(){this.items=[],this.offset=0,this.size=0};Le.prototype.enqueue=function(r){return this.items.push(r),++this.size};Le.prototype.dequeue=function(){if(this.size){var r=this.items[this.offset];return++this.offset*2>=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,r}};Le.prototype.peek=function(){if(this.size)return this.items[this.offset]};Le.prototype.forEach=function(r,e){e=arguments.length>1?e:this;for(var t=this.offset,i=0,n=this.items.length;t=r.length)return{done:!0};var t=r[e];return e++,{value:t,done:!1}})};Le.prototype.entries=function(){var r=this.items,e=this.offset,t=0;return new iw(function(){if(e>=r.length)return{done:!0};var i=r[e];return e++,{value:[t++,i],done:!1}})};typeof Symbol<"u"&&(Le.prototype[Symbol.iterator]=Le.prototype.values);Le.prototype.toString=function(){return this.toArray().join(",")};Le.prototype.toJSON=function(){return this.toArray()};Le.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:Le,enumerable:!1}),r};typeof Symbol<"u"&&(Le.prototype[Symbol.for("nodejs.util.inspect.custom")]=Le.prototype.inspect);Le.from=function(r){var e=new Le;return G4(r,function(t){e.enqueue(t)}),e};Le.of=function(){return Le.from(arguments)};nw.exports=Le});var uw=_((QX,sw)=>{var aw=Ue(),H4=_e();function je(){this.clear()}je.prototype.clear=function(){this.items=[],this.size=0};je.prototype.push=function(r){return this.items.push(r),++this.size};je.prototype.pop=function(){if(this.size!==0)return this.size--,this.items.pop()};je.prototype.peek=function(){return this.items[this.size-1]};je.prototype.forEach=function(r,e){e=arguments.length>1?e:this;for(var t=0,i=this.items.length;t=e)return{done:!0};var i=r[e-t-1];return t++,{value:i,done:!1}})};je.prototype.entries=function(){var r=this.items,e=r.length,t=0;return new aw(function(){if(t>=e)return{done:!0};var i=r[e-t-1];return{value:[t++,i],done:!1}})};typeof Symbol<"u"&&(je.prototype[Symbol.iterator]=je.prototype.values);je.prototype.toString=function(){return this.toArray().join(",")};je.prototype.toJSON=function(){return this.toArray()};je.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:je,enumerable:!1}),r};typeof Symbol<"u"&&(je.prototype[Symbol.for("nodejs.util.inspect.custom")]=je.prototype.inspect);je.from=function(r){var e=new je;return H4(r,function(t){e.push(t)}),e};je.of=function(){return je.from(arguments)};sw.exports=je});var cw=_(Ne=>{Ne.intersection=function(){if(arguments.length<2)throw new Error("mnemonist/Set.intersection: needs at least two arguments.");var r=new Set,e=1/0,t=null,i,n,s=arguments.length;for(n=0;ne.size)return!1;for(;i=t.next(),!i.done;)if(!e.has(i.value))return!1;return!0};Ne.isSuperset=function(r,e){return Ne.isSubset(e,r)};Ne.add=function(r,e){for(var t=e.values(),i;i=t.next(),!i.done;)r.add(i.value)};Ne.subtract=function(r,e){for(var t=e.values(),i;i=t.next(),!i.done;)r.delete(i.value)};Ne.intersect=function(r,e){for(var t=r.values(),i;i=t.next(),!i.done;)e.has(i.value)||r.delete(i.value)};Ne.disjunct=function(r,e){for(var t=r.values(),i,n=[];i=t.next(),!i.done;)e.has(i.value)&&n.push(i.value);for(t=e.values();i=t.next(),!i.done;)r.has(i.value)||r.add(i.value);for(var s=0,c=n.length;se.size&&(t=r,r=e,e=t),r.size===0)return 0;if(r===e)return r.size;for(var i=r.values(),n,s=0;n=i.next(),!n.done;)e.has(n.value)&&s++;return s};Ne.unionSize=function(r,e){var t=Ne.intersectionSize(r,e);return r.size+e.size-t};Ne.jaccard=function(r,e){var t=Ne.intersectionSize(r,e);if(t===0)return 0;var i=r.size+e.size-t;return t/i};Ne.overlap=function(r,e){var t=Ne.intersectionSize(r,e);return t===0?0:t/Math.min(r.size,e.size)}});var fw=_((YX,lw)=>{var $4=Ue(),Q4=ft().getPointerArray;function jt(r){var e=Q4(r);this.start=0,this.size=0,this.capacity=r,this.dense=new e(r),this.sparse=new e(r)}jt.prototype.clear=function(){this.start=0,this.size=0};jt.prototype.has=function(r){if(this.size===0)return!1;var e=this.sparse[r],t=e=this.start&&e=this.start&&e1?e:this;for(var t=this.capacity,i=this.size,n=this.start,s=0;s=t)return{done:!0};var s=r[i];return i++,n++,i===e&&(i=0),{value:s,done:!1}})};typeof Symbol<"u"&&(jt.prototype[Symbol.iterator]=jt.prototype.values);jt.prototype.inspect=function(){var r=[];return this.forEach(function(e){r.push(e)}),Object.defineProperty(r,"constructor",{value:jt,enumerable:!1}),r.capacity=this.capacity,r};typeof Symbol<"u"&&(jt.prototype[Symbol.for("nodejs.util.inspect.custom")]=jt.prototype.inspect);lw.exports=jt});var pw=_((XX,hw)=>{var um=Ue(),K4=ft().getPointerArray;function ot(r,e){arguments.length<2&&(e=r,r=Array);var t=K4(e);this.size=0,this.length=e,this.dense=new t(e),this.sparse=new t(e),this.vals=new r(e)}ot.prototype.clear=function(){this.size=0};ot.prototype.has=function(r){var e=this.sparse[r];return e=this.size||this.dense[e]!==r?!1:(e=this.dense[this.size-1],this.dense[this.sparse[r]]=e,this.sparse[e]=this.sparse[r],this.size--,!0)};ot.prototype.forEach=function(r,e){e=arguments.length>1?e:this;for(var t=0;t{var Y4=Ue(),X4=ft().getPointerArray;function It(r){var e=X4(r);this.size=0,this.length=r,this.dense=new e(r),this.sparse=new e(r)}It.prototype.clear=function(){this.size=0};It.prototype.has=function(r){var e=this.sparse[r];return e=this.size||this.dense[e]!==r?!1:(e=this.dense[this.size-1],this.dense[this.sparse[r]]=e,this.sparse[e]=this.sparse[r],this.size--,!0)};It.prototype.forEach=function(r,e){e=arguments.length>1?e:this;for(var t,i=0;i{var J4=_e(),Z4=2,e5=2,t5=new Set([0,1,2]),r5={0:"Returns only the top suggestion",1:"Returns suggestions with the smallest edit distance",2:"Returns every suggestion (no early termination)"};function Of(r){var e=new Set;return typeof r=="number"&&e.add(r),{suggestions:e,count:0}}function mw(r,e,t){return{term:r||"",distance:e||0,count:t||0}}function gw(r,e,t,i){i=i||new Set,e++;var n,s=r.length,c;if(s>1)for(c=0;c0&&r[c].length-s.length>i.length-s.length&&(t.suggestions=new Set,t.count=0),(e===2||!t.suggestions.size||r[c].length-s.length>=i.length-s.length)&&t.suggestions.add(n)}function yw(r,e){var t=r.length,i=e.length,n=[[]],s=t+i,c=new Map,l,h,p;for(n[0][0]=s,l=0;l<=t;l++)n[l+1]||(n[l+1]=[]),n[l+1][1]=l,n[l+1][0]=s;for(p=0;p<=i;p++)n[1][p+1]=p,n[0][p+1]=s;var v=r+e,b;for(l=0,h=v.length;ln)return[];for(var l=[s],h=new Set,p=new Set,v=[],b,w;l.length>0&&(b=l.shift(),!(t<2&&v.length>0&&c-b.length>v[0].distance));){if(w=r[b],w!==void 0){if(typeof w=="number"&&(w=Of(w)),w.count>0&&!p.has(b)){p.add(b);var T=mw(b,c-b.length,w.count);if(v.push(T),t<2&&c-b.length===0)break}w.suggestions.forEach(D=>{var N=e[D];if(!p.has(N)){p.add(N);var Q=0;if(s!==N)if(N.length===b.length)Q=c-b.length;else if(c===b.length)Q=N.length-b.length;else{for(var ie=0,pe=0,Fe=N.length;ie0||pe>0?Q=yw(N.substr(ie,Fe-ie-pe),s.substr(ie,c-ie-pe)):Q=yw(N,s)}if(t<2&&v.length>0&&v[0].distance>Q&&(v=[]),!(t<2&&v.length>0&&Q>v[0].distance)&&Q<=i){var pt=r[N];pt!==void 0&&v.push(mw(N,Q,pt.count))}}})}if(c-b.length0&&c-b.length>=v[0].distance)continue;for(var q=0,M=b.length;qthis.maxLength&&(this.maxLength=r.length)),e.count===1){var t=this.words.length;this.words.push(r);var i=gw(r,0,this.maxDistance);i.forEach(n=>{var s=this.dictionary[n];s!==void 0?(typeof s=="number"&&(s=Of(s),this.dictionary[n]=s),s.suggestions.has(t)||i5(this.words,this.verbosity,s,r,t,n)):this.dictionary[n]=t})}return this.size++,this};Er.prototype.search=function(r){return n5(this.dictionary,this.words,this.verbosity,this.maxDistance,this.maxLength,r)};Er.prototype.inspect=function(){var r=[];r.size=this.size,r.maxDistance=this.maxDistance,r.verbosity=this.verbosity,r.behavior=r5[this.verbosity];for(var e in this.dictionary)typeof this.dictionary[e]=="object"&&this.dictionary[e].count&&r.push([e,this.dictionary[e].count]);return Object.defineProperty(r,"constructor",{value:Er,enumerable:!1}),r};typeof Symbol<"u"&&(Er.prototype[Symbol.for("nodejs.util.inspect.custom")]=Er.prototype.inspect);Er.from=function(r,e){var t=new Er(e);return J4(r,function(i){t.add(i)}),t};bw.exports=Er});var cm=_((e9,Pw)=>{var o5=_e(),Mo=Ue(),Ge=String.fromCharCode(0);function Se(r){this.mode=r===Array?"array":"string",this.clear()}Se.prototype.clear=function(){this.root={},this.size=0};Se.prototype.set=function(r,e){for(var t=this.root,i,n=0,s=r.length;n"u")return;if(Ge in e)return e[Ge]};Se.prototype.delete=function(r){var e=this.root,t=null,i=null,n,s,c,l;for(c=0,l=r.length;c"u")return!1;t!==null?Object.keys(e).length>1&&(t=null,i=null):Object.keys(e).length<2&&(t=n,i=s)}return Ge in e?(this.size--,t?delete t[i]:delete e[Ge],!0):!1};Se.prototype.has=function(r){for(var e=this.root,t,i=0,n=r.length;i"u")return!1;return Ge in e};Se.prototype.find=function(r){var e=typeof r=="string",t=this.root,i=[],n,s,c;for(s=0,c=r.length;s"u")return i;for(var l=[t],h=[r],p;l.length;){r=h.pop(),t=l.pop();for(p in t){if(p===Ge){i.push([r,t[Ge]]);continue}l.push(t[p]),h.push(e?r+p:r.concat(p))}}return i};Se.prototype.values=function(r){var e=this.root,t=[],i,n,s;if(r){for(n=0,s=r.length;n"u")return Mo.empty()}return t.push(e),new Mo(function(){for(var c,l=!1,h;t.length;){c=t.pop();for(h in c){if(h===Ge){l=!0;continue}t.push(c[h])}if(l)return{done:!1,value:c[Ge]}}return{done:!0}})};Se.prototype.prefixes=function(r){var e=this.root,t=[],i=[],n,s,c,l=this.mode==="string";if(r){for(s=0,c=r.length;s"u")return Mo.empty()}else r=l?"":[];return t.push(e),i.push(r),new Mo(function(){for(var h,p,v=!1,b;t.length;){h=t.pop(),p=i.pop();for(b in h){if(b===Ge){v=!0;continue}t.push(h[b]),i.push(l?p+b:p.concat(b))}if(v)return{done:!1,value:p}}return{done:!0}})};Se.prototype.keys=Se.prototype.prefixes;Se.prototype.entries=function(r){var e=this.root,t=[],i=[],n,s,c,l=this.mode==="string";if(r){for(s=0,c=r.length;s"u")return Mo.empty()}else r=l?"":[];return t.push(e),i.push(r),new Mo(function(){for(var h,p,v=!1,b;t.length;){h=t.pop(),p=i.pop();for(b in h){if(b===Ge){v=!0;continue}t.push(h[b]),i.push(l?p+b:p.concat(b))}if(v)return{done:!1,value:[p,h[Ge]]}}return{done:!0}})};typeof Symbol<"u"&&(Se.prototype[Symbol.iterator]=Se.prototype.entries);Se.prototype.inspect=function(){for(var r=new Array(this.size),e=this.entries(),t,i=0;t=e.next(),!t.done;)r[i++]=t.value;return Object.defineProperty(r,"constructor",{value:Se,enumerable:!1}),r};typeof Symbol<"u"&&(Se.prototype[Symbol.for("nodejs.util.inspect.custom")]=Se.prototype.inspect);Se.prototype.toJSON=function(){return this.root};Se.from=function(r){var e=new Se;return o5(r,function(t,i){e.set(i,t)}),e};Se.SENTINEL=Ge;Pw.exports=Se});var Sw=_((t9,Ow)=>{var a5=_e(),ww=cm(),Sf=String.fromCharCode(0);function He(r){this.mode=r===Array?"array":"string",this.clear()}for(lm in ww.prototype)He.prototype[lm]=ww.prototype[lm];var lm;delete He.prototype.set;delete He.prototype.get;delete He.prototype.values;delete He.prototype.entries;He.prototype.add=function(r){for(var e=this.root,t,i=0,n=r.length;i"u")return i;for(var l=[t],h=[r],p;l.length;){r=h.pop(),t=l.pop();for(p in t){if(p===Sf){i.push(r);continue}l.push(t[p]),h.push(e?r+p:r.concat(p))}}return i};typeof Symbol<"u"&&(He.prototype[Symbol.iterator]=He.prototype.keys);He.prototype.inspect=function(){for(var r=new Set,e=this.keys(),t;t=e.next(),!t.done;)r.add(t.value);return Object.defineProperty(r,"constructor",{value:He,enumerable:!1}),r};typeof Symbol<"u"&&(He.prototype[Symbol.for("nodejs.util.inspect.custom")]=He.prototype.inspect);He.prototype.toJSON=function(){return this.root};He.from=function(r){var e=new He;return a5(r,function(t){e.add(t)}),e};He.SENTINEL=Sf;Ow.exports=He});var qw=_((r9,Ew)=>{var Tw=Ue(),s5=_e(),u5=Ot(),Aw=ft(),c5=function(r){return Math.max(1,Math.ceil(r*1.5))},l5=function(r){var e=Aw.getPointerArray(r);return new e(r)};function oe(r,e){if(arguments.length<1)throw new Error("mnemonist/vector: expecting at least a byte array constructor.");var t=e||0,i=c5,n=0,s=!1;typeof e=="object"&&(t=e.initialCapacity||0,n=e.initialLength||0,i=e.policy||i,s=e.factory===!0),this.factory=s?r:null,this.ArrayClass=r,this.length=n,this.capacity=Math.max(n,t),this.policy=i,this.array=new r(this.capacity)}oe.prototype.set=function(r,e){if(this.lengththis.capacity)if(this.factory===null?this.array=new this.ArrayClass(r):this.array=this.factory(r),Aw.isTypedArray(this.array))this.array.set(e,0);else for(var t=0,i=this.length;t=r)return this;for(e=this.capacity;e=e)return{done:!0};var i=r[t];return t++,{value:i,done:!1}})};oe.prototype.entries=function(){var r=this.array,e=this.length,t=0;return new Tw(function(){if(t>=e)return{done:!0};var i=r[t];return{value:[t++,i],done:!1}})};typeof Symbol<"u"&&(oe.prototype[Symbol.iterator]=oe.prototype.values);oe.prototype.inspect=function(){var r=this.array.slice(0,this.length);return r.type=this.array.constructor.name,r.items=this.length,r.capacity=this.capacity,Object.defineProperty(r,"constructor",{value:oe,enumerable:!1}),r};typeof Symbol<"u"&&(oe.prototype[Symbol.for("nodejs.util.inspect.custom")]=oe.prototype.inspect);oe.from=function(r,e,t){if(arguments.length<3&&(t=u5.guessLength(r),typeof t!="number"))throw new Error("mnemonist/vector.from: could not guess iterable length. Please provide desired capacity as last argument.");var i=new oe(e,t);return s5(r,function(n){i.push(n)}),i};function qr(r){var e=function(i){oe.call(this,r,i)};for(var t in oe.prototype)oe.prototype.hasOwnProperty(t)&&(e.prototype[t]=oe.prototype[t]);return e.from=function(i,n){return oe.from(i,r,n)},typeof Symbol<"u"&&(e.prototype[Symbol.iterator]=e.prototype.values),e}oe.Int8Vector=qr(Int8Array);oe.Uint8Vector=qr(Uint8Array);oe.Uint8ClampedVector=qr(Uint8ClampedArray);oe.Int16Vector=qr(Int16Array);oe.Uint16Vector=qr(Uint16Array);oe.Int32Vector=qr(Int32Array);oe.Uint32Vector=qr(Uint32Array);oe.Float32Vector=qr(Float32Array);oe.Float64Vector=qr(Float64Array);oe.PointerVector=qr(l5);Ew.exports=oe});var Mw=_((i9,Cw)=>{var f5=Ot(),h5=ft(),p5=rm().inplaceQuickSortIndices,d5=em().lowerBoundIndices,v5=gf(),m5=h5.getPointerArray;function y5(r,e){return r.distancee.distance?-1:0}function g5(r,e,t){for(var i=t.length,n=m5(i),s=0,c=new n(i),l=new n(i),h=new n(i),p=new Float64Array(i),v=[0,0,i],b=new Float64Array(i),w,T,q,M,L,D,N,Q,ie;v.length;)if(L=v.pop(),M=v.pop(),w=v.pop(),T=t[L-1],L--,ie=L-M,c[w]=T,ie!==0){if(ie===1){N=r(e[T],e[t[M]]),p[w]=N,s++,h[w]=s,c[s]=t[M];continue}for(Q=M;Q0&&(s++,h[w]=s,v.push(s,D,L)),D-M>0&&(s++,l[w]=s,v.push(s,M,D))}return{nodes:c,lefts:l,rights:h,mus:p}}function Qr(r,e){if(typeof r!="function")throw new Error("mnemonist/VPTree.constructor: given `distance` must be a function.");if(!e)throw new Error("mnemonist/VPTree.constructor: you must provide items to the tree. A VPTree cannot be updated after its creation.");this.distance=r,this.heap=new v5(y5),this.D=0;var t=f5.toArrayWithIndices(e);this.items=t[0];var i=t[1];this.size=i.length;var n=g5(r,this.items,i);this.nodes=n.nodes,this.lefts=n.lefts,this.rights=n.rights,this.mus=n.mus}Qr.prototype.nearestNeighbors=function(r,e){var t=this.heap,i=[0],n=1/0,s,c,l,h,p,v,b;for(this.D=0;i.length;)s=i.pop(),c=this.nodes[s],l=this.items[c],b=this.distance(l,e),this.D++,br&&t.pop(),t.size>=r&&(n=t.peek().distance)),h=this.lefts[s],p=this.rights[s],!(!h&&!p)&&(v=this.mus[s],b=v-n&&i.push(p)):(p&&b>=v-n&&i.push(p),h&&b=0;T--)w[T]=t.pop();return w};Qr.prototype.neighbors=function(r,e){var t=[],i=[0],n,s,c,l,h,p,v;for(this.D=0;i.length;)n=i.pop(),s=this.nodes[n],c=this.items[s],v=this.distance(c,e),this.D++,v<=r&&t.push({distance:v,item:c}),l=this.lefts[n],h=this.rights[n],!(!l&&!h)&&(p=this.mus[n],v=p-r&&i.push(h)):(h&&v>=p-r&&i.push(h),l&&v{var fm=gf(),hm=lf(),xw=CP();Lw.exports={BiMap:IP(),BitSet:VP(),BitVector:GP(),BloomFilter:XP(),BKTree:ZP(),CircularBuffer:n1(),DefaultMap:a1(),DefaultWeakMap:u1(),FixedDeque:Gv(),StaticDisjointSet:l1(),FibonacciHeap:hm,MinFibonacciHeap:hm.MinFibonacciHeap,MaxFibonacciHeap:hm.MaxFibonacciHeap,FixedReverseHeap:bf(),FuzzyMap:m1(),FuzzyMultiMap:_1(),HashedArrayTree:O1(),Heap:fm,MinHeap:fm.MinHeap,MaxHeap:fm.MaxHeap,StaticIntervalTree:E1(),InvertedIndex:I1(),KDTree:z1(),LinkedList:W1(),LRUCache:wf(),LRUCacheWithDelete:G1(),LRUMap:am(),LRUMapWithDelete:Q1(),MultiMap:Yv(),MultiSet:Y1(),PassjoinIndex:rw(),Queue:ow(),FixedStack:Jv(),Stack:uw(),SuffixArray:xw,GeneralizedSuffixArray:xw.GeneralizedSuffixArray,Set:cw(),SparseQueueSet:fw(),SparseMap:pw(),SparseSet:vw(),SymSpell:_w(),Trie:Sw(),TrieMap:cm(),Vector:qw(),VPTree:Mw()}});var D5={};UM(D5,{ArrayTilemap:()=>Rf,CharacterShiftAction:()=>Lf,CollisionStrategy:()=>Sa,Direction:()=>bt,GridEngine:()=>Ra,GridEngineHeadless:()=>Fa,MoveToResult:()=>Ff,NoPathFoundStrategy:()=>an,NumberOfDirections:()=>zr,PathBlockedStrategy:()=>_o,PhaserTile:()=>ki,PhaserTileLayer:()=>ko,PhaserTilemap:()=>ka,QueuedPathBlockedStrategy:()=>mm,TiledLayer:()=>zo,TiledTile:()=>Ro,TiledTilemap:()=>zf,default:()=>F5,directionFromPos:()=>rt});module.exports=BM(D5);var k=class r{static get ZERO(){return new r(0,0)}static get ONE(){return new r(1,1)}static get UP(){return new r(0,-1)}static get DOWN(){return new r(0,1)}static get LEFT(){return new r(-1,0)}static get RIGHT(){return new r(1,0)}static get UP_LEFT(){return new r(-1,-1)}static get UP_RIGHT(){return new r(1,-1)}static get DOWN_RIGHT(){return new r(1,1)}static get DOWN_LEFT(){return new r(-1,1)}constructor(e,t){typeof e=="number"?(this.x=e,this.y=t||0):(this.x=e.x,this.y=e.y)}clone(){return new r(this.x,this.y)}add(e){return new r(this.x+e.x,this.y+e.y)}multiply(e){return new r(this.x*e.x,this.y*e.y)}divide(e){return new r(this.x/e.x,this.y/e.y)}subtract(e){return new r(this.x-e.x,this.y-e.y)}equals(e){return this.x===e.x&&this.y===e.y}abs(){return new r(Math.abs(this.x),Math.abs(this.y))}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}modulo(e){return new r(this.x%e.x,this.y%e.y)}scalarModulo(e){return new r(this.x%e,this.y%e)}scalarMult(e){return new r(this.x*e,this.y*e)}toPosition(){return{x:this.x,y:this.y}}toString(){return`${this.x}#${this.y}`}};var $=class{static equal(e,t){return e.position.x===t.position.x&&e.position.y===t.position.y&&e.layer===t.layer}static copyOver(e,t){t.position.x=e.position.x,t.position.y=e.position.y,t.layer=e.layer}static clone(e){return{position:e.position.clone(),layer:e.layer}}static toString(e){return`${e.position.toString()}#${e.layer}`}static toInternal(e){return{position:new k(e.position.x,e.position.y),layer:e.charLayer}}static fromInternal(e){return{position:e.position.toPosition(),charLayer:e.layer}}};var bt=(p=>(p.NONE="none",p.LEFT="left",p.UP_LEFT="up-left",p.UP="up",p.UP_RIGHT="up-right",p.RIGHT="right",p.DOWN_RIGHT="down-right",p.DOWN="down",p.DOWN_LEFT="down-left",p))(bt||{}),GM={up:"down",down:"up",left:"right",right:"left",none:"none","up-left":"down-right","up-right":"down-left","down-right":"up-left","down-left":"up-right"},HM={up:k.UP,down:k.DOWN,left:k.LEFT,right:k.RIGHT,none:k.ZERO,"up-left":k.UP_LEFT,"up-right":k.UP_RIGHT,"down-right":k.DOWN_RIGHT,"down-left":k.DOWN_LEFT},$M={left:"up-left","up-left":"up",up:"up-right","up-right":"right",right:"down-right","down-right":"down",down:"down-left","down-left":"left",none:"none"},QM={left:"down-left","up-left":"left",up:"up-left","up-right":"up",right:"up-right","down-right":"right",down:"down-right","down-left":"down",none:"none"},KM=["down-left","down-right","up-right","up-left"];function ca(){return["up","down","left","right","none","up-left","up-right","down-right","down-left"]}function En(r){return KM.includes(r)}function up(r){return["left","right"].includes(r)}function tb(r){return["up","down"].includes(r)}function rb(r){return QM[r]}function js(r){return $M[r]}function Xt(r){return HM[r]}function ib(r){return GM[r]}function rt(r,e){if(r.x===e.x){if(r.y>e.y)return"up";if(r.ye.x)return"left";if(r.xe.x){if(r.ye.y)return"up-left"}else if(r.xe.y)return"up-right"}return"none"}var zr=(t=>(t[t.FOUR=4]="FOUR",t[t.EIGHT=8]="EIGHT",t))(zr||{});function ai(r){return typeof r=="string"&&ca().includes(r)}var Hr=gt(Mi(),1);var on=1e3,rf=class{constructor(e,t){this.id=e;this.movementDirection="none";this._tilePos={position:new k(0,0),layer:void 0};this.movementStarted$=new Hr.Subject;this.movementStopped$=new Hr.Subject;this.directionChanged$=new Hr.Subject;this.positionChangeStarted$=new Hr.Subject;this.positionChangeFinished$=new Hr.Subject;this.tilePositionSet$=new Hr.Subject;this.autoMovementSet$=new Hr.Subject;this.lastMovementImpulse="none";this.facingDirection="down";this.depthChanged$=new Hr.Subject;this.movementProgress=0;this.tilemap=t.tilemap,this.speed=t.speed,this.collidesWithTilesInternal=t.collidesWithTiles,this._tilePos.layer=t.charLayer,this.ignoreMissingTiles=t.ignoreMissingTiles??!1,this.collisionGroups=new Set(t.collisionGroups||[]),this.labels=new Set(t.labels||[]),this.numberOfDirections=t.numberOfDirections,t.facingDirection&&this.turnTowards(t.facingDirection),this.tileWidth=t.tileWidth??1,this.tileHeight=t.tileHeight??1}getId(){return this.id}getSpeed(){return this.speed}setSpeed(e){this.speed=e}setMovement(e){this.autoMovementSet$.next(e),this.movement=e}getMovement(){return this.movement}collidesWithTiles(){return this.collidesWithTilesInternal}getIgnoreMissingTiles(){return this.ignoreMissingTiles}setTilePosition(e){this.isMoving()&&this.movementStopped$.next(this.movementDirection),this.tilePositionSet$.next({...e}),this.fire(this.positionChangeStarted$,this.tilePos,e),this.fire(this.positionChangeFinished$,this.tilePos,e),this.movementDirection="none",this.lastMovementImpulse="none",this.tilePos=e,this.movementProgress=0}getTilePos(){return this.tilePos}getNextTilePos(){if(!this.isMoving())return this.tilePos;let e=this.tilePos.layer,t=this.tilePosInDirection(this.tilePos.position,this.movementDirection),i=this.tilemap.getTransition(t,this.tilePos.layer);return i&&(e=i),{position:this.tilePosInDirection(this.tilePos.position,this.movementDirection),layer:e}}getTileWidth(){return this.tileWidth}getTileHeight(){return this.tileHeight}move(e){this.lastMovementImpulse=e,e!="none"&&(this.isMoving()||(this.isBlockingDirection(e)?this.changeFacingDirection(e):this.startMoving(e)))}update(e){this.movement?.update(e),this.isMoving()&&this.updateCharacterPosition(e),this.lastMovementImpulse="none"}getMovementDirection(){return this.movementDirection}isBlockingDirection(e){if(e=="none")return!1;let t=this.tilePosInDirection(this.getNextTilePos().position,e),i=this.tilemap.getTransition(t,this.getNextTilePos().layer)||this.getNextTilePos().layer;return this.collidesWithTilesInternal&&this.isTileBlocking(e,i)?!0:this.isCharBlocking(e,i)}isTileBlocking(e,t){return this.someCharTile((i,n)=>{let s=this.tilePosInDirection(new k(i,n),e);return this.tilemap.hasBlockingTile(s,t,ib(e),this.ignoreMissingTiles)})}isCharBlocking(e,t){return this.someCharTile((i,n)=>{let s=this.tilePosInDirection(new k(i,n),e);return this.tilemap.hasBlockingChar(s,t,this.getCollisionGroups(),new Set([this.getId()]))})}isMoving(){return this.movementDirection!="none"}turnTowards(e){this.isMoving()||e!="none"&&this.changeFacingDirection(e)}changeFacingDirection(e){this.facingDirection!==e&&(this.facingDirection=e,this.directionChanged$.next(e))}getFacingDirection(){return this.facingDirection}getFacingPosition(){return this._tilePos.position.add(Xt(this.facingDirection))}addCollisionGroup(e){this.collisionGroups.add(e)}setCollisionGroups(e){this.collisionGroups=new Set(e)}getCollisionGroups(){return Array.from(this.collisionGroups)}hasCollisionGroup(e){return this.collisionGroups.has(e)}removeCollisionGroup(e){this.collisionGroups.delete(e)}removeAllCollisionGroups(){this.collisionGroups.clear()}addLabels(e){for(let t of e)this.labels.add(t)}getLabels(){return[...this.labels.values()]}hasLabel(e){return this.labels.has(e)}clearLabels(){this.labels.clear()}removeLabels(e){for(let t of e)this.labels.delete(t)}getNumberOfDirections(){return this.numberOfDirections}movementStarted(){return this.movementStarted$}movementStopped(){return this.movementStopped$}directionChanged(){return this.directionChanged$}tilePositionSet(){return this.tilePositionSet$}positionChangeStarted(){return this.positionChangeStarted$}positionChangeFinished(){return this.positionChangeFinished$}autoMovementSet(){return this.autoMovementSet$}depthChanged(){return this.depthChanged$}getMovementProgress(){return this.movementProgress}hasWalkedHalfATile(){return this.movementProgress>on/2}willCrossTileBorderThisUpdate(e){return this.movementProgress+this.maxProgressForDelta(e)>=on}updateCharacterPosition(e){let t=this.willCrossTileBorderThisUpdate(e),n=1-(t?on-this.movementProgress:this.maxProgressForDelta(e))/this.maxProgressForDelta(e);this.movementProgress=Math.min(this.movementProgress+this.maxProgressForDelta(e),on),t&&(this.movementProgress=0,this.shouldContinueMoving()?(this.fire(this.positionChangeFinished$,this.tilePos,this.getNextTilePos()),this.tilePos=this.getNextTilePos(),this.startMoving(this.lastMovementImpulse),n>0&&this.updateCharacterPosition(e*n)):this.stopMoving())}maxProgressForDelta(e){let i=e/1e3;return Math.floor(i*this.speed*on)}get tilePos(){return $.clone(this._tilePos)}set tilePos(e){$.copyOver(e,this._tilePos)}startMoving(e){e!=="none"&&(e!=this.movementDirection&&this.movementStarted$.next(e),this.movementDirection=e,this.facingDirection=e,this.fire(this.positionChangeStarted$,this.tilePos,this.getNextTilePos()))}tilePosInDirection(e,t){return e.add(Xt(this.tilemap.toMapDirection(t)))}shouldContinueMoving(){return this.lastMovementImpulse!=="none"&&!this.isBlockingDirection(this.lastMovementImpulse)}stopMoving(){if(this.movementDirection==="none")return;let e=this.tilePos,t=this.getNextTilePos(),i=this.movementDirection;this.tilePos=this.getNextTilePos(),this.movementDirection="none",this.movementStopped$.next(i),this.fire(this.positionChangeFinished$,e,t)}fire(e,{position:t,layer:i},{position:n,layer:s}){e.next({exitTile:t,enterTile:n,exitLayer:i,enterLayer:s})}someCharTile(e){let t=this.getNextTilePos().position;for(let i=t.x;ic===this.charData.id)).subscribe(({direction:c})=>{this.animation?.setStandingFrame(c)}),this.sprite&&(this.sprite.setOrigin(0,0),this.resetAnimation(this.sprite),this.updateOverlaySprite(),this.updateGridChar())}destroy(){this.destroy$.next(),this.destroy$.complete(),this.newSpriteSet$.complete()}setSprite(e){e?(this.sprite&&(e.x=this.sprite.x,e.y=this.sprite.y),this.sprite=e,this.newSpriteSet$.next(),this.layerOverlaySprite=this.layerOverlaySprite?this.scene.add.sprite(0,0,this.sprite.texture):void 0,this.updateOverlaySprite(),this.resetAnimation(this.sprite),this.updateDepth()):(this.layerOverlaySprite=void 0,this.sprite=void 0)}getSprite(){return this.sprite}getLayerOverlaySprite(){return this.layerOverlaySprite}setContainer(e){this.container=e}getContainer(){return this.container}getOffsetX(){return this.customOffset.x}setOffsetX(e){this.customOffset.x=e}getOffsetY(){return this.customOffset.y}setOffsetY(e){this.customOffset.y=e}getWalkingAnimationMapping(){return this.walkingAnimationMapping}turnTowards(e){this.geHeadless.isMoving(this.charData.id)||e!="none"&&(this.geHeadless.turnTowards(this.charData.id,e),this.animation?.setStandingFrame(e))}getAnimation(){return this.animation}setAnimation(e){this.animation=e}update(e){this.updateGridChar()}getEngineOffset(){if(!this.sprite)return k.ZERO;let e=this.tilemap.getTileWidth()/2-Math.floor((this.sprite?.displayWidth??0)/2),t=-(this.sprite?.displayHeight??0)+this.tilemap.getTileHeight();return new k(e,t)}updatePixelPos(){let e=new k(this.geHeadless.getPosition(this.charData.id)),t=this.geHeadless.getMovementProgress(this.charData.id)/1e3,n=this.tilemap.tilePosToPixelPos(e).add(this.getEngineOffset()).add(this.customOffset).add(Xt(this.geHeadless.getFacingDirection(this.charData.id)).multiply(this.tilemap.getTileDistance(this.geHeadless.getFacingDirection(this.charData.id)).scalarMult(t))),s=this.getGameObj();s&&(s.x=Math.floor(n.x),s.y=Math.floor(n.y))}getGameObj(){return this.container||this.sprite}updateGridChar(){if(this.updatePixelPos(),this.sprite&&this.geHeadless.isMoving(this.charData.id)){let e=this.geHeadless.getMovementProgress(this.charData.id)>on/2;this.getAnimation()?.updateCharacterFrame(this.geHeadless.getFacingDirection(this.charData.id),e,Number(this.sprite.frame.name))}this.updateDepth()}resetAnimation(e){let t=new Oa(this.walkingAnimationMapping,e.texture.source[0].width/e.width/Oa.FRAMES_CHAR_ROW);this.setAnimation(t),t.frameChange().pipe((0,af.takeUntil)(this.newSpriteSet$)).subscribe(i=>{e?.setFrame(i)}),t.setIsEnabled(this.walkingAnimationMapping!==void 0),t.setStandingFrame(this.geHeadless.getFacingDirection(this.charData.id))}updateOverlaySprite(){if(!this.layerOverlaySprite||!this.sprite)return;this.layerOverlaySprite.scale=this.sprite.scale;let e=this.tilemap.getTileHeight()/this.layerOverlaySprite.scale;this.layerOverlaySprite.setCrop(0,0,this.layerOverlaySprite.displayWidth,this.sprite.height-e),this.layerOverlaySprite.setOrigin(0,0)}updateDepth(){let e=this.getGameObj();if(!e)return;let t=new k(this.geHeadless.getPosition(this.charData.id)),i=this.geHeadless.getCharLayer(this.charData.id);this.setDepth(e,{position:t,layer:i});let n=this.getLayerOverlaySprite();if(n){let s=new k({...t,y:t.y-1});this.setDepth(n,{position:s,layer:i})}}setDepth(e,t){e.setDepth(this.tilemap.getDepthOfCharLayer(this.getTransitionLayer(t))+this.getPaddedPixelDepth(e))}getPaddedPixelDepth(e){return go.shiftPad(e.y+e.displayHeight,7)}getTransitionLayer(e){if(e.layer)return this.geHeadless.getTransition(e.position,e.layer)||e.layer}};var Sa=(n=>(n.DONT_BLOCK="DONT_BLOCK",n.BLOCK_TWO_TILES="BLOCK_TWO_TILES",n.BLOCK_ONE_TILE_AHEAD="BLOCK_ONE_TILE_AHEAD",n.BLOCK_ONE_TILE_BEHIND="BLOCK_ONE_TILE_BEHIND",n))(Sa||{});var an=(i=>(i.STOP="STOP",i.CLOSEST_REACHABLE="CLOSEST_REACHABLE",i.RETRY="RETRY",i))(an||{});var Ce=class r{static vec2str(e){return`${e.x}#${e.y}`}static equal(e,t){return r.vec2str(e)==r.vec2str(t)}static manhattanDistance(e,t){let i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return i+n}static chebyshevDistance(e,t){let i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.max(i,n)}static scalarMult(e,t){return e.clone().multiply(new k(t,t))}};var sf=class{distance(e,t){return Ce.manhattanDistance(e,t)}direction(e,t){if(Ce.equal(e,t))return"none";let i=e.clone().subtract(t);return Math.abs(i.x)>Math.abs(i.y)?i.x>0?"left":"right":i.y>0?"up":"down"}neighbors(e){return[new k(e.x,e.y+1),new k(e.x+1,e.y),new k(e.x-1,e.y),new k(e.x,e.y-1)]}getDirections(){return["up","right","down","left"]}};var uf=class{distance(e,t){return Ce.chebyshevDistance(e,t)}neighbors(e){let t=[new k(e.x,e.y+1),new k(e.x+1,e.y),new k(e.x-1,e.y),new k(e.x,e.y-1)],i=[new k(e.x+1,e.y+1),new k(e.x+1,e.y-1),new k(e.x-1,e.y+1),new k(e.x-1,e.y-1)];return[...t,...i]}direction(e,t){return t.x>e.x?t.y>e.y?"down-right":t.ye.y?"down-left":t.ye.y?"down":"none"}getDirections(){return["up","right","down","left","down-left","down-right","up-right","up-left"]}};var ct=class{static create(e){switch(e){case 4:return new sf;case 8:return new uf}}};var Ta=class{constructor(e,t,i){this.backoffMs=e;this.maxRetries=t;this.onFinished=i;this.retries=0;this.elapsed=0}retry(e,t){this.shouldRetry()?(this.elapsed+=e,this.elapsed>=this.backoffMs&&(this.elapsed=0,this.retries++,t())):this.onFinished()}reset(){this.retries=0,this.elapsed=0}getMaxRetries(){return this.maxRetries}getBackoffMs(){return this.backoffMs}shouldRetry(){return this.maxRetries===-1||this.retries(i.WAIT="WAIT",i.RETRY="RETRY",i.STOP="STOP",i))(_o||{});var Do=gt(Mi(),1);var yr=class{constructor(e,{shortestPathAlgorithm:t="BFS",pathWidth:i=1,pathHeight:n=1,numberOfDirections:s=4,isPositionAllowed:c=(L,D)=>!0,collisionGroups:l=[],ignoredChars:h=[],ignoreTiles:p=!1,ignoreMapBounds:v=!1,ignoreBlockedTarget:b=!1,maxPathLength:w=1/0,ignoreLayers:T=!1,considerCosts:q=!1,calculateClosestToTarget:M=!0}={}){this.gridTilemap=e;this.options={shortestPathAlgorithm:t,pathWidth:i,pathHeight:n,numberOfDirections:s,isPositionAllowed:c,collisionGroups:l,ignoredChars:h,ignoreTiles:p,ignoreMapBounds:v,ignoreBlockedTarget:b,maxPathLength:w,ignoreLayers:T,considerCosts:q,calculateClosestToTarget:M}}findShortestPath(e,t){this.options.ignoreLayers&&(this.gridTilemap.fixCacheLayer(e.layer),t.layer=e.layer);let i=this.findShortestPathImpl(e,t);return this.gridTilemap.unfixCacheLayers(),i}getNeighbors(e,t){return ct.create(this.options.numberOfDirections??4).neighbors(e.position).map(c=>{let l=e.layer;return this.options.ignoreLayers||(l=this.gridTilemap.getTransition(c,e.layer)),{position:c,layer:l||e.layer}}).filter(c=>!this.isBlocking(e,c)||this.options.ignoreBlockedTarget&&$.equal(c,t))}getTransition(e,t){if(!this.options.ignoreLayers)return this.gridTilemap.getTransition(e,t)}getCosts(e,t){if(!this.options.considerCosts)return 1;let i=rt(t.position,e);return this.gridTilemap.getTileCosts(t,i)}isBlocking(e,t){return!(this.options.ignoreMapBounds||this.gridTilemap.isInRange(t.position))||!this.options.isPositionAllowed(t.position,t.layer)||!this.options.ignoreTiles&&this.hasBlockingTileFrom(e,t,this.options.pathWidth,this.options.pathHeight,this.options.ignoreMapBounds,this.gridTilemap)?!0:this.hasBlockingCharFrom(t,this.options.pathWidth,this.options.pathHeight,this.options.collisionGroups,this.options.ignoredChars,this.gridTilemap)}distance(e,t){return(this.options.numberOfDirections===4?Ce.manhattanDistance:Ce.chebyshevDistance)(e,t)}getTilePosInDir(e,t){return this.gridTilemap.getTilePosInDirection(e,t)}getReverseNeighbors(e,t){let n=ct.create(this.options.numberOfDirections??4).neighbors(e.position),s;if(!this.options.ignoreLayers){let l=this.gridTilemap.getReverseTransitions(e.position,e.layer);s=l?[...l]:void 0}return n.map(l=>s?s.map(h=>({position:l,layer:h||e.layer})):[{position:l,layer:e.layer}]).flat().filter(l=>!this.isBlocking(l,e)||this.options.ignoreBlockedTarget&&$.equal(e,t))}hasBlockingCharFrom(e,t,i,n,s,c){for(let l=e.position.x;lqa(s,v)-qa(s,b)),l=e,h=this.distance(e.position,t.position),p=0;for(c.push(e),n.set($.toString(e),0),s.set($.toString(e),this.distance(e.position,t.position));c.size>0;){let v=c.pop();if(!v)break;p++;let b=this.distance(v.position,t.position);if(bthis.options.maxPathLength)return{previous:new Map,closestToTarget:l,steps:p,maxPathLengthReached:!0};for(let w of this.getNeighbors(v,t)){let T=qa(n,v)+this.getCosts(v.position,w),q=$.toString(w);(!n.has(q)||T0;){let p=s.dequeue();if(h++,!p)break;let{node:v,dist:b}=p;if(b>this.options.maxPathLength)return{previous:new Map,closestToTarget:c,steps:h,maxPathLengthReached:!0};let w=this.distance(v.position,t.position);if(wthis.lastDist)}step(e,t,i){this.lastDist=i;for(let n of e){let s=$.toString(n);if(!this.visited.has(s)){this.previous.set(s,t),this.queue.enqueue({node:n,dist:i+1}),this.visited.set(s,i+1);let c=this.otherBfs?.visited.get(s);c!==void 0&&c0,n.queue.size()>0);){let h=i.queue.dequeue();if(!h)break;let{node:p,dist:v}=h;if(v+1+(n.queue.peek()?.dist||0)>this.options.maxPathLength)return{previous:i.previous,previous2:n.previous,closestToTarget:this.maybeClosestToTarget(c),steps:s,maxPathLengthReached:!0};let b=this.distance(p.position,t.position);if(bLa(this.f,c)-La(this.f,l)),this.openSet.push(t);let s=$.toString(t);for(this.g.set(s,0),this.f.set(s,this.distance(t.position,i.position)),this.maxFrontierSize=Math.max(this.maxFrontierSize,this.openSet.size);this.openSet.size>0;){let c=this.openSet.pop();if(!c)break;if(this.steps++,$.equal(c,i))return{previous:n,closestToTarget:i,steps:this.steps,maxPathLengthReached:!1};if(La(this.g,c)+1>this.options.maxPathLength)return{previous:new Map,closestToTarget:this.closestToTarget,steps:this.steps,maxPathLengthReached:!0};this.updateClosestToTarget(c,i);for(let l of this.getNeighborsInternal(c,n.get($.toString(c)),i)){let h=$.toString(l.p),p=La(this.g,c)+l.dist;(!this.g.has(h)||p({p:l,dist:1}));let s=this.prune(i,t).map(l=>{let h=this.getTransition(l.position,t.layer);return{position:l.position,layer:h||t.layer}}),c=[];for(let l of s){let h=this.jump(t,l,n,1);h&&c.push(h)}return c}jump(t,i,n,s){let c=this.distanceUtils.direction(t.position,i.position);if(!(this.isBlocking(t,i)&&!($.equal(i,n)&&this.options.ignoreBlockedTarget)))return $.equal(i,n)?{p:i,dist:s}:s>=this.maxJumpSize?{p:i,dist:s}:this.getTransition(i.position,t.layer)!==void 0?{p:i,dist:s}:up(c)?{p:i,dist:s}:this.getForced(t,i).length>0?{p:i,dist:s}:(this.updateClosestToTarget(i,n),this.jump(i,this.getTilePosInDir(i,rt(t.position,i.position)),n,s+1))}getForced(t,i){let n=[],s=this.posInDir(i,this.distanceUtils.direction(i.position,t.position)),{topLeft:c,downLeft:l,top:h,bottom:p}=this.normalizedPositions(s,i),v=(w,T)=>this.isBlocking(w,T)||this.getTransition(T.position,T.layer)!==void 0,b=this.distanceUtils.direction(t.position,i.position);return tb(b)&&((v(s,l)||v(l,p))&&!this.isBlocking(i,p)&&n.push(p),(v(s,c)||v(c,h))&&!this.isBlocking(i,h)&&n.push(h)),n}prune(t,i){let{right:n,top:s,bottom:c}=this.normalizedPositions(t,i),l=this.getForced(t,i),h=rt(t.position,i.position);return up(h)?[n,s,c]:[n,...l]}normalizedPositions(t,i){let n=rt(t.position,i.position);return{topLeft:this.posInDir(i,this.turnTimes.get("up-left")?.get(this.turnOrder[n])||"up-left"),downLeft:this.posInDir(i,this.turnTimes.get("down-left")?.get(this.turnOrder[n])||"down-left"),downRight:this.posInDir(i,this.turnTimes.get("down-right")?.get(this.turnOrder[n])||"down-right"),topRight:this.posInDir(i,this.turnTimes.get("up-right")?.get(this.turnOrder[n])||"up-right"),top:this.posInDir(i,this.turnTimes.get("up")?.get(this.turnOrder[n])||"up"),bottom:this.posInDir(i,this.turnTimes.get("down")?.get(this.turnOrder[n])||"down"),right:this.posInDir(i,this.turnTimes.get("right")?.get(this.turnOrder[n])||"right")}}posInDir(t,i){return{position:t.position.add(Xt(i)),layer:t.layer}}returnPath(t,i,n){let s=[],c=n;for(s.push(c);!$.equal(c,i);){let l=t.get($.toString(c));if(!l)return[];this.distance(l.position,c.position)>1?this.fillPath(c,l,s):s.push(l),c=l}return s.reverse()}fillPath(t,i,n){let s=t;do{let c=rt(s.position,i.position);s=this.getTilePosInDir(s,c),n.push(s)}while(!Ce.equal(s.position,i.position))}};function La(r,e){return r.get($.toString(e))??Number.MAX_VALUE}function b5(){let r=["right","down-right","down","down-left","left","up-left","up","up-right"],e=new Map;for(let t=0;tc!==this),(0,Lo.take)(1)))).subscribe(({enterTile:c,enterLayer:l})=>{this.updateTarget(c,l)})}update(e){this.targetMovement?.update(e)}getInfo(){return{type:"Follow",config:{charToFollow:this.charToFollow.getId(),distance:this.options.distance,noPathFoundStrategy:this.options.noPathFoundStrategy,maxPathLength:this.options.maxPathLength,ignoreLayers:this.options.ignoreLayers}}}updateTarget(e,t){this.targetMovement=new jo(this.character,this.gridTilemap,{position:new k(e),layer:t},{distance:this.options.distance+1,config:{algorithm:this.options.shortestPathAlgorithm,noPathFoundStrategy:this.options.noPathFoundStrategy,maxPathLength:this.options.maxPathLength,ignoreLayers:this.options.ignoreLayers,considerCosts:this.options.considerCosts},ignoreBlockedTarget:!0})}};var ja=class{static getRandomInt(e){return Math.floor(Math.random()*Math.floor(e))}};var Io=gt(bo(),1);var Af=class{constructor(e,t=0,i=-1){this.character=e;this.delay=t;this.radius=i;this.stepSize=0;this.delayLeft=this.delay,this.initialRow=e.getNextTilePos().position.y,this.initialCol=e.getNextTilePos().position.x,this.randomizeStepSize(),this.stepsWalked=0,this.currentMovementDirection="none",this.character.positionChangeStarted().pipe((0,Io.takeUntil)(this.character.autoMovementSet().pipe((0,Io.filter)(n=>n!==this),(0,Io.take)(1)))).subscribe(()=>{this.stepsWalked++}),this.distanceUtils=ct.create(e.getNumberOfDirections())}update(e){if(this.shouldContinueWalkingCurrentDirection())this.character.move(this.currentMovementDirection);else if(this.delayLeft-=e,this.delayLeft<=0){this.delayLeft=this.delay;let t=this.getFreeRandomDirection();this.stepsWalked=0,this.character.move(t),this.currentMovementDirection=t,this.randomizeStepSize()}}getInfo(){return{type:"Random",config:{delay:this.delay,radius:this.radius}}}shouldContinueWalkingCurrentDirection(){return this.stepsWalked!this.character.isBlockingDirection(t)).filter(t=>this.isWithinRadius(t))}isWithinRadius(e){return this.radius==-1?!0:this.getDist(e)<=this.radius}getDist(e){return this.distanceUtils.distance(this.character.getNextTilePos().position.add(Xt(e)),new k(this.initialCol,this.initialRow))}getFreeRandomDirection(){let e=this.getFreeDirections();return e.length==0?"none":e[ja.getRandomInt(e.length)]}randomizeStepSize(){this.stepSize=ja.getRandomInt(this.radius)+1}};var or=gt(Mi(),1),$e=gt(bo(),1);function Iw(r,e){return r.filter(t=>e.labels?.withAllLabels?e.labels?.withAllLabels.every(i=>t.hasLabel(i)):e.labels?.withOneOfLabels?e.labels?.withOneOfLabels.some(i=>t.hasLabel(i)):e.labels?.withNoneLabels?!e.labels?.withNoneLabels.some(i=>t.hasLabel(i)):!0)}var Ef="2.38.1";var St=gt(Mi(),1);var qf=class{constructor(e,t){this.collistionStrategy=e;this.collisionGroupRelation=t;this.tilePosToCharacters=new Map;this.charRemoved$=new St.Subject}isCharBlockingAt(e,t,i,n=new Set){if(i.length===0)return!1;let s=this.posToString(e,t),c=this.tilePosToCharacters.get(s);return!!(c&&c.size>0&&[...c].filter(l=>!n.has(l.getId())).some(l=>i.some(h=>l.getCollisionGroups().some(p=>this.collidesWith(h,p)))))}collidesWith(e,t){return this.collisionGroupRelation?(this.collisionGroupRelation.get(e)||new Set).has(t):e===t}getCharactersAt(e,t){let i=this.posToString(e,t),n=this.tilePosToCharacters.get(i);return new Set(n)}addCharacter(e){this.addTilePositions(e.getTilePos(),e),this.addTilePositions(e.getNextTilePos(),e),this.addPositionChangeSub(e),this.addPositionChangeFinishedSub(e),this.addTilePosSetSub(e)}removeCharacter(e){let t=e.getId();this.charRemoved$.next(t),this.deleteTilePositions(e.getTilePos(),e),this.deleteTilePositions(e.getNextTilePos(),e)}add(e,t){this.tilePosToCharacters.has(e)||this.tilePosToCharacters.set(e,new Set),this.tilePosToCharacters.get(e)?.add(t)}addTilePosSetSub(e){e.tilePositionSet().pipe((0,St.takeUntil)(this.charRemoved(e.getId()))).subscribe(t=>{this.deleteTilePositions(e.getNextTilePos(),e),this.addTilePositions(t,e)})}charRemoved(e){return this.charRemoved$?.pipe((0,St.take)(1),(0,St.filter)(t=>t==e))}addPositionChangeSub(e){e.positionChangeStarted().pipe((0,St.takeUntil)(this.charRemoved(e.getId())),this.posChangeToLayerPos()).subscribe(t=>{this.collistionStrategy==="BLOCK_ONE_TILE_AHEAD"&&this.deleteTilePositions(t.exit,e),this.addTilePositions(t.enter,e)})}addPositionChangeFinishedSub(e){e.positionChangeFinished().pipe((0,St.takeUntil)(this.charRemoved(e.getId())),this.posChangeToLayerPos()).subscribe(t=>{this.deleteTilePositions(t.exit,e),this.addTilePositions(t.enter,e)})}addTilePositions(e,t){this.forEachCharTile(e,t,(i,n)=>{this.add(this.posToString(new k(i,n),e.layer),t)})}deleteTilePositions(e,t){this.forEachCharTile(e,t,(i,n)=>{this.tilePosToCharacters.get(this.posToString(new k(i,n),e.layer))?.delete(t)})}forEachCharTile(e,t,i){let n=e.position;for(let s=n.x;s({enter:{position:new k(e.enterTile),layer:e.enterLayer},exit:{position:new k(e.exitTile),layer:e.exitLayer}})))}posToString(e,t){return`${e.x}#${e.y}#${t}`}};var Di=class{constructor(e,t,i,n){this.x=e;this.y=t;this.width=i;this.height=n}getX(){return this.x}getY(){return this.y}getWidth(){return this.width}getHeight(){return this.height}isInRange(e){return e.x>=this.x&&e.x=this.y&&e.yi.isCharLayer());for(let i of[...t,void 0]){let n=this.tileCollisionCache.get(i?.getName());if(n===void 0){n=new Array(this.tilemap.getWidth());for(let s=0;s>e&1)==1}var Dw="ge_cost",xf=class r{constructor(e,t,i,n=void 0,s=!1){this.tilemap=e;this.collisionTilePropertyName=t;this.useTileCollisionCache=s;this.characters=new Map;this.transitions=new Map;this.reverseTransitions=new Map;this.collidesPropNames=new Map;this.tileCostPropNames=new Map;this.collisionRelevantLayersFrameCache=new Map;this.charBlockCache=new qf(i,n);for(let c of ca())this.collidesPropNames.set(c,r.ONE_WAY_COLLIDE_PROP_PREFIX+c),this.tileCostPropNames.set(c,`${Dw}_${c}`);this.useTileCollisionCache&&(this.tileCollisionCache=new Mf(e,this),this.tileCollisionCache.rebuild())}static{this.ONE_WAY_COLLIDE_PROP_PREFIX="ge_collide_"}fixCacheLayer(e){this.tileCollisionCache?.fixLayer(e)}unfixCacheLayers(){this.tileCollisionCache?.unfixLayers()}addCharacter(e){this.characters.set(e.getId(),e),e.getNextTilePos().layer===void 0&&e.setTilePosition({...e.getNextTilePos(),layer:this.getLowestCharLayer()}),this.charBlockCache.addCharacter(e)}removeCharacter(e){let t=this.characters.get(e);t&&(this.charBlockCache.removeCharacter(t),this.characters.delete(e))}getCharacters(){return[...this.characters.values()]}getCharactersAt(e,t){return this.charBlockCache.getCharactersAt(e,t)}rebuildTileCollisionCache(e){this.tileCollisionCache?.rebuild(e)}hasBlockingTileUncached(e,t,i,n){if(!n&&this.hasNoTileUncached(e,t))return!0;let s=this.getCollisionRelevantLayers(t);for(let c of s)if(this.isLayerBlockingAt(c.getName(),e,i))return!0;return!1}hasBlockingTile(e,t,i,n){let s=this.tileCollisionCache?.isBlockingFrom(e.x,e.y,t,i,n);return s!==void 0?s:this.hasBlockingTileUncached(e,t,i,n)}getTransition(e,t){let i=this.transitions.get(e.toString());if(i)return i.get(t)}getReverseTransitions(e,t){let i=this.reverseTransitions.get(e.toString());if(i)return i.get(t)}setTransition(e,t,i){this.transitions.has(e.toString())||this.transitions.set(e.toString(),new Map),this.reverseTransitions.has(e.toString())||this.reverseTransitions.set(e.toString(),new Map),this.transitions.get(e.toString())?.set(t,i),this.reverseTransitions.get(e.toString())?.has(i)||this.reverseTransitions.get(e.toString())?.set(i,new Set),this.reverseTransitions.get(e.toString())?.get(i)?.add(t)}getTransitions(){return new Map([...this.transitions].map(([e,t])=>[e,new Map(t)]))}getTileCosts(e,t){let i=this.getCollisionRelevantLayers(e.layer),n=1;for(let s of i)n=Math.max(n,this.getTileCostsForLayer({...e,layer:s.getName()},t));return n}getTileCostsForLayer(e,t){let i=this.tilemap.getTileAt(e.position.x,e.position.y,e.layer);return t&&i?.getProperty(this.tileCostPropNames.get(t)||"")||i?.getProperty(Dw)||1}hasNoTileUncached(e,t){return!this.getCollisionRelevantLayers(t).some(n=>this.tilemap.hasTileAt(e.x,e.y,n.getName()))}hasNoTile(e,t){let i=this.tileCollisionCache?.hasTileAt(e.x,e.y,t);return i!==void 0?i:this.hasNoTileUncached(e,t)}hasBlockingChar(e,t,i,n=new Set){return this.charBlockCache.isCharBlockingAt(e,t,i,n)}isInRange(e){return new Di(0,0,this.tilemap.getWidth(),this.tilemap.getHeight()).isInRange(e)}toMapDirection(e){return this.isIsometric()?rb(e):e}fromMapDirection(e){return this.isIsometric()?js(e):e}isIsometric(){return this.tilemap.getOrientation()==="isometric"}getTilePosInDirection(e,t){let i=e.position.add(Xt(this.toMapDirection(t))),n=this.getTransition(i,e.layer)||e.layer;return{position:i,layer:n}}invalidateFrameCache(){this.collisionRelevantLayersFrameCache.clear()}isLayerBlockingAt(e,t,i){let n=this.tilemap.getTileAt(t.x,t.y,e);return n?!!(n.getProperty(this.collisionTilePropertyName)||i&&n.getProperty(this.collidesPropNames.get(i)||"")):!1}getCharLayerIndexes(){return this.tilemap.getLayers().map((e,t)=>({layer:e,index:t})).filter(({layer:e})=>e.isCharLayer()).map(({index:e})=>e)}findPrevAndCharLayer(e){let t=this.getCharLayerIndexes(),i=this.tilemap.getLayers(),n=t.findIndex(s=>i[s].getProperty(Ia)==e);return n==0?{prevIndex:-1,charLayerIndex:t[n]}:{prevIndex:t[n-1],charLayerIndex:t[n]}}getCollisionRelevantLayers(e){if(!e)return this.tilemap.getLayers();let t=this.collisionRelevantLayersFrameCache.get(e);if(t)return t;let{prevIndex:i,charLayerIndex:n}=this.findPrevAndCharLayer(e),s=this.tilemap.getLayers().slice(i+1,n+1);return this.collisionRelevantLayersFrameCache.set(e,s),s}getLowestCharLayer(){for(let e of this.tilemap.getLayers())if(e.isCharLayer())return e.getProperty(Ia)}};var Lf=(t=>(t.REMOVED="REMOVED",t.ADDED="ADDED",t))(Lf||{});var kw=gt(Mi(),1),If=gt(bo(),1);var mm=(i=>(i.WAIT="WAIT",i.SKIP="SKIP",i.STOP="STOP",i))(mm||{}),jf=class{constructor(e,t){this.character=e;this.tilemap=t;this.queue=new $r;this.finished$=new kw.Subject;this.pathBlockedWaitElapsed=0;this.distanceUtils=ct.create(e.getNumberOfDirections()),this.character.autoMovementSet().pipe((0,If.filter)(i=>i!==this),(0,If.take)(1)).subscribe(()=>{this.queue.size()>0&&this.finishMovementTerminated(),this.finished$.complete()})}update(e){(!this.character.isMoving()||this.character.willCrossTileBorderThisUpdate(e))&&this.queue.size()>0&&this.moveCharOnPath(e)}getInfo(){return{type:"Queue"}}enqueue(e,t={}){let i={pathBlockedStrategy:t.pathBlockedStrategy??"STOP",pathBlockedWaitTimeoutMs:t?.pathBlockedWaitTimeoutMs||-1,ignoreInvalidPositions:t.ignoreInvalidPositions??!1,skipInvalidPositions:t.skipInvalidPositions??!1};for(let n of e){let s={command:n,config:i};if(ai(n)){this.queue.enqueue(s);continue}let l=this.queue.peekEnd()?.command;if(l||(l=this.character.getNextTilePos()),ai(l)){this.queue.enqueue(s);continue}let h=this.distanceUtils.distance(l.position,n.position)===1;(!t.ignoreInvalidPositions||h)&&this.queue.enqueue(s)}}peekAll(){return this.queue.peekAll()}size(){return this.queue.size()}finished(){return this.finished$}clear(){this.queue.clear()}moveCharOnPath(e){let t=this.queue.peek();if(!t)return;let i=t.command,n=t.config;if(ai(i)&&(i=this.tilemap.getTilePosInDirection(this.character.getNextTilePos(),i)),n.skipInvalidPositions){if(i=this.getNextValidPosition(),!i){this.finishInvalidNextPos(i);return}}else if(!this.isNeighborPos(i)){this.finishInvalidNextPos(i);return}if(this.character.isBlockingDirection(rt(this.character.getNextTilePos().position,i.position))){if(n.pathBlockedStrategy==="STOP")this.finishPathBlocked(i);else if(n.pathBlockedStrategy==="SKIP"){this.queue.dequeue(),this.moveCharOnPath(e);return}else n.pathBlockedStrategy==="WAIT"&&n.pathBlockedWaitTimeoutMs>-1&&(this.pathBlockedWaitElapsed+=e,this.pathBlockedWaitElapsed>=n.pathBlockedWaitTimeoutMs&&this.finishBlockedWaitTimeout(i,n.pathBlockedWaitTimeoutMs));return}this.pathBlockedWaitElapsed=0,this.queue.dequeue(),this.character.move(this.getDir(this.character.getNextTilePos().position,i.position)),this.isLastMovement()&&this.finish("SUCCESS","",i)}getNextValidPosition(){for(;this.queue.size()>0;){let e=this.queue.peek()?.command;if(ai(e)&&(e=this.tilemap.getTilePosInDirection(this.character.getNextTilePos(),e)),e&&this.isNeighborPos(e))return e;this.queue.dequeue()}}isLastMovement(){return this.queue.size()===0}isNeighborPos(e){let t=this.distanceUtils.distance(this.character.getNextTilePos().position,e.position)===1,i=this.tilemap.getTransition(e.position,this.character.getNextTilePos().layer);if(this.character.getNextTilePos().layer!==e.layer)return t&&i===e.layer;let n=i!==void 0&&i!==e.layer;return t&&!n}finishMovementTerminated(){this.finish("MOVEMENT_TERMINATED","New automatic movement has been set to character.")}finishInvalidNextPos(e){e?this.finish("INVALID_NEXT_POS",`Position ${this.posToStr(e)} is not reachable from ${this.posToStr(this.character.getNextTilePos())}.`):this.finish("INVALID_NEXT_POS",`No enqueued position is reachable from ${this.posToStr(this.character.getNextTilePos())}.`)}finishPathBlocked(e){this.finish("PATH_BLOCKED",`Position ${this.posToStr(e)} is blocked.`)}finishBlockedWaitTimeout(e,t){this.finish("PATH_BLOCKED_WAIT_TIMEOUT",`Position ${this.posToStr(e)} is blocked and the wait timeout of ${t} ms has been exceeded.`)}finish(e,t="",i=this.character.getNextTilePos()){this.queue=new $r,this.finished$.next({position:i.position,result:e,description:t,layer:i.layer})}getDir(e,t){return this.tilemap.fromMapDirection(rt(e,t))}posToStr(e){return`(${e.position.x}, ${e.position.y}, ${e.layer})`}};var Fa=class{constructor(e=!0){this.isCreatedInternal=!1;e&&console.log(`Using GridEngine v${Ef}`)}getCharLayer(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.getTilePos().layer}getTransition(e,t){return this.initGuard(),this.gridTilemap?.getTransition(new k(e),t)}setTransition(e,t,i){return this.initGuard(),this.gridTilemap?.setTransition(new k(e),t,i)}create(e,t){this.isCreatedInternal=!0,this.gridCharacters=new Map;let i=this.setConfigDefaults(t);this.config=i,this.movementStopped$=new or.Subject,this.movementStarted$=new or.Subject,this.directionChanged$=new or.Subject,this.positionChangeStarted$=new or.Subject,this.positionChangeFinished$=new or.Subject,this.queueMovementFinished$=new or.Subject,this.charRemoved$=new or.Subject,this.charAdded$=new or.Subject,this.gridTilemap=new xf(e,this.config.collisionTilePropertyName,this.config.characterCollisionStrategy,this.recordToMap(this.config.collisionGroupRelation),this.config.cacheTileCollisions),this.addCharacters()}recordToMap(e){return e?new Map(Object.entries(e).map(([i,n])=>[i,new Set(n)])):void 0}getPosition(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.getTilePos().position}move(e,t){this.moveChar(e,t)}moveRandomly(e,t=0,i=-1){this.initGuard();let n=this.gridCharacters?.get(e);if(!n)throw this.createCharUnknownErr(e);let s=new Af(n,t,i);n.setMovement(s)}getMovement(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);let i=t.getMovement();return i?i.getInfo():{type:"None"}}moveTo(e,t,i){let n=this.assembleMoveToConfig(i);this.initGuard();let s=this.gridCharacters?.get(e);if(!s)throw this.createCharUnknownErr(e);if(!this.gridTilemap)throw this.createUninitializedErr();let c=new jo(s,this.gridTilemap,{position:new k(t),layer:i?.targetLayer||s.getNextTilePos().layer},{distance:0,config:n});return s.setMovement(c),c.finishedObs().pipe((0,$e.map)(l=>({charId:e,position:l.position,result:l.result,description:l.description,layer:l.layer})))}stopMovement(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);t.setMovement(void 0)}setSpeed(e,t){this.initGuard();let i=this.gridCharacters?.get(e);if(!i)throw this.createCharUnknownErr(e);i.setSpeed(t)}getSpeed(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.getSpeed()}collidesWithTiles(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.collidesWithTiles()}update(e,t){if(this.isCreatedInternal&&this.gridCharacters)for(let[i,n]of this.gridCharacters)n.update(t);this.gridTilemap?.invalidateFrameCache()}addCharacter(e){if(!this.gridTilemap)throw this.createUninitializedErr();if(!this.config)throw this.createUninitializedErr();let t={speed:e.speed||4,tilemap:this.gridTilemap,collidesWithTiles:!0,collisionGroups:["geDefault"],charLayer:e.charLayer,facingDirection:e.facingDirection,labels:e.labels,numberOfDirections:e.numberOfDirections??this.config.numberOfDirections,tileWidth:e.tileWidth,tileHeight:e.tileHeight};typeof e.collides=="boolean"?e.collides===!1&&(t.collidesWithTiles=!1,t.collisionGroups=[]):e.collides!==void 0&&(e.collides.collidesWithTiles===!1&&(t.collidesWithTiles=!1),e.collides.collisionGroups&&(t.collisionGroups=e.collides.collisionGroups),t.ignoreMissingTiles=e.collides?.ignoreMissingTiles??!1);let i=new rf(e.id,t);e.startPosition&&i.setTilePosition({position:new k(e.startPosition),layer:i.getTilePos().layer}),this.gridCharacters?.set(e.id,i),this.gridTilemap.addCharacter(i);let n=i.getId();i.movementStopped().pipe((0,$e.takeUntil)(this.charRemoved(n))).subscribe(s=>{this.movementStopped$?.next({charId:n,direction:s})}),i.movementStarted().pipe((0,$e.takeUntil)(this.charRemoved(n))).subscribe(s=>{this.movementStarted$?.next({charId:n,direction:s})}),i.directionChanged().pipe((0,$e.takeUntil)(this.charRemoved(n))).subscribe(s=>{this.directionChanged$?.next({charId:n,direction:s})}),i.positionChangeStarted().pipe((0,$e.takeUntil)(this.charRemoved(n))).subscribe(s=>{this.positionChangeStarted$?.next({charId:n,...s})}),i.positionChangeFinished().pipe((0,$e.takeUntil)(this.charRemoved(n))).subscribe(s=>{this.positionChangeFinished$?.next({charId:n,...s})}),this.charAdded$?.next(n)}hasCharacter(e){return this.initGuard(),!!this.gridCharacters?.has(e)}removeCharacter(e){if(this.initGuard(),!this.gridCharacters?.get(e))throw this.createCharUnknownErr(e);this.gridTilemap?.removeCharacter(e),this.gridCharacters?.delete(e),this.charRemoved$?.next(e)}removeAllCharacters(){if(this.initGuard(),!!this.gridCharacters)for(let e of this.gridCharacters.keys())this.removeCharacter(e)}getAllCharacters(e){if(this.initGuard(),!this.gridCharacters)return[];let t=[...this.gridCharacters.values()];return(e?Iw(t,e):t).map(n=>n.getId())}getLabels(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.getLabels()}addLabels(e,t){this.initGuard();let i=this.gridCharacters?.get(e);if(!i)throw this.createCharUnknownErr(e);i.addLabels(t)}removeLabels(e,t){this.initGuard();let i=this.gridCharacters?.get(e);if(!i)throw this.createCharUnknownErr(e);i.removeLabels(t)}clearLabels(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);t.clearLabels()}follow(e,t,i,n){let s;i===void 0?s={distance:0,closestPointIfBlocked:!1}:typeof i=="number"?(s={distance:i,closestPointIfBlocked:!1},n&&(s.closestPointIfBlocked=!0)):s=i,this.initGuard();let c=this.gridCharacters?.get(e),l=this.gridCharacters?.get(t);if(!c)throw this.createCharUnknownErr(e);if(!l)throw this.createCharUnknownErr(t);if(!this.gridTilemap)throw this.createUninitializedErr();let h=new Tf(c,this.gridTilemap,l,{distance:s.distance,noPathFoundStrategy:s.closestPointIfBlocked?"CLOSEST_REACHABLE":"STOP",maxPathLength:s.maxPathLength??1/0,shortestPathAlgorithm:s.algorithm??"BIDIRECTIONAL_SEARCH",ignoreLayers:!!s.ignoreLayers});c.setMovement(h)}isMoving(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.isMoving()}getFacingDirection(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.getFacingDirection()}getFacingPosition(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);let i=t.getFacingPosition();return{x:i.x,y:i.y}}turnTowards(e,t){this.initGuard();let i=this.gridCharacters?.get(e);if(!i)throw this.createCharUnknownErr(e);return i.turnTowards(t)}getCharactersAt(e,t){if(this.initGuard(),!this.gridTilemap)return[];let i=this.gridTilemap.getCharactersAt(new k(e),t);return Array.from(i).map(n=>n.getId())}setPosition(e,t,i){this.initGuard();let n=this.gridCharacters?.get(e);if(!n)throw this.createCharUnknownErr(e);i||n.setTilePosition({position:new k(t),layer:n.getTilePos().layer}),n.setTilePosition({position:new k(t),layer:i})}isBlocked(e,t,i=["geDefault"]){this.initGuard();let n=new k(e);return!!(this.gridTilemap?.hasBlockingTile(n,t)||this.gridTilemap?.hasBlockingChar(n,t,i))}isTileBlocked(e,t){return this.initGuard(),!!this.gridTilemap?.hasBlockingTile(new k(e),t)}getCollisionGroups(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.getCollisionGroups()||[]}setCollisionGroups(e,t){this.initGuard();let i=this.gridCharacters?.get(e);if(!i)throw this.createCharUnknownErr(e);i.setCollisionGroups(t)}getTilePosInDirection(e,t,i){if(!this.gridTilemap)throw this.createUninitializedErr();let n=this.gridTilemap.getTilePosInDirection({position:new k(e),layer:t},i);return{position:n.position.toPosition(),charLayer:n.layer}}findShortestPath(e,t,i={}){if(!this.gridTilemap)throw this.createUninitializedErr();let n=i.shortestPathAlgorithm||"BFS";i.considerCosts&&n!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${n}'. It can only be used with A* algorithm.`);let c=new Fo(this.gridTilemap).findShortestPath($.toInternal(e),$.toInternal(t),{...i,shortestPathAlgorithm:n});return{path:c.path.map($.fromInternal),closestToTarget:c.closestToTarget?$.fromInternal(c.closestToTarget):void 0,reachedMaxPathLength:!1,steps:c.steps}}steppedOn(e,t,i){return this.positionChangeFinished().pipe((0,$e.filter)(n=>e.includes(n.charId)&&t.some(s=>s.x===n.enterTile.x&&s.y===n.enterTile.y)&&(i===void 0||i.includes(n.enterLayer))))}characterShifted(){if(!this.charAdded$||!this.charRemoved$)throw this.createUninitializedErr();return this.charAdded$.pipe((0,$e.map)(e=>({charId:e,action:"ADDED"})),(0,$e.mergeWith)(this.charRemoved$.pipe((0,$e.map)(e=>({charId:e,action:"REMOVED"})))))}movementStarted(){if(!this.movementStarted$)throw this.createUninitializedErr();return this.movementStarted$}movementStopped(){if(!this.movementStopped$)throw this.createUninitializedErr();return this.movementStopped$}directionChanged(){if(!this.directionChanged$)throw this.createUninitializedErr();return this.directionChanged$}positionChangeStarted(){if(!this.positionChangeStarted$)throw this.createUninitializedErr();return this.positionChangeStarted$}positionChangeFinished(){if(!this.positionChangeFinished$)throw this.createUninitializedErr();return this.positionChangeFinished$}getMovementProgress(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.getMovementProgress()}rebuildTileCollisionCache(e,t,i,n){this.gridTilemap?.rebuildTileCollisionCache(new Di(e,t,i,n))}addQueueMovements(e,t,i){this.initGuard();let n=this.gridCharacters?.get(e);if(!n)throw this.createCharUnknownErr(e);if(!this.gridTilemap)throw this.createUninitializedErr();let s;n?.getMovement()?.getInfo().type==="Queue"?s=n.getMovement():(s=new jf(n,this.gridTilemap),n.setMovement(s),s.finished().pipe((0,$e.takeUntil)((0,or.merge)(this.charRemoved(e),n.autoMovementSet()))).subscribe(c=>{this.queueMovementFinished$?.next({charId:e,...c})})),s.enqueue(t.map(c=>ai(c)?c:{position:new k(c.position),layer:c.charLayer}),i)}queueMovementFinished(){if(!this.queueMovementFinished$)throw this.createUninitializedErr();return this.queueMovementFinished$}getEnqueuedMovements(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.getMovement()?.getInfo().type==="Queue"?t.getMovement().peekAll().map(n=>({command:ai(n.command)?n.command:$.fromInternal(n.command),config:n.config})):[]}clearEnqueuedMovements(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);t.getMovement()?.getInfo().type==="Queue"&&t.getMovement().clear()}getTileCost(e,t,i){return this.initGuard(),this.gridTilemap?.getTileCosts({position:new k(e),layer:t},i)??1}charRemoved(e){if(!this.charRemoved$)throw this.createUninitializedErr();return this.charRemoved$?.pipe((0,$e.take)(1),(0,$e.filter)(t=>t==e))}initGuard(){if(!this.isCreatedInternal)throw this.createUninitializedErr()}createUninitializedErr(){throw new Error("GridEngine not initialized. You need to call create() first.")}addCharacters(){this.config?.characters.forEach(e=>this.addCharacter(e))}moveChar(e,t){this.initGuard();let i=this.gridCharacters?.get(e);if(!i)throw this.createCharUnknownErr(e);if(i.getNumberOfDirections()===4){if(!this.gridTilemap?.isIsometric()&&En(t)){console.warn(`GridEngine: Character '${e}' can't be moved '${t}' in 4 direction mode.`);return}else if(this.gridTilemap?.isIsometric()&&!En(t)){console.warn(`GridEngine: Character '${e}' can't be moved '${t}' in 4 direction isometric mode.`);return}}i.move(t)}createCharUnknownErr(e){return new Error(`Character unknown: ${e}`)}assembleMoveToConfig(e={}){let t={...e,noPathFoundStrategy:"STOP",pathBlockedStrategy:"WAIT"};return e?.noPathFoundStrategy&&(Object.values(an).includes(e.noPathFoundStrategy)?t.noPathFoundStrategy=e.noPathFoundStrategy:console.warn(`GridEngine: Unknown NoPathFoundStrategy '${e.noPathFoundStrategy}'. Falling back to 'STOP'`)),e?.pathBlockedStrategy&&(Object.values(_o).includes(e.pathBlockedStrategy)?t.pathBlockedStrategy=e.pathBlockedStrategy:console.warn(`GridEngine: Unknown PathBlockedStrategy '${e.pathBlockedStrategy}'. Falling back to 'WAIT'`)),t}setConfigDefaults(e){return{collisionTilePropertyName:"ge_collide",numberOfDirections:4,characterCollisionStrategy:"BLOCK_TWO_TILES",cacheTileCollisions:!1,...e}}};var Df=class extends xo{constructor(e,t={}){super(e,t),this.distanceUtils=ct.create(8)}getForced(e,t){let i=[],n=this.posInDir(t,this.distanceUtils.direction(t.position,e.position)),{topLeft:s,downLeft:c,top:l,bottom:h,topRight:p,downRight:v}=this.normalizedPositions(n,t),b=this.distanceUtils.direction(e.position,t.position),w=(T,q)=>this.isBlocking(T,q)||this.getTransition(q.position,q.layer)!==void 0;return En(b)?(w(e,s)&&!this.isBlocking(t,l)&&i.push(l),w(e,s)&&(w(e,c)||w(c,s))&&!this.isBlocking(t,s)&&i.push(s),w(e,c)&&!this.isBlocking(t,h)&&i.push(h),w(e,c)&&(w(e,s)||w(s,c))&&!this.isBlocking(t,c)&&i.push(c)):(w(e,l)&&(w(e,s)||w(s,l))&&(this.isBlocking(t,s)||i.push(s),this.isBlocking(t,l)||i.push(l)),w(e,l)&&(w(e,s)||w(s,l)||w(l,p))&&!this.isBlocking(t,p)&&i.push(p),w(e,h)&&(w(e,c)||w(c,l))&&(this.isBlocking(t,c)||i.push(c),this.isBlocking(t,h)||i.push(h)),w(e,h)&&(w(e,c)||w(s,h)||w(l,v))&&!this.isBlocking(t,v)&&i.push(v)),i}prune(e,t){let{right:i,topRight:n,downRight:s}=this.normalizedPositions(e,t),c=this.getForced(e,t),l=rt(e.position,t.position);return En(l)?[i,n,s,...c]:[i,...c]}jump(e,t,i,n){let s=this.distanceUtils.direction(e.position,t.position);if(!(this.isBlocking(e,t)&&!($.equal(t,i)&&this.options.ignoreBlockedTarget))){if($.equal(t,i))return{p:t,dist:n};if(n>=this.maxJumpSize)return{p:t,dist:n};if(this.getTransition(t.position,e.layer)!==void 0)return{p:t,dist:n};if(this.getForced(e,t).length>0)return{p:t,dist:n};if(this.updateClosestToTarget(t,i),s==="up-left"){if(this.jump(t,this.getTilePosInDir(t,"up"),i,n+1)!==void 0)return{p:t,dist:n};if(this.jump(t,this.getTilePosInDir(t,"left"),i,n+1)!==void 0)return{p:t,dist:n}}else if(s==="down-left"){if(this.jump(t,this.getTilePosInDir(t,"down"),i,n+1)!==void 0)return{p:t,dist:n};if(this.jump(t,this.getTilePosInDir(t,"left"),i,n+1)!==void 0)return{p:t,dist:n}}else if(s==="up-right"){if(this.jump(t,this.getTilePosInDir(t,"up"),i,n+1)!==void 0)return{p:t,dist:n};if(this.jump(t,this.getTilePosInDir(t,"right"),i,n+1)!==void 0)return{p:t,dist:n}}else if(s==="down-right"){if(this.jump(t,this.getTilePosInDir(t,"down"),i,n+1)!==void 0)return{p:t,dist:n};if(this.jump(t,this.getTilePosInDir(t,"right"),i,n+1)!==void 0)return{p:t,dist:n}}return this.jump(t,this.getTilePosInDir(t,rt(e.position,t.position)),i,n+1)}}};var Fo=class{constructor(e){this.gridTilemap=e}findShortestPath(e,t,i={}){return w5(i.shortestPathAlgorithm||"BIDIRECTIONAL_SEARCH",this.gridTilemap,i).findShortestPath(e,t)}};function w5(r,e,t){switch(r){case"BIDIRECTIONAL_SEARCH":return new df(e,t);case"A_STAR":return new ff(e,t);case"JPS":return t.numberOfDirections===8?new Df(e,t):new xo(e,t)}return new Po(e,t)}var Ff=(h=>(h.SUCCESS="SUCCESS",h.NO_PATH_FOUND_MAX_RETRIES_EXCEEDED="NO_PATH_FOUND_MAX_RETRIES_EXCEEDED",h.PATH_BLOCKED_MAX_RETRIES_EXCEEDED="PATH_BLOCKED_MAX_RETRIES_EXCEEDED",h.PATH_BLOCKED="PATH_BLOCKED",h.NO_PATH_FOUND="NO_PATH_FOUND",h.PATH_BLOCKED_WAIT_TIMEOUT="PATH_BLOCKED_WAIT_TIMEOUT",h.MOVEMENT_TERMINATED="MOVEMENT_TERMINATED",h.MAX_PATH_LENGTH_REACHED="MAX_PATH_LENGTH_REACHED",h))(Ff||{}),jo=class{constructor(e,t,i,{config:n,ignoreBlockedTarget:s=!1,distance:c=0}={}){this.character=e;this.tilemap=t;this.targetPos=i;this.shortestPath=[];this.distOffset=0;this.posOnPath=0;this.stopped=!1;this.pathBlockedWaitElapsed=0;this.isPositionAllowed=()=>!0;this.shortestPathAlgorithm="BIDIRECTIONAL_SEARCH";this.maxPathLength=1/0;this.considerCosts=!1;this.isBlocking=(e,t)=>e?new Po(this.tilemap,this.getPathfindingOptions()).isBlocking(this.character.getTilePos(),{position:e,layer:t}):!0;this.shortestPathAlgorithm=n?.algorithm??this.shortestPathAlgorithm,this.ignoreBlockedTarget=s,this.distance=c,this.noPathFoundStrategy=n?.noPathFoundStrategy||"STOP",this.pathBlockedStrategy=n?.pathBlockedStrategy||"WAIT",this.noPathFoundRetryable=new Ta(n?.noPathFoundRetryBackoffMs||200,n?.noPathFoundMaxRetries||-1,()=>{this.stop("NO_PATH_FOUND_MAX_RETRIES_EXCEEDED")}),this.pathBlockedRetryable=new Ta(n?.pathBlockedRetryBackoffMs||200,n?.pathBlockedMaxRetries||-1,()=>{this.stop("PATH_BLOCKED_MAX_RETRIES_EXCEEDED")}),n?.isPositionAllowedFn&&(this.isPositionAllowed=n.isPositionAllowedFn),n?.maxPathLength&&(this.maxPathLength=n.maxPathLength),n?.considerCosts&&this.shortestPathAlgorithm!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${this.shortestPathAlgorithm}'. It can only be used with A* algorithm.`),this.considerCosts=n?.considerCosts||!1,this.ignoreLayers=!!n?.ignoreLayers,this.distanceUtils=ct.create(e.getNumberOfDirections()),this.pathBlockedWaitTimeoutMs=n?.pathBlockedWaitTimeoutMs||-1,this.finished$=new Do.Subject,this.setCharacter(e)}setPathBlockedStrategy(e){this.pathBlockedStrategy=e}getPathBlockedStrategy(){return this.pathBlockedStrategy}setCharacter(e){this.character=e,this.noPathFoundRetryable.reset(),this.pathBlockedRetryable.reset(),this.pathBlockedWaitElapsed=0,this.calcShortestPath(),this.character.autoMovementSet().pipe((0,Do.filter)(t=>t!==this),(0,Do.take)(1)).subscribe(()=>{this.stop("MOVEMENT_TERMINATED")})}getPathfindingOptions(){return{shortestPathAlgorithm:this.shortestPathAlgorithm,pathWidth:this.character.getTileWidth(),pathHeight:this.character.getTileHeight(),numberOfDirections:this.character.getNumberOfDirections(),isPositionAllowed:this.isPositionAllowed,collisionGroups:this.character.getCollisionGroups(),ignoredChars:[this.character.getId()],ignoreTiles:!this.character.collidesWithTiles(),ignoreMapBounds:this.character.getIgnoreMissingTiles(),ignoreBlockedTarget:this.ignoreBlockedTarget,maxPathLength:this.maxPathLength,ignoreLayers:this.ignoreLayers,considerCosts:this.considerCosts,calculateClosestToTarget:!0}}update(e){this.stopped||(this.noPathFound()&&(this.noPathFoundStrategy==="RETRY"?this.noPathFoundRetryable.retry(e,()=>this.calcShortestPath()):this.noPathFoundStrategy==="STOP"&&this.stop("NO_PATH_FOUND")),this.updatePosOnPath(),this.isBlocking(this.nextTileOnPath()?.position,this.character?.getNextTilePos().layer)?this.applyPathBlockedStrategy(e):this.pathBlockedWaitElapsed=0,this.hasArrived()?(this.stop("SUCCESS"),this.existsDistToTarget()&&this.turnTowardsTarget()):this.isBlocking(this.nextTileOnPath()?.position,this.character?.getNextTilePos().layer)||this.moveCharOnPath())}finishedObs(){return this.finished$}getInfo(){return{type:"Target",state:{pathAhead:this.shortestPath.slice(this.posOnPath).map(e=>$.fromInternal(e))},config:{algorithm:this.shortestPathAlgorithm,ignoreBlockedTarget:this.ignoreBlockedTarget,distance:this.distance,targetPos:$.fromInternal(this.targetPos),noPathFoundStrategy:this.noPathFoundStrategy,pathBlockedStrategy:this.pathBlockedStrategy,noPathFoundRetryBackoffMs:this.noPathFoundRetryable.getBackoffMs(),noPathFoundMaxRetries:this.noPathFoundRetryable.getMaxRetries()}}}resultToReason(e){switch(e){case"SUCCESS":return"Successfully arrived.";case"MOVEMENT_TERMINATED":return"Movement of character has been replaced before destination was reached.";case"PATH_BLOCKED":return"PathBlockedStrategy STOP: Path blocked.";case"NO_PATH_FOUND_MAX_RETRIES_EXCEEDED":return`NoPathFoundStrategy RETRY: Maximum retries of ${this.noPathFoundRetryable.getMaxRetries()} exceeded.`;case"NO_PATH_FOUND":return"NoPathFoundStrategy STOP: No path found.";case"PATH_BLOCKED_MAX_RETRIES_EXCEEDED":return`PathBlockedStrategy RETRY: Maximum retries of ${this.pathBlockedRetryable.getMaxRetries()} exceeded.`;case"PATH_BLOCKED_WAIT_TIMEOUT":return`PathBlockedStrategy WAIT: Wait timeout of ${this.pathBlockedWaitTimeoutMs}ms exceeded.`}}applyPathBlockedStrategy(e){this.pathBlockedStrategy==="RETRY"?this.pathBlockedRetryable.retry(e,()=>{let t=this.getShortestPath();t.path.length>0&&this.calcShortestPath(t)}):this.pathBlockedStrategy==="STOP"?this.stop("PATH_BLOCKED"):this.pathBlockedStrategy==="WAIT"&&this.pathBlockedWaitTimeoutMs>-1&&(this.pathBlockedWaitElapsed+=e,this.pathBlockedWaitElapsed>=this.pathBlockedWaitTimeoutMs&&this.stop("PATH_BLOCKED_WAIT_TIMEOUT"))}moveCharOnPath(){let e=this.nextTileOnPath();if(!e)return;let t=this.getDir(this.character.getNextTilePos().position,e.position);this.character.move(t)}nextTileOnPath(){return this.shortestPath[this.posOnPath+1]}stop(e){this.finished$.next({position:this.character.getTilePos().position,result:e,description:this.resultToReason(e),layer:this.character.getTilePos().layer}),this.finished$.complete(),this.stopped=!0}turnTowardsTarget(){let e=this.shortestPath[this.posOnPath+1],t=this.getDir(this.character.getNextTilePos().position,e.position);this.character.turnTowards(t)}existsDistToTarget(){return this.posOnPath=this.shortestPath.length-1}updatePosOnPath(){let e=this.shortestPath[this.posOnPath];for(;this.posOnPaththis.isLayerAlwaysOnTop(s));this.tilemap.layers.filter(s=>!this.isLayerAlwaysOnTop(s)).forEach(s=>{this.hasLayerProp(s,r.HEIGHT_SHIFT_PROP_NAME)?(this.createHeightShiftLayers(s,t),e.push(s.tilemapLayer)):this.setDepth(s,++t)}),this.charLayerDepths.set(void 0,t),i.forEach((s,c)=>{s.tilemapLayer.setDepth(c+1+t)}),e.forEach(s=>s.destroy())}setDepth(e,t){e.tilemapLayer.setDepth(t),this.isCharLayer(e)&&this.charLayerDepths.set(this.getLayerProp(e,r.CHAR_LAYER_PROP_NAME),t)}createHeightShiftLayers(e,t){let i=this.getLayerProp(e,r.HEIGHT_SHIFT_PROP_NAME);isNaN(i)&&(i=0);let n=1;for(let s=0;ss.name==t)?.value}hasLayerProp(e,t){return this.getLayerProp(e,t)!=null}copyLayer(e,t){let i=`${e.name}#${t}`,n=this.tilemap.createBlankLayer(i,e.tilemapLayer.tileset);if(n){n.name=i;for(let s=0;s()=>(e||r((e={exports:{}}).exports,e),e.exports),C5=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of T5(e))!E5.call(r,n)&&n!==t&&zw(r,n,{get:()=>e[n],enumerable:!(i=S5(e,n))||i.enumerable});return r},gm=(r,e,t)=>(t=r!=null?O5(A5(r)):{},C5(e||!r||!r.__esModule?zw(t,"default",{value:r,enumerable:!0}):t,r)),bm=q5((r,e)=>{(function(){var t,i="4.17.21",n=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",p=500,v="__lodash_placeholder__",b=1,w=2,T=4,q=1,M=2,L=1,D=2,N=4,Q=8,ie=16,pe=32,Fe=64,pt=128,No=256,Nf=512,Uw=30,Bw="...",Gw=800,Hw=16,wm=1,$w=2,Qw=3,Ri=1/0,Kr=9007199254740991,Kw=17976931348623157e292,za=0/0,ar=4294967295,Yw=ar-1,Xw=ar>>>1,Jw=[["ary",pt],["bind",L],["bindKey",D],["curry",Q],["curryRight",ie],["flip",Nf],["partial",pe],["partialRight",Fe],["rearg",No]],hn="[object Arguments]",Na="[object Array]",Zw="[object AsyncFunction]",Vo="[object Boolean]",Wo="[object Date]",eO="[object DOMException]",Va="[object Error]",Wa="[object Function]",Om="[object GeneratorFunction]",Gt="[object Map]",Uo="[object Number]",tO="[object Null]",Cr="[object Object]",Sm="[object Promise]",rO="[object Proxy]",Bo="[object RegExp]",Ht="[object Set]",Go="[object String]",Ua="[object Symbol]",iO="[object Undefined]",Ho="[object WeakMap]",nO="[object WeakSet]",$o="[object ArrayBuffer]",pn="[object DataView]",Vf="[object Float32Array]",Wf="[object Float64Array]",Uf="[object Int8Array]",Bf="[object Int16Array]",Gf="[object Int32Array]",Hf="[object Uint8Array]",$f="[object Uint8ClampedArray]",Qf="[object Uint16Array]",Kf="[object Uint32Array]",oO=/\b__p \+= '';/g,aO=/\b(__p \+=) '' \+/g,sO=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Tm=/&(?:amp|lt|gt|quot|#39);/g,Am=/[&<>"']/g,uO=RegExp(Tm.source),cO=RegExp(Am.source),lO=/<%-([\s\S]+?)%>/g,fO=/<%([\s\S]+?)%>/g,Em=/<%=([\s\S]+?)%>/g,hO=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,pO=/^\w*$/,dO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Yf=/[\\^$.*+?()[\]{}|]/g,vO=RegExp(Yf.source),Xf=/^\s+/,mO=/\s/,yO=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,gO=/\{\n\/\* \[wrapped with (.+)\] \*/,bO=/,? & /,_O=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,PO=/[()=,{}\[\]\/\s]/,wO=/\\(\\)?/g,OO=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,qm=/\w*$/,SO=/^[-+]0x[0-9a-f]+$/i,TO=/^0b[01]+$/i,AO=/^\[object .+?Constructor\]$/,EO=/^0o[0-7]+$/i,qO=/^(?:0|[1-9]\d*)$/,CO=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ba=/($^)/,MO=/['\n\r\u2028\u2029\\]/g,Ga="\\ud800-\\udfff",xO="\\u0300-\\u036f",LO="\\ufe20-\\ufe2f",jO="\\u20d0-\\u20ff",Cm=xO+LO+jO,Mm="\\u2700-\\u27bf",xm="a-z\\xdf-\\xf6\\xf8-\\xff",IO="\\xac\\xb1\\xd7\\xf7",FO="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",DO="\\u2000-\\u206f",kO=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Lm="A-Z\\xc0-\\xd6\\xd8-\\xde",jm="\\ufe0e\\ufe0f",Im=IO+FO+DO+kO,Jf="['\u2019]",RO="["+Ga+"]",Fm="["+Im+"]",Ha="["+Cm+"]",Dm="\\d+",zO="["+Mm+"]",km="["+xm+"]",Rm="[^"+Ga+Im+Dm+Mm+xm+Lm+"]",Zf="\\ud83c[\\udffb-\\udfff]",NO="(?:"+Ha+"|"+Zf+")",zm="[^"+Ga+"]",eh="(?:\\ud83c[\\udde6-\\uddff]){2}",th="[\\ud800-\\udbff][\\udc00-\\udfff]",dn="["+Lm+"]",Nm="\\u200d",Vm="(?:"+km+"|"+Rm+")",VO="(?:"+dn+"|"+Rm+")",Wm="(?:"+Jf+"(?:d|ll|m|re|s|t|ve))?",Um="(?:"+Jf+"(?:D|LL|M|RE|S|T|VE))?",Bm=NO+"?",Gm="["+jm+"]?",WO="(?:"+Nm+"(?:"+[zm,eh,th].join("|")+")"+Gm+Bm+")*",UO="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",BO="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Hm=Gm+Bm+WO,GO="(?:"+[zO,eh,th].join("|")+")"+Hm,HO="(?:"+[zm+Ha+"?",Ha,eh,th,RO].join("|")+")",$O=RegExp(Jf,"g"),QO=RegExp(Ha,"g"),rh=RegExp(Zf+"(?="+Zf+")|"+HO+Hm,"g"),KO=RegExp([dn+"?"+km+"+"+Wm+"(?="+[Fm,dn,"$"].join("|")+")",VO+"+"+Um+"(?="+[Fm,dn+Vm,"$"].join("|")+")",dn+"?"+Vm+"+"+Wm,dn+"+"+Um,BO,UO,Dm,GO].join("|"),"g"),YO=RegExp("["+Nm+Ga+Cm+jm+"]"),XO=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,JO=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ZO=-1,ye={};ye[Vf]=ye[Wf]=ye[Uf]=ye[Bf]=ye[Gf]=ye[Hf]=ye[$f]=ye[Qf]=ye[Kf]=!0,ye[hn]=ye[Na]=ye[$o]=ye[Vo]=ye[pn]=ye[Wo]=ye[Va]=ye[Wa]=ye[Gt]=ye[Uo]=ye[Cr]=ye[Bo]=ye[Ht]=ye[Go]=ye[Ho]=!1;var ve={};ve[hn]=ve[Na]=ve[$o]=ve[pn]=ve[Vo]=ve[Wo]=ve[Vf]=ve[Wf]=ve[Uf]=ve[Bf]=ve[Gf]=ve[Gt]=ve[Uo]=ve[Cr]=ve[Bo]=ve[Ht]=ve[Go]=ve[Ua]=ve[Hf]=ve[$f]=ve[Qf]=ve[Kf]=!0,ve[Va]=ve[Wa]=ve[Ho]=!1;var eS={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},tS={"&":"&","<":"<",">":">",'"':""","'":"'"},rS={"&":"&","<":"<",">":">",""":'"',"'":"'"},iS={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},nS=parseFloat,oS=parseInt,$m=typeof global=="object"&&global&&global.Object===Object&&global,aS=typeof self=="object"&&self&&self.Object===Object&&self,Ve=$m||aS||Function("return this")(),ih=typeof r=="object"&&r&&!r.nodeType&&r,zi=ih&&typeof e=="object"&&e&&!e.nodeType&&e,Qm=zi&&zi.exports===ih,nh=Qm&&$m.process,Ft=function(){try{var A=zi&&zi.require&&zi.require("util").types;return A||nh&&nh.binding&&nh.binding("util")}catch{}}(),Km=Ft&&Ft.isArrayBuffer,Ym=Ft&&Ft.isDate,Xm=Ft&&Ft.isMap,Jm=Ft&&Ft.isRegExp,Zm=Ft&&Ft.isSet,ey=Ft&&Ft.isTypedArray;function Tt(A,x,C){switch(C.length){case 0:return A.call(x);case 1:return A.call(x,C[0]);case 2:return A.call(x,C[0],C[1]);case 3:return A.call(x,C[0],C[1],C[2])}return A.apply(x,C)}function sS(A,x,C,V){for(var K=-1,se=A==null?0:A.length;++K-1}function oh(A,x,C){for(var V=-1,K=A==null?0:A.length;++V-1;);return C}function uy(A,x){for(var C=A.length;C--&&vn(x,A[C],0)>-1;);return C}function mS(A,x){for(var C=A.length,V=0;C--;)A[C]===x&&++V;return V}var yS=ch(eS),gS=ch(tS);function bS(A){return"\\"+iS[A]}function _S(A,x){return A==null?t:A[x]}function mn(A){return YO.test(A)}function PS(A){return XO.test(A)}function wS(A){for(var x,C=[];!(x=A.next()).done;)C.push(x.value);return C}function ph(A){var x=-1,C=Array(A.size);return A.forEach(function(V,K){C[++x]=[K,V]}),C}function cy(A,x){return function(C){return A(x(C))}}function Jr(A,x){for(var C=-1,V=A.length,K=0,se=[];++C-1}function cT(o,a){var u=this.__data__,f=ls(u,o);return f<0?(++this.size,u.push([o,a])):u[f][1]=a,this}Mr.prototype.clear=oT,Mr.prototype.delete=aT,Mr.prototype.get=sT,Mr.prototype.has=uT,Mr.prototype.set=cT;function xr(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a=a?o:a)),o}function zt(o,a,u,f,d,g){var P,S=a&b,E=a&w,j=a&T;if(u&&(P=d?u(o,f,d,g):u(o)),P!==t)return P;if(!we(o))return o;var I=Y(o);if(I){if(P=pA(o),!S)return dt(o,P)}else{var F=tt(o),R=F==Wa||F==Om;if(oi(o))return Gy(o,S);if(F==Cr||F==hn||R&&!d){if(P=E||R?{}:lg(o),!S)return E?rA(o,TT(P,o)):tA(o,Py(P,o))}else{if(!ve[F])return d?o:{};P=dA(o,F,S)}}g||(g=new Qt);var W=g.get(o);if(W)return W;g.set(o,P),zg(o)?o.forEach(function(H){P.add(zt(H,a,u,H,o,g))}):kg(o)&&o.forEach(function(H,te){P.set(te,zt(H,a,u,te,o,g))});var G=j?E?zh:Rh:E?mt:We,Z=I?t:G(o);return Dt(Z||o,function(H,te){Z&&(te=H,H=o[te]),ea(P,te,zt(H,a,u,te,o,g))}),P}function AT(o){var a=We(o);return function(u){return wy(u,o,a)}}function wy(o,a,u){var f=u.length;if(o==null)return!f;for(o=de(o);f--;){var d=u[f],g=a[d],P=o[d];if(P===t&&!(d in o)||!g(P))return!1}return!0}function Oy(o,a,u){if(typeof o!="function")throw new kt(c);return sa(function(){o.apply(t,u)},a)}function ta(o,a,u,f){var d=-1,g=$a,P=!0,S=o.length,E=[],j=a.length;if(!S)return E;u&&(a=ge(a,At(u))),f?(g=oh,P=!1):a.length>=n&&(g=Qo,P=!1,a=new Wi(a));e:for(;++dd?0:d+u),f=f===t||f>d?d:J(f),f<0&&(f+=d),f=u>f?0:Vg(f);u0&&u(S)?a>1?Qe(S,a-1,u,f,d):Xr(d,S):f||(d[d.length]=S)}return d}var _h=Xy(),Ay=Xy(!0);function sr(o,a){return o&&_h(o,a,We)}function Ph(o,a){return o&&Ay(o,a,We)}function hs(o,a){return Yr(a,function(u){return Dr(o[u])})}function Bi(o,a){a=ii(a,o);for(var u=0,f=a.length;o!=null&&ua}function CT(o,a){return o!=null&&ce.call(o,a)}function MT(o,a){return o!=null&&a in de(o)}function xT(o,a,u){return o>=et(a,u)&&o=120&&I.length>=120)?new Wi(P&&I):t}I=o[0];var F=-1,R=S[0];e:for(;++F-1;)S!==o&&is.call(S,E,1),is.call(o,E,1);return o}function ky(o,a){for(var u=o?a.length:0,f=u-1;u--;){var d=a[u];if(u==f||d!==g){var g=d;Fr(d)?is.call(o,d,1):xh(o,d)}}return o}function qh(o,a){return o+as(yy()*(a-o+1))}function BT(o,a,u,f){for(var d=-1,g=ke(os((a-o)/(u||1)),0),P=C(g);g--;)P[f?g:++d]=o,o+=u;return P}function Ch(o,a){var u="";if(!o||a<1||a>Kr)return u;do a%2&&(u+=o),a=as(a/2),a&&(o+=o);while(a);return u}function ee(o,a){return Hh(pg(o,a,yt),o+"")}function GT(o){return _y(An(o))}function HT(o,a){var u=An(o);return Os(u,Ui(a,0,u.length))}function na(o,a,u,f){if(!we(o))return o;a=ii(a,o);for(var d=-1,g=a.length,P=g-1,S=o;S!=null&&++dd?0:d+a),u=u>d?d:u,u<0&&(u+=d),d=a>u?0:u-a>>>0,a>>>=0;for(var g=C(d);++f>>1,P=o[g];P!==null&&!qt(P)&&(u?P<=a:P=n){var j=a?null:aA(o);if(j)return Ka(j);P=!1,d=Qo,E=new Wi}else E=a?[]:S;e:for(;++f=f?o:Nt(o,a,u)}var By=kS||function(o){return Ve.clearTimeout(o)};function Gy(o,a){if(a)return o.slice();var u=o.length,f=hy?hy(u):new o.constructor(u);return o.copy(f),f}function Fh(o){var a=new o.constructor(o.byteLength);return new ts(a).set(new ts(o)),a}function XT(o,a){var u=a?Fh(o.buffer):o.buffer;return new o.constructor(u,o.byteOffset,o.byteLength)}function JT(o){var a=new o.constructor(o.source,qm.exec(o));return a.lastIndex=o.lastIndex,a}function ZT(o){return Zo?de(Zo.call(o)):{}}function Hy(o,a){var u=a?Fh(o.buffer):o.buffer;return new o.constructor(u,o.byteOffset,o.length)}function $y(o,a){if(o!==a){var u=o!==t,f=o===null,d=o===o,g=qt(o),P=a!==t,S=a===null,E=a===a,j=qt(a);if(!S&&!j&&!g&&o>a||g&&P&&E&&!S&&!j||f&&P&&E||!u&&E||!d)return 1;if(!f&&!g&&!j&&o=S)return E;var j=u[f];return E*(j=="desc"?-1:1)}}return o.index-a.index}function Qy(o,a,u,f){for(var d=-1,g=o.length,P=u.length,S=-1,E=a.length,j=ke(g-P,0),I=C(E+j),F=!f;++S1?u[d-1]:t,P=d>2?u[2]:t;for(g=o.length>3&&typeof g=="function"?(d--,g):t,P&&st(u[0],u[1],P)&&(g=d<3?t:g,d=1),a=de(a);++f-1?d[g?a[P]:P]:t}}function eg(o){return Ir(function(a){var u=a.length,f=u,d=Rt.prototype.thru;for(o&&a.reverse();f--;){var g=a[f];if(typeof g!="function")throw new kt(c);if(d&&!P&&Ps(g)=="wrapper")var P=new Rt([],!0)}for(f=P?f:u;++f1&&ne.reverse(),I&&ES))return!1;var j=g.get(o),I=g.get(a);if(j&&I)return j==a&&I==o;var F=-1,R=!0,W=u&M?new Wi:t;for(g.set(o,a),g.set(a,o);++F1?"& ":"")+a[f],a=a.join(u>2?", ":" "),o.replace(yO,`{ +/* [wrapped with `+a+`] */ +`)}function mA(o){return Y(o)||$i(o)||!!(vy&&o&&o[vy])}function Fr(o,a){var u=typeof o;return a=a??Kr,!!a&&(u=="number"||u!="symbol"&&qO.test(o))&&o>-1&&o%1==0&&o0){if(++a>=Gw)return arguments[0]}else a=0;return o.apply(t,arguments)}}function Os(o,a){var u=-1,f=o.length,d=f-1;for(a=a===t?f:a;++u1?o[a-1]:t;return u=typeof u=="function"?(o.pop(),u):t,Tg(o,u)});function Ag(o){var a=y(o);return a.__chain__=!0,a}function EE(o,a){return a(o),o}function Ss(o,a){return a(o)}var qE=Ir(function(o){var a=o.length,u=a?o[0]:0,f=this.__wrapped__,d=function(g){return bh(g,o)};return a>1||this.__actions__.length||!(f instanceof re)||!Fr(u)?this.thru(d):(f=f.slice(u,+u+(a?1:0)),f.__actions__.push({func:Ss,args:[d],thisArg:t}),new Rt(f,this.__chain__).thru(function(g){return a&&!g.length&&g.push(t),g}))});function CE(){return Ag(this)}function ME(){return new Rt(this.value(),this.__chain__)}function xE(){this.__values__===t&&(this.__values__=Ng(this.value()));var o=this.__index__>=this.__values__.length,a=o?t:this.__values__[this.__index__++];return{done:o,value:a}}function LE(){return this}function jE(o){for(var a,u=this;u instanceof cs;){var f=bg(u);f.__index__=0,f.__values__=t,a?d.__wrapped__=f:a=f;var d=f;u=u.__wrapped__}return d.__wrapped__=o,a}function IE(){var o=this.__wrapped__;if(o instanceof re){var a=o;return this.__actions__.length&&(a=new re(this)),a=a.reverse(),a.__actions__.push({func:Ss,args:[$h],thisArg:t}),new Rt(a,this.__chain__)}return this.thru($h)}function FE(){return Wy(this.__wrapped__,this.__actions__)}var DE=ms(function(o,a,u){ce.call(o,u)?++o[u]:Lr(o,u,1)});function kE(o,a,u){var f=Y(o)?ty:ET;return u&&st(o,a,u)&&(a=t),f(o,B(a,3))}function RE(o,a){var u=Y(o)?Yr:Ty;return u(o,B(a,3))}var zE=Zy(_g),NE=Zy(Pg);function VE(o,a){return Qe(Ts(o,a),1)}function WE(o,a){return Qe(Ts(o,a),Ri)}function UE(o,a,u){return u=u===t?1:J(u),Qe(Ts(o,a),u)}function Eg(o,a){var u=Y(o)?Dt:ti;return u(o,B(a,3))}function qg(o,a){var u=Y(o)?uS:Sy;return u(o,B(a,3))}var BE=ms(function(o,a,u){ce.call(o,u)?o[u].push(a):Lr(o,u,[a])});function GE(o,a,u,f){o=vt(o)?o:An(o),u=u&&!f?J(u):0;var d=o.length;return u<0&&(u=ke(d+u,0)),Ms(o)?u<=d&&o.indexOf(a,u)>-1:!!d&&vn(o,a,u)>-1}var HE=ee(function(o,a,u){var f=-1,d=typeof a=="function",g=vt(o)?C(o.length):[];return ti(o,function(P){g[++f]=d?Tt(a,P,u):ra(P,a,u)}),g}),$E=ms(function(o,a,u){Lr(o,u,a)});function Ts(o,a){var u=Y(o)?ge:xy;return u(o,B(a,3))}function QE(o,a,u,f){return o==null?[]:(Y(a)||(a=a==null?[]:[a]),u=f?t:u,Y(u)||(u=u==null?[]:[u]),Fy(o,a,u))}var KE=ms(function(o,a,u){o[u?0:1].push(a)},function(){return[[],[]]});function YE(o,a,u){var f=Y(o)?ah:oy,d=arguments.length<3;return f(o,B(a,4),u,d,ti)}function XE(o,a,u){var f=Y(o)?cS:oy,d=arguments.length<3;return f(o,B(a,4),u,d,Sy)}function JE(o,a){var u=Y(o)?Yr:Ty;return u(o,qs(B(a,3)))}function ZE(o){var a=Y(o)?_y:GT;return a(o)}function eq(o,a,u){(u?st(o,a,u):a===t)?a=1:a=J(a);var f=Y(o)?wT:HT;return f(o,a)}function tq(o){var a=Y(o)?OT:QT;return a(o)}function rq(o){if(o==null)return 0;if(vt(o))return Ms(o)?yn(o):o.length;var a=tt(o);return a==Gt||a==Ht?o.size:Th(o).length}function iq(o,a,u){var f=Y(o)?sh:KT;return u&&st(o,a,u)&&(a=t),f(o,B(a,3))}var nq=ee(function(o,a){if(o==null)return[];var u=a.length;return u>1&&st(o,a[0],a[1])?a=[]:u>2&&st(a[0],a[1],a[2])&&(a=[a[0]]),Fy(o,Qe(a,1),[])}),As=RS||function(){return Ve.Date.now()};function oq(o,a){if(typeof a!="function")throw new kt(c);return o=J(o),function(){if(--o<1)return a.apply(this,arguments)}}function Cg(o,a,u){return a=u?t:a,a=o&&a==null?o.length:a,jr(o,pt,t,t,t,t,a)}function Mg(o,a){var u;if(typeof a!="function")throw new kt(c);return o=J(o),function(){return--o>0&&(u=a.apply(this,arguments)),o<=1&&(a=t),u}}var Kh=ee(function(o,a,u){var f=L;if(u.length){var d=Jr(u,Sn(Kh));f|=pe}return jr(o,f,a,u,d)}),xg=ee(function(o,a,u){var f=L|D;if(u.length){var d=Jr(u,Sn(xg));f|=pe}return jr(a,f,o,u,d)});function Lg(o,a,u){a=u?t:a;var f=jr(o,Q,t,t,t,t,t,a);return f.placeholder=Lg.placeholder,f}function jg(o,a,u){a=u?t:a;var f=jr(o,ie,t,t,t,t,t,a);return f.placeholder=jg.placeholder,f}function Ig(o,a,u){var f,d,g,P,S,E,j=0,I=!1,F=!1,R=!0;if(typeof o!="function")throw new kt(c);a=Wt(a)||0,we(u)&&(I=!!u.leading,F="maxWait"in u,g=F?ke(Wt(u.maxWait)||0,a):g,R="trailing"in u?!!u.trailing:R);function W(qe){var Yt=f,Rr=d;return f=d=t,j=qe,P=o.apply(Rr,Yt),P}function G(qe){return j=qe,S=sa(te,a),I?W(qe):P}function Z(qe){var Yt=qe-E,Rr=qe-j,Zg=a-Yt;return F?et(Zg,g-Rr):Zg}function H(qe){var Yt=qe-E,Rr=qe-j;return E===t||Yt>=a||Yt<0||F&&Rr>=g}function te(){var qe=As();if(H(qe))return ne(qe);S=sa(te,Z(qe))}function ne(qe){return S=t,R&&f?W(qe):(f=d=t,P)}function Ct(){S!==t&&By(S),j=0,f=E=d=S=t}function ut(){return S===t?P:ne(As())}function Mt(){var qe=As(),Yt=H(qe);if(f=arguments,d=this,E=qe,Yt){if(S===t)return G(E);if(F)return By(S),S=sa(te,a),W(E)}return S===t&&(S=sa(te,a)),P}return Mt.cancel=Ct,Mt.flush=ut,Mt}var aq=ee(function(o,a){return Oy(o,1,a)}),sq=ee(function(o,a,u){return Oy(o,Wt(a)||0,u)});function uq(o){return jr(o,Nf)}function Es(o,a){if(typeof o!="function"||a!=null&&typeof a!="function")throw new kt(c);var u=function(){var f=arguments,d=a?a.apply(this,f):f[0],g=u.cache;if(g.has(d))return g.get(d);var P=o.apply(this,f);return u.cache=g.set(d,P)||g,P};return u.cache=new(Es.Cache||xr),u}Es.Cache=xr;function qs(o){if(typeof o!="function")throw new kt(c);return function(){var a=arguments;switch(a.length){case 0:return!o.call(this);case 1:return!o.call(this,a[0]);case 2:return!o.call(this,a[0],a[1]);case 3:return!o.call(this,a[0],a[1],a[2])}return!o.apply(this,a)}}function cq(o){return Mg(2,o)}var lq=YT(function(o,a){a=a.length==1&&Y(a[0])?ge(a[0],At(B())):ge(Qe(a,1),At(B()));var u=a.length;return ee(function(f){for(var d=-1,g=et(f.length,u);++d=a}),$i=qy(function(){return arguments}())?qy:function(o){return Te(o)&&ce.call(o,"callee")&&!dy.call(o,"callee")},Y=C.isArray,Tq=Km?At(Km):jT;function vt(o){return o!=null&&Cs(o.length)&&!Dr(o)}function Ee(o){return Te(o)&&vt(o)}function Aq(o){return o===!0||o===!1||Te(o)&&at(o)==Vo}var oi=NS||sp,Eq=Ym?At(Ym):IT;function qq(o){return Te(o)&&o.nodeType===1&&!ua(o)}function Cq(o){if(o==null)return!0;if(vt(o)&&(Y(o)||typeof o=="string"||typeof o.splice=="function"||oi(o)||Tn(o)||$i(o)))return!o.length;var a=tt(o);if(a==Gt||a==Ht)return!o.size;if(aa(o))return!Th(o).length;for(var u in o)if(ce.call(o,u))return!1;return!0}function Mq(o,a){return ia(o,a)}function xq(o,a,u){u=typeof u=="function"?u:t;var f=u?u(o,a):t;return f===t?ia(o,a,t,u):!!f}function Xh(o){if(!Te(o))return!1;var a=at(o);return a==Va||a==eO||typeof o.message=="string"&&typeof o.name=="string"&&!ua(o)}function Lq(o){return typeof o=="number"&&my(o)}function Dr(o){if(!we(o))return!1;var a=at(o);return a==Wa||a==Om||a==Zw||a==rO}function Dg(o){return typeof o=="number"&&o==J(o)}function Cs(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=Kr}function we(o){var a=typeof o;return o!=null&&(a=="object"||a=="function")}function Te(o){return o!=null&&typeof o=="object"}var kg=Xm?At(Xm):DT;function jq(o,a){return o===a||Sh(o,a,Vh(a))}function Iq(o,a,u){return u=typeof u=="function"?u:t,Sh(o,a,Vh(a),u)}function Fq(o){return Rg(o)&&o!=+o}function Dq(o){if(bA(o))throw new K(s);return Cy(o)}function kq(o){return o===null}function Rq(o){return o==null}function Rg(o){return typeof o=="number"||Te(o)&&at(o)==Uo}function ua(o){if(!Te(o)||at(o)!=Cr)return!1;var a=rs(o);if(a===null)return!0;var u=ce.call(a,"constructor")&&a.constructor;return typeof u=="function"&&u instanceof u&&Ja.call(u)==IS}var Jh=Jm?At(Jm):kT;function zq(o){return Dg(o)&&o>=-Kr&&o<=Kr}var zg=Zm?At(Zm):RT;function Ms(o){return typeof o=="string"||!Y(o)&&Te(o)&&at(o)==Go}function qt(o){return typeof o=="symbol"||Te(o)&&at(o)==Ua}var Tn=ey?At(ey):zT;function Nq(o){return o===t}function Vq(o){return Te(o)&&tt(o)==Ho}function Wq(o){return Te(o)&&at(o)==nO}var Uq=_s(Ah),Bq=_s(function(o,a){return o<=a});function Ng(o){if(!o)return[];if(vt(o))return Ms(o)?$t(o):dt(o);if(Ko&&o[Ko])return wS(o[Ko]());var a=tt(o),u=a==Gt?ph:a==Ht?Ka:An;return u(o)}function kr(o){if(!o)return o===0?o:0;if(o=Wt(o),o===Ri||o===-Ri){var a=o<0?-1:1;return a*Kw}return o===o?o:0}function J(o){var a=kr(o),u=a%1;return a===a?u?a-u:a:0}function Vg(o){return o?Ui(J(o),0,ar):0}function Wt(o){if(typeof o=="number")return o;if(qt(o))return za;if(we(o)){var a=typeof o.valueOf=="function"?o.valueOf():o;o=we(a)?a+"":a}if(typeof o!="string")return o===0?o:+o;o=ay(o);var u=TO.test(o);return u||EO.test(o)?oS(o.slice(2),u?2:8):SO.test(o)?za:+o}function Wg(o){return ur(o,mt(o))}function Gq(o){return o?Ui(J(o),-Kr,Kr):o===0?o:0}function ue(o){return o==null?"":Et(o)}var Hq=wn(function(o,a){if(aa(a)||vt(a)){ur(a,We(a),o);return}for(var u in a)ce.call(a,u)&&ea(o,u,a[u])}),Ug=wn(function(o,a){ur(a,mt(a),o)}),xs=wn(function(o,a,u,f){ur(a,mt(a),o,f)}),$q=wn(function(o,a,u,f){ur(a,We(a),o,f)}),Qq=Ir(bh);function Kq(o,a){var u=Pn(o);return a==null?u:Py(u,a)}var Yq=ee(function(o,a){o=de(o);var u=-1,f=a.length,d=f>2?a[2]:t;for(d&&st(a[0],a[1],d)&&(f=1);++u1),g}),ur(o,zh(o),u),f&&(u=zt(u,b|w|T,sA));for(var d=a.length;d--;)xh(u,a[d]);return u});function dC(o,a){return Gg(o,qs(B(a)))}var vC=Ir(function(o,a){return o==null?{}:WT(o,a)});function Gg(o,a){if(o==null)return{};var u=ge(zh(o),function(f){return[f]});return a=B(a),Dy(o,u,function(f,d){return a(f,d[0])})}function mC(o,a,u){a=ii(a,o);var f=-1,d=a.length;for(d||(d=1,o=t);++fa){var f=o;o=a,a=f}if(u||o%1||a%1){var d=yy();return et(o+d*(a-o+nS("1e-"+((d+"").length-1))),a)}return qh(o,a)}var EC=On(function(o,a,u){return a=a.toLowerCase(),o+(u?Qg(a):a)});function Qg(o){return tp(ue(o).toLowerCase())}function Kg(o){return o=ue(o),o&&o.replace(CO,yS).replace(QO,"")}function qC(o,a,u){o=ue(o),a=Et(a);var f=o.length;u=u===t?f:Ui(J(u),0,f);var d=u;return u-=a.length,u>=0&&o.slice(u,d)==a}function CC(o){return o=ue(o),o&&cO.test(o)?o.replace(Am,gS):o}function MC(o){return o=ue(o),o&&vO.test(o)?o.replace(Yf,"\\$&"):o}var xC=On(function(o,a,u){return o+(u?"-":"")+a.toLowerCase()}),LC=On(function(o,a,u){return o+(u?" ":"")+a.toLowerCase()}),jC=Jy("toLowerCase");function IC(o,a,u){o=ue(o),a=J(a);var f=a?yn(o):0;if(!a||f>=a)return o;var d=(a-f)/2;return bs(as(d),u)+o+bs(os(d),u)}function FC(o,a,u){o=ue(o),a=J(a);var f=a?yn(o):0;return a&&f>>0,u?(o=ue(o),o&&(typeof a=="string"||a!=null&&!Jh(a))&&(a=Et(a),!a&&mn(o))?ni($t(o),0,u):o.split(a,u)):[]}var WC=On(function(o,a,u){return o+(u?" ":"")+tp(a)});function UC(o,a,u){return o=ue(o),u=u==null?0:Ui(J(u),0,o.length),a=Et(a),o.slice(u,u+a.length)==a}function BC(o,a,u){var f=y.templateSettings;u&&st(o,a,u)&&(a=t),o=ue(o),a=xs({},a,f,og);var d=xs({},a.imports,f.imports,og),g=We(d),P=hh(d,g),S,E,j=0,I=a.interpolate||Ba,F="__p += '",R=dh((a.escape||Ba).source+"|"+I.source+"|"+(I===Em?OO:Ba).source+"|"+(a.evaluate||Ba).source+"|$","g"),W="//# sourceURL="+(ce.call(a,"sourceURL")?(a.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ZO+"]")+` +`;o.replace(R,function(H,te,ne,Ct,ut,Mt){return ne||(ne=Ct),F+=o.slice(j,Mt).replace(MO,bS),te&&(S=!0,F+=`' + +__e(`+te+`) + +'`),ut&&(E=!0,F+=`'; +`+ut+`; +__p += '`),ne&&(F+=`' + +((__t = (`+ne+`)) == null ? '' : __t) + +'`),j=Mt+H.length,H}),F+=`'; +`;var G=ce.call(a,"variable")&&a.variable;if(!G)F=`with (obj) { +`+F+` +} +`;else if(PO.test(G))throw new K(l);F=(E?F.replace(oO,""):F).replace(aO,"$1").replace(sO,"$1;"),F="function("+(G||"obj")+`) { +`+(G?"":`obj || (obj = {}); +`)+"var __t, __p = ''"+(S?", __e = _.escape":"")+(E?`, __j = Array.prototype.join; +function print() { __p += __j.call(arguments, '') } +`:`; +`)+F+`return __p +}`;var Z=Xg(function(){return se(g,W+"return "+F).apply(t,P)});if(Z.source=F,Xh(Z))throw Z;return Z}function GC(o){return ue(o).toLowerCase()}function HC(o){return ue(o).toUpperCase()}function $C(o,a,u){if(o=ue(o),o&&(u||a===t))return ay(o);if(!o||!(a=Et(a)))return o;var f=$t(o),d=$t(a),g=sy(f,d),P=uy(f,d)+1;return ni(f,g,P).join("")}function QC(o,a,u){if(o=ue(o),o&&(u||a===t))return o.slice(0,ly(o)+1);if(!o||!(a=Et(a)))return o;var f=$t(o),d=uy(f,$t(a))+1;return ni(f,0,d).join("")}function KC(o,a,u){if(o=ue(o),o&&(u||a===t))return o.replace(Xf,"");if(!o||!(a=Et(a)))return o;var f=$t(o),d=sy(f,$t(a));return ni(f,d).join("")}function YC(o,a){var u=Uw,f=Bw;if(we(a)){var d="separator"in a?a.separator:d;u="length"in a?J(a.length):u,f="omission"in a?Et(a.omission):f}o=ue(o);var g=o.length;if(mn(o)){var P=$t(o);g=P.length}if(u>=g)return o;var S=u-yn(f);if(S<1)return f;var E=P?ni(P,0,S).join(""):o.slice(0,S);if(d===t)return E+f;if(P&&(S+=E.length-S),Jh(d)){if(o.slice(S).search(d)){var j,I=E;for(d.global||(d=dh(d.source,ue(qm.exec(d))+"g")),d.lastIndex=0;j=d.exec(I);)var F=j.index;E=E.slice(0,F===t?S:F)}}else if(o.indexOf(Et(d),S)!=S){var R=E.lastIndexOf(d);R>-1&&(E=E.slice(0,R))}return E+f}function XC(o){return o=ue(o),o&&uO.test(o)?o.replace(Tm,AS):o}var JC=On(function(o,a,u){return o+(u?" ":"")+a.toUpperCase()}),tp=Jy("toUpperCase");function Yg(o,a,u){return o=ue(o),a=u?t:a,a===t?PS(o)?CS(o):hS(o):o.match(a)||[]}var Xg=ee(function(o,a){try{return Tt(o,t,a)}catch(u){return Xh(u)?u:new K(u)}}),ZC=Ir(function(o,a){return Dt(a,function(u){u=cr(u),Lr(o,u,Kh(o[u],o))}),o});function eM(o){var a=o==null?0:o.length,u=B();return o=a?ge(o,function(f){if(typeof f[1]!="function")throw new kt(c);return[u(f[0]),f[1]]}):[],ee(function(f){for(var d=-1;++dKr)return[];var u=ar,f=et(o,ar);a=B(a),o-=ar;for(var d=fh(f,a);++u0||a<0)?new re(u):(o<0?u=u.takeRight(-o):o&&(u=u.drop(o)),a!==t&&(a=J(a),u=a<0?u.dropRight(-a):u.take(a-o)),u)},re.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},re.prototype.toArray=function(){return this.take(ar)},sr(re.prototype,function(o,a){var u=/^(?:filter|find|map|reject)|While$/.test(a),f=/^(?:head|last)$/.test(a),d=y[f?"take"+(a=="last"?"Right":""):a],g=f||/^find/.test(a);d&&(y.prototype[a]=function(){var P=this.__wrapped__,S=f?[1]:arguments,E=P instanceof re,j=S[0],I=E||Y(P),F=function(te){var ne=d.apply(y,Xr([te],S));return f&&R?ne[0]:ne};I&&u&&typeof j=="function"&&j.length!=1&&(E=I=!1);var R=this.__chain__,W=!!this.__actions__.length,G=g&&!R,Z=E&&!W;if(!g&&I){P=Z?P:new re(this);var H=o.apply(P,S);return H.__actions__.push({func:Ss,args:[F],thisArg:t}),new Rt(H,R)}return G&&Z?o.apply(this,S):(H=this.thru(F),G?f?H.value()[0]:H.value():H)})}),Dt(["pop","push","shift","sort","splice","unshift"],function(o){var a=Ya[o],u=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",f=/^(?:pop|shift)$/.test(o);y.prototype[o]=function(){var d=arguments;if(f&&!this.__chain__){var g=this.value();return a.apply(Y(g)?g:[],d)}return this[u](function(P){return a.apply(Y(P)?P:[],d)})}}),sr(re.prototype,function(o,a){var u=y[a];if(u){var f=u.name+"";ce.call(_n,f)||(_n[f]=[]),_n[f].push({name:a,func:u})}}),_n[ys(t,D).name]=[{name:"wrapper",func:t}],re.prototype.clone=XS,re.prototype.reverse=JS,re.prototype.value=ZS,y.prototype.at=qE,y.prototype.chain=CE,y.prototype.commit=ME,y.prototype.next=xE,y.prototype.plant=jE,y.prototype.reverse=IE,y.prototype.toJSON=y.prototype.valueOf=y.prototype.value=FE,y.prototype.first=y.prototype.head,Ko&&(y.prototype[Ko]=LE),y},Zr=MS();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ve._=Zr,define(function(){return Zr})):zi?((zi.exports=Zr)._=Zr,ih._=Zr):Ve._=Zr}).call(r)}),Nw=class extends Set{constructor(r,e=!1){super(r),this.valuesAsFlags=e}};function Da(r){if(r instanceof Map)return Object.fromEntries([...r.entries()].map(([e,t])=>[e,Da(t)]));if(r instanceof Set)return Array.from(r.values()).map(Da);if(r instanceof Nw)return{values:[...r.values()],valuesAsFlags:r.valuesAsFlags};if(typeof r=="object"){let e={};return Object.entries(r).forEach(([t,i])=>{e[t]=Da(i)}),e}else return r}var dZ=gm(bm(),1);var M5=gm(bm(),1);function fn(r,e){if(typeof r!="object")throw new Error(`Cannot merge into non-object objectToMergeWith. Received: ${JSON.stringify(r)}`);if(typeof e!="object")throw new Error(`Cannot merge using non-object objectToMergeWith. Received: ${JSON.stringify(e)}`);let t=(0,M5.cloneDeep)(r);for(let[i,n]of Object.entries(e))typeof n!="object"||n instanceof Set||t[i]===void 0?t[i]=n:t[i]=fn(t[i],n);return t}function Vw(r,e){if(!(r===void 0||typeof r!="object"))for(let t of Object.keys(r)){if(t===e)return r[t];let i=r[t];if(typeof i=="object"){let n=Vw(i,e);if(n!==void 0)return n}}}var ym="@composite:",x5="@inherit:",L5=class{constructor(r,e,t){this.tiledClassToMembersMap=r,this.enumNameToValuesMap=e,this.parserOptions=t,this.memoiser=new Map}flattenMembers(r,e){return this.memoiser.has(r)?{[r]:this.memoiser.get(r)}:(this.memoiser.set(r,e.reduce((t,i)=>({...t,...this.flattenMemberProperty(i)}),{})),{[r]:this.memoiser.get(r)})}flattenMemberProperty(r){let e=r.propertyType??r.propertytype;if(r.type==="class"){if(!this.memoiser.has(e)){let n=this.tiledClassToMembersMap.get(e).reduce((s,c)=>fn(this.flattenMemberProperty(c),s),{});this.memoiser.set(e,n)}let t=this.memoiser.get(e),i=fn(t,this.flattenValue(r.value,t));return this.checkIfShouldFlatten(r.name)?i:{[r.name.replace(ym,"")]:i}}else return this.enumNameToValuesMap.has(e)?this.enumNameToValuesMap.get(e).valuesAsFlags?{[r.name]:new Set(r.value.split(",").filter(t=>t!==""))}:{[r.name]:r.value}:{[r.name]:r.value}}get memoisedFlattenedProperties(){return this.memoiser}flattenValue(r,e){return Object.entries(r).reduce((t,[i,n])=>{if(typeof n!="object")return Vw(e,i)instanceof Set?fn({[i]:new Set(n.split(",").filter(s=>s!==""))},t):fn({[i]:n},t);if(this.checkIfShouldFlatten(i))return fn(this.flattenValue(n,e),t);{let s=i.replace(ym,"");return fn({[s]:this.flattenValue(n,e)},t)}},{})}checkIfShouldFlatten(r){return this.parserOptions?.defaultComposite===!0?r.startsWith(x5):!r.startsWith(ym)}},Rw=gm(bm(),1),j5=class{constructor(r){this.flattener=r}flattenPropertiesOnObject(r){return{...this.flattener.memoisedFlattenedProperties.get(r.class??r.type),...r.properties?.reduce((e,t)=>({...e,...this.flattener.flattenMemberProperty(t)}),{}),name:r.name,id:r.id,class:r.class??r.type??null,x:r.x,y:r.y}}flattenPropertiesOnTile(r){return{...this.flattener.memoisedFlattenedProperties.get(r.class??r.type),...r.properties?.reduce((e,t)=>({...e,...this.flattener.flattenMemberProperty(t)}),{}),id:r.id,class:r.class??r.type??null}}getCustomTypesMap(){return new Map([...this.flattener.memoisedFlattenedProperties.entries()].map(([r,e])=>[r,(0,Rw.cloneDeep)(e)]))}getEnumsMap(){return new Map([...this.flattener.enumNameToValuesMap.entries()].map(([r,e])=>[r,(0,Rw.cloneDeep)(e)]))}toJSON(){return JSON.stringify({customTypes:Da(this.getCustomTypesMap()),enums:Da(this.getEnumsMap())},null,4)}};function I5(r,e){let t=new Map(r.propertyTypes.filter(s=>s.type==="enum").map(s=>[s.name,new Nw(s.values,s.valuesAsFlags)])),i=new Map(r.propertyTypes.filter(s=>s.type==="class").map(s=>[s.name,s.members])),n=new L5(i,t,e);return i.forEach((s,c)=>{n.flattenMembers(c,s)}),new j5(n)}var Ww={parse:I5};var ki=class{constructor(e,t){this.phaserTile=e;this.tiledProject=t}getProperty(e){let t={};if(this.tiledProject){let n=Ww.parse(this.tiledProject),s=this.getType();if(s){let c=n.getCustomTypesMap()?.get(s);if(c)for(let[l,h]of Object.entries(c))t[l]=h}}return this.phaserTile.properties[e]??t[e]}hasProperty(e){return this.getProperty(e)!=null}getType(){return this.phaserTile.tileset?.tileData[this.phaserTile.index-1]?.type}};var ko=class{constructor(e,t){this.phaserTilemapLayer=e;this.tiledProject=t}getName(){return this.phaserTilemapLayer.layer.name}getProperty(e){return this.phaserTilemapLayer.layer.properties?.find(n=>n.name==e)?.value}hasProperty(e){return this.getProperty(e)!=null}isCharLayer(){return this.hasProperty(Ia)}getData(){return this.phaserTilemapLayer.layer.data.map(e=>e.map(t=>new ki(t,this.tiledProject)))}};var ka=class{constructor(e,t){this.phaserTilemap=e;this.tiledProject=t;for(let i of this.phaserTilemap.layers)if(i.tilemapLayer==null)throw new Error(`Error initializing tilemap. Layer '${i.name}' has no 'tilemapLayer'. This can happen if you call 'createLayer' with the wrong layer ID.`)}getTileWidth(){return this.phaserTilemap.tileWidth}getTileHeight(){return this.phaserTilemap.tileHeight}getWidth(){return this.phaserTilemap.width}getHeight(){return this.phaserTilemap.height}getOrientation(){return this.phaserTilemap.orientation==Phaser.Tilemaps.Orientation.ISOMETRIC.toString()?"isometric":"orthogonal"}getLayers(){return this.phaserTilemap.layers.map(e=>new ko(e.tilemapLayer,this.tiledProject))}hasTileAt(e,t,i){return!!this.phaserTilemap.hasTileAt(e,t,i)}getTileAt(e,t,i){let n=this.phaserTilemap.getTileAt(e,t,!1,i);if(n)return new ki(n,this.tiledProject)}};var Rf=class{constructor(e,t="orthogonal",i="ge_collide"){this.map=e;this.orientation=t;this.layerMap=new Map;this.layers=[];let n=-1,s=-1;Object.entries(e).map(([c,l])=>{let h=l.data[0]?.length,p=l.data.length;if(n!==-1&&n!==h||s!==-1&&s!==p)throw new Error("All tilemap layers must have the same dimensions.");n=h,s=p;let v=[];for(let w=0;w=0&&e=0&&t{if(!s.tiles)return!1;let c=s.firstgid??0;return!!s.tiles.find(h=>h.id+c===t)});if(!i)return;let n=i.tiles?.find(s=>s.id+(i.firstgid??0)===t);if(n?.properties)for(let s of n.properties)s.name&&(this.props[s.name]=s.value)}getProperty(e){return this.props[e]}hasProperty(e){return this.props[e]!==void 0}};var zo=class{constructor(e,t){this.layer=t;this.data=[];if(this.data=[],this.layer.data)for(let i=0;i<(this.layer.height||0);i++){let n=[];for(let s=0;s<(this.layer.width||0);s++){let c=this.layer.data[i*(this.layer.width||0)+s];c!==void 0?n.push(new Ro(e,c)):n.push(void 0)}this.data.push(n)}}getName(){return this.layer.name}getProperty(e){return this.layer.properties?.find(t=>t.name===e)?.value}hasProperty(e){return this.getProperty(e)!==void 0}getData(){return this.data}isCharLayer(){return this.hasProperty("ge_charLayer")}};var zf=class{constructor(e){this.rawTilemap=e;this.layers=[];this.layers=this.rawTilemap.layers?.map(t=>new zo(this.rawTilemap.tilesets,t))}hasTileAt(e,t,i){if(e<0||e>=this.rawTilemap.width||t<0||t>=this.rawTilemap.height||!this.rawTilemap.layers)return!1;let n=this.rawTilemap.layers.find(c=>c.name===i);if(!n)return!1;let s=t*this.rawTilemap.width+e;return n.data[s]>0}getTileAt(e,t,i){if(e<0||e>=this.rawTilemap.width||t<0||t>=this.rawTilemap.height||!this.rawTilemap.layers)return;let n=this.layers.find(s=>s.getName()===i);if(n)return n.getData()[t][e]}getOrientation(){return this.rawTilemap.orientation}getLayers(){return this.layers}getWidth(){return this.rawTilemap.width}getHeight(){return this.rawTilemap.height}};var Ra=class r{constructor(e){this.scene=e;this.geHeadless=new Fa(!1);this.isCreatedInternal=!1;r.welcomeMessagePrinted||(console.log(`Using GridEngine Phaser Plugin v${Ef}`),r.welcomeMessagePrinted=!0),this.scene.sys.events.once("boot",this.boot,this)}static{this.welcomeMessagePrinted=!1}boot(){this.scene.sys.events.on("update",this.update,this)}getCharLayer(e){return this.geHeadless.getCharLayer(e)}getTransition(e,t){return this.geHeadless.getTransition(e,t)}setTransition(e,t,i){this.geHeadless.setTransition(e,t,i)}create(e,t){this.geHeadless.create(new ka(e,t.tiledProject),t),this.isCreatedInternal=!0,this.gridCharacters=new Map;let i=this.setConfigDefaults(t);this.config=i,this.gridTilemap=new kf(e),this.addCharacters()}getPosition(e){return this.geHeadless.getPosition(e)}move(e,t){this.geHeadless.move(e,t)}moveRandomly(e,t=0,i=-1){this.geHeadless.moveRandomly(e,t,i)}getMovement(e){return this.geHeadless.getMovement(e)}moveTo(e,t,i){return this.geHeadless.moveTo(e,t,i)}stopMovement(e){this.geHeadless.stopMovement(e)}setSpeed(e,t){this.geHeadless.setSpeed(e,t)}getSpeed(e){return this.geHeadless.getSpeed(e)}getContainer(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.getContainer()}getOffsetX(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.getOffsetX()}setOffsetX(e,t){this.initGuard();let i=this.gridCharacters?.get(e);if(!i)throw this.createCharUnknownErr(e);i.setOffsetX(t)}getOffsetY(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.getOffsetY()}setOffsetY(e,t){this.initGuard();let i=this.gridCharacters?.get(e);if(!i)throw this.createCharUnknownErr(e);i.setOffsetY(t)}collidesWithTiles(e){return this.geHeadless.collidesWithTiles(e)}getWalkingAnimationMapping(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.getAnimation()?.getWalkingAnimationMapping()}hasLayerOverlay(){return this.initGuard(),!!this.config?.layerOverlay}setWalkingAnimationMapping(e,t){this.initGuard();let i=this.gridCharacters?.get(e);if(!i)throw this.createCharUnknownErr(e);i.getAnimation()?.setWalkingAnimationMapping(t)}update(e,t){if(this.isCreatedInternal&&this.gridCharacters)for(let[i,n]of this.gridCharacters)n.update(t);this.geHeadless.update(e,t)}addCharacter(e){this.geHeadless.addCharacter(e),this.addCharacterInternal(e)}hasCharacter(e){return this.geHeadless.hasCharacter(e)}removeCharacter(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);t.destroy(),this.gridCharacters?.delete(e),this.geHeadless.removeCharacter(e)}removeAllCharacters(){if(this.initGuard(),!!this.gridCharacters){for(let e of this.gridCharacters.keys())this.removeCharacter(e);this.geHeadless.removeAllCharacters()}}getAllCharacters(e){return this.geHeadless.getAllCharacters(e)}getLabels(e){return this.geHeadless.getLabels(e)}addLabels(e,t){this.geHeadless.addLabels(e,t)}removeLabels(e,t){this.geHeadless.removeLabels(e,t)}clearLabels(e){this.geHeadless.clearLabels(e)}follow(e,t,i,n){let s;i===void 0?s={distance:0,closestPointIfBlocked:!1}:typeof i=="number"?(s={distance:i,closestPointIfBlocked:!1},n&&(s.closestPointIfBlocked=!0)):s=i,this.geHeadless.follow(e,t,s)}isMoving(e){return this.geHeadless.isMoving(e)}getFacingDirection(e){return this.geHeadless.getFacingDirection(e)}getFacingPosition(e){return this.geHeadless.getFacingPosition(e)}turnTowards(e,t){this.initGuard();let i=this.gridCharacters?.get(e);if(!i)throw this.createCharUnknownErr(e);i.turnTowards(t),this.geHeadless.turnTowards(e,t)}getCharactersAt(e,t){return this.geHeadless.getCharactersAt(e,t)}setPosition(e,t,i){this.geHeadless.setPosition(e,t,i)}getSprite(e){this.initGuard();let t=this.gridCharacters?.get(e);if(!t)throw this.createCharUnknownErr(e);return t.getSprite()}setSprite(e,t){this.initGuard();let i=this.gridCharacters?.get(e);if(!i)throw this.createCharUnknownErr(e);t.setOrigin(0,0),this.setCharSprite(t,i)}isBlocked(e,t,i=["geDefault"]){return this.geHeadless.isBlocked(e,t,i)}isTileBlocked(e,t){return this.geHeadless.isTileBlocked(e,t)}getCollisionGroups(e){return this.geHeadless.getCollisionGroups(e)}setCollisionGroups(e,t){this.geHeadless.setCollisionGroups(e,t)}getTilePosInDirection(e,t,i){return this.geHeadless.getTilePosInDirection(e,t,i)}findShortestPath(e,t,i={}){return this.geHeadless.findShortestPath(e,t,i)}steppedOn(e,t,i){return this.geHeadless.steppedOn(e,t,i)}characterShifted(){return this.geHeadless.characterShifted()}movementStarted(){return this.geHeadless.movementStarted()}movementStopped(){return this.geHeadless.movementStopped()}directionChanged(){return this.geHeadless.directionChanged()}positionChangeStarted(){return this.geHeadless.positionChangeStarted()}positionChangeFinished(){return this.geHeadless.positionChangeFinished()}getMovementProgress(e){return this.geHeadless.getMovementProgress(e)}rebuildTileCollisionCache(e,t,i,n){this.geHeadless.rebuildTileCollisionCache(e,t,i,n)}addQueueMovements(e,t,i){this.geHeadless.addQueueMovements(e,t,i)}getEnqueuedMovements(e){return this.geHeadless.getEnqueuedMovements(e)}queueMovementFinished(){return this.geHeadless.queueMovementFinished()}clearEnqueuedMovements(e){return this.geHeadless.clearEnqueuedMovements(e)}getTileCost(e,t,i){return this.initGuard(),this.geHeadless.getTileCost(e,t,i)}setConfigDefaults(e){return{collisionTilePropertyName:"ge_collide",numberOfDirections:4,characterCollisionStrategy:"BLOCK_TWO_TILES",layerOverlay:!1,cacheTileCollisions:!1,...e}}initGuard(){if(!this.isCreatedInternal)throw this.createUninitializedErr()}createUninitializedErr(){throw new Error("GridEngine not initialized. You need to call create() first.")}addCharacters(){this.config?.characters.forEach(e=>this.addCharacterInternal(e))}createCharUnknownErr(e){return new Error(`Character unknown: ${e}`)}setCharSprite(e,t){t.setSprite(e)}addCharacterInternal(e){if(this.initGuard(),!this.gridTilemap)throw this.createUninitializedErr();if(!this.config)throw this.createUninitializedErr();let t=new of(e,this.scene,this.gridTilemap,this.config.layerOverlay,this.geHeadless);this.gridCharacters?.set(e.id,t)}};var F5=Ra;0&&(module.exports={ArrayTilemap,CharacterShiftAction,CollisionStrategy,Direction,GridEngine,GridEngineHeadless,MoveToResult,NoPathFoundStrategy,NumberOfDirections,PathBlockedStrategy,PhaserTile,PhaserTileLayer,PhaserTilemap,QueuedPathBlockedStrategy,TiledLayer,TiledTile,TiledTilemap,directionFromPos}); +/*! Bundled license information: + +tiled-property-flattener/dist/tiled_property_flattener.min.js: + (*! Bundled license information: + + lodash/lodash.js: + (** + * @license + * Lodash + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + *) + *) +*/ diff --git a/dist/GridEngine.min.js b/dist/GridEngine.min.js index 4232c80b..d31e168d 100644 --- a/dist/GridEngine.min.js +++ b/dist/GridEngine.min.js @@ -1,6 +1,6 @@ (()=>{var HP=Object.create;var su=Object.defineProperty,BP=Object.defineProperties,WP=Object.getOwnPropertyDescriptor,qP=Object.getOwnPropertyDescriptors,$P=Object.getOwnPropertyNames,Rl=Object.getOwnPropertySymbols,QP=Object.getPrototypeOf,zl=Object.prototype.hasOwnProperty,KP=Object.prototype.propertyIsEnumerable;var Fl=(r,t,e)=>t in r?su(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ot=(r,t)=>{for(var e in t||(t={}))zl.call(t,e)&&Fl(r,e,t[e]);if(Rl)for(var e of Rl(t))KP.call(t,e)&&Fl(r,e,t[e]);return r},He=(r,t)=>BP(r,qP(t));var z=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var YP=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of $P(t))!zl.call(r,s)&&s!==e&&su(r,s,{get:()=>t[s],enumerable:!(n=WP(t,s))||n.enumerable});return r};var Vl=(r,t,e)=>(e=r!=null?HP(QP(r)):{},YP(t||!r||!r.__esModule?su(e,"default",{value:r,enumerable:!0}):e,r));var Ln=z(_n=>{var vT=function(r,t){return rt?1:0},bT=function(r,t){return rt?-1:0};function wT(r){return function(t,e){return r(e,t)}}function PT(r){return r===2?function(t,e){return t[0]e[0]?1:t[1]e[1]?1:0}:function(t,e){for(var n=0;ne[n])return 1;n++}return 0}}_n.DEFAULT_COMPARATOR=vT;_n.DEFAULT_REVERSE_COMPARATOR=bT;_n.reverseComparator=wT;_n.createTupleComparator=PT});var ff=z(vu=>{vu.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer!="undefined";vu.SYMBOL_SUPPORT=typeof Symbol!="undefined"});var dt=z((PE,df)=>{var pf=ff(),TT=pf.ARRAY_BUFFER_SUPPORT,xT=pf.SYMBOL_SUPPORT;df.exports=function(t,e){var n,s,a,h,l;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)||TT&&ArrayBuffer.isView(t)||typeof t=="string"||t.toString()==="[object Arguments]"){for(a=0,h=t.length;a{var mf=Ln(),gf=dt(),yf=mf.DEFAULT_COMPARATOR,ST=mf.reverseComparator;function ne(r){if(this.clear(),this.comparator=r||yf,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 CT(r){return{item:r,degree:0}}function vf(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=CT(r);return t.left=t,t.right=t,vf(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 bf(r){for(var t=[],e=r,n=!1;!(e===r&&n);)e===r&&(n=!0),t.push(e),e=e.right;return t}function wf(r,t){r.root===t&&(r.root=t.right),t.left.right=t.right,t.right.left=t.left}function _T(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 LT(r,t,e){wf(r,t),t.left=t,t.right=t,_T(e,t),e.degree++,t.parent=e}function ET(r){var t=new Array(r.size),e=bf(r.root),n,s,a,h,l,p;for(n=0,s=e.length;n0&&(p=a,a=h,h=p),LT(r,h,a),t[l]=null,l++;t[l]=a}for(n=0;n{var AT=Math.pow(2,8)-1,OT=Math.pow(2,16)-1,DT=Math.pow(2,32)-1,MT=Math.pow(2,7)-1,IT=Math.pow(2,15)-1,kT=Math.pow(2,31)-1;or.getPointerArray=function(r){var t=r-1;if(t<=AT)return Uint8Array;if(t<=OT)return Uint16Array;if(t<=DT)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")};or.getSignedPointerArray=function(r){var t=r-1;return t<=MT?Int8Array:t<=IT?Int16Array:t<=kT?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 RT={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};or.getMinimalRepresentation=function(r,t){var e=null,n=0,s,a,h,l,p;for(l=0,p=r.length;ln&&(n=s,e=a);return e};or.isTypedArray=function(r){return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView(r)};or.concat=function(){var r=0,t,e,n;for(t=0,n=arguments.length;t{var Sf=dt(),Cf=oe();function FT(r){return Array.isArray(r)||Cf.isTypedArray(r)}function bu(r){if(typeof r.length=="number")return r.length;if(typeof r.size=="number")return r.size}function zT(r){var t=bu(r),e=typeof t=="number"?new Array(t):[],n=0;return Sf(r,function(s){e[n++]=s}),e}function VT(r){var t=bu(r),e=typeof t=="number"?Cf.getPointerArray(t):Array,n=typeof t=="number"?new Array(t):[],s=typeof t=="number"?new e(t):[],a=0;return Sf(r,function(h){n[a]=h,s[a]=a++}),[n,s]}An.isArrayLike=FT;An.guessLength=bu;An.toArray=zT;An.toArrayWithIndices=VT});var vs=z((qE,Af)=>{var ms=dt(),_f=Ln(),sr=pe(),ys=_f.DEFAULT_COMPARATOR,wu=_f.reverseComparator;function Pu(r,t,e,n){for(var s=t[n],a,h;n>e;){if(a=n-1>>1,h=t[a],r(s,h)<0){t[n]=h,n=a;continue}break}t[n]=s}function On(r,t,e){for(var n=t.length,s=e,a=t[e],h=2*e+1,l;h=0&&(h=l),t[e]=t[h],e=h,h=2*e+1;t[e]=a,Pu(r,t,s,e)}function Lf(r,t,e){t.push(e),Pu(r,t,0,t.length-1)}function Tu(r,t){var e=t.pop();if(t.length!==0){var n=t[0];return t[0]=e,On(r,t,0),n}return e}function zi(r,t,e){if(t.length===0)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var n=t[0];return t[0]=e,On(r,t,0),n}function Ef(r,t,e){var n;return t.length!==0&&r(t[0],e)<0&&(n=t[0],t[0]=e,e=n,On(r,t,0)),e}function ai(r,t){for(var e=t.length,n=e>>1,s=n;--s>=0;)On(r,t,s)}function xu(r,t){for(var e=t.length,n=0,s=new Array(e);n=e.length)return e.slice().sort(r);for(p=e.slice(0,t),ai(n,p),s=t,a=e.length;s0&&zi(n,p,e[s]);return p.sort(r)}var m=sr.guessLength(e);return m!==null&&m0&&zi(n,p,y)),s++}),p.length>s&&(p.length=s),p.sort(r)}function UT(r,t,e){arguments.length===2&&(e=t,t=r,r=ys);var n=wu(r),s,a,h,l=-1/0,p;if(t===1){if(sr.isArrayLike(e)){for(s=0,a=e.length;s0)&&(l=h);return p=new e.constructor(1),p[0]=l,p}return ms(e,function(y){(l===-1/0||r(y,l)>0)&&(l=y)}),[l]}if(sr.isArrayLike(e)){if(t>=e.length)return e.slice().sort(n);for(p=e.slice(0,t),ai(r,p),s=t,a=e.length;s0&&zi(r,p,e[s]);return p.sort(n)}var m=sr.guessLength(e);return m!==null&&m0&&zi(r,p,y)),s++}),p.length>s&&(p.length=s),p.sort(n)}function at(r){if(this.clear(),this.comparator=r||ys,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 Lf(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--,Tu(this.comparator,this.items)};at.prototype.replace=function(r){return zi(this.comparator,this.items,r)};at.prototype.pushpop=function(r){return Ef(this.comparator,this.items,r)};at.prototype.consume=function(){return this.size=0,xu(this.comparator,this.items)};at.prototype.toArray=function(){return xu(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 gs(r){if(this.clear(),this.comparator=r||ys,typeof this.comparator!="function")throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=wu(this.comparator)}gs.prototype=at.prototype;at.from=function(r,t){var e=new at(t),n;return sr.isArrayLike(r)?n=r.slice():n=sr.toArray(r),ai(e.comparator,n),e.items=n,e.size=n.length,e};gs.from=function(r,t){var e=new gs(t),n;return sr.isArrayLike(r)?n=r.slice():n=sr.toArray(r),ai(e.comparator,n),e.items=n,e.size=n.length,e};at.siftUp=On;at.siftDown=Pu;at.push=Lf;at.pop=Tu;at.replace=zi;at.pushpop=Ef;at.heapify=ai;at.consume=xu;at.nsmallest=NT;at.nlargest=UT;at.MinHeap=at;at.MaxHeap=gs;Af.exports=at});var kf=z(($E,If)=>{var Of="";function Df(r,t,e){for(var n=t.length,s=[],a=n,h=-1,l,p=0,m;a--;)h=Math.max(r[t[a]+e],h);for(m=h>>24&&32||h>>16&&24||h>>8&&16||8;p>p&15].push(t[a]);for(l=0;l<16;l++)for(h=s[l].length;h--;)t[++a]=s[l][h]}}function jT(r,t,e,n){return r[e]-r[n]||(e%3===2?r[e+1]-r[n+1]||t[e+2]-t[n+2]:t[e+1]-t[n+1])}function Su(r,t){var e=[],n=[],s=2*t/3|0,a=t-s,h=s+1>>1,l=s,p=0,m,y=[],b=[];if(t===1)return[0];for(;l--;)e[l]=(l*3>>1)+1;for(l=3;l--;)Df(r,e,l);for(p=n[(e[0]/3|0)+(e[0]%3===1?0:h)]=1,l=1;lthis.firstLength&&a>this.firstLength)){for(t=Math.min(this.length-s,this.length-a),n=0;nr.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{var GT=dt();function $e(r){this.size=0,this.items=new Map,this.inverse=r}function Pe(){this.size=0,this.items=new Map,this.inverse=new $e(this)}function Rf(){this.size=0,this.items.clear(),this.inverse.items.clear()}Pe.prototype.clear=Rf;$e.prototype.clear=Rf;function Ff(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 n=this.inverse.items.get(t);if(n===r)return this;this.items.delete(n)}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}Pe.prototype.set=Ff;$e.prototype.set=Ff;function zf(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}Pe.prototype.delete=zf;$e.prototype.delete=zf;var HT=["has","get","forEach","keys","values","entries"];HT.forEach(function(r){Pe.prototype[r]=$e.prototype[r]=function(){return Map.prototype[r].apply(this.items,arguments)}});typeof Symbol!="undefined"&&(Pe.prototype[Symbol.iterator]=Pe.prototype.entries,$e.prototype[Symbol.iterator]=$e.prototype.entries);Pe.prototype.inspect=function(){var r={left:this.items,right:this.inverse.items};return Object.defineProperty(r,"constructor",{value:Pe,enumerable:!1}),r};typeof Symbol!="undefined"&&(Pe.prototype[Symbol.for("nodejs.util.inspect.custom")]=Pe.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);Pe.from=function(r){var t=new Pe;return GT(r,function(e,n){t.set(n,e)}),t};Vf.exports=Pe});var Nt=z((KE,Uf)=>{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"};Uf.exports=ar});var _u=z(Qe=>{function Gf(r){return r|=r>>1,r|=r>>2,r|=r>>4,r|=r>>8,r|=r>>16,r&~(r>>1)}Qe.msb32=Gf;function Cu(r){return r|=r>>1,r|=r>>2,r|=r>>4,r&~(r>>1)}Qe.msb8=Cu;Qe.test=function(r,t){return r>>t&1};Qe.criticalBit8=function(r,t){return Cu(r^t)};Qe.criticalBit8Mask=function(r,t){return~Cu(r^t)>>>0&255};Qe.testCriticalBit8=function(r,t){return 1+(r|t)>>8};Qe.criticalBit32Mask=function(r,t){return~Gf(r^t)>>>0&4294967295};Qe.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 Vi=new Uint8Array(Math.pow(2,8));for(Dn=0,jf=Vi.length;Dn>8&255]+Vi[r>>16&255]+Vi[r>>24&255]}});var qf=z((XE,Wf)=>{var Bf=Nt(),Hf=_u();function It(r){this.length=r,this.clear()}It.prototype.clear=function(){this.size=0,this.array=new Uint32Array(Math.ceil(this.length/32))};It.prototype.set=function(r,t){var e=r>>5,n=r&31,s=this.array[e],a;return t===0||t===!1?a=this.array[e]&=~(1<>>0,a>s?this.size++:a>5,e=r&31,n=this.array[t],s;return s=this.array[t]&=~(1<>5,e=r&31,n=this.array[t],s=this.array[t]^=1<>>0,s>n?this.size++:s>5,e=r&31;return this.array[t]>>e&1};It.prototype.test=function(r){return!!this.get(r)};It.prototype.rank=function(r){if(this.size===0)return 0;for(var t=r>>5,e=r&31,n=0,s=0;s=this.length)return-1;for(var t,e=32,n=0,s=0,a=0,h=this.array.length;a>l&1,s===r)return n}};It.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=this.length,n,s,a=32,h=0,l=this.array.length;h>p&1,r.call(t,s,h*32+p)}};It.prototype.values=function(){var r=this.length,t=!1,e,n,s=this.array,a=s.length,h=0,l=-1,p=32;return new Bf(function m(){if(!t){if(h>=a)return{done:!0};h===a-1&&(p=r%32||32),e=s[h++],t=!0,l=-1}return l++,l>=p?(t=!1,m()):(n=e>>l&1,{value:n})})};It.prototype.entries=function(){var r=this.length,t=!1,e,n,s=this.array,a,h=s.length,l=0,p=-1,m=32;return new Bf(function y(){if(!t){if(l>=h)return{done:!0};l===h-1&&(m=r%32||32),e=s[l++],t=!0,p=-1}return p++,a=~-l*32+p,p>=m?(t=!1,y()):(n=e>>p&1,{value:[a,n]})})};typeof Symbol!="undefined"&&(It.prototype[Symbol.iterator]=It.prototype.values);It.prototype.inspect=function(){var r=new Uint8Array(this.length);return this.forEach(function(t,e){r[e]=t}),Object.defineProperty(r,"constructor",{value:It,enumerable:!1}),r};typeof Symbol!="undefined"&&(It.prototype[Symbol.for("nodejs.util.inspect.custom")]=It.prototype.inspect);It.prototype.toJSON=function(){return Array.from(this.array)};Wf.exports=It});var Yf=z((JE,Kf)=>{var Qf=Nt(),$f=_u(),BT=function(r){return Math.max(1,Math.ceil(r*1.5))};function WT(r){return new Uint32Array(Math.ceil(r/32))}function mt(r){var t=r||0,e=BT;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=WT(this.capacity)}mt.prototype.set=function(r,t){if(this.length>5,n=r&31,s=this.array[e],a;return t===0||t===!1?a=this.array[e]&=~(1<>>0,a>s?this.size++:a>5,e=r&31,n=this.array[t],s;return s=this.array[t]&=~(1<>5,e=r&31,n=this.array[t],s=this.array[t]^=1<>>0,s>n?this.size++:sthis.array.length?(this.array=new Uint32Array(n),this.array.set(e,0)):this.array=e.slice(0,n),this.capacity=r,this)};mt.prototype.grow=function(r){var t;if(typeof r=="number"){if(this.capacity>=r)return this;for(t=this.capacity;t>5,n=t&31;return this.array[e]|=1<>5,e=r&31;return this.array[t]>>e&1}};mt.prototype.get=function(r){if(!(this.length>5,e=r&31;return this.array[t]>>e&1}};mt.prototype.test=function(r){return this.length>5,e=r&31,n=0,s=0;s=this.length)return-1;for(var t,e=32,n=0,s=0,a=0,h=this.array.length;a>l&1,s===r)return n}};mt.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=this.length,n,s,a=32,h=0,l=this.array.length;h>p&1,r.call(t,s,h*32+p)}};mt.prototype.values=function(){var r=this.length,t=!1,e,n,s=this.array,a=s.length,h=0,l=-1,p=32;return new Qf(function m(){if(!t){if(h>=a)return{done:!0};h===a-1&&(p=r%32||32),e=s[h++],t=!0,l=-1}return l++,l>=p?(t=!1,m()):(n=e>>l&1,{value:n})})};mt.prototype.entries=function(){var r=this.length,t=!1,e,n,s=this.array,a,h=s.length,l=0,p=-1,m=32;return new Qf(function y(){if(!t){if(l>=h)return{done:!0};l===h-1&&(m=r%32||32),e=s[l++],t=!0,p=-1}return p++,a=~-l*32+p,p>=m?(t=!1,y()):(n=e>>p&1,{value:[a,n]})})};typeof Symbol!="undefined"&&(mt.prototype[Symbol.iterator]=mt.prototype.values);mt.prototype.inspect=function(){var r=new Uint8Array(this.length);return this.forEach(function(t,e){r[e]=t}),Object.defineProperty(r,"constructor",{value:mt,enumerable:!1}),r};typeof Symbol!="undefined"&&(mt.prototype[Symbol.for("nodejs.util.inspect.custom")]=mt.prototype.inspect);mt.prototype.toJSON=function(){return Array.from(this.array.slice(0,(this.length>>5)+1))};Kf.exports=mt});var Jf=z((ZE,Xf)=>{function ui(r,t){return(r&65535)*t+(((r>>>16)*t&65535)<<16)&4294967295}function qT(r,t){return(r&65535)+(t>>>16)+(((r>>>16)+t&65535)<<16)&4294967295}function Lu(r,t){return r<>>32-t}Xf.exports=function(t,e){var n=3432918353,s=461845907,a=15,h=13,l=5,p=1801774676,m=t,y,b,x;for(b=0,x=e.length-4;b<=x;b+=4)y=e[b]|e[b+1]<<8|e[b+2]<<16|e[b+3]<<24,y=ui(y,n),y=Lu(y,a),y=ui(y,s),m^=y,m=Lu(m,h),m=ui(m,l),m=qT(m,p);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=ui(y,n),y=Lu(y,a),y=ui(y,s),m^=y;default:}return m^=e.length,m^=m>>>16,m=ui(m,2246822507),m^=m>>>13,m=ui(m,3266489909),m^=m>>>16,m>>>0}});var rp=z((tA,ep)=>{var $T=Jf(),QT=dt(),KT=Math.LN2*Math.LN2,YT={errorRate:.005};function Zf(r){var t=new Uint16Array(r.length),e,n;for(e=0,n=r.length;e>3]|=a}return this};hi.prototype.test=function(r){for(var t=Zf(r),e=0,n=this.hashFunctions;e>3]&1<<(7&s)))return!1}return!0};hi.prototype.toJSON=function(){return this.data};hi.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 hi(t);return QT(r,function(n){e.add(n)}),e};ep.exports=hi});var np=z((eA,ip)=>{var XT=dt();function Ke(r){if(typeof r!="function")throw new Error("mnemonist/BKTree.constructor: given `distance` should be a function.");this.distance=r,this.clear()}Ke.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};Ke.prototype.search=function(r,t){if(!this.root)return[];for(var e=[],n=[this.root],s,a,h,l,p;n.length;)for(s=n.pop(),h=this.distance(t,s.item),h<=r&&e.push({item:s.item,distance:h}),l=h-r,p=h+r+1;l{var Eu=pe(),op=Nt();function St(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()}St.prototype.clear=function(){this.start=0,this.size=0};St.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)%this.capacity;return this.items[t]=r,++this.size};St.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};St.prototype.pop=function(){if(this.size===0)return;let r=(this.start+this.size-1)%this.capacity;return this.size--,this.items[r]};St.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]}};St.prototype.peekFirst=function(){if(this.size!==0)return this.items[this.start]};St.prototype.peekLast=function(){if(this.size!==0){var r=this.start+this.size-1;return r>this.capacity&&(r-=this.capacity),this.items[r]}};St.prototype.get=function(r){if(this.size!==0)return r=this.start+r,r>this.capacity&&(r-=this.capacity),this.items[r]};St.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=this.capacity,n=this.size,s=this.start,a=0;a=e)return{done:!0};var a=r[n];return n++,s++,n===t&&(n=0),{value:a,done:!1}})};St.prototype.entries=function(){var r=this.items,t=this.capacity,e=this.size,n=this.start,s=0;return new op(function(){if(s>=e)return{done:!0};var a=r[n];return n++,n===t&&(n=0),{value:[s++,a],done:!1}})};typeof Symbol!="undefined"&&(St.prototype[Symbol.iterator]=St.prototype.values);St.prototype.inspect=function(){var r=this.toArray();return r.type=this.ArrayClass.name,r.capacity=this.capacity,Object.defineProperty(r,"constructor",{value:St,enumerable:!1}),r};typeof Symbol!="undefined"&&(St.prototype[Symbol.for("nodejs.util.inspect.custom")]=St.prototype.inspect);St.from=function(r,t,e){if(arguments.length<3&&(e=Eu.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 n=new St(t,e);if(Eu.isArrayLike(r)){var s,a;for(s=0,a=r.length;s{var Ou=pe(),Du=Au();function Ni(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 ap(r){Ni.prototype[r]=Du.prototype[r]}Object.keys(Du.prototype).forEach(ap);typeof Symbol!="undefined"&&Object.getOwnPropertySymbols(Du.prototype).forEach(ap);Ni.prototype.push=function(r){var t=(this.start+this.size)%this.capacity;return this.items[t]=r,this.size===this.capacity?(this.start=(t+1)%this.capacity,this.size):++this.size};Ni.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)};Ni.from=function(r,t,e){if(arguments.length<3&&(e=Ou.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 n=new Ni(t,e);if(Ou.isArrayLike(r)){var s,a;for(s=0,a=r.length;s{function Wt(r){if(typeof r!="function")throw new Error("mnemonist/DefaultMap.constructor: expecting a function.");this.items=new Map,this.factory=r,this.size=0}Wt.prototype.clear=function(){this.items.clear(),this.size=0};Wt.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};Wt.prototype.peek=function(r){return this.items.get(r)};Wt.prototype.set=function(r,t){return this.items.set(r,t),this.size=this.items.size,this};Wt.prototype.has=function(r){return this.items.has(r)};Wt.prototype.delete=function(r){var t=this.items.delete(r);return this.size=this.items.size,t};Wt.prototype.forEach=function(r,t){t=arguments.length>1?t:this,this.items.forEach(r,t)};Wt.prototype.entries=function(){return this.items.entries()};Wt.prototype.keys=function(){return this.items.keys()};Wt.prototype.values=function(){return this.items.values()};typeof Symbol!="undefined"&&(Wt.prototype[Symbol.iterator]=Wt.prototype.entries);Wt.prototype.inspect=function(){return this.items};typeof Symbol!="undefined"&&(Wt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Wt.prototype.inspect);Wt.autoIncrement=function(){var r=0;return function(){return r++}};cp.exports=Wt});var pp=z((oA,fp)=>{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);fp.exports=ur});var mp=z((sA,dp)=>{var Mu=oe();function hr(r){var t=Mu.getPointerArray(r),e=Mu.getPointerArray(Math.log2(r));this.size=r,this.dimension=r,this.parents=new t(r),this.ranks=new e(r);for(var n=0;na?this.parents[n]=e:(this.parents[n]=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=Mu.getPointerArray(this.dimension),t={},e=new r(this.size),n=0,s,a=0,h=this.parents.length;a{var gp=Ln(),Iu=vs(),JT=gp.DEFAULT_COMPARATOR,ZT=gp.reverseComparator;function tx(r,t,e,n){for(var s=e,a=n,h=t[n],l=2*n+1,p;l=0&&(l=p),t[n]=t[l],n=l,l=2*n+1;t[n]=h,Iu.siftDown(r,t,a,n)}function yp(r,t,e,n){for(var s=n,a=s,h=new r(n),l,p;a>0;)l=e[--a],a!==0&&(p=e[0],e[0]=l,tx(t,e,--n,0),l=p),h[a]=l;return h}function cr(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||JT,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=ZT(this.comparator)}cr.prototype.clear=function(){this.size=0};cr.prototype.push=function(r){return this.size0&&Iu.replace(this.comparator,this.items,r),this.size};cr.prototype.peek=function(){return this.items[0]};cr.prototype.consume=function(){var r=yp(this.ArrayClass,this.comparator,this.items,this.size);return this.size=0,r};cr.prototype.toArray=function(){return yp(this.ArrayClass,this.comparator,this.items.slice(0,this.size),this.size)};cr.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:cr,enumerable:!1}),r};typeof Symbol!="undefined"&&(cr.prototype[Symbol.for("nodejs.util.inspect.custom")]=cr.prototype.inspect);vp.exports=cr});var Pp=z((uA,wp)=>{var ex=dt(),bp=function(r){return r};function Yt(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=bp),this.readHashFunction||(this.readHashFunction=bp),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.")}Yt.prototype.clear=function(){this.items.clear(),this.size=0};Yt.prototype.add=function(r){var t=this.writeHashFunction(r);return this.items.set(t,r),this.size=this.items.size,this};Yt.prototype.set=function(r,t){return r=this.writeHashFunction(r),this.items.set(r,t),this.size=this.items.size,this};Yt.prototype.get=function(r){return r=this.readHashFunction(r),this.items.get(r)};Yt.prototype.has=function(r){return r=this.readHashFunction(r),this.items.has(r)};Yt.prototype.forEach=function(r,t){t=arguments.length>1?t:this,this.items.forEach(function(e){r.call(t,e,e)})};Yt.prototype.values=function(){return this.items.values()};typeof Symbol!="undefined"&&(Yt.prototype[Symbol.iterator]=Yt.prototype.values);Yt.prototype.inspect=function(){var r=Array.from(this.items.values());return Object.defineProperty(r,"constructor",{value:Yt,enumerable:!1}),r};typeof Symbol!="undefined"&&(Yt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Yt.prototype.inspect);Yt.from=function(r,t,e){var n=new Yt(t);return ex(r,function(s,a){e?n.set(a,s):n.add(s)}),n};wp.exports=Yt});var ku=z((hA,Tp)=>{var ws=Nt(),rx=dt();function lt(r){this.Container=r||Array,this.items=new Map,this.clear(),Object.defineProperty(this.items,"constructor",{value:lt,enumerable:!1})}lt.prototype.clear=function(){this.size=0,this.dimension=0,this.items.clear()};lt.prototype.set=function(r,t){var e=this.items.get(r),n;return e||(this.dimension++,e=new this.Container,this.items.set(r,e)),this.Container===Set?(n=e.size,e.add(t),n1?t:this;var e;function n(s){r.call(t,s,e)}this.items.forEach(function(s,a){e=a,s.forEach(n)})};lt.prototype.forEachAssociation=function(r,t){t=arguments.length>1?t:this,this.items.forEach(r,t)};lt.prototype.keys=function(){return this.items.keys()};lt.prototype.values=function(){var r=this.items.values(),t=!1,e,n,s,a;return this.Container===Set?new ws(function h(){if(!t){if(n=r.next(),n.done)return{done:!0};t=!0,e=n.value.values()}return n=e.next(),n.done?(t=!1,h()):{done:!1,value:n.value}}):new ws(function h(){if(!t){if(n=r.next(),n.done)return{done:!0};t=!0,e=n.value,s=0,a=e.length}return s>=a?(t=!1,h()):{done:!1,value:e[s++]}})};lt.prototype.entries=function(){var r=this.items.entries(),t=!1,e,n,s,a,h;return this.Container===Set?new ws(function l(){if(!t){if(n=r.next(),n.done)return{done:!0};t=!0,s=n.value[0],e=n.value[1].values()}return n=e.next(),n.done?(t=!1,l()):{done:!1,value:[s,n.value]}}):new ws(function l(){if(!t){if(n=r.next(),n.done)return{done:!0};t=!0,s=n.value[0],e=n.value[1],a=0,h=e.length}return a>=h?(t=!1,l()):{done:!1,value:[s,e[a++]]}})};lt.prototype.containers=function(){return this.items.values()};lt.prototype.associations=function(){return this.items.entries()};typeof Symbol!="undefined"&&(lt.prototype[Symbol.iterator]=lt.prototype.entries);lt.prototype.inspect=function(){return this.items};typeof Symbol!="undefined"&&(lt.prototype[Symbol.for("nodejs.util.inspect.custom")]=lt.prototype.inspect);lt.prototype.toJSON=function(){return this.items};lt.from=function(r,t){var e=new lt(t);return rx(r,function(n,s){e.set(s,n)}),e};Tp.exports=lt});var Cp=z((cA,Sp)=>{var ix=ku(),nx=dt(),xp=function(r){return r};function Xt(r,t){if(this.items=new ix(t),this.clear(),Array.isArray(r)?(this.writeHashFunction=r[0],this.readHashFunction=r[1]):(this.writeHashFunction=r,this.readHashFunction=r),this.writeHashFunction||(this.writeHashFunction=xp),this.readHashFunction||(this.readHashFunction=xp),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.")}Xt.prototype.clear=function(){this.items.clear(),this.size=0,this.dimension=0};Xt.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};Xt.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};Xt.prototype.get=function(r){return r=this.readHashFunction(r),this.items.get(r)};Xt.prototype.has=function(r){return r=this.readHashFunction(r),this.items.has(r)};Xt.prototype.forEach=function(r,t){t=arguments.length>1?t:this,this.items.forEach(function(e){r.call(t,e,e)})};Xt.prototype.values=function(){return this.items.values()};typeof Symbol!="undefined"&&(Xt.prototype[Symbol.iterator]=Xt.prototype.values);Xt.prototype.inspect=function(){var r=Array.from(this);return Object.defineProperty(r,"constructor",{value:Xt,enumerable:!1}),r};typeof Symbol!="undefined"&&(Xt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Xt.prototype.inspect);Xt.from=function(r,t,e,n){arguments.length===3&&typeof e=="boolean"&&(n=e,e=Array);var s=new Xt(t,e);return nx(r,function(a,h){n?s.set(h,a):s.add(a)}),s};Sp.exports=Xt});var Ep=z((lA,Lp)=>{var _p=1024;function ox(r){return(r&r-1)===0}function Ye(r,t){if(arguments.length<1)throw new Error("mnemonist/hashed-array-tree: expecting at least a byte array constructor.");var e=t||0,n=_p,s=0;if(typeof t=="object"&&(e=t.initialCapacity||0,s=t.initialLength||0,n=t.blockSize||_p),!n||!ox(n))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/n);this.ArrayClass=r,this.length=s,this.capacity=h*n,this.blockSize=n,this.offsetMask=n-1,this.blockMask=Math.log2(n),this.blocks=new Array(h);for(var l=0;l>this.blockMask,n=r&this.offsetMask;return this.blocks[e][n]=t,this};Ye.prototype.get=function(r){if(!(this.length>this.blockMask,e=r&this.offsetMask;return this.blocks[t][e]}};Ye.prototype.grow=function(r){if(typeof r!="number"&&(r=this.capacity+this.blockSize),this.capacity>=r)return this;for(;this.capacity>this.blockMask,n=t&this.offsetMask;return this.blocks[e][n]=r,++this.length};Ye.prototype.pop=function(){if(this.length!==0){var r=this.blocks[this.blocks.length-1],t=--this.length&this.offsetMask;return r[t]}};Ye.prototype.inspect=function(){for(var r=new this.ArrayClass(this.length),t,e=0,n=this.length;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:Ye,enumerable:!1}),r};typeof Symbol!="undefined"&&(Ye.prototype[Symbol.for("nodejs.util.inspect.custom")]=Ye.prototype.inspect);Lp.exports=Ye});var Fu=z((fA,Op)=>{var Ap=Nt(),Ru=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,n=this.items.length;e=t)return{done:!0};var n=r[t-e-1];return e++,{value:n,done:!1}})};kt.prototype.entries=function(){var r=this.items,t=this.size,e=0;return new Ap(function(){if(e>=t)return{done:!0};var n=r[t-e-1];return{value:[e++,n],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=Ru.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 n=new kt(t,e);if(Ru.isArrayLike(r)){var s,a;for(s=0,a=r.length;s{var sx=pe(),ax=oe(),ux=Fu();function zu(r,t,e,n,s,a,h,l){var p=h+(l-h)/2|0,m=~-p,y=-~p,b=e[p];n[a]=b+1;var x=t?t(r[b]):r[b][1],C=a*2+1,O=a*2+2,I=-1/0,F=-1/0;h<=m&&(I=zu(r,t,e,n,s,C,h,m)),y<=l&&(F=zu(r,t,e,n,s,O,y,l));var H=Math.max(x,I,F),j=b;return H===I?j=s[n[C]-1]:H===F&&(j=s[n[O]-1]),s[b]=j,H}function lr(r,t){this.size=r.length,this.intervals=r;var e=null,n=null;Array.isArray(t)&&(e=t[0],n=t[1]);var s=r.length,a=ax.getPointerArray(s+1),h=new a(s),l;for(l=1;lC?1:0});var p=Math.ceil(Math.log2(s+1)),m=Math.pow(2,p)-1,y=new a(m),b=new a(s);zu(r,n,h,y,b,0,0,s-1),h=null,this.height=p,this.tree=y,this.augmentations=b,this.startGetter=e,this.endGetter=n,this.stack=new ux(a,this.height)}lr.prototype.intervalsContainingPoint=function(r){var t=[],e=this.stack;e.clear(),e.push(0);for(var n=this.tree.length,s,a,h,l,p,m,y,b,x;e.size;)s=e.pop(),a=this.tree[s]-1,h=this.intervals[a],l=this.intervals[this.augmentations[a]],y=this.endGetter?this.endGetter(l):l[1],!(r>y)&&(b=s*2+1,b=p&&r<=m&&t.push(h),!(rx)&&(C=h*2+1,C=y&&t<=b&&n.push(p),!(e{Br.search=function(r,t,e,n){var s=0;e=typeof e!="undefined"?e:0,n=typeof n!="undefined"?n:r.length,n--;for(var a;e<=n;)if(s=e+n>>>1,a=r[s],a>t)n=~-s;else if(a>>1,h=r(t[n],e),h>0)a=~-n;else if(h<0)s=-~n;else return n;return-1};Br.lowerBound=function(r,t,e,n){var s=0;for(e=typeof e!="undefined"?e:0,n=typeof n!="undefined"?n:r.length;e>>1,t<=r[s]?n=s:e=-~s;return e};Br.lowerBoundWithComparator=function(r,t,e){for(var n=0,s=0,a=t.length;s>>1,r(e,t[n])<=0?a=n:s=-~n;return s};Br.lowerBoundIndices=function(r,t,e,n,s){var a=0;for(n=typeof n!="undefined"?n:0,s=typeof s!="undefined"?s:r.length;n>>1,e<=r[t[a]]?s=a:n=-~a;return n};Br.upperBound=function(r,t,e,n){var s=0;for(e=typeof e!="undefined"?e:0,n=typeof n!="undefined"?n:r.length;e>>1,t>=r[s]?e=-~s:n=s;return e};Br.upperBoundWithComparator=function(r,t,e){for(var n=0,s=0,a=t.length;s>>1,r(e,t[n])>=0?s=-~n:a=n;return s}});var Fp=z(Wr=>{var Ui=oe(),ji=pe().isArrayLike,ci=Vu(),Ip=cs();function kp(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 n=r[r.length-1],s=t[0];if(n<=s)return Ui.isTypedArray(r)?Ui.concat(r,t):r.concat(t);var a=new r.constructor(r.length+t.length),h,l,p;for(h=0,l=r.length;ht[0]&&(e=r,r=t,t=e);var n=r[r.length-1],s=t[0];if(nt[0]&&(e=r,r=t,t=e);var n=r[r.length-1],s=t[0];if(nb?p=ci.lowerBound(t,y,p+1):(a.push(y),h++,p++);return a};function hx(r){var t=0,e=-1/0,n,s,a,h=[];for(s=0,a=r.length;se&&(e=n));if(h.length===0)return new r[0].constructor(0);if(h.length===1)return h[0].slice();if(h.length===2)return kp(h[0],h[1]);r=h;var l=new r[0].constructor(t),p=Ui.getPointerArray(e),m=new p(r.length),y=new Ip(function(C,O){return C=r[C][m[C]],O=r[O][m[O]],CO?1:0});for(s=0;st&&(t=e));if(a.length===0)return new r[0].constructor(0);if(a.length===1)return a[0].slice();if(a.length===2)return Rp(a[0],a[1]);r=a;var h=new r[0].constructor,l=Ui.getPointerArray(t),p=new l(r.length),m=new Ip(function(x,C){return x=r[x][p[x]],C=r[C][p[C]],xC?1:0});for(n=0;nt&&(t=h),s=r[l][0],a=r[l][h-1],s>e&&(e=s),an)return[];if(e===n)return[e];var m,y,b=r[0],x,C,O,I,F,H,j=e;for(l=1;lH?C=ci.lowerBound(y,F,C+1):(b.push(F),x++,C++);if(b.length===0)return b;j=b[0]}return b};Wr.merge=function(){if(arguments.length===2){if(ji(arguments[0]))return kp(arguments[0],arguments[1])}else if(ji(arguments[0]))return hx(arguments);return null};Wr.unionUnique=function(){if(arguments.length===2){if(ji(arguments[0]))return Rp(arguments[0],arguments[1])}else if(ji(arguments[0]))return cx(arguments);return null};Wr.intersectionUnique=function(){if(arguments.length===2){if(ji(arguments[0]))return Wr.intersectionUniqueArrays(arguments[0],arguments[1])}else if(ji(arguments[0]))return Wr.kWayIntersectionUniqueArrays(arguments);return null}});var Np=z((gA,Vp)=>{var lx=Nt(),fx=dt(),px=Fp();function zp(r){return r}function se(r){if(this.clear(),Array.isArray(r)?(this.documentTokenizer=r[0],this.queryTokenizer=r[1]):(this.documentTokenizer=r,this.queryTokenizer=r),this.documentTokenizer||(this.documentTokenizer=zp),this.queryTokenizer||(this.queryTokenizer=zp),typeof this.documentTokenizer!="function")throw new Error("mnemonist/InvertedIndex.constructor: document tokenizer is not a function.");if(typeof this.queryTokenizer!="function")throw new Error("mnemonist/InvertedIndex.constructor: query tokenizer is not a function.")}se.prototype.clear=function(){this.items=[],this.mapping=new Map,this.size=0,this.dimension=0};se.prototype.add=function(r){this.size++;var t=this.items.length;this.items.push(r);var e=this.documentTokenizer(r);if(!Array.isArray(e))throw new Error("mnemonist/InvertedIndex.add: tokenizer function should return an array of tokens.");for(var n=new Set,s,a,h=0,l=e.length;h1)for(s=1,a=t.length;s1?t:this;for(var e=0,n=this.documents.length;e=t)return{done:!0};var n=r[e++];return{value:n,done:!1}})};se.prototype.tokens=function(){return this.mapping.keys()};typeof Symbol!="undefined"&&(se.prototype[Symbol.iterator]=se.prototype.documents);se.prototype.inspect=function(){var r=this.items.slice();return Object.defineProperty(r,"constructor",{value:se,enumerable:!1}),r};typeof Symbol!="undefined"&&(se.prototype[Symbol.for("nodejs.util.inspect.custom")]=se.prototype.inspect);se.from=function(r,t){var e=new se(t);return fx(r,function(n){e.add(n)}),e};Vp.exports=se});var Uu=z(Nu=>{var Ut=new Float64Array(64),wt=new Float64Array(64);function dx(r,t,e){var n,s,a,h,l;for(Ut[0]=t,wt[0]=e,s=0;s>=0;)if(a=Ut[s],h=wt[s]-1,a=n&&awt[s-1]-Ut[s-1]&&(l=Ut[s],Ut[s]=Ut[s-1],Ut[s-1]=l,l=wt[s],wt[s]=wt[s-1],wt[s-1]=l)}else s--;return r}Nu.inplaceQuickSort=dx;function mx(r,t,e,n){var s,a,h,l,p,m;for(Ut[0]=e,wt[0]=n,a=0;a>=0;)if(h=Ut[a],l=wt[a]-1,h=s&&hwt[a-1]-Ut[a-1]&&(m=Ut[a],Ut[a]=Ut[a-1],Ut[a-1]=m,m=wt[a],wt[a]=wt[a-1],wt[a-1]=m)}else a--;return t}Nu.inplaceQuickSortIndices=mx});var Bp=z((vA,Hp)=>{var gx=pe(),Ps=oe(),Up=Ln().createTupleComparator,jp=bs(),yx=Uu().inplaceQuickSortIndices;function ju(r,t,e,n){var s,a=0,h;for(s=0;s>>1),O=e[C],h[j]=O,b>-1&&(x===0?l[b]=j+1:p[b]=j+1),H=(H+1)%r,C!==I&&C!==F-1&&m.push([H,C+1,F,j,1]),C!==I&&m.push([H,I,C,j,0]),j++;return{axes:t,labels:n,pivots:h,lefts:l,rights:p}}function ke(r,t){this.dimensions=r,this.visited=0,this.axes=t.axes,this.labels=t.labels,this.pivots=t.pivots,this.lefts=t.lefts,this.rights=t.rights,this.size=this.labels.length}ke.prototype.nearestNeighbor=function(r){var t=1/0,e=null,n=this.dimensions,s=this.axes,a=this.pivots,h=this.lefts,l=this.rights,p=0;function m(y,b){p++;var x=h[b],C=l[b],O=a[b],I=ju(n,s,O,r);if(!(I0?x!==0&&m(y,x-1):C!==0&&m(y,C-1),F*F0?C!==0&&m(y,C-1):x!==0&&m(y,x-1))}}return m(0,0),this.visited=p,this.labels[e]};var bx=Up(3),wx=Up(2);ke.prototype.kNearestNeighbors=function(r,t){if(r<=0)throw new Error("mnemonist/kd-tree.kNearestNeighbors: k should be a positive number.");if(r=Math.min(r,this.size),r===1)return[this.nearestNeighbor(t)];var e=new jp(Array,bx,r),n=this.dimensions,s=this.axes,a=this.pivots,h=this.lefts,l=this.rights,p=0;function m(x,C){var O=h[C],I=l[C],F=a[C],H=ju(n,s,F,t);e.push([H,p++,F]);var j=t[x],Z=s[x][F],ht=j-Z;x=(x+1)%n,j{var Wp=Nt(),Px=dt();function yt(){this.clear()}yt.prototype.clear=function(){this.head=null,this.tail=null,this.size=0};yt.prototype.first=function(){return this.head?this.head.item:void 0};yt.prototype.peek=yt.prototype.first;yt.prototype.last=function(){return this.tail?this.tail.item:void 0};yt.prototype.push=function(r){var t={item:r,next:null};return this.head?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this.size++,this.size};yt.prototype.unshift=function(r){var t={item:r,next:null};return this.head?(this.head.next||(this.tail=this.head),t.next=this.head,this.head=t):(this.head=t,this.tail=t),this.size++,this.size};yt.prototype.shift=function(){if(this.size){var r=this.head;return this.head=r.next,this.size--,r.item}};yt.prototype.forEach=function(r,t){if(this.size){t=arguments.length>1?t:this;for(var e=this.head,n=0;e;)r.call(t,e.item,n,this),e=e.next,n++}};yt.prototype.toArray=function(){if(!this.size)return[];for(var r=new Array(this.size),t=0,e=this.size,n=this.head;t{var Gu=Nt(),Tx=dt(),xx=oe(),Sx=pe();function Et(r,t,e){if(arguments.length<2&&(e=r,r=null,t=null),this.capacity=e,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-cache: capacity should be a finite positive integer.");var n=xx.getPointerArray(e);this.forward=new n(e),this.backward=new n(e),this.K=typeof r=="function"?new r(e):new Array(e),this.V=typeof t=="function"?new t(e):new Array(e),this.size=0,this.head=0,this.tail=0,this.items={}}Et.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}};Et.prototype.splayOnTop=function(r){var t=this.head;if(this.head===r)return this;var e=this.backward[r],n=this.forward[r];return this.tail===r?this.tail=e:this.backward[n]=e,this.forward[e]=n,this.backward[t]=r,this.head=r,this.forward[r]=t,this};Et.prototype.set=function(r,t){var e=this.items[r];if(typeof e!="undefined"){this.splayOnTop(e),this.V[e]=t;return}this.size1?t:this;for(var e=0,n=this.size,s=this.head,a=this.K,h=this.V,l=this.forward;e=t)return{done:!0};var a=n[e];return r++,r=t)return{done:!0};var a=n[e];return r++,r=t)return{done:!0};var h=n[e],l=s[e];return r++,r{var Gi=Ts(),Cx=dt(),_x=oe(),Lx=pe();function fr(r,t,e){arguments.length<2?Gi.call(this,r):Gi.call(this,r,t,e);var n=_x.getPointerArray(this.capacity);this.deleted=new n(this.capacity),this.deletedSize=0}for(Hu in Gi.prototype)fr.prototype[Hu]=Gi.prototype[Hu];var Hu;typeof Symbol!="undefined"&&(fr.prototype[Symbol.iterator]=Gi.prototype[Symbol.iterator]);fr.prototype.clear=function(){Gi.prototype.clear.call(this),this.deletedSize=0};fr.prototype.set=function(r,t){var e=this.items[r];if(typeof e!="undefined"){this.splayOnTop(e),this.V[e]=t;return}this.size0?e=this.deleted[--this.deletedSize]:e=this.size,this.size++):(e=this.tail,this.tail=this.backward[e],delete this.items[this.K[e]]),this.items[r]=e,this.K[e]=r,this.V[e]=t,this.forward[e]=this.head,this.backward[this.head]=e,this.head=e};fr.prototype.setpop=function(r,t){var e=null,n=null,s=this.items[r];return typeof s!="undefined"?(this.splayOnTop(s),e=this.V[s],this.V[s]=t,{evicted:!1,key:r,value:e}):(this.size0?s=this.deleted[--this.deletedSize]:s=this.size,this.size++):(s=this.tail,this.tail=this.backward[s],e=this.V[s],n=this.K[s],delete this.items[this.K[s]]),this.items[r]=s,this.K[s]=r,this.V[s]=t,this.forward[s]=this.head,this.backward[this.head]=s,this.head=s,n?{evicted:!0,key:n,value:e}:null)};fr.prototype.delete=function(r){var t=this.items[r];if(typeof t=="undefined")return!1;if(delete this.items[r],this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,!0;var e=this.backward[t],n=this.forward[t];return this.head===t&&(this.head=n),this.tail===t&&(this.tail=e),this.forward[e]=n,this.backward[n]=e,this.size--,this.deleted[this.deletedSize++]=t,!0};fr.prototype.remove=function(r,t=void 0){var e=this.items[r];if(typeof e=="undefined")return t;var n=this.V[e];if(delete this.items[r],this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,n;var s=this.backward[e],a=this.forward[e];return this.head===e&&(this.head=a),this.tail===e&&(this.tail=s),this.forward[s]=a,this.backward[a]=s,this.size--,this.deleted[this.deletedSize++]=e,n};fr.from=function(r,t,e,n){if(arguments.length<2){if(n=Lx.guessLength(r),typeof n!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(n=t,t=null,e=null);var s=new fr(t,e,n);return Cx(r,function(a,h){s.set(h,a)}),s};Kp.exports=fr});var Bu=z((TA,Xp)=>{var Hi=Ts(),Ex=dt(),Ax=oe(),Ox=pe();function qt(r,t,e){if(arguments.length<2&&(e=r,r=null,t=null),this.capacity=e,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-map: capacity should be positive number.");if(!isFinite(this.capacity)||Math.floor(this.capacity)!==this.capacity)throw new Error("mnemonist/lru-map: capacity should be a finite positive integer.");var n=Ax.getPointerArray(e);this.forward=new n(e),this.backward=new n(e),this.K=typeof r=="function"?new r(e):new Array(e),this.V=typeof t=="function"?new t(e):new Array(e),this.size=0,this.head=0,this.tail=0,this.items=new Map}qt.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items.clear()};qt.prototype.set=function(r,t){var e=this.items.get(r);if(typeof e!="undefined"){this.splayOnTop(e),this.V[e]=t;return}this.size{var Bi=Bu(),Dx=dt(),Mx=oe(),Ix=pe();function pr(r,t,e){arguments.length<2?Bi.call(this,r):Bi.call(this,r,t,e);var n=Mx.getPointerArray(this.capacity);this.deleted=new n(this.capacity),this.deletedSize=0}for(Wu in Bi.prototype)pr.prototype[Wu]=Bi.prototype[Wu];var Wu;typeof Symbol!="undefined"&&(pr.prototype[Symbol.iterator]=Bi.prototype[Symbol.iterator]);pr.prototype.clear=function(){Bi.prototype.clear.call(this),this.deletedSize=0};pr.prototype.set=function(r,t){var e=this.items.get(r);if(typeof e!="undefined"){this.splayOnTop(e),this.V[e]=t;return}this.size0?e=this.deleted[--this.deletedSize]:e=this.size,this.size++):(e=this.tail,this.tail=this.backward[e],this.items.delete(this.K[e])),this.items.set(r,e),this.K[e]=r,this.V[e]=t,this.forward[e]=this.head,this.backward[this.head]=e,this.head=e};pr.prototype.setpop=function(r,t){var e=null,n=null,s=this.items.get(r);return typeof s!="undefined"?(this.splayOnTop(s),e=this.V[s],this.V[s]=t,{evicted:!1,key:r,value:e}):(this.size0?s=this.deleted[--this.deletedSize]:s=this.size,this.size++):(s=this.tail,this.tail=this.backward[s],e=this.V[s],n=this.K[s],this.items.delete(this.K[s])),this.items.set(r,s),this.K[s]=r,this.V[s]=t,this.forward[s]=this.head,this.backward[this.head]=s,this.head=s,n?{evicted:!0,key:n,value:e}:null)};pr.prototype.delete=function(r){var t=this.items.get(r);if(typeof t=="undefined")return!1;if(this.items.delete(r),this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,!0;var e=this.backward[t],n=this.forward[t];return this.head===t&&(this.head=n),this.tail===t&&(this.tail=e),this.forward[e]=n,this.backward[n]=e,this.size--,this.deleted[this.deletedSize++]=t,!0};pr.prototype.remove=function(r,t=void 0){var e=this.items.get(r);if(typeof e=="undefined")return t;var n=this.V[e];if(this.items.delete(r),this.size===1)return this.size=0,this.head=0,this.tail=0,this.deletedSize=0,n;var s=this.backward[e],a=this.forward[e];return this.head===e&&(this.head=a),this.tail===e&&(this.tail=s),this.forward[s]=a,this.backward[a]=s,this.size--,this.deleted[this.deletedSize++]=e,n};pr.from=function(r,t,e,n){if(arguments.length<2){if(n=Ix.guessLength(r),typeof n!="number")throw new Error("mnemonist/lru-map.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(n=t,t=null,e=null);var s=new pr(t,e,n);return Dx(r,function(a,h){s.set(h,a)}),s};Jp.exports=pr});var ed=z((SA,td)=>{var kx=Nt(),Rx=dt(),Fx=bs(),zx=function(r,t){return r[1]>t[1]?-1:r[1] 0.");for(var t=new Fx(Array,zx,r),e=this.items.entries(),n;n=e.next(),!n.done;)t.push(n.value);return t.consume()};et.prototype.forEach=function(r,t){t=arguments.length>1?t:this;var e;this.items.forEach(function(n,s){for(e=0;e1?t:this,this.items.forEach(r,t)};et.prototype.keys=function(){return this.items.keys()};et.prototype.values=function(){var r=this.items.entries(),t=!1,e,n,s,a;return new kx(function h(){if(!t){if(e=r.next(),e.done)return{done:!0};t=!0,n=e.value[0],s=e.value[1],a=0}return a>=s?(t=!1,h()):(a++,{done:!1,value:n})})};et.prototype.multiplicities=function(){return this.items.entries()};typeof Symbol!="undefined"&&(et.prototype[Symbol.iterator]=et.prototype.values);et.prototype.inspect=function(){return this.items};typeof Symbol!="undefined"&&(et.prototype[Symbol.for("nodejs.util.inspect.custom")]=et.prototype.inspect);et.prototype.toJSON=function(){return this.items};et.from=function(r){var t=new et;return Rx(r,function(e){t.add(e)}),t};et.isSubset=function(r,t){var e=r.multiplicities(),n,s,a;if(r===t)return!0;if(r.dimension>t.dimension)return!1;for(;n=e.next(),!n.done;)if(s=n.value[0],a=n.value[1],t.multiplicity(s){var Vx=Nt(),Nx=dt();function Ux(r,t,e){return((Math.pow(r,2)-Math.pow(Math.abs(t-e),2))/2|0)+r+1}function jx(r,t){for(var e=0,n=0,s=t+1;nt.length?-1:r.lengtht?1:0}function rd(r,t){var e=r+1,n=t/e|0,s=n+1,a,h,l=t-n*e,p=e-l,m=new Array(r+1);for(a=0;a 0");this.levenshtein=r,this.k=t,this.clear()}Ct.prototype.clear=function(){this.size=0,this.strings=[],this.invertedIndices={}};Ct.prototype.add=function(r){var t=r.length,e=this.size;this.strings.push(r),this.size++;var n=id(this.k,r),s=this.invertedIndices[t];typeof s=="undefined"&&(s={},this.invertedIndices[t]=s);var a,h,l,p,m;for(p=0,m=n.length;p1?t:this;for(var e=0,n=this.strings.length;e=t)return{done:!0};var n=r[e];return e++,{value:n,done:!1}})};typeof Symbol!="undefined"&&(Ct.prototype[Symbol.iterator]=Ct.prototype.values);Ct.prototype.inspect=function(){var r=this.strings.slice();return 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){var n=new Ct(t,e);return Nx(r,function(s){n.add(s)}),n};Ct.countKeys=jx;Ct.comparator=Gx;Ct.partition=rd;Ct.segments=id;Ct.segmentPos=Hx;Ct.multiMatchAwareInterval=nd;Ct.multiMatchAwareSubstrings=od;sd.exports=Ct});var cd=z((_A,hd)=>{var ud=Nt(),Bx=dt();function _t(){this.clear()}_t.prototype.clear=function(){this.items=[],this.offset=0,this.size=0};_t.prototype.enqueue=function(r){return this.items.push(r),++this.size};_t.prototype.dequeue=function(){if(this.size){var r=this.items[this.offset];return++this.offset*2>=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,r}};_t.prototype.peek=function(){if(this.size)return this.items[this.offset]};_t.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=this.offset,n=0,s=this.items.length;e=r.length)return{done:!0};var e=r[t];return t++,{value:e,done:!1}})};_t.prototype.entries=function(){var r=this.items,t=this.offset,e=0;return new ud(function(){if(t>=r.length)return{done:!0};var n=r[t];return t++,{value:[e++,n],done:!1}})};typeof Symbol!="undefined"&&(_t.prototype[Symbol.iterator]=_t.prototype.values);_t.prototype.toString=function(){return this.toArray().join(",")};_t.prototype.toJSON=function(){return this.toArray()};_t.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:_t,enumerable:!1}),r};typeof Symbol!="undefined"&&(_t.prototype[Symbol.for("nodejs.util.inspect.custom")]=_t.prototype.inspect);_t.from=function(r){var t=new _t;return Bx(r,function(e){t.enqueue(e)}),t};_t.of=function(){return _t.from(arguments)};hd.exports=_t});var pd=z((LA,fd)=>{var ld=Nt(),Wx=dt();function Lt(){this.clear()}Lt.prototype.clear=function(){this.items=[],this.size=0};Lt.prototype.push=function(r){return this.items.push(r),++this.size};Lt.prototype.pop=function(){if(this.size!==0)return this.size--,this.items.pop()};Lt.prototype.peek=function(){return this.items[this.size-1]};Lt.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=0,n=this.items.length;e=t)return{done:!0};var n=r[t-e-1];return e++,{value:n,done:!1}})};Lt.prototype.entries=function(){var r=this.items,t=r.length,e=0;return new ld(function(){if(e>=t)return{done:!0};var n=r[t-e-1];return{value:[e++,n],done:!1}})};typeof Symbol!="undefined"&&(Lt.prototype[Symbol.iterator]=Lt.prototype.values);Lt.prototype.toString=function(){return this.toArray().join(",")};Lt.prototype.toJSON=function(){return this.toArray()};Lt.prototype.inspect=function(){var r=this.toArray();return Object.defineProperty(r,"constructor",{value:Lt,enumerable:!1}),r};typeof Symbol!="undefined"&&(Lt.prototype[Symbol.for("nodejs.util.inspect.custom")]=Lt.prototype.inspect);Lt.from=function(r){var t=new Lt;return Wx(r,function(e){t.push(e)}),t};Lt.of=function(){return Lt.from(arguments)};fd.exports=Lt});var dd=z(Rt=>{Rt.intersection=function(){if(arguments.length<2)throw new Error("mnemonist/Set.intersection: needs at least two arguments.");var r=new Set,t=1/0,e=null,n,s,a=arguments.length;for(s=0;st.size)return!1;for(;n=e.next(),!n.done;)if(!t.has(n.value))return!1;return!0};Rt.isSuperset=function(r,t){return Rt.isSubset(t,r)};Rt.add=function(r,t){for(var e=t.values(),n;n=e.next(),!n.done;)r.add(n.value)};Rt.subtract=function(r,t){for(var e=t.values(),n;n=e.next(),!n.done;)r.delete(n.value)};Rt.intersect=function(r,t){for(var e=r.values(),n;n=e.next(),!n.done;)t.has(n.value)||r.delete(n.value)};Rt.disjunct=function(r,t){for(var e=r.values(),n,s=[];n=e.next(),!n.done;)t.has(n.value)&&s.push(n.value);for(e=t.values();n=e.next(),!n.done;)r.has(n.value)||r.add(n.value);for(var a=0,h=s.length;at.size&&(e=r,r=t,t=e),r.size===0)return 0;if(r===t)return r.size;for(var n=r.values(),s,a=0;s=n.next(),!s.done;)t.has(s.value)&&a++;return a};Rt.unionSize=function(r,t){var e=Rt.intersectionSize(r,t);return r.size+t.size-e};Rt.jaccard=function(r,t){var e=Rt.intersectionSize(r,t);if(e===0)return 0;var n=r.size+t.size-e;return e/n};Rt.overlap=function(r,t){var e=Rt.intersectionSize(r,t);return e===0?0:e/Math.min(r.size,t.size)}});var gd=z((AA,md)=>{var qx=Nt(),$x=oe().getPointerArray;function Te(r){var t=$x(r);this.start=0,this.size=0,this.capacity=r,this.dense=new t(r),this.sparse=new t(r)}Te.prototype.clear=function(){this.start=0,this.size=0};Te.prototype.has=function(r){if(this.size===0)return!1;var t=this.sparse[r],e=t=this.start&&t=this.start&&t1?t:this;for(var e=this.capacity,n=this.size,s=this.start,a=0;a=e)return{done:!0};var a=r[n];return n++,s++,n===t&&(n=0),{value:a,done:!1}})};typeof Symbol!="undefined"&&(Te.prototype[Symbol.iterator]=Te.prototype.values);Te.prototype.inspect=function(){var r=[];return this.forEach(function(t){r.push(t)}),Object.defineProperty(r,"constructor",{value:Te,enumerable:!1}),r.capacity=this.capacity,r};typeof Symbol!="undefined"&&(Te.prototype[Symbol.for("nodejs.util.inspect.custom")]=Te.prototype.inspect);md.exports=Te});var vd=z((OA,yd)=>{var qu=Nt(),Qx=oe().getPointerArray;function Jt(r,t){arguments.length<2&&(t=r,r=Array);var e=Qx(t);this.size=0,this.length=t,this.dense=new e(t),this.sparse=new e(t),this.vals=new r(t)}Jt.prototype.clear=function(){this.size=0};Jt.prototype.has=function(r){var t=this.sparse[r];return t=this.size||this.dense[t]!==r?!1:(t=this.dense[this.size-1],this.dense[this.sparse[r]]=t,this.sparse[t]=this.sparse[r],this.size--,!0)};Jt.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e=0;e{var Kx=Nt(),Yx=oe().getPointerArray;function xe(r){var t=Yx(r);this.size=0,this.length=r,this.dense=new t(r),this.sparse=new t(r)}xe.prototype.clear=function(){this.size=0};xe.prototype.has=function(r){var t=this.sparse[r];return t=this.size||this.dense[t]!==r?!1:(t=this.dense[this.size-1],this.dense[this.sparse[r]]=t,this.sparse[t]=this.sparse[r],this.size--,!0)};xe.prototype.forEach=function(r,t){t=arguments.length>1?t:this;for(var e,n=0;n{var Xx=dt(),Jx=2,Zx=2,tS=new Set([0,1,2]),eS={0:"Returns only the top suggestion",1:"Returns suggestions with the smallest edit distance",2:"Returns every suggestion (no early termination)"};function xs(r){var t=new Set;return typeof r=="number"&&t.add(r),{suggestions:t,count:0}}function Pd(r,t,e){return{term:r||"",distance:t||0,count:e||0}}function xd(r,t,e,n){n=n||new Set,t++;var s,a=r.length,h;if(a>1)for(h=0;h0&&r[h].length-a.length>n.length-a.length&&(e.suggestions=new Set,e.count=0),(t===2||!e.suggestions.size||r[h].length-a.length>=n.length-a.length)&&e.suggestions.add(s)}function Td(r,t){var e=r.length,n=t.length,s=[[]],a=e+n,h=new Map,l,p,m;for(s[0][0]=a,l=0;l<=e;l++)s[l+1]||(s[l+1]=[]),s[l+1][1]=l,s[l+1][0]=a;for(m=0;m<=n;m++)s[1][m+1]=m,s[0][m+1]=a;var y=r+t,b;for(l=0,p=y.length;ls)return[];for(var l=[a],p=new Set,m=new Set,y=[],b,x;l.length>0&&(b=l.shift(),!(e<2&&y.length>0&&h-b.length>y[0].distance));){if(x=r[b],x!==void 0){if(typeof x=="number"&&(x=xs(x)),x.count>0&&!m.has(b)){m.add(b);var C=Pd(b,h-b.length,x.count);if(y.push(C),e<2&&h-b.length===0)break}x.suggestions.forEach(H=>{var j=t[H];if(!m.has(j)){m.add(j);var Z=0;if(a!==j)if(j.length===b.length)Z=h-b.length;else if(h===b.length)Z=j.length-b.length;else{for(var ht=0,At=0,Fe=j.length;ht0||At>0?Z=Td(j.substr(ht,Fe-ht-At),a.substr(ht,h-ht-At)):Z=Td(j,a)}if(e<2&&y.length>0&&y[0].distance>Z&&(y=[]),!(e<2&&y.length>0&&Z>y[0].distance)&&Z<=n){var Se=r[j];Se!==void 0&&y.push(Pd(j,Z,Se.count))}}})}if(h-b.length0&&h-b.length>=y[0].distance)continue;for(var O=0,I=b.length;Othis.maxLength&&(this.maxLength=r.length)),t.count===1){var e=this.words.length;this.words.push(r);var n=xd(r,0,this.maxDistance);n.forEach(s=>{var a=this.dictionary[s];a!==void 0?(typeof a=="number"&&(a=xs(a),this.dictionary[s]=a),a.suggestions.has(e)||rS(this.words,this.verbosity,a,r,e,s)):this.dictionary[s]=e})}return this.size++,this};dr.prototype.search=function(r){return iS(this.dictionary,this.words,this.verbosity,this.maxDistance,this.maxLength,r)};dr.prototype.inspect=function(){var r=[];r.size=this.size,r.maxDistance=this.maxDistance,r.verbosity=this.verbosity,r.behavior=eS[this.verbosity];for(var t in this.dictionary)typeof this.dictionary[t]=="object"&&this.dictionary[t].count&&r.push([t,this.dictionary[t].count]);return Object.defineProperty(r,"constructor",{value:dr,enumerable:!1}),r};typeof Symbol!="undefined"&&(dr.prototype[Symbol.for("nodejs.util.inspect.custom")]=dr.prototype.inspect);dr.from=function(r,t){var e=new dr(t);return Xx(r,function(n){e.add(n)}),e};Sd.exports=dr});var $u=z((IA,_d)=>{var nS=dt(),Wi=Nt(),jt=String.fromCharCode(0);function vt(r){this.mode=r===Array?"array":"string",this.clear()}vt.prototype.clear=function(){this.root={},this.size=0};vt.prototype.set=function(r,t){for(var e=this.root,n,s=0,a=r.length;s1&&(e=null,n=null):Object.keys(t).length<2&&(e=s,n=a)}return jt in t?(this.size--,e?delete e[n]:delete t[jt],!0):!1};vt.prototype.has=function(r){for(var t=this.root,e,n=0,s=r.length;n{var oS=dt(),Ld=$u(),Ss=String.fromCharCode(0);function Gt(r){this.mode=r===Array?"array":"string",this.clear()}for(Qu in Ld.prototype)Gt.prototype[Qu]=Ld.prototype[Qu];var Qu;delete Gt.prototype.set;delete Gt.prototype.get;delete Gt.prototype.values;delete Gt.prototype.entries;Gt.prototype.add=function(r){for(var t=this.root,e,n=0,s=r.length;n{var Od=Nt(),sS=dt(),aS=pe(),Dd=oe(),uS=function(r){return Math.max(1,Math.ceil(r*1.5))},hS=function(r){var t=Dd.getPointerArray(r);return new t(r)};function J(r,t){if(arguments.length<1)throw new Error("mnemonist/vector: expecting at least a byte array constructor.");var e=t||0,n=uS,s=0,a=!1;typeof t=="object"&&(e=t.initialCapacity||0,s=t.initialLength||0,n=t.policy||n,a=t.factory===!0),this.factory=a?r:null,this.ArrayClass=r,this.length=s,this.capacity=Math.max(s,e),this.policy=n,this.array=new r(this.capacity)}J.prototype.set=function(r,t){if(this.lengththis.capacity)if(this.factory===null?this.array=new this.ArrayClass(r):this.array=this.factory(r),Dd.isTypedArray(this.array))this.array.set(t,0);else for(var e=0,n=this.length;e=r)return this;for(t=this.capacity;t=t)return{done:!0};var n=r[e];return e++,{value:n,done:!1}})};J.prototype.entries=function(){var r=this.array,t=this.length,e=0;return new Od(function(){if(e>=t)return{done:!0};var n=r[e];return{value:[e++,n],done:!1}})};typeof Symbol!="undefined"&&(J.prototype[Symbol.iterator]=J.prototype.values);J.prototype.inspect=function(){var r=this.array.slice(0,this.length);return r.type=this.array.constructor.name,r.items=this.length,r.capacity=this.capacity,Object.defineProperty(r,"constructor",{value:J,enumerable:!1}),r};typeof Symbol!="undefined"&&(J.prototype[Symbol.for("nodejs.util.inspect.custom")]=J.prototype.inspect);J.from=function(r,t,e){if(arguments.length<3&&(e=aS.guessLength(r),typeof e!="number"))throw new Error("mnemonist/vector.from: could not guess iterable length. Please provide desired capacity as last argument.");var n=new J(t,e);return sS(r,function(s){n.push(s)}),n};function mr(r){var t=function(n){J.call(this,r,n)};for(var e in J.prototype)J.prototype.hasOwnProperty(e)&&(t.prototype[e]=J.prototype[e]);return t.from=function(n,s){return J.from(n,r,s)},typeof Symbol!="undefined"&&(t.prototype[Symbol.iterator]=t.prototype.values),t}J.Int8Vector=mr(Int8Array);J.Uint8Vector=mr(Uint8Array);J.Uint8ClampedVector=mr(Uint8ClampedArray);J.Int16Vector=mr(Int16Array);J.Uint16Vector=mr(Uint16Array);J.Int32Vector=mr(Int32Array);J.Uint32Vector=mr(Uint32Array);J.Float32Vector=mr(Float32Array);J.Float64Vector=mr(Float64Array);J.PointerVector=mr(hS);Md.exports=J});var Rd=z((FA,kd)=>{var cS=pe(),lS=oe(),fS=Uu().inplaceQuickSortIndices,pS=Vu().lowerBoundIndices,dS=vs(),mS=lS.getPointerArray;function gS(r,t){return r.distancet.distance?-1:0}function yS(r,t,e){for(var n=e.length,s=mS(n),a=0,h=new s(n),l=new s(n),p=new s(n),m=new Float64Array(n),y=[0,0,n],b=new Float64Array(n),x,C,O,I,F,H,j,Z,ht;y.length;)if(F=y.pop(),I=y.pop(),x=y.pop(),C=e[F-1],F--,ht=F-I,h[x]=C,ht!==0){if(ht===1){j=r(t[C],t[e[I]]),m[x]=j,a++,p[x]=a,h[a]=e[I];continue}for(Z=I;Z0&&(a++,p[x]=a,y.push(a,H,F)),H-I>0&&(a++,l[x]=a,y.push(a,I,H))}return{nodes:h,lefts:l,rights:p,mus:m}}function Er(r,t){if(typeof r!="function")throw new Error("mnemonist/VPTree.constructor: given `distance` must be a function.");if(!t)throw new Error("mnemonist/VPTree.constructor: you must provide items to the tree. A VPTree cannot be updated after its creation.");this.distance=r,this.heap=new dS(gS),this.D=0;var e=cS.toArrayWithIndices(t);this.items=e[0];var n=e[1];this.size=n.length;var s=yS(r,this.items,n);this.nodes=s.nodes,this.lefts=s.lefts,this.rights=s.rights,this.mus=s.mus}Er.prototype.nearestNeighbors=function(r,t){var e=this.heap,n=[0],s=1/0,a,h,l,p,m,y,b;for(this.D=0;n.length;)a=n.pop(),h=this.nodes[a],l=this.items[h],b=this.distance(l,t),this.D++,br&&e.pop(),e.size>=r&&(s=e.peek().distance)),p=this.lefts[a],m=this.rights[a],!(!p&&!m)&&(y=this.mus[a],b=y-s&&n.push(m)):(m&&b>=y-s&&n.push(m),p&&b=0;C--)x[C]=e.pop();return x};Er.prototype.neighbors=function(r,t){var e=[],n=[0],s,a,h,l,p,m,y;for(this.D=0;n.length;)s=n.pop(),a=this.nodes[s],h=this.items[a],y=this.distance(h,t),this.D++,y<=r&&e.push({distance:y,item:h}),l=this.lefts[s],p=this.rights[s],!(!l&&!p)&&(m=this.mus[s],y=m-r&&n.push(p)):(p&&y>=m-r&&n.push(p),l&&y{var Ku=vs(),Yu=cs(),Fd=kf();zd.exports={BiMap:Nf(),BitSet:qf(),BitVector:Yf(),BloomFilter:rp(),BKTree:np(),CircularBuffer:hp(),DefaultMap:lp(),DefaultWeakMap:pp(),FixedDeque:Au(),StaticDisjointSet:mp(),FibonacciHeap:Yu,MinFibonacciHeap:Yu.MinFibonacciHeap,MaxFibonacciHeap:Yu.MaxFibonacciHeap,FixedReverseHeap:bs(),FuzzyMap:Pp(),FuzzyMultiMap:Cp(),HashedArrayTree:Ep(),Heap:Ku,MinHeap:Ku.MinHeap,MaxHeap:Ku.MaxHeap,StaticIntervalTree:Mp(),InvertedIndex:Np(),KDTree:Bp(),LinkedList:$p(),LRUCache:Ts(),LRUCacheWithDelete:Yp(),LRUMap:Bu(),LRUMapWithDelete:Zp(),MultiMap:ku(),MultiSet:ed(),PassjoinIndex:ad(),Queue:cd(),FixedStack:Fu(),Stack:pd(),SuffixArray:Fd,GeneralizedSuffixArray:Fd.GeneralizedSuffixArray,Set:dd(),SparseQueueSet:gd(),SparseMap:vd(),SparseSet:wd(),SymSpell:Cd(),Trie:Ad(),TrieMap:$u(),Vector:Id(),VPTree:Rd()}});var D=class r{static get ZERO(){return new r(0,0)}static get ONE(){return new r(1,1)}static get UP(){return new r(0,-1)}static get DOWN(){return new r(0,1)}static get LEFT(){return new r(-1,0)}static get RIGHT(){return new r(1,0)}static get UP_LEFT(){return new r(-1,-1)}static get UP_RIGHT(){return new r(1,-1)}static get DOWN_RIGHT(){return new r(1,1)}static get DOWN_LEFT(){return new r(-1,1)}constructor(t,e){typeof t=="number"?(this.x=t,this.y=e||0):(this.x=t.x,this.y=t.y)}clone(){return new r(this.x,this.y)}add(t){return new r(this.x+t.x,this.y+t.y)}multiply(t){return new r(this.x*t.x,this.y*t.y)}divide(t){return new r(this.x/t.x,this.y/t.y)}subtract(t){return new r(this.x-t.x,this.y-t.y)}equals(t){return this.x===t.x&&this.y===t.y}abs(){return new r(Math.abs(this.x),Math.abs(this.y))}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}modulo(t){return new r(this.x%t.x,this.y%t.y)}scalarModulo(t){return new r(this.x%t,this.y%t)}scalarMult(t){return new r(this.x*t,this.y*t)}toPosition(){return{x:this.x,y:this.y}}toString(){return`${this.x}#${this.y}`}};var G=class{static equal(t,e){return t.position.x===e.position.x&&t.position.y===e.position.y&&t.layer===e.layer}static copyOver(t,e){e.position.x=t.position.x,e.position.y=t.position.y,e.layer=t.layer}static clone(t){return{position:t.position.clone(),layer:t.layer}}static toString(t){return`${t.position.toString()}#${t.layer}`}static toInternal(t){return{position:new D(t.position.x,t.position.y),layer:t.charLayer}}static fromInternal(t){return{position:t.position.toPosition(),charLayer:t.layer}}};var XP={up:"down",down:"up",left:"right",right:"left",none:"none","up-left":"down-right","up-right":"down-left","down-right":"up-left","down-left":"up-right"},JP={up:D.UP,down:D.DOWN,left:D.LEFT,right:D.RIGHT,none:D.ZERO,"up-left":D.UP_LEFT,"up-right":D.UP_RIGHT,"down-right":D.DOWN_RIGHT,"down-left":D.DOWN_LEFT},ZP={left:"up-left","up-left":"up",up:"up-right","up-right":"right",right:"down-right","down-right":"down",down:"down-left","down-left":"left",none:"none"},tT={left:"down-left","up-left":"left",up:"up-left","up-right":"up",right:"up-right","down-right":"right",down:"down-right","down-left":"down",none:"none"},eT=["down-left","down-right","up-right","up-left"];function bn(){return["up","down","left","right","none","up-left","up-right","down-right","down-left"]}function Ei(r){return eT.includes(r)}function au(r){return["left","right"].includes(r)}function Nl(r){return["up","down"].includes(r)}function Ul(r){return tT[r]}function Io(r){return ZP[r]}function Be(r){return JP[r]}function jl(r){return XP[r]}function re(r,t){if(r.x===t.x){if(r.y>t.y)return"up";if(r.yt.x)return"left";if(r.xt.x){if(r.yt.y)return"up-left"}else if(r.xt.y)return"up-right"}return"none"}function Ur(r){return typeof r=="string"&&bn().includes(r)}var uu=function(r,t){return uu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])},uu(r,t)};function jr(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");uu(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function Gl(r,t,e,n){function s(a){return a instanceof e?a:new e(function(h){h(a)})}return new(e||(e=Promise))(function(a,h){function l(y){try{m(n.next(y))}catch(b){h(b)}}function p(y){try{m(n.throw(y))}catch(b){h(b)}}function m(y){y.done?a(y.value):s(y.value).then(l,p)}m((n=n.apply(r,t||[])).next())})}function ko(r,t){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,s,a,h;return h={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function l(m){return function(y){return p([m,y])}}function p(m){if(n)throw new TypeError("Generator is already executing.");for(;h&&(h=0,m[0]&&(e=0)),e;)try{if(n=1,s&&(a=m[0]&2?s.return:m[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,m[1])).done)return a;switch(s=0,a&&(m=[m[0]&2,a.value]),m[0]){case 0:case 1:a=m;break;case 4:return e.label++,{value:m[1],done:!1};case 5:e.label++,s=m[1],m=[0];continue;case 7:m=e.ops.pop(),e.trys.pop();continue;default:if(a=e.trys,!(a=a.length>0&&a[a.length-1])&&(m[0]===6||m[0]===2)){e=0;continue}if(m[0]===3&&(!a||m[1]>a[0]&&m[1]=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function er(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,a=[],h;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)a.push(s.value)}catch(l){h={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(h)throw h.error}}return a}function rr(r,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,a;n1||l(x,C)})})}function l(x,C){try{p(n[x](C))}catch(O){b(a[0][3],O)}}function p(x){x.value instanceof ii?Promise.resolve(x.value.v).then(m,y):b(a[0][2],x)}function m(x){l("next",x)}function y(x){l("throw",x)}function b(x,C){x(C),a.shift(),a.length&&l(a[0][0],a[0][1])}}function Bl(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof _r=="function"?_r(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(a){e[a]=r[a]&&function(h){return new Promise(function(l,p){h=r[a](h),s(l,p,h.done,h.value)})}}function s(a,h,l,p){Promise.resolve(p).then(function(m){a({value:m,done:l})},h)}}function tt(r){return typeof r=="function"}function Ro(r){var t=function(n){Error.call(n),n.stack=new Error().stack},e=r(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var Fo=Ro(function(r){return function(e){r(this),this.message=e?e.length+` errors occurred during unsubscription: `+e.map(function(n,s){return s+1+") "+n.toString()}).join(` - `):"",this.name="UnsubscriptionError",this.errors=e}});function wn(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var Ai=function(){function r(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var t,e,n,s,a;if(!this.closed){this.closed=!0;var h=this._parentage;if(h)if(this._parentage=null,Array.isArray(h))try{for(var l=_r(h),p=l.next();!p.done;p=l.next()){var m=p.value;m.remove(this)}}catch(I){t={error:I}}finally{try{p&&!p.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}else h.remove(this);var y=this.initialTeardown;if(tt(y))try{y()}catch(I){a=I instanceof Fo?I.errors:[I]}var b=this._finalizers;if(b){this._finalizers=null;try{for(var x=_r(b),C=x.next();!C.done;C=x.next()){var O=C.value;try{Wl(O)}catch(I){a=a!=null?a:[],I instanceof Fo?a=rr(rr([],er(a)),er(I.errors)):a.push(I)}}}catch(I){n={error:I}}finally{try{C&&!C.done&&(s=x.return)&&s.call(x)}finally{if(n)throw n.error}}}if(a)throw new Fo(a)}},r.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)Wl(t);else{if(t instanceof r){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},r.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},r.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},r.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&wn(e,t)},r.prototype.remove=function(t){var e=this._finalizers;e&&wn(e,t),t instanceof r&&t._removeParent(this)},r.EMPTY=function(){var t=new r;return t.closed=!0,t}(),r}();var hu=Ai.EMPTY;function zo(r){return r instanceof Ai||r&&"closed"in r&&tt(r.remove)&&tt(r.add)&&tt(r.unsubscribe)}function Wl(r){tt(r)?r():r.unsubscribe()}var We={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Oi={setTimeout:function(r,t){for(var e=[],n=2;n0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var n=this,s=this,a=s.hasError,h=s.isStopped,l=s.observers;return a||h?hu:(this.currentObservers=null,l.push(e),new Ai(function(){n.currentObservers=null,wn(l,e)}))},t.prototype._checkFinalizedStatuses=function(e){var n=this,s=n.hasError,a=n.thrownError,h=n.isStopped;s?e.error(a):h&&e.complete()},t.prototype.asObservable=function(){var e=new Vt;return e.source=this,e},t.create=function(e,n){return new Jl(e,n)},t}(Vt);var Jl=function(r){jr(t,r);function t(e,n){var s=r.call(this)||this;return s.destination=e,s.source=n,s}return t.prototype.next=function(e){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.next)===null||s===void 0||s.call(n,e)},t.prototype.error=function(e){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.error)===null||s===void 0||s.call(n,e)},t.prototype.complete=function(){var e,n;(n=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||n===void 0||n.call(e)},t.prototype._subscribe=function(e){var n,s;return(s=(n=this.source)===null||n===void 0?void 0:n.subscribe(e))!==null&&s!==void 0?s:hu},t}(it);var Go=new Vt(function(r){return r.complete()});function Zl(r){return r&&tt(r.schedule)}function tf(r){return r[r.length-1]}function Ho(r){return Zl(tf(r))?r.pop():void 0}function Bo(r,t){return typeof tf(r)=="number"?r.pop():t}var Wo=function(r){return r&&typeof r.length=="number"&&typeof r!="function"};function qo(r){return tt(r==null?void 0:r.then)}function $o(r){return tt(r[Mi])}function Qo(r){return Symbol.asyncIterator&&tt(r==null?void 0:r[Symbol.asyncIterator])}function Ko(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function cT(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Yo=cT();function Xo(r){return tt(r==null?void 0:r[Yo])}function Jo(r){return Hl(this,arguments,function(){var e,n,s,a;return ko(this,function(h){switch(h.label){case 0:e=r.getReader(),h.label=1;case 1:h.trys.push([1,,9,10]),h.label=2;case 2:return[4,ii(e.read())];case 3:return n=h.sent(),s=n.value,a=n.done,a?[4,ii(void 0)]:[3,5];case 4:return[2,h.sent()];case 5:return[4,ii(s)];case 6:return[4,h.sent()];case 7:return h.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function Zo(r){return tt(r==null?void 0:r.getReader)}function le(r){if(r instanceof Vt)return r;if(r!=null){if($o(r))return lT(r);if(Wo(r))return fT(r);if(qo(r))return pT(r);if(Qo(r))return ef(r);if(Xo(r))return dT(r);if(Zo(r))return mT(r)}throw Ko(r)}function lT(r){return new Vt(function(t){var e=r[Mi]();if(tt(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function fT(r){return new Vt(function(t){for(var e=0;e{let a=this.tilePosInDirection(new D(n,s),t);return this.tilemap.hasBlockingTile(a,e,jl(t),this.ignoreMissingTiles)})}isCharBlocking(t,e){return this.someCharTile((n,s)=>{let a=this.tilePosInDirection(new D(n,s),t);return this.tilemap.hasBlockingChar(a,e,this.getCollisionGroups(),new Set([this.getId()]))})}isMoving(){return this.movementDirection!="none"}turnTowards(t){this.isMoving()||t!="none"&&this.changeFacingDirection(t)}changeFacingDirection(t){this.facingDirection!==t&&(this.facingDirection=t,this.directionChanged$.next(t))}getFacingDirection(){return this.facingDirection}getFacingPosition(){return this._tilePos.position.add(Be(this.facingDirection))}addCollisionGroup(t){this.collisionGroups.add(t)}setCollisionGroups(t){this.collisionGroups=new Set(t)}getCollisionGroups(){return Array.from(this.collisionGroups)}hasCollisionGroup(t){return this.collisionGroups.has(t)}removeCollisionGroup(t){this.collisionGroups.delete(t)}removeAllCollisionGroups(){this.collisionGroups.clear()}addLabels(t){for(let e of t)this.labels.add(e)}getLabels(){return[...this.labels.values()]}hasLabel(t){return this.labels.has(t)}clearLabels(){this.labels.clear()}removeLabels(t){for(let e of t)this.labels.delete(e)}getNumberOfDirections(){return this.numberOfDirections}movementStarted(){return this.movementStarted$}movementStopped(){return this.movementStopped$}directionChanged(){return this.directionChanged$}tilePositionSet(){return this.tilePositionSet$}positionChangeStarted(){return this.positionChangeStarted$}positionChangeFinished(){return this.positionChangeFinished$}autoMovementSet(){return this.autoMovementSet$}depthChanged(){return this.depthChanged$}getMovementProgress(){return this.movementProgress}hasWalkedHalfATile(){return this.movementProgress>oi/2}willCrossTileBorderThisUpdate(t){return this.movementProgress+this.maxProgressForDelta(t)>=oi}updateCharacterPosition(t){let e=this.willCrossTileBorderThisUpdate(t),s=1-(e?oi-this.movementProgress:this.maxProgressForDelta(t))/this.maxProgressForDelta(t);this.movementProgress=Math.min(this.movementProgress+this.maxProgressForDelta(t),oi),e&&(this.movementProgress=0,this.shouldContinueMoving()?(this.fire(this.positionChangeFinished$,this.tilePos,this.getNextTilePos()),this.tilePos=this.getNextTilePos(),this.startMoving(this.lastMovementImpulse),s>0&&this.updateCharacterPosition(t*s)):this.stopMoving())}maxProgressForDelta(t){let n=t/1e3;return Math.floor(n*this.speed*oi)}get tilePos(){return G.clone(this._tilePos)}set tilePos(t){G.copyOver(t,this._tilePos)}startMoving(t){t!=="none"&&(t!=this.movementDirection&&this.movementStarted$.next(t),this.movementDirection=t,this.facingDirection=t,this.fire(this.positionChangeStarted$,this.tilePos,this.getNextTilePos()))}tilePosInDirection(t,e){return t.add(Be(this.tilemap.toMapDirection(e)))}shouldContinueMoving(){return this.lastMovementImpulse!=="none"&&!this.isBlockingDirection(this.lastMovementImpulse)}stopMoving(){if(this.movementDirection==="none")return;let t=this.tilePos,e=this.getNextTilePos(),n=this.movementDirection;this.tilePos=this.getNextTilePos(),this.movementDirection="none",this.movementStopped$.next(n),this.fire(this.positionChangeFinished$,t,e)}fire(t,{position:e,layer:n},{position:s,layer:a}){t.next({exitTile:e,enterTile:s,exitLayer:n,enterLayer:a})}someCharTile(t){let e=this.getNextTilePos().position;for(let n=e.x;nh===this.charData.id)).subscribe(({direction:h})=>{var l;(l=this.animation)==null||l.setStandingFrame(h)}),this.sprite&&(this.sprite.setOrigin(0,0),this.resetAnimation(this.sprite),this.updateOverlaySprite(),this.updateGridChar())}destroy(){this.destroy$.next(),this.destroy$.complete(),this.newSpriteSet$.complete()}setSprite(t){t?(this.sprite&&(t.x=this.sprite.x,t.y=this.sprite.y),this.sprite=t,this.newSpriteSet$.next(),this.layerOverlaySprite=this.layerOverlaySprite?this.scene.add.sprite(0,0,this.sprite.texture):void 0,this.updateOverlaySprite(),this.resetAnimation(this.sprite),this.updateDepth()):(this.layerOverlaySprite=void 0,this.sprite=void 0)}getSprite(){return this.sprite}getLayerOverlaySprite(){return this.layerOverlaySprite}setContainer(t){this.container=t}getContainer(){return this.container}getOffsetX(){return this.customOffset.x}setOffsetX(t){this.customOffset.x=t}getOffsetY(){return this.customOffset.y}setOffsetY(t){this.customOffset.y=t}getWalkingAnimationMapping(){return this.walkingAnimationMapping}turnTowards(t){var e;this.geHeadless.isMoving(this.charData.id)||t!="none"&&(this.geHeadless.turnTowards(this.charData.id,t),(e=this.animation)==null||e.setStandingFrame(t))}getAnimation(){return this.animation}setAnimation(t){this.animation=t}update(t){this.updateGridChar()}getEngineOffset(){var n,s,a,h;if(!this.sprite)return D.ZERO;let t=this.tilemap.getTileWidth()/2-Math.floor(((s=(n=this.sprite)==null?void 0:n.displayWidth)!=null?s:0)/2),e=-((h=(a=this.sprite)==null?void 0:a.displayHeight)!=null?h:0)+this.tilemap.getTileHeight();return new D(t,e)}updatePixelPos(){let t=new D(this.geHeadless.getPosition(this.charData.id)),e=this.geHeadless.getMovementProgress(this.charData.id)/1e3,s=this.tilemap.tilePosToPixelPos(t).add(this.getEngineOffset()).add(this.customOffset).add(Be(this.geHeadless.getFacingDirection(this.charData.id)).multiply(this.tilemap.getTileDistance(this.geHeadless.getFacingDirection(this.charData.id)).scalarMult(e))),a=this.getGameObj();a&&(a.x=Math.floor(s.x),a.y=Math.floor(s.y))}getGameObj(){return this.container||this.sprite}updateGridChar(){var t;if(this.updatePixelPos(),this.sprite&&this.geHeadless.isMoving(this.charData.id)){let e=this.geHeadless.getMovementProgress(this.charData.id)>oi/2;(t=this.getAnimation())==null||t.updateCharacterFrame(this.geHeadless.getFacingDirection(this.charData.id),e,Number(this.sprite.frame.name))}this.updateDepth()}resetAnimation(t){let e=new xn(this.walkingAnimationMapping,t.texture.source[0].width/t.width/xn.FRAMES_CHAR_ROW);this.setAnimation(e),e.frameChange().pipe(Mt(this.newSpriteSet$)).subscribe(n=>{t==null||t.setFrame(n)}),e.setIsEnabled(this.walkingAnimationMapping!==void 0),e.setStandingFrame(this.geHeadless.getFacingDirection(this.charData.id))}updateOverlaySprite(){if(!this.layerOverlaySprite||!this.sprite)return;this.layerOverlaySprite.scale=this.sprite.scale;let t=this.tilemap.getTileHeight()/this.layerOverlaySprite.scale;this.layerOverlaySprite.setCrop(0,0,this.layerOverlaySprite.displayWidth,this.sprite.height-t),this.layerOverlaySprite.setOrigin(0,0)}updateDepth(){let t=this.getGameObj();if(!t)return;let e=new D(this.geHeadless.getPosition(this.charData.id)),n=this.geHeadless.getCharLayer(this.charData.id);this.setDepth(t,{position:e,layer:n});let s=this.getLayerOverlaySprite();if(s){let a=new D(He(ot({},e),{y:e.y-1}));this.setDepth(s,{position:a,layer:n})}}setDepth(t,e){t.setDepth(this.tilemap.getDepthOfCharLayer(this.getTransitionLayer(e))+this.getPaddedPixelDepth(t))}getPaddedPixelDepth(t){return Ii.shiftPad(t.y+t.displayHeight,7)}getTransitionLayer(t){if(t.layer)return this.geHeadless.getTransition(t.position,t.layer)||t.layer}};var ki=(n=>(n.STOP="STOP",n.CLOSEST_REACHABLE="CLOSEST_REACHABLE",n.RETRY="RETRY",n))(ki||{});var xt=class r{static vec2str(t){return`${t.x}#${t.y}`}static equal(t,e){return r.vec2str(t)==r.vec2str(e)}static manhattanDistance(t,e){let n=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return n+s}static chebyshevDistance(t,e){let n=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return Math.max(n,s)}static scalarMult(t,e){return t.clone().multiply(new D(e,e))}};var as=class{distance(t,e){return xt.manhattanDistance(t,e)}direction(t,e){if(xt.equal(t,e))return"none";let n=t.clone().subtract(e);return Math.abs(n.x)>Math.abs(n.y)?n.x>0?"left":"right":n.y>0?"up":"down"}neighbors(t){return[new D(t.x,t.y+1),new D(t.x+1,t.y),new D(t.x-1,t.y),new D(t.x,t.y-1)]}getDirections(){return["up","right","down","left"]}};var us=class{distance(t,e){return xt.chebyshevDistance(t,e)}neighbors(t){let e=[new D(t.x,t.y+1),new D(t.x+1,t.y),new D(t.x-1,t.y),new D(t.x,t.y-1)],n=[new D(t.x+1,t.y+1),new D(t.x+1,t.y-1),new D(t.x-1,t.y+1),new D(t.x-1,t.y-1)];return[...e,...n]}direction(t,e){return e.x>t.x?e.y>t.y?"down-right":e.yt.y?"down-left":e.yt.y?"down":"none"}getDirections(){return["up","right","down","left","down-left","down-right","up-right","up-left"]}};var ie=class{static create(t){switch(t){case 4:return new as;case 8:return new us}}};var Sn=class{constructor(t,e,n){this.backoffMs=t;this.maxRetries=e;this.onFinished=n;this.retries=0;this.elapsed=0}retry(t,e){this.shouldRetry()?(this.elapsed+=t,this.elapsed>=this.backoffMs&&(this.elapsed=0,this.retries++,e())):this.onFinished()}reset(){this.retries=0,this.elapsed=0}getMaxRetries(){return this.maxRetries}getBackoffMs(){return this.backoffMs}shouldRetry(){return this.maxRetries===-1||this.retries(n.WAIT="WAIT",n.RETRY="RETRY",n.STOP="STOP",n))(Cn||{});var nr=class{constructor(t,{shortestPathAlgorithm:e="BFS",pathWidth:n=1,pathHeight:s=1,numberOfDirections:a=4,isPositionAllowed:h=(F,H)=>!0,collisionGroups:l=[],ignoredChars:p=[],ignoreTiles:m=!1,ignoreMapBounds:y=!1,ignoreBlockedTarget:b=!1,maxPathLength:x=1/0,ignoreLayers:C=!1,considerCosts:O=!1,calculateClosestToTarget:I=!0}={}){this.gridTilemap=t;this.options={shortestPathAlgorithm:e,pathWidth:n,pathHeight:s,numberOfDirections:a,isPositionAllowed:h,collisionGroups:l,ignoredChars:p,ignoreTiles:m,ignoreMapBounds:y,ignoreBlockedTarget:b,maxPathLength:x,ignoreLayers:C,considerCosts:O,calculateClosestToTarget:I}}findShortestPath(t,e){this.options.ignoreLayers&&(this.gridTilemap.fixCacheLayer(t.layer),e.layer=t.layer);let n=this.findShortestPathImpl(t,e);return this.gridTilemap.unfixCacheLayers(),n}getNeighbors(t,e){var h;return ie.create((h=this.options.numberOfDirections)!=null?h:4).neighbors(t.position).map(l=>{let p=t.layer;return this.options.ignoreLayers||(p=this.gridTilemap.getTransition(l,t.layer)),{position:l,layer:p||t.layer}}).filter(l=>!this.isBlocking(t,l)||this.options.ignoreBlockedTarget&&G.equal(l,e))}getTransition(t,e){if(!this.options.ignoreLayers)return this.gridTilemap.getTransition(t,e)}getCosts(t,e){if(!this.options.considerCosts)return 1;let n=re(e.position,t);return this.gridTilemap.getTileCosts(e,n)}isBlocking(t,e){return!(this.options.ignoreMapBounds||this.gridTilemap.isInRange(e.position))||!this.options.isPositionAllowed(e.position,e.layer)||!this.options.ignoreTiles&&this.hasBlockingTileFrom(t,e,this.options.pathWidth,this.options.pathHeight,this.options.ignoreMapBounds,this.gridTilemap)?!0:this.hasBlockingCharFrom(e,this.options.pathWidth,this.options.pathHeight,this.options.collisionGroups,this.options.ignoredChars,this.gridTilemap)}distance(t,e){return(this.options.numberOfDirections===4?xt.manhattanDistance:xt.chebyshevDistance)(t,e)}getTilePosInDir(t,e){return this.gridTilemap.getTilePosInDirection(t,e)}getReverseNeighbors(t,e){var l;let s=ie.create((l=this.options.numberOfDirections)!=null?l:4).neighbors(t.position),a;if(!this.options.ignoreLayers){let p=this.gridTilemap.getReverseTransitions(t.position,t.layer);a=p?[...p]:void 0}return s.map(p=>a?a.map(m=>({position:p,layer:m||t.layer})):[{position:p,layer:t.layer}]).flat().filter(p=>!this.isBlocking(p,t)||this.options.ignoreBlockedTarget&&G.equal(t,e))}hasBlockingCharFrom(t,e,n,s,a,h){for(let l=t.position.x;lEn(a,y)-En(a,b)),l=t,p=this.distance(t.position,e.position),m=0;for(h.push(t),s.set(G.toString(t),0),a.set(G.toString(t),this.distance(t.position,e.position));h.size>0;){let y=h.pop();if(!y)break;m++;let b=this.distance(y.position,e.position);if(bthis.options.maxPathLength)return{previous:new Map,closestToTarget:l,steps:m,maxPathLengthReached:!0};for(let x of this.getNeighbors(y,e)){let C=En(s,y)+this.getCosts(y.position,x),O=G.toString(x);(!s.has(O)||C0;){let m=a.dequeue();if(p++,!m)break;let{node:y,dist:b}=m;if(b>this.options.maxPathLength)return{previous:new Map,closestToTarget:h,steps:p,maxPathLengthReached:!0};let x=this.distance(y.position,e.position);if(xthis.lastDist)}step(t,e,n){var s;this.lastDist=n;for(let a of t){let h=G.toString(a);if(!this.visited.has(h)){this.previous.set(h,e),this.queue.enqueue({node:a,dist:n+1}),this.visited.set(h,n+1);let l=(s=this.otherBfs)==null?void 0:s.visited.get(h);l!==void 0&&l0,s.queue.size()>0);){let m=n.queue.dequeue();if(!m)break;let{node:y,dist:b}=m;if(b+1+(((p=s.queue.peek())==null?void 0:p.dist)||0)>this.options.maxPathLength)return{previous:n.previous,previous2:s.previous,closestToTarget:this.maybeClosestToTarget(h),steps:a,maxPathLengthReached:!0};let x=this.distance(y.position,e.position);if(xMn(this.f,h)-Mn(this.f,l)),this.openSet.push(e);let a=G.toString(e);for(this.g.set(a,0),this.f.set(a,this.distance(e.position,n.position)),this.maxFrontierSize=Math.max(this.maxFrontierSize,this.openSet.size);this.openSet.size>0;){let h=this.openSet.pop();if(!h)break;if(this.steps++,G.equal(h,n))return{previous:s,closestToTarget:n,steps:this.steps,maxPathLengthReached:!1};if(Mn(this.g,h)+1>this.options.maxPathLength)return{previous:new Map,closestToTarget:this.closestToTarget,steps:this.steps,maxPathLengthReached:!0};this.updateClosestToTarget(h,n);for(let l of this.getNeighborsInternal(h,s.get(G.toString(h)),n)){let p=G.toString(l.p),m=Mn(this.g,h)+l.dist;(!this.g.has(p)||m({p:l,dist:1}));let a=this.prune(n,e).map(l=>{let p=this.getTransition(l.position,e.layer);return{position:l.position,layer:p||e.layer}}),h=[];for(let l of a){let p=this.jump(e,l,s,1);p&&h.push(p)}return h}jump(e,n,s,a){let h=this.distanceUtils.direction(e.position,n.position);if(!(this.isBlocking(e,n)&&!(G.equal(n,s)&&this.options.ignoreBlockedTarget)))return G.equal(n,s)?{p:n,dist:a}:a>=this.maxJumpSize?{p:n,dist:a}:this.getTransition(n.position,e.layer)!==void 0?{p:n,dist:a}:au(h)?{p:n,dist:a}:this.getForced(e,n).length>0?{p:n,dist:a}:(this.updateClosestToTarget(n,s),this.jump(n,this.getTilePosInDir(n,re(e.position,n.position)),s,a+1))}getForced(e,n){let s=[],a=this.posInDir(n,this.distanceUtils.direction(n.position,e.position)),{topLeft:h,downLeft:l,top:p,bottom:m}=this.normalizedPositions(a,n),y=(x,C)=>this.isBlocking(x,C)||this.getTransition(C.position,C.layer)!==void 0,b=this.distanceUtils.direction(e.position,n.position);return Nl(b)&&((y(a,l)||y(l,m))&&!this.isBlocking(n,m)&&s.push(m),(y(a,h)||y(h,p))&&!this.isBlocking(n,p)&&s.push(p)),s}prune(e,n){let{right:s,top:a,bottom:h}=this.normalizedPositions(e,n),l=this.getForced(e,n),p=re(e.position,n.position);return au(p)?[s,a,h]:[s,...l]}normalizedPositions(e,n){var a,h,l,p,m,y,b;let s=re(e.position,n.position);return{topLeft:this.posInDir(n,((a=this.turnTimes.get("up-left"))==null?void 0:a.get(this.turnOrder[s]))||"up-left"),downLeft:this.posInDir(n,((h=this.turnTimes.get("down-left"))==null?void 0:h.get(this.turnOrder[s]))||"down-left"),downRight:this.posInDir(n,((l=this.turnTimes.get("down-right"))==null?void 0:l.get(this.turnOrder[s]))||"down-right"),topRight:this.posInDir(n,((p=this.turnTimes.get("up-right"))==null?void 0:p.get(this.turnOrder[s]))||"up-right"),top:this.posInDir(n,((m=this.turnTimes.get("up"))==null?void 0:m.get(this.turnOrder[s]))||"up"),bottom:this.posInDir(n,((y=this.turnTimes.get("down"))==null?void 0:y.get(this.turnOrder[s]))||"down"),right:this.posInDir(n,((b=this.turnTimes.get("right"))==null?void 0:b.get(this.turnOrder[s]))||"right")}}posInDir(e,n){return{position:e.position.add(Be(n)),layer:e.layer}}returnPath(e,n,s){let a=[],h=s;for(a.push(h);!G.equal(h,n);){let l=e.get(G.toString(h));if(!l)return[];this.distance(l.position,h.position)>1?this.fillPath(h,l,a):a.push(l),h=l}return a.reverse()}fillPath(e,n,s){let a=e;do{let h=re(a.position,n.position);a=this.getTilePosInDir(a,h),s.push(a)}while(!xt.equal(a.position,n.position))}};function Mn(r,t){var e;return(e=r.get(G.toString(t)))!=null?e:Number.MAX_VALUE}function vS(){let r=["right","down-right","down","down-left","left","up-left","up","up-right"],t=new Map;for(let e=0;eh!==this),fe(1)))).subscribe(({enterTile:h,enterLayer:l})=>{this.updateTarget(h,l)})}update(t){var e;(e=this.targetMovement)==null||e.update(t)}getInfo(){return{type:"Follow",config:{charToFollow:this.charToFollow.getId(),distance:this.options.distance,noPathFoundStrategy:this.options.noPathFoundStrategy,maxPathLength:this.options.maxPathLength,ignoreLayers:this.options.ignoreLayers}}}updateTarget(t,e){this.targetMovement=new $i(this.character,this.gridTilemap,{position:new D(t),layer:e},{distance:this.options.distance+1,config:{algorithm:this.options.shortestPathAlgorithm,noPathFoundStrategy:this.options.noPathFoundStrategy,maxPathLength:this.options.maxPathLength,ignoreLayers:this.options.ignoreLayers,considerCosts:this.options.considerCosts},ignoreBlockedTarget:!0})}};var In=class{static getRandomInt(t){return Math.floor(Math.random()*Math.floor(t))}};var _s=class{constructor(t,e=0,n=-1){this.character=t;this.delay=e;this.radius=n;this.stepSize=0;this.delayLeft=this.delay,this.initialRow=t.getNextTilePos().position.y,this.initialCol=t.getNextTilePos().position.x,this.randomizeStepSize(),this.stepsWalked=0,this.currentMovementDirection="none",this.character.positionChangeStarted().pipe(Mt(this.character.autoMovementSet().pipe(Bt(s=>s!==this),fe(1)))).subscribe(()=>{this.stepsWalked++}),this.distanceUtils=ie.create(t.getNumberOfDirections())}update(t){if(this.shouldContinueWalkingCurrentDirection())this.character.move(this.currentMovementDirection);else if(this.delayLeft-=t,this.delayLeft<=0){this.delayLeft=this.delay;let e=this.getFreeRandomDirection();this.stepsWalked=0,this.character.move(e),this.currentMovementDirection=e,this.randomizeStepSize()}}getInfo(){return{type:"Random",config:{delay:this.delay,radius:this.radius}}}shouldContinueWalkingCurrentDirection(){return this.stepsWalked!this.character.isBlockingDirection(e)).filter(e=>this.isWithinRadius(e))}isWithinRadius(t){return this.radius==-1?!0:this.getDist(t)<=this.radius}getDist(t){return this.distanceUtils.distance(this.character.getNextTilePos().position.add(Be(t)),new D(this.initialCol,this.initialRow))}getFreeRandomDirection(){let t=this.getFreeDirections();return t.length==0?"none":t[In.getRandomInt(t.length)]}randomizeStepSize(){this.stepSize=In.getRandomInt(this.radius)+1}};function Nd(r,t){return r.filter(e=>{var n,s,a,h,l,p;return(n=t.labels)!=null&&n.withAllLabels?(s=t.labels)==null?void 0:s.withAllLabels.every(m=>e.hasLabel(m)):(a=t.labels)!=null&&a.withOneOfLabels?(h=t.labels)==null?void 0:h.withOneOfLabels.some(m=>e.hasLabel(m)):(l=t.labels)!=null&&l.withNoneLabels?!((p=t.labels)!=null&&p.withNoneLabels.some(m=>e.hasLabel(m))):!0})}var Ls="2.36.0";var Es=class{constructor(t,e){this.collistionStrategy=t;this.collisionGroupRelation=e;this.tilePosToCharacters=new Map;this.charRemoved$=new it}isCharBlockingAt(t,e,n,s=new Set){if(n.length===0)return!1;let a=this.posToString(t,e),h=this.tilePosToCharacters.get(a);return!!(h&&h.size>0&&[...h].filter(l=>!s.has(l.getId())).some(l=>n.some(p=>l.getCollisionGroups().some(m=>this.collidesWith(p,m)))))}collidesWith(t,e){return this.collisionGroupRelation?(this.collisionGroupRelation.get(t)||new Set).has(e):t===e}getCharactersAt(t,e){let n=this.posToString(t,e),s=this.tilePosToCharacters.get(n);return new Set(s)}addCharacter(t){this.addTilePositions(t.getTilePos(),t),this.addTilePositions(t.getNextTilePos(),t),this.addPositionChangeSub(t),this.addPositionChangeFinishedSub(t),this.addTilePosSetSub(t)}removeCharacter(t){let e=t.getId();this.charRemoved$.next(e),this.deleteTilePositions(t.getTilePos(),t),this.deleteTilePositions(t.getNextTilePos(),t)}add(t,e){var n;this.tilePosToCharacters.has(t)||this.tilePosToCharacters.set(t,new Set),(n=this.tilePosToCharacters.get(t))==null||n.add(e)}addTilePosSetSub(t){t.tilePositionSet().pipe(Mt(this.charRemoved(t.getId()))).subscribe(e=>{this.deleteTilePositions(t.getNextTilePos(),t),this.addTilePositions(e,t)})}charRemoved(t){var e;return(e=this.charRemoved$)==null?void 0:e.pipe(fe(1),Bt(n=>n==t))}addPositionChangeSub(t){t.positionChangeStarted().pipe(Mt(this.charRemoved(t.getId())),this.posChangeToLayerPos()).subscribe(e=>{this.collistionStrategy==="BLOCK_ONE_TILE_AHEAD"&&this.deleteTilePositions(e.exit,t),this.addTilePositions(e.enter,t)})}addPositionChangeFinishedSub(t){t.positionChangeFinished().pipe(Mt(this.charRemoved(t.getId())),this.posChangeToLayerPos()).subscribe(e=>{this.deleteTilePositions(e.exit,t),this.addTilePositions(e.enter,t)})}addTilePositions(t,e){this.forEachCharTile(t,e,(n,s)=>{this.add(this.posToString(new D(n,s),t.layer),e)})}deleteTilePositions(t,e){this.forEachCharTile(t,e,(n,s)=>{var a;(a=this.tilePosToCharacters.get(this.posToString(new D(n,s),t.layer)))==null||a.delete(e)})}forEachCharTile(t,e,n){let s=t.position;for(let a=s.x;a({enter:{position:new D(t.enterTile),layer:t.enterLayer},exit:{position:new D(t.exitTile),layer:t.exitLayer}})))}posToString(t,e){return`${t.x}#${t.y}#${e}`}};var qr=class{constructor(t,e,n,s){this.x=t;this.y=e;this.width=n;this.height=s}getX(){return this.x}getY(){return this.y}getWidth(){return this.width}getHeight(){return this.height}isInRange(t){return t.x>=this.x&&t.x=this.y&&t.yn.isCharLayer());for(let n of[...e,void 0]){let s=this.tileCollisionCache.get(n==null?void 0:n.getName());if(s===void 0){s=new Array(this.tilemap.getWidth());for(let a=0;a>t&1)==1}var Gd="ge_cost",Ms=class Ms{constructor(t,e,n,s=void 0,a=!1){this.tilemap=t;this.collisionTilePropertyName=e;this.useTileCollisionCache=a;this.characters=new Map;this.transitions=new Map;this.reverseTransitions=new Map;this.collidesPropNames=new Map;this.tileCostPropNames=new Map;this.collisionRelevantLayersFrameCache=new Map;this.charBlockCache=new Es(n,s);for(let h of bn())this.collidesPropNames.set(h,Ms.ONE_WAY_COLLIDE_PROP_PREFIX+h),this.tileCostPropNames.set(h,`${Gd}_${h}`);this.useTileCollisionCache&&(this.tileCollisionCache=new Os(t,this),this.tileCollisionCache.rebuild())}fixCacheLayer(t){var e;(e=this.tileCollisionCache)==null||e.fixLayer(t)}unfixCacheLayers(){var t;(t=this.tileCollisionCache)==null||t.unfixLayers()}addCharacter(t){this.characters.set(t.getId(),t),t.getNextTilePos().layer===void 0&&t.setTilePosition(He(ot({},t.getNextTilePos()),{layer:this.getLowestCharLayer()})),this.charBlockCache.addCharacter(t)}removeCharacter(t){let e=this.characters.get(t);e&&(this.charBlockCache.removeCharacter(e),this.characters.delete(t))}getCharacters(){return[...this.characters.values()]}getCharactersAt(t,e){return this.charBlockCache.getCharactersAt(t,e)}rebuildTileCollisionCache(t){var e;(e=this.tileCollisionCache)==null||e.rebuild(t)}hasBlockingTileUncached(t,e,n,s){if(!s&&this.hasNoTileUncached(t,e))return!0;let a=this.getCollisionRelevantLayers(e);for(let h of a)if(this.isLayerBlockingAt(h.getName(),t,n))return!0;return!1}hasBlockingTile(t,e,n,s){var h;let a=(h=this.tileCollisionCache)==null?void 0:h.isBlockingFrom(t.x,t.y,e,n,s);return a!==void 0?a:this.hasBlockingTileUncached(t,e,n,s)}getTransition(t,e){let n=this.transitions.get(t.toString());if(n)return n.get(e)}getReverseTransitions(t,e){let n=this.reverseTransitions.get(t.toString());if(n)return n.get(e)}setTransition(t,e,n){var s,a,h,l,p;this.transitions.has(t.toString())||this.transitions.set(t.toString(),new Map),this.reverseTransitions.has(t.toString())||this.reverseTransitions.set(t.toString(),new Map),(s=this.transitions.get(t.toString()))==null||s.set(e,n),(a=this.reverseTransitions.get(t.toString()))!=null&&a.has(n)||(h=this.reverseTransitions.get(t.toString()))==null||h.set(n,new Set),(p=(l=this.reverseTransitions.get(t.toString()))==null?void 0:l.get(n))==null||p.add(e)}getTransitions(){return new Map([...this.transitions].map(([t,e])=>[t,new Map(e)]))}getTileCosts(t,e){let n=this.getCollisionRelevantLayers(t.layer),s=1;for(let a of n)s=Math.max(s,this.getTileCostsForLayer(He(ot({},t),{layer:a.getName()}),e));return s}getTileCostsForLayer(t,e){let n=this.tilemap.getTileAt(t.position.x,t.position.y,t.layer);return e&&(n==null?void 0:n.getProperty(this.tileCostPropNames.get(e)||""))||(n==null?void 0:n.getProperty(Gd))||1}hasNoTileUncached(t,e){return!this.getCollisionRelevantLayers(e).some(s=>this.tilemap.hasTileAt(t.x,t.y,s.getName()))}hasNoTile(t,e){var s;let n=(s=this.tileCollisionCache)==null?void 0:s.hasTileAt(t.x,t.y,e);return n!==void 0?n:this.hasNoTileUncached(t,e)}hasBlockingChar(t,e,n,s=new Set){return this.charBlockCache.isCharBlockingAt(t,e,n,s)}isInRange(t){return new qr(0,0,this.tilemap.getWidth(),this.tilemap.getHeight()).isInRange(t)}toMapDirection(t){return this.isIsometric()?Ul(t):t}fromMapDirection(t){return this.isIsometric()?Io(t):t}isIsometric(){return this.tilemap.getOrientation()==="isometric"}getTilePosInDirection(t,e){let n=t.position.add(Be(this.toMapDirection(e))),s=this.getTransition(n,t.layer)||t.layer;return{position:n,layer:s}}invalidateFrameCache(){this.collisionRelevantLayersFrameCache.clear()}isLayerBlockingAt(t,e,n){let s=this.tilemap.getTileAt(e.x,e.y,t);return s?!!(s.getProperty(this.collisionTilePropertyName)||n&&s.getProperty(this.collidesPropNames.get(n)||"")):!1}getCharLayerIndexes(){return this.tilemap.getLayers().map((t,e)=>({layer:t,index:e})).filter(({layer:t})=>t.isCharLayer()).map(({index:t})=>t)}findPrevAndCharLayer(t){let e=this.getCharLayerIndexes(),n=this.tilemap.getLayers(),s=e.findIndex(a=>n[a].getProperty(kn)==t);return s==0?{prevIndex:-1,charLayerIndex:e[s]}:{prevIndex:e[s-1],charLayerIndex:e[s]}}getCollisionRelevantLayers(t){if(!t)return this.tilemap.getLayers();let e=this.collisionRelevantLayersFrameCache.get(t);if(e)return e;let{prevIndex:n,charLayerIndex:s}=this.findPrevAndCharLayer(t),a=this.tilemap.getLayers().slice(n+1,s+1);return this.collisionRelevantLayersFrameCache.set(t,a),a}getLowestCharLayer(){for(let t of this.tilemap.getLayers())if(t.isCharLayer())return t.getProperty(kn)}};Ms.ONE_WAY_COLLIDE_PROP_PREFIX="ge_collide_";var Ds=Ms;var Is=class{constructor(t,e){this.character=t;this.tilemap=e;this.queue=new Lr;this.finished$=new it;this.pathBlockedWaitElapsed=0;this.distanceUtils=ie.create(t.getNumberOfDirections()),this.character.autoMovementSet().pipe(Bt(n=>n!==this),fe(1)).subscribe(()=>{this.queue.size()>0&&this.finishMovementTerminated(),this.finished$.complete()})}update(t){(!this.character.isMoving()||this.character.willCrossTileBorderThisUpdate(t))&&this.queue.size()>0&&this.moveCharOnPath(t)}getInfo(){return{type:"Queue"}}enqueue(t,e={}){var s,a,h;let n={pathBlockedStrategy:(s=e.pathBlockedStrategy)!=null?s:"STOP",pathBlockedWaitTimeoutMs:(e==null?void 0:e.pathBlockedWaitTimeoutMs)||-1,ignoreInvalidPositions:(a=e.ignoreInvalidPositions)!=null?a:!1,skipInvalidPositions:(h=e.skipInvalidPositions)!=null?h:!1};for(let l of t){let p={command:l,config:n};if(Ur(l)){this.queue.enqueue(p);continue}let m=this.queue.peekEnd(),y=m==null?void 0:m.command;if(y||(y=this.character.getNextTilePos()),Ur(y)){this.queue.enqueue(p);continue}let b=this.distanceUtils.distance(y.position,l.position)===1;(!e.ignoreInvalidPositions||b)&&this.queue.enqueue(p)}}peekAll(){return this.queue.peekAll()}size(){return this.queue.size()}finished(){return this.finished$}clear(){this.queue.clear()}moveCharOnPath(t){let e=this.queue.peek();if(!e)return;let n=e.command,s=e.config;if(Ur(n)&&(n=this.tilemap.getTilePosInDirection(this.character.getNextTilePos(),n)),s.skipInvalidPositions){if(n=this.getNextValidPosition(),!n){this.finishInvalidNextPos(n);return}}else if(!this.isNeighborPos(n)){this.finishInvalidNextPos(n);return}if(this.character.isBlockingDirection(re(this.character.getNextTilePos().position,n.position))){if(s.pathBlockedStrategy==="STOP")this.finishPathBlocked(n);else if(s.pathBlockedStrategy==="SKIP"){this.queue.dequeue(),this.moveCharOnPath(t);return}else s.pathBlockedStrategy==="WAIT"&&s.pathBlockedWaitTimeoutMs>-1&&(this.pathBlockedWaitElapsed+=t,this.pathBlockedWaitElapsed>=s.pathBlockedWaitTimeoutMs&&this.finishBlockedWaitTimeout(n,s.pathBlockedWaitTimeoutMs));return}this.pathBlockedWaitElapsed=0,this.queue.dequeue(),this.character.move(this.getDir(this.character.getNextTilePos().position,n.position)),this.isLastMovement()&&this.finish("SUCCESS","",n)}getNextValidPosition(){var t;for(;this.queue.size()>0;){let e=(t=this.queue.peek())==null?void 0:t.command;if(Ur(e)&&(e=this.tilemap.getTilePosInDirection(this.character.getNextTilePos(),e)),e&&this.isNeighborPos(e))return e;this.queue.dequeue()}}isLastMovement(){return this.queue.size()===0}isNeighborPos(t){let e=this.distanceUtils.distance(this.character.getNextTilePos().position,t.position)===1,n=this.tilemap.getTransition(t.position,this.character.getNextTilePos().layer);if(this.character.getNextTilePos().layer!==t.layer)return e&&n===t.layer;let s=n!==void 0&&n!==t.layer;return e&&!s}finishMovementTerminated(){this.finish("MOVEMENT_TERMINATED","New automatic movement has been set to character.")}finishInvalidNextPos(t){t?this.finish("INVALID_NEXT_POS",`Position ${this.posToStr(t)} is not reachable from ${this.posToStr(this.character.getNextTilePos())}.`):this.finish("INVALID_NEXT_POS",`No enqueued position is reachable from ${this.posToStr(this.character.getNextTilePos())}.`)}finishPathBlocked(t){this.finish("PATH_BLOCKED",`Position ${this.posToStr(t)} is blocked.`)}finishBlockedWaitTimeout(t,e){this.finish("PATH_BLOCKED_WAIT_TIMEOUT",`Position ${this.posToStr(t)} is blocked and the wait timeout of ${e} ms has been exceeded.`)}finish(t,e="",n=this.character.getNextTilePos()){this.queue=new Lr,this.finished$.next({position:n.position,result:t,description:e,layer:n.layer})}getDir(t,e){return this.tilemap.fromMapDirection(re(t,e))}posToStr(t){return`(${t.position.x}, ${t.position.y}, ${t.layer})`}};var ks=class{constructor(t=!0){this.isCreatedInternal=!1;t&&console.log(`Using GridEngine v${Ls}`)}getCharLayer(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getTilePos().layer}getTransition(t,e){var n;return this.initGuard(),(n=this.gridTilemap)==null?void 0:n.getTransition(new D(t),e)}setTransition(t,e,n){var s;return this.initGuard(),(s=this.gridTilemap)==null?void 0:s.setTransition(new D(t),e,n)}create(t,e){this.isCreatedInternal=!0,this.gridCharacters=new Map;let n=this.setConfigDefaults(e);this.config=n,this.movementStopped$=new it,this.movementStarted$=new it,this.directionChanged$=new it,this.positionChangeStarted$=new it,this.positionChangeFinished$=new it,this.queueMovementFinished$=new it,this.charRemoved$=new it,this.charAdded$=new it,this.gridTilemap=new Ds(t,this.config.collisionTilePropertyName,this.config.characterCollisionStrategy,this.recordToMap(this.config.collisionGroupRelation),this.config.cacheTileCollisions),this.addCharacters()}recordToMap(t){return t?new Map(Object.entries(t).map(([n,s])=>[n,new Set(s)])):void 0}getPosition(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getTilePos().position}move(t,e){this.moveChar(t,e)}moveRandomly(t,e=0,n=-1){var h;this.initGuard();let s=(h=this.gridCharacters)==null?void 0:h.get(t);if(!s)throw this.createCharUnknownErr(t);let a=new _s(s,e,n);s.setMovement(a)}getMovement(t){var s;this.initGuard();let e=(s=this.gridCharacters)==null?void 0:s.get(t);if(!e)throw this.createCharUnknownErr(t);let n=e.getMovement();return n?n.getInfo():{type:"None"}}moveTo(t,e,n){var l;let s=this.assembleMoveToConfig(n);this.initGuard();let a=(l=this.gridCharacters)==null?void 0:l.get(t);if(!a)throw this.createCharUnknownErr(t);if(!this.gridTilemap)throw this.createUninitializedErr();let h=new $i(a,this.gridTilemap,{position:new D(e),layer:(n==null?void 0:n.targetLayer)||a.getNextTilePos().layer},{distance:0,config:s});return a.setMovement(h),h.finishedObs().pipe(ir(p=>({charId:t,position:p.position,result:p.result,description:p.description,layer:p.layer})))}stopMovement(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);e.setMovement(void 0)}setSpeed(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.setSpeed(e)}getSpeed(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getSpeed()}collidesWithTiles(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.collidesWithTiles()}update(t,e){var n;if(this.isCreatedInternal&&this.gridCharacters)for(let[s,a]of this.gridCharacters)a.update(e);(n=this.gridTilemap)==null||n.invalidateFrameCache()}addCharacter(t){var a,h,l,p,m;if(!this.gridTilemap)throw this.createUninitializedErr();if(!this.config)throw this.createUninitializedErr();let e={speed:t.speed||4,tilemap:this.gridTilemap,collidesWithTiles:!0,collisionGroups:["geDefault"],charLayer:t.charLayer,facingDirection:t.facingDirection,labels:t.labels,numberOfDirections:(a=t.numberOfDirections)!=null?a:this.config.numberOfDirections,tileWidth:t.tileWidth,tileHeight:t.tileHeight};typeof t.collides=="boolean"?t.collides===!1&&(e.collidesWithTiles=!1,e.collisionGroups=[]):t.collides!==void 0&&(t.collides.collidesWithTiles===!1&&(e.collidesWithTiles=!1),t.collides.collisionGroups&&(e.collisionGroups=t.collides.collisionGroups),e.ignoreMissingTiles=(l=(h=t.collides)==null?void 0:h.ignoreMissingTiles)!=null?l:!1);let n=new os(t.id,e);t.startPosition&&n.setTilePosition({position:new D(t.startPosition),layer:n.getTilePos().layer}),(p=this.gridCharacters)==null||p.set(t.id,n),this.gridTilemap.addCharacter(n);let s=n.getId();n.movementStopped().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.movementStopped$)==null||b.next({charId:s,direction:y})}),n.movementStarted().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.movementStarted$)==null||b.next({charId:s,direction:y})}),n.directionChanged().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.directionChanged$)==null||b.next({charId:s,direction:y})}),n.positionChangeStarted().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.positionChangeStarted$)==null||b.next(ot({charId:s},y))}),n.positionChangeFinished().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.positionChangeFinished$)==null||b.next(ot({charId:s},y))}),(m=this.charAdded$)==null||m.next(s)}hasCharacter(t){var e;return this.initGuard(),!!((e=this.gridCharacters)!=null&&e.has(t))}removeCharacter(t){var n,s,a,h;if(this.initGuard(),!((n=this.gridCharacters)==null?void 0:n.get(t)))throw this.createCharUnknownErr(t);(s=this.gridTilemap)==null||s.removeCharacter(t),(a=this.gridCharacters)==null||a.delete(t),(h=this.charRemoved$)==null||h.next(t)}removeAllCharacters(){if(this.initGuard(),!!this.gridCharacters)for(let t of this.gridCharacters.keys())this.removeCharacter(t)}getAllCharacters(t){if(this.initGuard(),!this.gridCharacters)return[];let e=[...this.gridCharacters.values()];return(t?Nd(e,t):e).map(s=>s.getId())}getLabels(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getLabels()}addLabels(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.addLabels(e)}removeLabels(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.removeLabels(e)}clearLabels(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);e.clearLabels()}follow(t,e,n,s){var m,y,b,x;let a;n===void 0?a={distance:0,closestPointIfBlocked:!1}:typeof n=="number"?(a={distance:n,closestPointIfBlocked:!1},s&&(a.closestPointIfBlocked=!0)):a=n,this.initGuard();let h=(m=this.gridCharacters)==null?void 0:m.get(t),l=(y=this.gridCharacters)==null?void 0:y.get(e);if(!h)throw this.createCharUnknownErr(t);if(!l)throw this.createCharUnknownErr(e);if(!this.gridTilemap)throw this.createUninitializedErr();let p=new Cs(h,this.gridTilemap,l,{distance:a.distance,noPathFoundStrategy:a.closestPointIfBlocked?"CLOSEST_REACHABLE":"STOP",maxPathLength:(b=a.maxPathLength)!=null?b:1/0,shortestPathAlgorithm:(x=a.algorithm)!=null?x:"BIDIRECTIONAL_SEARCH",ignoreLayers:!!a.ignoreLayers});h.setMovement(p)}isMoving(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.isMoving()}getFacingDirection(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getFacingDirection()}getFacingPosition(t){var s;this.initGuard();let e=(s=this.gridCharacters)==null?void 0:s.get(t);if(!e)throw this.createCharUnknownErr(t);let n=e.getFacingPosition();return{x:n.x,y:n.y}}turnTowards(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);return n.turnTowards(e)}getCharactersAt(t,e){if(this.initGuard(),!this.gridTilemap)return[];let n=this.gridTilemap.getCharactersAt(new D(t),e);return Array.from(n).map(s=>s.getId())}setPosition(t,e,n){var a;this.initGuard();let s=(a=this.gridCharacters)==null?void 0:a.get(t);if(!s)throw this.createCharUnknownErr(t);n||s.setTilePosition({position:new D(e),layer:s.getTilePos().layer}),s.setTilePosition({position:new D(e),layer:n})}isBlocked(t,e,n=["geDefault"]){var a,h;this.initGuard();let s=new D(t);return!!((a=this.gridTilemap)!=null&&a.hasBlockingTile(s,e)||(h=this.gridTilemap)!=null&&h.hasBlockingChar(s,e,n))}isTileBlocked(t,e){var n;return this.initGuard(),!!((n=this.gridTilemap)!=null&&n.hasBlockingTile(new D(t),e))}getCollisionGroups(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getCollisionGroups()||[]}setCollisionGroups(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.setCollisionGroups(e)}getTilePosInDirection(t,e,n){if(!this.gridTilemap)throw this.createUninitializedErr();let s=this.gridTilemap.getTilePosInDirection({position:new D(t),layer:e},n);return{position:s.position.toPosition(),charLayer:s.layer}}findShortestPath(t,e,n={}){if(!this.gridTilemap)throw this.createUninitializedErr();let s=n.shortestPathAlgorithm||"BFS";n.considerCosts&&s!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${s}'. It can only be used with A* algorithm.`);let h=new Qi(this.gridTilemap).findShortestPath(G.toInternal(t),G.toInternal(e),He(ot({},n),{shortestPathAlgorithm:s}));return{path:h.path.map(G.fromInternal),closestToTarget:h.closestToTarget?G.fromInternal(h.closestToTarget):void 0,reachedMaxPathLength:!1,steps:h.steps}}steppedOn(t,e,n){return this.positionChangeFinished().pipe(Bt(s=>t.includes(s.charId)&&e.some(a=>a.x===s.enterTile.x&&a.y===s.enterTile.y)&&(n===void 0||n.includes(s.enterLayer))))}characterShifted(){if(!this.charAdded$||!this.charRemoved$)throw this.createUninitializedErr();return this.charAdded$.pipe(ir(t=>({charId:t,action:"ADDED"})),yu(this.charRemoved$.pipe(ir(t=>({charId:t,action:"REMOVED"})))))}movementStarted(){if(!this.movementStarted$)throw this.createUninitializedErr();return this.movementStarted$}movementStopped(){if(!this.movementStopped$)throw this.createUninitializedErr();return this.movementStopped$}directionChanged(){if(!this.directionChanged$)throw this.createUninitializedErr();return this.directionChanged$}positionChangeStarted(){if(!this.positionChangeStarted$)throw this.createUninitializedErr();return this.positionChangeStarted$}positionChangeFinished(){if(!this.positionChangeFinished$)throw this.createUninitializedErr();return this.positionChangeFinished$}getMovementProgress(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getMovementProgress()}rebuildTileCollisionCache(t,e,n,s){var a;(a=this.gridTilemap)==null||a.rebuildTileCollisionCache(new qr(t,e,n,s))}addQueueMovements(t,e,n){var h,l;this.initGuard();let s=(h=this.gridCharacters)==null?void 0:h.get(t);if(!s)throw this.createCharUnknownErr(t);if(!this.gridTilemap)throw this.createUninitializedErr();let a;((l=s==null?void 0:s.getMovement())==null?void 0:l.getInfo().type)==="Queue"?a=s.getMovement():(a=new Is(s,this.gridTilemap),s.setMovement(a),a.finished().pipe(Mt(gu(this.charRemoved(t),s.autoMovementSet()))).subscribe(p=>{var m;(m=this.queueMovementFinished$)==null||m.next(ot({charId:t},p))})),a.enqueue(e.map(p=>Ur(p)?p:{position:new D(p.position),layer:p.charLayer}),n)}queueMovementFinished(){if(!this.queueMovementFinished$)throw this.createUninitializedErr();return this.queueMovementFinished$}getEnqueuedMovements(t){var n,s;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return((s=e.getMovement())==null?void 0:s.getInfo().type)==="Queue"?e.getMovement().peekAll().map(h=>({command:Ur(h.command)?h.command:G.fromInternal(h.command),config:h.config})):[]}clearEnqueuedMovements(t){var n,s;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);((s=e.getMovement())==null?void 0:s.getInfo().type)==="Queue"&&e.getMovement().clear()}getTileCost(t,e,n){var s,a;return this.initGuard(),(a=(s=this.gridTilemap)==null?void 0:s.getTileCosts({position:new D(t),layer:e},n))!=null?a:1}charRemoved(t){var e;if(!this.charRemoved$)throw this.createUninitializedErr();return(e=this.charRemoved$)==null?void 0:e.pipe(fe(1),Bt(n=>n==t))}initGuard(){if(!this.isCreatedInternal)throw this.createUninitializedErr()}createUninitializedErr(){throw new Error("GridEngine not initialized. You need to call create() first.")}addCharacters(){var t;(t=this.config)==null||t.characters.forEach(e=>this.addCharacter(e))}moveChar(t,e){var s,a,h;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);if(n.getNumberOfDirections()===4){if(!((a=this.gridTilemap)!=null&&a.isIsometric())&&Ei(e)){console.warn(`GridEngine: Character '${t}' can't be moved '${e}' in 4 direction mode.`);return}else if((h=this.gridTilemap)!=null&&h.isIsometric()&&!Ei(e)){console.warn(`GridEngine: Character '${t}' can't be moved '${e}' in 4 direction isometric mode.`);return}}n.move(e)}createCharUnknownErr(t){return new Error(`Character unknown: ${t}`)}assembleMoveToConfig(t={}){let e=He(ot({},t),{noPathFoundStrategy:"STOP",pathBlockedStrategy:"WAIT"});return t!=null&&t.noPathFoundStrategy&&(Object.values(ki).includes(t.noPathFoundStrategy)?e.noPathFoundStrategy=t.noPathFoundStrategy:console.warn(`GridEngine: Unknown NoPathFoundStrategy '${t.noPathFoundStrategy}'. Falling back to 'STOP'`)),t!=null&&t.pathBlockedStrategy&&(Object.values(Cn).includes(t.pathBlockedStrategy)?e.pathBlockedStrategy=t.pathBlockedStrategy:console.warn(`GridEngine: Unknown PathBlockedStrategy '${t.pathBlockedStrategy}'. Falling back to 'WAIT'`)),e}setConfigDefaults(t){return ot({collisionTilePropertyName:"ge_collide",numberOfDirections:4,characterCollisionStrategy:"BLOCK_TWO_TILES",cacheTileCollisions:!1},t)}};var Rs=class extends qi{constructor(t,e={}){super(t,e),this.distanceUtils=ie.create(8)}getForced(t,e){let n=[],s=this.posInDir(e,this.distanceUtils.direction(e.position,t.position)),{topLeft:a,downLeft:h,top:l,bottom:p,topRight:m,downRight:y}=this.normalizedPositions(s,e),b=this.distanceUtils.direction(t.position,e.position),x=(C,O)=>this.isBlocking(C,O)||this.getTransition(O.position,O.layer)!==void 0;return Ei(b)?(x(t,a)&&!this.isBlocking(e,l)&&n.push(l),x(t,a)&&(x(t,h)||x(h,a))&&!this.isBlocking(e,a)&&n.push(a),x(t,h)&&!this.isBlocking(e,p)&&n.push(p),x(t,h)&&(x(t,a)||x(a,h))&&!this.isBlocking(e,h)&&n.push(h)):(x(t,l)&&(x(t,a)||x(a,l))&&(this.isBlocking(e,a)||n.push(a),this.isBlocking(e,l)||n.push(l)),x(t,l)&&(x(t,a)||x(a,l)||x(l,m))&&!this.isBlocking(e,m)&&n.push(m),x(t,p)&&(x(t,h)||x(h,l))&&(this.isBlocking(e,h)||n.push(h),this.isBlocking(e,p)||n.push(p)),x(t,p)&&(x(t,h)||x(a,p)||x(l,y))&&!this.isBlocking(e,y)&&n.push(y)),n}prune(t,e){let{right:n,topRight:s,downRight:a}=this.normalizedPositions(t,e),h=this.getForced(t,e),l=re(t.position,e.position);return Ei(l)?[n,s,a,...h]:[n,...h]}jump(t,e,n,s){let a=this.distanceUtils.direction(t.position,e.position);if(!(this.isBlocking(t,e)&&!(G.equal(e,n)&&this.options.ignoreBlockedTarget))){if(G.equal(e,n))return{p:e,dist:s};if(s>=this.maxJumpSize)return{p:e,dist:s};if(this.getTransition(e.position,t.layer)!==void 0)return{p:e,dist:s};if(this.getForced(t,e).length>0)return{p:e,dist:s};if(this.updateClosestToTarget(e,n),a==="up-left"){if(this.jump(e,this.getTilePosInDir(e,"up"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"left"),n,s+1)!==void 0)return{p:e,dist:s}}else if(a==="down-left"){if(this.jump(e,this.getTilePosInDir(e,"down"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"left"),n,s+1)!==void 0)return{p:e,dist:s}}else if(a==="up-right"){if(this.jump(e,this.getTilePosInDir(e,"up"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"right"),n,s+1)!==void 0)return{p:e,dist:s}}else if(a==="down-right"){if(this.jump(e,this.getTilePosInDir(e,"down"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"right"),n,s+1)!==void 0)return{p:e,dist:s}}return this.jump(e,this.getTilePosInDir(e,re(t.position,e.position)),n,s+1)}}};var Qi=class{constructor(t){this.gridTilemap=t}findShortestPath(t,e,n={}){return xS(n.shortestPathAlgorithm||"BIDIRECTIONAL_SEARCH",this.gridTilemap,n).findShortestPath(t,e)}};function xS(r,t,e){switch(r){case"BIDIRECTIONAL_SEARCH":return new ds(t,e);case"A_STAR":return new ls(t,e);case"JPS":return e.numberOfDirections===8?new Rs(t,e):new qi(t,e)}return new Fi(t,e)}var $i=class{constructor(t,e,n,{config:s,ignoreBlockedTarget:a=!1,distance:h=0}={}){this.character=t;this.tilemap=e;this.targetPos=n;this.shortestPath=[];this.distOffset=0;this.posOnPath=0;this.stopped=!1;this.pathBlockedWaitElapsed=0;this.isPositionAllowed=()=>!0;this.shortestPathAlgorithm="BIDIRECTIONAL_SEARCH";this.maxPathLength=1/0;this.considerCosts=!1;this.isBlocking=(t,e)=>t?new Fi(this.tilemap,this.getPathfindingOptions()).isBlocking(this.character.getTilePos(),{position:t,layer:e}):!0;var l;this.shortestPathAlgorithm=(l=s==null?void 0:s.algorithm)!=null?l:this.shortestPathAlgorithm,this.ignoreBlockedTarget=a,this.distance=h,this.noPathFoundStrategy=(s==null?void 0:s.noPathFoundStrategy)||"STOP",this.pathBlockedStrategy=(s==null?void 0:s.pathBlockedStrategy)||"WAIT",this.noPathFoundRetryable=new Sn((s==null?void 0:s.noPathFoundRetryBackoffMs)||200,(s==null?void 0:s.noPathFoundMaxRetries)||-1,()=>{this.stop("NO_PATH_FOUND_MAX_RETRIES_EXCEEDED")}),this.pathBlockedRetryable=new Sn((s==null?void 0:s.pathBlockedRetryBackoffMs)||200,(s==null?void 0:s.pathBlockedMaxRetries)||-1,()=>{this.stop("PATH_BLOCKED_MAX_RETRIES_EXCEEDED")}),s!=null&&s.isPositionAllowedFn&&(this.isPositionAllowed=s.isPositionAllowedFn),s!=null&&s.maxPathLength&&(this.maxPathLength=s.maxPathLength),s!=null&&s.considerCosts&&this.shortestPathAlgorithm!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${this.shortestPathAlgorithm}'. It can only be used with A* algorithm.`),this.considerCosts=(s==null?void 0:s.considerCosts)||!1,this.ignoreLayers=!!(s!=null&&s.ignoreLayers),this.distanceUtils=ie.create(t.getNumberOfDirections()),this.pathBlockedWaitTimeoutMs=(s==null?void 0:s.pathBlockedWaitTimeoutMs)||-1,this.finished$=new it,this.setCharacter(t)}setPathBlockedStrategy(t){this.pathBlockedStrategy=t}getPathBlockedStrategy(){return this.pathBlockedStrategy}setCharacter(t){this.character=t,this.noPathFoundRetryable.reset(),this.pathBlockedRetryable.reset(),this.pathBlockedWaitElapsed=0,this.calcShortestPath(),this.character.autoMovementSet().pipe(Bt(e=>e!==this),fe(1)).subscribe(()=>{this.stop("MOVEMENT_TERMINATED")})}getPathfindingOptions(){return{shortestPathAlgorithm:this.shortestPathAlgorithm,pathWidth:this.character.getTileWidth(),pathHeight:this.character.getTileHeight(),numberOfDirections:this.character.getNumberOfDirections(),isPositionAllowed:this.isPositionAllowed,collisionGroups:this.character.getCollisionGroups(),ignoredChars:[this.character.getId()],ignoreTiles:!this.character.collidesWithTiles(),ignoreMapBounds:this.character.getIgnoreMissingTiles(),ignoreBlockedTarget:this.ignoreBlockedTarget,maxPathLength:this.maxPathLength,ignoreLayers:this.ignoreLayers,considerCosts:this.considerCosts,calculateClosestToTarget:!0}}update(t){var e,n,s,a;this.stopped||(this.noPathFound()&&(this.noPathFoundStrategy==="RETRY"?this.noPathFoundRetryable.retry(t,()=>this.calcShortestPath()):this.noPathFoundStrategy==="STOP"&&this.stop("NO_PATH_FOUND")),this.updatePosOnPath(),this.isBlocking((e=this.nextTileOnPath())==null?void 0:e.position,(n=this.character)==null?void 0:n.getNextTilePos().layer)?this.applyPathBlockedStrategy(t):this.pathBlockedWaitElapsed=0,this.hasArrived()?(this.stop("SUCCESS"),this.existsDistToTarget()&&this.turnTowardsTarget()):this.isBlocking((s=this.nextTileOnPath())==null?void 0:s.position,(a=this.character)==null?void 0:a.getNextTilePos().layer)||this.moveCharOnPath())}finishedObs(){return this.finished$}getInfo(){return{type:"Target",state:{pathAhead:this.shortestPath.slice(this.posOnPath).map(t=>G.fromInternal(t))},config:{algorithm:this.shortestPathAlgorithm,ignoreBlockedTarget:this.ignoreBlockedTarget,distance:this.distance,targetPos:G.fromInternal(this.targetPos),noPathFoundStrategy:this.noPathFoundStrategy,pathBlockedStrategy:this.pathBlockedStrategy,noPathFoundRetryBackoffMs:this.noPathFoundRetryable.getBackoffMs(),noPathFoundMaxRetries:this.noPathFoundRetryable.getMaxRetries()}}}resultToReason(t){switch(t){case"SUCCESS":return"Successfully arrived.";case"MOVEMENT_TERMINATED":return"Movement of character has been replaced before destination was reached.";case"PATH_BLOCKED":return"PathBlockedStrategy STOP: Path blocked.";case"NO_PATH_FOUND_MAX_RETRIES_EXCEEDED":return`NoPathFoundStrategy RETRY: Maximum retries of ${this.noPathFoundRetryable.getMaxRetries()} exceeded.`;case"NO_PATH_FOUND":return"NoPathFoundStrategy STOP: No path found.";case"PATH_BLOCKED_MAX_RETRIES_EXCEEDED":return`PathBlockedStrategy RETRY: Maximum retries of ${this.pathBlockedRetryable.getMaxRetries()} exceeded.`;case"PATH_BLOCKED_WAIT_TIMEOUT":return`PathBlockedStrategy WAIT: Wait timeout of ${this.pathBlockedWaitTimeoutMs}ms exceeded.`}}applyPathBlockedStrategy(t){this.pathBlockedStrategy==="RETRY"?this.pathBlockedRetryable.retry(t,()=>{let e=this.getShortestPath();e.path.length>0&&this.calcShortestPath(e)}):this.pathBlockedStrategy==="STOP"?this.stop("PATH_BLOCKED"):this.pathBlockedStrategy==="WAIT"&&this.pathBlockedWaitTimeoutMs>-1&&(this.pathBlockedWaitElapsed+=t,this.pathBlockedWaitElapsed>=this.pathBlockedWaitTimeoutMs&&this.stop("PATH_BLOCKED_WAIT_TIMEOUT"))}moveCharOnPath(){let t=this.nextTileOnPath();if(!t)return;let e=this.getDir(this.character.getNextTilePos().position,t.position);this.character.move(e)}nextTileOnPath(){return this.shortestPath[this.posOnPath+1]}stop(t){this.finished$.next({position:this.character.getTilePos().position,result:t,description:this.resultToReason(t),layer:this.character.getTilePos().layer}),this.finished$.complete(),this.stopped=!0}turnTowardsTarget(){let t=this.shortestPath[this.posOnPath+1],e=this.getDir(this.character.getNextTilePos().position,t.position);this.character.turnTowards(e)}existsDistToTarget(){return this.posOnPath=this.shortestPath.length-1}updatePosOnPath(){let t=this.shortestPath[this.posOnPath];for(;this.posOnPaththis.isLayerAlwaysOnTop(a));this.tilemap.layers.filter(a=>!this.isLayerAlwaysOnTop(a)).forEach(a=>{this.hasLayerProp(a,Re.HEIGHT_SHIFT_PROP_NAME)?(this.createHeightShiftLayers(a,e),t.push(a.tilemapLayer)):this.setDepth(a,++e)}),this.charLayerDepths.set(void 0,e),n.forEach((a,h)=>{a.tilemapLayer.setDepth(h+1+e)}),t.forEach(a=>a.destroy())}setDepth(t,e){t.tilemapLayer.setDepth(e),this.isCharLayer(t)&&this.charLayerDepths.set(this.getLayerProp(t,Re.CHAR_LAYER_PROP_NAME),e)}createHeightShiftLayers(t,e){let n=this.getLayerProp(t,Re.HEIGHT_SHIFT_PROP_NAME);isNaN(n)&&(n=0);let s=1;for(let a=0;aa.name==e);return s==null?void 0:s.value}hasLayerProp(t,e){return this.getLayerProp(t,e)!=null}copyLayer(t,e){let n=`${t.name}#${e}`,s=this.tilemap.createBlankLayer(n,t.tilemapLayer.tileset);if(s){s.name=n;for(let a=0;a()=>(t||r((t={exports:{}}).exports,t),t.exports),OS=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of _S(t))!ES.call(r,s)&&s!==e&&Bd(r,s,{get:()=>t[s],enumerable:!(n=CS(t,s))||n.enumerable});return r},eh=(r,t,e)=>(e=r!=null?SS(LS(r)):{},OS(t||!r||!r.__esModule?Bd(e,"default",{value:r,enumerable:!0}):e,r)),rh=AS((r,t)=>{(function(){var e,n="4.17.21",s=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",h="Expected a function",l="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",m=500,y="__lodash_placeholder__",b=1,x=2,C=4,O=1,I=2,F=1,H=2,j=4,Z=8,ht=16,At=32,Fe=64,Se=128,Ki=256,Vs=512,Qd=30,Kd="...",Yd=800,Xd=16,ih=1,Jd=2,Zd=3,$r=1/0,Ar=9007199254740991,tm=17976931348623157e292,Nn=0/0,Xe=4294967295,em=Xe-1,rm=Xe>>>1,im=[["ary",Se],["bind",F],["bindKey",H],["curry",Z],["curryRight",ht],["flip",Vs],["partial",At],["partialRight",Fe],["rearg",Ki]],pi="[object Arguments]",Un="[object Array]",nm="[object AsyncFunction]",Yi="[object Boolean]",Xi="[object Date]",om="[object DOMException]",jn="[object Error]",Gn="[object Function]",nh="[object GeneratorFunction]",ze="[object Map]",Ji="[object Number]",sm="[object Null]",gr="[object Object]",oh="[object Promise]",am="[object Proxy]",Zi="[object RegExp]",Ve="[object Set]",tn="[object String]",Hn="[object Symbol]",um="[object Undefined]",en="[object WeakMap]",hm="[object WeakSet]",rn="[object ArrayBuffer]",di="[object DataView]",Ns="[object Float32Array]",Us="[object Float64Array]",js="[object Int8Array]",Gs="[object Int16Array]",Hs="[object Int32Array]",Bs="[object Uint8Array]",Ws="[object Uint8ClampedArray]",qs="[object Uint16Array]",$s="[object Uint32Array]",cm=/\b__p \+= '';/g,lm=/\b(__p \+=) '' \+/g,fm=/(__e\(.*?\)|\b__t\)) \+\n'';/g,sh=/&(?:amp|lt|gt|quot|#39);/g,ah=/[&<>"']/g,pm=RegExp(sh.source),dm=RegExp(ah.source),mm=/<%-([\s\S]+?)%>/g,gm=/<%([\s\S]+?)%>/g,uh=/<%=([\s\S]+?)%>/g,ym=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,vm=/^\w*$/,bm=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qs=/[\\^$.*+?()[\]{}|]/g,wm=RegExp(Qs.source),Ks=/^\s+/,Pm=/\s/,Tm=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,xm=/\{\n\/\* \[wrapped with (.+)\] \*/,Sm=/,? & /,Cm=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,_m=/[()=,{}\[\]\/\s]/,Lm=/\\(\\)?/g,Em=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,hh=/\w*$/,Am=/^[-+]0x[0-9a-f]+$/i,Om=/^0b[01]+$/i,Dm=/^\[object .+?Constructor\]$/,Mm=/^0o[0-7]+$/i,Im=/^(?:0|[1-9]\d*)$/,km=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Bn=/($^)/,Rm=/['\n\r\u2028\u2029\\]/g,Wn="\\ud800-\\udfff",Fm="\\u0300-\\u036f",zm="\\ufe20-\\ufe2f",Vm="\\u20d0-\\u20ff",ch=Fm+zm+Vm,lh="\\u2700-\\u27bf",fh="a-z\\xdf-\\xf6\\xf8-\\xff",Nm="\\xac\\xb1\\xd7\\xf7",Um="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",jm="\\u2000-\\u206f",Gm=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ph="A-Z\\xc0-\\xd6\\xd8-\\xde",dh="\\ufe0e\\ufe0f",mh=Nm+Um+jm+Gm,Ys="['\u2019]",Hm="["+Wn+"]",gh="["+mh+"]",qn="["+ch+"]",yh="\\d+",Bm="["+lh+"]",vh="["+fh+"]",bh="[^"+Wn+mh+yh+lh+fh+ph+"]",Xs="\\ud83c[\\udffb-\\udfff]",Wm="(?:"+qn+"|"+Xs+")",wh="[^"+Wn+"]",Js="(?:\\ud83c[\\udde6-\\uddff]){2}",Zs="[\\ud800-\\udbff][\\udc00-\\udfff]",mi="["+ph+"]",Ph="\\u200d",Th="(?:"+vh+"|"+bh+")",qm="(?:"+mi+"|"+bh+")",xh="(?:"+Ys+"(?:d|ll|m|re|s|t|ve))?",Sh="(?:"+Ys+"(?:D|LL|M|RE|S|T|VE))?",Ch=Wm+"?",_h="["+dh+"]?",$m="(?:"+Ph+"(?:"+[wh,Js,Zs].join("|")+")"+_h+Ch+")*",Qm="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Km="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Lh=_h+Ch+$m,Ym="(?:"+[Bm,Js,Zs].join("|")+")"+Lh,Xm="(?:"+[wh+qn+"?",qn,Js,Zs,Hm].join("|")+")",Jm=RegExp(Ys,"g"),Zm=RegExp(qn,"g"),ta=RegExp(Xs+"(?="+Xs+")|"+Xm+Lh,"g"),tg=RegExp([mi+"?"+vh+"+"+xh+"(?="+[gh,mi,"$"].join("|")+")",qm+"+"+Sh+"(?="+[gh,mi+Th,"$"].join("|")+")",mi+"?"+Th+"+"+xh,mi+"+"+Sh,Km,Qm,yh,Ym].join("|"),"g"),eg=RegExp("["+Ph+Wn+ch+dh+"]"),rg=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ig=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ng=-1,ft={};ft[Ns]=ft[Us]=ft[js]=ft[Gs]=ft[Hs]=ft[Bs]=ft[Ws]=ft[qs]=ft[$s]=!0,ft[pi]=ft[Un]=ft[rn]=ft[Yi]=ft[di]=ft[Xi]=ft[jn]=ft[Gn]=ft[ze]=ft[Ji]=ft[gr]=ft[Zi]=ft[Ve]=ft[tn]=ft[en]=!1;var ct={};ct[pi]=ct[Un]=ct[rn]=ct[di]=ct[Yi]=ct[Xi]=ct[Ns]=ct[Us]=ct[js]=ct[Gs]=ct[Hs]=ct[ze]=ct[Ji]=ct[gr]=ct[Zi]=ct[Ve]=ct[tn]=ct[Hn]=ct[Bs]=ct[Ws]=ct[qs]=ct[$s]=!0,ct[jn]=ct[Gn]=ct[en]=!1;var og={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},sg={"&":"&","<":"<",">":">",'"':""","'":"'"},ag={"&":"&","<":"<",">":">",""":'"',"'":"'"},ug={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},hg=parseFloat,cg=parseInt,Eh=typeof global=="object"&&global&&global.Object===Object&&global,lg=typeof self=="object"&&self&&self.Object===Object&&self,Ft=Eh||lg||Function("return this")(),ea=typeof r=="object"&&r&&!r.nodeType&&r,Qr=ea&&typeof t=="object"&&t&&!t.nodeType&&t,Ah=Qr&&Qr.exports===ea,ra=Ah&&Eh.process,Ce=function(){try{var P=Qr&&Qr.require&&Qr.require("util").types;return P||ra&&ra.binding&&ra.binding("util")}catch(_){}}(),Oh=Ce&&Ce.isArrayBuffer,Dh=Ce&&Ce.isDate,Mh=Ce&&Ce.isMap,Ih=Ce&&Ce.isRegExp,kh=Ce&&Ce.isSet,Rh=Ce&&Ce.isTypedArray;function de(P,_,S){switch(S.length){case 0:return P.call(_);case 1:return P.call(_,S[0]);case 2:return P.call(_,S[0],S[1]);case 3:return P.call(_,S[0],S[1],S[2])}return P.apply(_,S)}function fg(P,_,S,k){for(var B=-1,rt=P==null?0:P.length;++B-1}function ia(P,_,S){for(var k=-1,B=P==null?0:P.length;++k-1;);return S}function Hh(P,_){for(var S=P.length;S--&&gi(_,P[S],0)>-1;);return S}function Pg(P,_){for(var S=P.length,k=0;S--;)P[S]===_&&++k;return k}var Tg=aa(og),xg=aa(sg);function Sg(P){return"\\"+ug[P]}function Cg(P,_){return P==null?e:P[_]}function yi(P){return eg.test(P)}function _g(P){return rg.test(P)}function Lg(P){for(var _,S=[];!(_=P.next()).done;)S.push(_.value);return S}function la(P){var _=-1,S=Array(P.size);return P.forEach(function(k,B){S[++_]=[B,k]}),S}function Bh(P,_){return function(S){return P(_(S))}}function Mr(P,_){for(var S=-1,k=P.length,B=0,rt=[];++S-1}function dy(i,o){var u=this.__data__,c=co(u,i);return c<0?(++this.size,u.push([i,o])):u[c][1]=o,this}yr.prototype.clear=cy,yr.prototype.delete=ly,yr.prototype.get=fy,yr.prototype.has=py,yr.prototype.set=dy;function vr(i){var o=-1,u=i==null?0:i.length;for(this.clear();++o=o?i:o)),i}function Ae(i,o,u,c,f,g){var v,w=o&b,T=o&x,L=o&C;if(u&&(v=f?u(i,c,f,g):u(i)),v!==e)return v;if(!gt(i))return i;var E=W(i);if(E){if(v=vv(i),!w)return ae(i,v)}else{var A=Qt(i),M=A==Gn||A==nh;if(Nr(i))return _c(i,w);if(A==gr||A==pi||M&&!f){if(v=T||M?{}:Wc(i),!w)return T?av(i,Oy(v,i)):sv(i,rc(v,i))}else{if(!ct[A])return f?i:{};v=bv(i,A,w)}}g||(g=new Ue);var R=g.get(i);if(R)return R;g.set(i,v),wl(i)?i.forEach(function(U){v.add(Ae(U,o,u,U,i,g))}):vl(i)&&i.forEach(function(U,K){v.set(K,Ae(U,o,u,K,i,g))});var N=L?T?za:Fa:T?he:zt,$=E?e:N(i);return _e($||i,function(U,K){$&&(K=U,U=i[K]),cn(v,K,Ae(U,o,u,K,i,g))}),v}function Dy(i){var o=zt(i);return function(u){return ic(u,i,o)}}function ic(i,o,u){var c=u.length;if(i==null)return!c;for(i=ut(i);c--;){var f=u[c],g=o[f],v=i[f];if(v===e&&!(f in i)||!g(v))return!1}return!0}function nc(i,o,u){if(typeof i!="function")throw new Le(h);return yn(function(){i.apply(e,u)},o)}function ln(i,o,u,c){var f=-1,g=$n,v=!0,w=i.length,T=[],L=o.length;if(!w)return T;u&&(o=pt(o,me(u))),c?(g=ia,v=!1):o.length>=s&&(g=nn,v=!1,o=new Xr(o));t:for(;++ff?0:f+u),c=c===e||c>f?f:q(c),c<0&&(c+=f),c=u>c?0:Tl(c);u0&&u(w)?o>1?Ht(w,o-1,u,c,f):Dr(f,w):c||(f[f.length]=w)}return f}var va=Mc(),ac=Mc(!0);function Je(i,o){return i&&va(i,o,zt)}function ba(i,o){return i&&ac(i,o,zt)}function fo(i,o){return Or(o,function(u){return xr(i[u])})}function Zr(i,o){o=zr(o,i);for(var u=0,c=o.length;i!=null&&uo}function ky(i,o){return i!=null&&st.call(i,o)}function Ry(i,o){return i!=null&&o in ut(i)}function Fy(i,o,u){return i>=$t(o,u)&&i=120&&E.length>=120)?new Xr(v&&E):e}E=i[0];var A=-1,M=w[0];t:for(;++A-1;)w!==i&&io.call(w,T,1),io.call(i,T,1);return i}function vc(i,o){for(var u=i?o.length:0,c=u-1;u--;){var f=o[u];if(u==c||f!==g){var g=f;Tr(f)?io.call(i,f,1):Aa(i,f)}}return i}function _a(i,o){return i+so(Jh()*(o-i+1))}function Ky(i,o,u,c){for(var f=-1,g=Dt(oo((o-i)/(u||1)),0),v=S(g);g--;)v[c?g:++f]=i,i+=u;return v}function La(i,o){var u="";if(!i||o<1||o>Ar)return u;do o%2&&(u+=i),o=so(o/2),o&&(i+=i);while(o);return u}function Q(i,o){return Ba(Qc(i,o,ce),i+"")}function Yy(i){return ec(Li(i))}function Xy(i,o){var u=Li(i);return So(u,Jr(o,0,u.length))}function dn(i,o,u,c){if(!gt(i))return i;o=zr(o,i);for(var f=-1,g=o.length,v=g-1,w=i;w!=null&&++ff?0:f+o),u=u>f?f:u,u<0&&(u+=f),f=o>u?0:u-o>>>0,o>>>=0;for(var g=S(f);++c>>1,v=i[g];v!==null&&!ye(v)&&(u?v<=o:v=s){var L=o?null:lv(i);if(L)return Kn(L);v=!1,f=nn,T=new Xr}else T=o?[]:w;t:for(;++c=c?i:Oe(i,o,u)}var Cc=Gg||function(i){return Ft.clearTimeout(i)};function _c(i,o){if(o)return i.slice();var u=i.length,c=$h?$h(u):new i.constructor(u);return i.copy(c),c}function Ia(i){var o=new i.constructor(i.byteLength);return new eo(o).set(new eo(i)),o}function rv(i,o){var u=o?Ia(i.buffer):i.buffer;return new i.constructor(u,i.byteOffset,i.byteLength)}function iv(i){var o=new i.constructor(i.source,hh.exec(i));return o.lastIndex=i.lastIndex,o}function nv(i){return hn?ut(hn.call(i)):{}}function Lc(i,o){var u=o?Ia(i.buffer):i.buffer;return new i.constructor(u,i.byteOffset,i.length)}function Ec(i,o){if(i!==o){var u=i!==e,c=i===null,f=i===i,g=ye(i),v=o!==e,w=o===null,T=o===o,L=ye(o);if(!w&&!L&&!g&&i>o||g&&v&&T&&!w&&!L||c&&v&&T||!u&&T||!f)return 1;if(!c&&!g&&!L&&i=w)return T;var L=u[c];return T*(L=="desc"?-1:1)}}return i.index-o.index}function Ac(i,o,u,c){for(var f=-1,g=i.length,v=u.length,w=-1,T=o.length,L=Dt(g-v,0),E=S(T+L),A=!c;++w1?u[f-1]:e,v=f>2?u[2]:e;for(g=i.length>3&&typeof g=="function"?(f--,g):e,v&&te(u[0],u[1],v)&&(g=f<3?e:g,f=1),o=ut(o);++c-1?f[g?o[v]:v]:e}}function Rc(i){return Pr(function(o){var u=o.length,c=u,f=Ee.prototype.thru;for(i&&o.reverse();c--;){var g=o[c];if(typeof g!="function")throw new Le(h);if(f&&!v&&To(g)=="wrapper")var v=new Ee([],!0)}for(c=v?c:u;++c1&&X.reverse(),E&&Tw))return!1;var L=g.get(i),E=g.get(o);if(L&&E)return L==o&&E==i;var A=-1,M=!0,R=u&I?new Xr:e;for(g.set(i,o),g.set(o,i);++A1?"& ":"")+o[c],o=o.join(u>2?", ":" "),i.replace(Tm,`{ + `):"",this.name="UnsubscriptionError",this.errors=e}});function wn(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var Ai=function(){function r(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var t,e,n,s,a;if(!this.closed){this.closed=!0;var h=this._parentage;if(h)if(this._parentage=null,Array.isArray(h))try{for(var l=_r(h),p=l.next();!p.done;p=l.next()){var m=p.value;m.remove(this)}}catch(I){t={error:I}}finally{try{p&&!p.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}else h.remove(this);var y=this.initialTeardown;if(tt(y))try{y()}catch(I){a=I instanceof Fo?I.errors:[I]}var b=this._finalizers;if(b){this._finalizers=null;try{for(var x=_r(b),C=x.next();!C.done;C=x.next()){var O=C.value;try{Wl(O)}catch(I){a=a!=null?a:[],I instanceof Fo?a=rr(rr([],er(a)),er(I.errors)):a.push(I)}}}catch(I){n={error:I}}finally{try{C&&!C.done&&(s=x.return)&&s.call(x)}finally{if(n)throw n.error}}}if(a)throw new Fo(a)}},r.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)Wl(t);else{if(t instanceof r){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},r.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},r.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},r.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&wn(e,t)},r.prototype.remove=function(t){var e=this._finalizers;e&&wn(e,t),t instanceof r&&t._removeParent(this)},r.EMPTY=function(){var t=new r;return t.closed=!0,t}(),r}();var hu=Ai.EMPTY;function zo(r){return r instanceof Ai||r&&"closed"in r&&tt(r.remove)&&tt(r.add)&&tt(r.unsubscribe)}function Wl(r){tt(r)?r():r.unsubscribe()}var We={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Oi={setTimeout:function(r,t){for(var e=[],n=2;n0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var n=this,s=this,a=s.hasError,h=s.isStopped,l=s.observers;return a||h?hu:(this.currentObservers=null,l.push(e),new Ai(function(){n.currentObservers=null,wn(l,e)}))},t.prototype._checkFinalizedStatuses=function(e){var n=this,s=n.hasError,a=n.thrownError,h=n.isStopped;s?e.error(a):h&&e.complete()},t.prototype.asObservable=function(){var e=new Vt;return e.source=this,e},t.create=function(e,n){return new Jl(e,n)},t}(Vt);var Jl=function(r){jr(t,r);function t(e,n){var s=r.call(this)||this;return s.destination=e,s.source=n,s}return t.prototype.next=function(e){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.next)===null||s===void 0||s.call(n,e)},t.prototype.error=function(e){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.error)===null||s===void 0||s.call(n,e)},t.prototype.complete=function(){var e,n;(n=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||n===void 0||n.call(e)},t.prototype._subscribe=function(e){var n,s;return(s=(n=this.source)===null||n===void 0?void 0:n.subscribe(e))!==null&&s!==void 0?s:hu},t}(it);var Go=new Vt(function(r){return r.complete()});function Zl(r){return r&&tt(r.schedule)}function tf(r){return r[r.length-1]}function Ho(r){return Zl(tf(r))?r.pop():void 0}function Bo(r,t){return typeof tf(r)=="number"?r.pop():t}var Wo=function(r){return r&&typeof r.length=="number"&&typeof r!="function"};function qo(r){return tt(r==null?void 0:r.then)}function $o(r){return tt(r[Mi])}function Qo(r){return Symbol.asyncIterator&&tt(r==null?void 0:r[Symbol.asyncIterator])}function Ko(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function cT(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Yo=cT();function Xo(r){return tt(r==null?void 0:r[Yo])}function Jo(r){return Hl(this,arguments,function(){var e,n,s,a;return ko(this,function(h){switch(h.label){case 0:e=r.getReader(),h.label=1;case 1:h.trys.push([1,,9,10]),h.label=2;case 2:return[4,ii(e.read())];case 3:return n=h.sent(),s=n.value,a=n.done,a?[4,ii(void 0)]:[3,5];case 4:return[2,h.sent()];case 5:return[4,ii(s)];case 6:return[4,h.sent()];case 7:return h.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function Zo(r){return tt(r==null?void 0:r.getReader)}function le(r){if(r instanceof Vt)return r;if(r!=null){if($o(r))return lT(r);if(Wo(r))return fT(r);if(qo(r))return pT(r);if(Qo(r))return ef(r);if(Xo(r))return dT(r);if(Zo(r))return mT(r)}throw Ko(r)}function lT(r){return new Vt(function(t){var e=r[Mi]();if(tt(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function fT(r){return new Vt(function(t){for(var e=0;e{let a=this.tilePosInDirection(new D(n,s),t);return this.tilemap.hasBlockingTile(a,e,jl(t),this.ignoreMissingTiles)})}isCharBlocking(t,e){return this.someCharTile((n,s)=>{let a=this.tilePosInDirection(new D(n,s),t);return this.tilemap.hasBlockingChar(a,e,this.getCollisionGroups(),new Set([this.getId()]))})}isMoving(){return this.movementDirection!="none"}turnTowards(t){this.isMoving()||t!="none"&&this.changeFacingDirection(t)}changeFacingDirection(t){this.facingDirection!==t&&(this.facingDirection=t,this.directionChanged$.next(t))}getFacingDirection(){return this.facingDirection}getFacingPosition(){return this._tilePos.position.add(Be(this.facingDirection))}addCollisionGroup(t){this.collisionGroups.add(t)}setCollisionGroups(t){this.collisionGroups=new Set(t)}getCollisionGroups(){return Array.from(this.collisionGroups)}hasCollisionGroup(t){return this.collisionGroups.has(t)}removeCollisionGroup(t){this.collisionGroups.delete(t)}removeAllCollisionGroups(){this.collisionGroups.clear()}addLabels(t){for(let e of t)this.labels.add(e)}getLabels(){return[...this.labels.values()]}hasLabel(t){return this.labels.has(t)}clearLabels(){this.labels.clear()}removeLabels(t){for(let e of t)this.labels.delete(e)}getNumberOfDirections(){return this.numberOfDirections}movementStarted(){return this.movementStarted$}movementStopped(){return this.movementStopped$}directionChanged(){return this.directionChanged$}tilePositionSet(){return this.tilePositionSet$}positionChangeStarted(){return this.positionChangeStarted$}positionChangeFinished(){return this.positionChangeFinished$}autoMovementSet(){return this.autoMovementSet$}depthChanged(){return this.depthChanged$}getMovementProgress(){return this.movementProgress}hasWalkedHalfATile(){return this.movementProgress>oi/2}willCrossTileBorderThisUpdate(t){return this.movementProgress+this.maxProgressForDelta(t)>=oi}updateCharacterPosition(t){let e=this.willCrossTileBorderThisUpdate(t),s=1-(e?oi-this.movementProgress:this.maxProgressForDelta(t))/this.maxProgressForDelta(t);this.movementProgress=Math.min(this.movementProgress+this.maxProgressForDelta(t),oi),e&&(this.movementProgress=0,this.shouldContinueMoving()?(this.fire(this.positionChangeFinished$,this.tilePos,this.getNextTilePos()),this.tilePos=this.getNextTilePos(),this.startMoving(this.lastMovementImpulse),s>0&&this.updateCharacterPosition(t*s)):this.stopMoving())}maxProgressForDelta(t){let n=t/1e3;return Math.floor(n*this.speed*oi)}get tilePos(){return G.clone(this._tilePos)}set tilePos(t){G.copyOver(t,this._tilePos)}startMoving(t){t!=="none"&&(t!=this.movementDirection&&this.movementStarted$.next(t),this.movementDirection=t,this.facingDirection=t,this.fire(this.positionChangeStarted$,this.tilePos,this.getNextTilePos()))}tilePosInDirection(t,e){return t.add(Be(this.tilemap.toMapDirection(e)))}shouldContinueMoving(){return this.lastMovementImpulse!=="none"&&!this.isBlockingDirection(this.lastMovementImpulse)}stopMoving(){if(this.movementDirection==="none")return;let t=this.tilePos,e=this.getNextTilePos(),n=this.movementDirection;this.tilePos=this.getNextTilePos(),this.movementDirection="none",this.movementStopped$.next(n),this.fire(this.positionChangeFinished$,t,e)}fire(t,{position:e,layer:n},{position:s,layer:a}){t.next({exitTile:e,enterTile:s,exitLayer:n,enterLayer:a})}someCharTile(t){let e=this.getNextTilePos().position;for(let n=e.x;nh===this.charData.id)).subscribe(({direction:h})=>{var l;(l=this.animation)==null||l.setStandingFrame(h)}),this.sprite&&(this.sprite.setOrigin(0,0),this.resetAnimation(this.sprite),this.updateOverlaySprite(),this.updateGridChar())}destroy(){this.destroy$.next(),this.destroy$.complete(),this.newSpriteSet$.complete()}setSprite(t){t?(this.sprite&&(t.x=this.sprite.x,t.y=this.sprite.y),this.sprite=t,this.newSpriteSet$.next(),this.layerOverlaySprite=this.layerOverlaySprite?this.scene.add.sprite(0,0,this.sprite.texture):void 0,this.updateOverlaySprite(),this.resetAnimation(this.sprite),this.updateDepth()):(this.layerOverlaySprite=void 0,this.sprite=void 0)}getSprite(){return this.sprite}getLayerOverlaySprite(){return this.layerOverlaySprite}setContainer(t){this.container=t}getContainer(){return this.container}getOffsetX(){return this.customOffset.x}setOffsetX(t){this.customOffset.x=t}getOffsetY(){return this.customOffset.y}setOffsetY(t){this.customOffset.y=t}getWalkingAnimationMapping(){return this.walkingAnimationMapping}turnTowards(t){var e;this.geHeadless.isMoving(this.charData.id)||t!="none"&&(this.geHeadless.turnTowards(this.charData.id,t),(e=this.animation)==null||e.setStandingFrame(t))}getAnimation(){return this.animation}setAnimation(t){this.animation=t}update(t){this.updateGridChar()}getEngineOffset(){var n,s,a,h;if(!this.sprite)return D.ZERO;let t=this.tilemap.getTileWidth()/2-Math.floor(((s=(n=this.sprite)==null?void 0:n.displayWidth)!=null?s:0)/2),e=-((h=(a=this.sprite)==null?void 0:a.displayHeight)!=null?h:0)+this.tilemap.getTileHeight();return new D(t,e)}updatePixelPos(){let t=new D(this.geHeadless.getPosition(this.charData.id)),e=this.geHeadless.getMovementProgress(this.charData.id)/1e3,s=this.tilemap.tilePosToPixelPos(t).add(this.getEngineOffset()).add(this.customOffset).add(Be(this.geHeadless.getFacingDirection(this.charData.id)).multiply(this.tilemap.getTileDistance(this.geHeadless.getFacingDirection(this.charData.id)).scalarMult(e))),a=this.getGameObj();a&&(a.x=Math.floor(s.x),a.y=Math.floor(s.y))}getGameObj(){return this.container||this.sprite}updateGridChar(){var t;if(this.updatePixelPos(),this.sprite&&this.geHeadless.isMoving(this.charData.id)){let e=this.geHeadless.getMovementProgress(this.charData.id)>oi/2;(t=this.getAnimation())==null||t.updateCharacterFrame(this.geHeadless.getFacingDirection(this.charData.id),e,Number(this.sprite.frame.name))}this.updateDepth()}resetAnimation(t){let e=new xn(this.walkingAnimationMapping,t.texture.source[0].width/t.width/xn.FRAMES_CHAR_ROW);this.setAnimation(e),e.frameChange().pipe(Mt(this.newSpriteSet$)).subscribe(n=>{t==null||t.setFrame(n)}),e.setIsEnabled(this.walkingAnimationMapping!==void 0),e.setStandingFrame(this.geHeadless.getFacingDirection(this.charData.id))}updateOverlaySprite(){if(!this.layerOverlaySprite||!this.sprite)return;this.layerOverlaySprite.scale=this.sprite.scale;let t=this.tilemap.getTileHeight()/this.layerOverlaySprite.scale;this.layerOverlaySprite.setCrop(0,0,this.layerOverlaySprite.displayWidth,this.sprite.height-t),this.layerOverlaySprite.setOrigin(0,0)}updateDepth(){let t=this.getGameObj();if(!t)return;let e=new D(this.geHeadless.getPosition(this.charData.id)),n=this.geHeadless.getCharLayer(this.charData.id);this.setDepth(t,{position:e,layer:n});let s=this.getLayerOverlaySprite();if(s){let a=new D(He(ot({},e),{y:e.y-1}));this.setDepth(s,{position:a,layer:n})}}setDepth(t,e){t.setDepth(this.tilemap.getDepthOfCharLayer(this.getTransitionLayer(e))+this.getPaddedPixelDepth(t))}getPaddedPixelDepth(t){return Ii.shiftPad(t.y+t.displayHeight,7)}getTransitionLayer(t){if(t.layer)return this.geHeadless.getTransition(t.position,t.layer)||t.layer}};var ki=(n=>(n.STOP="STOP",n.CLOSEST_REACHABLE="CLOSEST_REACHABLE",n.RETRY="RETRY",n))(ki||{});var xt=class r{static vec2str(t){return`${t.x}#${t.y}`}static equal(t,e){return r.vec2str(t)==r.vec2str(e)}static manhattanDistance(t,e){let n=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return n+s}static chebyshevDistance(t,e){let n=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return Math.max(n,s)}static scalarMult(t,e){return t.clone().multiply(new D(e,e))}};var as=class{distance(t,e){return xt.manhattanDistance(t,e)}direction(t,e){if(xt.equal(t,e))return"none";let n=t.clone().subtract(e);return Math.abs(n.x)>Math.abs(n.y)?n.x>0?"left":"right":n.y>0?"up":"down"}neighbors(t){return[new D(t.x,t.y+1),new D(t.x+1,t.y),new D(t.x-1,t.y),new D(t.x,t.y-1)]}getDirections(){return["up","right","down","left"]}};var us=class{distance(t,e){return xt.chebyshevDistance(t,e)}neighbors(t){let e=[new D(t.x,t.y+1),new D(t.x+1,t.y),new D(t.x-1,t.y),new D(t.x,t.y-1)],n=[new D(t.x+1,t.y+1),new D(t.x+1,t.y-1),new D(t.x-1,t.y+1),new D(t.x-1,t.y-1)];return[...e,...n]}direction(t,e){return e.x>t.x?e.y>t.y?"down-right":e.yt.y?"down-left":e.yt.y?"down":"none"}getDirections(){return["up","right","down","left","down-left","down-right","up-right","up-left"]}};var ie=class{static create(t){switch(t){case 4:return new as;case 8:return new us}}};var Sn=class{constructor(t,e,n){this.backoffMs=t;this.maxRetries=e;this.onFinished=n;this.retries=0;this.elapsed=0}retry(t,e){this.shouldRetry()?(this.elapsed+=t,this.elapsed>=this.backoffMs&&(this.elapsed=0,this.retries++,e())):this.onFinished()}reset(){this.retries=0,this.elapsed=0}getMaxRetries(){return this.maxRetries}getBackoffMs(){return this.backoffMs}shouldRetry(){return this.maxRetries===-1||this.retries(n.WAIT="WAIT",n.RETRY="RETRY",n.STOP="STOP",n))(Cn||{});var nr=class{constructor(t,{shortestPathAlgorithm:e="BFS",pathWidth:n=1,pathHeight:s=1,numberOfDirections:a=4,isPositionAllowed:h=(F,H)=>!0,collisionGroups:l=[],ignoredChars:p=[],ignoreTiles:m=!1,ignoreMapBounds:y=!1,ignoreBlockedTarget:b=!1,maxPathLength:x=1/0,ignoreLayers:C=!1,considerCosts:O=!1,calculateClosestToTarget:I=!0}={}){this.gridTilemap=t;this.options={shortestPathAlgorithm:e,pathWidth:n,pathHeight:s,numberOfDirections:a,isPositionAllowed:h,collisionGroups:l,ignoredChars:p,ignoreTiles:m,ignoreMapBounds:y,ignoreBlockedTarget:b,maxPathLength:x,ignoreLayers:C,considerCosts:O,calculateClosestToTarget:I}}findShortestPath(t,e){this.options.ignoreLayers&&(this.gridTilemap.fixCacheLayer(t.layer),e.layer=t.layer);let n=this.findShortestPathImpl(t,e);return this.gridTilemap.unfixCacheLayers(),n}getNeighbors(t,e){var h;return ie.create((h=this.options.numberOfDirections)!=null?h:4).neighbors(t.position).map(l=>{let p=t.layer;return this.options.ignoreLayers||(p=this.gridTilemap.getTransition(l,t.layer)),{position:l,layer:p||t.layer}}).filter(l=>!this.isBlocking(t,l)||this.options.ignoreBlockedTarget&&G.equal(l,e))}getTransition(t,e){if(!this.options.ignoreLayers)return this.gridTilemap.getTransition(t,e)}getCosts(t,e){if(!this.options.considerCosts)return 1;let n=re(e.position,t);return this.gridTilemap.getTileCosts(e,n)}isBlocking(t,e){return!(this.options.ignoreMapBounds||this.gridTilemap.isInRange(e.position))||!this.options.isPositionAllowed(e.position,e.layer)||!this.options.ignoreTiles&&this.hasBlockingTileFrom(t,e,this.options.pathWidth,this.options.pathHeight,this.options.ignoreMapBounds,this.gridTilemap)?!0:this.hasBlockingCharFrom(e,this.options.pathWidth,this.options.pathHeight,this.options.collisionGroups,this.options.ignoredChars,this.gridTilemap)}distance(t,e){return(this.options.numberOfDirections===4?xt.manhattanDistance:xt.chebyshevDistance)(t,e)}getTilePosInDir(t,e){return this.gridTilemap.getTilePosInDirection(t,e)}getReverseNeighbors(t,e){var l;let s=ie.create((l=this.options.numberOfDirections)!=null?l:4).neighbors(t.position),a;if(!this.options.ignoreLayers){let p=this.gridTilemap.getReverseTransitions(t.position,t.layer);a=p?[...p]:void 0}return s.map(p=>a?a.map(m=>({position:p,layer:m||t.layer})):[{position:p,layer:t.layer}]).flat().filter(p=>!this.isBlocking(p,t)||this.options.ignoreBlockedTarget&&G.equal(t,e))}hasBlockingCharFrom(t,e,n,s,a,h){for(let l=t.position.x;lEn(a,y)-En(a,b)),l=t,p=this.distance(t.position,e.position),m=0;for(h.push(t),s.set(G.toString(t),0),a.set(G.toString(t),this.distance(t.position,e.position));h.size>0;){let y=h.pop();if(!y)break;m++;let b=this.distance(y.position,e.position);if(bthis.options.maxPathLength)return{previous:new Map,closestToTarget:l,steps:m,maxPathLengthReached:!0};for(let x of this.getNeighbors(y,e)){let C=En(s,y)+this.getCosts(y.position,x),O=G.toString(x);(!s.has(O)||C0;){let m=a.dequeue();if(p++,!m)break;let{node:y,dist:b}=m;if(b>this.options.maxPathLength)return{previous:new Map,closestToTarget:h,steps:p,maxPathLengthReached:!0};let x=this.distance(y.position,e.position);if(xthis.lastDist)}step(t,e,n){var s;this.lastDist=n;for(let a of t){let h=G.toString(a);if(!this.visited.has(h)){this.previous.set(h,e),this.queue.enqueue({node:a,dist:n+1}),this.visited.set(h,n+1);let l=(s=this.otherBfs)==null?void 0:s.visited.get(h);l!==void 0&&l0,s.queue.size()>0);){let m=n.queue.dequeue();if(!m)break;let{node:y,dist:b}=m;if(b+1+(((p=s.queue.peek())==null?void 0:p.dist)||0)>this.options.maxPathLength)return{previous:n.previous,previous2:s.previous,closestToTarget:this.maybeClosestToTarget(h),steps:a,maxPathLengthReached:!0};let x=this.distance(y.position,e.position);if(xMn(this.f,h)-Mn(this.f,l)),this.openSet.push(e);let a=G.toString(e);for(this.g.set(a,0),this.f.set(a,this.distance(e.position,n.position)),this.maxFrontierSize=Math.max(this.maxFrontierSize,this.openSet.size);this.openSet.size>0;){let h=this.openSet.pop();if(!h)break;if(this.steps++,G.equal(h,n))return{previous:s,closestToTarget:n,steps:this.steps,maxPathLengthReached:!1};if(Mn(this.g,h)+1>this.options.maxPathLength)return{previous:new Map,closestToTarget:this.closestToTarget,steps:this.steps,maxPathLengthReached:!0};this.updateClosestToTarget(h,n);for(let l of this.getNeighborsInternal(h,s.get(G.toString(h)),n)){let p=G.toString(l.p),m=Mn(this.g,h)+l.dist;(!this.g.has(p)||m({p:l,dist:1}));let a=this.prune(n,e).map(l=>{let p=this.getTransition(l.position,e.layer);return{position:l.position,layer:p||e.layer}}),h=[];for(let l of a){let p=this.jump(e,l,s,1);p&&h.push(p)}return h}jump(e,n,s,a){let h=this.distanceUtils.direction(e.position,n.position);if(!(this.isBlocking(e,n)&&!(G.equal(n,s)&&this.options.ignoreBlockedTarget)))return G.equal(n,s)?{p:n,dist:a}:a>=this.maxJumpSize?{p:n,dist:a}:this.getTransition(n.position,e.layer)!==void 0?{p:n,dist:a}:au(h)?{p:n,dist:a}:this.getForced(e,n).length>0?{p:n,dist:a}:(this.updateClosestToTarget(n,s),this.jump(n,this.getTilePosInDir(n,re(e.position,n.position)),s,a+1))}getForced(e,n){let s=[],a=this.posInDir(n,this.distanceUtils.direction(n.position,e.position)),{topLeft:h,downLeft:l,top:p,bottom:m}=this.normalizedPositions(a,n),y=(x,C)=>this.isBlocking(x,C)||this.getTransition(C.position,C.layer)!==void 0,b=this.distanceUtils.direction(e.position,n.position);return Nl(b)&&((y(a,l)||y(l,m))&&!this.isBlocking(n,m)&&s.push(m),(y(a,h)||y(h,p))&&!this.isBlocking(n,p)&&s.push(p)),s}prune(e,n){let{right:s,top:a,bottom:h}=this.normalizedPositions(e,n),l=this.getForced(e,n),p=re(e.position,n.position);return au(p)?[s,a,h]:[s,...l]}normalizedPositions(e,n){var a,h,l,p,m,y,b;let s=re(e.position,n.position);return{topLeft:this.posInDir(n,((a=this.turnTimes.get("up-left"))==null?void 0:a.get(this.turnOrder[s]))||"up-left"),downLeft:this.posInDir(n,((h=this.turnTimes.get("down-left"))==null?void 0:h.get(this.turnOrder[s]))||"down-left"),downRight:this.posInDir(n,((l=this.turnTimes.get("down-right"))==null?void 0:l.get(this.turnOrder[s]))||"down-right"),topRight:this.posInDir(n,((p=this.turnTimes.get("up-right"))==null?void 0:p.get(this.turnOrder[s]))||"up-right"),top:this.posInDir(n,((m=this.turnTimes.get("up"))==null?void 0:m.get(this.turnOrder[s]))||"up"),bottom:this.posInDir(n,((y=this.turnTimes.get("down"))==null?void 0:y.get(this.turnOrder[s]))||"down"),right:this.posInDir(n,((b=this.turnTimes.get("right"))==null?void 0:b.get(this.turnOrder[s]))||"right")}}posInDir(e,n){return{position:e.position.add(Be(n)),layer:e.layer}}returnPath(e,n,s){let a=[],h=s;for(a.push(h);!G.equal(h,n);){let l=e.get(G.toString(h));if(!l)return[];this.distance(l.position,h.position)>1?this.fillPath(h,l,a):a.push(l),h=l}return a.reverse()}fillPath(e,n,s){let a=e;do{let h=re(a.position,n.position);a=this.getTilePosInDir(a,h),s.push(a)}while(!xt.equal(a.position,n.position))}};function Mn(r,t){var e;return(e=r.get(G.toString(t)))!=null?e:Number.MAX_VALUE}function vS(){let r=["right","down-right","down","down-left","left","up-left","up","up-right"],t=new Map;for(let e=0;eh!==this),fe(1)))).subscribe(({enterTile:h,enterLayer:l})=>{this.updateTarget(h,l)})}update(t){var e;(e=this.targetMovement)==null||e.update(t)}getInfo(){return{type:"Follow",config:{charToFollow:this.charToFollow.getId(),distance:this.options.distance,noPathFoundStrategy:this.options.noPathFoundStrategy,maxPathLength:this.options.maxPathLength,ignoreLayers:this.options.ignoreLayers}}}updateTarget(t,e){this.targetMovement=new $i(this.character,this.gridTilemap,{position:new D(t),layer:e},{distance:this.options.distance+1,config:{algorithm:this.options.shortestPathAlgorithm,noPathFoundStrategy:this.options.noPathFoundStrategy,maxPathLength:this.options.maxPathLength,ignoreLayers:this.options.ignoreLayers,considerCosts:this.options.considerCosts},ignoreBlockedTarget:!0})}};var In=class{static getRandomInt(t){return Math.floor(Math.random()*Math.floor(t))}};var _s=class{constructor(t,e=0,n=-1){this.character=t;this.delay=e;this.radius=n;this.stepSize=0;this.delayLeft=this.delay,this.initialRow=t.getNextTilePos().position.y,this.initialCol=t.getNextTilePos().position.x,this.randomizeStepSize(),this.stepsWalked=0,this.currentMovementDirection="none",this.character.positionChangeStarted().pipe(Mt(this.character.autoMovementSet().pipe(Bt(s=>s!==this),fe(1)))).subscribe(()=>{this.stepsWalked++}),this.distanceUtils=ie.create(t.getNumberOfDirections())}update(t){if(this.shouldContinueWalkingCurrentDirection())this.character.move(this.currentMovementDirection);else if(this.delayLeft-=t,this.delayLeft<=0){this.delayLeft=this.delay;let e=this.getFreeRandomDirection();this.stepsWalked=0,this.character.move(e),this.currentMovementDirection=e,this.randomizeStepSize()}}getInfo(){return{type:"Random",config:{delay:this.delay,radius:this.radius}}}shouldContinueWalkingCurrentDirection(){return this.stepsWalked!this.character.isBlockingDirection(e)).filter(e=>this.isWithinRadius(e))}isWithinRadius(t){return this.radius==-1?!0:this.getDist(t)<=this.radius}getDist(t){return this.distanceUtils.distance(this.character.getNextTilePos().position.add(Be(t)),new D(this.initialCol,this.initialRow))}getFreeRandomDirection(){let t=this.getFreeDirections();return t.length==0?"none":t[In.getRandomInt(t.length)]}randomizeStepSize(){this.stepSize=In.getRandomInt(this.radius)+1}};function Nd(r,t){return r.filter(e=>{var n,s,a,h,l,p;return(n=t.labels)!=null&&n.withAllLabels?(s=t.labels)==null?void 0:s.withAllLabels.every(m=>e.hasLabel(m)):(a=t.labels)!=null&&a.withOneOfLabels?(h=t.labels)==null?void 0:h.withOneOfLabels.some(m=>e.hasLabel(m)):(l=t.labels)!=null&&l.withNoneLabels?!((p=t.labels)!=null&&p.withNoneLabels.some(m=>e.hasLabel(m))):!0})}var Ls="2.38.1";var Es=class{constructor(t,e){this.collistionStrategy=t;this.collisionGroupRelation=e;this.tilePosToCharacters=new Map;this.charRemoved$=new it}isCharBlockingAt(t,e,n,s=new Set){if(n.length===0)return!1;let a=this.posToString(t,e),h=this.tilePosToCharacters.get(a);return!!(h&&h.size>0&&[...h].filter(l=>!s.has(l.getId())).some(l=>n.some(p=>l.getCollisionGroups().some(m=>this.collidesWith(p,m)))))}collidesWith(t,e){return this.collisionGroupRelation?(this.collisionGroupRelation.get(t)||new Set).has(e):t===e}getCharactersAt(t,e){let n=this.posToString(t,e),s=this.tilePosToCharacters.get(n);return new Set(s)}addCharacter(t){this.addTilePositions(t.getTilePos(),t),this.addTilePositions(t.getNextTilePos(),t),this.addPositionChangeSub(t),this.addPositionChangeFinishedSub(t),this.addTilePosSetSub(t)}removeCharacter(t){let e=t.getId();this.charRemoved$.next(e),this.deleteTilePositions(t.getTilePos(),t),this.deleteTilePositions(t.getNextTilePos(),t)}add(t,e){var n;this.tilePosToCharacters.has(t)||this.tilePosToCharacters.set(t,new Set),(n=this.tilePosToCharacters.get(t))==null||n.add(e)}addTilePosSetSub(t){t.tilePositionSet().pipe(Mt(this.charRemoved(t.getId()))).subscribe(e=>{this.deleteTilePositions(t.getNextTilePos(),t),this.addTilePositions(e,t)})}charRemoved(t){var e;return(e=this.charRemoved$)==null?void 0:e.pipe(fe(1),Bt(n=>n==t))}addPositionChangeSub(t){t.positionChangeStarted().pipe(Mt(this.charRemoved(t.getId())),this.posChangeToLayerPos()).subscribe(e=>{this.collistionStrategy==="BLOCK_ONE_TILE_AHEAD"&&this.deleteTilePositions(e.exit,t),this.addTilePositions(e.enter,t)})}addPositionChangeFinishedSub(t){t.positionChangeFinished().pipe(Mt(this.charRemoved(t.getId())),this.posChangeToLayerPos()).subscribe(e=>{this.deleteTilePositions(e.exit,t),this.addTilePositions(e.enter,t)})}addTilePositions(t,e){this.forEachCharTile(t,e,(n,s)=>{this.add(this.posToString(new D(n,s),t.layer),e)})}deleteTilePositions(t,e){this.forEachCharTile(t,e,(n,s)=>{var a;(a=this.tilePosToCharacters.get(this.posToString(new D(n,s),t.layer)))==null||a.delete(e)})}forEachCharTile(t,e,n){let s=t.position;for(let a=s.x;a({enter:{position:new D(t.enterTile),layer:t.enterLayer},exit:{position:new D(t.exitTile),layer:t.exitLayer}})))}posToString(t,e){return`${t.x}#${t.y}#${e}`}};var qr=class{constructor(t,e,n,s){this.x=t;this.y=e;this.width=n;this.height=s}getX(){return this.x}getY(){return this.y}getWidth(){return this.width}getHeight(){return this.height}isInRange(t){return t.x>=this.x&&t.x=this.y&&t.yn.isCharLayer());for(let n of[...e,void 0]){let s=this.tileCollisionCache.get(n==null?void 0:n.getName());if(s===void 0){s=new Array(this.tilemap.getWidth());for(let a=0;a>t&1)==1}var Gd="ge_cost",Ms=class Ms{constructor(t,e,n,s=void 0,a=!1){this.tilemap=t;this.collisionTilePropertyName=e;this.useTileCollisionCache=a;this.characters=new Map;this.transitions=new Map;this.reverseTransitions=new Map;this.collidesPropNames=new Map;this.tileCostPropNames=new Map;this.collisionRelevantLayersFrameCache=new Map;this.charBlockCache=new Es(n,s);for(let h of bn())this.collidesPropNames.set(h,Ms.ONE_WAY_COLLIDE_PROP_PREFIX+h),this.tileCostPropNames.set(h,`${Gd}_${h}`);this.useTileCollisionCache&&(this.tileCollisionCache=new Os(t,this),this.tileCollisionCache.rebuild())}fixCacheLayer(t){var e;(e=this.tileCollisionCache)==null||e.fixLayer(t)}unfixCacheLayers(){var t;(t=this.tileCollisionCache)==null||t.unfixLayers()}addCharacter(t){this.characters.set(t.getId(),t),t.getNextTilePos().layer===void 0&&t.setTilePosition(He(ot({},t.getNextTilePos()),{layer:this.getLowestCharLayer()})),this.charBlockCache.addCharacter(t)}removeCharacter(t){let e=this.characters.get(t);e&&(this.charBlockCache.removeCharacter(e),this.characters.delete(t))}getCharacters(){return[...this.characters.values()]}getCharactersAt(t,e){return this.charBlockCache.getCharactersAt(t,e)}rebuildTileCollisionCache(t){var e;(e=this.tileCollisionCache)==null||e.rebuild(t)}hasBlockingTileUncached(t,e,n,s){if(!s&&this.hasNoTileUncached(t,e))return!0;let a=this.getCollisionRelevantLayers(e);for(let h of a)if(this.isLayerBlockingAt(h.getName(),t,n))return!0;return!1}hasBlockingTile(t,e,n,s){var h;let a=(h=this.tileCollisionCache)==null?void 0:h.isBlockingFrom(t.x,t.y,e,n,s);return a!==void 0?a:this.hasBlockingTileUncached(t,e,n,s)}getTransition(t,e){let n=this.transitions.get(t.toString());if(n)return n.get(e)}getReverseTransitions(t,e){let n=this.reverseTransitions.get(t.toString());if(n)return n.get(e)}setTransition(t,e,n){var s,a,h,l,p;this.transitions.has(t.toString())||this.transitions.set(t.toString(),new Map),this.reverseTransitions.has(t.toString())||this.reverseTransitions.set(t.toString(),new Map),(s=this.transitions.get(t.toString()))==null||s.set(e,n),(a=this.reverseTransitions.get(t.toString()))!=null&&a.has(n)||(h=this.reverseTransitions.get(t.toString()))==null||h.set(n,new Set),(p=(l=this.reverseTransitions.get(t.toString()))==null?void 0:l.get(n))==null||p.add(e)}getTransitions(){return new Map([...this.transitions].map(([t,e])=>[t,new Map(e)]))}getTileCosts(t,e){let n=this.getCollisionRelevantLayers(t.layer),s=1;for(let a of n)s=Math.max(s,this.getTileCostsForLayer(He(ot({},t),{layer:a.getName()}),e));return s}getTileCostsForLayer(t,e){let n=this.tilemap.getTileAt(t.position.x,t.position.y,t.layer);return e&&(n==null?void 0:n.getProperty(this.tileCostPropNames.get(e)||""))||(n==null?void 0:n.getProperty(Gd))||1}hasNoTileUncached(t,e){return!this.getCollisionRelevantLayers(e).some(s=>this.tilemap.hasTileAt(t.x,t.y,s.getName()))}hasNoTile(t,e){var s;let n=(s=this.tileCollisionCache)==null?void 0:s.hasTileAt(t.x,t.y,e);return n!==void 0?n:this.hasNoTileUncached(t,e)}hasBlockingChar(t,e,n,s=new Set){return this.charBlockCache.isCharBlockingAt(t,e,n,s)}isInRange(t){return new qr(0,0,this.tilemap.getWidth(),this.tilemap.getHeight()).isInRange(t)}toMapDirection(t){return this.isIsometric()?Ul(t):t}fromMapDirection(t){return this.isIsometric()?Io(t):t}isIsometric(){return this.tilemap.getOrientation()==="isometric"}getTilePosInDirection(t,e){let n=t.position.add(Be(this.toMapDirection(e))),s=this.getTransition(n,t.layer)||t.layer;return{position:n,layer:s}}invalidateFrameCache(){this.collisionRelevantLayersFrameCache.clear()}isLayerBlockingAt(t,e,n){let s=this.tilemap.getTileAt(e.x,e.y,t);return s?!!(s.getProperty(this.collisionTilePropertyName)||n&&s.getProperty(this.collidesPropNames.get(n)||"")):!1}getCharLayerIndexes(){return this.tilemap.getLayers().map((t,e)=>({layer:t,index:e})).filter(({layer:t})=>t.isCharLayer()).map(({index:t})=>t)}findPrevAndCharLayer(t){let e=this.getCharLayerIndexes(),n=this.tilemap.getLayers(),s=e.findIndex(a=>n[a].getProperty(kn)==t);return s==0?{prevIndex:-1,charLayerIndex:e[s]}:{prevIndex:e[s-1],charLayerIndex:e[s]}}getCollisionRelevantLayers(t){if(!t)return this.tilemap.getLayers();let e=this.collisionRelevantLayersFrameCache.get(t);if(e)return e;let{prevIndex:n,charLayerIndex:s}=this.findPrevAndCharLayer(t),a=this.tilemap.getLayers().slice(n+1,s+1);return this.collisionRelevantLayersFrameCache.set(t,a),a}getLowestCharLayer(){for(let t of this.tilemap.getLayers())if(t.isCharLayer())return t.getProperty(kn)}};Ms.ONE_WAY_COLLIDE_PROP_PREFIX="ge_collide_";var Ds=Ms;var Is=class{constructor(t,e){this.character=t;this.tilemap=e;this.queue=new Lr;this.finished$=new it;this.pathBlockedWaitElapsed=0;this.distanceUtils=ie.create(t.getNumberOfDirections()),this.character.autoMovementSet().pipe(Bt(n=>n!==this),fe(1)).subscribe(()=>{this.queue.size()>0&&this.finishMovementTerminated(),this.finished$.complete()})}update(t){(!this.character.isMoving()||this.character.willCrossTileBorderThisUpdate(t))&&this.queue.size()>0&&this.moveCharOnPath(t)}getInfo(){return{type:"Queue"}}enqueue(t,e={}){var s,a,h;let n={pathBlockedStrategy:(s=e.pathBlockedStrategy)!=null?s:"STOP",pathBlockedWaitTimeoutMs:(e==null?void 0:e.pathBlockedWaitTimeoutMs)||-1,ignoreInvalidPositions:(a=e.ignoreInvalidPositions)!=null?a:!1,skipInvalidPositions:(h=e.skipInvalidPositions)!=null?h:!1};for(let l of t){let p={command:l,config:n};if(Ur(l)){this.queue.enqueue(p);continue}let m=this.queue.peekEnd(),y=m==null?void 0:m.command;if(y||(y=this.character.getNextTilePos()),Ur(y)){this.queue.enqueue(p);continue}let b=this.distanceUtils.distance(y.position,l.position)===1;(!e.ignoreInvalidPositions||b)&&this.queue.enqueue(p)}}peekAll(){return this.queue.peekAll()}size(){return this.queue.size()}finished(){return this.finished$}clear(){this.queue.clear()}moveCharOnPath(t){let e=this.queue.peek();if(!e)return;let n=e.command,s=e.config;if(Ur(n)&&(n=this.tilemap.getTilePosInDirection(this.character.getNextTilePos(),n)),s.skipInvalidPositions){if(n=this.getNextValidPosition(),!n){this.finishInvalidNextPos(n);return}}else if(!this.isNeighborPos(n)){this.finishInvalidNextPos(n);return}if(this.character.isBlockingDirection(re(this.character.getNextTilePos().position,n.position))){if(s.pathBlockedStrategy==="STOP")this.finishPathBlocked(n);else if(s.pathBlockedStrategy==="SKIP"){this.queue.dequeue(),this.moveCharOnPath(t);return}else s.pathBlockedStrategy==="WAIT"&&s.pathBlockedWaitTimeoutMs>-1&&(this.pathBlockedWaitElapsed+=t,this.pathBlockedWaitElapsed>=s.pathBlockedWaitTimeoutMs&&this.finishBlockedWaitTimeout(n,s.pathBlockedWaitTimeoutMs));return}this.pathBlockedWaitElapsed=0,this.queue.dequeue(),this.character.move(this.getDir(this.character.getNextTilePos().position,n.position)),this.isLastMovement()&&this.finish("SUCCESS","",n)}getNextValidPosition(){var t;for(;this.queue.size()>0;){let e=(t=this.queue.peek())==null?void 0:t.command;if(Ur(e)&&(e=this.tilemap.getTilePosInDirection(this.character.getNextTilePos(),e)),e&&this.isNeighborPos(e))return e;this.queue.dequeue()}}isLastMovement(){return this.queue.size()===0}isNeighborPos(t){let e=this.distanceUtils.distance(this.character.getNextTilePos().position,t.position)===1,n=this.tilemap.getTransition(t.position,this.character.getNextTilePos().layer);if(this.character.getNextTilePos().layer!==t.layer)return e&&n===t.layer;let s=n!==void 0&&n!==t.layer;return e&&!s}finishMovementTerminated(){this.finish("MOVEMENT_TERMINATED","New automatic movement has been set to character.")}finishInvalidNextPos(t){t?this.finish("INVALID_NEXT_POS",`Position ${this.posToStr(t)} is not reachable from ${this.posToStr(this.character.getNextTilePos())}.`):this.finish("INVALID_NEXT_POS",`No enqueued position is reachable from ${this.posToStr(this.character.getNextTilePos())}.`)}finishPathBlocked(t){this.finish("PATH_BLOCKED",`Position ${this.posToStr(t)} is blocked.`)}finishBlockedWaitTimeout(t,e){this.finish("PATH_BLOCKED_WAIT_TIMEOUT",`Position ${this.posToStr(t)} is blocked and the wait timeout of ${e} ms has been exceeded.`)}finish(t,e="",n=this.character.getNextTilePos()){this.queue=new Lr,this.finished$.next({position:n.position,result:t,description:e,layer:n.layer})}getDir(t,e){return this.tilemap.fromMapDirection(re(t,e))}posToStr(t){return`(${t.position.x}, ${t.position.y}, ${t.layer})`}};var ks=class{constructor(t=!0){this.isCreatedInternal=!1;t&&console.log(`Using GridEngine v${Ls}`)}getCharLayer(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getTilePos().layer}getTransition(t,e){var n;return this.initGuard(),(n=this.gridTilemap)==null?void 0:n.getTransition(new D(t),e)}setTransition(t,e,n){var s;return this.initGuard(),(s=this.gridTilemap)==null?void 0:s.setTransition(new D(t),e,n)}create(t,e){this.isCreatedInternal=!0,this.gridCharacters=new Map;let n=this.setConfigDefaults(e);this.config=n,this.movementStopped$=new it,this.movementStarted$=new it,this.directionChanged$=new it,this.positionChangeStarted$=new it,this.positionChangeFinished$=new it,this.queueMovementFinished$=new it,this.charRemoved$=new it,this.charAdded$=new it,this.gridTilemap=new Ds(t,this.config.collisionTilePropertyName,this.config.characterCollisionStrategy,this.recordToMap(this.config.collisionGroupRelation),this.config.cacheTileCollisions),this.addCharacters()}recordToMap(t){return t?new Map(Object.entries(t).map(([n,s])=>[n,new Set(s)])):void 0}getPosition(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getTilePos().position}move(t,e){this.moveChar(t,e)}moveRandomly(t,e=0,n=-1){var h;this.initGuard();let s=(h=this.gridCharacters)==null?void 0:h.get(t);if(!s)throw this.createCharUnknownErr(t);let a=new _s(s,e,n);s.setMovement(a)}getMovement(t){var s;this.initGuard();let e=(s=this.gridCharacters)==null?void 0:s.get(t);if(!e)throw this.createCharUnknownErr(t);let n=e.getMovement();return n?n.getInfo():{type:"None"}}moveTo(t,e,n){var l;let s=this.assembleMoveToConfig(n);this.initGuard();let a=(l=this.gridCharacters)==null?void 0:l.get(t);if(!a)throw this.createCharUnknownErr(t);if(!this.gridTilemap)throw this.createUninitializedErr();let h=new $i(a,this.gridTilemap,{position:new D(e),layer:(n==null?void 0:n.targetLayer)||a.getNextTilePos().layer},{distance:0,config:s});return a.setMovement(h),h.finishedObs().pipe(ir(p=>({charId:t,position:p.position,result:p.result,description:p.description,layer:p.layer})))}stopMovement(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);e.setMovement(void 0)}setSpeed(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.setSpeed(e)}getSpeed(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getSpeed()}collidesWithTiles(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.collidesWithTiles()}update(t,e){var n;if(this.isCreatedInternal&&this.gridCharacters)for(let[s,a]of this.gridCharacters)a.update(e);(n=this.gridTilemap)==null||n.invalidateFrameCache()}addCharacter(t){var a,h,l,p,m;if(!this.gridTilemap)throw this.createUninitializedErr();if(!this.config)throw this.createUninitializedErr();let e={speed:t.speed||4,tilemap:this.gridTilemap,collidesWithTiles:!0,collisionGroups:["geDefault"],charLayer:t.charLayer,facingDirection:t.facingDirection,labels:t.labels,numberOfDirections:(a=t.numberOfDirections)!=null?a:this.config.numberOfDirections,tileWidth:t.tileWidth,tileHeight:t.tileHeight};typeof t.collides=="boolean"?t.collides===!1&&(e.collidesWithTiles=!1,e.collisionGroups=[]):t.collides!==void 0&&(t.collides.collidesWithTiles===!1&&(e.collidesWithTiles=!1),t.collides.collisionGroups&&(e.collisionGroups=t.collides.collisionGroups),e.ignoreMissingTiles=(l=(h=t.collides)==null?void 0:h.ignoreMissingTiles)!=null?l:!1);let n=new os(t.id,e);t.startPosition&&n.setTilePosition({position:new D(t.startPosition),layer:n.getTilePos().layer}),(p=this.gridCharacters)==null||p.set(t.id,n),this.gridTilemap.addCharacter(n);let s=n.getId();n.movementStopped().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.movementStopped$)==null||b.next({charId:s,direction:y})}),n.movementStarted().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.movementStarted$)==null||b.next({charId:s,direction:y})}),n.directionChanged().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.directionChanged$)==null||b.next({charId:s,direction:y})}),n.positionChangeStarted().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.positionChangeStarted$)==null||b.next(ot({charId:s},y))}),n.positionChangeFinished().pipe(Mt(this.charRemoved(s))).subscribe(y=>{var b;(b=this.positionChangeFinished$)==null||b.next(ot({charId:s},y))}),(m=this.charAdded$)==null||m.next(s)}hasCharacter(t){var e;return this.initGuard(),!!((e=this.gridCharacters)!=null&&e.has(t))}removeCharacter(t){var n,s,a,h;if(this.initGuard(),!((n=this.gridCharacters)==null?void 0:n.get(t)))throw this.createCharUnknownErr(t);(s=this.gridTilemap)==null||s.removeCharacter(t),(a=this.gridCharacters)==null||a.delete(t),(h=this.charRemoved$)==null||h.next(t)}removeAllCharacters(){if(this.initGuard(),!!this.gridCharacters)for(let t of this.gridCharacters.keys())this.removeCharacter(t)}getAllCharacters(t){if(this.initGuard(),!this.gridCharacters)return[];let e=[...this.gridCharacters.values()];return(t?Nd(e,t):e).map(s=>s.getId())}getLabels(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getLabels()}addLabels(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.addLabels(e)}removeLabels(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.removeLabels(e)}clearLabels(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);e.clearLabels()}follow(t,e,n,s){var m,y,b,x;let a;n===void 0?a={distance:0,closestPointIfBlocked:!1}:typeof n=="number"?(a={distance:n,closestPointIfBlocked:!1},s&&(a.closestPointIfBlocked=!0)):a=n,this.initGuard();let h=(m=this.gridCharacters)==null?void 0:m.get(t),l=(y=this.gridCharacters)==null?void 0:y.get(e);if(!h)throw this.createCharUnknownErr(t);if(!l)throw this.createCharUnknownErr(e);if(!this.gridTilemap)throw this.createUninitializedErr();let p=new Cs(h,this.gridTilemap,l,{distance:a.distance,noPathFoundStrategy:a.closestPointIfBlocked?"CLOSEST_REACHABLE":"STOP",maxPathLength:(b=a.maxPathLength)!=null?b:1/0,shortestPathAlgorithm:(x=a.algorithm)!=null?x:"BIDIRECTIONAL_SEARCH",ignoreLayers:!!a.ignoreLayers});h.setMovement(p)}isMoving(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.isMoving()}getFacingDirection(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getFacingDirection()}getFacingPosition(t){var s;this.initGuard();let e=(s=this.gridCharacters)==null?void 0:s.get(t);if(!e)throw this.createCharUnknownErr(t);let n=e.getFacingPosition();return{x:n.x,y:n.y}}turnTowards(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);return n.turnTowards(e)}getCharactersAt(t,e){if(this.initGuard(),!this.gridTilemap)return[];let n=this.gridTilemap.getCharactersAt(new D(t),e);return Array.from(n).map(s=>s.getId())}setPosition(t,e,n){var a;this.initGuard();let s=(a=this.gridCharacters)==null?void 0:a.get(t);if(!s)throw this.createCharUnknownErr(t);n||s.setTilePosition({position:new D(e),layer:s.getTilePos().layer}),s.setTilePosition({position:new D(e),layer:n})}isBlocked(t,e,n=["geDefault"]){var a,h;this.initGuard();let s=new D(t);return!!((a=this.gridTilemap)!=null&&a.hasBlockingTile(s,e)||(h=this.gridTilemap)!=null&&h.hasBlockingChar(s,e,n))}isTileBlocked(t,e){var n;return this.initGuard(),!!((n=this.gridTilemap)!=null&&n.hasBlockingTile(new D(t),e))}getCollisionGroups(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getCollisionGroups()||[]}setCollisionGroups(t,e){var s;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);n.setCollisionGroups(e)}getTilePosInDirection(t,e,n){if(!this.gridTilemap)throw this.createUninitializedErr();let s=this.gridTilemap.getTilePosInDirection({position:new D(t),layer:e},n);return{position:s.position.toPosition(),charLayer:s.layer}}findShortestPath(t,e,n={}){if(!this.gridTilemap)throw this.createUninitializedErr();let s=n.shortestPathAlgorithm||"BFS";n.considerCosts&&s!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${s}'. It can only be used with A* algorithm.`);let h=new Qi(this.gridTilemap).findShortestPath(G.toInternal(t),G.toInternal(e),He(ot({},n),{shortestPathAlgorithm:s}));return{path:h.path.map(G.fromInternal),closestToTarget:h.closestToTarget?G.fromInternal(h.closestToTarget):void 0,reachedMaxPathLength:!1,steps:h.steps}}steppedOn(t,e,n){return this.positionChangeFinished().pipe(Bt(s=>t.includes(s.charId)&&e.some(a=>a.x===s.enterTile.x&&a.y===s.enterTile.y)&&(n===void 0||n.includes(s.enterLayer))))}characterShifted(){if(!this.charAdded$||!this.charRemoved$)throw this.createUninitializedErr();return this.charAdded$.pipe(ir(t=>({charId:t,action:"ADDED"})),yu(this.charRemoved$.pipe(ir(t=>({charId:t,action:"REMOVED"})))))}movementStarted(){if(!this.movementStarted$)throw this.createUninitializedErr();return this.movementStarted$}movementStopped(){if(!this.movementStopped$)throw this.createUninitializedErr();return this.movementStopped$}directionChanged(){if(!this.directionChanged$)throw this.createUninitializedErr();return this.directionChanged$}positionChangeStarted(){if(!this.positionChangeStarted$)throw this.createUninitializedErr();return this.positionChangeStarted$}positionChangeFinished(){if(!this.positionChangeFinished$)throw this.createUninitializedErr();return this.positionChangeFinished$}getMovementProgress(t){var n;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return e.getMovementProgress()}rebuildTileCollisionCache(t,e,n,s){var a;(a=this.gridTilemap)==null||a.rebuildTileCollisionCache(new qr(t,e,n,s))}addQueueMovements(t,e,n){var h,l;this.initGuard();let s=(h=this.gridCharacters)==null?void 0:h.get(t);if(!s)throw this.createCharUnknownErr(t);if(!this.gridTilemap)throw this.createUninitializedErr();let a;((l=s==null?void 0:s.getMovement())==null?void 0:l.getInfo().type)==="Queue"?a=s.getMovement():(a=new Is(s,this.gridTilemap),s.setMovement(a),a.finished().pipe(Mt(gu(this.charRemoved(t),s.autoMovementSet()))).subscribe(p=>{var m;(m=this.queueMovementFinished$)==null||m.next(ot({charId:t},p))})),a.enqueue(e.map(p=>Ur(p)?p:{position:new D(p.position),layer:p.charLayer}),n)}queueMovementFinished(){if(!this.queueMovementFinished$)throw this.createUninitializedErr();return this.queueMovementFinished$}getEnqueuedMovements(t){var n,s;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);return((s=e.getMovement())==null?void 0:s.getInfo().type)==="Queue"?e.getMovement().peekAll().map(h=>({command:Ur(h.command)?h.command:G.fromInternal(h.command),config:h.config})):[]}clearEnqueuedMovements(t){var n,s;this.initGuard();let e=(n=this.gridCharacters)==null?void 0:n.get(t);if(!e)throw this.createCharUnknownErr(t);((s=e.getMovement())==null?void 0:s.getInfo().type)==="Queue"&&e.getMovement().clear()}getTileCost(t,e,n){var s,a;return this.initGuard(),(a=(s=this.gridTilemap)==null?void 0:s.getTileCosts({position:new D(t),layer:e},n))!=null?a:1}charRemoved(t){var e;if(!this.charRemoved$)throw this.createUninitializedErr();return(e=this.charRemoved$)==null?void 0:e.pipe(fe(1),Bt(n=>n==t))}initGuard(){if(!this.isCreatedInternal)throw this.createUninitializedErr()}createUninitializedErr(){throw new Error("GridEngine not initialized. You need to call create() first.")}addCharacters(){var t;(t=this.config)==null||t.characters.forEach(e=>this.addCharacter(e))}moveChar(t,e){var s,a,h;this.initGuard();let n=(s=this.gridCharacters)==null?void 0:s.get(t);if(!n)throw this.createCharUnknownErr(t);if(n.getNumberOfDirections()===4){if(!((a=this.gridTilemap)!=null&&a.isIsometric())&&Ei(e)){console.warn(`GridEngine: Character '${t}' can't be moved '${e}' in 4 direction mode.`);return}else if((h=this.gridTilemap)!=null&&h.isIsometric()&&!Ei(e)){console.warn(`GridEngine: Character '${t}' can't be moved '${e}' in 4 direction isometric mode.`);return}}n.move(e)}createCharUnknownErr(t){return new Error(`Character unknown: ${t}`)}assembleMoveToConfig(t={}){let e=He(ot({},t),{noPathFoundStrategy:"STOP",pathBlockedStrategy:"WAIT"});return t!=null&&t.noPathFoundStrategy&&(Object.values(ki).includes(t.noPathFoundStrategy)?e.noPathFoundStrategy=t.noPathFoundStrategy:console.warn(`GridEngine: Unknown NoPathFoundStrategy '${t.noPathFoundStrategy}'. Falling back to 'STOP'`)),t!=null&&t.pathBlockedStrategy&&(Object.values(Cn).includes(t.pathBlockedStrategy)?e.pathBlockedStrategy=t.pathBlockedStrategy:console.warn(`GridEngine: Unknown PathBlockedStrategy '${t.pathBlockedStrategy}'. Falling back to 'WAIT'`)),e}setConfigDefaults(t){return ot({collisionTilePropertyName:"ge_collide",numberOfDirections:4,characterCollisionStrategy:"BLOCK_TWO_TILES",cacheTileCollisions:!1},t)}};var Rs=class extends qi{constructor(t,e={}){super(t,e),this.distanceUtils=ie.create(8)}getForced(t,e){let n=[],s=this.posInDir(e,this.distanceUtils.direction(e.position,t.position)),{topLeft:a,downLeft:h,top:l,bottom:p,topRight:m,downRight:y}=this.normalizedPositions(s,e),b=this.distanceUtils.direction(t.position,e.position),x=(C,O)=>this.isBlocking(C,O)||this.getTransition(O.position,O.layer)!==void 0;return Ei(b)?(x(t,a)&&!this.isBlocking(e,l)&&n.push(l),x(t,a)&&(x(t,h)||x(h,a))&&!this.isBlocking(e,a)&&n.push(a),x(t,h)&&!this.isBlocking(e,p)&&n.push(p),x(t,h)&&(x(t,a)||x(a,h))&&!this.isBlocking(e,h)&&n.push(h)):(x(t,l)&&(x(t,a)||x(a,l))&&(this.isBlocking(e,a)||n.push(a),this.isBlocking(e,l)||n.push(l)),x(t,l)&&(x(t,a)||x(a,l)||x(l,m))&&!this.isBlocking(e,m)&&n.push(m),x(t,p)&&(x(t,h)||x(h,l))&&(this.isBlocking(e,h)||n.push(h),this.isBlocking(e,p)||n.push(p)),x(t,p)&&(x(t,h)||x(a,p)||x(l,y))&&!this.isBlocking(e,y)&&n.push(y)),n}prune(t,e){let{right:n,topRight:s,downRight:a}=this.normalizedPositions(t,e),h=this.getForced(t,e),l=re(t.position,e.position);return Ei(l)?[n,s,a,...h]:[n,...h]}jump(t,e,n,s){let a=this.distanceUtils.direction(t.position,e.position);if(!(this.isBlocking(t,e)&&!(G.equal(e,n)&&this.options.ignoreBlockedTarget))){if(G.equal(e,n))return{p:e,dist:s};if(s>=this.maxJumpSize)return{p:e,dist:s};if(this.getTransition(e.position,t.layer)!==void 0)return{p:e,dist:s};if(this.getForced(t,e).length>0)return{p:e,dist:s};if(this.updateClosestToTarget(e,n),a==="up-left"){if(this.jump(e,this.getTilePosInDir(e,"up"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"left"),n,s+1)!==void 0)return{p:e,dist:s}}else if(a==="down-left"){if(this.jump(e,this.getTilePosInDir(e,"down"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"left"),n,s+1)!==void 0)return{p:e,dist:s}}else if(a==="up-right"){if(this.jump(e,this.getTilePosInDir(e,"up"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"right"),n,s+1)!==void 0)return{p:e,dist:s}}else if(a==="down-right"){if(this.jump(e,this.getTilePosInDir(e,"down"),n,s+1)!==void 0)return{p:e,dist:s};if(this.jump(e,this.getTilePosInDir(e,"right"),n,s+1)!==void 0)return{p:e,dist:s}}return this.jump(e,this.getTilePosInDir(e,re(t.position,e.position)),n,s+1)}}};var Qi=class{constructor(t){this.gridTilemap=t}findShortestPath(t,e,n={}){return xS(n.shortestPathAlgorithm||"BIDIRECTIONAL_SEARCH",this.gridTilemap,n).findShortestPath(t,e)}};function xS(r,t,e){switch(r){case"BIDIRECTIONAL_SEARCH":return new ds(t,e);case"A_STAR":return new ls(t,e);case"JPS":return e.numberOfDirections===8?new Rs(t,e):new qi(t,e)}return new Fi(t,e)}var $i=class{constructor(t,e,n,{config:s,ignoreBlockedTarget:a=!1,distance:h=0}={}){this.character=t;this.tilemap=e;this.targetPos=n;this.shortestPath=[];this.distOffset=0;this.posOnPath=0;this.stopped=!1;this.pathBlockedWaitElapsed=0;this.isPositionAllowed=()=>!0;this.shortestPathAlgorithm="BIDIRECTIONAL_SEARCH";this.maxPathLength=1/0;this.considerCosts=!1;this.isBlocking=(t,e)=>t?new Fi(this.tilemap,this.getPathfindingOptions()).isBlocking(this.character.getTilePos(),{position:t,layer:e}):!0;var l;this.shortestPathAlgorithm=(l=s==null?void 0:s.algorithm)!=null?l:this.shortestPathAlgorithm,this.ignoreBlockedTarget=a,this.distance=h,this.noPathFoundStrategy=(s==null?void 0:s.noPathFoundStrategy)||"STOP",this.pathBlockedStrategy=(s==null?void 0:s.pathBlockedStrategy)||"WAIT",this.noPathFoundRetryable=new Sn((s==null?void 0:s.noPathFoundRetryBackoffMs)||200,(s==null?void 0:s.noPathFoundMaxRetries)||-1,()=>{this.stop("NO_PATH_FOUND_MAX_RETRIES_EXCEEDED")}),this.pathBlockedRetryable=new Sn((s==null?void 0:s.pathBlockedRetryBackoffMs)||200,(s==null?void 0:s.pathBlockedMaxRetries)||-1,()=>{this.stop("PATH_BLOCKED_MAX_RETRIES_EXCEEDED")}),s!=null&&s.isPositionAllowedFn&&(this.isPositionAllowed=s.isPositionAllowedFn),s!=null&&s.maxPathLength&&(this.maxPathLength=s.maxPathLength),s!=null&&s.considerCosts&&this.shortestPathAlgorithm!=="A_STAR"&&console.warn(`GridEngine: Pathfinding option 'considerCosts' cannot be used with algorithm '${this.shortestPathAlgorithm}'. It can only be used with A* algorithm.`),this.considerCosts=(s==null?void 0:s.considerCosts)||!1,this.ignoreLayers=!!(s!=null&&s.ignoreLayers),this.distanceUtils=ie.create(t.getNumberOfDirections()),this.pathBlockedWaitTimeoutMs=(s==null?void 0:s.pathBlockedWaitTimeoutMs)||-1,this.finished$=new it,this.setCharacter(t)}setPathBlockedStrategy(t){this.pathBlockedStrategy=t}getPathBlockedStrategy(){return this.pathBlockedStrategy}setCharacter(t){this.character=t,this.noPathFoundRetryable.reset(),this.pathBlockedRetryable.reset(),this.pathBlockedWaitElapsed=0,this.calcShortestPath(),this.character.autoMovementSet().pipe(Bt(e=>e!==this),fe(1)).subscribe(()=>{this.stop("MOVEMENT_TERMINATED")})}getPathfindingOptions(){return{shortestPathAlgorithm:this.shortestPathAlgorithm,pathWidth:this.character.getTileWidth(),pathHeight:this.character.getTileHeight(),numberOfDirections:this.character.getNumberOfDirections(),isPositionAllowed:this.isPositionAllowed,collisionGroups:this.character.getCollisionGroups(),ignoredChars:[this.character.getId()],ignoreTiles:!this.character.collidesWithTiles(),ignoreMapBounds:this.character.getIgnoreMissingTiles(),ignoreBlockedTarget:this.ignoreBlockedTarget,maxPathLength:this.maxPathLength,ignoreLayers:this.ignoreLayers,considerCosts:this.considerCosts,calculateClosestToTarget:!0}}update(t){var e,n,s,a;this.stopped||(this.noPathFound()&&(this.noPathFoundStrategy==="RETRY"?this.noPathFoundRetryable.retry(t,()=>this.calcShortestPath()):this.noPathFoundStrategy==="STOP"&&this.stop("NO_PATH_FOUND")),this.updatePosOnPath(),this.isBlocking((e=this.nextTileOnPath())==null?void 0:e.position,(n=this.character)==null?void 0:n.getNextTilePos().layer)?this.applyPathBlockedStrategy(t):this.pathBlockedWaitElapsed=0,this.hasArrived()?(this.stop("SUCCESS"),this.existsDistToTarget()&&this.turnTowardsTarget()):this.isBlocking((s=this.nextTileOnPath())==null?void 0:s.position,(a=this.character)==null?void 0:a.getNextTilePos().layer)||this.moveCharOnPath())}finishedObs(){return this.finished$}getInfo(){return{type:"Target",state:{pathAhead:this.shortestPath.slice(this.posOnPath).map(t=>G.fromInternal(t))},config:{algorithm:this.shortestPathAlgorithm,ignoreBlockedTarget:this.ignoreBlockedTarget,distance:this.distance,targetPos:G.fromInternal(this.targetPos),noPathFoundStrategy:this.noPathFoundStrategy,pathBlockedStrategy:this.pathBlockedStrategy,noPathFoundRetryBackoffMs:this.noPathFoundRetryable.getBackoffMs(),noPathFoundMaxRetries:this.noPathFoundRetryable.getMaxRetries()}}}resultToReason(t){switch(t){case"SUCCESS":return"Successfully arrived.";case"MOVEMENT_TERMINATED":return"Movement of character has been replaced before destination was reached.";case"PATH_BLOCKED":return"PathBlockedStrategy STOP: Path blocked.";case"NO_PATH_FOUND_MAX_RETRIES_EXCEEDED":return`NoPathFoundStrategy RETRY: Maximum retries of ${this.noPathFoundRetryable.getMaxRetries()} exceeded.`;case"NO_PATH_FOUND":return"NoPathFoundStrategy STOP: No path found.";case"PATH_BLOCKED_MAX_RETRIES_EXCEEDED":return`PathBlockedStrategy RETRY: Maximum retries of ${this.pathBlockedRetryable.getMaxRetries()} exceeded.`;case"PATH_BLOCKED_WAIT_TIMEOUT":return`PathBlockedStrategy WAIT: Wait timeout of ${this.pathBlockedWaitTimeoutMs}ms exceeded.`}}applyPathBlockedStrategy(t){this.pathBlockedStrategy==="RETRY"?this.pathBlockedRetryable.retry(t,()=>{let e=this.getShortestPath();e.path.length>0&&this.calcShortestPath(e)}):this.pathBlockedStrategy==="STOP"?this.stop("PATH_BLOCKED"):this.pathBlockedStrategy==="WAIT"&&this.pathBlockedWaitTimeoutMs>-1&&(this.pathBlockedWaitElapsed+=t,this.pathBlockedWaitElapsed>=this.pathBlockedWaitTimeoutMs&&this.stop("PATH_BLOCKED_WAIT_TIMEOUT"))}moveCharOnPath(){let t=this.nextTileOnPath();if(!t)return;let e=this.getDir(this.character.getNextTilePos().position,t.position);this.character.move(e)}nextTileOnPath(){return this.shortestPath[this.posOnPath+1]}stop(t){this.finished$.next({position:this.character.getTilePos().position,result:t,description:this.resultToReason(t),layer:this.character.getTilePos().layer}),this.finished$.complete(),this.stopped=!0}turnTowardsTarget(){let t=this.shortestPath[this.posOnPath+1],e=this.getDir(this.character.getNextTilePos().position,t.position);this.character.turnTowards(e)}existsDistToTarget(){return this.posOnPath=this.shortestPath.length-1}updatePosOnPath(){let t=this.shortestPath[this.posOnPath];for(;this.posOnPaththis.isLayerAlwaysOnTop(a));this.tilemap.layers.filter(a=>!this.isLayerAlwaysOnTop(a)).forEach(a=>{this.hasLayerProp(a,Re.HEIGHT_SHIFT_PROP_NAME)?(this.createHeightShiftLayers(a,e),t.push(a.tilemapLayer)):this.setDepth(a,++e)}),this.charLayerDepths.set(void 0,e),n.forEach((a,h)=>{a.tilemapLayer.setDepth(h+1+e)}),t.forEach(a=>a.destroy())}setDepth(t,e){t.tilemapLayer.setDepth(e),this.isCharLayer(t)&&this.charLayerDepths.set(this.getLayerProp(t,Re.CHAR_LAYER_PROP_NAME),e)}createHeightShiftLayers(t,e){let n=this.getLayerProp(t,Re.HEIGHT_SHIFT_PROP_NAME);isNaN(n)&&(n=0);let s=1;for(let a=0;aa.name==e);return s==null?void 0:s.value}hasLayerProp(t,e){return this.getLayerProp(t,e)!=null}copyLayer(t,e){let n=`${t.name}#${e}`,s=this.tilemap.createBlankLayer(n,t.tilemapLayer.tileset);if(s){s.name=n;for(let a=0;a()=>(t||r((t={exports:{}}).exports,t),t.exports),OS=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of _S(t))!ES.call(r,s)&&s!==e&&Bd(r,s,{get:()=>t[s],enumerable:!(n=CS(t,s))||n.enumerable});return r},eh=(r,t,e)=>(e=r!=null?SS(LS(r)):{},OS(t||!r||!r.__esModule?Bd(e,"default",{value:r,enumerable:!0}):e,r)),rh=AS((r,t)=>{(function(){var e,n="4.17.21",s=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",h="Expected a function",l="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",m=500,y="__lodash_placeholder__",b=1,x=2,C=4,O=1,I=2,F=1,H=2,j=4,Z=8,ht=16,At=32,Fe=64,Se=128,Ki=256,Vs=512,Qd=30,Kd="...",Yd=800,Xd=16,ih=1,Jd=2,Zd=3,$r=1/0,Ar=9007199254740991,tm=17976931348623157e292,Nn=0/0,Xe=4294967295,em=Xe-1,rm=Xe>>>1,im=[["ary",Se],["bind",F],["bindKey",H],["curry",Z],["curryRight",ht],["flip",Vs],["partial",At],["partialRight",Fe],["rearg",Ki]],pi="[object Arguments]",Un="[object Array]",nm="[object AsyncFunction]",Yi="[object Boolean]",Xi="[object Date]",om="[object DOMException]",jn="[object Error]",Gn="[object Function]",nh="[object GeneratorFunction]",ze="[object Map]",Ji="[object Number]",sm="[object Null]",gr="[object Object]",oh="[object Promise]",am="[object Proxy]",Zi="[object RegExp]",Ve="[object Set]",tn="[object String]",Hn="[object Symbol]",um="[object Undefined]",en="[object WeakMap]",hm="[object WeakSet]",rn="[object ArrayBuffer]",di="[object DataView]",Ns="[object Float32Array]",Us="[object Float64Array]",js="[object Int8Array]",Gs="[object Int16Array]",Hs="[object Int32Array]",Bs="[object Uint8Array]",Ws="[object Uint8ClampedArray]",qs="[object Uint16Array]",$s="[object Uint32Array]",cm=/\b__p \+= '';/g,lm=/\b(__p \+=) '' \+/g,fm=/(__e\(.*?\)|\b__t\)) \+\n'';/g,sh=/&(?:amp|lt|gt|quot|#39);/g,ah=/[&<>"']/g,pm=RegExp(sh.source),dm=RegExp(ah.source),mm=/<%-([\s\S]+?)%>/g,gm=/<%([\s\S]+?)%>/g,uh=/<%=([\s\S]+?)%>/g,ym=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,vm=/^\w*$/,bm=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qs=/[\\^$.*+?()[\]{}|]/g,wm=RegExp(Qs.source),Ks=/^\s+/,Pm=/\s/,Tm=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,xm=/\{\n\/\* \[wrapped with (.+)\] \*/,Sm=/,? & /,Cm=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,_m=/[()=,{}\[\]\/\s]/,Lm=/\\(\\)?/g,Em=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,hh=/\w*$/,Am=/^[-+]0x[0-9a-f]+$/i,Om=/^0b[01]+$/i,Dm=/^\[object .+?Constructor\]$/,Mm=/^0o[0-7]+$/i,Im=/^(?:0|[1-9]\d*)$/,km=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Bn=/($^)/,Rm=/['\n\r\u2028\u2029\\]/g,Wn="\\ud800-\\udfff",Fm="\\u0300-\\u036f",zm="\\ufe20-\\ufe2f",Vm="\\u20d0-\\u20ff",ch=Fm+zm+Vm,lh="\\u2700-\\u27bf",fh="a-z\\xdf-\\xf6\\xf8-\\xff",Nm="\\xac\\xb1\\xd7\\xf7",Um="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",jm="\\u2000-\\u206f",Gm=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ph="A-Z\\xc0-\\xd6\\xd8-\\xde",dh="\\ufe0e\\ufe0f",mh=Nm+Um+jm+Gm,Ys="['\u2019]",Hm="["+Wn+"]",gh="["+mh+"]",qn="["+ch+"]",yh="\\d+",Bm="["+lh+"]",vh="["+fh+"]",bh="[^"+Wn+mh+yh+lh+fh+ph+"]",Xs="\\ud83c[\\udffb-\\udfff]",Wm="(?:"+qn+"|"+Xs+")",wh="[^"+Wn+"]",Js="(?:\\ud83c[\\udde6-\\uddff]){2}",Zs="[\\ud800-\\udbff][\\udc00-\\udfff]",mi="["+ph+"]",Ph="\\u200d",Th="(?:"+vh+"|"+bh+")",qm="(?:"+mi+"|"+bh+")",xh="(?:"+Ys+"(?:d|ll|m|re|s|t|ve))?",Sh="(?:"+Ys+"(?:D|LL|M|RE|S|T|VE))?",Ch=Wm+"?",_h="["+dh+"]?",$m="(?:"+Ph+"(?:"+[wh,Js,Zs].join("|")+")"+_h+Ch+")*",Qm="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Km="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Lh=_h+Ch+$m,Ym="(?:"+[Bm,Js,Zs].join("|")+")"+Lh,Xm="(?:"+[wh+qn+"?",qn,Js,Zs,Hm].join("|")+")",Jm=RegExp(Ys,"g"),Zm=RegExp(qn,"g"),ta=RegExp(Xs+"(?="+Xs+")|"+Xm+Lh,"g"),tg=RegExp([mi+"?"+vh+"+"+xh+"(?="+[gh,mi,"$"].join("|")+")",qm+"+"+Sh+"(?="+[gh,mi+Th,"$"].join("|")+")",mi+"?"+Th+"+"+xh,mi+"+"+Sh,Km,Qm,yh,Ym].join("|"),"g"),eg=RegExp("["+Ph+Wn+ch+dh+"]"),rg=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ig=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ng=-1,ft={};ft[Ns]=ft[Us]=ft[js]=ft[Gs]=ft[Hs]=ft[Bs]=ft[Ws]=ft[qs]=ft[$s]=!0,ft[pi]=ft[Un]=ft[rn]=ft[Yi]=ft[di]=ft[Xi]=ft[jn]=ft[Gn]=ft[ze]=ft[Ji]=ft[gr]=ft[Zi]=ft[Ve]=ft[tn]=ft[en]=!1;var ct={};ct[pi]=ct[Un]=ct[rn]=ct[di]=ct[Yi]=ct[Xi]=ct[Ns]=ct[Us]=ct[js]=ct[Gs]=ct[Hs]=ct[ze]=ct[Ji]=ct[gr]=ct[Zi]=ct[Ve]=ct[tn]=ct[Hn]=ct[Bs]=ct[Ws]=ct[qs]=ct[$s]=!0,ct[jn]=ct[Gn]=ct[en]=!1;var og={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},sg={"&":"&","<":"<",">":">",'"':""","'":"'"},ag={"&":"&","<":"<",">":">",""":'"',"'":"'"},ug={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},hg=parseFloat,cg=parseInt,Eh=typeof global=="object"&&global&&global.Object===Object&&global,lg=typeof self=="object"&&self&&self.Object===Object&&self,Ft=Eh||lg||Function("return this")(),ea=typeof r=="object"&&r&&!r.nodeType&&r,Qr=ea&&typeof t=="object"&&t&&!t.nodeType&&t,Ah=Qr&&Qr.exports===ea,ra=Ah&&Eh.process,Ce=function(){try{var P=Qr&&Qr.require&&Qr.require("util").types;return P||ra&&ra.binding&&ra.binding("util")}catch(_){}}(),Oh=Ce&&Ce.isArrayBuffer,Dh=Ce&&Ce.isDate,Mh=Ce&&Ce.isMap,Ih=Ce&&Ce.isRegExp,kh=Ce&&Ce.isSet,Rh=Ce&&Ce.isTypedArray;function de(P,_,S){switch(S.length){case 0:return P.call(_);case 1:return P.call(_,S[0]);case 2:return P.call(_,S[0],S[1]);case 3:return P.call(_,S[0],S[1],S[2])}return P.apply(_,S)}function fg(P,_,S,k){for(var B=-1,rt=P==null?0:P.length;++B-1}function ia(P,_,S){for(var k=-1,B=P==null?0:P.length;++k-1;);return S}function Hh(P,_){for(var S=P.length;S--&&gi(_,P[S],0)>-1;);return S}function Pg(P,_){for(var S=P.length,k=0;S--;)P[S]===_&&++k;return k}var Tg=aa(og),xg=aa(sg);function Sg(P){return"\\"+ug[P]}function Cg(P,_){return P==null?e:P[_]}function yi(P){return eg.test(P)}function _g(P){return rg.test(P)}function Lg(P){for(var _,S=[];!(_=P.next()).done;)S.push(_.value);return S}function la(P){var _=-1,S=Array(P.size);return P.forEach(function(k,B){S[++_]=[B,k]}),S}function Bh(P,_){return function(S){return P(_(S))}}function Mr(P,_){for(var S=-1,k=P.length,B=0,rt=[];++S-1}function dy(i,o){var u=this.__data__,c=co(u,i);return c<0?(++this.size,u.push([i,o])):u[c][1]=o,this}yr.prototype.clear=cy,yr.prototype.delete=ly,yr.prototype.get=fy,yr.prototype.has=py,yr.prototype.set=dy;function vr(i){var o=-1,u=i==null?0:i.length;for(this.clear();++o=o?i:o)),i}function Ae(i,o,u,c,f,g){var v,w=o&b,T=o&x,L=o&C;if(u&&(v=f?u(i,c,f,g):u(i)),v!==e)return v;if(!gt(i))return i;var E=W(i);if(E){if(v=vv(i),!w)return ae(i,v)}else{var A=Qt(i),M=A==Gn||A==nh;if(Nr(i))return _c(i,w);if(A==gr||A==pi||M&&!f){if(v=T||M?{}:Wc(i),!w)return T?av(i,Oy(v,i)):sv(i,rc(v,i))}else{if(!ct[A])return f?i:{};v=bv(i,A,w)}}g||(g=new Ue);var R=g.get(i);if(R)return R;g.set(i,v),wl(i)?i.forEach(function(U){v.add(Ae(U,o,u,U,i,g))}):vl(i)&&i.forEach(function(U,K){v.set(K,Ae(U,o,u,K,i,g))});var N=L?T?za:Fa:T?he:zt,$=E?e:N(i);return _e($||i,function(U,K){$&&(K=U,U=i[K]),cn(v,K,Ae(U,o,u,K,i,g))}),v}function Dy(i){var o=zt(i);return function(u){return ic(u,i,o)}}function ic(i,o,u){var c=u.length;if(i==null)return!c;for(i=ut(i);c--;){var f=u[c],g=o[f],v=i[f];if(v===e&&!(f in i)||!g(v))return!1}return!0}function nc(i,o,u){if(typeof i!="function")throw new Le(h);return yn(function(){i.apply(e,u)},o)}function ln(i,o,u,c){var f=-1,g=$n,v=!0,w=i.length,T=[],L=o.length;if(!w)return T;u&&(o=pt(o,me(u))),c?(g=ia,v=!1):o.length>=s&&(g=nn,v=!1,o=new Xr(o));t:for(;++ff?0:f+u),c=c===e||c>f?f:q(c),c<0&&(c+=f),c=u>c?0:Tl(c);u0&&u(w)?o>1?Ht(w,o-1,u,c,f):Dr(f,w):c||(f[f.length]=w)}return f}var va=Mc(),ac=Mc(!0);function Je(i,o){return i&&va(i,o,zt)}function ba(i,o){return i&&ac(i,o,zt)}function fo(i,o){return Or(o,function(u){return xr(i[u])})}function Zr(i,o){o=zr(o,i);for(var u=0,c=o.length;i!=null&&uo}function ky(i,o){return i!=null&&st.call(i,o)}function Ry(i,o){return i!=null&&o in ut(i)}function Fy(i,o,u){return i>=$t(o,u)&&i=120&&E.length>=120)?new Xr(v&&E):e}E=i[0];var A=-1,M=w[0];t:for(;++A-1;)w!==i&&io.call(w,T,1),io.call(i,T,1);return i}function vc(i,o){for(var u=i?o.length:0,c=u-1;u--;){var f=o[u];if(u==c||f!==g){var g=f;Tr(f)?io.call(i,f,1):Aa(i,f)}}return i}function _a(i,o){return i+so(Jh()*(o-i+1))}function Ky(i,o,u,c){for(var f=-1,g=Dt(oo((o-i)/(u||1)),0),v=S(g);g--;)v[c?g:++f]=i,i+=u;return v}function La(i,o){var u="";if(!i||o<1||o>Ar)return u;do o%2&&(u+=i),o=so(o/2),o&&(i+=i);while(o);return u}function Q(i,o){return Ba(Qc(i,o,ce),i+"")}function Yy(i){return ec(Li(i))}function Xy(i,o){var u=Li(i);return So(u,Jr(o,0,u.length))}function dn(i,o,u,c){if(!gt(i))return i;o=zr(o,i);for(var f=-1,g=o.length,v=g-1,w=i;w!=null&&++ff?0:f+o),u=u>f?f:u,u<0&&(u+=f),f=o>u?0:u-o>>>0,o>>>=0;for(var g=S(f);++c>>1,v=i[g];v!==null&&!ye(v)&&(u?v<=o:v=s){var L=o?null:lv(i);if(L)return Kn(L);v=!1,f=nn,T=new Xr}else T=o?[]:w;t:for(;++c=c?i:Oe(i,o,u)}var Cc=Gg||function(i){return Ft.clearTimeout(i)};function _c(i,o){if(o)return i.slice();var u=i.length,c=$h?$h(u):new i.constructor(u);return i.copy(c),c}function Ia(i){var o=new i.constructor(i.byteLength);return new eo(o).set(new eo(i)),o}function rv(i,o){var u=o?Ia(i.buffer):i.buffer;return new i.constructor(u,i.byteOffset,i.byteLength)}function iv(i){var o=new i.constructor(i.source,hh.exec(i));return o.lastIndex=i.lastIndex,o}function nv(i){return hn?ut(hn.call(i)):{}}function Lc(i,o){var u=o?Ia(i.buffer):i.buffer;return new i.constructor(u,i.byteOffset,i.length)}function Ec(i,o){if(i!==o){var u=i!==e,c=i===null,f=i===i,g=ye(i),v=o!==e,w=o===null,T=o===o,L=ye(o);if(!w&&!L&&!g&&i>o||g&&v&&T&&!w&&!L||c&&v&&T||!u&&T||!f)return 1;if(!c&&!g&&!L&&i=w)return T;var L=u[c];return T*(L=="desc"?-1:1)}}return i.index-o.index}function Ac(i,o,u,c){for(var f=-1,g=i.length,v=u.length,w=-1,T=o.length,L=Dt(g-v,0),E=S(T+L),A=!c;++w1?u[f-1]:e,v=f>2?u[2]:e;for(g=i.length>3&&typeof g=="function"?(f--,g):e,v&&te(u[0],u[1],v)&&(g=f<3?e:g,f=1),o=ut(o);++c-1?f[g?o[v]:v]:e}}function Rc(i){return Pr(function(o){var u=o.length,c=u,f=Ee.prototype.thru;for(i&&o.reverse();c--;){var g=o[c];if(typeof g!="function")throw new Le(h);if(f&&!v&&To(g)=="wrapper")var v=new Ee([],!0)}for(c=v?c:u;++c1&&X.reverse(),E&&Tw))return!1;var L=g.get(i),E=g.get(o);if(L&&E)return L==o&&E==i;var A=-1,M=!0,R=u&I?new Xr:e;for(g.set(i,o),g.set(o,i);++A1?"& ":"")+o[c],o=o.join(u>2?", ":" "),i.replace(Tm,`{ /* [wrapped with `+o+`] */ `)}function Pv(i){return W(i)||ri(i)||!!(Yh&&i&&i[Yh])}function Tr(i,o){var u=typeof i;return o=o!=null?o:Ar,!!o&&(u=="number"||u!="symbol"&&Im.test(i))&&i>-1&&i%1==0&&i0){if(++o>=Yd)return arguments[0]}else o=0;return i.apply(e,arguments)}}function So(i,o){var u=-1,c=i.length,f=c-1;for(o=o===e?c:o;++u1?i[o-1]:e;return u=typeof u=="function"?(i.pop(),u):e,sl(i,u)});function al(i){var o=d(i);return o.__chain__=!0,o}function M0(i,o){return o(i),i}function Co(i,o){return o(i)}var I0=Pr(function(i){var o=i.length,u=o?i[0]:0,c=this.__wrapped__,f=function(g){return ya(g,i)};return o>1||this.__actions__.length||!(c instanceof Y)||!Tr(u)?this.thru(f):(c=c.slice(u,+u+(o?1:0)),c.__actions__.push({func:Co,args:[f],thisArg:e}),new Ee(c,this.__chain__).thru(function(g){return o&&!g.length&&g.push(e),g}))});function k0(){return al(this)}function R0(){return new Ee(this.value(),this.__chain__)}function F0(){this.__values__===e&&(this.__values__=Pl(this.value()));var i=this.__index__>=this.__values__.length,o=i?e:this.__values__[this.__index__++];return{done:i,value:o}}function z0(){return this}function V0(i){for(var o,u=this;u instanceof ho;){var c=tl(u);c.__index__=0,c.__values__=e,o?f.__wrapped__=c:o=c;var f=c;u=u.__wrapped__}return f.__wrapped__=i,o}function N0(){var i=this.__wrapped__;if(i instanceof Y){var o=i;return this.__actions__.length&&(o=new Y(this)),o=o.reverse(),o.__actions__.push({func:Co,args:[Wa],thisArg:e}),new Ee(o,this.__chain__)}return this.thru(Wa)}function U0(){return xc(this.__wrapped__,this.__actions__)}var j0=yo(function(i,o,u){st.call(i,u)?++i[u]:br(i,u,1)});function G0(i,o,u){var c=W(i)?Fh:My;return u&&te(i,o,u)&&(o=e),c(i,V(o,3))}function H0(i,o){var u=W(i)?Or:sc;return u(i,V(o,3))}var B0=kc(el),W0=kc(rl);function q0(i,o){return Ht(_o(i,o),1)}function $0(i,o){return Ht(_o(i,o),$r)}function Q0(i,o,u){return u=u===e?1:q(u),Ht(_o(i,o),u)}function ul(i,o){var u=W(i)?_e:Rr;return u(i,V(o,3))}function hl(i,o){var u=W(i)?pg:oc;return u(i,V(o,3))}var K0=yo(function(i,o,u){st.call(i,u)?i[u].push(o):br(i,u,[o])});function Y0(i,o,u,c){i=ue(i)?i:Li(i),u=u&&!c?q(u):0;var f=i.length;return u<0&&(u=Dt(f+u,0)),Do(i)?u<=f&&i.indexOf(o,u)>-1:!!f&&gi(i,o,u)>-1}var X0=Q(function(i,o,u){var c=-1,f=typeof o=="function",g=ue(i)?S(i.length):[];return Rr(i,function(v){g[++c]=f?de(o,v,u):fn(v,o,u)}),g}),J0=yo(function(i,o,u){br(i,u,o)});function _o(i,o){var u=W(i)?pt:fc;return u(i,V(o,3))}function Z0(i,o,u,c){return i==null?[]:(W(o)||(o=o==null?[]:[o]),u=c?e:u,W(u)||(u=u==null?[]:[u]),gc(i,o,u))}var tb=yo(function(i,o,u){i[u?0:1].push(o)},function(){return[[],[]]});function eb(i,o,u){var c=W(i)?na:Uh,f=arguments.length<3;return c(i,V(o,4),u,f,Rr)}function rb(i,o,u){var c=W(i)?dg:Uh,f=arguments.length<3;return c(i,V(o,4),u,f,oc)}function ib(i,o){var u=W(i)?Or:sc;return u(i,Ao(V(o,3)))}function nb(i){var o=W(i)?ec:Yy;return o(i)}function ob(i,o,u){(u?te(i,o,u):o===e)?o=1:o=q(o);var c=W(i)?Ly:Xy;return c(i,o)}function sb(i){var o=W(i)?Ey:Zy;return o(i)}function ab(i){if(i==null)return 0;if(ue(i))return Do(i)?vi(i):i.length;var o=Qt(i);return o==ze||o==Ve?i.size:xa(i).length}function ub(i,o,u){var c=W(i)?oa:tv;return u&&te(i,o,u)&&(o=e),c(i,V(o,3))}var hb=Q(function(i,o){if(i==null)return[];var u=o.length;return u>1&&te(i,o[0],o[1])?o=[]:u>2&&te(o[0],o[1],o[2])&&(o=[o[0]]),gc(i,Ht(o,1),[])}),Lo=Hg||function(){return Ft.Date.now()};function cb(i,o){if(typeof o!="function")throw new Le(h);return i=q(i),function(){if(--i<1)return o.apply(this,arguments)}}function cl(i,o,u){return o=u?e:o,o=i&&o==null?i.length:o,wr(i,Se,e,e,e,e,o)}function ll(i,o){var u;if(typeof o!="function")throw new Le(h);return i=q(i),function(){return--i>0&&(u=o.apply(this,arguments)),i<=1&&(o=e),u}}var $a=Q(function(i,o,u){var c=F;if(u.length){var f=Mr(u,Ci($a));c|=At}return wr(i,c,o,u,f)}),fl=Q(function(i,o,u){var c=F|H;if(u.length){var f=Mr(u,Ci(fl));c|=At}return wr(o,c,i,u,f)});function pl(i,o,u){o=u?e:o;var c=wr(i,Z,e,e,e,e,e,o);return c.placeholder=pl.placeholder,c}function dl(i,o,u){o=u?e:o;var c=wr(i,ht,e,e,e,e,e,o);return c.placeholder=dl.placeholder,c}function ml(i,o,u){var c,f,g,v,w,T,L=0,E=!1,A=!1,M=!0;if(typeof i!="function")throw new Le(h);o=Me(o)||0,gt(u)&&(E=!!u.leading,A="maxWait"in u,g=A?Dt(Me(u.maxWait)||0,o):g,M="trailing"in u?!!u.trailing:M);function R(Tt){var Ge=c,Cr=f;return c=f=e,L=Tt,v=i.apply(Cr,Ge),v}function N(Tt){return L=Tt,w=yn(K,o),E?R(Tt):v}function $(Tt){var Ge=Tt-T,Cr=Tt-L,kl=o-Ge;return A?$t(kl,g-Cr):kl}function U(Tt){var Ge=Tt-T,Cr=Tt-L;return T===e||Ge>=o||Ge<0||A&&Cr>=g}function K(){var Tt=Lo();if(U(Tt))return X(Tt);w=yn(K,$(Tt))}function X(Tt){return w=e,M&&c?R(Tt):(c=f=e,v)}function ve(){w!==e&&Cc(w),L=0,c=T=f=w=e}function ee(){return w===e?v:X(Lo())}function be(){var Tt=Lo(),Ge=U(Tt);if(c=arguments,f=this,T=Tt,Ge){if(w===e)return N(T);if(A)return Cc(w),w=yn(K,o),R(T)}return w===e&&(w=yn(K,o)),v}return be.cancel=ve,be.flush=ee,be}var lb=Q(function(i,o){return nc(i,1,o)}),fb=Q(function(i,o,u){return nc(i,Me(o)||0,u)});function pb(i){return wr(i,Vs)}function Eo(i,o){if(typeof i!="function"||o!=null&&typeof o!="function")throw new Le(h);var u=function(){var c=arguments,f=o?o.apply(this,c):c[0],g=u.cache;if(g.has(f))return g.get(f);var v=i.apply(this,c);return u.cache=g.set(f,v)||g,v};return u.cache=new(Eo.Cache||vr),u}Eo.Cache=vr;function Ao(i){if(typeof i!="function")throw new Le(h);return function(){var o=arguments;switch(o.length){case 0:return!i.call(this);case 1:return!i.call(this,o[0]);case 2:return!i.call(this,o[0],o[1]);case 3:return!i.call(this,o[0],o[1],o[2])}return!i.apply(this,o)}}function db(i){return ll(2,i)}var mb=ev(function(i,o){o=o.length==1&&W(o[0])?pt(o[0],me(V())):pt(Ht(o,1),me(V()));var u=o.length;return Q(function(c){for(var f=-1,g=$t(c.length,u);++f=o}),ri=hc(function(){return arguments}())?hc:function(i){return bt(i)&&st.call(i,"callee")&&!Kh.call(i,"callee")},W=S.isArray,Ob=Oh?me(Oh):Vy;function ue(i){return i!=null&&Oo(i.length)&&!xr(i)}function Pt(i){return bt(i)&&ue(i)}function Db(i){return i===!0||i===!1||bt(i)&&Zt(i)==Yi}var Nr=Wg||ou,Mb=Dh?me(Dh):Ny;function Ib(i){return bt(i)&&i.nodeType===1&&!vn(i)}function kb(i){if(i==null)return!0;if(ue(i)&&(W(i)||typeof i=="string"||typeof i.splice=="function"||Nr(i)||_i(i)||ri(i)))return!i.length;var o=Qt(i);if(o==ze||o==Ve)return!i.size;if(gn(i))return!xa(i).length;for(var u in i)if(st.call(i,u))return!1;return!0}function Rb(i,o){return pn(i,o)}function Fb(i,o,u){u=typeof u=="function"?u:e;var c=u?u(i,o):e;return c===e?pn(i,o,e,u):!!c}function Ka(i){if(!bt(i))return!1;var o=Zt(i);return o==jn||o==om||typeof i.message=="string"&&typeof i.name=="string"&&!vn(i)}function zb(i){return typeof i=="number"&&Xh(i)}function xr(i){if(!gt(i))return!1;var o=Zt(i);return o==Gn||o==nh||o==nm||o==am}function yl(i){return typeof i=="number"&&i==q(i)}function Oo(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=Ar}function gt(i){var o=typeof i;return i!=null&&(o=="object"||o=="function")}function bt(i){return i!=null&&typeof i=="object"}var vl=Mh?me(Mh):jy;function Vb(i,o){return i===o||Ta(i,o,Na(o))}function Nb(i,o,u){return u=typeof u=="function"?u:e,Ta(i,o,Na(o),u)}function Ub(i){return bl(i)&&i!=+i}function jb(i){if(Sv(i))throw new B(a);return cc(i)}function Gb(i){return i===null}function Hb(i){return i==null}function bl(i){return typeof i=="number"||bt(i)&&Zt(i)==Ji}function vn(i){if(!bt(i)||Zt(i)!=gr)return!1;var o=ro(i);if(o===null)return!0;var u=st.call(o,"constructor")&&o.constructor;return typeof u=="function"&&u instanceof u&&Jn.call(u)==Ng}var Ya=Ih?me(Ih):Gy;function Bb(i){return yl(i)&&i>=-Ar&&i<=Ar}var wl=kh?me(kh):Hy;function Do(i){return typeof i=="string"||!W(i)&&bt(i)&&Zt(i)==tn}function ye(i){return typeof i=="symbol"||bt(i)&&Zt(i)==Hn}var _i=Rh?me(Rh):By;function Wb(i){return i===e}function qb(i){return bt(i)&&Qt(i)==en}function $b(i){return bt(i)&&Zt(i)==hm}var Qb=Po(Sa),Kb=Po(function(i,o){return i<=o});function Pl(i){if(!i)return[];if(ue(i))return Do(i)?Ne(i):ae(i);if(on&&i[on])return Lg(i[on]());var o=Qt(i),u=o==ze?la:o==Ve?Kn:Li;return u(i)}function Sr(i){if(!i)return i===0?i:0;if(i=Me(i),i===$r||i===-$r){var o=i<0?-1:1;return o*tm}return i===i?i:0}function q(i){var o=Sr(i),u=o%1;return o===o?u?o-u:o:0}function Tl(i){return i?Jr(q(i),0,Xe):0}function Me(i){if(typeof i=="number")return i;if(ye(i))return Nn;if(gt(i)){var o=typeof i.valueOf=="function"?i.valueOf():i;i=gt(o)?o+"":o}if(typeof i!="string")return i===0?i:+i;i=jh(i);var u=Om.test(i);return u||Mm.test(i)?cg(i.slice(2),u?2:8):Am.test(i)?Nn:+i}function xl(i){return Ze(i,he(i))}function Yb(i){return i?Jr(q(i),-Ar,Ar):i===0?i:0}function nt(i){return i==null?"":ge(i)}var Xb=xi(function(i,o){if(gn(o)||ue(o)){Ze(o,zt(o),i);return}for(var u in o)st.call(o,u)&&cn(i,u,o[u])}),Sl=xi(function(i,o){Ze(o,he(o),i)}),Mo=xi(function(i,o,u,c){Ze(o,he(o),i,c)}),Jb=xi(function(i,o,u,c){Ze(o,zt(o),i,c)}),Zb=Pr(ya);function tw(i,o){var u=Ti(i);return o==null?u:rc(u,o)}var ew=Q(function(i,o){i=ut(i);var u=-1,c=o.length,f=c>2?o[2]:e;for(f&&te(o[0],o[1],f)&&(c=1);++u1),g}),Ze(i,za(i),u),c&&(u=Ae(u,b|x|C,fv));for(var f=o.length;f--;)Aa(u,o[f]);return u});function bw(i,o){return _l(i,Ao(V(o)))}var ww=Pr(function(i,o){return i==null?{}:$y(i,o)});function _l(i,o){if(i==null)return{};var u=pt(za(i),function(c){return[c]});return o=V(o),yc(i,u,function(c,f){return o(c,f[0])})}function Pw(i,o,u){o=zr(o,i);var c=-1,f=o.length;for(f||(f=1,i=e);++co){var c=i;i=o,o=c}if(u||i%1||o%1){var f=Jh();return $t(i+f*(o-i+hg("1e-"+((f+"").length-1))),o)}return _a(i,o)}var Mw=Si(function(i,o,u){return o=o.toLowerCase(),i+(u?Al(o):o)});function Al(i){return Za(nt(i).toLowerCase())}function Ol(i){return i=nt(i),i&&i.replace(km,Tg).replace(Zm,"")}function Iw(i,o,u){i=nt(i),o=ge(o);var c=i.length;u=u===e?c:Jr(q(u),0,c);var f=u;return u-=o.length,u>=0&&i.slice(u,f)==o}function kw(i){return i=nt(i),i&&dm.test(i)?i.replace(ah,xg):i}function Rw(i){return i=nt(i),i&&wm.test(i)?i.replace(Qs,"\\$&"):i}var Fw=Si(function(i,o,u){return i+(u?"-":"")+o.toLowerCase()}),zw=Si(function(i,o,u){return i+(u?" ":"")+o.toLowerCase()}),Vw=Ic("toLowerCase");function Nw(i,o,u){i=nt(i),o=q(o);var c=o?vi(i):0;if(!o||c>=o)return i;var f=(o-c)/2;return wo(so(f),u)+i+wo(oo(f),u)}function Uw(i,o,u){i=nt(i),o=q(o);var c=o?vi(i):0;return o&&c>>0,u?(i=nt(i),i&&(typeof o=="string"||o!=null&&!Ya(o))&&(o=ge(o),!o&&yi(i))?Vr(Ne(i),0,u):i.split(o,u)):[]}var $w=Si(function(i,o,u){return i+(u?" ":"")+Za(o)});function Qw(i,o,u){return i=nt(i),u=u==null?0:Jr(q(u),0,i.length),o=ge(o),i.slice(u,u+o.length)==o}function Kw(i,o,u){var c=d.templateSettings;u&&te(i,o,u)&&(o=e),i=nt(i),o=Mo({},o,c,Uc);var f=Mo({},o.imports,c.imports,Uc),g=zt(f),v=ca(f,g),w,T,L=0,E=o.interpolate||Bn,A="__p += '",M=fa((o.escape||Bn).source+"|"+E.source+"|"+(E===uh?Em:Bn).source+"|"+(o.evaluate||Bn).source+"|$","g"),R="//# sourceURL="+(st.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ng+"]")+` `;i.replace(M,function(U,K,X,ve,ee,be){return X||(X=ve),A+=i.slice(L,be).replace(Rm,Sg),K&&(w=!0,A+=`' + diff --git a/dist/GridTilemap/CharBlockCache/CharBlockCache.d.ts b/dist/GridTilemap/CharBlockCache/CharBlockCache.d.ts deleted file mode 100644 index 60951d44..00000000 --- a/dist/GridTilemap/CharBlockCache/CharBlockCache.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { GridCharacter } from "../../GridCharacter/GridCharacter"; -import { Vector2 } from "../../Utils/Vector2/Vector2"; -import { LayerName } from "../GridTilemap"; -export declare class CharBlockCache { - private tilePosToCharacters; - private positionChangeStartedSubs; - private tilePosSetSubs; - private positionChangeFinishedSubs; - isCharBlockingAt(pos: Vector2, layer: LayerName, collisionGroups: string[]): boolean; - getCharactersAt(pos: Vector2, layer: string): Set; - addCharacter(character: GridCharacter): void; - removeCharacter(character: GridCharacter): void; - private add; - private addTilePosSetSub; - private addPositionChangeSub; - private addPositionChangeFinishedSub; - private posToString; -} diff --git a/dist/GridTilemap/GridTilemap.d.ts b/dist/GridTilemap/GridTilemap.d.ts deleted file mode 100644 index c8f3349f..00000000 --- a/dist/GridTilemap/GridTilemap.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { Direction } from "./../Direction/Direction"; -import { Vector2 } from "../Utils/Vector2/Vector2"; -import { GridCharacter } from "../GridCharacter/GridCharacter"; -export declare type LayerName = string | undefined; -export declare class GridTilemap { - private tilemap; - private static readonly ALWAYS_TOP_PROP_NAME; - private static readonly CHAR_LAYER_PROP_NAME; - private static readonly HEIGHT_SHIFT_PROP_NAME; - private static readonly ONE_WAY_COLLIDE_PROP_PREFIX; - private static readonly Z_INDEX_PADDING; - private characters; - private charBlockCache; - private charLayerDepths; - private transitions; - constructor(tilemap: Phaser.Tilemaps.Tilemap); - addCharacter(character: GridCharacter): void; - removeCharacter(charId: string): void; - getCharacters(): GridCharacter[]; - getCharactersAt(position: Vector2, layer: string): Set; - isBlocking(charLayer: string | undefined, pos: Vector2, collisionGroups: string[], direction?: Direction): boolean; - hasBlockingTile(charLayer: string | undefined, pos: Vector2, direction?: Direction): boolean; - getTransition(pos: Vector2, fromLayer?: string): string | undefined; - setTransition(pos: Vector2, fromLayer: LayerName, toLayer: LayerName): void; - getTransitions(): Map>; - hasNoTile(pos: Vector2, charLayer?: string): boolean; - hasBlockingChar(pos: Vector2, layer: string | undefined, collisionGroups: string[]): boolean; - getTileWidth(): number; - getTileHeight(): number; - getDepthOfCharLayer(layerName: LayerName): number; - isInRange(pos: Vector2): boolean; - getTileSize(): Vector2; - tilePosToPixelPos(tilePosition: Vector2): Vector2; - getTileDistance(direction: Direction): Vector2; - toMapDirection(direction: Direction): Direction; - isIsometric(): boolean; - private isLayerBlockingAt; - private getCharLayerIndexes; - private findPrevAndCharLayer; - private getCollisionRelevantLayers; - private getLowestCharLayer; - private getLayerProp; - private hasLayerProp; - private isLayerAlwaysOnTop; - private isCharLayer; - private setLayerDepths; - private setDepth; - private createHeightShiftLayers; - private copyLayer; -} diff --git a/dist/Movement/FollowMovement/FollowMovement.d.ts b/dist/Movement/FollowMovement/FollowMovement.d.ts deleted file mode 100644 index f9f4c837..00000000 --- a/dist/Movement/FollowMovement/FollowMovement.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { NumberOfDirections } from "./../../Direction/Direction"; -import { GridTilemap } from "../../GridTilemap/GridTilemap"; -import { GridCharacter } from "../../GridCharacter/GridCharacter"; -import { Movement, MovementInfo } from "../Movement"; -import { NoPathFoundStrategy } from "../../Pathfinding/NoPathFoundStrategy"; -export declare class FollowMovement implements Movement { - private character; - private gridTilemap; - private charToFollow; - private numberOfDirections; - private distance; - private noPathFoundStrategy; - private targetMovement?; - constructor(character: GridCharacter, gridTilemap: GridTilemap, charToFollow: GridCharacter, numberOfDirections?: NumberOfDirections, distance?: number, noPathFoundStrategy?: NoPathFoundStrategy); - update(delta: number): void; - getInfo(): MovementInfo; - private updateTarget; -} diff --git a/dist/Pathfinding/Bfs/Bfs.d.ts b/dist/Pathfinding/Bfs/Bfs.d.ts deleted file mode 100644 index bcc0cae7..00000000 --- a/dist/Pathfinding/Bfs/Bfs.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { LayerPosition, ShortestPathAlgorithm } from "./../ShortestPathAlgorithm"; -export declare class Bfs implements ShortestPathAlgorithm { - getShortestPath(startPos: LayerPosition, targetPos: LayerPosition, getNeighbours: (pos: LayerPosition) => LayerPosition[]): { - path: LayerPosition[]; - closestToTarget: LayerPosition; - }; - private distance; - private pos2Str; - private equal; - private shortestPathBfs; - private returnPath; -} diff --git a/dist/Pathfinding/BidirectionalSearch/BidirectionalSearch.d.ts b/dist/Pathfinding/BidirectionalSearch/BidirectionalSearch.d.ts deleted file mode 100644 index f4b1a28e..00000000 --- a/dist/Pathfinding/BidirectionalSearch/BidirectionalSearch.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { LayerPosition, ShortestPathAlgorithm } from "../ShortestPathAlgorithm"; -export declare class BidirectionalSearch implements ShortestPathAlgorithm { - getShortestPath(startPos: LayerPosition, targetPos: LayerPosition, getNeighbours: (pos: LayerPosition) => LayerPosition[]): { - path: LayerPosition[]; - closestToTarget: LayerPosition; - }; - private distance; - private equal; - private shortestPathBfs; - private returnPath; - private getPathFromPrev; -} diff --git a/dist/Pathfinding/ShortestPathAlgorithm.d.ts b/dist/Pathfinding/ShortestPathAlgorithm.d.ts deleted file mode 100644 index 57edb839..00000000 --- a/dist/Pathfinding/ShortestPathAlgorithm.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { LayerName } from "../GridTilemap/GridTilemap"; -import { Vector2 } from "../Utils/Vector2/Vector2"; -export interface LayerPosition { - position: Vector2; - layer: LayerName; -} -export interface ShortestPathAlgorithm { - getShortestPath(startPos: LayerPosition, targetPos: LayerPosition, getNeighbours: (pos: LayerPosition) => LayerPosition[]): { - path: LayerPosition[]; - closestToTarget: LayerPosition; - }; -} diff --git a/dist/RandomMovement/RandomMovement.d.ts b/dist/RandomMovement/RandomMovement.d.ts deleted file mode 100644 index eb04ad6a..00000000 --- a/dist/RandomMovement/RandomMovement.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { GridCharacter } from "./../GridCharacter/GridCharacter"; -export declare class RandomMovement { - private delay; - private radius; - private movementTuple; - constructor(delay?: number, radius?: number); - setCharacter(character: GridCharacter): void; - update(delta: number): void; - private shouldContinueWalkingCurrentDirection; - private getFreeDirections; - private isWithinRadius; - private getFreeRandomDirection; - private getRandomInt; -} diff --git a/dist/TargetMovement/TargetMovement.d.ts b/dist/TargetMovement/TargetMovement.d.ts deleted file mode 100644 index 0bea22c3..00000000 --- a/dist/TargetMovement/TargetMovement.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { GridTilemap } from "./../GridTilemap/GridTilemap"; -import { GridCharacter } from "../GridCharacter/GridCharacter"; -import * as Phaser from "phaser"; -declare type Vector2 = Phaser.Math.Vector2; -declare const Vector2: typeof Phaser.Math.Vector2; -export declare class TargetMovement { - private tilemap; - private characters; - constructor(tilemap: GridTilemap); - addCharacter(character: GridCharacter, targetPos: Vector2, distance?: number, closestPointIfBlocked?: boolean): void; - removeCharacter(charId: string): void; - update(): void; - isBlocking: (targetPos: Vector2) => (pos: Vector2) => boolean; - clear(): void; - private noPathExists; - private getShortestPath; - private getDirOnShortestPath; -} -export {}; diff --git a/dist/Utils/DistanceUtilsFactory/DistanceUtilsFactory.d.ts b/dist/Utils/DistanceUtilsFactory/DistanceUtilsFactory.d.ts deleted file mode 100644 index 92825b95..00000000 --- a/dist/Utils/DistanceUtilsFactory/DistanceUtilsFactory.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { NumberOfDirections } from "./../../Direction/Direction"; -import { DistanceUtils } from "../DistanceUtils"; -export declare class DistanceUtilsFactory { - static create(numberOfDirections: NumberOfDirections): DistanceUtils; -} diff --git a/dist/Utils/LayerPositionUtils/LayerPositionUtils.d.ts b/dist/Utils/LayerPositionUtils/LayerPositionUtils.d.ts deleted file mode 100644 index 073c72de..00000000 --- a/dist/Utils/LayerPositionUtils/LayerPositionUtils.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { LayerPosition } from "./../../Pathfinding/ShortestPathAlgorithm"; -export declare class LayerPositionUtils { - static equal(position: LayerPosition, otherPosition: LayerPosition): boolean; - static copyOver(source: LayerPosition, target: LayerPosition): void; - static clone(layerPosition: LayerPosition): LayerPosition; - static toString(layerPosition: LayerPosition): string; -} diff --git a/dist/Utils/MockFactory/MockFactory.d.ts b/dist/Utils/MockFactory/MockFactory.d.ts deleted file mode 100644 index 8caaf15c..00000000 --- a/dist/Utils/MockFactory/MockFactory.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/// -export declare function createSpriteMock(): any; -export declare function createBlankLayerMock(): { - scale: number; - putTileAt: jest.Mock; - setDepth: jest.Mock; -}; -export declare function createTilemapMock(blankLayerMock?: any): { - layers: { - name: string; - tilemapLayer: { - setDepth: jest.Mock; - scale: number; - tileset: string; - }; - properties: { - name: string; - value: string; - }[]; - }[]; - tileWidth: number; - tileHeight: number; - width: number; - height: number; - getTileAt: jest.Mock; - hasTileAt: jest.Mock; - createBlankLayer: jest.Mock; -}; diff --git a/dist/cjs/package.json b/dist/cjs/package.json new file mode 100644 index 00000000..f1033d40 --- /dev/null +++ b/dist/cjs/package.json @@ -0,0 +1 @@ +{"type": "commonjs"}{"type": "commonjs"}{"type": "commonjs"} \ No newline at end of file diff --git a/dist/speedtests/RoomsTilemap.d.ts b/dist/cjs/speedtests/RoomsTilemap.d.ts similarity index 100% rename from dist/speedtests/RoomsTilemap.d.ts rename to dist/cjs/speedtests/RoomsTilemap.d.ts diff --git a/dist/speedtests/run.d.ts b/dist/cjs/speedtests/run.d.ts similarity index 100% rename from dist/speedtests/run.d.ts rename to dist/cjs/speedtests/run.d.ts diff --git a/dist/speedtests/tests/BfsSpeed.d.ts b/dist/cjs/speedtests/tests/BfsSpeed.d.ts similarity index 100% rename from dist/speedtests/tests/BfsSpeed.d.ts rename to dist/cjs/speedtests/tests/BfsSpeed.d.ts diff --git a/dist/speedtests/tests/BidirSpeed.d.ts b/dist/cjs/speedtests/tests/BidirSpeed.d.ts similarity index 100% rename from dist/speedtests/tests/BidirSpeed.d.ts rename to dist/cjs/speedtests/tests/BidirSpeed.d.ts diff --git a/dist/src/Collisions/CollisionStrategy.d.ts b/dist/cjs/src/Collisions/CollisionStrategy.d.ts similarity index 100% rename from dist/src/Collisions/CollisionStrategy.d.ts rename to dist/cjs/src/Collisions/CollisionStrategy.d.ts diff --git a/dist/src/Datastructures/Queue/Queue.d.ts b/dist/cjs/src/Datastructures/Queue/Queue.d.ts similarity index 100% rename from dist/src/Datastructures/Queue/Queue.d.ts rename to dist/cjs/src/Datastructures/Queue/Queue.d.ts diff --git a/dist/Datastructures/Queue/Queue.test.d.ts b/dist/cjs/src/Datastructures/Queue/Queue.test.d.ts similarity index 100% rename from dist/Datastructures/Queue/Queue.test.d.ts rename to dist/cjs/src/Datastructures/Queue/Queue.test.d.ts diff --git a/dist/src/Direction/Direction.d.ts b/dist/cjs/src/Direction/Direction.d.ts similarity index 92% rename from dist/src/Direction/Direction.d.ts rename to dist/cjs/src/Direction/Direction.d.ts index bc26fe82..49f19470 100644 --- a/dist/src/Direction/Direction.d.ts +++ b/dist/cjs/src/Direction/Direction.d.ts @@ -1,5 +1,5 @@ -import { Position } from "../GridEngine"; -import { Vector2 } from "../Utils/Vector2/Vector2"; +import { Position } from "../GridEngine.js"; +import { Vector2 } from "../Utils/Vector2/Vector2.js"; export declare enum Direction { NONE = "none", LEFT = "left", diff --git a/dist/src/Direction/Direction.test.d.ts b/dist/cjs/src/Direction/Direction.test.d.ts similarity index 100% rename from dist/src/Direction/Direction.test.d.ts rename to dist/cjs/src/Direction/Direction.test.d.ts diff --git a/dist/src/GridCharacter/CharacterAnimation/CharacterAnimation.d.ts b/dist/cjs/src/GridCharacter/CharacterAnimation/CharacterAnimation.d.ts similarity index 92% rename from dist/src/GridCharacter/CharacterAnimation/CharacterAnimation.d.ts rename to dist/cjs/src/GridCharacter/CharacterAnimation/CharacterAnimation.d.ts index 33ffa1a3..dcd5bc0a 100644 --- a/dist/src/GridCharacter/CharacterAnimation/CharacterAnimation.d.ts +++ b/dist/cjs/src/GridCharacter/CharacterAnimation/CharacterAnimation.d.ts @@ -1,5 +1,5 @@ -import { Direction } from "./../../Direction/Direction"; -import { WalkingAnimationMapping } from "../../GridEngine"; +import { Direction } from "./../../Direction/Direction.js"; +import { WalkingAnimationMapping } from "../../GridEngine.js"; import { Observable } from "rxjs"; export type CharacterIndex = number; /** Frame numbers for one movement direction */ diff --git a/dist/GridCharacter/CharacterAnimation/CharacterAnimation.test.d.ts b/dist/cjs/src/GridCharacter/CharacterAnimation/CharacterAnimation.test.d.ts similarity index 100% rename from dist/GridCharacter/CharacterAnimation/CharacterAnimation.test.d.ts rename to dist/cjs/src/GridCharacter/CharacterAnimation/CharacterAnimation.test.d.ts diff --git a/dist/src/GridCharacter/CharacterFilter/CharacterFilter.d.ts b/dist/cjs/src/GridCharacter/CharacterFilter/CharacterFilter.d.ts similarity index 97% rename from dist/src/GridCharacter/CharacterFilter/CharacterFilter.d.ts rename to dist/cjs/src/GridCharacter/CharacterFilter/CharacterFilter.d.ts index 5fefda13..0c2852e0 100644 --- a/dist/src/GridCharacter/CharacterFilter/CharacterFilter.d.ts +++ b/dist/cjs/src/GridCharacter/CharacterFilter/CharacterFilter.d.ts @@ -1,4 +1,4 @@ -import { GridCharacter } from "../GridCharacter"; +import { GridCharacter } from "../GridCharacter.js"; /** * Options for filtering characters. */ diff --git a/dist/GridCharacter/CharacterFilter/CharacterFilter.test.d.ts b/dist/cjs/src/GridCharacter/CharacterFilter/CharacterFilter.test.d.ts similarity index 100% rename from dist/GridCharacter/CharacterFilter/CharacterFilter.test.d.ts rename to dist/cjs/src/GridCharacter/CharacterFilter/CharacterFilter.test.d.ts diff --git a/dist/src/GridCharacter/GridCharacter.d.ts b/dist/cjs/src/GridCharacter/GridCharacter.d.ts similarity index 91% rename from dist/src/GridCharacter/GridCharacter.d.ts rename to dist/cjs/src/GridCharacter/GridCharacter.d.ts index 23eaf8ee..38346b60 100644 --- a/dist/src/GridCharacter/GridCharacter.d.ts +++ b/dist/cjs/src/GridCharacter/GridCharacter.d.ts @@ -1,12 +1,12 @@ -import { LayerVecPos } from "./../Pathfinding/ShortestPathAlgorithm"; -import { NumberOfDirections } from "./../Direction/Direction"; -import { Direction } from "../Direction/Direction"; +import { LayerVecPos } from "./../Pathfinding/ShortestPathAlgorithm.js"; +import { NumberOfDirections } from "./../Direction/Direction.js"; +import { Direction } from "../Direction/Direction.js"; import { Subject } from "rxjs"; -import { CharLayer, Position } from "../GridEngine"; -import { Movement } from "../Movement/Movement"; -import { Vector2 } from "../Utils/Vector2/Vector2"; +import { CharLayer, Position } from "../GridEngine.js"; +import { Movement } from "../Movement/Movement.js"; +import { Vector2 } from "../Utils/Vector2/Vector2.js"; import * as Phaser from "phaser"; -import { GridTilemap } from "../GridTilemap/GridTilemap"; +import { GridTilemap } from "../GridTilemap/GridTilemap.js"; export declare const MAX_MOVEMENT_PROGRESS = 1000; export type CharId = string; export type GameObject = Phaser.GameObjects.Container | Phaser.GameObjects.Sprite; diff --git a/dist/GridCharacter/GridCharacter.test.d.ts b/dist/cjs/src/GridCharacter/GridCharacter.test.d.ts similarity index 100% rename from dist/GridCharacter/GridCharacter.test.d.ts rename to dist/cjs/src/GridCharacter/GridCharacter.test.d.ts diff --git a/dist/src/GridEngine.d.ts b/dist/cjs/src/GridEngine.d.ts similarity index 96% rename from dist/src/GridEngine.d.ts rename to dist/cjs/src/GridEngine.d.ts index fc092033..6f03145b 100644 --- a/dist/src/GridEngine.d.ts +++ b/dist/cjs/src/GridEngine.d.ts @@ -1,26 +1,26 @@ -import { CollisionStrategy } from "./Collisions/CollisionStrategy"; -import { Finished, MoveToConfig, MoveToInfo, MoveToResult } from "./Movement/TargetMovement/TargetMovement"; -import { PositionChange } from "./GridCharacter/GridCharacter"; -import { Direction, NumberOfDirections, directionFromPos } from "./Direction/Direction"; +import { CollisionStrategy } from "./Collisions/CollisionStrategy.js"; +import { Finished, MoveToConfig, MoveToInfo, MoveToResult } from "./Movement/TargetMovement/TargetMovement.js"; +import { PositionChange } from "./GridCharacter/GridCharacter.js"; +import { Direction, NumberOfDirections, directionFromPos } from "./Direction/Direction.js"; import { Observable } from "rxjs"; -import { NoPathFoundStrategy } from "./Pathfinding/NoPathFoundStrategy"; -import { PathBlockedStrategy } from "./Pathfinding/PathBlockedStrategy"; -import { MovementInfo } from "./Movement/Movement"; -import { CharacterIndex, FrameRow } from "./GridCharacter/CharacterAnimation/CharacterAnimation"; -import { CharacterFilteringOptions } from "./GridCharacter/CharacterFilter/CharacterFilter"; -import { IsPositionAllowedFn, PathfindingOptions } from "./Pathfinding/Pathfinding"; -import { ShortestPathAlgorithmType } from "./Pathfinding/ShortestPathAlgorithm"; -import { GridEngineHeadless, TileSizePerSecond, GridEngineConfigHeadless, CollisionConfig, CharacterDataHeadless } from "./GridEngineHeadless"; -import { PhaserTilemap, TiledProject } from "./GridTilemap/Phaser/PhaserTilemap"; -import { Orientation, Tile, TileLayer, Tilemap } from "./GridTilemap/Tilemap"; -import { PhaserTileLayer } from "./GridTilemap/Phaser/PhaserTileLayer"; -import { PhaserTile } from "./GridTilemap/Phaser/PhaserTile"; -import { QueueMovementConfig, QueuedPathBlockedStrategy, Finished as QueueMovementFinished, QueueMovementResult, QueueMovementEntry } from "./Movement/QueueMovement/QueueMovement"; -import { CharacterShift, CharacterShiftAction, CharLayer, FollowOptions, IGridEngine, LayerPosition, PathfindingResult, Position } from "./IGridEngine"; -import { ArrayTilemap, ArrayTilemapInputLayer } from "./GridTilemap/ArrayTilemap/ArrayTilemap"; -import { TiledTilemap } from "./GridTilemap/TiledTilemap/TiledTilemap"; -import { TiledLayer } from "./GridTilemap/TiledTilemap/TiledLayer"; -import { TiledTile } from "./GridTilemap/TiledTilemap/TiledTile"; +import { NoPathFoundStrategy } from "./Pathfinding/NoPathFoundStrategy.js"; +import { PathBlockedStrategy } from "./Pathfinding/PathBlockedStrategy.js"; +import { MovementInfo } from "./Movement/Movement.js"; +import { CharacterIndex, FrameRow } from "./GridCharacter/CharacterAnimation/CharacterAnimation.js"; +import { CharacterFilteringOptions } from "./GridCharacter/CharacterFilter/CharacterFilter.js"; +import { IsPositionAllowedFn, PathfindingOptions } from "./Pathfinding/Pathfinding.js"; +import { ShortestPathAlgorithmType } from "./Pathfinding/ShortestPathAlgorithm.js"; +import { GridEngineHeadless, TileSizePerSecond, GridEngineConfigHeadless, CollisionConfig, CharacterDataHeadless } from "./GridEngineHeadless.js"; +import { PhaserTilemap, TiledProject } from "./GridTilemap/Phaser/PhaserTilemap.js"; +import { Orientation, Tile, TileLayer, Tilemap } from "./GridTilemap/Tilemap.js"; +import { PhaserTileLayer } from "./GridTilemap/Phaser/PhaserTileLayer.js"; +import { PhaserTile } from "./GridTilemap/Phaser/PhaserTile.js"; +import { QueueMovementConfig, QueuedPathBlockedStrategy, Finished as QueueMovementFinished, QueueMovementResult, QueueMovementEntry } from "./Movement/QueueMovement/QueueMovement.js"; +import { CharacterShift, CharacterShiftAction, CharLayer, FollowOptions, IGridEngine, LayerPosition, PathfindingResult, Position } from "./IGridEngine.js"; +import { ArrayTilemap, ArrayTilemapInputLayer } from "./GridTilemap/ArrayTilemap/ArrayTilemap.js"; +import { TiledTilemap } from "./GridTilemap/TiledTilemap/TiledTilemap.js"; +import { TiledLayer } from "./GridTilemap/TiledTilemap/TiledLayer.js"; +import { TiledTile } from "./GridTilemap/TiledTilemap/TiledTile.js"; export { ArrayTilemap, ArrayTilemapInputLayer, CharacterDataHeadless, CharacterFilteringOptions, CharacterShift, CharacterShiftAction, CharLayer, CollisionConfig, CollisionStrategy, Direction, Finished, FollowOptions, FrameRow, GridEngineConfigHeadless, GridEngineHeadless, IGridEngine, IsPositionAllowedFn, LayerPosition, MovementInfo, MoveToConfig, MoveToInfo, MoveToResult, NoPathFoundStrategy, NumberOfDirections, Orientation, PathBlockedStrategy, PathfindingOptions, PathfindingResult, Position, PositionChange, PhaserTile, PhaserTileLayer, PhaserTilemap, QueueMovementConfig, QueueMovementEntry, QueueMovementFinished, QueueMovementResult, QueuedPathBlockedStrategy, ShortestPathAlgorithmType, Tile, TiledProject, TiledTilemap, TiledLayer, TiledTile, TileLayer, Tilemap, TileSizePerSecond, directionFromPos, }; /** * Configuration object for initializing GridEngine. diff --git a/dist/src/GridEngine.test.d.ts b/dist/cjs/src/GridEngine.test.d.ts similarity index 100% rename from dist/src/GridEngine.test.d.ts rename to dist/cjs/src/GridEngine.test.d.ts diff --git a/dist/src/GridEngineHeadless.d.ts b/dist/cjs/src/GridEngineHeadless.d.ts similarity index 97% rename from dist/src/GridEngineHeadless.d.ts rename to dist/cjs/src/GridEngineHeadless.d.ts index 3d3501af..6a7dc42c 100644 --- a/dist/src/GridEngineHeadless.d.ts +++ b/dist/cjs/src/GridEngineHeadless.d.ts @@ -1,18 +1,18 @@ -import { CollisionStrategy } from "./Collisions/CollisionStrategy"; -import { Finished, MoveToConfig, MoveToResult } from "./Movement/TargetMovement/TargetMovement"; -import { PositionChange } from "./GridCharacter/GridCharacter"; -import { Direction, NumberOfDirections } from "./Direction/Direction"; +import { CollisionStrategy } from "./Collisions/CollisionStrategy.js"; +import { Finished, MoveToConfig, MoveToResult } from "./Movement/TargetMovement/TargetMovement.js"; +import { PositionChange } from "./GridCharacter/GridCharacter.js"; +import { Direction, NumberOfDirections } from "./Direction/Direction.js"; import { Observable } from "rxjs"; -import { NoPathFoundStrategy } from "./Pathfinding/NoPathFoundStrategy"; -import { PathBlockedStrategy } from "./Pathfinding/PathBlockedStrategy"; -import { MovementInfo } from "./Movement/Movement"; -import { FrameRow } from "./GridCharacter/CharacterAnimation/CharacterAnimation"; -import { CharacterFilteringOptions } from "./GridCharacter/CharacterFilter/CharacterFilter"; -import { IsPositionAllowedFn, PathfindingOptions } from "./Pathfinding/Pathfinding"; -import { ShortestPathAlgorithmType } from "./Pathfinding/ShortestPathAlgorithm"; -import { Tilemap } from "./GridTilemap/Tilemap"; -import { CharacterShift, CharLayer, FollowOptions, IGridEngine, LayerPosition, PathfindingResult, Position } from "./IGridEngine"; -import { QueueMovementConfig, QueueMovementEntry, Finished as QueueMovementFinished } from "./Movement/QueueMovement/QueueMovement"; +import { NoPathFoundStrategy } from "./Pathfinding/NoPathFoundStrategy.js"; +import { PathBlockedStrategy } from "./Pathfinding/PathBlockedStrategy.js"; +import { MovementInfo } from "./Movement/Movement.js"; +import { FrameRow } from "./GridCharacter/CharacterAnimation/CharacterAnimation.js"; +import { CharacterFilteringOptions } from "./GridCharacter/CharacterFilter/CharacterFilter.js"; +import { IsPositionAllowedFn, PathfindingOptions } from "./Pathfinding/Pathfinding.js"; +import { ShortestPathAlgorithmType } from "./Pathfinding/ShortestPathAlgorithm.js"; +import { Tilemap } from "./GridTilemap/Tilemap.js"; +import { CharacterShift, CharLayer, FollowOptions, IGridEngine, LayerPosition, PathfindingResult, Position } from "./IGridEngine.js"; +import { QueueMovementConfig, QueueMovementEntry, Finished as QueueMovementFinished } from "./Movement/QueueMovement/QueueMovement.js"; export { CollisionStrategy, CharacterFilteringOptions, Direction, MoveToConfig, MoveToResult, Finished, FrameRow, NumberOfDirections, NoPathFoundStrategy, PathBlockedStrategy, MovementInfo, PositionChange, IsPositionAllowedFn, PathfindingOptions, ShortestPathAlgorithmType, }; export type TileSizePerSecond = number; /** diff --git a/dist/src/GridEngineHeadless.test.d.ts b/dist/cjs/src/GridEngineHeadless.test.d.ts similarity index 100% rename from dist/src/GridEngineHeadless.test.d.ts rename to dist/cjs/src/GridEngineHeadless.test.d.ts diff --git a/dist/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.d.ts b/dist/cjs/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.d.ts similarity index 92% rename from dist/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.d.ts rename to dist/cjs/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.d.ts index fae778b3..dfb51667 100644 --- a/dist/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.d.ts +++ b/dist/cjs/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.d.ts @@ -1,7 +1,7 @@ -import { CharacterData, GridEngineHeadless, WalkingAnimationMapping } from "../../GridEngine"; -import { CharacterAnimation } from "../../GridCharacter/CharacterAnimation/CharacterAnimation"; -import { Direction } from "../../Direction/Direction"; -import { GridTilemapPhaser } from "../GridTilemapPhaser/GridTilemapPhaser"; +import { CharacterData, GridEngineHeadless, WalkingAnimationMapping } from "../../GridEngine.js"; +import { CharacterAnimation } from "../../GridCharacter/CharacterAnimation/CharacterAnimation.js"; +import { Direction } from "../../Direction/Direction.js"; +import { GridTilemapPhaser } from "../GridTilemapPhaser/GridTilemapPhaser.js"; export declare class GridCharacterPhaser { private charData; private scene; diff --git a/dist/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.test.d.ts b/dist/cjs/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.test.d.ts similarity index 100% rename from dist/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.test.d.ts rename to dist/cjs/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.test.d.ts diff --git a/dist/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.d.ts b/dist/cjs/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.d.ts similarity index 87% rename from dist/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.d.ts rename to dist/cjs/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.d.ts index cfafad83..476a5568 100644 --- a/dist/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.d.ts +++ b/dist/cjs/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.d.ts @@ -1,5 +1,5 @@ -import { CharLayer, Direction } from "../../GridEngine"; -import { Vector2 } from "../../Utils/Vector2/Vector2"; +import { CharLayer, Direction } from "../../GridEngine.js"; +import { Vector2 } from "../../Utils/Vector2/Vector2.js"; export declare class GridTilemapPhaser { private tilemap; private static readonly ALWAYS_TOP_PROP_NAME; diff --git a/dist/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.test.d.ts b/dist/cjs/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.test.d.ts similarity index 100% rename from dist/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.test.d.ts rename to dist/cjs/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.test.d.ts diff --git a/dist/src/GridTilemap/ArrayTilemap/ArrayTilemap.d.ts b/dist/cjs/src/GridTilemap/ArrayTilemap/ArrayTilemap.d.ts similarity index 99% rename from dist/src/GridTilemap/ArrayTilemap/ArrayTilemap.d.ts rename to dist/cjs/src/GridTilemap/ArrayTilemap/ArrayTilemap.d.ts index 2451124a..a05ef85e 100644 --- a/dist/src/GridTilemap/ArrayTilemap/ArrayTilemap.d.ts +++ b/dist/cjs/src/GridTilemap/ArrayTilemap/ArrayTilemap.d.ts @@ -1,4 +1,4 @@ -import { Orientation, Tile, TileLayer, Tilemap } from "../Tilemap"; +import { Orientation, Tile, TileLayer, Tilemap } from "../Tilemap.js"; /** * Represents a layer for a simple array tilemap. */ diff --git a/dist/src/GridTilemap/ArrayTilemap/ArrayTilemap.test.d.ts b/dist/cjs/src/GridTilemap/ArrayTilemap/ArrayTilemap.test.d.ts similarity index 100% rename from dist/src/GridTilemap/ArrayTilemap/ArrayTilemap.test.d.ts rename to dist/cjs/src/GridTilemap/ArrayTilemap/ArrayTilemap.test.d.ts diff --git a/dist/src/GridTilemap/CharBlockCache/CharBlockCache.d.ts b/dist/cjs/src/GridTilemap/CharBlockCache/CharBlockCache.d.ts similarity index 89% rename from dist/src/GridTilemap/CharBlockCache/CharBlockCache.d.ts rename to dist/cjs/src/GridTilemap/CharBlockCache/CharBlockCache.d.ts index 2047aa6e..7eed841b 100644 --- a/dist/src/GridTilemap/CharBlockCache/CharBlockCache.d.ts +++ b/dist/cjs/src/GridTilemap/CharBlockCache/CharBlockCache.d.ts @@ -1,7 +1,7 @@ -import { GridCharacter } from "../../GridCharacter/GridCharacter"; -import { CharLayer } from "../../GridEngine"; -import { Vector2 } from "../../Utils/Vector2/Vector2"; -import { CollisionStrategy } from "../../Collisions/CollisionStrategy"; +import { GridCharacter } from "../../GridCharacter/GridCharacter.js"; +import { CharLayer } from "../../GridEngine.js"; +import { Vector2 } from "../../Utils/Vector2/Vector2.js"; +import { CollisionStrategy } from "../../Collisions/CollisionStrategy.js"; export declare class CharBlockCache { private collistionStrategy; private collisionGroupRelation?; diff --git a/dist/GridTilemap/CharBlockCache/CharBlockCache.test.d.ts b/dist/cjs/src/GridTilemap/CharBlockCache/CharBlockCache.test.d.ts similarity index 100% rename from dist/GridTilemap/CharBlockCache/CharBlockCache.test.d.ts rename to dist/cjs/src/GridTilemap/CharBlockCache/CharBlockCache.test.d.ts diff --git a/dist/src/GridTilemap/GridTilemap.d.ts b/dist/cjs/src/GridTilemap/GridTilemap.d.ts similarity index 88% rename from dist/src/GridTilemap/GridTilemap.d.ts rename to dist/cjs/src/GridTilemap/GridTilemap.d.ts index 695ef4ff..55db3d1a 100644 --- a/dist/src/GridTilemap/GridTilemap.d.ts +++ b/dist/cjs/src/GridTilemap/GridTilemap.d.ts @@ -1,11 +1,11 @@ -import { Direction } from "./../Direction/Direction"; -import { Vector2 } from "../Utils/Vector2/Vector2"; -import { Rect } from "../Utils/Rect/Rect"; -import { GridCharacter } from "../GridCharacter/GridCharacter"; -import { LayerVecPos } from "../Pathfinding/ShortestPathAlgorithm"; -import { CollisionStrategy } from "../Collisions/CollisionStrategy"; -import { CharLayer } from "../GridEngine"; -import { Tilemap } from "./Tilemap"; +import { Direction } from "./../Direction/Direction.js"; +import { Rect } from "../Utils/Rect/Rect.js"; +import { GridCharacter } from "../GridCharacter/GridCharacter.js"; +import { LayerVecPos } from "../Pathfinding/ShortestPathAlgorithm.js"; +import { CollisionStrategy } from "../Collisions/CollisionStrategy.js"; +import { CharLayer } from "../GridEngine.js"; +import { Tilemap } from "./Tilemap.js"; +import { Vector2 } from "../Utils/Vector2/Vector2.js"; export declare class GridTilemap { private tilemap; private collisionTilePropertyName; diff --git a/dist/GridTilemap/GridTilemap.test.d.ts b/dist/cjs/src/GridTilemap/GridTilemap.test.d.ts similarity index 100% rename from dist/GridTilemap/GridTilemap.test.d.ts rename to dist/cjs/src/GridTilemap/GridTilemap.test.d.ts diff --git a/dist/src/GridTilemap/Phaser/PhaserTile.d.ts b/dist/cjs/src/GridTilemap/Phaser/PhaserTile.d.ts similarity index 76% rename from dist/src/GridTilemap/Phaser/PhaserTile.d.ts rename to dist/cjs/src/GridTilemap/Phaser/PhaserTile.d.ts index 78eab767..1365ee4f 100644 --- a/dist/src/GridTilemap/Phaser/PhaserTile.d.ts +++ b/dist/cjs/src/GridTilemap/Phaser/PhaserTile.d.ts @@ -1,5 +1,5 @@ -import { Tile } from "../Tilemap"; -import { TiledProject } from "./PhaserTilemap"; +import { Tile } from "../Tilemap.js"; +import { TiledProject } from "./PhaserTilemap.js"; export declare class PhaserTile implements Tile { private phaserTile; private tiledProject?; diff --git a/dist/src/GridTilemap/Phaser/PhaserTile.test.d.ts b/dist/cjs/src/GridTilemap/Phaser/PhaserTile.test.d.ts similarity index 100% rename from dist/src/GridTilemap/Phaser/PhaserTile.test.d.ts rename to dist/cjs/src/GridTilemap/Phaser/PhaserTile.test.d.ts diff --git a/dist/src/GridTilemap/Phaser/PhaserTileLayer.d.ts b/dist/cjs/src/GridTilemap/Phaser/PhaserTileLayer.d.ts similarity index 79% rename from dist/src/GridTilemap/Phaser/PhaserTileLayer.d.ts rename to dist/cjs/src/GridTilemap/Phaser/PhaserTileLayer.d.ts index 89fd788f..f43b9c94 100644 --- a/dist/src/GridTilemap/Phaser/PhaserTileLayer.d.ts +++ b/dist/cjs/src/GridTilemap/Phaser/PhaserTileLayer.d.ts @@ -1,5 +1,5 @@ -import { TileLayer, Tile } from "../Tilemap"; -import { TiledProject } from "./PhaserTilemap"; +import { TileLayer, Tile } from "../Tilemap.js"; +import { TiledProject } from "./PhaserTilemap.js"; export declare class PhaserTileLayer implements TileLayer { private phaserTilemapLayer; private tiledProject?; diff --git a/dist/src/GridTilemap/Phaser/PhaserTileLayer.test.d.ts b/dist/cjs/src/GridTilemap/Phaser/PhaserTileLayer.test.d.ts similarity index 100% rename from dist/src/GridTilemap/Phaser/PhaserTileLayer.test.d.ts rename to dist/cjs/src/GridTilemap/Phaser/PhaserTileLayer.test.d.ts diff --git a/dist/src/GridTilemap/Phaser/PhaserTilemap.d.ts b/dist/cjs/src/GridTilemap/Phaser/PhaserTilemap.d.ts similarity index 99% rename from dist/src/GridTilemap/Phaser/PhaserTilemap.d.ts rename to dist/cjs/src/GridTilemap/Phaser/PhaserTilemap.d.ts index e46c4f80..a9d55c72 100644 --- a/dist/src/GridTilemap/Phaser/PhaserTilemap.d.ts +++ b/dist/cjs/src/GridTilemap/Phaser/PhaserTilemap.d.ts @@ -1,4 +1,4 @@ -import { TileLayer, Orientation, Tile, Tilemap } from "../Tilemap"; +import { TileLayer, Orientation, Tile, Tilemap } from "../Tilemap.js"; export interface TiledProject { propertyTypes: Array<{ name: string; diff --git a/dist/src/GridTilemap/Phaser/PhaserTilemap.test.d.ts b/dist/cjs/src/GridTilemap/Phaser/PhaserTilemap.test.d.ts similarity index 100% rename from dist/src/GridTilemap/Phaser/PhaserTilemap.test.d.ts rename to dist/cjs/src/GridTilemap/Phaser/PhaserTilemap.test.d.ts diff --git a/dist/src/GridTilemap/TileCollisionCache/TileCollisionCache.d.ts b/dist/cjs/src/GridTilemap/TileCollisionCache/TileCollisionCache.d.ts similarity index 67% rename from dist/src/GridTilemap/TileCollisionCache/TileCollisionCache.d.ts rename to dist/cjs/src/GridTilemap/TileCollisionCache/TileCollisionCache.d.ts index 276ec99e..81070b12 100644 --- a/dist/src/GridTilemap/TileCollisionCache/TileCollisionCache.d.ts +++ b/dist/cjs/src/GridTilemap/TileCollisionCache/TileCollisionCache.d.ts @@ -1,8 +1,8 @@ -import { Direction } from "../../Direction/Direction"; -import { GridTilemap } from "../GridTilemap"; -import { Tilemap } from "../Tilemap"; -import { Rect } from "../../Utils/Rect/Rect"; -import { CharLayer } from "../../IGridEngine"; +import { Direction } from "../../Direction/Direction.js"; +import { GridTilemap } from "../GridTilemap.js"; +import { Tilemap } from "../Tilemap.js"; +import { Rect } from "../../Utils/Rect/Rect.js"; +import { CharLayer } from "../../IGridEngine.js"; export declare class TileCollisionCache { private tilemap; private gridTilemap; diff --git a/dist/src/GridTilemap/TileCollisionCache/TileCollisionCache.test.d.ts b/dist/cjs/src/GridTilemap/TileCollisionCache/TileCollisionCache.test.d.ts similarity index 100% rename from dist/src/GridTilemap/TileCollisionCache/TileCollisionCache.test.d.ts rename to dist/cjs/src/GridTilemap/TileCollisionCache/TileCollisionCache.test.d.ts diff --git a/dist/src/GridTilemap/TiledTilemap/TiledLayer.d.ts b/dist/cjs/src/GridTilemap/TiledTilemap/TiledLayer.d.ts similarity index 76% rename from dist/src/GridTilemap/TiledTilemap/TiledLayer.d.ts rename to dist/cjs/src/GridTilemap/TiledTilemap/TiledLayer.d.ts index 0b552487..a1e9a77b 100644 --- a/dist/src/GridTilemap/TiledTilemap/TiledLayer.d.ts +++ b/dist/cjs/src/GridTilemap/TiledTilemap/TiledLayer.d.ts @@ -1,5 +1,5 @@ -import { Tile, TileLayer } from "../Tilemap"; -import { RawTiledLayer, RawTiledTileset } from "./TiledMap"; +import { Tile, TileLayer } from "../Tilemap.js"; +import { RawTiledLayer, RawTiledTileset } from "./TiledMap.js"; export declare class TiledLayer implements TileLayer { private layer; private data; diff --git a/dist/src/GridTilemap/TiledTilemap/TiledLayer.test.d.ts b/dist/cjs/src/GridTilemap/TiledTilemap/TiledLayer.test.d.ts similarity index 100% rename from dist/src/GridTilemap/TiledTilemap/TiledLayer.test.d.ts rename to dist/cjs/src/GridTilemap/TiledTilemap/TiledLayer.test.d.ts diff --git a/dist/src/GridTilemap/TiledTilemap/TiledMap.d.ts b/dist/cjs/src/GridTilemap/TiledTilemap/TiledMap.d.ts similarity index 100% rename from dist/src/GridTilemap/TiledTilemap/TiledMap.d.ts rename to dist/cjs/src/GridTilemap/TiledTilemap/TiledMap.d.ts diff --git a/dist/src/GridTilemap/TiledTilemap/TiledTile.d.ts b/dist/cjs/src/GridTilemap/TiledTilemap/TiledTile.d.ts similarity index 70% rename from dist/src/GridTilemap/TiledTilemap/TiledTile.d.ts rename to dist/cjs/src/GridTilemap/TiledTilemap/TiledTile.d.ts index c655ed03..891f8271 100644 --- a/dist/src/GridTilemap/TiledTilemap/TiledTile.d.ts +++ b/dist/cjs/src/GridTilemap/TiledTilemap/TiledTile.d.ts @@ -1,5 +1,5 @@ -import { Tile } from "../Tilemap"; -import { RawTiledTileset } from "./TiledMap"; +import { Tile } from "../Tilemap.js"; +import { RawTiledTileset } from "./TiledMap.js"; export declare class TiledTile implements Tile { private props; constructor(tilesets: RawTiledTileset[], tileId: number); diff --git a/dist/src/GridTilemap/TiledTilemap/TiledTile.test.d.ts b/dist/cjs/src/GridTilemap/TiledTilemap/TiledTile.test.d.ts similarity index 100% rename from dist/src/GridTilemap/TiledTilemap/TiledTile.test.d.ts rename to dist/cjs/src/GridTilemap/TiledTilemap/TiledTile.test.d.ts diff --git a/dist/src/GridTilemap/TiledTilemap/TiledTilemap.d.ts b/dist/cjs/src/GridTilemap/TiledTilemap/TiledTilemap.d.ts similarity index 98% rename from dist/src/GridTilemap/TiledTilemap/TiledTilemap.d.ts rename to dist/cjs/src/GridTilemap/TiledTilemap/TiledTilemap.d.ts index b4288ee2..83554359 100644 --- a/dist/src/GridTilemap/TiledTilemap/TiledTilemap.d.ts +++ b/dist/cjs/src/GridTilemap/TiledTilemap/TiledTilemap.d.ts @@ -1,4 +1,4 @@ -import { Orientation, Tile, TileLayer, Tilemap } from "../Tilemap"; +import { Orientation, Tile, TileLayer, Tilemap } from "../Tilemap.js"; export declare const CHAR_LAYER_PROP_NAME = "ge_charLayer"; /** * Simple implementation of the Tilemap interface, using a parsed version of a diff --git a/dist/src/GridTilemap/TiledTilemap/TiledTilemap.test.d.ts b/dist/cjs/src/GridTilemap/TiledTilemap/TiledTilemap.test.d.ts similarity index 100% rename from dist/src/GridTilemap/TiledTilemap/TiledTilemap.test.d.ts rename to dist/cjs/src/GridTilemap/TiledTilemap/TiledTilemap.test.d.ts diff --git a/dist/src/GridTilemap/Tilemap.d.ts b/dist/cjs/src/GridTilemap/Tilemap.d.ts similarity index 100% rename from dist/src/GridTilemap/Tilemap.d.ts rename to dist/cjs/src/GridTilemap/Tilemap.d.ts diff --git a/dist/src/IGridEngine.d.ts b/dist/cjs/src/IGridEngine.d.ts similarity index 98% rename from dist/src/IGridEngine.d.ts rename to dist/cjs/src/IGridEngine.d.ts index aad33753..8e1503e4 100644 --- a/dist/src/IGridEngine.d.ts +++ b/dist/cjs/src/IGridEngine.d.ts @@ -1,12 +1,12 @@ -import { Direction } from "./Direction/Direction"; -import { MovementInfo } from "./Movement/Movement"; -import { Finished, MoveToConfig } from "./Movement/TargetMovement/TargetMovement"; -import { QueueMovementConfig, QueueMovementEntry, Finished as QueueMovementFinished } from "./Movement/QueueMovement/QueueMovement"; +import { Direction } from "./Direction/Direction.js"; +import { MovementInfo } from "./Movement/Movement.js"; +import { Finished, MoveToConfig } from "./Movement/TargetMovement/TargetMovement.js"; +import { QueueMovementConfig, QueueMovementEntry, Finished as QueueMovementFinished } from "./Movement/QueueMovement/QueueMovement.js"; import { Observable } from "rxjs"; -import { CharacterFilteringOptions } from "./GridCharacter/CharacterFilter/CharacterFilter"; -import { PathfindingOptions } from "./Pathfinding/Pathfinding"; -import { PositionChange } from "./GridCharacter/GridCharacter"; -import { ShortestPathAlgorithmType } from "./Pathfinding/ShortestPathAlgorithm"; +import { CharacterFilteringOptions } from "./GridCharacter/CharacterFilter/CharacterFilter.js"; +import { PathfindingOptions } from "./Pathfinding/Pathfinding.js"; +import { PositionChange } from "./GridCharacter/GridCharacter.js"; +import { ShortestPathAlgorithmType } from "./Pathfinding/ShortestPathAlgorithm.js"; export type CharLayer = string | undefined; /** * Specifies a tile position along with a character layer. diff --git a/dist/src/Movement/FollowMovement/FollowMovement.d.ts b/dist/cjs/src/Movement/FollowMovement/FollowMovement.d.ts similarity index 78% rename from dist/src/Movement/FollowMovement/FollowMovement.d.ts rename to dist/cjs/src/Movement/FollowMovement/FollowMovement.d.ts index 42c33c6e..6f1caa60 100644 --- a/dist/src/Movement/FollowMovement/FollowMovement.d.ts +++ b/dist/cjs/src/Movement/FollowMovement/FollowMovement.d.ts @@ -1,8 +1,8 @@ -import { GridTilemap } from "../../GridTilemap/GridTilemap"; -import { GridCharacter } from "../../GridCharacter/GridCharacter"; -import { Movement, MovementInfo } from "../Movement"; -import { ShortestPathAlgorithmType } from "../../GridEngine"; -import { NoPathFoundStrategy } from "../../Pathfinding/NoPathFoundStrategy"; +import { GridTilemap } from "../../GridTilemap/GridTilemap.js"; +import { GridCharacter } from "../../GridCharacter/GridCharacter.js"; +import { Movement, MovementInfo } from "../Movement.js"; +import { ShortestPathAlgorithmType } from "../../GridEngine.js"; +import { NoPathFoundStrategy } from "../../Pathfinding/NoPathFoundStrategy.js"; export interface Options { distance?: number; noPathFoundStrategy?: NoPathFoundStrategy; diff --git a/dist/FollowMovement/FollowMovement.test.d.ts b/dist/cjs/src/Movement/FollowMovement/FollowMovement.test.d.ts similarity index 100% rename from dist/FollowMovement/FollowMovement.test.d.ts rename to dist/cjs/src/Movement/FollowMovement/FollowMovement.test.d.ts diff --git a/dist/src/Movement/Movement.d.ts b/dist/cjs/src/Movement/Movement.d.ts similarity index 100% rename from dist/src/Movement/Movement.d.ts rename to dist/cjs/src/Movement/Movement.d.ts diff --git a/dist/src/Movement/QueueMovement/QueueMovement.d.ts b/dist/cjs/src/Movement/QueueMovement/QueueMovement.d.ts similarity index 94% rename from dist/src/Movement/QueueMovement/QueueMovement.d.ts rename to dist/cjs/src/Movement/QueueMovement/QueueMovement.d.ts index 603034b7..86a9d067 100644 --- a/dist/src/Movement/QueueMovement/QueueMovement.d.ts +++ b/dist/cjs/src/Movement/QueueMovement/QueueMovement.d.ts @@ -1,11 +1,11 @@ -import { Direction } from "../../Direction/Direction"; -import { GridCharacter } from "../../GridCharacter/GridCharacter"; -import { GridTilemap } from "../../GridTilemap/GridTilemap"; -import { LayerVecPos } from "../../Pathfinding/ShortestPathAlgorithm"; -import { Movement, MovementInfo } from "../Movement"; +import { Direction } from "../../Direction/Direction.js"; +import { GridCharacter } from "../../GridCharacter/GridCharacter.js"; +import { GridTilemap } from "../../GridTilemap/GridTilemap.js"; +import { LayerVecPos } from "../../Pathfinding/ShortestPathAlgorithm.js"; +import { Movement, MovementInfo } from "../Movement.js"; import { Subject } from "rxjs"; -import { CharLayer, LayerPosition, Position } from "../../IGridEngine"; -import { Concrete } from "../../Utils/TypeUtils"; +import { CharLayer, LayerPosition, Position } from "../../IGridEngine.js"; +import { Concrete } from "../../Utils/TypeUtils.js"; /** * @category Queue Movement */ diff --git a/dist/src/Movement/QueueMovement/QueueMovement.test.d.ts b/dist/cjs/src/Movement/QueueMovement/QueueMovement.test.d.ts similarity index 100% rename from dist/src/Movement/QueueMovement/QueueMovement.test.d.ts rename to dist/cjs/src/Movement/QueueMovement/QueueMovement.test.d.ts diff --git a/dist/src/Movement/RandomMovement/RandomMovement.d.ts b/dist/cjs/src/Movement/RandomMovement/RandomMovement.d.ts similarity index 91% rename from dist/src/Movement/RandomMovement/RandomMovement.d.ts rename to dist/cjs/src/Movement/RandomMovement/RandomMovement.d.ts index 594968dc..e3222137 100644 --- a/dist/src/Movement/RandomMovement/RandomMovement.d.ts +++ b/dist/cjs/src/Movement/RandomMovement/RandomMovement.d.ts @@ -1,5 +1,5 @@ -import { GridCharacter } from "../../GridCharacter/GridCharacter"; -import { Movement, MovementInfo } from "../Movement"; +import { GridCharacter } from "../../GridCharacter/GridCharacter.js"; +import { Movement, MovementInfo } from "../Movement.js"; export declare class RandomMovement implements Movement { private character; private delay; diff --git a/dist/Movement/RandomMovement/RandomMovement.test.d.ts b/dist/cjs/src/Movement/RandomMovement/RandomMovement.test.d.ts similarity index 100% rename from dist/Movement/RandomMovement/RandomMovement.test.d.ts rename to dist/cjs/src/Movement/RandomMovement/RandomMovement.test.d.ts diff --git a/dist/Movement/TargetMovement/Retryable/Retryable.d.ts b/dist/cjs/src/Movement/TargetMovement/Retryable/Retryable.d.ts similarity index 100% rename from dist/Movement/TargetMovement/Retryable/Retryable.d.ts rename to dist/cjs/src/Movement/TargetMovement/Retryable/Retryable.d.ts diff --git a/dist/Movement/TargetMovement/Retryable/Retryable.test.d.ts b/dist/cjs/src/Movement/TargetMovement/Retryable/Retryable.test.d.ts similarity index 100% rename from dist/Movement/TargetMovement/Retryable/Retryable.test.d.ts rename to dist/cjs/src/Movement/TargetMovement/Retryable/Retryable.test.d.ts diff --git a/dist/src/Movement/TargetMovement/TargetMovement.d.ts b/dist/cjs/src/Movement/TargetMovement/TargetMovement.d.ts similarity index 96% rename from dist/src/Movement/TargetMovement/TargetMovement.d.ts rename to dist/cjs/src/Movement/TargetMovement/TargetMovement.d.ts index 8167b988..06153de6 100644 --- a/dist/src/Movement/TargetMovement/TargetMovement.d.ts +++ b/dist/cjs/src/Movement/TargetMovement/TargetMovement.d.ts @@ -1,12 +1,12 @@ -import { NoPathFoundStrategy } from "./../../Pathfinding/NoPathFoundStrategy"; -import { LayerVecPos, ShortestPathAlgorithmType } from "./../../Pathfinding/ShortestPathAlgorithm"; -import { GridTilemap } from "../../GridTilemap/GridTilemap"; -import { GridCharacter } from "../../GridCharacter/GridCharacter"; -import { Movement, MovementInfo } from "../Movement"; -import { PathBlockedStrategy } from "../../Pathfinding/PathBlockedStrategy"; -import { CharLayer, LayerPosition, Position } from "../../GridEngine"; +import { NoPathFoundStrategy } from "./../../Pathfinding/NoPathFoundStrategy.js"; +import { LayerVecPos, ShortestPathAlgorithmType } from "./../../Pathfinding/ShortestPathAlgorithm.js"; +import { GridTilemap } from "../../GridTilemap/GridTilemap.js"; +import { GridCharacter } from "../../GridCharacter/GridCharacter.js"; +import { Movement, MovementInfo } from "../Movement.js"; +import { PathBlockedStrategy } from "../../Pathfinding/PathBlockedStrategy.js"; +import { CharLayer, LayerPosition, Position } from "../../GridEngine.js"; import { Subject } from "rxjs"; -import { IsPositionAllowedFn } from "../../Pathfinding/Pathfinding"; +import { IsPositionAllowedFn } from "../../Pathfinding/Pathfinding.js"; /** * @category Pathfinding */ diff --git a/dist/Movement/TargetMovement/TargetMovement.test.d.ts b/dist/cjs/src/Movement/TargetMovement/TargetMovement.test.d.ts similarity index 100% rename from dist/Movement/TargetMovement/TargetMovement.test.d.ts rename to dist/cjs/src/Movement/TargetMovement/TargetMovement.test.d.ts diff --git a/dist/src/Pathfinding/AStar/AStar.d.ts b/dist/cjs/src/Pathfinding/AStar/AStar.d.ts similarity index 87% rename from dist/src/Pathfinding/AStar/AStar.d.ts rename to dist/cjs/src/Pathfinding/AStar/AStar.d.ts index 2bf48450..398b7037 100644 --- a/dist/src/Pathfinding/AStar/AStar.d.ts +++ b/dist/cjs/src/Pathfinding/AStar/AStar.d.ts @@ -1,4 +1,4 @@ -import { LayerVecPos, ShortestPathAlgorithm, ShortestPathResult } from "../ShortestPathAlgorithm"; +import { LayerVecPos, ShortestPathAlgorithm, ShortestPathResult } from "../ShortestPathAlgorithm.js"; export declare class AStar extends ShortestPathAlgorithm { findShortestPathImpl(startPos: LayerVecPos, targetPos: LayerVecPos): ShortestPathResult; private shortestPathBfs; diff --git a/dist/src/Pathfinding/AStar/AStar.test.d.ts b/dist/cjs/src/Pathfinding/AStar/AStar.test.d.ts similarity index 100% rename from dist/src/Pathfinding/AStar/AStar.test.d.ts rename to dist/cjs/src/Pathfinding/AStar/AStar.test.d.ts diff --git a/dist/src/Pathfinding/Bfs/Bfs.d.ts b/dist/cjs/src/Pathfinding/Bfs/Bfs.d.ts similarity index 87% rename from dist/src/Pathfinding/Bfs/Bfs.d.ts rename to dist/cjs/src/Pathfinding/Bfs/Bfs.d.ts index 9c419253..0c674837 100644 --- a/dist/src/Pathfinding/Bfs/Bfs.d.ts +++ b/dist/cjs/src/Pathfinding/Bfs/Bfs.d.ts @@ -1,4 +1,4 @@ -import { LayerVecPos, ShortestPathAlgorithm, ShortestPathResult } from "./../ShortestPathAlgorithm"; +import { LayerVecPos, ShortestPathAlgorithm, ShortestPathResult } from "./../ShortestPathAlgorithm.js"; export declare class Bfs extends ShortestPathAlgorithm { findShortestPathImpl(startPos: LayerVecPos, targetPos: LayerVecPos): ShortestPathResult; private equal; diff --git a/dist/Pathfinding/Bfs/Bfs.test.d.ts b/dist/cjs/src/Pathfinding/Bfs/Bfs.test.d.ts similarity index 100% rename from dist/Pathfinding/Bfs/Bfs.test.d.ts rename to dist/cjs/src/Pathfinding/Bfs/Bfs.test.d.ts diff --git a/dist/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.d.ts b/dist/cjs/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.d.ts similarity index 92% rename from dist/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.d.ts rename to dist/cjs/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.d.ts index f77349df..f857047c 100644 --- a/dist/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.d.ts +++ b/dist/cjs/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.d.ts @@ -1,4 +1,4 @@ -import { LayerVecPos, ShortestPathAlgorithm, ShortestPathResult } from "../ShortestPathAlgorithm"; +import { LayerVecPos, ShortestPathAlgorithm, ShortestPathResult } from "../ShortestPathAlgorithm.js"; export declare class BidirectionalSearch extends ShortestPathAlgorithm { findShortestPathImpl(startPos: LayerVecPos, targetPos: LayerVecPos): ShortestPathResult; private equal; diff --git a/dist/Pathfinding/BidirectionalSearch/BidirectionalSearch.test.d.ts b/dist/cjs/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.test.d.ts similarity index 100% rename from dist/Pathfinding/BidirectionalSearch/BidirectionalSearch.test.d.ts rename to dist/cjs/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.test.d.ts diff --git a/dist/src/Pathfinding/Jps4/Jps4.d.ts b/dist/cjs/src/Pathfinding/Jps4/Jps4.d.ts similarity index 83% rename from dist/src/Pathfinding/Jps4/Jps4.d.ts rename to dist/cjs/src/Pathfinding/Jps4/Jps4.d.ts index cd89dca3..ed19713f 100644 --- a/dist/src/Pathfinding/Jps4/Jps4.d.ts +++ b/dist/cjs/src/Pathfinding/Jps4/Jps4.d.ts @@ -1,8 +1,8 @@ -import { LayerVecPos, ShortestPathAlgorithm, ShortestPathResult } from "../ShortestPathAlgorithm"; -import { Direction } from "../../Direction/Direction"; -import { DistanceUtils } from "../../Utils/DistanceUtils"; -import { GridTilemap } from "../../GridTilemap/GridTilemap"; -import { PathfindingOptions } from "../Pathfinding"; +import { LayerVecPos, ShortestPathAlgorithm, ShortestPathResult } from "../ShortestPathAlgorithm.js"; +import { Direction } from "../../Direction/Direction.js"; +import { DistanceUtils } from "../../Utils/DistanceUtils.js"; +import { GridTilemap } from "../../GridTilemap/GridTilemap.js"; +import { PathfindingOptions } from "../Pathfinding.js"; export declare class Jps4 extends ShortestPathAlgorithm { private openSet; private g; diff --git a/dist/src/Pathfinding/Jps4/Jps4.test.d.ts b/dist/cjs/src/Pathfinding/Jps4/Jps4.test.d.ts similarity index 100% rename from dist/src/Pathfinding/Jps4/Jps4.test.d.ts rename to dist/cjs/src/Pathfinding/Jps4/Jps4.test.d.ts diff --git a/dist/src/Pathfinding/Jps8/Jps8.d.ts b/dist/cjs/src/Pathfinding/Jps8/Jps8.d.ts similarity index 65% rename from dist/src/Pathfinding/Jps8/Jps8.d.ts rename to dist/cjs/src/Pathfinding/Jps8/Jps8.d.ts index 40414a24..2b22f71c 100644 --- a/dist/src/Pathfinding/Jps8/Jps8.d.ts +++ b/dist/cjs/src/Pathfinding/Jps8/Jps8.d.ts @@ -1,7 +1,7 @@ -import { PathfindingOptions } from "../../GridEngineHeadless"; -import { GridTilemap } from "../../GridTilemap/GridTilemap"; -import { Jps4 } from "../Jps4/Jps4"; -import { LayerVecPos } from "../ShortestPathAlgorithm"; +import { PathfindingOptions } from "../../GridEngineHeadless.js"; +import { GridTilemap } from "../../GridTilemap/GridTilemap.js"; +import { Jps4 } from "../Jps4/Jps4.js"; +import { LayerVecPos } from "../ShortestPathAlgorithm.js"; export declare class Jps8 extends Jps4 { constructor(gridTilemap: GridTilemap, po?: PathfindingOptions); protected getForced(parent: LayerVecPos, node: LayerVecPos): LayerVecPos[]; diff --git a/dist/src/Pathfinding/Jps8/Jps8.test.d.ts b/dist/cjs/src/Pathfinding/Jps8/Jps8.test.d.ts similarity index 100% rename from dist/src/Pathfinding/Jps8/Jps8.test.d.ts rename to dist/cjs/src/Pathfinding/Jps8/Jps8.test.d.ts diff --git a/dist/src/Pathfinding/NoPathFoundStrategy.d.ts b/dist/cjs/src/Pathfinding/NoPathFoundStrategy.d.ts similarity index 100% rename from dist/src/Pathfinding/NoPathFoundStrategy.d.ts rename to dist/cjs/src/Pathfinding/NoPathFoundStrategy.d.ts diff --git a/dist/src/Pathfinding/PathBlockedStrategy.d.ts b/dist/cjs/src/Pathfinding/PathBlockedStrategy.d.ts similarity index 100% rename from dist/src/Pathfinding/PathBlockedStrategy.d.ts rename to dist/cjs/src/Pathfinding/PathBlockedStrategy.d.ts diff --git a/dist/src/Pathfinding/Pathfinding.d.ts b/dist/cjs/src/Pathfinding/Pathfinding.d.ts similarity index 93% rename from dist/src/Pathfinding/Pathfinding.d.ts rename to dist/cjs/src/Pathfinding/Pathfinding.d.ts index 22a4a6ce..dc8e1dee 100644 --- a/dist/src/Pathfinding/Pathfinding.d.ts +++ b/dist/cjs/src/Pathfinding/Pathfinding.d.ts @@ -1,8 +1,8 @@ -import { NumberOfDirections } from "../Direction/Direction"; -import { CharId } from "../GridCharacter/GridCharacter"; -import { Position } from "../GridEngine"; -import { GridTilemap } from "../GridTilemap/GridTilemap"; -import { LayerVecPos, ShortestPathAlgorithmType, ShortestPathResult } from "./ShortestPathAlgorithm"; +import { NumberOfDirections } from "../Direction/Direction.js"; +import { CharId } from "../GridCharacter/GridCharacter.js"; +import { Position } from "../GridEngine.js"; +import { GridTilemap } from "../GridTilemap/GridTilemap.js"; +import { LayerVecPos, ShortestPathAlgorithmType, ShortestPathResult } from "./ShortestPathAlgorithm.js"; /** * Configuration object for pathfinding. * diff --git a/dist/src/Pathfinding/Pathfinding.test.d.ts b/dist/cjs/src/Pathfinding/Pathfinding.test.d.ts similarity index 100% rename from dist/src/Pathfinding/Pathfinding.test.d.ts rename to dist/cjs/src/Pathfinding/Pathfinding.test.d.ts diff --git a/dist/src/Pathfinding/ShortestPathAlgorithm.d.ts b/dist/cjs/src/Pathfinding/ShortestPathAlgorithm.d.ts similarity index 87% rename from dist/src/Pathfinding/ShortestPathAlgorithm.d.ts rename to dist/cjs/src/Pathfinding/ShortestPathAlgorithm.d.ts index 2ab373ee..f190102c 100644 --- a/dist/src/Pathfinding/ShortestPathAlgorithm.d.ts +++ b/dist/cjs/src/Pathfinding/ShortestPathAlgorithm.d.ts @@ -1,8 +1,8 @@ -import { CharLayer, Direction } from "../GridEngine"; -import { GridTilemap } from "../GridTilemap/GridTilemap"; -import { Vector2 } from "../Utils/Vector2/Vector2"; -import { PathfindingOptions } from "./Pathfinding"; -import { Concrete } from "../Utils/TypeUtils"; +import { CharLayer, Direction } from "../GridEngine.js"; +import { GridTilemap } from "../GridTilemap/GridTilemap.js"; +import { Vector2 } from "../Utils/Vector2/Vector2.js"; +import { PathfindingOptions } from "./Pathfinding.js"; +import { Concrete } from "../Utils/TypeUtils.js"; export interface LayerVecPos { position: Vector2; layer: CharLayer; diff --git a/dist/Testing/Utils.d.ts b/dist/cjs/src/Testing/Utils.d.ts similarity index 100% rename from dist/Testing/Utils.d.ts rename to dist/cjs/src/Testing/Utils.d.ts diff --git a/dist/src/Utils/DistanceUtils.d.ts b/dist/cjs/src/Utils/DistanceUtils.d.ts similarity index 67% rename from dist/src/Utils/DistanceUtils.d.ts rename to dist/cjs/src/Utils/DistanceUtils.d.ts index 9e869fd3..942713bd 100644 --- a/dist/src/Utils/DistanceUtils.d.ts +++ b/dist/cjs/src/Utils/DistanceUtils.d.ts @@ -1,5 +1,5 @@ -import { Direction } from "../Direction/Direction"; -import { Vector2 } from "./Vector2/Vector2"; +import { Direction } from "../Direction/Direction.js"; +import { Vector2 } from "./Vector2/Vector2.js"; export interface DistanceUtils { distance(pos1: Vector2, pos2: Vector2): number; direction(from: Vector2, to: Vector2): Direction; diff --git a/dist/src/Utils/DistanceUtils4/DistanceUtils4.d.ts b/dist/cjs/src/Utils/DistanceUtils4/DistanceUtils4.d.ts similarity index 60% rename from dist/src/Utils/DistanceUtils4/DistanceUtils4.d.ts rename to dist/cjs/src/Utils/DistanceUtils4/DistanceUtils4.d.ts index 6a2c7e14..b36cece5 100644 --- a/dist/src/Utils/DistanceUtils4/DistanceUtils4.d.ts +++ b/dist/cjs/src/Utils/DistanceUtils4/DistanceUtils4.d.ts @@ -1,6 +1,6 @@ -import { Direction } from "../../Direction/Direction"; -import { Vector2 } from "../Vector2/Vector2"; -import { DistanceUtils } from "../DistanceUtils"; +import { Direction } from "../../Direction/Direction.js"; +import { Vector2 } from "../Vector2/Vector2.js"; +import { DistanceUtils } from "../DistanceUtils.js"; export declare class DistanceUtils4 implements DistanceUtils { distance(pos1: Vector2, pos2: Vector2): number; direction(from: Vector2, to: Vector2): Direction; diff --git a/dist/Utils/DistanceUtils4/DistanceUtils4.test.d.ts b/dist/cjs/src/Utils/DistanceUtils4/DistanceUtils4.test.d.ts similarity index 100% rename from dist/Utils/DistanceUtils4/DistanceUtils4.test.d.ts rename to dist/cjs/src/Utils/DistanceUtils4/DistanceUtils4.test.d.ts diff --git a/dist/src/Utils/DistanceUtils8/DistanceUtils8.d.ts b/dist/cjs/src/Utils/DistanceUtils8/DistanceUtils8.d.ts similarity index 60% rename from dist/src/Utils/DistanceUtils8/DistanceUtils8.d.ts rename to dist/cjs/src/Utils/DistanceUtils8/DistanceUtils8.d.ts index 92712ef5..5235d25a 100644 --- a/dist/src/Utils/DistanceUtils8/DistanceUtils8.d.ts +++ b/dist/cjs/src/Utils/DistanceUtils8/DistanceUtils8.d.ts @@ -1,6 +1,6 @@ -import { Direction } from "../../Direction/Direction"; -import { Vector2 } from "../Vector2/Vector2"; -import { DistanceUtils } from "../DistanceUtils"; +import { Direction } from "../../Direction/Direction.js"; +import { Vector2 } from "../Vector2/Vector2.js"; +import { DistanceUtils } from "../DistanceUtils.js"; export declare class DistanceUtils8 implements DistanceUtils { distance(pos1: Vector2, pos2: Vector2): number; neighbors(pos: Vector2): Vector2[]; diff --git a/dist/Utils/DistanceUtils8/DistanceUtils8.test.d.ts b/dist/cjs/src/Utils/DistanceUtils8/DistanceUtils8.test.d.ts similarity index 100% rename from dist/Utils/DistanceUtils8/DistanceUtils8.test.d.ts rename to dist/cjs/src/Utils/DistanceUtils8/DistanceUtils8.test.d.ts diff --git a/dist/cjs/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.d.ts b/dist/cjs/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.d.ts new file mode 100644 index 00000000..c1482117 --- /dev/null +++ b/dist/cjs/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.d.ts @@ -0,0 +1,5 @@ +import { NumberOfDirections } from "./../../Direction/Direction.js"; +import { DistanceUtils } from "../DistanceUtils.js"; +export declare class DistanceUtilsFactory { + static create(numberOfDirections: NumberOfDirections): DistanceUtils; +} diff --git a/dist/Utils/DistanceUtilsFactory/DistanceUtilsFactory.test.d.ts b/dist/cjs/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.test.d.ts similarity index 100% rename from dist/Utils/DistanceUtilsFactory/DistanceUtilsFactory.test.d.ts rename to dist/cjs/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.test.d.ts diff --git a/dist/src/Utils/LayerPositionUtils/LayerPositionUtils.d.ts b/dist/cjs/src/Utils/LayerPositionUtils/LayerPositionUtils.d.ts similarity index 88% rename from dist/src/Utils/LayerPositionUtils/LayerPositionUtils.d.ts rename to dist/cjs/src/Utils/LayerPositionUtils/LayerPositionUtils.d.ts index 71819eaa..7aa67c74 100644 --- a/dist/src/Utils/LayerPositionUtils/LayerPositionUtils.d.ts +++ b/dist/cjs/src/Utils/LayerPositionUtils/LayerPositionUtils.d.ts @@ -1,5 +1,5 @@ -import { LayerPosition } from "../../GridEngine"; -import { LayerVecPos } from "./../../Pathfinding/ShortestPathAlgorithm"; +import { LayerPosition } from "../../GridEngine.js"; +import { LayerVecPos } from "./../../Pathfinding/ShortestPathAlgorithm.js"; export declare class LayerPositionUtils { static equal(position: LayerVecPos, otherPosition: LayerVecPos): boolean; static copyOver(source: LayerVecPos, target: LayerVecPos): void; diff --git a/dist/Utils/LayerPositionUtils/LayerPositionUtils.test.d.ts b/dist/cjs/src/Utils/LayerPositionUtils/LayerPositionUtils.test.d.ts similarity index 100% rename from dist/Utils/LayerPositionUtils/LayerPositionUtils.test.d.ts rename to dist/cjs/src/Utils/LayerPositionUtils/LayerPositionUtils.test.d.ts diff --git a/dist/src/Utils/MockFactory/MockFactory.d.ts b/dist/cjs/src/Utils/MockFactory/MockFactory.d.ts similarity index 91% rename from dist/src/Utils/MockFactory/MockFactory.d.ts rename to dist/cjs/src/Utils/MockFactory/MockFactory.d.ts index 5efc4fe4..bedb2199 100644 --- a/dist/src/Utils/MockFactory/MockFactory.d.ts +++ b/dist/cjs/src/Utils/MockFactory/MockFactory.d.ts @@ -1,7 +1,7 @@ -import { GridTilemap } from "../../GridTilemap/GridTilemap"; -import { Vector2 } from "../Vector2/Vector2"; -import { LayerVecPos } from "../../Pathfinding/ShortestPathAlgorithm"; -import { TileLayer, Tilemap } from "../../GridTilemap/Tilemap"; +import { GridTilemap } from "../../GridTilemap/GridTilemap.js"; +import { Vector2 } from "../Vector2/Vector2.js"; +import { LayerVecPos } from "../../Pathfinding/ShortestPathAlgorithm.js"; +import { TileLayer, Tilemap } from "../../GridTilemap/Tilemap.js"; export interface TileCost { ge_cost?: number; ge_cost_left?: number; diff --git a/dist/src/Utils/MockFactory/MockPhaserTilemap.d.ts b/dist/cjs/src/Utils/MockFactory/MockPhaserTilemap.d.ts similarity index 74% rename from dist/src/Utils/MockFactory/MockPhaserTilemap.d.ts rename to dist/cjs/src/Utils/MockFactory/MockPhaserTilemap.d.ts index 12457d6a..b7d0a432 100644 --- a/dist/src/Utils/MockFactory/MockPhaserTilemap.d.ts +++ b/dist/cjs/src/Utils/MockFactory/MockPhaserTilemap.d.ts @@ -1,2 +1,2 @@ -import { CostMapLayer } from "./MockFactory"; +import { CostMapLayer } from "./MockFactory.js"; export declare function createPhaserTilemapStub(blockMap: Map, costMap?: CostMapLayer[]): Phaser.Tilemaps.Tilemap; diff --git a/dist/src/Utils/MockFactory/MockTilemap.d.ts b/dist/cjs/src/Utils/MockFactory/MockTilemap.d.ts similarity index 98% rename from dist/src/Utils/MockFactory/MockTilemap.d.ts rename to dist/cjs/src/Utils/MockFactory/MockTilemap.d.ts index 776688d3..00ea8346 100644 --- a/dist/src/Utils/MockFactory/MockTilemap.d.ts +++ b/dist/cjs/src/Utils/MockFactory/MockTilemap.d.ts @@ -1,4 +1,4 @@ -import { TileLayer, Orientation, Tile, Tilemap } from "../../GridTilemap/Tilemap"; +import { TileLayer, Orientation, Tile, Tilemap } from "../../GridTilemap/Tilemap.js"; export declare class MockTile implements Tile { private properties; constructor(properties?: Record); diff --git a/dist/Utils/RandomUtils/RandomUtils.d.ts b/dist/cjs/src/Utils/RandomUtils/RandomUtils.d.ts similarity index 100% rename from dist/Utils/RandomUtils/RandomUtils.d.ts rename to dist/cjs/src/Utils/RandomUtils/RandomUtils.d.ts diff --git a/dist/Utils/RandomUtils/RandomUtils.test.d.ts b/dist/cjs/src/Utils/RandomUtils/RandomUtils.test.d.ts similarity index 100% rename from dist/Utils/RandomUtils/RandomUtils.test.d.ts rename to dist/cjs/src/Utils/RandomUtils/RandomUtils.test.d.ts diff --git a/dist/src/Utils/Rect/Rect.d.ts b/dist/cjs/src/Utils/Rect/Rect.d.ts similarity index 85% rename from dist/src/Utils/Rect/Rect.d.ts rename to dist/cjs/src/Utils/Rect/Rect.d.ts index d6f98c5e..8b3d198f 100644 --- a/dist/src/Utils/Rect/Rect.d.ts +++ b/dist/cjs/src/Utils/Rect/Rect.d.ts @@ -1,4 +1,4 @@ -import { Vector2 } from "../Vector2/Vector2"; +import { Vector2 } from "../Vector2/Vector2.js"; export declare class Rect { private x; private y; diff --git a/dist/Utils/Rect/Rect.test.d.ts b/dist/cjs/src/Utils/Rect/Rect.test.d.ts similarity index 100% rename from dist/Utils/Rect/Rect.test.d.ts rename to dist/cjs/src/Utils/Rect/Rect.test.d.ts diff --git a/dist/Utils/SpriteUtils/SpriteUtils.d.ts b/dist/cjs/src/Utils/SpriteUtils/SpriteUtils.d.ts similarity index 100% rename from dist/Utils/SpriteUtils/SpriteUtils.d.ts rename to dist/cjs/src/Utils/SpriteUtils/SpriteUtils.d.ts diff --git a/dist/Utils/SpriteUtils/SpriteUtils.test.d.ts b/dist/cjs/src/Utils/SpriteUtils/SpriteUtils.test.d.ts similarity index 100% rename from dist/Utils/SpriteUtils/SpriteUtils.test.d.ts rename to dist/cjs/src/Utils/SpriteUtils/SpriteUtils.test.d.ts diff --git a/dist/src/Utils/TypeUtils.d.ts b/dist/cjs/src/Utils/TypeUtils.d.ts similarity index 100% rename from dist/src/Utils/TypeUtils.d.ts rename to dist/cjs/src/Utils/TypeUtils.d.ts diff --git a/dist/Utils/Utils/Utils.d.ts b/dist/cjs/src/Utils/Utils/Utils.d.ts similarity index 100% rename from dist/Utils/Utils/Utils.d.ts rename to dist/cjs/src/Utils/Utils/Utils.d.ts diff --git a/dist/Utils/Utils/Utils.test.d.ts b/dist/cjs/src/Utils/Utils/Utils.test.d.ts similarity index 100% rename from dist/Utils/Utils/Utils.test.d.ts rename to dist/cjs/src/Utils/Utils/Utils.test.d.ts diff --git a/dist/src/Utils/Vector2/Vector2.d.ts b/dist/cjs/src/Utils/Vector2/Vector2.d.ts similarity index 94% rename from dist/src/Utils/Vector2/Vector2.d.ts rename to dist/cjs/src/Utils/Vector2/Vector2.d.ts index 348c96e6..e217dc4a 100644 --- a/dist/src/Utils/Vector2/Vector2.d.ts +++ b/dist/cjs/src/Utils/Vector2/Vector2.d.ts @@ -1,4 +1,4 @@ -import { Position } from "../../GridEngine"; +import { Position } from "../../GridEngine.js"; export declare class Vector2 { static get ZERO(): Vector2; static get ONE(): Vector2; diff --git a/dist/Utils/Vector2/Vector2.test.d.ts b/dist/cjs/src/Utils/Vector2/Vector2.test.d.ts similarity index 100% rename from dist/Utils/Vector2/Vector2.test.d.ts rename to dist/cjs/src/Utils/Vector2/Vector2.test.d.ts diff --git a/dist/Utils/VectorUtils.d.ts b/dist/cjs/src/Utils/VectorUtils.d.ts similarity index 87% rename from dist/Utils/VectorUtils.d.ts rename to dist/cjs/src/Utils/VectorUtils.d.ts index 6a471fc2..ba4ba12f 100644 --- a/dist/Utils/VectorUtils.d.ts +++ b/dist/cjs/src/Utils/VectorUtils.d.ts @@ -1,4 +1,4 @@ -import { Vector2 } from "./Vector2/Vector2"; +import { Vector2 } from "./Vector2/Vector2.js"; export declare class VectorUtils { static vec2str(vec: Vector2): string; static equal(vec1: Vector2, vec2: Vector2): boolean; diff --git a/dist/Utils/VectorUtils.test.d.ts b/dist/cjs/src/Utils/VectorUtils.test.d.ts similarity index 100% rename from dist/Utils/VectorUtils.test.d.ts rename to dist/cjs/src/Utils/VectorUtils.test.d.ts diff --git a/dist/cjs/src/main-esm.d.ts b/dist/cjs/src/main-esm.d.ts new file mode 100644 index 00000000..9aabbd78 --- /dev/null +++ b/dist/cjs/src/main-esm.d.ts @@ -0,0 +1,3 @@ +import { GridEngine } from "./GridEngine.js"; +export * from "./GridEngine.js"; +export default GridEngine; diff --git a/dist/src/main-iife.d.ts b/dist/cjs/src/main-iife.d.ts similarity index 100% rename from dist/src/main-iife.d.ts rename to dist/cjs/src/main-iife.d.ts diff --git a/dist/mjs/package.json b/dist/mjs/package.json new file mode 100644 index 00000000..da64b178 --- /dev/null +++ b/dist/mjs/package.json @@ -0,0 +1 @@ +{"type": "module"}{"type": "module"}{"type": "module"} \ No newline at end of file diff --git a/dist/mjs/speedtests/RoomsTilemap.d.ts b/dist/mjs/speedtests/RoomsTilemap.d.ts new file mode 100644 index 00000000..a033afe4 --- /dev/null +++ b/dist/mjs/speedtests/RoomsTilemap.d.ts @@ -0,0 +1,15 @@ +import { Tilemap, Orientation, TileLayer, Tile } from "../src/GridEngine"; +export declare class RoomsTilemap implements Tilemap { + private height; + private width; + private layers; + private layersByName; + constructor(path: string | string[]); + private addLayer; + getWidth(): number; + getHeight(): number; + getOrientation(): Orientation; + getLayers(): TileLayer[]; + hasTileAt(x: number, y: number, layer?: string): boolean; + getTileAt(x: number, y: number, layer?: string): Tile | undefined; +} diff --git a/dist/mjs/speedtests/run.d.ts b/dist/mjs/speedtests/run.d.ts new file mode 100644 index 00000000..3ddb363a --- /dev/null +++ b/dist/mjs/speedtests/run.d.ts @@ -0,0 +1,9 @@ +import { GridEngineHeadless } from "../src/GridEngineHeadless"; +export interface SpeedTestResult { + result: number; + tolerance: number; +} +export interface SpeedTest { + name: string; + run: (gridEngine: GridEngineHeadless) => SpeedTestResult; +} diff --git a/dist/mjs/speedtests/tests/BfsSpeed.d.ts b/dist/mjs/speedtests/tests/BfsSpeed.d.ts new file mode 100644 index 00000000..f67143a4 --- /dev/null +++ b/dist/mjs/speedtests/tests/BfsSpeed.d.ts @@ -0,0 +1,8 @@ +import { GridEngineHeadless } from "../../src/GridEngineHeadless"; +export declare const BfsSpeed: { + name: string; + run: (gridEngine: GridEngineHeadless) => { + result: number; + tolerance: number; + }; +}; diff --git a/dist/mjs/speedtests/tests/BidirSpeed.d.ts b/dist/mjs/speedtests/tests/BidirSpeed.d.ts new file mode 100644 index 00000000..c930bc97 --- /dev/null +++ b/dist/mjs/speedtests/tests/BidirSpeed.d.ts @@ -0,0 +1,8 @@ +import { GridEngineHeadless } from "../../src/GridEngineHeadless"; +export declare const BidirSpeed: { + name: string; + run: (gridEngine: GridEngineHeadless) => { + result: number; + tolerance: number; + }; +}; diff --git a/dist/Collisions/CollisionStrategy.d.ts b/dist/mjs/src/Collisions/CollisionStrategy.d.ts similarity index 95% rename from dist/Collisions/CollisionStrategy.d.ts rename to dist/mjs/src/Collisions/CollisionStrategy.d.ts index 2976c966..81e12e6d 100644 --- a/dist/Collisions/CollisionStrategy.d.ts +++ b/dist/mjs/src/Collisions/CollisionStrategy.d.ts @@ -1,3 +1,6 @@ +/** + * @category Configuration + */ export declare enum CollisionStrategy { /** * Not used yet. diff --git a/dist/Datastructures/Queue/Queue.d.ts b/dist/mjs/src/Datastructures/Queue/Queue.d.ts similarity index 82% rename from dist/Datastructures/Queue/Queue.d.ts rename to dist/mjs/src/Datastructures/Queue/Queue.d.ts index 0a32b81c..ef134bfc 100644 --- a/dist/Datastructures/Queue/Queue.d.ts +++ b/dist/mjs/src/Datastructures/Queue/Queue.d.ts @@ -9,5 +9,8 @@ export declare class Queue { dequeue(): T | undefined; enqueue(data: T): void; peek(): T | undefined; + peekAll(): T[]; + clear(): void; + peekEnd(): T | undefined; size(): number; } diff --git a/dist/src/Datastructures/Queue/Queue.test.d.ts b/dist/mjs/src/Datastructures/Queue/Queue.test.d.ts similarity index 100% rename from dist/src/Datastructures/Queue/Queue.test.d.ts rename to dist/mjs/src/Datastructures/Queue/Queue.test.d.ts diff --git a/dist/mjs/src/Direction/Direction.d.ts b/dist/mjs/src/Direction/Direction.d.ts new file mode 100644 index 00000000..49f19470 --- /dev/null +++ b/dist/mjs/src/Direction/Direction.d.ts @@ -0,0 +1,36 @@ +import { Position } from "../GridEngine.js"; +import { Vector2 } from "../Utils/Vector2/Vector2.js"; +export declare enum Direction { + NONE = "none", + LEFT = "left", + UP_LEFT = "up-left", + UP = "up", + UP_RIGHT = "up-right", + RIGHT = "right", + DOWN_RIGHT = "down-right", + DOWN = "down", + DOWN_LEFT = "down-left" +} +export declare function directions(): Direction[]; +export declare function isDiagonal(direction: Direction): boolean; +export declare function isHorizontal(direction: Direction): boolean; +export declare function isVertical(direction: Direction): boolean; +export declare function turnCounterClockwise(direction: Direction): Direction; +export declare function turnClockwise(direction: Direction): Direction; +export declare function directionVector(direction: Direction): Vector2; +export declare function oppositeDirection(direction: Direction): Direction; +/** + * Helper function that returns the direction from a source to a target + * position. + * + * For example: + * `directionFromPos({x:1, y:1}, {{x:2, y:1}}) = Direction.RIGHT` + * + * @category Helpers + */ +export declare function directionFromPos(src: Position, dest: Position): Direction; +export declare enum NumberOfDirections { + FOUR = 4, + EIGHT = 8 +} +export declare function isDirection(val: any): val is Direction; diff --git a/dist/GlobalConfig/GlobalConfig.test.d.ts b/dist/mjs/src/Direction/Direction.test.d.ts similarity index 100% rename from dist/GlobalConfig/GlobalConfig.test.d.ts rename to dist/mjs/src/Direction/Direction.test.d.ts diff --git a/dist/GridCharacter/CharacterAnimation/CharacterAnimation.d.ts b/dist/mjs/src/GridCharacter/CharacterAnimation/CharacterAnimation.d.ts similarity index 90% rename from dist/GridCharacter/CharacterAnimation/CharacterAnimation.d.ts rename to dist/mjs/src/GridCharacter/CharacterAnimation/CharacterAnimation.d.ts index 6fec48a5..dcd5bc0a 100644 --- a/dist/GridCharacter/CharacterAnimation/CharacterAnimation.d.ts +++ b/dist/mjs/src/GridCharacter/CharacterAnimation/CharacterAnimation.d.ts @@ -1,7 +1,7 @@ -import { Direction } from "./../../Direction/Direction"; -import { WalkingAnimationMapping } from "../../GridEngine"; +import { Direction } from "./../../Direction/Direction.js"; +import { WalkingAnimationMapping } from "../../GridEngine.js"; import { Observable } from "rxjs"; -export declare type CharacterIndex = number; +export type CharacterIndex = number; /** Frame numbers for one movement direction */ export interface FrameRow { /** Frame number for animation frame with left foot in front */ diff --git a/dist/src/GridCharacter/CharacterAnimation/CharacterAnimation.test.d.ts b/dist/mjs/src/GridCharacter/CharacterAnimation/CharacterAnimation.test.d.ts similarity index 100% rename from dist/src/GridCharacter/CharacterAnimation/CharacterAnimation.test.d.ts rename to dist/mjs/src/GridCharacter/CharacterAnimation/CharacterAnimation.test.d.ts diff --git a/dist/mjs/src/GridCharacter/CharacterFilter/CharacterFilter.d.ts b/dist/mjs/src/GridCharacter/CharacterFilter/CharacterFilter.d.ts new file mode 100644 index 00000000..0c2852e0 --- /dev/null +++ b/dist/mjs/src/GridCharacter/CharacterFilter/CharacterFilter.d.ts @@ -0,0 +1,51 @@ +import { GridCharacter } from "../GridCharacter.js"; +/** + * Options for filtering characters. + */ +export interface CharacterFilteringOptions { + labels?: { + /** + * When set and not an empty array, these labels must ALL be present on a + * character in order for it to appear in the filtered result. + * + * If both, {@link withAllLabels} and + * {@link withNoneLabels} are provided and + * non-empty arrays, {@link withNoneLabels} is ignored. + * + * If both, {@link withAllLabels} and + * {@link withOneOfLabels} are provided and + * non-empty arrays, {@link withOneOfLabels} is ignored. + * @default `[]` + */ + withAllLabels?: string[]; + /** + * When set and not an empty array, NONE of these labels must be present on + * a character in order for it to appear in the filtered result. + * + * If both, {@link withAllLabels} and + * {@link withNoneLabels} are provided and + * non-empty arrays, {@link withNoneLabels} is ignored. + * + * If both, {@link withNoneLabels} and + * {@link withOneOfLabels} are provided and + * non-empty arrays, {@link withNoneLabels} is ignored. + * @default `[]` + */ + withNoneLabels?: string[]; + /** + * When set and not an empty array, ONE of these labels must be present on a + * character in order for it to appear in the filtered result. + * + * If both, {@link withAllLabels} and + * {@link withNoneLabels} are provided and + * non-empty arrays, {@link withNoneLabels} is ignored. + * + * If both, {@link withNoneLabels} and + * {@link withOneOfLabels} are provided and + * non-empty arrays, {@link withNoneLabels} is ignored. + * @default `[]` + */ + withOneOfLabels?: string[]; + }; +} +export declare function filterCharacters(characters: GridCharacter[], options: CharacterFilteringOptions): GridCharacter[]; diff --git a/dist/src/GridCharacter/CharacterFilter/CharacterFilter.test.d.ts b/dist/mjs/src/GridCharacter/CharacterFilter/CharacterFilter.test.d.ts similarity index 100% rename from dist/src/GridCharacter/CharacterFilter/CharacterFilter.test.d.ts rename to dist/mjs/src/GridCharacter/CharacterFilter/CharacterFilter.test.d.ts diff --git a/dist/GridCharacter/GridCharacter.d.ts b/dist/mjs/src/GridCharacter/GridCharacter.d.ts similarity index 63% rename from dist/GridCharacter/GridCharacter.d.ts rename to dist/mjs/src/GridCharacter/GridCharacter.d.ts index b65beec3..38346b60 100644 --- a/dist/GridCharacter/GridCharacter.d.ts +++ b/dist/mjs/src/GridCharacter/GridCharacter.d.ts @@ -1,26 +1,33 @@ -import { LayerPosition } from "./../Pathfinding/ShortestPathAlgorithm"; -import { Direction } from "../Direction/Direction"; -import { GridTilemap, LayerName } from "../GridTilemap/GridTilemap"; +import { LayerVecPos } from "./../Pathfinding/ShortestPathAlgorithm.js"; +import { NumberOfDirections } from "./../Direction/Direction.js"; +import { Direction } from "../Direction/Direction.js"; import { Subject } from "rxjs"; -import { Position } from "../GridEngine"; -import { Movement } from "../Movement/Movement"; -import { Vector2 } from "../Utils/Vector2/Vector2"; +import { CharLayer, Position } from "../GridEngine.js"; +import { Movement } from "../Movement/Movement.js"; +import { Vector2 } from "../Utils/Vector2/Vector2.js"; import * as Phaser from "phaser"; -export declare type GameObject = Phaser.GameObjects.Container | Phaser.GameObjects.Sprite; +import { GridTilemap } from "../GridTilemap/GridTilemap.js"; +export declare const MAX_MOVEMENT_PROGRESS = 1000; +export type CharId = string; +export type GameObject = Phaser.GameObjects.Container | Phaser.GameObjects.Sprite; export interface PositionChange { exitTile: Position; enterTile: Position; - exitLayer: LayerName; - enterLayer: LayerName; + exitLayer: CharLayer; + enterLayer: CharLayer; } export interface CharConfig { - tilemap: GridTilemap; - speed: number; - collidesWithTiles: boolean; charLayer?: string; + collidesWithTiles: boolean; collisionGroups?: string[]; facingDirection?: Direction; + ignoreMissingTiles?: boolean; labels?: string[]; + numberOfDirections: NumberOfDirections; + speed: number; + tileHeight?: number; + tilemap: GridTilemap; + tileWidth?: number; } export declare class GridCharacter { private id; @@ -40,9 +47,13 @@ export declare class GridCharacter { private movement?; private collidesWithTilesInternal; private collisionGroups; + private ignoreMissingTiles; private depthChanged$; private movementProgress; private labels; + private numberOfDirections; + private tileWidth; + private tileHeight; constructor(id: string, config: CharConfig); getId(): string; getSpeed(): number; @@ -50,15 +61,21 @@ export declare class GridCharacter { setMovement(movement?: Movement): void; getMovement(): Movement | undefined; collidesWithTiles(): boolean; - setTilePosition(tilePosition: LayerPosition): void; - getTilePos(): LayerPosition; - getNextTilePos(): LayerPosition; + getIgnoreMissingTiles(): boolean; + setTilePosition(tilePosition: LayerVecPos): void; + getTilePos(): LayerVecPos; + getNextTilePos(): LayerVecPos; + getTileWidth(): number; + getTileHeight(): number; move(direction: Direction): void; update(delta: number): void; getMovementDirection(): Direction; isBlockingDirection(direction: Direction): boolean; + isTileBlocking(direction: Direction, layerInDirection: CharLayer): boolean; + private isCharBlocking; isMoving(): boolean; turnTowards(direction: Direction): void; + private changeFacingDirection; getFacingDirection(): Direction; getFacingPosition(): Vector2; addCollisionGroup(collisionGroup: string): void; @@ -72,17 +89,20 @@ export declare class GridCharacter { hasLabel(label: string): boolean; clearLabels(): void; removeLabels(labels: string[]): void; + getNumberOfDirections(): NumberOfDirections; movementStarted(): Subject; movementStopped(): Subject; directionChanged(): Subject; - tilePositionSet(): Subject; + tilePositionSet(): Subject; positionChangeStarted(): Subject; positionChangeFinished(): Subject; autoMovementSet(): Subject; - depthChanged(): Subject; + depthChanged(): Subject; getMovementProgress(): number; hasWalkedHalfATile(): boolean; + willCrossTileBorderThisUpdate(delta: number): boolean; private updateCharacterPosition; + private maxProgressForDelta; private get tilePos(); private set tilePos(value); private startMoving; @@ -90,4 +110,5 @@ export declare class GridCharacter { private shouldContinueMoving; private stopMoving; private fire; + private someCharTile; } diff --git a/dist/src/GridCharacter/GridCharacter.test.d.ts b/dist/mjs/src/GridCharacter/GridCharacter.test.d.ts similarity index 100% rename from dist/src/GridCharacter/GridCharacter.test.d.ts rename to dist/mjs/src/GridCharacter/GridCharacter.test.d.ts diff --git a/dist/mjs/src/GridEngine.d.ts b/dist/mjs/src/GridEngine.d.ts new file mode 100644 index 00000000..6f03145b --- /dev/null +++ b/dist/mjs/src/GridEngine.d.ts @@ -0,0 +1,524 @@ +import { CollisionStrategy } from "./Collisions/CollisionStrategy.js"; +import { Finished, MoveToConfig, MoveToInfo, MoveToResult } from "./Movement/TargetMovement/TargetMovement.js"; +import { PositionChange } from "./GridCharacter/GridCharacter.js"; +import { Direction, NumberOfDirections, directionFromPos } from "./Direction/Direction.js"; +import { Observable } from "rxjs"; +import { NoPathFoundStrategy } from "./Pathfinding/NoPathFoundStrategy.js"; +import { PathBlockedStrategy } from "./Pathfinding/PathBlockedStrategy.js"; +import { MovementInfo } from "./Movement/Movement.js"; +import { CharacterIndex, FrameRow } from "./GridCharacter/CharacterAnimation/CharacterAnimation.js"; +import { CharacterFilteringOptions } from "./GridCharacter/CharacterFilter/CharacterFilter.js"; +import { IsPositionAllowedFn, PathfindingOptions } from "./Pathfinding/Pathfinding.js"; +import { ShortestPathAlgorithmType } from "./Pathfinding/ShortestPathAlgorithm.js"; +import { GridEngineHeadless, TileSizePerSecond, GridEngineConfigHeadless, CollisionConfig, CharacterDataHeadless } from "./GridEngineHeadless.js"; +import { PhaserTilemap, TiledProject } from "./GridTilemap/Phaser/PhaserTilemap.js"; +import { Orientation, Tile, TileLayer, Tilemap } from "./GridTilemap/Tilemap.js"; +import { PhaserTileLayer } from "./GridTilemap/Phaser/PhaserTileLayer.js"; +import { PhaserTile } from "./GridTilemap/Phaser/PhaserTile.js"; +import { QueueMovementConfig, QueuedPathBlockedStrategy, Finished as QueueMovementFinished, QueueMovementResult, QueueMovementEntry } from "./Movement/QueueMovement/QueueMovement.js"; +import { CharacterShift, CharacterShiftAction, CharLayer, FollowOptions, IGridEngine, LayerPosition, PathfindingResult, Position } from "./IGridEngine.js"; +import { ArrayTilemap, ArrayTilemapInputLayer } from "./GridTilemap/ArrayTilemap/ArrayTilemap.js"; +import { TiledTilemap } from "./GridTilemap/TiledTilemap/TiledTilemap.js"; +import { TiledLayer } from "./GridTilemap/TiledTilemap/TiledLayer.js"; +import { TiledTile } from "./GridTilemap/TiledTilemap/TiledTile.js"; +export { ArrayTilemap, ArrayTilemapInputLayer, CharacterDataHeadless, CharacterFilteringOptions, CharacterShift, CharacterShiftAction, CharLayer, CollisionConfig, CollisionStrategy, Direction, Finished, FollowOptions, FrameRow, GridEngineConfigHeadless, GridEngineHeadless, IGridEngine, IsPositionAllowedFn, LayerPosition, MovementInfo, MoveToConfig, MoveToInfo, MoveToResult, NoPathFoundStrategy, NumberOfDirections, Orientation, PathBlockedStrategy, PathfindingOptions, PathfindingResult, Position, PositionChange, PhaserTile, PhaserTileLayer, PhaserTilemap, QueueMovementConfig, QueueMovementEntry, QueueMovementFinished, QueueMovementResult, QueuedPathBlockedStrategy, ShortestPathAlgorithmType, Tile, TiledProject, TiledTilemap, TiledLayer, TiledTile, TileLayer, Tilemap, TileSizePerSecond, directionFromPos, }; +/** + * Configuration object for initializing GridEngine. + * + * @category Configuration + */ +export interface GridEngineConfig extends GridEngineConfigHeadless { + /** An array of character data. Each describing a character on the map. */ + characters: CharacterData[]; + /** + * Enables experimental + * {@link https://annoraaq.github.io/grid-engine/p/layer-overlay/ | layer overlay feature}. + * + * @defaultValue `false` + * + * @beta + */ + layerOverlay?: boolean; + /** + * Object, parsed from Tiled project file. This is used to provide Tiled + * project features like tile classes. + */ + tiledProject?: TiledProject; +} +export interface WalkingAnimationMapping { + /** FrameRow for moving up */ + [Direction.UP]: FrameRow; + /** FrameRow for moving right */ + [Direction.RIGHT]: FrameRow; + /** FrameRow for moving down */ + [Direction.DOWN]: FrameRow; + /** FrameRow for moving left */ + [Direction.LEFT]: FrameRow; + /** FrameRow for moving up-left */ + [Direction.UP_LEFT]?: FrameRow; + /** FrameRow for moving up-right */ + [Direction.UP_RIGHT]?: FrameRow; + /** FrameRow for moving down-left */ + [Direction.DOWN_LEFT]?: FrameRow; + /** FrameRow for moving down-right */ + [Direction.DOWN_RIGHT]?: FrameRow; +} +/** + * Configuration object used to initialize a new character in GridEngine. + * + * @category Configuration + */ +export interface CharacterData extends CharacterDataHeadless { + /** The character’s sprite. */ + sprite?: Phaser.GameObjects.Sprite; + /** + * If not set, automatic walking animation will be disabed. Do this if you + * want to use a custom animation. In case of number: The 0-based index of + * the character on the spritesheet. Here is an + * {@link https://github.com/Annoraaq/grid-engine/raw/master/images/charIndex.png | example image showing the character indices}. + * In case of {@link WalkingAnimationMapping}: Alternatively to providing a + * characterIndex you can also provide a custom frame mapping. This is + * especially handy if your spritesheet has a different arrangement of frames + * than you can see in the {@link https://github.com/Annoraaq/grid-engine/raw/master/images/charIndex.png | example image} + * (4 rows with 3 columns). You can provide the frame number for every state + * of the character. + * + * For more details see the {@link https://annoraaq.github.io/grid-engine/example/custom-walking-animation-mapping/ | custom walking animation mapping example}. + */ + walkingAnimationMapping?: CharacterIndex | WalkingAnimationMapping; + /** + * A container that holds the character’s sprite. This can be used in order + * to move more game objects along with the sprite (for example a character’s + * name or health bar). In order to position the container correctly on the + * tiles, it is necessary that you position the character’s sprite on + * position (0, 0) in the container. + * + * If you pass both, a container and a sprite, only the container's pixel + * position will be changed on movement. That is only relevant if you pass a + * sprite that is not included in the container. + * + * For more details see the {@link https://annoraaq.github.io/grid-engine/example/phaser-containers/ | container example}. + */ + container?: Phaser.GameObjects.Container; + /** + * A custom x-offset for the sprite/container. + * + * @defaultValue `0` + */ + offsetX?: number; + /** + * A custom y-offset for the sprite/container. + * + * @defaultValue `0` + */ + offsetY?: number; +} +/** + * @category Main Modules + */ +export declare class GridEngine implements IGridEngine { + private scene; + static welcomeMessagePrinted: boolean; + private geHeadless; + private config?; + private gridCharacters?; + private gridTilemap?; + private isCreatedInternal; + /** + * Should only be called by Phaser and never directly. + * @internal + */ + constructor(scene: Phaser.Scene); + /** @internal */ + boot(): void; + /** + * {@inheritDoc IGridEngine.getCharLayer} + * + * @category Character + */ + getCharLayer(charId: string): string | undefined; + /** + * {@inheritDoc IGridEngine.getTransition} + * + * @category Tilemap + */ + getTransition(position: Position, fromLayer: string): string | undefined; + /** + * {@inheritDoc IGridEngine.setTransition} + * + * @category Tilemap + */ + setTransition(position: Position, fromLayer: string, toLayer: string): void; + /** + * Initializes GridEngine. Must be called before any other methods of + * GridEngine are called. + * + * @category Grid Engine + */ + create(tilemap: Phaser.Tilemaps.Tilemap, config: GridEngineConfig): void; + /** + * {@inheritDoc IGridEngine.getPosition} + * + * @category Character + */ + getPosition(charId: string): Position; + /** + * {@inheritDoc IGridEngine.move} + * + * @category Basic Movement + */ + move(charId: string, direction: Direction): void; + /** + * {@inheritDoc IGridEngine.moveRandomly} + * + * @category Random Movement + */ + moveRandomly(charId: string, delay?: number, radius?: number): void; + /** + * {@inheritDoc IGridEngine.getMovement} + * + * @category Character + */ + getMovement(charId: string): MovementInfo; + /** + * {@inheritDoc IGridEngine.moveTo} + * + * @category Pathfinding + */ + moveTo(charId: string, targetPos: Position, config?: MoveToConfig): Observable<{ + charId: string; + } & Finished>; + /** + * {@inheritDoc IGridEngine.stopMovement} + * + * @category Basic Movement + */ + stopMovement(charId: string): void; + /** + * {@inheritDoc IGridEngine.setSpeed} + * + * @category Character + */ + setSpeed(charId: string, speed: number): void; + /** + * {@inheritDoc IGridEngine.getSpeed} + * + * @category Character + */ + getSpeed(charId: string): number; + /** + * @returns Container for a character. + * + * @category Character + */ + getContainer(charId: string): Phaser.GameObjects.Container | undefined; + /** + * @returns X-offset for a character. + * + * @category Character + */ + getOffsetX(charId: string): number; + /** + * Set custom x-offset for the sprite/container. + * + * @category Character + */ + setOffsetX(charId: string, offsetX: number): void; + /** + * @returns Y-offset for a character. + * + * @category Character + */ + getOffsetY(charId: string): number; + /** + * Set custom y-offset for the sprite/container. + * + * @category Character + */ + setOffsetY(charId: string, offsetY: number): void; + /** + * {@inheritDoc IGridEngine.collidesWithTiles} + * + * @category Character + */ + collidesWithTiles(charId: string): boolean; + /** + * @returns {@link WalkingAnimationMapping} for a character. If a character + * index was set, it will be returned instead. + * + * @category Character + */ + getWalkingAnimationMapping(charId: string): WalkingAnimationMapping | number | undefined; + /** + * @returns `true` if {@link https://annoraaq.github.io/grid-engine/p/layer-overlay/ | layer overlay} + * is activated. + * + * @category Grid Engine + */ + hasLayerOverlay(): boolean; + /** + * Sets the {@link WalkingAnimationMapping} for a character. Alternatively you + * can provide a number which is the character index (see also + * {@link CharacterData | Character Config}). If you provide `undefined`, it + * will disable walking animations for the character. + * + * @category Character + */ + setWalkingAnimationMapping(charId: string, walkingAnimationMapping?: WalkingAnimationMapping | number): void; + /** @internal */ + update(time: number, delta: number): void; + /** + * Adds a character after calling {@link create}. + * + * @category Grid Engine + */ + addCharacter(charData: CharacterData): void; + /** + * {@inheritDoc IGridEngine.hasCharacter} + * + * @category Grid Engine + */ + hasCharacter(charId: string): boolean; + /** + * {@inheritDoc IGridEngine.removeCharacter} + * + * @category Grid Engine + */ + removeCharacter(charId: string): void; + /** + * {@inheritDoc IGridEngine.removeAllCharacters} + * + * @category Grid Engine + */ + removeAllCharacters(): void; + /** + * {@inheritDoc IGridEngine.getAllCharacters} + * + * @category Character + */ + getAllCharacters(options?: CharacterFilteringOptions): string[]; + /** + * {@inheritDoc IGridEngine.getLabels} + * + * @category Character + */ + getLabels(charId: string): string[]; + /** + * {@inheritDoc IGridEngine.addLabels} + * + * @category Character + */ + addLabels(charId: string, labels: string[]): void; + /** + * {@inheritDoc IGridEngine.removeLabels} + * + * @category Character + */ + removeLabels(charId: string, labels: string[]): void; + /** + * {@inheritDoc IGridEngine.clearLabels} + * + * @category Character + */ + clearLabels(charId: string): void; + /** + * {@inheritDoc IGridEngine.follow} + * + * @category Pathfinding + */ + follow(charId: string, charIdToFollow: string, options?: FollowOptions): void; + follow(charId: string, charIdToFollow: string, distance?: number, closestPointIfBlocked?: boolean): void; + /** + * {@inheritDoc IGridEngine.isMoving} + * + * @category Character + */ + isMoving(charId: string): boolean; + /** + * {@inheritDoc IGridEngine.getFacingDirection} + * + * @category Character + */ + getFacingDirection(charId: string): Direction; + /** + * {@inheritDoc IGridEngine.getFacingPosition} + * + * @category Character + */ + getFacingPosition(charId: string): Position; + /** + * {@inheritDoc IGridEngine.turnTowards} + * + * @category Basic Movement + */ + turnTowards(charId: string, direction: Direction): void; + /** + * {@inheritDoc IGridEngine.getCharactersAt} + * + * @category Tilemap + */ + getCharactersAt(position: Position, layer?: string): string[]; + /** + * {@inheritDoc IGridEngine.setPosition} + * + * @category Character + */ + setPosition(charId: string, pos: Position, layer?: string): void; + /** + * @returns Sprite of given character + * + * @category Character + */ + getSprite(charId: string): Phaser.GameObjects.Sprite | undefined; + /** + * Sets the sprite for a character. + * + * @category Character + */ + setSprite(charId: string, sprite: Phaser.GameObjects.Sprite): void; + /** + * {@inheritDoc IGridEngine.isBlocked} + * + * @category Tilemap + */ + isBlocked(position: Position, layer?: string, collisionGroups?: string[]): boolean; + /** + * {@inheritDoc IGridEngine.isTileBlocked} + * + * @category Tilemap + */ + isTileBlocked(position: Position, layer?: string): boolean; + /** + * {@inheritDoc IGridEngine.getCollisionGroups} + * + * @category Character + */ + getCollisionGroups(charId: string): string[]; + /** + * {@inheritDoc IGridEngine.setCollisionGroups} + * + * @category Character + */ + setCollisionGroups(charId: string, collisionGroups: string[]): void; + /** + * {@inheritDoc IGridEngine.getTilePosInDirection} + * + * @category Tilemap + */ + getTilePosInDirection(position: Position, charLayer: string | undefined, direction: Direction): LayerPosition; + /** + * {@inheritDoc IGridEngine.findShortestPath} + * @alpha + * + * @category Pathfinding + */ + findShortestPath(source: LayerPosition, dest: LayerPosition, options?: PathfindingOptions): PathfindingResult; + /** + * {@inheritDoc IGridEngine.steppedOn} + * + * @category Basic Movement + */ + steppedOn(charIds: string[], tiles: Position[], layer?: CharLayer[]): Observable<{ + charId: string; + } & PositionChange>; + /** + * {@inheritDoc IGridEngine.characterShifted} + * + * @category GridEngine + */ + characterShifted(): Observable; + /** + * {@inheritDoc IGridEngine.movementStarted} + * + * @category Character + */ + movementStarted(): Observable<{ + charId: string; + direction: Direction; + }>; + /** + * {@inheritDoc IGridEngine.movementStopped} + * + * @category Character + */ + movementStopped(): Observable<{ + charId: string; + direction: Direction; + }>; + /** + * {@inheritDoc IGridEngine.directionChanged} + * + * @category Character + */ + directionChanged(): Observable<{ + charId: string; + direction: Direction; + }>; + /** + * {@inheritDoc IGridEngine.positionChangeStarted} + * + * @category Character + */ + positionChangeStarted(): Observable<{ + charId: string; + } & PositionChange>; + /** + * {@inheritDoc IGridEngine.positionChangeFinished} + * + * @category Character + */ + positionChangeFinished(): Observable<{ + charId: string; + } & PositionChange>; + /** + * {@inheritDoc IGridEngine.getMovementProgress} + * + * @category Character + */ + getMovementProgress(charId: string): number; + /** + * {@inheritDoc IGridEngine.rebuildTileCollisionCache} + * + * @category Grid Engine + */ + rebuildTileCollisionCache(x: number, y: number, width: number, height: number): void; + /** + * {@inheritDoc IGridEngine.addQueueMovements} + * + * @category Queue Movement + */ + addQueueMovements(charId: string, positions: Array, options?: QueueMovementConfig): void; + /** + * {@inheritDoc IGridEngine.getEnqueuedMovements} + * + * @category Queue Movement + */ + getEnqueuedMovements(charId: string): QueueMovementEntry[]; + /** + * {@inheritDoc IGridEngine.queueMovementFinished} + * + * @category Queue Movement + */ + queueMovementFinished(): Observable<{ + charId: string; + } & QueueMovementFinished>; + /** + * {@inheritDoc IGridEngine.clearEnqueuedMovements} + * + * @category Queue Movement + */ + clearEnqueuedMovements(charId: string): void; + /** + * {@inheritDoc IGridEngine.getTileCost} + * + * @category Pathfinding + */ + getTileCost(position: Position, charLayer?: string, srcDirection?: Direction): number; + private setConfigDefaults; + private initGuard; + private createUninitializedErr; + private addCharacters; + private createCharUnknownErr; + private setCharSprite; + private addCharacterInternal; +} diff --git a/dist/GridCharacter/IsometricGridCharacter/IsometricGridCharacter.test.d.ts b/dist/mjs/src/GridEngine.test.d.ts similarity index 100% rename from dist/GridCharacter/IsometricGridCharacter/IsometricGridCharacter.test.d.ts rename to dist/mjs/src/GridEngine.test.d.ts diff --git a/dist/mjs/src/GridEngineHeadless.d.ts b/dist/mjs/src/GridEngineHeadless.d.ts new file mode 100644 index 00000000..6a7dc42c --- /dev/null +++ b/dist/mjs/src/GridEngineHeadless.d.ts @@ -0,0 +1,525 @@ +import { CollisionStrategy } from "./Collisions/CollisionStrategy.js"; +import { Finished, MoveToConfig, MoveToResult } from "./Movement/TargetMovement/TargetMovement.js"; +import { PositionChange } from "./GridCharacter/GridCharacter.js"; +import { Direction, NumberOfDirections } from "./Direction/Direction.js"; +import { Observable } from "rxjs"; +import { NoPathFoundStrategy } from "./Pathfinding/NoPathFoundStrategy.js"; +import { PathBlockedStrategy } from "./Pathfinding/PathBlockedStrategy.js"; +import { MovementInfo } from "./Movement/Movement.js"; +import { FrameRow } from "./GridCharacter/CharacterAnimation/CharacterAnimation.js"; +import { CharacterFilteringOptions } from "./GridCharacter/CharacterFilter/CharacterFilter.js"; +import { IsPositionAllowedFn, PathfindingOptions } from "./Pathfinding/Pathfinding.js"; +import { ShortestPathAlgorithmType } from "./Pathfinding/ShortestPathAlgorithm.js"; +import { Tilemap } from "./GridTilemap/Tilemap.js"; +import { CharacterShift, CharLayer, FollowOptions, IGridEngine, LayerPosition, PathfindingResult, Position } from "./IGridEngine.js"; +import { QueueMovementConfig, QueueMovementEntry, Finished as QueueMovementFinished } from "./Movement/QueueMovement/QueueMovement.js"; +export { CollisionStrategy, CharacterFilteringOptions, Direction, MoveToConfig, MoveToResult, Finished, FrameRow, NumberOfDirections, NoPathFoundStrategy, PathBlockedStrategy, MovementInfo, PositionChange, IsPositionAllowedFn, PathfindingOptions, ShortestPathAlgorithmType, }; +export type TileSizePerSecond = number; +/** + * Configuration object for initializing GridEngineHeadless. + * + * @category Configuration + */ +export interface GridEngineConfigHeadless { + /** An array of character data. Each describing a character on the map. */ + characters: CharacterDataHeadless[]; + /** + * A custom name for the + * {@link https://annoraaq.github.io/grid-engine/p/tile-properties/#collisions | collision tile property} + * of your tilemap. + * + * @defaultValue 'ge_collide' + */ + collisionTilePropertyName?: string; + /** + * The possible number of directions for moving a character. Default is 4 + * (up, down, left, right). If set to 8 it additionaly enables diagonal + * movement (up-left, up-right, down-left, down-right). + * + * @defaultValue {@link NumberOfDirections.FOUR} + */ + numberOfDirections?: NumberOfDirections; + /** + * The character collision strategy. + * + * @defaultValue {@link CollisionStrategy.BLOCK_TWO_TILES} + */ + characterCollisionStrategy?: CollisionStrategy; + /** + * Specifies, whether a tile collision cache should be used. It can make + * pathfinding significantly faster. However, if you change something on the + * tilemap (adding layers, changing tiles, etc.) you need to call + * {@link GridEngineHeadless.rebuildTileCollisionCache}. For more information on + * pathfinding performance check out + * {@link https://annoraaq.github.io/grid-engine/p/pathfinding-performance/| pathfinding performance}. + * + * @defaultValue false + */ + cacheTileCollisions?: boolean; + /** + * Specifies a custom collision group relation. You can define which group + * collides with which other groups. + * + * Example: + * {'group1': ['group2', 'group3']} + * This means that `group1` collides with `group2` and `group3` (but not with + * itself!). Also neither `group2` nor `group3` collide with `group1`, so the + * relation can be non-symmetric. + * + * If this property is omitted, the default relation is that each group only + * collides with itself. + */ + collisionGroupRelation?: Record; +} +/** + * @category Configuration + */ +export interface CollisionConfig { + /** + * Determines whether the character should collide with the tilemap. + * + * @defaultValue `true` + */ + collidesWithTiles?: boolean; + /** + * If set to `true`, the character will not collide with a position that has + * no tile on any layer. This is especially useful if you want the character + * to be able to move outside of the map boundaries. + * + * @defaultValue `false` + */ + ignoreMissingTiles?: boolean; + /** + * Array with collision groups. Only characters with at least one matching + * collision group collide. If omitted it will be initialized with a default + * collision group called `'geDefault'`. If you want to keep a character from + * colliding with any other character, you can simply provide an empty array + * here. + * + * @defaultValue `['geDefault']` + */ + collisionGroups?: string[]; +} +/** + * Configuration object used to initialize a new character in GridEngine. + * + * @category Configuration + */ +export interface CharacterDataHeadless { + /** + * A unique identifier for the character on the map. If you provice two + * characters with the same id, the last one will override the previous one. + */ + id: string; + /** + * The speed of a player in tiles per second. + * + * @defaultValue `4` + */ + speed?: TileSizePerSecond; + /** + * Start tile position of the player. + * + * @defaultValue `{x: 0, y:0}` + */ + startPosition?: Position; + /** + * Sets the direction the character is initially facing. + * + * @defaultValue {@link Direction.DOWN} + */ + facingDirection?: Direction; + /** + * Set to false, if character should not collide (neither with the tilemap, + * nor with other characters). For more control, pass a + * {@link CollisionConfig} object. + * + * @defaultValue `true` + */ + collides?: boolean | CollisionConfig; + /** + * Sets the + * {@link https://annoraaq.github.io/grid-engine/features/character-layers | character layer} + * of the character. If omitted the lowest character layer of the tilemap is + * taken. If there are no character layers in the tilemap, it will get the + * char layer `undefined`. + * + * @beta + */ + charLayer?: string; + /** + * Sets labels for the character. They can be used to filter and logically + * group characters. + * + * @defaultValue `[]` + */ + labels?: string[]; + /** + * The possible number of directions for moving a character. This setting can + * be used to override the {@link GridEngineConfig.numberOfDirections | global setting} + * in the GridEngine configuration for specific characters. + */ + numberOfDirections?: NumberOfDirections; + /** + * With of the character in tiles. This allows to specify character that span + * more than just one tile. + * + * @defaultValue 1 + */ + tileWidth?: number; + /** + * Height of the character in tiles. This allows to specify character that span + * more than just one tile. + * + * @defaultValue 1 + */ + tileHeight?: number; +} +/** + * @category Main Modules + */ +export declare class GridEngineHeadless implements IGridEngine { + private gridCharacters?; + private config?; + private gridTilemap?; + private isCreatedInternal; + private movementStopped$?; + private movementStarted$?; + private directionChanged$?; + private positionChangeStarted$?; + private positionChangeFinished$?; + private queueMovementFinished$?; + private charRemoved$?; + private charAdded$?; + constructor(printWelcomeMessage?: boolean); + /** + * {@inheritDoc IGridEngine.getCharLayer} + * + * @category Character + */ + getCharLayer(charId: string): string | undefined; + /** + * {@inheritDoc IGridEngine.getTransition} + * + * @category Tilemap + */ + getTransition(position: Position, fromLayer: string): string | undefined; + /** + * {@inheritDoc IGridEngine.setTransition} + * + * @category Tilemap + */ + setTransition(position: Position, fromLayer: string, toLayer: string): void; + /** + * Initializes GridEngine. Must be called before any other methods of + * GridEngine are called. + * + * @category Grid Engine + */ + create(tilemap: Tilemap, config: GridEngineConfigHeadless): void; + private recordToMap; + /** + * {@inheritDoc IGridEngine.getPosition} + * + * @category Character + */ + getPosition(charId: string): Position; + /** + * {@inheritDoc IGridEngine.move} + * + * @category Basic Movement + */ + move(charId: string, direction: Direction): void; + /** + * {@inheritDoc IGridEngine.moveRandomly} + * + * @category Random Movement + */ + moveRandomly(charId: string, delay?: number, radius?: number): void; + /** + * {@inheritDoc IGridEngine.getMovement} + * + * @category Character + */ + getMovement(charId: string): MovementInfo; + /** + * {@inheritDoc IGridEngine.moveTo} + * + * @category Pathfinding + */ + moveTo(charId: string, targetPos: Position, config?: MoveToConfig): Observable<{ + charId: string; + } & Finished>; + /** + * {@inheritDoc IGridEngine.stopMovement} + * + * @category Character + */ + stopMovement(charId: string): void; + /** + * {@inheritDoc IGridEngine.setSpeed} + * + * @category Character + */ + setSpeed(charId: string, speed: number): void; + /** + * {@inheritDoc IGridEngine.getSpeed} + * + * @category Character + * + */ + getSpeed(charId: string): number; + /** + * {@inheritDoc IGridEngine.collidesWithTiles} + * + * @category Character + */ + collidesWithTiles(charId: string): boolean; + /** + * @category Grid Engine + */ + update(_time: number, delta: number): void; + /** + * Adds a character after calling {@link create}. + * + * @category Grid Engine + */ + addCharacter(charData: CharacterDataHeadless): void; + /** + * {@inheritDoc IGridEngine.hasCharacter} + * + * @category Grid Engine + */ + hasCharacter(charId: string): boolean; + /** + * {@inheritDoc IGridEngine.removeCharacter} + * + * @category Grid Engine + */ + removeCharacter(charId: string): void; + /** + * {@inheritDoc IGridEngine.removeAllCharacters} + * + * @category Grid Engine + */ + removeAllCharacters(): void; + /** + * {@inheritDoc IGridEngine.getAllCharacters} + * + * @category Grid Engine + */ + getAllCharacters(options?: CharacterFilteringOptions): string[]; + /** + * {@inheritDoc IGridEngine.getLabels} + * + * @category Character + */ + getLabels(charId: string): string[]; + /** + * {@inheritDoc IGridEngine.addLabels} + * + * @category Character + */ + addLabels(charId: string, labels: string[]): void; + /** + * {@inheritDoc IGridEngine.removeLabels} + * + * @category Character + */ + removeLabels(charId: string, labels: string[]): void; + /** + * {@inheritDoc IGridEngine.clearLabels} + * + * @category Character + */ + clearLabels(charId: string): void; + /** + * {@inheritDoc IGridEngine.follow} + * + * @category Pathfinding + */ + follow(charId: string, charIdToFollow: string, options?: FollowOptions): void; + follow(charId: string, charIdToFollow: string, distance?: number, closestPointIfBlocked?: boolean): void; + /** + * {@inheritDoc IGridEngine.isMoving} + * + * @category Character + */ + isMoving(charId: string): boolean; + /** + * {@inheritDoc IGridEngine.getFacingDirection} + * + * @category Character + */ + getFacingDirection(charId: string): Direction; + /** + * {@inheritDoc IGridEngine.getFacingPosition} + * + * @category Character + */ + getFacingPosition(charId: string): Position; + /** + * {@inheritDoc IGridEngine.turnTowards} + * + * @category Basic Movement + */ + turnTowards(charId: string, direction: Direction): void; + /** + * {@inheritDoc IGridEngine.getCharactersAt} + * + * @category Tilemap + */ + getCharactersAt(position: Position, layer?: string): string[]; + /** + * {@inheritDoc IGridEngine.setPosition} + * + * @category Character + */ + setPosition(charId: string, pos: Position, layer?: string): void; + /** + * {@inheritDoc IGridEngine.isBlocked} + * + * @category Tilemap + */ + isBlocked(position: Position, layer?: string, collisionGroups?: string[]): boolean; + /** + * {@inheritDoc IGridEngine.isTileBlocked} + * + * @category Tilemap + */ + isTileBlocked(position: Position, layer?: string): boolean; + /** + * {@inheritDoc IGridEngine.getCollisionGroups} + * + * @category Character + */ + getCollisionGroups(charId: string): string[]; + /** + * {@inheritDoc IGridEngine.setCollisionGroups} + * + * @category Character + */ + setCollisionGroups(charId: string, collisionGroups: string[]): void; + /** + * {@inheritDoc IGridEngine.getTilePosInDirection} + * + * @category Tilemap + */ + getTilePosInDirection(position: Position, charLayer: string | undefined, direction: Direction): LayerPosition; + /** + * {@inheritDoc IGridEngine.findShortestPath} + * @alpha + * + * @category Pathfinding + */ + findShortestPath(source: LayerPosition, dest: LayerPosition, options?: PathfindingOptions): PathfindingResult; + /** + * {@inheritDoc IGridEngine.steppedOn} + * + * @category Basic Movement + */ + steppedOn(charIds: string[], tiles: Position[], layer?: CharLayer[]): Observable<{ + charId: string; + } & PositionChange>; + /** + * {@inheritDoc IGridEngine.characterShifted} + * + * @category GridEngine + */ + characterShifted(): Observable; + /** + * {@inheritDoc IGridEngine.movementStarted} + * + * @category Character + */ + movementStarted(): Observable<{ + charId: string; + direction: Direction; + }>; + /** + * {@inheritDoc IGridEngine.movementStopped} + * + * @category Character + */ + movementStopped(): Observable<{ + charId: string; + direction: Direction; + }>; + /** + * {@inheritDoc IGridEngine.directionChanged} + * + * @category Character + */ + directionChanged(): Observable<{ + charId: string; + direction: Direction; + }>; + /** + * {@inheritDoc IGridEngine.positionChangeStarted} + * + * @category Character + */ + positionChangeStarted(): Observable<{ + charId: string; + } & PositionChange>; + /** + * {@inheritDoc IGridEngine.positionChangeFinished} + * + * @category Character + */ + positionChangeFinished(): Observable<{ + charId: string; + } & PositionChange>; + /** + * {@inheritDoc IGridEngine.getMovementProgress} + * + * @category Character + */ + getMovementProgress(charId: string): number; + /** + * {@inheritDoc IGridEngine.rebuildTileCollisionCache} + * + * @category Character + */ + rebuildTileCollisionCache(x: number, y: number, width: number, height: number): void; + /** + * {@inheritDoc IGridEngine.addQueueMovements} + * + * @category Queue Movement + */ + addQueueMovements(charId: string, positions: Array, options?: QueueMovementConfig): void; + /** + * {@inheritDoc IGridEngine.queueMovementFinished} + * + * @category Queue Movement + */ + queueMovementFinished(): Observable<{ + charId: string; + } & QueueMovementFinished>; + /** + * {@inheritDoc IGridEngine.getEnqueuedMovements} + * + * @category Queue Movement + */ + getEnqueuedMovements(charId: string): QueueMovementEntry[]; + /** + * {@inheritDoc IGridEngine.clearEnqueuedMovements} + * + * @category Queue Movement + */ + clearEnqueuedMovements(charId: string): void; + /** + * {@inheritDoc IGridEngine.getTileCost} + * + * @category Pathfinding + */ + getTileCost(position: Position, charLayer?: string, srcDirection?: Direction): number; + private charRemoved; + private initGuard; + private createUninitializedErr; + private addCharacters; + private moveChar; + private createCharUnknownErr; + private assembleMoveToConfig; + private setConfigDefaults; +} diff --git a/dist/Movement/FollowMovement/FollowMovement.test.d.ts b/dist/mjs/src/GridEngineHeadless.test.d.ts similarity index 100% rename from dist/Movement/FollowMovement/FollowMovement.test.d.ts rename to dist/mjs/src/GridEngineHeadless.test.d.ts diff --git a/dist/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.d.ts b/dist/mjs/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.d.ts similarity index 68% rename from dist/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.d.ts rename to dist/mjs/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.d.ts index b22e99ab..dfb51667 100644 --- a/dist/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.d.ts +++ b/dist/mjs/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.d.ts @@ -1,43 +1,39 @@ -import { GridTilemap } from "./../../GridTilemap/GridTilemap"; -import { GridCharacter } from "../../GridCharacter/GridCharacter"; -import { CharacterData, WalkingAnimationMapping } from "../../GridEngine"; -import { Vector2 } from "../../Utils/Vector2/Vector2"; -import { CharacterAnimation } from "../../GridCharacter/CharacterAnimation/CharacterAnimation"; -import { Direction } from "../../Direction/Direction"; +import { CharacterData, GridEngineHeadless, WalkingAnimationMapping } from "../../GridEngine.js"; +import { CharacterAnimation } from "../../GridCharacter/CharacterAnimation/CharacterAnimation.js"; +import { Direction } from "../../Direction/Direction.js"; +import { GridTilemapPhaser } from "../GridTilemapPhaser/GridTilemapPhaser.js"; export declare class GridCharacterPhaser { private charData; private scene; private tilemap; - private layerOverlay; + private geHeadless; private customOffset; - private engineOffset; private sprite?; private layerOverlaySprite?; private container?; private newSpriteSet$; private destroy$; - private gridCharacter; private walkingAnimationMapping?; private animation?; - constructor(charData: CharacterData, scene: Phaser.Scene, tilemap: GridTilemap, layerOverlay: boolean); + constructor(charData: CharacterData, scene: Phaser.Scene, tilemap: GridTilemapPhaser, layerOverlay: boolean, geHeadless: GridEngineHeadless); destroy(): void; - getGridCharacter(): GridCharacter; setSprite(sprite?: Phaser.GameObjects.Sprite): void; getSprite(): Phaser.GameObjects.Sprite | undefined; getLayerOverlaySprite(): Phaser.GameObjects.Sprite | undefined; setContainer(container?: Phaser.GameObjects.Container): void; getContainer(): Phaser.GameObjects.Container | undefined; - getEngineOffset(): Vector2; getOffsetX(): number; + setOffsetX(offsetX: number): void; getOffsetY(): number; + setOffsetY(offsetY: number): void; getWalkingAnimationMapping(): WalkingAnimationMapping | number | undefined; turnTowards(direction: Direction): void; getAnimation(): CharacterAnimation | undefined; setAnimation(animation: CharacterAnimation): void; - update(delta: number): void; + update(_delta: number): void; + private getEngineOffset; private updatePixelPos; private getGameObj; - private createChar; private updateGridChar; private resetAnimation; private updateOverlaySprite; diff --git a/dist/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.test.d.ts b/dist/mjs/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.test.d.ts similarity index 100% rename from dist/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.test.d.ts rename to dist/mjs/src/GridEnginePhaser/GridCharacterPhaser/GridCharacterPhaser.test.d.ts diff --git a/dist/mjs/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.d.ts b/dist/mjs/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.d.ts new file mode 100644 index 00000000..476a5568 --- /dev/null +++ b/dist/mjs/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.d.ts @@ -0,0 +1,26 @@ +import { CharLayer, Direction } from "../../GridEngine.js"; +import { Vector2 } from "../../Utils/Vector2/Vector2.js"; +export declare class GridTilemapPhaser { + private tilemap; + private static readonly ALWAYS_TOP_PROP_NAME; + private static readonly CHAR_LAYER_PROP_NAME; + private static readonly HEIGHT_SHIFT_PROP_NAME; + private static readonly Z_INDEX_PADDING; + private charLayerDepths; + constructor(tilemap: Phaser.Tilemaps.Tilemap); + getTileWidth(): number; + getTileHeight(): number; + getDepthOfCharLayer(layerName: CharLayer): number; + tilePosToPixelPos(tilePosition: Vector2): Vector2; + getTileDistance(direction: Direction): Vector2; + private getTileSize; + private isIsometric; + private isLayerAlwaysOnTop; + private isCharLayer; + private setLayerDepths; + private setDepth; + private createHeightShiftLayers; + private getLayerProp; + private hasLayerProp; + private copyLayer; +} diff --git a/dist/RandomMovement/RandomMovement.test.d.ts b/dist/mjs/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.test.d.ts similarity index 100% rename from dist/RandomMovement/RandomMovement.test.d.ts rename to dist/mjs/src/GridEnginePhaser/GridTilemapPhaser/GridTilemapPhaser.test.d.ts diff --git a/dist/mjs/src/GridTilemap/ArrayTilemap/ArrayTilemap.d.ts b/dist/mjs/src/GridTilemap/ArrayTilemap/ArrayTilemap.d.ts new file mode 100644 index 00000000..a05ef85e --- /dev/null +++ b/dist/mjs/src/GridTilemap/ArrayTilemap/ArrayTilemap.d.ts @@ -0,0 +1,32 @@ +import { Orientation, Tile, TileLayer, Tilemap } from "../Tilemap.js"; +/** + * Represents a layer for a simple array tilemap. + */ +export interface ArrayTilemapInputLayer { + /** + * Actual tilemap data. + * 0 => unblocked + * 1 => blocked + */ + data: number[][]; + isCharLayer?: boolean; +} +type LayerName = string; +/** + * Very simple tilemap implementation. Can be used as a base for creating your + * own customized tilemap or for simple use cases or testing. + */ +export declare class ArrayTilemap implements Tilemap { + private map; + private orientation; + private layerMap; + private layers; + constructor(map: Record, orientation?: Orientation, collisionPropertyName?: string); + getWidth(): number; + getHeight(): number; + getOrientation(): Orientation; + getLayers(): TileLayer[]; + hasTileAt(x: number, y: number, layer?: string): boolean; + getTileAt(x: number, y: number, layer?: string): Tile | undefined; +} +export {}; diff --git a/dist/TargetMovement/TargetMovement.test.d.ts b/dist/mjs/src/GridTilemap/ArrayTilemap/ArrayTilemap.test.d.ts similarity index 100% rename from dist/TargetMovement/TargetMovement.test.d.ts rename to dist/mjs/src/GridTilemap/ArrayTilemap/ArrayTilemap.test.d.ts diff --git a/dist/mjs/src/GridTilemap/CharBlockCache/CharBlockCache.d.ts b/dist/mjs/src/GridTilemap/CharBlockCache/CharBlockCache.d.ts new file mode 100644 index 00000000..7eed841b --- /dev/null +++ b/dist/mjs/src/GridTilemap/CharBlockCache/CharBlockCache.d.ts @@ -0,0 +1,26 @@ +import { GridCharacter } from "../../GridCharacter/GridCharacter.js"; +import { CharLayer } from "../../GridEngine.js"; +import { Vector2 } from "../../Utils/Vector2/Vector2.js"; +import { CollisionStrategy } from "../../Collisions/CollisionStrategy.js"; +export declare class CharBlockCache { + private collistionStrategy; + private collisionGroupRelation?; + private tilePosToCharacters; + private charRemoved$; + constructor(collistionStrategy: CollisionStrategy, collisionGroupRelation?: Map> | undefined); + isCharBlockingAt(pos: Vector2, layer: CharLayer, collisionGroups: string[], exclude?: Set): boolean; + private collidesWith; + getCharactersAt(pos: Vector2, layer?: string): Set; + addCharacter(character: GridCharacter): void; + removeCharacter(character: GridCharacter): void; + private add; + private addTilePosSetSub; + private charRemoved; + private addPositionChangeSub; + private addPositionChangeFinishedSub; + private addTilePositions; + private deleteTilePositions; + private forEachCharTile; + private posChangeToLayerPos; + private posToString; +} diff --git a/dist/src/GridTilemap/CharBlockCache/CharBlockCache.test.d.ts b/dist/mjs/src/GridTilemap/CharBlockCache/CharBlockCache.test.d.ts similarity index 100% rename from dist/src/GridTilemap/CharBlockCache/CharBlockCache.test.d.ts rename to dist/mjs/src/GridTilemap/CharBlockCache/CharBlockCache.test.d.ts diff --git a/dist/mjs/src/GridTilemap/GridTilemap.d.ts b/dist/mjs/src/GridTilemap/GridTilemap.d.ts new file mode 100644 index 00000000..55db3d1a --- /dev/null +++ b/dist/mjs/src/GridTilemap/GridTilemap.d.ts @@ -0,0 +1,52 @@ +import { Direction } from "./../Direction/Direction.js"; +import { Rect } from "../Utils/Rect/Rect.js"; +import { GridCharacter } from "../GridCharacter/GridCharacter.js"; +import { LayerVecPos } from "../Pathfinding/ShortestPathAlgorithm.js"; +import { CollisionStrategy } from "../Collisions/CollisionStrategy.js"; +import { CharLayer } from "../GridEngine.js"; +import { Tilemap } from "./Tilemap.js"; +import { Vector2 } from "../Utils/Vector2/Vector2.js"; +export declare class GridTilemap { + private tilemap; + private collisionTilePropertyName; + private useTileCollisionCache; + private static readonly ONE_WAY_COLLIDE_PROP_PREFIX; + private characters; + private charBlockCache; + private transitions; + private reverseTransitions; + private collidesPropNames; + private tileCostPropNames; + private collisionRelevantLayersFrameCache; + private tileCollisionCache?; + constructor(tilemap: Tilemap, collisionTilePropertyName: string, collisionStrategy: CollisionStrategy, collisionGroupRelation?: Map> | undefined, useTileCollisionCache?: boolean); + fixCacheLayer(layer: CharLayer): void; + unfixCacheLayers(): void; + addCharacter(character: GridCharacter): void; + removeCharacter(charId: string): void; + getCharacters(): GridCharacter[]; + getCharactersAt(position: Vector2, layer?: string): Set; + rebuildTileCollisionCache(rect?: Rect): void; + hasBlockingTileUncached(pos: Vector2, charLayer: string | undefined, direction?: Direction, ignoreHasTile?: boolean): boolean; + hasBlockingTile(pos: Vector2, charLayer: string | undefined, direction?: Direction, ignoreHasTile?: boolean): boolean; + getTransition(pos: Vector2, fromLayer?: string): string | undefined; + getReverseTransitions(pos: Vector2, targetLayer?: string): Set | undefined; + setTransition(pos: Vector2, fromLayer: CharLayer, toLayer: CharLayer): void; + getTransitions(): Map>; + getTileCosts(pos: LayerVecPos, srcDir?: Direction): number; + private getTileCostsForLayer; + hasNoTileUncached(pos: Vector2, charLayer?: string): boolean; + hasNoTile(pos: Vector2, charLayer?: string): boolean; + hasBlockingChar(pos: Vector2, layer: string | undefined, collisionGroups: string[], exclude?: Set): boolean; + isInRange(pos: Vector2): boolean; + toMapDirection(direction: Direction): Direction; + fromMapDirection(direction: Direction): Direction; + isIsometric(): boolean; + getTilePosInDirection(position: LayerVecPos, direction: Direction): LayerVecPos; + invalidateFrameCache(): void; + private isLayerBlockingAt; + private getCharLayerIndexes; + private findPrevAndCharLayer; + private getCollisionRelevantLayers; + private getLowestCharLayer; +} diff --git a/dist/src/GridTilemap/GridTilemap.test.d.ts b/dist/mjs/src/GridTilemap/GridTilemap.test.d.ts similarity index 100% rename from dist/src/GridTilemap/GridTilemap.test.d.ts rename to dist/mjs/src/GridTilemap/GridTilemap.test.d.ts diff --git a/dist/mjs/src/GridTilemap/Phaser/PhaserTile.d.ts b/dist/mjs/src/GridTilemap/Phaser/PhaserTile.d.ts new file mode 100644 index 00000000..1365ee4f --- /dev/null +++ b/dist/mjs/src/GridTilemap/Phaser/PhaserTile.d.ts @@ -0,0 +1,10 @@ +import { Tile } from "../Tilemap.js"; +import { TiledProject } from "./PhaserTilemap.js"; +export declare class PhaserTile implements Tile { + private phaserTile; + private tiledProject?; + constructor(phaserTile: Phaser.Tilemaps.Tile, tiledProject?: TiledProject | undefined); + getProperty(name: string): any; + hasProperty(name: string): boolean; + private getType; +} diff --git a/dist/Utils/DistanceUtils.test.d.ts b/dist/mjs/src/GridTilemap/Phaser/PhaserTile.test.d.ts similarity index 100% rename from dist/Utils/DistanceUtils.test.d.ts rename to dist/mjs/src/GridTilemap/Phaser/PhaserTile.test.d.ts diff --git a/dist/mjs/src/GridTilemap/Phaser/PhaserTileLayer.d.ts b/dist/mjs/src/GridTilemap/Phaser/PhaserTileLayer.d.ts new file mode 100644 index 00000000..f43b9c94 --- /dev/null +++ b/dist/mjs/src/GridTilemap/Phaser/PhaserTileLayer.d.ts @@ -0,0 +1,12 @@ +import { TileLayer, Tile } from "../Tilemap.js"; +import { TiledProject } from "./PhaserTilemap.js"; +export declare class PhaserTileLayer implements TileLayer { + private phaserTilemapLayer; + private tiledProject?; + constructor(phaserTilemapLayer: Phaser.Tilemaps.TilemapLayer, tiledProject?: TiledProject | undefined); + getName(): string; + getProperty(name: string): string | undefined; + hasProperty(name: string): boolean; + isCharLayer(): boolean; + getData(): Tile[][]; +} diff --git a/dist/src/GlobalConfig/GlobalConfig.test.d.ts b/dist/mjs/src/GridTilemap/Phaser/PhaserTileLayer.test.d.ts similarity index 100% rename from dist/src/GlobalConfig/GlobalConfig.test.d.ts rename to dist/mjs/src/GridTilemap/Phaser/PhaserTileLayer.test.d.ts diff --git a/dist/mjs/src/GridTilemap/Phaser/PhaserTilemap.d.ts b/dist/mjs/src/GridTilemap/Phaser/PhaserTilemap.d.ts new file mode 100644 index 00000000..a9d55c72 --- /dev/null +++ b/dist/mjs/src/GridTilemap/Phaser/PhaserTilemap.d.ts @@ -0,0 +1,26 @@ +import { TileLayer, Orientation, Tile, Tilemap } from "../Tilemap.js"; +export interface TiledProject { + propertyTypes: Array<{ + name: string; + type: string; + members: Array<{ + name: string; + type: string; + propertyType?: string; + value: any; + }>; + }>; +} +export declare class PhaserTilemap implements Tilemap { + private phaserTilemap; + private tiledProject?; + constructor(phaserTilemap: Phaser.Tilemaps.Tilemap, tiledProject?: TiledProject | undefined); + getTileWidth(): number; + getTileHeight(): number; + getWidth(): number; + getHeight(): number; + getOrientation(): Orientation; + getLayers(): TileLayer[]; + hasTileAt(x: number, y: number, layer?: string): boolean; + getTileAt(x: number, y: number, layer?: string): Tile | undefined; +} diff --git a/dist/src/Movement/FollowMovement/FollowMovement.test.d.ts b/dist/mjs/src/GridTilemap/Phaser/PhaserTilemap.test.d.ts similarity index 100% rename from dist/src/Movement/FollowMovement/FollowMovement.test.d.ts rename to dist/mjs/src/GridTilemap/Phaser/PhaserTilemap.test.d.ts diff --git a/dist/mjs/src/GridTilemap/TileCollisionCache/TileCollisionCache.d.ts b/dist/mjs/src/GridTilemap/TileCollisionCache/TileCollisionCache.d.ts new file mode 100644 index 00000000..81070b12 --- /dev/null +++ b/dist/mjs/src/GridTilemap/TileCollisionCache/TileCollisionCache.d.ts @@ -0,0 +1,17 @@ +import { Direction } from "../../Direction/Direction.js"; +import { GridTilemap } from "../GridTilemap.js"; +import { Tilemap } from "../Tilemap.js"; +import { Rect } from "../../Utils/Rect/Rect.js"; +import { CharLayer } from "../../IGridEngine.js"; +export declare class TileCollisionCache { + private tilemap; + private gridTilemap; + private fixedLayer?; + constructor(tilemap: Tilemap, gridTilemap: GridTilemap); + private tileCollisionCache; + fixLayer(layer: CharLayer): void; + unfixLayers(): void; + rebuild(rect?: Rect): void; + hasTileAt(x: number, y: number, layer?: string): boolean | undefined; + isBlockingFrom(x: number, y: number, layer?: string, direction?: Direction, ignoreHasTile?: boolean): boolean | undefined; +} diff --git a/dist/src/Movement/RandomMovement/RandomMovement.test.d.ts b/dist/mjs/src/GridTilemap/TileCollisionCache/TileCollisionCache.test.d.ts similarity index 100% rename from dist/src/Movement/RandomMovement/RandomMovement.test.d.ts rename to dist/mjs/src/GridTilemap/TileCollisionCache/TileCollisionCache.test.d.ts diff --git a/dist/mjs/src/GridTilemap/TiledTilemap/TiledLayer.d.ts b/dist/mjs/src/GridTilemap/TiledTilemap/TiledLayer.d.ts new file mode 100644 index 00000000..a1e9a77b --- /dev/null +++ b/dist/mjs/src/GridTilemap/TiledTilemap/TiledLayer.d.ts @@ -0,0 +1,12 @@ +import { Tile, TileLayer } from "../Tilemap.js"; +import { RawTiledLayer, RawTiledTileset } from "./TiledMap.js"; +export declare class TiledLayer implements TileLayer { + private layer; + private data; + constructor(tilesets: RawTiledTileset[], layer: RawTiledLayer); + getName(): string | undefined; + getProperty(name: string): string | undefined; + hasProperty(name: string): boolean; + getData(): Array>; + isCharLayer(): boolean; +} diff --git a/dist/src/Movement/TargetMovement/Retryable/Retryable.test.d.ts b/dist/mjs/src/GridTilemap/TiledTilemap/TiledLayer.test.d.ts similarity index 100% rename from dist/src/Movement/TargetMovement/Retryable/Retryable.test.d.ts rename to dist/mjs/src/GridTilemap/TiledTilemap/TiledLayer.test.d.ts diff --git a/dist/mjs/src/GridTilemap/TiledTilemap/TiledMap.d.ts b/dist/mjs/src/GridTilemap/TiledTilemap/TiledMap.d.ts new file mode 100644 index 00000000..cca8b959 --- /dev/null +++ b/dist/mjs/src/GridTilemap/TiledTilemap/TiledMap.d.ts @@ -0,0 +1,30 @@ +export interface RawTiledTilemap { + width?: number; + height?: number; + orientation?: string; + layers?: RawTiledLayer[]; +} +export interface RawTiledLayer { + name?: string; + scale?: number; + properties?: { + name: string; + value: string; + }[]; + height?: number; + width?: number; + data?: number[]; +} +export interface RawTiledTileset { + firstgid?: number; + tiles?: RawTiledTilesetTile[]; +} +export interface RawTiledTilesetTileProp { + name?: string; + type?: string; + value?: any; +} +export interface RawTiledTilesetTile { + id: number; + properties?: RawTiledTilesetTileProp[]; +} diff --git a/dist/mjs/src/GridTilemap/TiledTilemap/TiledTile.d.ts b/dist/mjs/src/GridTilemap/TiledTilemap/TiledTile.d.ts new file mode 100644 index 00000000..891f8271 --- /dev/null +++ b/dist/mjs/src/GridTilemap/TiledTilemap/TiledTile.d.ts @@ -0,0 +1,8 @@ +import { Tile } from "../Tilemap.js"; +import { RawTiledTileset } from "./TiledMap.js"; +export declare class TiledTile implements Tile { + private props; + constructor(tilesets: RawTiledTileset[], tileId: number); + getProperty(name: string): any; + hasProperty(name: string): boolean; +} diff --git a/dist/src/Movement/TargetMovement/TargetMovement.test.d.ts b/dist/mjs/src/GridTilemap/TiledTilemap/TiledTile.test.d.ts similarity index 100% rename from dist/src/Movement/TargetMovement/TargetMovement.test.d.ts rename to dist/mjs/src/GridTilemap/TiledTilemap/TiledTile.test.d.ts diff --git a/dist/mjs/src/GridTilemap/TiledTilemap/TiledTilemap.d.ts b/dist/mjs/src/GridTilemap/TiledTilemap/TiledTilemap.d.ts new file mode 100644 index 00000000..83554359 --- /dev/null +++ b/dist/mjs/src/GridTilemap/TiledTilemap/TiledTilemap.d.ts @@ -0,0 +1,20 @@ +import { Orientation, Tile, TileLayer, Tilemap } from "../Tilemap.js"; +export declare const CHAR_LAYER_PROP_NAME = "ge_charLayer"; +/** + * Simple implementation of the Tilemap interface, using a parsed version of a + * Tiled tilemap. + * + * Example usage: + * `new TiledTilemap(JSON.parse(tiledTilemapAsString))` + */ +export declare class TiledTilemap implements Tilemap { + private rawTilemap; + private layers; + constructor(rawTilemap: any); + hasTileAt(x: number, y: number, layer: string): boolean; + getTileAt(x: number, y: number, layer: string): Tile | undefined; + getOrientation(): Orientation; + getLayers(): TileLayer[]; + getWidth(): number; + getHeight(): number; +} diff --git a/dist/src/Pathfinding/Bfs/Bfs.test.d.ts b/dist/mjs/src/GridTilemap/TiledTilemap/TiledTilemap.test.d.ts similarity index 100% rename from dist/src/Pathfinding/Bfs/Bfs.test.d.ts rename to dist/mjs/src/GridTilemap/TiledTilemap/TiledTilemap.test.d.ts diff --git a/dist/mjs/src/GridTilemap/Tilemap.d.ts b/dist/mjs/src/GridTilemap/Tilemap.d.ts new file mode 100644 index 00000000..ed649be5 --- /dev/null +++ b/dist/mjs/src/GridTilemap/Tilemap.d.ts @@ -0,0 +1,21 @@ +export type Orientation = "isometric" | "orthogonal"; +export declare const CHAR_LAYER_PROP_NAME = "ge_charLayer"; +export interface Tile { + getProperty(name: string): any; + hasProperty(name: string): boolean; +} +export interface TileLayer { + getName(): string | undefined; + getProperty(name: string): string | undefined; + hasProperty(name: string): boolean; + getData(): Array>; + isCharLayer(): boolean; +} +export interface Tilemap { + getWidth(): number; + getHeight(): number; + getOrientation(): Orientation; + getLayers(): TileLayer[]; + hasTileAt(x: number, y: number, layer?: string): boolean; + getTileAt(x: number, y: number, layer?: string): Tile | undefined; +} diff --git a/dist/mjs/src/IGridEngine.d.ts b/dist/mjs/src/IGridEngine.d.ts new file mode 100644 index 00000000..8e1503e4 --- /dev/null +++ b/dist/mjs/src/IGridEngine.d.ts @@ -0,0 +1,546 @@ +import { Direction } from "./Direction/Direction.js"; +import { MovementInfo } from "./Movement/Movement.js"; +import { Finished, MoveToConfig } from "./Movement/TargetMovement/TargetMovement.js"; +import { QueueMovementConfig, QueueMovementEntry, Finished as QueueMovementFinished } from "./Movement/QueueMovement/QueueMovement.js"; +import { Observable } from "rxjs"; +import { CharacterFilteringOptions } from "./GridCharacter/CharacterFilter/CharacterFilter.js"; +import { PathfindingOptions } from "./Pathfinding/Pathfinding.js"; +import { PositionChange } from "./GridCharacter/GridCharacter.js"; +import { ShortestPathAlgorithmType } from "./Pathfinding/ShortestPathAlgorithm.js"; +export type CharLayer = string | undefined; +/** + * Specifies a tile position along with a character layer. + */ +export interface LayerPosition { + position: Position; + charLayer: CharLayer; +} +export interface Position { + x: number; + y: number; +} +/** + * Result of a pathfinding algorithm run. + * + * @category Pathfinding + */ +export interface PathfindingResult { + steps: number; + /** + * Actual shortest path. Contains an empty array if no path has + * been found. + */ + path: LayerPosition[]; + /** + * Only set, if {@link PathfindingOptions.calculateClosestToTarget} is set. + * It will still be set in algorithms where it does not come with a + * performance penalty (like BFS). + * If no path could be found, it contains one position that has the closest + * distance to the target. The distance is either + * {@link https://en.wikipedia.org/wiki/Taxicab_geometry | manhattan distance} + * in case of 4 direction mode or + * {@link https://en.wikipedia.org/wiki/Chebyshev_distance | Chebyshev distance} + * in case of 8 direction mode. + */ + closestToTarget?: LayerPosition; + /** + * In case that {@link PathfindingOptions.maxPathLength} was set, this + * property indicates that pathfinding stopped because it reached that maximum + * path lenght. + */ + reachedMaxPathLength: boolean; +} +/** + * @category Pathfinding + */ +export interface FollowOptions { + /** + * Minimum distance to keep to `charIdToFollow` in + * {@link https://en.wikipedia.org/wiki/Taxicab_geometry | manhattan distance} + * in case of 4 direction mode and with and + * {@link https://en.wikipedia.org/wiki/Chebyshev_distance | Chebyshev distance} + * in case of 8 direction mode. + */ + distance?: number; + /** + * `charId` will move to the closest point + * ({@link https://en.wikipedia.org/wiki/Taxicab_geometry | manhattan distance} + * in case of 4 direction mode and with and + * {@link https://en.wikipedia.org/wiki/Chebyshev_distance | Chebyshev distance} + * in case of 8 direction mode) + * to `charIdToFollow` that is reachable from `charId` in case that there + * does not exist a path between `charId` and `charIdToFollow`. + */ + closestPointIfBlocked?: boolean; + /** + * If this is set, the algorithm will stop once it reaches a path length of + * this value. This is useful to avoid running out of memory on large or + * infinite maps. + */ + maxPathLength?: number; + /** + * Algorithm to use for pathfinding. + */ + algorithm?: ShortestPathAlgorithmType; + /** + * If set to `true`, pathfinding will only be performed on the char layer of + * the start position. If you don't use char layers, activating this setting + * can improve pathfinding performance. + * + * @default false + */ + ignoreLayers?: boolean; +} +/** + * Result of a modification of the internal characters array + */ +export interface CharacterShift { + /** the modified character */ + charId: string; + /** The action that was performed when modifying the character */ + action: CharacterShiftAction; +} +/** + * Type of modification of grid engine characters + */ +export declare enum CharacterShiftAction { + /** removed existing character */ + REMOVED = "REMOVED", + /** added new character */ + ADDED = "ADDED" +} +export interface IGridEngine { + /** + * Returns the character layer of the given character. + * You can read more about character layers and transitions + * {@link https://annoraaq.github.io/grid-engine/p/character-layers | here} + * + * @category Character + */ + getCharLayer(charId: string): string | undefined; + /** + * @returns The character layer that the transition on the given position and + * character layer leads to. + * + * @beta + * + * @category Tilemap + */ + getTransition(position: Position, fromLayer: string): string | undefined; + /** + * Sets the character layer `toLayer` that the transition on position + * `position` from character layer `fromLayer` should lead to. + * You can read more about character layers and transitions + * {@link https://annoraaq.github.io/grid-engine/p/character-layers | here} + * + * @param position Position of the new transition + * @param fromLayer Character layer the new transition should start at + * @param toLayer Character layer the new transition should lead to + * + * @beta + * + * @category Tilemap + */ + setTransition(position: Position, fromLayer: string, toLayer: string): void; + /** + * @returns The tile position of the character with the given id + * + * @category Character + */ + getPosition(charId: string): Position; + /** + * Initiates movement of the character with the given id. If the character is + * already moving nothing happens. If the movement direction is currently + * blocked, the character will only turn towards that direction. Movement + * commands are **not** queued. + * + * @category Basic Movement + */ + move(charId: string, direction: Direction): void; + /** + * Initiates random movement of the character with the given id. The + * character will randomly pick one of the non-blocking directions. + * Optionally a `delay` in milliseconds can be provided. This represents the + * waiting time after a finished movement, before the next is being initiated. + * If a `radius` other than -1 is provided, the character will not move + * further than that radius from its initial position (the position it has + * been, when `moveRandomly` was called). The distance is calculated with the + * {@link https://en.wikipedia.org/wiki/Taxicab_geometry | manhattan distance} + * in case of 4 direction mode and with and + * {@link https://en.wikipedia.org/wiki/Chebyshev_distance | Chebyshev distance} + * in case of 8 direction mode. Additionally, if a `radius` other than -1 was + * given, the character might move more than one tile into a random direction + * in one run (as long as the route is neither blocked nor outside of the + * radius). + * + * @category Random Movement + */ + moveRandomly(charId: string, delay: number, radius: number): void; + /** + * @returns Information about the current automatic movement (including + * random movement, follow movement and target movement) + * + * @category Character + */ + getMovement(charId: string): MovementInfo; + /** + * Initiates movement toward the specified `targetPos`. The movement will + * happen along one shortest path. Check out {@link MoveToConfig} for + * pathfinding configurations. + * + * @returns an observable that will fire + * whenever the moveTo movement is finished or aborted. It will provide a + * {@link MoveToResult | result code} as well as a description and a character + * layer. + * + * @category Pathfinding + */ + moveTo(charId: string, targetPos: Position, config?: MoveToConfig): Observable<{ + charId: string; + } & Finished>; + /** + * Stops any automated movement such as random movement + * ({@link moveRandomly}), following ({@link follow}), moving to a + * specified position ({@link moveTo}) or queued movements ({@link addQueueMovements}). + * + * @category Character + */ + stopMovement(charId: string): void; + /** + * Sets the speed in tiles per second for a character. + * + * @category Character + */ + setSpeed(charId: string, speed: number): void; + /** + * @returns Speed in tiles per second for a character. + * + * @category Character + */ + getSpeed(charId: string): number; + /** + * @returns true if the character is able to collide with the tilemap. Don't + * confuse this with an actual collision check. You should use + * {@link isBlocked} or {@link isTileBlocked} for this. + * + * @category Character + */ + collidesWithTiles(charId: string): boolean; + /** + * @category Grid Engine + */ + update(_time: number, delta: number): void; + /** + * Checks whether a character with the given ID is registered. + * + * @category Grid Engine + */ + hasCharacter(charId: string): boolean; + /** + * Removes the character with the given ID from the plugin. + * Please note that the corresponding sprites need to be remove separately. + * + * @category Grid Engine + */ + removeCharacter(charId: string): void; + /** + * Removes all characters from the plugin. + * Please note that the corresponding sprites need to be remove separately. + * + * @category Grid Engine + */ + removeAllCharacters(): void; + /** + * @returns All character IDs that are registered in the plugin, satisfying + * the provided filtering options. + */ + getAllCharacters(options?: CharacterFilteringOptions): string[]; + /** + * @returns All labels, attached to the character. + * + * @category Character + */ + getLabels(charId: string): string[]; + /** + * Add labels to the character. + * + * @category Character + */ + addLabels(charId: string, labels: string[]): void; + /** + * Remove labels from the character. + * + * @category Character + */ + removeLabels(charId: string, labels: string[]): void; + /** + * Removes all labels from the character. + * + * @category Character + */ + clearLabels(charId: string): void; + /** + * Character `charId` will start to walk towards `charIdToFollow` on a + * shortest path until it reaches the specified `distance`. + * + * @param charId ID of character that should follow + * @param charIdToFollow ID of character that should be followed + * + * @category Pathfinding + */ + follow(charId: string, charIdToFollow: string, options?: FollowOptions): void; + /** + * @deprecated + * Use follow(charId: string, charIdToFollow: string, options: FollowOptions): void; + * instead. + * + * Character `charId` will start to walk towards `charIdToFollow` on a + * shortest path until it reaches the specified `distance`. + * + * @param charId ID of character that should follow + * @param charIdToFollow ID of character that should be followed + * @param distance Minimum distance to keep to `charIdToFollow` in + * {@link https://en.wikipedia.org/wiki/Taxicab_geometry | manhattan distance} + * in case of 4 direction mode and with and + * {@link https://en.wikipedia.org/wiki/Chebyshev_distance | Chebyshev distance} + * in case of 8 direction mode. + * @param closestPointIfBlocked `charId` will move to the closest point + * ({@link https://en.wikipedia.org/wiki/Taxicab_geometry | manhattan distance} + * in case of 4 direction mode and with and + * {@link https://en.wikipedia.org/wiki/Chebyshev_distance | Chebyshev distance} + * in case of 8 direction mode) + * to `charIdToFollow` that is reachable from `charId` in case that there + * does not exist a path between `charId` and `charIdToFollow`. + */ + follow(charId: string, charIdToFollow: string, distance?: number, closestPointIfBlocked?: boolean): void; + follow(charId: string, charIdToFollow: string, distance?: FollowOptions | number, closestPointIfBlocked?: boolean): void; + /** + * @returns True if the character is currently moving. + * + * @category Chatacter State + */ + isMoving(charId: string): boolean; + /** + * @returns Direction the character is currently facing. At time of creation + * this is `down`. + * + * @category Character + */ + getFacingDirection(charId: string): Direction; + /** + * @returns Position the character is currently facing. + * + * @category Character + */ + getFacingPosition(charId: string): Position; + /** + * Turns the character towards the given direction without moving it. + * + * @category Basic Movement + */ + turnTowards(charId: string, direction: Direction): void; + /** + * Finds the identifiers of all characters at the provided tile position. + * @returns The identifiers of all characters on this tile. + * + * @category Tilemap + */ + getCharactersAt(position: Position, layer?: string): string[]; + /** + * Places the character with the given id to the provided tile position. If + * that character is moving, the movement is stopped. The + * {@link positionChangeStarted} and {@link positionChangeFinished} observables will + * emit. If the character was moving, the {@link movementStopped} observable + * will also emit. + * + * @category Character + */ + setPosition(charId: string, pos: Position, layer?: string): void; + /** + * Checks whether the given position is blocked by either the tilemap or a + * blocking character. If you provide no layer, be sure not to use character + * layers in your tilemap. + * + * @returns True if position on given layer is blocked by the tilemap or a + * character + * + * @category Tilemap + */ + isBlocked(position: Position, layer?: string, collisionGroups?: string[]): boolean; + /** + * Checks whether the given position is blocked by the tilemap. If you provide + * no layer, be sure not to use character layers in your tilemap. + * + * @returns True if position on given layer is blocked by the tilemap. + * + * @category Tilemap + */ + isTileBlocked(position: Position, layer?: string): boolean; + /** + * Returns all collision groups of the given character. + * {@link https://annoraaq.github.io/grid-engine/examples/collision-groups | Collision Groups Example} + * + * @returns All collision groups of the given character. + * + * @category Character + */ + getCollisionGroups(charId: string): string[]; + /** + * Sets collision groups for the given character. Previous collision groups + * will be overwritten. + * + * @category Character + */ + setCollisionGroups(charId: string, collisionGroups: string[]): void; + /** + * Gets the tile position and character layer adjacent to the given + * position in the given direction. + * + * @category Tilemap + */ + getTilePosInDirection(position: Position, charLayer: string | undefined, direction: Direction): LayerPosition; + /** + * Returns the shortest path from source to destination. + * + * @param source Source position + * @param dest Destination position + * @param options Pathfinding options + * @returns Shortest path. In case that no path could be found, + * `closestToTarget` is a position with a minimum distance to the target. + * + * @alpha + * + * @category Pathfinding + */ + findShortestPath(source: LayerPosition, dest: LayerPosition, options?: PathfindingOptions): PathfindingResult; + /** + * @returns Observable that, whenever a specified position is entered on optionally provided layers, + * will notify with the target characters position change + * + * @category Basic Movement + */ + steppedOn(charIds: string[], tiles: Position[], layer?: CharLayer[]): Observable<{ + charId: string; + } & PositionChange>; + /** + * @returns Observable that emits when a new character is added or an existing is removed. + * + * @category Grid Engine + */ + characterShifted(): Observable; + /** + * @returns Observable that on each start of a movement will provide the + * character ID and the direction. + * + * @category Character + */ + movementStarted(): Observable<{ + charId: string; + direction: Direction; + }>; + /** + * @returns Observable that on each stopped movement of a character will + * provide it’s ID and the direction of that movement. + * + * @category Character + */ + movementStopped(): Observable<{ + charId: string; + direction: Direction; + }>; + /** + * @returns Observable that will notify about every change of direction that + * is not part of a movement. This is the case if the character tries to walk + * towards a blocked tile. The character will turn but not move. + * It also emits when you call {@link GridEngine.turnTowards}. + * + * This obsersable never emits more than one time in a row for the same + * direction. + * So for instance, if {@link GridEngine.turnTowards} is called multiple times + * in a row (without any facing direction change occurring inbetween) with the + * same direction, this observable would only emit once. + * + * @category Character + */ + directionChanged(): Observable<{ + charId: string; + direction: Direction; + }>; + /** + * @returns Observable that will notify about every change of tile position. + * It will notify at the beginning of the movement. + * + * @category Character + */ + positionChangeStarted(): Observable<{ + charId: string; + } & PositionChange>; + /** + * @returns Observable that will notify about every change of tile position. + * It will notify at the end of the movement. + * + * @category Character + */ + positionChangeFinished(): Observable<{ + charId: string; + } & PositionChange>; + /** + * Returns the movement progress (0-1000) of a character to the next tile. For + * example, if a character has movement progress 400 that means that it has + * moved 400/1000th of the distance to the next tile already. + * + * @category Character + */ + getMovementProgress(charId: string): number; + /** + * Refresh the tile collision cache. For performance reasons, you should + * provide an area that needs to be rebuilt, if possible. You need to have + * {@link GridEngineConfigHeadless.cacheTileCollisions} enabled. + * + * For more information on pathfinding performance check out + * {@link https://annoraaq.github.io/grid-engine/p/pathfinding-performance/| pathfinding performance}. + * + * @category Grid Engine + */ + rebuildTileCollisionCache(x: number, y: number, width: number, height: number): void; + /** + * Adds new positions to the movement queue. Any other automatic movement of + * the character will be stopped. + * @param charId + * @param positions Positions to enqueue + * @param options Options for the queue movement. These options take effect + * immediately (also for previously enqueued but not yet executed movements). + * + * @category Queue Movement + */ + addQueueMovements(charId: string, positions: Array, options?: QueueMovementConfig): any; + /** + * Returns all enqueued movements for the given character. + * + * @category Queue Movement + */ + getEnqueuedMovements(charId: string): QueueMovementEntry[]; + /** + * Clears the complete movement queue for the character, that was filled by + * using {@link IGridEngine.addQueueMovements}. + * + * @category Queue Movement + */ + clearEnqueuedMovements(charId: string): void; + /** + * Emits whenever queued movements for a character finish (with success or + * failure). + * + * @category Queue Movement + */ + queueMovementFinished(): Observable<{ + charId: string; + } & QueueMovementFinished>; + /** + * Returns the {@link https://annoraaq.github.io/grid-engine/p/tile-properties/#pathfinding-costs | tile cost} + * for a position. + * + * @category Pathfinding + */ + getTileCost(position: Position, charLayer?: string, srcDirection?: Direction): number; +} diff --git a/dist/mjs/src/Movement/FollowMovement/FollowMovement.d.ts b/dist/mjs/src/Movement/FollowMovement/FollowMovement.d.ts new file mode 100644 index 00000000..6f1caa60 --- /dev/null +++ b/dist/mjs/src/Movement/FollowMovement/FollowMovement.d.ts @@ -0,0 +1,24 @@ +import { GridTilemap } from "../../GridTilemap/GridTilemap.js"; +import { GridCharacter } from "../../GridCharacter/GridCharacter.js"; +import { Movement, MovementInfo } from "../Movement.js"; +import { ShortestPathAlgorithmType } from "../../GridEngine.js"; +import { NoPathFoundStrategy } from "../../Pathfinding/NoPathFoundStrategy.js"; +export interface Options { + distance?: number; + noPathFoundStrategy?: NoPathFoundStrategy; + maxPathLength?: number; + shortestPathAlgorithm?: ShortestPathAlgorithmType; + ignoreLayers?: boolean; + considerCosts?: boolean; +} +export declare class FollowMovement implements Movement { + private character; + private gridTilemap; + private charToFollow; + private targetMovement?; + private options; + constructor(character: GridCharacter, gridTilemap: GridTilemap, charToFollow: GridCharacter, options?: Options); + update(delta: number): void; + getInfo(): MovementInfo; + private updateTarget; +} diff --git a/dist/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.test.d.ts b/dist/mjs/src/Movement/FollowMovement/FollowMovement.test.d.ts similarity index 100% rename from dist/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.test.d.ts rename to dist/mjs/src/Movement/FollowMovement/FollowMovement.test.d.ts diff --git a/dist/Movement/Movement.d.ts b/dist/mjs/src/Movement/Movement.d.ts similarity index 71% rename from dist/Movement/Movement.d.ts rename to dist/mjs/src/Movement/Movement.d.ts index c2eaab0f..d8e2f0b6 100644 --- a/dist/Movement/Movement.d.ts +++ b/dist/mjs/src/Movement/Movement.d.ts @@ -11,4 +11,9 @@ export interface MovementInfo { * type */ config?: Record; + /** + * Current state of movement. This is custom for every automatic movement + * type + */ + state?: Record; } diff --git a/dist/mjs/src/Movement/QueueMovement/QueueMovement.d.ts b/dist/mjs/src/Movement/QueueMovement/QueueMovement.d.ts new file mode 100644 index 00000000..86a9d067 --- /dev/null +++ b/dist/mjs/src/Movement/QueueMovement/QueueMovement.d.ts @@ -0,0 +1,127 @@ +import { Direction } from "../../Direction/Direction.js"; +import { GridCharacter } from "../../GridCharacter/GridCharacter.js"; +import { GridTilemap } from "../../GridTilemap/GridTilemap.js"; +import { LayerVecPos } from "../../Pathfinding/ShortestPathAlgorithm.js"; +import { Movement, MovementInfo } from "../Movement.js"; +import { Subject } from "rxjs"; +import { CharLayer, LayerPosition, Position } from "../../IGridEngine.js"; +import { Concrete } from "../../Utils/TypeUtils.js"; +/** + * @category Queue Movement + */ +export interface QueueMovementConfig { + /** + * Determines what happens if the next position on the enqueued path is blocked. + * For the different strategies see {@link QueuedPathBlockedStrategy}. + * @default QueuePathBlockedStrategy.STOP + */ + pathBlockedStrategy?: QueuedPathBlockedStrategy; + /** + * Only relevant if {@link QueueMovementConfig.pathBlockedStrategy} is set to {@link QueuedPathBlockedStrategy.WAIT}. + * + * It sets the number of milliseconds that Grid Engine will wait + * for the path to become unblocked again before stopping the movement. + * + * If not set, Grid Engine will wait forever (equals a value of `-1`). + * @default `-1` + */ + pathBlockedWaitTimeoutMs?: number; + /** + * If `true`, it will not enqueue a tile position that is invalid, meaning not + * adjacent to the last position in the queue. It does *not* ignore blocked + * positions or positions that do not have a valid layer transition. The + * reason for this is that blocked positions or missing layer transitions + * might not be missing/blocked anymore when the character actually tries to + * move. + * + * @default `false` + */ + ignoreInvalidPositions?: boolean; + /** + * If `true`, it will not stop when an invalid (not blocked) movement is to be + * executed. Instead it will simply drop that movement and try the next one. + * Please note that in contrast to + * {@link QueueMovementConfig.ignoreInvalidPositions} this also includes + * movements that cannot be performed due to missing transitions. + * + * To control what happens with blocked positions, use + * {@link QueueMovementConfig.pathBlockedStrategy} + * + * @default `false` + */ + skipInvalidPositions?: boolean; +} +/** + * Determines what happens if the next position on the enqueued path is blocked. + * + * @category Queue Movement + */ +export declare enum QueuedPathBlockedStrategy { + /** + * Makes the character wait (forever or until given + * {@link QueueMovementConfig.pathBlockedWaitTimeoutMs}) until the path will + * be free again. + */ + WAIT = "WAIT", + /** + * Makes the character skip the current movement and try the next in the + * queue. + */ + SKIP = "SKIP", + /** + * Makes the character stop the movement. + */ + STOP = "STOP" +} +/** + * @category Queue Movement + */ +export type QueueMovementResult = "SUCCESS" | "INVALID_NEXT_POS" | "MOVEMENT_TERMINATED" | "PATH_BLOCKED" | "PATH_BLOCKED_WAIT_TIMEOUT"; +/** + * @category Queue Movement + */ +export interface Finished { + position: Position; + result?: QueueMovementResult; + description?: string; + layer: CharLayer; +} +interface QueueEntry { + command: LayerVecPos | Direction; + config: Concrete; +} +/** + * @category Queue Movement + */ +export interface QueueMovementEntry { + command: LayerPosition | Direction; + config: Concrete; +} +export declare class QueueMovement implements Movement { + private character; + private tilemap; + private queue; + private finished$; + private distanceUtils; + private pathBlockedWaitElapsed; + constructor(character: GridCharacter, tilemap: GridTilemap); + update(delta: number): void; + getInfo(): MovementInfo; + enqueue(positions: Array, config?: QueueMovementConfig): void; + peekAll(): QueueEntry[]; + size(): number; + finished(): Subject; + clear(): void; + private moveCharOnPath; + private getNextValidPosition; + private isLastMovement; + private isNeighborPos; + private finishMovementTerminated; + private finishInvalidNextPos; + private finishPathBlocked; + private finishBlockedWaitTimeout; + private finish; + private getDir; + private posToStr; +} +export {}; diff --git a/dist/src/Utils/DistanceUtils4/DistanceUtils4.test.d.ts b/dist/mjs/src/Movement/QueueMovement/QueueMovement.test.d.ts similarity index 100% rename from dist/src/Utils/DistanceUtils4/DistanceUtils4.test.d.ts rename to dist/mjs/src/Movement/QueueMovement/QueueMovement.test.d.ts diff --git a/dist/Movement/RandomMovement/RandomMovement.d.ts b/dist/mjs/src/Movement/RandomMovement/RandomMovement.d.ts similarity index 72% rename from dist/Movement/RandomMovement/RandomMovement.d.ts rename to dist/mjs/src/Movement/RandomMovement/RandomMovement.d.ts index e17e3158..e3222137 100644 --- a/dist/Movement/RandomMovement/RandomMovement.d.ts +++ b/dist/mjs/src/Movement/RandomMovement/RandomMovement.d.ts @@ -1,6 +1,5 @@ -import { NumberOfDirections } from "./../../Direction/Direction"; -import { GridCharacter } from "../../GridCharacter/GridCharacter"; -import { Movement, MovementInfo } from "../Movement"; +import { GridCharacter } from "../../GridCharacter/GridCharacter.js"; +import { Movement, MovementInfo } from "../Movement.js"; export declare class RandomMovement implements Movement { private character; private delay; @@ -12,7 +11,7 @@ export declare class RandomMovement implements Movement { private stepsWalked; private currentMovementDirection; private distanceUtils; - constructor(character: GridCharacter, numberOfDirections?: NumberOfDirections, delay?: number, radius?: number); + constructor(character: GridCharacter, delay?: number, radius?: number); update(delta: number): void; getInfo(): MovementInfo; private shouldContinueWalkingCurrentDirection; diff --git a/dist/src/Utils/DistanceUtils8/DistanceUtils8.test.d.ts b/dist/mjs/src/Movement/RandomMovement/RandomMovement.test.d.ts similarity index 100% rename from dist/src/Utils/DistanceUtils8/DistanceUtils8.test.d.ts rename to dist/mjs/src/Movement/RandomMovement/RandomMovement.test.d.ts diff --git a/dist/src/Movement/TargetMovement/Retryable/Retryable.d.ts b/dist/mjs/src/Movement/TargetMovement/Retryable/Retryable.d.ts similarity index 100% rename from dist/src/Movement/TargetMovement/Retryable/Retryable.d.ts rename to dist/mjs/src/Movement/TargetMovement/Retryable/Retryable.d.ts diff --git a/dist/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.test.d.ts b/dist/mjs/src/Movement/TargetMovement/Retryable/Retryable.test.d.ts similarity index 100% rename from dist/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.test.d.ts rename to dist/mjs/src/Movement/TargetMovement/Retryable/Retryable.test.d.ts diff --git a/dist/Movement/TargetMovement/TargetMovement.d.ts b/dist/mjs/src/Movement/TargetMovement/TargetMovement.d.ts similarity index 60% rename from dist/Movement/TargetMovement/TargetMovement.d.ts rename to dist/mjs/src/Movement/TargetMovement/TargetMovement.d.ts index 91b9bb8f..06153de6 100644 --- a/dist/Movement/TargetMovement/TargetMovement.d.ts +++ b/dist/mjs/src/Movement/TargetMovement/TargetMovement.d.ts @@ -1,13 +1,15 @@ -import { LayerName } from "./../../GridTilemap/GridTilemap"; -import { NoPathFoundStrategy } from "./../../Pathfinding/NoPathFoundStrategy"; -import { NumberOfDirections } from "./../../Direction/Direction"; -import { LayerPosition } from "./../../Pathfinding/ShortestPathAlgorithm"; -import { GridTilemap } from "../../GridTilemap/GridTilemap"; -import { GridCharacter } from "../../GridCharacter/GridCharacter"; -import { Movement, MovementInfo } from "../Movement"; -import { PathBlockedStrategy } from "../../Pathfinding/PathBlockedStrategy"; -import { Position } from "../../GridEngine"; +import { NoPathFoundStrategy } from "./../../Pathfinding/NoPathFoundStrategy.js"; +import { LayerVecPos, ShortestPathAlgorithmType } from "./../../Pathfinding/ShortestPathAlgorithm.js"; +import { GridTilemap } from "../../GridTilemap/GridTilemap.js"; +import { GridCharacter } from "../../GridCharacter/GridCharacter.js"; +import { Movement, MovementInfo } from "../Movement.js"; +import { PathBlockedStrategy } from "../../Pathfinding/PathBlockedStrategy.js"; +import { CharLayer, LayerPosition, Position } from "../../GridEngine.js"; import { Subject } from "rxjs"; +import { IsPositionAllowedFn } from "../../Pathfinding/Pathfinding.js"; +/** + * @category Pathfinding + */ export interface MoveToConfig { /** * Determines what happens if no path could be found. For the different @@ -60,7 +62,47 @@ export interface MoveToConfig { * the current char layer of the moving character is used. */ targetLayer?: string; + /** + * Function to specify whether a certain position is allowed for pathfinding. + * If the function returns false, the tile will be consindered as blocked. + * + * It can be used to restrict pathfinding to specific regions. + * + * Beware that this method can become a performance bottleneck easily. So be + * careful and keep it as efficient as possible. An asymptotic runtime + * complexity of O(1) is recommended. + */ + isPositionAllowedFn?: IsPositionAllowedFn; + /** + * Algorithm to use for pathfinding. + */ + algorithm?: ShortestPathAlgorithmType; + /** + * If this is set, the algorithm will stop once it reaches a path length of + * this value. This is useful to avoid running out of memory on large or + * infinite maps. + */ + maxPathLength?: number | undefined; + /** + * If set to `true`, pathfinding will only be performed on the char layer of + * the start position. If you don't use char layers, activating this setting + * can improve pathfinding performance. + * + * @default false + */ + ignoreLayers?: boolean; + /** + * Only considered by A* algorithm. + * If set to `true`, pathfinding will consider costs. Costs are set via tile + * properties. + * + * @default false + */ + considerCosts?: boolean; } +/** + * @category Pathfinding + */ export declare enum MoveToResult { SUCCESS = "SUCCESS", NO_PATH_FOUND_MAX_RETRIES_EXCEEDED = "NO_PATH_FOUND_MAX_RETRIES_EXCEEDED", @@ -68,20 +110,38 @@ export declare enum MoveToResult { PATH_BLOCKED = "PATH_BLOCKED", NO_PATH_FOUND = "NO_PATH_FOUND", PATH_BLOCKED_WAIT_TIMEOUT = "PATH_BLOCKED_WAIT_TIMEOUT", - MOVEMENT_TERMINATED = "MOVEMENT_TERMINATED" + MOVEMENT_TERMINATED = "MOVEMENT_TERMINATED", + MAX_PATH_LENGTH_REACHED = "MAX_PATH_LENGTH_REACHED" } +/** + * @category Pathfinding + */ export interface Finished { position: Position; result?: MoveToResult; description?: string; - layer: LayerName; + layer: CharLayer; } export interface Options { - numberOfDirections?: NumberOfDirections; distance?: number; config?: MoveToConfig; ignoreBlockedTarget?: boolean; } +export interface MoveToInfo extends MovementInfo { + state: { + pathAhead: LayerPosition[]; + }; + config: { + algorithm: ShortestPathAlgorithmType; + ignoreBlockedTarget: boolean; + distance: number; + targetPos: LayerPosition; + noPathFoundStrategy: NoPathFoundStrategy; + pathBlockedStrategy: PathBlockedStrategy; + noPathFoundRetryBackoffMs: number; + noPathFoundMaxRetries: number; + }; +} export declare class TargetMovement implements Movement { private character; private tilemap; @@ -99,15 +159,20 @@ export declare class TargetMovement implements Movement { private distanceUtils; private finished$; private ignoreBlockedTarget; + private ignoreLayers; private distance; - constructor(character: GridCharacter, tilemap: GridTilemap, targetPos: LayerPosition, { numberOfDirections, config, ignoreBlockedTarget, distance, }?: Options); + private isPositionAllowed; + private shortestPathAlgorithm; + private maxPathLength; + private considerCosts; + constructor(character: GridCharacter, tilemap: GridTilemap, targetPos: LayerVecPos, { config, ignoreBlockedTarget, distance }?: Options); setPathBlockedStrategy(pathBlockedStrategy: PathBlockedStrategy): void; getPathBlockedStrategy(): PathBlockedStrategy; private setCharacter; + private getPathfindingOptions; update(delta: number): void; - getNeighbours: (pos: LayerPosition) => LayerPosition[]; finishedObs(): Subject; - getInfo(): MovementInfo; + getInfo(): MoveToInfo; private resultToReason; private applyPathBlockedStrategy; private moveCharOnPath; diff --git a/dist/src/Utils/LayerPositionUtils/LayerPositionUtils.test.d.ts b/dist/mjs/src/Movement/TargetMovement/TargetMovement.test.d.ts similarity index 100% rename from dist/src/Utils/LayerPositionUtils/LayerPositionUtils.test.d.ts rename to dist/mjs/src/Movement/TargetMovement/TargetMovement.test.d.ts diff --git a/dist/mjs/src/Pathfinding/AStar/AStar.d.ts b/dist/mjs/src/Pathfinding/AStar/AStar.d.ts new file mode 100644 index 00000000..398b7037 --- /dev/null +++ b/dist/mjs/src/Pathfinding/AStar/AStar.d.ts @@ -0,0 +1,6 @@ +import { LayerVecPos, ShortestPathAlgorithm, ShortestPathResult } from "../ShortestPathAlgorithm.js"; +export declare class AStar extends ShortestPathAlgorithm { + findShortestPathImpl(startPos: LayerVecPos, targetPos: LayerVecPos): ShortestPathResult; + private shortestPathBfs; + private returnPath; +} diff --git a/dist/src/Utils/RandomUtils/RandomUtils.test.d.ts b/dist/mjs/src/Pathfinding/AStar/AStar.test.d.ts similarity index 100% rename from dist/src/Utils/RandomUtils/RandomUtils.test.d.ts rename to dist/mjs/src/Pathfinding/AStar/AStar.test.d.ts diff --git a/dist/mjs/src/Pathfinding/Bfs/Bfs.d.ts b/dist/mjs/src/Pathfinding/Bfs/Bfs.d.ts new file mode 100644 index 00000000..0c674837 --- /dev/null +++ b/dist/mjs/src/Pathfinding/Bfs/Bfs.d.ts @@ -0,0 +1,7 @@ +import { LayerVecPos, ShortestPathAlgorithm, ShortestPathResult } from "./../ShortestPathAlgorithm.js"; +export declare class Bfs extends ShortestPathAlgorithm { + findShortestPathImpl(startPos: LayerVecPos, targetPos: LayerVecPos): ShortestPathResult; + private equal; + private shortestPathBfs; + private returnPath; +} diff --git a/dist/src/Utils/Rect/Rect.test.d.ts b/dist/mjs/src/Pathfinding/Bfs/Bfs.test.d.ts similarity index 100% rename from dist/src/Utils/Rect/Rect.test.d.ts rename to dist/mjs/src/Pathfinding/Bfs/Bfs.test.d.ts diff --git a/dist/mjs/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.d.ts b/dist/mjs/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.d.ts new file mode 100644 index 00000000..f857047c --- /dev/null +++ b/dist/mjs/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.d.ts @@ -0,0 +1,14 @@ +import { LayerVecPos, ShortestPathAlgorithm, ShortestPathResult } from "../ShortestPathAlgorithm.js"; +export declare class BidirectionalSearch extends ShortestPathAlgorithm { + findShortestPathImpl(startPos: LayerVecPos, targetPos: LayerVecPos): ShortestPathResult; + private equal; + private shortestPathBfs; + private shouldStop; + /** + * Returns closestToTarget if it is enabled in the options and undefined + * otherwise. + */ + private maybeClosestToTarget; + private returnPath; + private getPathFromPrev; +} diff --git a/dist/src/Utils/SpriteUtils/SpriteUtils.test.d.ts b/dist/mjs/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.test.d.ts similarity index 100% rename from dist/src/Utils/SpriteUtils/SpriteUtils.test.d.ts rename to dist/mjs/src/Pathfinding/BidirectionalSearch/BidirectionalSearch.test.d.ts diff --git a/dist/mjs/src/Pathfinding/Jps4/Jps4.d.ts b/dist/mjs/src/Pathfinding/Jps4/Jps4.d.ts new file mode 100644 index 00000000..ed19713f --- /dev/null +++ b/dist/mjs/src/Pathfinding/Jps4/Jps4.d.ts @@ -0,0 +1,41 @@ +import { LayerVecPos, ShortestPathAlgorithm, ShortestPathResult } from "../ShortestPathAlgorithm.js"; +import { Direction } from "../../Direction/Direction.js"; +import { DistanceUtils } from "../../Utils/DistanceUtils.js"; +import { GridTilemap } from "../../GridTilemap/GridTilemap.js"; +import { PathfindingOptions } from "../Pathfinding.js"; +export declare class Jps4 extends ShortestPathAlgorithm { + private openSet; + private g; + private f; + private closestToTarget; + private smallestDistToTarget; + private steps; + private maxFrontierSize; + protected maxJumpSize: number; + private turnOrder; + private turnTimes; + protected distanceUtils: DistanceUtils; + constructor(gridTilemap: GridTilemap, po?: PathfindingOptions); + findShortestPathImpl(startPos: LayerVecPos, targetPos: LayerVecPos): ShortestPathResult; + private shortestPath; + protected updateClosestToTarget(node: LayerVecPos, stopNode: LayerVecPos): void; + private getNeighborsInternal; + protected jump(parent: LayerVecPos, node: LayerVecPos, stopNode: LayerVecPos, dist: number): { + p: LayerVecPos; + dist: number; + } | undefined; + protected getForced(parent: LayerVecPos, node: LayerVecPos): LayerVecPos[]; + protected prune(parent: LayerVecPos, node: LayerVecPos): LayerVecPos[]; + protected normalizedPositions(parent: LayerVecPos, node: LayerVecPos): { + topLeft: LayerVecPos; + downLeft: LayerVecPos; + downRight: LayerVecPos; + topRight: LayerVecPos; + top: LayerVecPos; + bottom: LayerVecPos; + right: LayerVecPos; + }; + protected posInDir(pos: LayerVecPos, dir: Direction): LayerVecPos; + private returnPath; + private fillPath; +} diff --git a/dist/src/Utils/Utils/Utils.test.d.ts b/dist/mjs/src/Pathfinding/Jps4/Jps4.test.d.ts similarity index 100% rename from dist/src/Utils/Utils/Utils.test.d.ts rename to dist/mjs/src/Pathfinding/Jps4/Jps4.test.d.ts diff --git a/dist/mjs/src/Pathfinding/Jps8/Jps8.d.ts b/dist/mjs/src/Pathfinding/Jps8/Jps8.d.ts new file mode 100644 index 00000000..2b22f71c --- /dev/null +++ b/dist/mjs/src/Pathfinding/Jps8/Jps8.d.ts @@ -0,0 +1,13 @@ +import { PathfindingOptions } from "../../GridEngineHeadless.js"; +import { GridTilemap } from "../../GridTilemap/GridTilemap.js"; +import { Jps4 } from "../Jps4/Jps4.js"; +import { LayerVecPos } from "../ShortestPathAlgorithm.js"; +export declare class Jps8 extends Jps4 { + constructor(gridTilemap: GridTilemap, po?: PathfindingOptions); + protected getForced(parent: LayerVecPos, node: LayerVecPos): LayerVecPos[]; + protected prune(parent: LayerVecPos, node: LayerVecPos): LayerVecPos[]; + protected jump(parent: LayerVecPos, node: LayerVecPos, stopNode: LayerVecPos, dist: number): { + p: LayerVecPos; + dist: number; + } | undefined; +} diff --git a/dist/src/Utils/Vector2/Vector2.test.d.ts b/dist/mjs/src/Pathfinding/Jps8/Jps8.test.d.ts similarity index 100% rename from dist/src/Utils/Vector2/Vector2.test.d.ts rename to dist/mjs/src/Pathfinding/Jps8/Jps8.test.d.ts diff --git a/dist/Pathfinding/NoPathFoundStrategy.d.ts b/dist/mjs/src/Pathfinding/NoPathFoundStrategy.d.ts similarity index 96% rename from dist/Pathfinding/NoPathFoundStrategy.d.ts rename to dist/mjs/src/Pathfinding/NoPathFoundStrategy.d.ts index e4aaf461..65c5bbba 100644 --- a/dist/Pathfinding/NoPathFoundStrategy.d.ts +++ b/dist/mjs/src/Pathfinding/NoPathFoundStrategy.d.ts @@ -1,6 +1,8 @@ /** * Different strategies that determine the behavior of pathfinding if no path * could be found. + * + * @category Pathfinding */ export declare enum NoPathFoundStrategy { /** diff --git a/dist/Pathfinding/PathBlockedStrategy.d.ts b/dist/mjs/src/Pathfinding/PathBlockedStrategy.d.ts similarity index 96% rename from dist/Pathfinding/PathBlockedStrategy.d.ts rename to dist/mjs/src/Pathfinding/PathBlockedStrategy.d.ts index 2ae345cf..2ff81b91 100644 --- a/dist/Pathfinding/PathBlockedStrategy.d.ts +++ b/dist/mjs/src/Pathfinding/PathBlockedStrategy.d.ts @@ -2,6 +2,8 @@ * Determines what happens if a previously calculated path is suddenly * blocked. This can happen if a path existed and while the character was * moving along that path, it got suddenly blocked. + * + * @category Pathfinding */ export declare enum PathBlockedStrategy { /** diff --git a/dist/mjs/src/Pathfinding/Pathfinding.d.ts b/dist/mjs/src/Pathfinding/Pathfinding.d.ts new file mode 100644 index 00000000..dc8e1dee --- /dev/null +++ b/dist/mjs/src/Pathfinding/Pathfinding.d.ts @@ -0,0 +1,113 @@ +import { NumberOfDirections } from "../Direction/Direction.js"; +import { CharId } from "../GridCharacter/GridCharacter.js"; +import { Position } from "../GridEngine.js"; +import { GridTilemap } from "../GridTilemap/GridTilemap.js"; +import { LayerVecPos, ShortestPathAlgorithmType, ShortestPathResult } from "./ShortestPathAlgorithm.js"; +/** + * Configuration object for pathfinding. + * + * @category Pathfinding + */ +export interface PathfindingOptions { + /** Algorithm used for Pathfinding. */ + shortestPathAlgorithm?: ShortestPathAlgorithmType; + /** + * Consecutive tiles in x-dimension that need to fit in the path. + * This is useful for characters that span over multiple tiles. + */ + pathWidth?: number; + /** + * Consecutive tiles in y-dimension that need to fit in the path. + * This is useful for characters that span over multiple tiles. + */ + pathHeight?: number; + /** + * The number of directions to consider. + */ + numberOfDirections?: NumberOfDirections; + /** + * Function to specify whether a certain position is allowed for pathfinding. + * If the function returns false, the tile will be consindered as blocked. + * + * It can be used to restrict pathfinding to specific regions. + * + * Beware that this method can become a performance bottleneck easily. So be + * careful and keep it as efficient as possible. An asymptotic runtime + * complexity of O(1) is recommended. + */ + isPositionAllowed?: IsPositionAllowedFn; + /** + * The collision groups to consider for pathfinding. + */ + collisionGroups?: string[]; + /** + * Set of characters to ignore at collision checking. + */ + ignoredChars?: CharId[]; + /** + * If set to `true`, tile collisions will be ignored. + */ + ignoreTiles?: boolean; + /** + * If set to `true`, map boundaries are ignored. By default, positions + * outside of the boundaries of the tilemap are considered to be blocking, + * even if {@link PathfindingOptions.ignoreTiles} is set to `false`. + */ + ignoreMapBounds?: boolean; + /** + * If set to `true`, pathfinding will find a path, even if the target is + * blocked. This is a common use case if you want to find the shortest path + * to a blocking character. + */ + ignoreBlockedTarget?: boolean; + /** + * If this is set, the algorithm will stop once it reaches a path length of + * this value. This is useful to avoid running out of memory on large or + * infinite maps. + */ + maxPathLength?: number; + /** + * If set to `true`, pathfinding will only be performed on the char layer of + * the start position. If you don't use char layers, activating this setting + * can improve pathfinding performance. + * + * @default false + */ + ignoreLayers?: boolean; + /** + * Only considered by A* algorithm. + * If set to `true`, pathfinding will consider costs. Costs are set via tile + * properties. + * + * @default false + */ + considerCosts?: boolean; + /** + * If `true`, {@link PathfindingResult.closestToTarget} is calculated. + * Otherwise it is ignored in some algorithms and will not be set in {@link PathfindingResult}. + * Depending on the used pathfinding algorithm (like for BIDIRECTIONAL_SEARCH) + * it can be faster if it is disabled. It will not be ignored in algorithms + * where it does not come with a performance penalty (like BFS). + * + * @default true + */ + calculateClosestToTarget?: boolean; +} +/** + * Function to specify whether a certain position is allowed for pathfinding. + * If the function returns false, the tile will be consindered as blocked. + * + * It can be used to restrict pathfinding to specific regions. + * + * Beware that this method can become a performance bottleneck easily. So be + * careful and keep it as efficient as possible. An asymptotic runtime + * complexity of O(1) is recommended. + * + * @category Pathfinding + */ +export type IsPositionAllowedFn = (pos: Position, charLayer?: string) => boolean; +export declare class Pathfinding { + private gridTilemap; + constructor(gridTilemap: GridTilemap); + findShortestPath(source: LayerVecPos, dest: LayerVecPos, pathfindingOptions?: PathfindingOptions): ShortestPathResult; +} diff --git a/dist/src/Utils/VectorUtils.test.d.ts b/dist/mjs/src/Pathfinding/Pathfinding.test.d.ts similarity index 100% rename from dist/src/Utils/VectorUtils.test.d.ts rename to dist/mjs/src/Pathfinding/Pathfinding.test.d.ts diff --git a/dist/mjs/src/Pathfinding/ShortestPathAlgorithm.d.ts b/dist/mjs/src/Pathfinding/ShortestPathAlgorithm.d.ts new file mode 100644 index 00000000..f190102c --- /dev/null +++ b/dist/mjs/src/Pathfinding/ShortestPathAlgorithm.d.ts @@ -0,0 +1,47 @@ +import { CharLayer, Direction } from "../GridEngine.js"; +import { GridTilemap } from "../GridTilemap/GridTilemap.js"; +import { Vector2 } from "../Utils/Vector2/Vector2.js"; +import { PathfindingOptions } from "./Pathfinding.js"; +import { Concrete } from "../Utils/TypeUtils.js"; +export interface LayerVecPos { + position: Vector2; + layer: CharLayer; +} +/** + * BFS: (Breadth first search) Simple algorithm. It can find the shortest path + * in O(4ᵈ) (resp O(8ᵈ) for 8 directions). d is the length of the shortest path. + * + * BIDIRECTIONAL_SEARCH: This algorithm starts 2 BFS, one from the start and + * one from the end position. It has a performance of O(4^(d/2)) + * (resp O(8^(d/2))). + * + * @category Pathfinding + */ +export type ShortestPathAlgorithmType = "BFS" | "BIDIRECTIONAL_SEARCH" | "A_STAR" | "JPS"; +export interface ShortestPath { + path: LayerVecPos[]; + distOffset: number; +} +export interface ShortestPathResult { + path: LayerVecPos[]; + closestToTarget?: LayerVecPos; + steps: number; + maxPathLengthReached: boolean; + algorithmUsed: ShortestPathAlgorithmType; +} +export declare abstract class ShortestPathAlgorithm { + protected gridTilemap: GridTilemap; + protected options: Concrete; + findShortestPath(startPos: LayerVecPos, targetPos: LayerVecPos): ShortestPathResult; + abstract findShortestPathImpl(startPos: LayerVecPos, targetPos: LayerVecPos): ShortestPathResult; + constructor(gridTilemap: GridTilemap, { shortestPathAlgorithm, pathWidth, pathHeight, numberOfDirections, isPositionAllowed, collisionGroups, ignoredChars, ignoreTiles, ignoreMapBounds, ignoreBlockedTarget, maxPathLength, ignoreLayers, considerCosts, calculateClosestToTarget, }?: PathfindingOptions); + getNeighbors(pos: LayerVecPos, dest: LayerVecPos): LayerVecPos[]; + getTransition(pos: Vector2, fromLayer?: string): string | undefined; + getCosts(src: Vector2, dest: LayerVecPos): number; + isBlocking(src: LayerVecPos, dest: LayerVecPos): boolean; + distance(fromNode: Vector2, toNode: Vector2): number; + getTilePosInDir(pos: LayerVecPos, dir: Direction): LayerVecPos; + getReverseNeighbors(pos: LayerVecPos, dest: LayerVecPos): LayerVecPos[]; + private hasBlockingCharFrom; + private hasBlockingTileFrom; +} diff --git a/dist/src/Testing/Utils.d.ts b/dist/mjs/src/Testing/Utils.d.ts similarity index 100% rename from dist/src/Testing/Utils.d.ts rename to dist/mjs/src/Testing/Utils.d.ts diff --git a/dist/Utils/DistanceUtils.d.ts b/dist/mjs/src/Utils/DistanceUtils.d.ts similarity index 55% rename from dist/Utils/DistanceUtils.d.ts rename to dist/mjs/src/Utils/DistanceUtils.d.ts index 84235e29..942713bd 100644 --- a/dist/Utils/DistanceUtils.d.ts +++ b/dist/mjs/src/Utils/DistanceUtils.d.ts @@ -1,8 +1,8 @@ -import { Direction } from "../Direction/Direction"; -import { Vector2 } from "./Vector2/Vector2"; +import { Direction } from "../Direction/Direction.js"; +import { Vector2 } from "./Vector2/Vector2.js"; export interface DistanceUtils { distance(pos1: Vector2, pos2: Vector2): number; direction(from: Vector2, to: Vector2): Direction; - neighbours(pos: Vector2): Vector2[]; + neighbors(pos: Vector2): Vector2[]; getDirections(): Direction[]; } diff --git a/dist/Utils/DistanceUtils4/DistanceUtils4.d.ts b/dist/mjs/src/Utils/DistanceUtils4/DistanceUtils4.d.ts similarity index 50% rename from dist/Utils/DistanceUtils4/DistanceUtils4.d.ts rename to dist/mjs/src/Utils/DistanceUtils4/DistanceUtils4.d.ts index 4883dc23..b36cece5 100644 --- a/dist/Utils/DistanceUtils4/DistanceUtils4.d.ts +++ b/dist/mjs/src/Utils/DistanceUtils4/DistanceUtils4.d.ts @@ -1,9 +1,9 @@ -import { Direction } from "../../Direction/Direction"; -import { Vector2 } from "../Vector2/Vector2"; -import { DistanceUtils } from "../DistanceUtils"; +import { Direction } from "../../Direction/Direction.js"; +import { Vector2 } from "../Vector2/Vector2.js"; +import { DistanceUtils } from "../DistanceUtils.js"; export declare class DistanceUtils4 implements DistanceUtils { distance(pos1: Vector2, pos2: Vector2): number; direction(from: Vector2, to: Vector2): Direction; - neighbours(pos: Vector2): Vector2[]; + neighbors(pos: Vector2): Vector2[]; getDirections(): Direction[]; } diff --git a/dist/mjs/src/Utils/DistanceUtils4/DistanceUtils4.test.d.ts b/dist/mjs/src/Utils/DistanceUtils4/DistanceUtils4.test.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/mjs/src/Utils/DistanceUtils4/DistanceUtils4.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/Utils/DistanceUtils8/DistanceUtils8.d.ts b/dist/mjs/src/Utils/DistanceUtils8/DistanceUtils8.d.ts similarity index 50% rename from dist/Utils/DistanceUtils8/DistanceUtils8.d.ts rename to dist/mjs/src/Utils/DistanceUtils8/DistanceUtils8.d.ts index 51da97e8..5235d25a 100644 --- a/dist/Utils/DistanceUtils8/DistanceUtils8.d.ts +++ b/dist/mjs/src/Utils/DistanceUtils8/DistanceUtils8.d.ts @@ -1,9 +1,9 @@ -import { Direction } from "../../Direction/Direction"; -import { Vector2 } from "../Vector2/Vector2"; -import { DistanceUtils } from "../DistanceUtils"; +import { Direction } from "../../Direction/Direction.js"; +import { Vector2 } from "../Vector2/Vector2.js"; +import { DistanceUtils } from "../DistanceUtils.js"; export declare class DistanceUtils8 implements DistanceUtils { distance(pos1: Vector2, pos2: Vector2): number; - neighbours(pos: Vector2): Vector2[]; + neighbors(pos: Vector2): Vector2[]; direction(from: Vector2, to: Vector2): Direction; getDirections(): Direction[]; } diff --git a/dist/mjs/src/Utils/DistanceUtils8/DistanceUtils8.test.d.ts b/dist/mjs/src/Utils/DistanceUtils8/DistanceUtils8.test.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/mjs/src/Utils/DistanceUtils8/DistanceUtils8.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/mjs/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.d.ts b/dist/mjs/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.d.ts new file mode 100644 index 00000000..c1482117 --- /dev/null +++ b/dist/mjs/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.d.ts @@ -0,0 +1,5 @@ +import { NumberOfDirections } from "./../../Direction/Direction.js"; +import { DistanceUtils } from "../DistanceUtils.js"; +export declare class DistanceUtilsFactory { + static create(numberOfDirections: NumberOfDirections): DistanceUtils; +} diff --git a/dist/mjs/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.test.d.ts b/dist/mjs/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.test.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/mjs/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/mjs/src/Utils/LayerPositionUtils/LayerPositionUtils.d.ts b/dist/mjs/src/Utils/LayerPositionUtils/LayerPositionUtils.d.ts new file mode 100644 index 00000000..7aa67c74 --- /dev/null +++ b/dist/mjs/src/Utils/LayerPositionUtils/LayerPositionUtils.d.ts @@ -0,0 +1,10 @@ +import { LayerPosition } from "../../GridEngine.js"; +import { LayerVecPos } from "./../../Pathfinding/ShortestPathAlgorithm.js"; +export declare class LayerPositionUtils { + static equal(position: LayerVecPos, otherPosition: LayerVecPos): boolean; + static copyOver(source: LayerVecPos, target: LayerVecPos): void; + static clone(layerPosition: LayerVecPos): LayerVecPos; + static toString(layerPosition: LayerVecPos): string; + static toInternal(layerPosition: LayerPosition): LayerVecPos; + static fromInternal(layerPosition: LayerVecPos): LayerPosition; +} diff --git a/dist/mjs/src/Utils/LayerPositionUtils/LayerPositionUtils.test.d.ts b/dist/mjs/src/Utils/LayerPositionUtils/LayerPositionUtils.test.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/mjs/src/Utils/LayerPositionUtils/LayerPositionUtils.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/mjs/src/Utils/MockFactory/MockFactory.d.ts b/dist/mjs/src/Utils/MockFactory/MockFactory.d.ts new file mode 100644 index 00000000..bedb2199 --- /dev/null +++ b/dist/mjs/src/Utils/MockFactory/MockFactory.d.ts @@ -0,0 +1,45 @@ +import { GridTilemap } from "../../GridTilemap/GridTilemap.js"; +import { Vector2 } from "../Vector2/Vector2.js"; +import { LayerVecPos } from "../../Pathfinding/ShortestPathAlgorithm.js"; +import { TileLayer, Tilemap } from "../../GridTilemap/Tilemap.js"; +export interface TileCost { + ge_cost?: number; + ge_cost_left?: number; + ge_cost_right?: number; + ge_cost_up?: number; + ge_cost_down?: number; + "ge_cost_down-left"?: number; + "ge_cost_down-right"?: number; + "ge_cost_up-left"?: number; + "ge_cost_up-right"?: number; +} +export declare const LOWER_CHAR_LAYER = "lowerCharLayer"; +export declare const HIGHER_CHAR_LAYER = "testCharLayer"; +export declare const COLLISION_GROUP = "testCollisionGroup"; +export type CostMap = Array>; +export interface CostMapLayer { + layer: string | undefined; + costMap: CostMap; +} +export declare function createSpriteMock(): any; +export declare function createMockLayer(layerData: any): TileLayer; +export declare function layerPos(vec: Vector2, layer?: string): LayerVecPos; +export declare function mockCharMap(gridTilemap: GridTilemap, blockMaps: Array<{ + layer: string | undefined; + blockMap: string[]; +}>): void; +export declare function mockRandomMap(layer: string | undefined, width: number, height: number, density?: number, seed?: number): Tilemap; +export declare function getBlockingProps(char: string): Record; +export declare function mockBlockMap(blockMap: string[], charLayer?: string, isometric?: boolean, costMap?: Array>): Tilemap; +export declare function mockLayeredBlockMap(blockMaps: Array<{ + layer: string | undefined; + blockMap: string[]; + isCharLayer?: boolean; + charLayerName?: string; +}>, isometric?: boolean, costMaps?: CostMapLayer[]): Tilemap; +export declare function tileCostProps(costMap: CostMapLayer, r: number, c: number): Record; +export declare function createAllowedFn(map: string[], ignoreBounds?: boolean): ({ x, y }: { + x: any; + y: any; +}, _charLayer: any) => boolean; +export declare function updateLayer(tilemapMock: any, blockMap: string[], layer?: string): void; diff --git a/dist/mjs/src/Utils/MockFactory/MockPhaserTilemap.d.ts b/dist/mjs/src/Utils/MockFactory/MockPhaserTilemap.d.ts new file mode 100644 index 00000000..b7d0a432 --- /dev/null +++ b/dist/mjs/src/Utils/MockFactory/MockPhaserTilemap.d.ts @@ -0,0 +1,2 @@ +import { CostMapLayer } from "./MockFactory.js"; +export declare function createPhaserTilemapStub(blockMap: Map, costMap?: CostMapLayer[]): Phaser.Tilemaps.Tilemap; diff --git a/dist/mjs/src/Utils/MockFactory/MockTilemap.d.ts b/dist/mjs/src/Utils/MockFactory/MockTilemap.d.ts new file mode 100644 index 00000000..00ea8346 --- /dev/null +++ b/dist/mjs/src/Utils/MockFactory/MockTilemap.d.ts @@ -0,0 +1,46 @@ +import { TileLayer, Orientation, Tile, Tilemap } from "../../GridTilemap/Tilemap.js"; +export declare class MockTile implements Tile { + private properties; + constructor(properties?: Record); + getProperty(name: string): any; + hasProperty(name: string): boolean; +} +export declare class MockTilemap implements Tilemap { + private layers; + private orientation; + constructor(layers?: TileLayer[], orientation?: Orientation); + getTileWidth(): number; + getTileHeight(): number; + getWidth(): number; + getHeight(): number; + getOrientation(): Orientation; + getLayers(): TileLayer[]; + hasTileAt(x: number, y: number, layer?: string): boolean; + getTileAt(x: number, y: number, layer?: string): Tile | undefined; +} +export declare class MockTileLayer implements TileLayer { + private name; + private properties; + private height; + private width; + private scale; + private tilesets; + private data; + private depth; + constructor(name: string | undefined, properties?: Record, height?: number, width?: number, scale?: number, tilesets?: string[], data?: Array>); + getProperty(name: string): string | undefined; + hasProperty(name: string): boolean; + getProperties(): Record; + isCharLayer(): boolean; + getName(): string | undefined; + getHeight(): number; + getWidth(): number; + getScale(): number; + setScale(scale: number): void; + setDepth(depth: number): void; + getDepth(): number; + destroy(): void; + getTilesets(): string[]; + putTileAt(_tile: number, _x: number, _y: number): void; + getData(): Array>; +} diff --git a/dist/src/Utils/RandomUtils/RandomUtils.d.ts b/dist/mjs/src/Utils/RandomUtils/RandomUtils.d.ts similarity index 100% rename from dist/src/Utils/RandomUtils/RandomUtils.d.ts rename to dist/mjs/src/Utils/RandomUtils/RandomUtils.d.ts diff --git a/dist/mjs/src/Utils/RandomUtils/RandomUtils.test.d.ts b/dist/mjs/src/Utils/RandomUtils/RandomUtils.test.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/mjs/src/Utils/RandomUtils/RandomUtils.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/Utils/Rect/Rect.d.ts b/dist/mjs/src/Utils/Rect/Rect.d.ts similarity index 85% rename from dist/Utils/Rect/Rect.d.ts rename to dist/mjs/src/Utils/Rect/Rect.d.ts index d6f98c5e..8b3d198f 100644 --- a/dist/Utils/Rect/Rect.d.ts +++ b/dist/mjs/src/Utils/Rect/Rect.d.ts @@ -1,4 +1,4 @@ -import { Vector2 } from "../Vector2/Vector2"; +import { Vector2 } from "../Vector2/Vector2.js"; export declare class Rect { private x; private y; diff --git a/dist/mjs/src/Utils/Rect/Rect.test.d.ts b/dist/mjs/src/Utils/Rect/Rect.test.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/mjs/src/Utils/Rect/Rect.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/src/Utils/SpriteUtils/SpriteUtils.d.ts b/dist/mjs/src/Utils/SpriteUtils/SpriteUtils.d.ts similarity index 100% rename from dist/src/Utils/SpriteUtils/SpriteUtils.d.ts rename to dist/mjs/src/Utils/SpriteUtils/SpriteUtils.d.ts diff --git a/dist/mjs/src/Utils/SpriteUtils/SpriteUtils.test.d.ts b/dist/mjs/src/Utils/SpriteUtils/SpriteUtils.test.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/mjs/src/Utils/SpriteUtils/SpriteUtils.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/Utils/TypeUtils.d.ts b/dist/mjs/src/Utils/TypeUtils.d.ts similarity index 56% rename from dist/Utils/TypeUtils.d.ts rename to dist/mjs/src/Utils/TypeUtils.d.ts index 32f0ddeb..ceb9d70c 100644 --- a/dist/Utils/TypeUtils.d.ts +++ b/dist/mjs/src/Utils/TypeUtils.d.ts @@ -1,3 +1,3 @@ -export declare type Concrete = { +export type Concrete = { [Property in keyof Type]-?: Type[Property]; }; diff --git a/dist/src/Utils/Utils/Utils.d.ts b/dist/mjs/src/Utils/Utils/Utils.d.ts similarity index 100% rename from dist/src/Utils/Utils/Utils.d.ts rename to dist/mjs/src/Utils/Utils/Utils.d.ts diff --git a/dist/mjs/src/Utils/Utils/Utils.test.d.ts b/dist/mjs/src/Utils/Utils/Utils.test.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/mjs/src/Utils/Utils/Utils.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/Utils/Vector2/Vector2.d.ts b/dist/mjs/src/Utils/Vector2/Vector2.d.ts similarity index 91% rename from dist/Utils/Vector2/Vector2.d.ts rename to dist/mjs/src/Utils/Vector2/Vector2.d.ts index 9dcc997e..e217dc4a 100644 --- a/dist/Utils/Vector2/Vector2.d.ts +++ b/dist/mjs/src/Utils/Vector2/Vector2.d.ts @@ -1,4 +1,4 @@ -import { Position } from "../../GridEngine"; +import { Position } from "../../GridEngine.js"; export declare class Vector2 { static get ZERO(): Vector2; static get ONE(): Vector2; @@ -25,5 +25,6 @@ export declare class Vector2 { modulo(vector: Vector2): Vector2; scalarModulo(scalar: number): Vector2; scalarMult(scalar: number): Vector2; + toPosition(): Position; toString(): string; } diff --git a/dist/mjs/src/Utils/Vector2/Vector2.test.d.ts b/dist/mjs/src/Utils/Vector2/Vector2.test.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/mjs/src/Utils/Vector2/Vector2.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/src/Utils/VectorUtils.d.ts b/dist/mjs/src/Utils/VectorUtils.d.ts similarity index 87% rename from dist/src/Utils/VectorUtils.d.ts rename to dist/mjs/src/Utils/VectorUtils.d.ts index 6a471fc2..ba4ba12f 100644 --- a/dist/src/Utils/VectorUtils.d.ts +++ b/dist/mjs/src/Utils/VectorUtils.d.ts @@ -1,4 +1,4 @@ -import { Vector2 } from "./Vector2/Vector2"; +import { Vector2 } from "./Vector2/Vector2.js"; export declare class VectorUtils { static vec2str(vec: Vector2): string; static equal(vec1: Vector2, vec2: Vector2): boolean; diff --git a/dist/mjs/src/Utils/VectorUtils.test.d.ts b/dist/mjs/src/Utils/VectorUtils.test.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/mjs/src/Utils/VectorUtils.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/mjs/src/main-esm.d.ts b/dist/mjs/src/main-esm.d.ts new file mode 100644 index 00000000..9aabbd78 --- /dev/null +++ b/dist/mjs/src/main-esm.d.ts @@ -0,0 +1,3 @@ +import { GridEngine } from "./GridEngine.js"; +export * from "./GridEngine.js"; +export default GridEngine; diff --git a/dist/mjs/src/main-iife.d.ts b/dist/mjs/src/main-iife.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/mjs/src/main-iife.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/dist/src/GlobalConfig/GlobalConfig.d.ts b/dist/src/GlobalConfig/GlobalConfig.d.ts deleted file mode 100644 index 3065f256..00000000 --- a/dist/src/GlobalConfig/GlobalConfig.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { GridEngineConfig } from "../GridEngine"; -import { Concrete } from "../Utils/TypeUtils"; -export declare class GlobalConfig { - private static config; - static get(): Concrete; - static set(config: Concrete): void; -} diff --git a/dist/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.d.ts b/dist/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.d.ts deleted file mode 100644 index 92825b95..00000000 --- a/dist/src/Utils/DistanceUtilsFactory/DistanceUtilsFactory.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { NumberOfDirections } from "./../../Direction/Direction"; -import { DistanceUtils } from "../DistanceUtils"; -export declare class DistanceUtilsFactory { - static create(numberOfDirections: NumberOfDirections): DistanceUtils; -} diff --git a/dist/src/main-esm.d.ts b/dist/src/main-esm.d.ts deleted file mode 100644 index e88ec250..00000000 --- a/dist/src/main-esm.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { GridEngine } from "./GridEngine"; -export * from "./GridEngine"; -export default GridEngine; diff --git a/docs/public/api/classes/ArrayTilemap.html b/docs/public/api/classes/ArrayTilemap.html index 1b1f3419..9287b6d2 100644 --- a/docs/public/api/classes/ArrayTilemap.html +++ b/docs/public/api/classes/ArrayTilemap.html @@ -29,7 +29,7 @@

Implements

+
  • Defined in GridTilemap/ArrayTilemap/ArrayTilemap.ts:22
  • @@ -66,7 +66,7 @@
    orientation: collisionPropertyName: string = "ge_collide"

    Returns ArrayTilemap

    +
  • Defined in GridTilemap/ArrayTilemap/ArrayTilemap.ts:26
  • Methods

    @@ -77,7 +77,7 @@
    +
  • Defined in GridTilemap/ArrayTilemap/ArrayTilemap.ts:66
  • +
  • Defined in GridTilemap/ArrayTilemap/ArrayTilemap.ts:72
  • +
  • Defined in GridTilemap/ArrayTilemap/ArrayTilemap.ts:69
  • +
  • Defined in GridTilemap/ArrayTilemap/ArrayTilemap.ts:81
  • +
  • Defined in GridTilemap/ArrayTilemap/ArrayTilemap.ts:63
  • +
  • Defined in GridTilemap/ArrayTilemap/ArrayTilemap.ts:75
  • +
  • Defined in GridEngine.ts:361
    • @@ -207,7 +207,7 @@

      Returns void

    +
  • Defined in GridEngine.ts:674
  • Character

    @@ -230,7 +230,7 @@

    Returns void

    +
  • Defined in GridEngine.ts:581
  • +
  • Defined in GridEngine.ts:599
  • +
  • Defined in GridEngine.ts:448
  • +
  • Defined in GridEngine.ts:846
  • +
  • Defined in GridEngine.ts:563
  • +
  • Defined in GridEngine.ts:263
  • +
  • Defined in GridEngine.ts:753
  • +
  • Defined in GridEngine.ts:388
  • +
  • Defined in GridEngine.ts:656
  • +
  • Defined in GridEngine.ts:665
  • +
  • Defined in GridEngine.ts:572
  • +
  • Defined in GridEngine.ts:339
  • +
  • Defined in GridEngine.ts:873
  • +
  • Defined in GridEngine.ts:400
  • +
  • Defined in GridEngine.ts:424
  • +
  • Defined in GridEngine.ts:312
  • +
  • Defined in GridEngine.ts:379
  • +
  • Defined in GridEngine.ts:705
  • +
  • Defined in GridEngine.ts:458
  • +
  • Defined in GridEngine.ts:647
  • +
  • Defined in GridEngine.ts:828
  • +
  • Defined in GridEngine.ts:837
  • +
  • Defined in GridEngine.ts:864
  • +
  • Defined in GridEngine.ts:855
  • +
  • Defined in GridEngine.ts:590
  • +
  • Defined in GridEngine.ts:762
  • +
  • Defined in GridEngine.ts:412
  • +
  • Defined in GridEngine.ts:436
  • +
  • Defined in GridEngine.ts:696
  • +
  • Defined in GridEngine.ts:370
  • +
  • Defined in GridEngine.ts:717
  • +
  • Defined in GridEngine.ts:487
  • Grid Engine

    @@ -794,7 +794,7 @@
    charData: Returns void
    +
  • Defined in GridEngine.ts:514
  • +
  • Defined in GridEngine.ts:291
  • +
  • Defined in GridEngine.ts:524
  • +
  • Defined in GridEngine.ts:474
  • +
  • Defined in GridEngine.ts:882
  • +
  • Defined in GridEngine.ts:548
  • +
  • Defined in GridEngine.ts:533
  • GridEngine

    @@ -918,14 +918,14 @@

    Returns Observab

    +
  • Defined in GridEngine.ts:819
  • Other

    welcomeMessagePrinted: boolean = false
    +
  • Defined in GridEngine.ts:231
  • Pathfinding

    @@ -959,7 +959,7 @@

    Returns

    +
  • Defined in GridEngine.ts:789
  • @@ -1033,7 +1033,7 @@

    Deprecated

    Use follow(charId: string, charIdToFollow: string, options

  • +
  • Defined in GridEngine.ts:609
  • +
  • Defined in GridEngine.ts:938
  • +
  • Defined in GridEngine.ts:348
  • Queue Movement

    @@ -1120,7 +1120,7 @@

    Returns void

    +
  • Defined in GridEngine.ts:896
  • +
  • Defined in GridEngine.ts:929
  • +
  • Defined in GridEngine.ts:909
  • +
  • Defined in GridEngine.ts:918
  • Random Movement

    @@ -1209,7 +1209,7 @@

    Returns void

    +
  • Defined in GridEngine.ts:330
  • Tilemap

    @@ -1233,7 +1233,7 @@

    Returns string

    +
  • Defined in GridEngine.ts:687
  • +
  • Defined in GridEngine.ts:771
  • +
  • Defined in GridEngine.ts:272
  • +
  • Defined in GridEngine.ts:731
  • +
  • Defined in GridEngine.ts:744
  • +
  • Defined in GridEngine.ts:281
  • +
  • Defined in GridEngineHeadless.ts:825
  • Character

    @@ -201,7 +201,7 @@

    Returns void

    +
  • Defined in GridEngineHeadless.ts:692
  • +
  • Defined in GridEngineHeadless.ts:716
  • +
  • Defined in GridEngineHeadless.ts:516
  • +
  • Defined in GridEngineHeadless.ts:1057
  • +
  • Defined in GridEngineHeadless.ts:297
  • +
  • Defined in GridEngineHeadless.ts:898
  • +
  • Defined in GridEngineHeadless.ts:800
  • +
  • Defined in GridEngineHeadless.ts:812
  • +
  • Defined in GridEngineHeadless.ts:680
  • +
  • Defined in GridEngineHeadless.ts:422
  • +
  • Defined in GridEngineHeadless.ts:1087
  • +
  • Defined in GridEngineHeadless.ts:388
  • +
  • Defined in GridEngineHeadless.ts:504
  • +
  • Defined in GridEngineHeadless.ts:788
  • +
  • Defined in GridEngineHeadless.ts:1037
  • +
  • Defined in GridEngineHeadless.ts:1047
  • +
  • Defined in GridEngineHeadless.ts:1077
  • +
  • Defined in GridEngineHeadless.ts:1067
  • +
  • Defined in GridEngineHeadless.ts:1099
  • +
  • Defined in GridEngineHeadless.ts:704
  • +
  • Defined in GridEngineHeadless.ts:910
  • +
  • Defined in GridEngineHeadless.ts:852
  • +
  • Defined in GridEngineHeadless.ts:491
  • +
  • Defined in GridEngineHeadless.ts:479
  • Grid Engine

    @@ -647,7 +647,7 @@
    charData: Returns void
    +
  • Defined in GridEngineHeadless.ts:540
  • +
  • Defined in GridEngineHeadless.ts:334
  • +
  • Defined in GridEngineHeadless.ts:665
  • +
  • Defined in GridEngineHeadless.ts:628
  • +
  • Defined in GridEngineHeadless.ts:652
  • +
  • Defined in GridEngineHeadless.ts:638
  • +
  • Defined in GridEngineHeadless.ts:526
  • GridEngine

    @@ -764,7 +764,7 @@

    Returns Observab

    +
  • Defined in GridEngineHeadless.ts:1012
  • Other

    @@ -779,7 +779,7 @@

    Parameters

    printWelcomeMessage: boolean = true

    Returns GridEngineHeadless

    +
  • Defined in GridEngineHeadless.ts:286
  • Pathfinding

    @@ -813,7 +813,7 @@

    Returns

    +
  • Defined in GridEngineHeadless.ts:947
  • @@ -887,7 +887,7 @@

    Deprecated

    Use follow(charId: string, charIdToFollow: string, options

  • +
  • Defined in GridEngineHeadless.ts:729
  • +
  • Defined in GridEngineHeadless.ts:1208
  • +
  • Defined in GridEngineHeadless.ts:440
  • Queue Movement

    @@ -974,7 +974,7 @@

    Returns void

    +
  • Defined in GridEngineHeadless.ts:1113
  • +
  • Defined in GridEngineHeadless.ts:1193
  • +
  • Defined in GridEngineHeadless.ts:1170
  • +
  • Defined in GridEngineHeadless.ts:1158
  • Random Movement

    @@ -1063,7 +1063,7 @@

    Returns void

    +
  • Defined in GridEngineHeadless.ts:409
  • Tilemap

    @@ -1087,7 +1087,7 @@

    Returns string

    +
  • Defined in GridEngineHeadless.ts:837
  • +
  • Defined in GridEngineHeadless.ts:922
  • +
  • Defined in GridEngineHeadless.ts:309
  • +
  • Defined in GridEngineHeadless.ts:870
  • +
  • Defined in GridEngineHeadless.ts:888
  • +
  • Defined in GridEngineHeadless.ts:319
  • +
  • Defined in GridTilemap/Phaser/PhaserTile.ts:29
  • +
  • Defined in GridTilemap/Phaser/PhaserTileLayer.ts:27
  • +
  • Defined in GridTilemap/Phaser/PhaserTilemap.ts:66
  • +
  • Defined in GridTilemap/TiledTilemap/TiledLayer.ts:39
  • +
  • Defined in GridTilemap/TiledTilemap/TiledTile.ts:34
  • +
  • Defined in GridTilemap/TiledTilemap/TiledTilemap.ts:21
  • +
  • Defined in IGridEngine.ts:126
  • @@ -40,7 +40,7 @@
    +
  • Defined in IGridEngine.ts:130
  • REMOVED: "REMOVED"
    @@ -48,7 +48,7 @@
    +
  • Defined in IGridEngine.ts:128
  • +
  • Defined in Collisions/CollisionStrategy.ts:22
  • BLOCK_TWO_TILES: "BLOCK_TWO_TILES"
    @@ -46,7 +46,7 @@
    +
  • Defined in Collisions/CollisionStrategy.ts:16
  • +
  • Defined in Direction/Direction.ts:8
  • +
  • Defined in Movement/TargetMovement/TargetMovement.ts:137
  • +
  • Defined in Pathfinding/NoPathFoundStrategy.ts:7
  • @@ -43,7 +43,7 @@
    +
  • Defined in Pathfinding/NoPathFoundStrategy.ts:17
  • RETRY: "RETRY"
    @@ -55,7 +55,7 @@
    +
  • Defined in Pathfinding/NoPathFoundStrategy.ts:26
  • STOP: "STOP"
    @@ -63,7 +63,7 @@
    +
  • Defined in Pathfinding/NoPathFoundStrategy.ts:11
  • +
  • Defined in Direction/Direction.ts:141
  • +
  • Defined in Pathfinding/PathBlockedStrategy.ts:8
  • @@ -45,7 +45,7 @@
    +
  • Defined in Pathfinding/PathBlockedStrategy.ts:20
  • STOP: "STOP"
    @@ -53,7 +53,7 @@
    +
  • Defined in Pathfinding/PathBlockedStrategy.ts:25
  • WAIT: "WAIT"
    @@ -62,7 +62,7 @@
    +
  • Defined in Pathfinding/PathBlockedStrategy.ts:13
  • +
  • Defined in Movement/QueueMovement/QueueMovement.ts:73
  • @@ -42,7 +42,7 @@
    +
  • Defined in Movement/QueueMovement/QueueMovement.ts:85
  • STOP: "STOP"
    @@ -50,7 +50,7 @@
    +
  • Defined in Movement/QueueMovement/QueueMovement.ts:90
  • WAIT: "WAIT"
    @@ -60,7 +60,7 @@
    +
  • Defined in Movement/QueueMovement/QueueMovement.ts:79
  • +
  • Defined in GridTilemap/ArrayTilemap/ArrayTilemap.ts:13
  • +
  • Defined in GridEngineHeadless.ts:215
  • container?: Container
    @@ -93,7 +93,7 @@
    +
  • Defined in GridEngine.ts:210
  • facingDirection?: Direction
    @@ -104,7 +104,7 @@

    Default Value

    Inherited from CharacterDataHeadless.facingDirection

    +
  • Defined in GridEngineHeadless.ts:206
  • id: string
    @@ -114,7 +114,7 @@
    +
  • Defined in GridEngineHeadless.ts:185
  • labels?: string[]
    @@ -126,7 +126,7 @@

    Default Value

    []

    +
  • Defined in GridEngineHeadless.ts:234
  • numberOfDirections?: NumberOfDirections
    @@ -137,7 +137,7 @@
    +
  • Defined in GridEngineHeadless.ts:241
  • offsetX?: number
    @@ -147,7 +147,7 @@

    0

    +
  • Defined in GridEngine.ts:217
  • offsetY?: number
    @@ -157,7 +157,7 @@

    0

    +
  • Defined in GridEngine.ts:224
  • speed?: number
    @@ -168,7 +168,7 @@

    Default Value

    4

    +
  • Defined in GridEngineHeadless.ts:192
  • sprite?: Sprite
    @@ -176,7 +176,7 @@
    +
  • Defined in GridEngine.ts:179
  • startPosition?: Position
    @@ -187,7 +187,7 @@

    Default Value

    {x: 0, y:0}

    +
  • Defined in GridEngineHeadless.ts:199
  • tileHeight?: number
    @@ -199,7 +199,7 @@

    Default Value

    1

    +
  • Defined in GridEngineHeadless.ts:257
  • tileWidth?: number
    @@ -211,7 +211,7 @@

    Default Value

    1

    +
  • Defined in GridEngineHeadless.ts:249
  • walkingAnimationMapping?: number | WalkingAnimationMapping
    @@ -229,7 +229,7 @@
    +
  • Defined in GridEngine.ts:195
  • +
  • Defined in GridEngineHeadless.ts:206
  • id: string
    @@ -89,7 +89,7 @@
    +
  • Defined in GridEngineHeadless.ts:185
  • labels?: string[]
    @@ -100,7 +100,7 @@

    []

    +
  • Defined in GridEngineHeadless.ts:234
  • numberOfDirections?: NumberOfDirections
    @@ -110,7 +110,7 @@
    +
  • Defined in GridEngineHeadless.ts:241
  • speed?: number
    @@ -120,7 +120,7 @@

    4

    +
  • Defined in GridEngineHeadless.ts:192
  • startPosition?: Position
    @@ -130,7 +130,7 @@

    {x: 0, y:0}

    +
  • Defined in GridEngineHeadless.ts:199
  • tileHeight?: number
    @@ -141,7 +141,7 @@

    1

    +
  • Defined in GridEngineHeadless.ts:257
  • tileWidth?: number
    @@ -152,7 +152,7 @@

    1

    +
  • Defined in GridEngineHeadless.ts:249
  • +
  • Defined in IGridEngine.ts:118
  • +
  • Defined in GridEngineHeadless.ts:172
  • ignoreMissingTiles?: boolean
    @@ -69,7 +69,7 @@

    false

    +
  • Defined in GridEngineHeadless.ts:161
  • +
  • Defined in IGridEngine.ts:96
  • +
  • Defined in GridEngine.ts:134
  • collisionGroupRelation?: Record<string, string[]>
    @@ -97,7 +97,7 @@
    +
  • Defined in GridEngineHeadless.ts:140
  • collisionTilePropertyName?: string
    @@ -110,7 +110,7 @@

    Default Value

    'ge_collide'

    +
  • Defined in GridEngineHeadless.ts:97
  • layerOverlay?: boolean
    @@ -121,7 +121,7 @@

    false

    +
  • Defined in GridEngine.ts:144
  • numberOfDirections?: NumberOfDirections
    @@ -134,7 +134,7 @@

    Default Value

    Inherited from GridEngineConfigHeadless.numberOfDirections

    +
  • Defined in GridEngineHeadless.ts:106
  • tiledProject?: TiledProject
    @@ -143,7 +143,7 @@
    +
  • Defined in GridEngine.ts:150
  • +
  • Defined in GridEngineHeadless.ts:113
  • characters: CharacterDataHeadless[]
    @@ -75,7 +75,7 @@
    +
  • Defined in GridEngineHeadless.ts:88
  • collisionGroupRelation?: Record<string, string[]>
    @@ -91,7 +91,7 @@
    +
  • Defined in GridEngineHeadless.ts:140
  • collisionTilePropertyName?: string
    @@ -103,7 +103,7 @@

    'ge_collide'

    +
  • Defined in GridEngineHeadless.ts:97
  • numberOfDirections?: NumberOfDirections
    @@ -115,7 +115,7 @@

    FOUR

    +
  • Defined in GridEngineHeadless.ts:106
  • +
  • Defined in IGridEngine.ts:449
    • @@ -289,7 +289,7 @@

      Returns

    +
  • Defined in IGridEngine.ts:380
  • +
  • Defined in IGridEngine.ts:387
  • +
  • Defined in IGridEngine.ts:300
  • +
  • Defined in IGridEngine.ts:211
  • +
  • Defined in IGridEngine.ts:568
  • +
  • Defined in IGridEngine.ts:174
  • +
  • Defined in IGridEngine.ts:250
  • +
  • Defined in IGridEngine.ts:519
  • +
  • Defined in IGridEngine.ts:527
  • +
  • Defined in IGridEngine.ts:559
  • +
  • Defined in IGridEngine.ts:551
  • +
  • Defined in IGridEngine.ts:314
  • +
  • Defined in IGridEngine.ts:457
  • +
  • Defined in IGridEngine.ts:413
  • +
  • Defined in IGridEngine.ts:243
  • +
  • Defined in IGridEngine.ts:236
  • Chatacter State

    @@ -541,7 +541,7 @@

    Returns boolean

    +
  • Defined in IGridEngine.ts:373
  • Grid Engine

    @@ -553,7 +553,7 @@

    Returns Observab

    +
  • Defined in IGridEngine.ts:511
  • +
  • Defined in IGridEngine.ts:271
  • +
  • Defined in IGridEngine.ts:580
  • +
  • Defined in IGridEngine.ts:287
  • +
  • Defined in IGridEngine.ts:279
  • +
  • Defined in IGridEngine.ts:264
  • Other

    @@ -658,7 +658,7 @@

    Returns string

    +
  • Defined in IGridEngine.ts:293
  • Pathfinding

    @@ -691,7 +691,7 @@

    Returns

    +
  • Defined in IGridEngine.ts:484
  • @@ -762,7 +762,7 @@

    Deprecated

    Use follow(charId: string, charIdToFollow: string, options shortest path until it reaches the specified distance.

  • +
  • Defined in IGridEngine.ts:356
  • @@ -778,7 +778,7 @@
    Optional Optional closestPointIfBlocked: boolean
  • Returns void

    +
  • Defined in IGridEngine.ts:362
  • +
  • Defined in IGridEngine.ts:634
  • +
  • Defined in IGridEngine.ts:224
  • Queue Movement

    @@ -856,7 +856,7 @@
    Optional Returns any
    +
  • Defined in IGridEngine.ts:597
  • +
  • Defined in IGridEngine.ts:616
  • +
  • Defined in IGridEngine.ts:608
  • +
  • Defined in IGridEngine.ts:624
  • Random Movement

    @@ -936,7 +936,7 @@
    radius: Returns void
    +
  • Defined in IGridEngine.ts:203
  • Tilemap

    @@ -957,7 +957,7 @@

    Returns string

    +
  • Defined in IGridEngine.ts:402
  • +
  • Defined in IGridEngine.ts:465
  • +
  • Defined in IGridEngine.ts:151
  • +
  • Defined in IGridEngine.ts:425
  • +
  • Defined in IGridEngine.ts:439
  • +
  • Defined in IGridEngine.ts:167
  • +
  • Defined in Movement/TargetMovement/TargetMovement.ts:121
  • isPositionAllowedFn?: IsPositionAllowedFn
    @@ -90,7 +90,7 @@
    +
  • Defined in Movement/TargetMovement/TargetMovement.ts:100
  • maxPathLength?: number
    @@ -100,7 +100,7 @@
    +
  • Defined in Movement/TargetMovement/TargetMovement.ts:112
  • noPathFoundMaxRetries?: number
    @@ -109,7 +109,7 @@
    +
  • Defined in Movement/TargetMovement/TargetMovement.ts:59
  • noPathFoundRetryBackoffMs?: number
    @@ -119,7 +119,7 @@
    +
  • Defined in Movement/TargetMovement/TargetMovement.ts:52
  • noPathFoundStrategy?: NoPathFoundStrategy
    @@ -128,7 +128,7 @@
    +
  • Defined in Movement/TargetMovement/TargetMovement.ts:35
  • pathBlockedMaxRetries?: number
    @@ -137,7 +137,7 @@
    +
  • Defined in Movement/TargetMovement/TargetMovement.ts:66
  • pathBlockedRetryBackoffMs?: number
    @@ -147,7 +147,7 @@
    +
  • Defined in Movement/TargetMovement/TargetMovement.ts:74
  • pathBlockedStrategy?: PathBlockedStrategy
    @@ -158,7 +158,7 @@
    +
  • Defined in Movement/TargetMovement/TargetMovement.ts:44
  • pathBlockedWaitTimeoutMs?: number
    @@ -168,7 +168,7 @@
    +
  • Defined in Movement/TargetMovement/TargetMovement.ts:82
  • targetLayer?: string
    @@ -177,7 +177,7 @@
    +
  • Defined in Movement/TargetMovement/TargetMovement.ts:88
  • +
  • Defined in Movement/TargetMovement/TargetMovement.ts:164
  • type: string
    @@ -92,7 +92,7 @@
    +
  • Defined in Movement/Movement.ts:9
  • +
  • Defined in Movement/Movement.ts:9
  • +
  • Defined in Pathfinding/Pathfinding.ts:107
  • ignoreBlockedTarget?: boolean
    @@ -94,7 +94,7 @@
    +
  • Defined in Pathfinding/Pathfinding.ts:82
  • ignoreLayers?: boolean
    @@ -107,7 +107,7 @@

    Default

    false
     
    +
  • Defined in Pathfinding/Pathfinding.ts:98
  • ignoreMapBounds?: boolean
    @@ -117,7 +117,7 @@
    +
  • Defined in Pathfinding/Pathfinding.ts:75
  • ignoreTiles?: boolean
    @@ -125,7 +125,7 @@
    +
  • Defined in Pathfinding/Pathfinding.ts:68
  • ignoredChars?: string[]
    @@ -133,7 +133,7 @@
    +
  • Defined in Pathfinding/Pathfinding.ts:63
  • isPositionAllowed?: IsPositionAllowedFn
    @@ -146,7 +146,7 @@
    +
  • Defined in Pathfinding/Pathfinding.ts:53
  • maxPathLength?: number
    @@ -156,7 +156,7 @@
    +
  • Defined in Pathfinding/Pathfinding.ts:89
  • numberOfDirections?: NumberOfDirections
    @@ -164,7 +164,7 @@
    +
  • Defined in Pathfinding/Pathfinding.ts:41
  • pathHeight?: number
    @@ -173,7 +173,7 @@
    +
  • Defined in Pathfinding/Pathfinding.ts:36
  • pathWidth?: number
    @@ -182,7 +182,7 @@
    +
  • Defined in Pathfinding/Pathfinding.ts:31
  • shortestPathAlgorithm?: ShortestPathAlgorithmType
    @@ -190,7 +190,7 @@
    +
  • Defined in Pathfinding/Pathfinding.ts:24
  • +
  • Defined in IGridEngine.ts:64
  • steps: number
    +
  • Defined in IGridEngine.ts:39
  • +
  • Defined in Movement/QueueMovement/QueueMovement.ts:28
  • pathBlockedWaitTimeoutMs?: number
    @@ -74,7 +74,7 @@

    -1

    +
  • Defined in Movement/QueueMovement/QueueMovement.ts:39
  • skipInvalidPositions?: boolean
    @@ -90,7 +90,7 @@

    false

    +
  • Defined in Movement/QueueMovement/QueueMovement.ts:65
  • Returns boolean

    +
  • Defined in GridTilemap/Tilemap.ts:6
  • Returns boolean

    +
  • Defined in GridTilemap/Tilemap.ts:12
  • +
  • Defined in GridTilemap/Tilemap.ts:14
  • +
  • Defined in GridTilemap/Phaser/PhaserTilemap.ts:6
  • Returns boolean

    +
  • Defined in GridTilemap/Tilemap.ts:22
  • +
  • Defined in GridEngine.ts:161
  • right: FrameRow
    @@ -78,7 +78,7 @@
    +
  • Defined in GridEngine.ts:157
  • @@ -86,7 +86,7 @@
    +
  • Defined in GridEngine.ts:155
  • up-left?: FrameRow
    @@ -94,7 +94,7 @@
    +
  • Defined in GridEngine.ts:163
  • up-right?: FrameRow
    @@ -102,7 +102,7 @@
    +
  • Defined in GridEngine.ts:165
  • +
  • Defined in IGridEngine.ts:18
  • +
  • Defined in Pathfinding/Pathfinding.ts:133
  • +
  • Defined in GridTilemap/Tilemap.ts:1
  • +
  • Defined in Movement/QueueMovement/QueueMovement.ts:96
  • +
  • Defined in Pathfinding/ShortestPathAlgorithm.ts:30
  • +
  • Defined in GridEngineHeadless.ts:79