@esengine/pathfinding 1.0.8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,558 +0,0 @@
1
- /**
2
- * @esengine/pathfinding v1.0.8
3
- * 高性能寻路算法库 - 支持A*、广度优先等算法,适用于Cocos Creator、Laya等游戏引擎
4
- *
5
- * @author yhh
6
- * @license MIT
7
- */
8
- var Vector2Utils = (function () {
9
- function Vector2Utils() {
10
- }
11
- Vector2Utils.equals = function (a, b) {
12
- if (a.equals) {
13
- return a.equals(b);
14
- }
15
- return a.x === b.x && a.y === b.y;
16
- };
17
- Vector2Utils.create = function (x, y) {
18
- return { x: x, y: y };
19
- };
20
- Vector2Utils.clone = function (vector) {
21
- return { x: vector.x, y: vector.y };
22
- };
23
- Vector2Utils.add = function (a, b) {
24
- return { x: a.x + b.x, y: a.y + b.y };
25
- };
26
- Vector2Utils.manhattanDistance = function (a, b) {
27
- return Math.abs(a.x - b.x) + Math.abs(a.y - b.y);
28
- };
29
- Vector2Utils.distance = function (a, b) {
30
- var dx = a.x - b.x;
31
- var dy = a.y - b.y;
32
- return Math.sqrt(dx * dx + dy * dy);
33
- };
34
- Vector2Utils.toHash = function (vector) {
35
- var x = (vector.x + this.MAX_COORD) | 0;
36
- var y = (vector.y + this.MAX_COORD) | 0;
37
- return (x << 16) | y;
38
- };
39
- Vector2Utils.toKey = function (vector) {
40
- return "".concat(vector.x, ",").concat(vector.y);
41
- };
42
- Vector2Utils.fromHash = function (hash) {
43
- var x = (hash >> 16) - this.MAX_COORD;
44
- var y = (hash & 0xFFFF) - this.MAX_COORD;
45
- return { x: x, y: y };
46
- };
47
- Vector2Utils.HASH_MULTIPLIER = 73856093;
48
- Vector2Utils.MAX_COORD = 32767;
49
- return Vector2Utils;
50
- }());
51
-
52
- var PriorityQueue = (function () {
53
- function PriorityQueue() {
54
- this._heap = [];
55
- this._size = 0;
56
- }
57
- Object.defineProperty(PriorityQueue.prototype, "size", {
58
- get: function () {
59
- return this._size;
60
- },
61
- enumerable: false,
62
- configurable: true
63
- });
64
- Object.defineProperty(PriorityQueue.prototype, "isEmpty", {
65
- get: function () {
66
- return this._size === 0;
67
- },
68
- enumerable: false,
69
- configurable: true
70
- });
71
- PriorityQueue.prototype.clear = function () {
72
- this._heap.length = 0;
73
- this._size = 0;
74
- };
75
- PriorityQueue.prototype.enqueue = function (item) {
76
- this._heap[this._size] = item;
77
- this._bubbleUp(this._size);
78
- this._size++;
79
- };
80
- PriorityQueue.prototype.dequeue = function () {
81
- if (this._size === 0) {
82
- return undefined;
83
- }
84
- var result = this._heap[0];
85
- this._size--;
86
- if (this._size > 0) {
87
- this._heap[0] = this._heap[this._size];
88
- this._bubbleDown(0);
89
- }
90
- return result;
91
- };
92
- PriorityQueue.prototype.peek = function () {
93
- return this._size > 0 ? this._heap[0] : undefined;
94
- };
95
- PriorityQueue.prototype._bubbleUp = function (index) {
96
- while (index > 0) {
97
- var parentIndex = Math.floor((index - 1) / 2);
98
- if (this._heap[index].priority >= this._heap[parentIndex].priority) {
99
- break;
100
- }
101
- this._swap(index, parentIndex);
102
- index = parentIndex;
103
- }
104
- };
105
- PriorityQueue.prototype._bubbleDown = function (index) {
106
- while (true) {
107
- var minIndex = index;
108
- var leftChild = 2 * index + 1;
109
- var rightChild = 2 * index + 2;
110
- if (leftChild < this._size &&
111
- this._heap[leftChild].priority < this._heap[minIndex].priority) {
112
- minIndex = leftChild;
113
- }
114
- if (rightChild < this._size &&
115
- this._heap[rightChild].priority < this._heap[minIndex].priority) {
116
- minIndex = rightChild;
117
- }
118
- if (minIndex === index) {
119
- break;
120
- }
121
- this._swap(index, minIndex);
122
- index = minIndex;
123
- }
124
- };
125
- PriorityQueue.prototype._swap = function (i, j) {
126
- var temp = this._heap[i];
127
- this._heap[i] = this._heap[j];
128
- this._heap[j] = temp;
129
- };
130
- return PriorityQueue;
131
- }());
132
-
133
- var __spreadArray = (globalThis && globalThis.__spreadArray) || function (to, from, pack) {
134
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
135
- if (ar || !(i in from)) {
136
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
137
- ar[i] = from[i];
138
- }
139
- }
140
- return to.concat(ar || Array.prototype.slice.call(from));
141
- };
142
- var AStarNode = (function () {
143
- function AStarNode(node, gCost, hCost, parent) {
144
- if (gCost === void 0) { gCost = 0; }
145
- if (hCost === void 0) { hCost = 0; }
146
- if (parent === void 0) { parent = null; }
147
- this.priority = 0;
148
- this.gCost = 0;
149
- this.hCost = 0;
150
- this.parent = null;
151
- this.hash = 0;
152
- this.node = node;
153
- this.gCost = gCost;
154
- this.hCost = hCost;
155
- this.priority = gCost + hCost;
156
- this.parent = parent;
157
- this.hash = Vector2Utils.toHash(node);
158
- }
159
- AStarNode.prototype.updateCosts = function (gCost, hCost, parent) {
160
- if (parent === void 0) { parent = null; }
161
- this.gCost = gCost;
162
- this.hCost = hCost;
163
- this.priority = gCost + hCost;
164
- this.parent = parent;
165
- };
166
- AStarNode.prototype.updateNode = function (node, gCost, hCost, parent) {
167
- if (gCost === void 0) { gCost = 0; }
168
- if (hCost === void 0) { hCost = 0; }
169
- if (parent === void 0) { parent = null; }
170
- this.node = node;
171
- this.gCost = gCost;
172
- this.hCost = hCost;
173
- this.priority = gCost + hCost;
174
- this.parent = parent;
175
- this.hash = Vector2Utils.toHash(node);
176
- };
177
- AStarNode.prototype.reset = function () {
178
- this.node = null;
179
- this.priority = 0;
180
- this.gCost = 0;
181
- this.hCost = 0;
182
- this.parent = null;
183
- this.hash = 0;
184
- };
185
- return AStarNode;
186
- }());
187
- var AStarPathfinder = (function () {
188
- function AStarPathfinder() {
189
- }
190
- AStarPathfinder._getNode = function (node, gCost, hCost, parent) {
191
- if (gCost === void 0) { gCost = 0; }
192
- if (hCost === void 0) { hCost = 0; }
193
- if (parent === void 0) { parent = null; }
194
- var astarNode = this._nodePool.pop();
195
- if (!astarNode) {
196
- astarNode = new AStarNode(node, gCost, hCost, parent);
197
- }
198
- else {
199
- astarNode.updateNode(node, gCost, hCost, parent);
200
- }
201
- return astarNode;
202
- };
203
- AStarPathfinder._recycleNode = function (node) {
204
- if (this._nodePool.length < 1000) {
205
- node.reset();
206
- this._nodePool.push(node);
207
- }
208
- };
209
- AStarPathfinder.search = function (graph, start, goal) {
210
- var openSet = new PriorityQueue();
211
- var closedSet = new Set();
212
- var openSetMap = new Map();
213
- var startHash = Vector2Utils.toHash(start);
214
- var goalHash = Vector2Utils.toHash(goal);
215
- if (startHash === goalHash) {
216
- return { found: true, goalNode: this._getNode(start, 0, 0) };
217
- }
218
- if (!graph.isNodePassable(start)) {
219
- return { found: false, openSetNodes: [] };
220
- }
221
- var startNode = this._getNode(start, 0, graph.heuristic(start, goal));
222
- openSet.enqueue(startNode);
223
- openSetMap.set(startHash, startNode);
224
- var goalNode;
225
- var processedNodes = [];
226
- while (!openSet.isEmpty) {
227
- var current = openSet.dequeue();
228
- var currentHash = current.hash;
229
- openSetMap.delete(currentHash);
230
- if (currentHash === goalHash) {
231
- goalNode = current;
232
- break;
233
- }
234
- closedSet.add(currentHash);
235
- for (var _i = 0, _a = graph.getNeighbors(current.node); _i < _a.length; _i++) {
236
- var neighbor = _a[_i];
237
- var neighborHash = Vector2Utils.toHash(neighbor);
238
- if (closedSet.has(neighborHash)) {
239
- continue;
240
- }
241
- var tentativeGScore = current.gCost + graph.cost(current.node, neighbor);
242
- var existingNode = openSetMap.get(neighborHash);
243
- if (existingNode) {
244
- if (tentativeGScore < existingNode.gCost) {
245
- var hCost = existingNode.hCost;
246
- existingNode.updateCosts(tentativeGScore, hCost, current);
247
- }
248
- }
249
- else {
250
- var hCost = graph.heuristic(neighbor, goal);
251
- var neighborNode = this._getNode(neighbor, tentativeGScore, hCost, current);
252
- openSet.enqueue(neighborNode);
253
- openSetMap.set(neighborHash, neighborNode);
254
- }
255
- }
256
- processedNodes.push(current);
257
- }
258
- var remainingNodes = [];
259
- while (!openSet.isEmpty) {
260
- remainingNodes.push(openSet.dequeue());
261
- }
262
- var allNodesToRecycle = __spreadArray(__spreadArray([], processedNodes, true), remainingNodes, true);
263
- return { found: !!goalNode, goalNode: goalNode, openSetNodes: allNodesToRecycle };
264
- };
265
- AStarPathfinder.searchPath = function (graph, start, goal) {
266
- var result = this.search(graph, start, goal);
267
- if (!result.found || !result.goalNode) {
268
- if (result.openSetNodes) {
269
- for (var _i = 0, _a = result.openSetNodes; _i < _a.length; _i++) {
270
- var node = _a[_i];
271
- this._recycleNode(node);
272
- }
273
- }
274
- return [];
275
- }
276
- var path = this.reconstructPathFromNode(result.goalNode);
277
- if (result.openSetNodes) {
278
- for (var _b = 0, _c = result.openSetNodes; _b < _c.length; _b++) {
279
- var node = _c[_b];
280
- this._recycleNode(node);
281
- }
282
- }
283
- return path;
284
- };
285
- AStarPathfinder.reconstructPathFromNode = function (goalNode) {
286
- this._tempPath.length = 0;
287
- var current = goalNode;
288
- while (current) {
289
- this._tempPath.unshift(current.node);
290
- current = current.parent;
291
- }
292
- return __spreadArray([], this._tempPath, true);
293
- };
294
- AStarPathfinder.hasPath = function (graph, start, goal) {
295
- var result = this.search(graph, start, goal);
296
- if (result.goalNode) {
297
- this._recycleNode(result.goalNode);
298
- }
299
- if (result.openSetNodes) {
300
- for (var _i = 0, _a = result.openSetNodes; _i < _a.length; _i++) {
301
- var node = _a[_i];
302
- if (node !== result.goalNode) {
303
- this._recycleNode(node);
304
- }
305
- }
306
- }
307
- return result.found;
308
- };
309
- AStarPathfinder.clearPool = function () {
310
- this._nodePool.length = 0;
311
- this._tempPath.length = 0;
312
- };
313
- AStarPathfinder.getPoolStats = function () {
314
- return {
315
- poolSize: this._nodePool.length,
316
- maxPoolSize: 1000
317
- };
318
- };
319
- AStarPathfinder._nodePool = [];
320
- AStarPathfinder._tempPath = [];
321
- return AStarPathfinder;
322
- }());
323
-
324
- var AstarGridGraph = (function () {
325
- function AstarGridGraph(width, height) {
326
- this.dirs = [
327
- Vector2Utils.create(1, 0),
328
- Vector2Utils.create(0, -1),
329
- Vector2Utils.create(-1, 0),
330
- Vector2Utils.create(0, 1)
331
- ];
332
- this.walls = [];
333
- this.weightedNodes = [];
334
- this.defaultWeight = 1;
335
- this.weightedNodeWeight = 5;
336
- this._neighbors = new Array(4);
337
- this._wallsSet = new Set();
338
- this._weightedNodesSet = new Set();
339
- this._wallsDirty = true;
340
- this._weightedNodesDirty = true;
341
- this._width = width;
342
- this._height = height;
343
- }
344
- AstarGridGraph.prototype.addWall = function (wall) {
345
- this.walls.push(wall);
346
- this._wallsDirty = true;
347
- };
348
- AstarGridGraph.prototype.addWalls = function (walls) {
349
- var _a;
350
- (_a = this.walls).push.apply(_a, walls);
351
- this._wallsDirty = true;
352
- };
353
- AstarGridGraph.prototype.clearWalls = function () {
354
- this.walls.length = 0;
355
- this._wallsSet.clear();
356
- this._wallsDirty = false;
357
- };
358
- AstarGridGraph.prototype.addWeightedNode = function (node) {
359
- this.weightedNodes.push(node);
360
- this._weightedNodesDirty = true;
361
- };
362
- AstarGridGraph.prototype.addWeightedNodes = function (nodes) {
363
- var _a;
364
- (_a = this.weightedNodes).push.apply(_a, nodes);
365
- this._weightedNodesDirty = true;
366
- };
367
- AstarGridGraph.prototype.clearWeightedNodes = function () {
368
- this.weightedNodes.length = 0;
369
- this._weightedNodesSet.clear();
370
- this._weightedNodesDirty = false;
371
- };
372
- AstarGridGraph.prototype._updateHashSets = function () {
373
- if (this._wallsDirty) {
374
- this._wallsSet.clear();
375
- for (var _i = 0, _a = this.walls; _i < _a.length; _i++) {
376
- var wall = _a[_i];
377
- this._wallsSet.add(Vector2Utils.toHash(wall));
378
- }
379
- this._wallsDirty = false;
380
- }
381
- if (this._weightedNodesDirty) {
382
- this._weightedNodesSet.clear();
383
- for (var _b = 0, _c = this.weightedNodes; _b < _c.length; _b++) {
384
- var node = _c[_b];
385
- this._weightedNodesSet.add(Vector2Utils.toHash(node));
386
- }
387
- this._weightedNodesDirty = false;
388
- }
389
- };
390
- AstarGridGraph.prototype.isNodeInBounds = function (node) {
391
- return 0 <= node.x && node.x < this._width && 0 <= node.y && node.y < this._height;
392
- };
393
- AstarGridGraph.prototype.isNodePassable = function (node) {
394
- this._updateHashSets();
395
- return !this._wallsSet.has(Vector2Utils.toHash(node));
396
- };
397
- AstarGridGraph.prototype.search = function (start, goal) {
398
- return AStarPathfinder.hasPath(this, start, goal);
399
- };
400
- AstarGridGraph.prototype.searchPath = function (start, goal) {
401
- return AStarPathfinder.searchPath(this, start, goal);
402
- };
403
- AstarGridGraph.prototype.getNeighbors = function (node) {
404
- this._neighbors.length = 0;
405
- for (var _i = 0, _a = this.dirs; _i < _a.length; _i++) {
406
- var dir = _a[_i];
407
- var next = Vector2Utils.add(node, dir);
408
- if (this.isNodeInBounds(next) && this.isNodePassable(next)) {
409
- this._neighbors.push(next);
410
- }
411
- }
412
- return this._neighbors;
413
- };
414
- AstarGridGraph.prototype.cost = function (from, to) {
415
- this._updateHashSets();
416
- return this._weightedNodesSet.has(Vector2Utils.toHash(to)) ? this.weightedNodeWeight : this.defaultWeight;
417
- };
418
- AstarGridGraph.prototype.heuristic = function (node, goal) {
419
- return Vector2Utils.manhattanDistance(node, goal);
420
- };
421
- AstarGridGraph.prototype.getStats = function () {
422
- this._updateHashSets();
423
- return {
424
- walls: this.walls.length,
425
- weightedNodes: this.weightedNodes.length,
426
- gridSize: "".concat(this._width, "x").concat(this._height),
427
- wallsSetSize: this._wallsSet.size,
428
- weightedNodesSetSize: this._weightedNodesSet.size
429
- };
430
- };
431
- return AstarGridGraph;
432
- }());
433
-
434
- var BreadthFirstPathfinder = (function () {
435
- function BreadthFirstPathfinder() {
436
- }
437
- BreadthFirstPathfinder.search = function (graph, start, goal, cameFrom) {
438
- var frontier = [];
439
- var visited = new Set();
440
- var pathMap = cameFrom || new Map();
441
- var startHash = Vector2Utils.toHash(start);
442
- var goalHash = Vector2Utils.toHash(goal);
443
- if (startHash === goalHash) {
444
- return true;
445
- }
446
- frontier.push(start);
447
- visited.add(startHash);
448
- while (frontier.length > 0) {
449
- var current = frontier.shift();
450
- var currentHash = Vector2Utils.toHash(current);
451
- if (currentHash === goalHash) {
452
- return true;
453
- }
454
- for (var _i = 0, _a = graph.getNeighbors(current); _i < _a.length; _i++) {
455
- var neighbor = _a[_i];
456
- var neighborHash = Vector2Utils.toHash(neighbor);
457
- if (visited.has(neighborHash)) {
458
- continue;
459
- }
460
- visited.add(neighborHash);
461
- pathMap.set(neighborHash, current);
462
- frontier.push(neighbor);
463
- }
464
- }
465
- return false;
466
- };
467
- BreadthFirstPathfinder.searchPath = function (graph, start, goal) {
468
- var cameFrom = new Map();
469
- if (this.search(graph, start, goal, cameFrom)) {
470
- return this.reconstructPath(cameFrom, start, goal);
471
- }
472
- return [];
473
- };
474
- BreadthFirstPathfinder.reconstructPath = function (cameFrom, start, goal) {
475
- var path = [];
476
- var current = goal;
477
- var startHash = Vector2Utils.toHash(start);
478
- while (Vector2Utils.toHash(current) !== startHash) {
479
- path.unshift(current);
480
- var currentHash = Vector2Utils.toHash(current);
481
- var parent_1 = cameFrom.get(currentHash);
482
- if (!parent_1)
483
- break;
484
- current = parent_1;
485
- }
486
- path.unshift(start);
487
- return path;
488
- };
489
- return BreadthFirstPathfinder;
490
- }());
491
-
492
- var UnweightedGraph = (function () {
493
- function UnweightedGraph() {
494
- this.edges = new Map();
495
- }
496
- UnweightedGraph.prototype.addEdgesForNode = function (node, neighbors) {
497
- this.edges.set(node, neighbors);
498
- return this;
499
- };
500
- UnweightedGraph.prototype.getNeighbors = function (node) {
501
- return this.edges.get(node) || [];
502
- };
503
- return UnweightedGraph;
504
- }());
505
-
506
- var UnweightedGridGraph = (function () {
507
- function UnweightedGridGraph(width, height, allowDiagonalSearch) {
508
- if (allowDiagonalSearch === void 0) { allowDiagonalSearch = false; }
509
- this.walls = [];
510
- this._neighbors = [];
511
- this._width = width;
512
- this._height = height;
513
- this._dirs = allowDiagonalSearch ? UnweightedGridGraph.COMPASS_DIRS : UnweightedGridGraph.CARDINAL_DIRS;
514
- }
515
- UnweightedGridGraph.prototype.isNodeInBounds = function (node) {
516
- return 0 <= node.x && node.x < this._width && 0 <= node.y && node.y < this._height;
517
- };
518
- UnweightedGridGraph.prototype.isNodePassable = function (node) {
519
- return !this.walls.find(function (wall) { return Vector2Utils.equals(wall, node); });
520
- };
521
- UnweightedGridGraph.prototype.getNeighbors = function (node) {
522
- this._neighbors.length = 0;
523
- for (var _i = 0, _a = this._dirs; _i < _a.length; _i++) {
524
- var dir = _a[_i];
525
- var next = Vector2Utils.add(node, dir);
526
- if (this.isNodeInBounds(next) && this.isNodePassable(next)) {
527
- this._neighbors.push(next);
528
- }
529
- }
530
- return this._neighbors;
531
- };
532
- UnweightedGridGraph.prototype.searchPath = function (start, goal) {
533
- return BreadthFirstPathfinder.searchPath(this, start, goal);
534
- };
535
- UnweightedGridGraph.prototype.hasPath = function (start, goal) {
536
- return BreadthFirstPathfinder.search(this, start, goal);
537
- };
538
- UnweightedGridGraph.CARDINAL_DIRS = [
539
- Vector2Utils.create(1, 0),
540
- Vector2Utils.create(0, -1),
541
- Vector2Utils.create(-1, 0),
542
- Vector2Utils.create(0, 1)
543
- ];
544
- UnweightedGridGraph.COMPASS_DIRS = [
545
- Vector2Utils.create(1, 0),
546
- Vector2Utils.create(1, -1),
547
- Vector2Utils.create(0, -1),
548
- Vector2Utils.create(-1, -1),
549
- Vector2Utils.create(-1, 0),
550
- Vector2Utils.create(-1, 1),
551
- Vector2Utils.create(0, 1),
552
- Vector2Utils.create(1, 1),
553
- ];
554
- return UnweightedGridGraph;
555
- }());
556
-
557
- export { AStarPathfinder, AstarGridGraph, BreadthFirstPathfinder, PriorityQueue, UnweightedGraph, UnweightedGridGraph, Vector2Utils };
558
- //# sourceMappingURL=pathfinding.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pathfinding.mjs","sources":["../bin/Types/IVector2.js","../bin/Utils/PriorityQueue.js","../bin/AI/Pathfinding/AStar/AStarPathfinder.js","../bin/AI/Pathfinding/AStar/AstarGridGraph.js","../bin/AI/Pathfinding/BreadthFirst/BreadthFirstPathfinder.js","../bin/AI/Pathfinding/BreadthFirst/UnweightedGraph.js","../bin/AI/Pathfinding/BreadthFirst/UnweightedGridGraph.js"],"sourcesContent":["var Vector2Utils = (function () {\n function Vector2Utils() {\n }\n Vector2Utils.equals = function (a, b) {\n if (a.equals) {\n return a.equals(b);\n }\n return a.x === b.x && a.y === b.y;\n };\n Vector2Utils.create = function (x, y) {\n return { x: x, y: y };\n };\n Vector2Utils.clone = function (vector) {\n return { x: vector.x, y: vector.y };\n };\n Vector2Utils.add = function (a, b) {\n return { x: a.x + b.x, y: a.y + b.y };\n };\n Vector2Utils.manhattanDistance = function (a, b) {\n return Math.abs(a.x - b.x) + Math.abs(a.y - b.y);\n };\n Vector2Utils.distance = function (a, b) {\n var dx = a.x - b.x;\n var dy = a.y - b.y;\n return Math.sqrt(dx * dx + dy * dy);\n };\n Vector2Utils.toHash = function (vector) {\n var x = (vector.x + this.MAX_COORD) | 0;\n var y = (vector.y + this.MAX_COORD) | 0;\n return (x << 16) | y;\n };\n Vector2Utils.toKey = function (vector) {\n return \"\".concat(vector.x, \",\").concat(vector.y);\n };\n Vector2Utils.fromHash = function (hash) {\n var x = (hash >> 16) - this.MAX_COORD;\n var y = (hash & 0xFFFF) - this.MAX_COORD;\n return { x: x, y: y };\n };\n Vector2Utils.HASH_MULTIPLIER = 73856093;\n Vector2Utils.MAX_COORD = 32767;\n return Vector2Utils;\n}());\nexport { Vector2Utils };\n","var PriorityQueue = (function () {\n function PriorityQueue() {\n this._heap = [];\n this._size = 0;\n }\n Object.defineProperty(PriorityQueue.prototype, \"size\", {\n get: function () {\n return this._size;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(PriorityQueue.prototype, \"isEmpty\", {\n get: function () {\n return this._size === 0;\n },\n enumerable: false,\n configurable: true\n });\n PriorityQueue.prototype.clear = function () {\n this._heap.length = 0;\n this._size = 0;\n };\n PriorityQueue.prototype.enqueue = function (item) {\n this._heap[this._size] = item;\n this._bubbleUp(this._size);\n this._size++;\n };\n PriorityQueue.prototype.dequeue = function () {\n if (this._size === 0) {\n return undefined;\n }\n var result = this._heap[0];\n this._size--;\n if (this._size > 0) {\n this._heap[0] = this._heap[this._size];\n this._bubbleDown(0);\n }\n return result;\n };\n PriorityQueue.prototype.peek = function () {\n return this._size > 0 ? this._heap[0] : undefined;\n };\n PriorityQueue.prototype._bubbleUp = function (index) {\n while (index > 0) {\n var parentIndex = Math.floor((index - 1) / 2);\n if (this._heap[index].priority >= this._heap[parentIndex].priority) {\n break;\n }\n this._swap(index, parentIndex);\n index = parentIndex;\n }\n };\n PriorityQueue.prototype._bubbleDown = function (index) {\n while (true) {\n var minIndex = index;\n var leftChild = 2 * index + 1;\n var rightChild = 2 * index + 2;\n if (leftChild < this._size &&\n this._heap[leftChild].priority < this._heap[minIndex].priority) {\n minIndex = leftChild;\n }\n if (rightChild < this._size &&\n this._heap[rightChild].priority < this._heap[minIndex].priority) {\n minIndex = rightChild;\n }\n if (minIndex === index) {\n break;\n }\n this._swap(index, minIndex);\n index = minIndex;\n }\n };\n PriorityQueue.prototype._swap = function (i, j) {\n var temp = this._heap[i];\n this._heap[i] = this._heap[j];\n this._heap[j] = temp;\n };\n return PriorityQueue;\n}());\nexport { PriorityQueue };\n","var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nimport { Vector2Utils } from '../../../Types/IVector2';\nimport { PriorityQueue } from '../../../Utils/PriorityQueue';\nvar AStarNode = (function () {\n function AStarNode(node, gCost, hCost, parent) {\n if (gCost === void 0) { gCost = 0; }\n if (hCost === void 0) { hCost = 0; }\n if (parent === void 0) { parent = null; }\n this.priority = 0;\n this.gCost = 0;\n this.hCost = 0;\n this.parent = null;\n this.hash = 0;\n this.node = node;\n this.gCost = gCost;\n this.hCost = hCost;\n this.priority = gCost + hCost;\n this.parent = parent;\n this.hash = Vector2Utils.toHash(node);\n }\n AStarNode.prototype.updateCosts = function (gCost, hCost, parent) {\n if (parent === void 0) { parent = null; }\n this.gCost = gCost;\n this.hCost = hCost;\n this.priority = gCost + hCost;\n this.parent = parent;\n };\n AStarNode.prototype.updateNode = function (node, gCost, hCost, parent) {\n if (gCost === void 0) { gCost = 0; }\n if (hCost === void 0) { hCost = 0; }\n if (parent === void 0) { parent = null; }\n this.node = node;\n this.gCost = gCost;\n this.hCost = hCost;\n this.priority = gCost + hCost;\n this.parent = parent;\n this.hash = Vector2Utils.toHash(node);\n };\n AStarNode.prototype.reset = function () {\n this.node = null;\n this.priority = 0;\n this.gCost = 0;\n this.hCost = 0;\n this.parent = null;\n this.hash = 0;\n };\n return AStarNode;\n}());\nvar AStarPathfinder = (function () {\n function AStarPathfinder() {\n }\n AStarPathfinder._getNode = function (node, gCost, hCost, parent) {\n if (gCost === void 0) { gCost = 0; }\n if (hCost === void 0) { hCost = 0; }\n if (parent === void 0) { parent = null; }\n var astarNode = this._nodePool.pop();\n if (!astarNode) {\n astarNode = new AStarNode(node, gCost, hCost, parent);\n }\n else {\n astarNode.updateNode(node, gCost, hCost, parent);\n }\n return astarNode;\n };\n AStarPathfinder._recycleNode = function (node) {\n if (this._nodePool.length < 1000) {\n node.reset();\n this._nodePool.push(node);\n }\n };\n AStarPathfinder.search = function (graph, start, goal) {\n var openSet = new PriorityQueue();\n var closedSet = new Set();\n var openSetMap = new Map();\n var startHash = Vector2Utils.toHash(start);\n var goalHash = Vector2Utils.toHash(goal);\n if (startHash === goalHash) {\n return { found: true, goalNode: this._getNode(start, 0, 0) };\n }\n if (!graph.isNodePassable(start)) {\n return { found: false, openSetNodes: [] };\n }\n var startNode = this._getNode(start, 0, graph.heuristic(start, goal));\n openSet.enqueue(startNode);\n openSetMap.set(startHash, startNode);\n var goalNode;\n var processedNodes = [];\n while (!openSet.isEmpty) {\n var current = openSet.dequeue();\n var currentHash = current.hash;\n openSetMap.delete(currentHash);\n if (currentHash === goalHash) {\n goalNode = current;\n break;\n }\n closedSet.add(currentHash);\n for (var _i = 0, _a = graph.getNeighbors(current.node); _i < _a.length; _i++) {\n var neighbor = _a[_i];\n var neighborHash = Vector2Utils.toHash(neighbor);\n if (closedSet.has(neighborHash)) {\n continue;\n }\n var tentativeGScore = current.gCost + graph.cost(current.node, neighbor);\n var existingNode = openSetMap.get(neighborHash);\n if (existingNode) {\n if (tentativeGScore < existingNode.gCost) {\n var hCost = existingNode.hCost;\n existingNode.updateCosts(tentativeGScore, hCost, current);\n }\n }\n else {\n var hCost = graph.heuristic(neighbor, goal);\n var neighborNode = this._getNode(neighbor, tentativeGScore, hCost, current);\n openSet.enqueue(neighborNode);\n openSetMap.set(neighborHash, neighborNode);\n }\n }\n processedNodes.push(current);\n }\n var remainingNodes = [];\n while (!openSet.isEmpty) {\n remainingNodes.push(openSet.dequeue());\n }\n var allNodesToRecycle = __spreadArray(__spreadArray([], processedNodes, true), remainingNodes, true);\n return { found: !!goalNode, goalNode: goalNode, openSetNodes: allNodesToRecycle };\n };\n AStarPathfinder.searchPath = function (graph, start, goal) {\n var result = this.search(graph, start, goal);\n if (!result.found || !result.goalNode) {\n if (result.openSetNodes) {\n for (var _i = 0, _a = result.openSetNodes; _i < _a.length; _i++) {\n var node = _a[_i];\n this._recycleNode(node);\n }\n }\n return [];\n }\n var path = this.reconstructPathFromNode(result.goalNode);\n if (result.openSetNodes) {\n for (var _b = 0, _c = result.openSetNodes; _b < _c.length; _b++) {\n var node = _c[_b];\n this._recycleNode(node);\n }\n }\n return path;\n };\n AStarPathfinder.reconstructPathFromNode = function (goalNode) {\n this._tempPath.length = 0;\n var current = goalNode;\n while (current) {\n this._tempPath.unshift(current.node);\n current = current.parent;\n }\n return __spreadArray([], this._tempPath, true);\n };\n AStarPathfinder.hasPath = function (graph, start, goal) {\n var result = this.search(graph, start, goal);\n if (result.goalNode) {\n this._recycleNode(result.goalNode);\n }\n if (result.openSetNodes) {\n for (var _i = 0, _a = result.openSetNodes; _i < _a.length; _i++) {\n var node = _a[_i];\n if (node !== result.goalNode) {\n this._recycleNode(node);\n }\n }\n }\n return result.found;\n };\n AStarPathfinder.clearPool = function () {\n this._nodePool.length = 0;\n this._tempPath.length = 0;\n };\n AStarPathfinder.getPoolStats = function () {\n return {\n poolSize: this._nodePool.length,\n maxPoolSize: 1000\n };\n };\n AStarPathfinder._nodePool = [];\n AStarPathfinder._tempPath = [];\n return AStarPathfinder;\n}());\nexport { AStarPathfinder };\n","import { Vector2Utils } from '../../../Types/IVector2';\nimport { AStarPathfinder } from './AStarPathfinder';\nvar AstarGridGraph = (function () {\n function AstarGridGraph(width, height) {\n this.dirs = [\n Vector2Utils.create(1, 0),\n Vector2Utils.create(0, -1),\n Vector2Utils.create(-1, 0),\n Vector2Utils.create(0, 1)\n ];\n this.walls = [];\n this.weightedNodes = [];\n this.defaultWeight = 1;\n this.weightedNodeWeight = 5;\n this._neighbors = new Array(4);\n this._wallsSet = new Set();\n this._weightedNodesSet = new Set();\n this._wallsDirty = true;\n this._weightedNodesDirty = true;\n this._width = width;\n this._height = height;\n }\n AstarGridGraph.prototype.addWall = function (wall) {\n this.walls.push(wall);\n this._wallsDirty = true;\n };\n AstarGridGraph.prototype.addWalls = function (walls) {\n var _a;\n (_a = this.walls).push.apply(_a, walls);\n this._wallsDirty = true;\n };\n AstarGridGraph.prototype.clearWalls = function () {\n this.walls.length = 0;\n this._wallsSet.clear();\n this._wallsDirty = false;\n };\n AstarGridGraph.prototype.addWeightedNode = function (node) {\n this.weightedNodes.push(node);\n this._weightedNodesDirty = true;\n };\n AstarGridGraph.prototype.addWeightedNodes = function (nodes) {\n var _a;\n (_a = this.weightedNodes).push.apply(_a, nodes);\n this._weightedNodesDirty = true;\n };\n AstarGridGraph.prototype.clearWeightedNodes = function () {\n this.weightedNodes.length = 0;\n this._weightedNodesSet.clear();\n this._weightedNodesDirty = false;\n };\n AstarGridGraph.prototype._updateHashSets = function () {\n if (this._wallsDirty) {\n this._wallsSet.clear();\n for (var _i = 0, _a = this.walls; _i < _a.length; _i++) {\n var wall = _a[_i];\n this._wallsSet.add(Vector2Utils.toHash(wall));\n }\n this._wallsDirty = false;\n }\n if (this._weightedNodesDirty) {\n this._weightedNodesSet.clear();\n for (var _b = 0, _c = this.weightedNodes; _b < _c.length; _b++) {\n var node = _c[_b];\n this._weightedNodesSet.add(Vector2Utils.toHash(node));\n }\n this._weightedNodesDirty = false;\n }\n };\n AstarGridGraph.prototype.isNodeInBounds = function (node) {\n return 0 <= node.x && node.x < this._width && 0 <= node.y && node.y < this._height;\n };\n AstarGridGraph.prototype.isNodePassable = function (node) {\n this._updateHashSets();\n return !this._wallsSet.has(Vector2Utils.toHash(node));\n };\n AstarGridGraph.prototype.search = function (start, goal) {\n return AStarPathfinder.hasPath(this, start, goal);\n };\n AstarGridGraph.prototype.searchPath = function (start, goal) {\n return AStarPathfinder.searchPath(this, start, goal);\n };\n AstarGridGraph.prototype.getNeighbors = function (node) {\n this._neighbors.length = 0;\n for (var _i = 0, _a = this.dirs; _i < _a.length; _i++) {\n var dir = _a[_i];\n var next = Vector2Utils.add(node, dir);\n if (this.isNodeInBounds(next) && this.isNodePassable(next)) {\n this._neighbors.push(next);\n }\n }\n return this._neighbors;\n };\n AstarGridGraph.prototype.cost = function (from, to) {\n this._updateHashSets();\n return this._weightedNodesSet.has(Vector2Utils.toHash(to)) ? this.weightedNodeWeight : this.defaultWeight;\n };\n AstarGridGraph.prototype.heuristic = function (node, goal) {\n return Vector2Utils.manhattanDistance(node, goal);\n };\n AstarGridGraph.prototype.getStats = function () {\n this._updateHashSets();\n return {\n walls: this.walls.length,\n weightedNodes: this.weightedNodes.length,\n gridSize: \"\".concat(this._width, \"x\").concat(this._height),\n wallsSetSize: this._wallsSet.size,\n weightedNodesSetSize: this._weightedNodesSet.size\n };\n };\n return AstarGridGraph;\n}());\nexport { AstarGridGraph };\n","import { Vector2Utils } from '../../../Types/IVector2';\nvar BreadthFirstPathfinder = (function () {\n function BreadthFirstPathfinder() {\n }\n BreadthFirstPathfinder.search = function (graph, start, goal, cameFrom) {\n var frontier = [];\n var visited = new Set();\n var pathMap = cameFrom || new Map();\n var startHash = Vector2Utils.toHash(start);\n var goalHash = Vector2Utils.toHash(goal);\n if (startHash === goalHash) {\n return true;\n }\n frontier.push(start);\n visited.add(startHash);\n while (frontier.length > 0) {\n var current = frontier.shift();\n var currentHash = Vector2Utils.toHash(current);\n if (currentHash === goalHash) {\n return true;\n }\n for (var _i = 0, _a = graph.getNeighbors(current); _i < _a.length; _i++) {\n var neighbor = _a[_i];\n var neighborHash = Vector2Utils.toHash(neighbor);\n if (visited.has(neighborHash)) {\n continue;\n }\n visited.add(neighborHash);\n pathMap.set(neighborHash, current);\n frontier.push(neighbor);\n }\n }\n return false;\n };\n BreadthFirstPathfinder.searchPath = function (graph, start, goal) {\n var cameFrom = new Map();\n if (this.search(graph, start, goal, cameFrom)) {\n return this.reconstructPath(cameFrom, start, goal);\n }\n return [];\n };\n BreadthFirstPathfinder.reconstructPath = function (cameFrom, start, goal) {\n var path = [];\n var current = goal;\n var startHash = Vector2Utils.toHash(start);\n while (Vector2Utils.toHash(current) !== startHash) {\n path.unshift(current);\n var currentHash = Vector2Utils.toHash(current);\n var parent_1 = cameFrom.get(currentHash);\n if (!parent_1)\n break;\n current = parent_1;\n }\n path.unshift(start);\n return path;\n };\n return BreadthFirstPathfinder;\n}());\nexport { BreadthFirstPathfinder };\n","var UnweightedGraph = (function () {\n function UnweightedGraph() {\n this.edges = new Map();\n }\n UnweightedGraph.prototype.addEdgesForNode = function (node, neighbors) {\n this.edges.set(node, neighbors);\n return this;\n };\n UnweightedGraph.prototype.getNeighbors = function (node) {\n return this.edges.get(node) || [];\n };\n return UnweightedGraph;\n}());\nexport { UnweightedGraph };\n","import { Vector2Utils } from '../../../Types/IVector2';\nimport { BreadthFirstPathfinder } from './BreadthFirstPathfinder';\nvar UnweightedGridGraph = (function () {\n function UnweightedGridGraph(width, height, allowDiagonalSearch) {\n if (allowDiagonalSearch === void 0) { allowDiagonalSearch = false; }\n this.walls = [];\n this._neighbors = [];\n this._width = width;\n this._height = height;\n this._dirs = allowDiagonalSearch ? UnweightedGridGraph.COMPASS_DIRS : UnweightedGridGraph.CARDINAL_DIRS;\n }\n UnweightedGridGraph.prototype.isNodeInBounds = function (node) {\n return 0 <= node.x && node.x < this._width && 0 <= node.y && node.y < this._height;\n };\n UnweightedGridGraph.prototype.isNodePassable = function (node) {\n return !this.walls.find(function (wall) { return Vector2Utils.equals(wall, node); });\n };\n UnweightedGridGraph.prototype.getNeighbors = function (node) {\n this._neighbors.length = 0;\n for (var _i = 0, _a = this._dirs; _i < _a.length; _i++) {\n var dir = _a[_i];\n var next = Vector2Utils.add(node, dir);\n if (this.isNodeInBounds(next) && this.isNodePassable(next)) {\n this._neighbors.push(next);\n }\n }\n return this._neighbors;\n };\n UnweightedGridGraph.prototype.searchPath = function (start, goal) {\n return BreadthFirstPathfinder.searchPath(this, start, goal);\n };\n UnweightedGridGraph.prototype.hasPath = function (start, goal) {\n return BreadthFirstPathfinder.search(this, start, goal);\n };\n UnweightedGridGraph.CARDINAL_DIRS = [\n Vector2Utils.create(1, 0),\n Vector2Utils.create(0, -1),\n Vector2Utils.create(-1, 0),\n Vector2Utils.create(0, 1)\n ];\n UnweightedGridGraph.COMPASS_DIRS = [\n Vector2Utils.create(1, 0),\n Vector2Utils.create(1, -1),\n Vector2Utils.create(0, -1),\n Vector2Utils.create(-1, -1),\n Vector2Utils.create(-1, 0),\n Vector2Utils.create(-1, 1),\n Vector2Utils.create(0, 1),\n Vector2Utils.create(1, 1),\n ];\n return UnweightedGridGraph;\n}());\nexport { UnweightedGridGraph };\n"],"names":["this"],"mappings":";;;;;;;AAAG,IAAC,YAAY,IAAI,YAAY;AAChC,IAAI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