@2112-lab/central-plant 0.1.1 → 0.1.3
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.
- package/dist/bundle/index.js +1 -15140
- package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -353
- package/dist/cjs/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1 -0
- package/dist/cjs/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -1292
- package/dist/cjs/node_modules/three/examples/jsm/controls/TransformControls.js +1 -1543
- package/dist/cjs/node_modules/three/examples/jsm/loaders/GLTFLoader.js +1 -4374
- package/dist/cjs/node_modules/three/examples/jsm/loaders/RGBELoader.js +1 -465
- package/dist/cjs/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +1 -117
- package/dist/cjs/src/animationManager.js +1 -121
- package/dist/cjs/src/componentManager.js +1 -151
- package/dist/cjs/src/debugLogger.js +1 -176
- package/dist/cjs/src/disposalManager.js +1 -185
- package/dist/cjs/src/environmentManager.js +1 -1308
- package/dist/cjs/src/hotReloadManager.js +1 -252
- package/dist/cjs/src/index.js +1 -128
- package/dist/cjs/src/keyboardControlsManager.js +1 -206
- package/dist/cjs/src/nameUtils.js +1 -106
- package/dist/cjs/src/pathfindingManager.js +1 -321
- package/dist/cjs/src/performanceMonitor.js +1 -718
- package/dist/cjs/src/sceneExportManager.js +1 -292
- package/dist/cjs/src/sceneInitializationManager.js +1 -540
- package/dist/cjs/src/textureConfig.js +1 -624
- package/dist/cjs/src/transformControlsManager.js +1 -851
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +1 -328
- package/dist/esm/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1 -0
- package/dist/esm/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -1287
- package/dist/esm/node_modules/three/examples/jsm/controls/TransformControls.js +1 -1537
- package/dist/esm/node_modules/three/examples/jsm/loaders/GLTFLoader.js +1 -4370
- package/dist/esm/node_modules/three/examples/jsm/loaders/RGBELoader.js +1 -461
- package/dist/esm/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +1 -113
- package/dist/esm/src/animationManager.js +1 -112
- package/dist/esm/src/componentManager.js +1 -123
- package/dist/esm/src/debugLogger.js +1 -167
- package/dist/esm/src/disposalManager.js +1 -155
- package/dist/esm/src/environmentManager.js +1 -1282
- package/dist/esm/src/hotReloadManager.js +1 -244
- package/dist/esm/src/index.js +1 -118
- package/dist/esm/src/keyboardControlsManager.js +1 -196
- package/dist/esm/src/nameUtils.js +1 -99
- package/dist/esm/src/pathfindingManager.js +1 -295
- package/dist/esm/src/performanceMonitor.js +1 -712
- package/dist/esm/src/sceneExportManager.js +1 -286
- package/dist/esm/src/sceneInitializationManager.js +1 -513
- package/dist/esm/src/textureConfig.js +1 -595
- package/dist/esm/src/transformControlsManager.js +1 -827
- package/dist/index.d.ts +0 -4
- package/package.json +1 -1
- package/dist/cjs/src/ConnectionManager.js +0 -114
- package/dist/cjs/src/Pathfinder.js +0 -88
- package/dist/cjs/src/modelPreloader.js +0 -488
- package/dist/cjs/src/sceneOperationsManager.js +0 -596
- package/dist/esm/src/ConnectionManager.js +0 -110
- package/dist/esm/src/Pathfinder.js +0 -84
- package/dist/esm/src/modelPreloader.js +0 -464
- package/dist/esm/src/sceneOperationsManager.js +0 -572
|
@@ -1,353 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
function _arrayLikeToArray(r, a) {
|
|
6
|
-
(null == a || a > r.length) && (a = r.length);
|
|
7
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
8
|
-
return n;
|
|
9
|
-
}
|
|
10
|
-
function _arrayWithHoles(r) {
|
|
11
|
-
if (Array.isArray(r)) return r;
|
|
12
|
-
}
|
|
13
|
-
function _arrayWithoutHoles(r) {
|
|
14
|
-
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
15
|
-
}
|
|
16
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
17
|
-
try {
|
|
18
|
-
var i = n[a](c),
|
|
19
|
-
u = i.value;
|
|
20
|
-
} catch (n) {
|
|
21
|
-
return void e(n);
|
|
22
|
-
}
|
|
23
|
-
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
24
|
-
}
|
|
25
|
-
function _asyncToGenerator(n) {
|
|
26
|
-
return function () {
|
|
27
|
-
var t = this,
|
|
28
|
-
e = arguments;
|
|
29
|
-
return new Promise(function (r, o) {
|
|
30
|
-
var a = n.apply(t, e);
|
|
31
|
-
function _next(n) {
|
|
32
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
33
|
-
}
|
|
34
|
-
function _throw(n) {
|
|
35
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
36
|
-
}
|
|
37
|
-
_next(void 0);
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function _classCallCheck(a, n) {
|
|
42
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
43
|
-
}
|
|
44
|
-
function _defineProperties(e, r) {
|
|
45
|
-
for (var t = 0; t < r.length; t++) {
|
|
46
|
-
var o = r[t];
|
|
47
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function _createClass(e, r, t) {
|
|
51
|
-
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
52
|
-
writable: !1
|
|
53
|
-
}), e;
|
|
54
|
-
}
|
|
55
|
-
function _createForOfIteratorHelper(r, e) {
|
|
56
|
-
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
57
|
-
if (!t) {
|
|
58
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
59
|
-
t && (r = t);
|
|
60
|
-
var n = 0,
|
|
61
|
-
F = function () {};
|
|
62
|
-
return {
|
|
63
|
-
s: F,
|
|
64
|
-
n: function () {
|
|
65
|
-
return n >= r.length ? {
|
|
66
|
-
done: !0
|
|
67
|
-
} : {
|
|
68
|
-
done: !1,
|
|
69
|
-
value: r[n++]
|
|
70
|
-
};
|
|
71
|
-
},
|
|
72
|
-
e: function (r) {
|
|
73
|
-
throw r;
|
|
74
|
-
},
|
|
75
|
-
f: F
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
79
|
-
}
|
|
80
|
-
var o,
|
|
81
|
-
a = !0,
|
|
82
|
-
u = !1;
|
|
83
|
-
return {
|
|
84
|
-
s: function () {
|
|
85
|
-
t = t.call(r);
|
|
86
|
-
},
|
|
87
|
-
n: function () {
|
|
88
|
-
var r = t.next();
|
|
89
|
-
return a = r.done, r;
|
|
90
|
-
},
|
|
91
|
-
e: function (r) {
|
|
92
|
-
u = !0, o = r;
|
|
93
|
-
},
|
|
94
|
-
f: function () {
|
|
95
|
-
try {
|
|
96
|
-
a || null == t.return || t.return();
|
|
97
|
-
} finally {
|
|
98
|
-
if (u) throw o;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
function _defineProperty(e, r, t) {
|
|
104
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
105
|
-
value: t,
|
|
106
|
-
enumerable: !0,
|
|
107
|
-
configurable: !0,
|
|
108
|
-
writable: !0
|
|
109
|
-
}) : e[r] = t, e;
|
|
110
|
-
}
|
|
111
|
-
function _iterableToArray(r) {
|
|
112
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
113
|
-
}
|
|
114
|
-
function _iterableToArrayLimit(r, l) {
|
|
115
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
116
|
-
if (null != t) {
|
|
117
|
-
var e,
|
|
118
|
-
n,
|
|
119
|
-
i,
|
|
120
|
-
u,
|
|
121
|
-
a = [],
|
|
122
|
-
f = !0,
|
|
123
|
-
o = !1;
|
|
124
|
-
try {
|
|
125
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
126
|
-
if (Object(t) !== t) return;
|
|
127
|
-
f = !1;
|
|
128
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
129
|
-
} catch (r) {
|
|
130
|
-
o = !0, n = r;
|
|
131
|
-
} finally {
|
|
132
|
-
try {
|
|
133
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
134
|
-
} finally {
|
|
135
|
-
if (o) throw n;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return a;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
function _nonIterableRest() {
|
|
142
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
143
|
-
}
|
|
144
|
-
function _nonIterableSpread() {
|
|
145
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
146
|
-
}
|
|
147
|
-
function ownKeys(e, r) {
|
|
148
|
-
var t = Object.keys(e);
|
|
149
|
-
if (Object.getOwnPropertySymbols) {
|
|
150
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
151
|
-
r && (o = o.filter(function (r) {
|
|
152
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
153
|
-
})), t.push.apply(t, o);
|
|
154
|
-
}
|
|
155
|
-
return t;
|
|
156
|
-
}
|
|
157
|
-
function _objectSpread2(e) {
|
|
158
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
159
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
160
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
161
|
-
_defineProperty(e, r, t[r]);
|
|
162
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
163
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
return e;
|
|
167
|
-
}
|
|
168
|
-
function _regenerator() {
|
|
169
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
170
|
-
var e,
|
|
171
|
-
t,
|
|
172
|
-
r = "function" == typeof Symbol ? Symbol : {},
|
|
173
|
-
n = r.iterator || "@@iterator",
|
|
174
|
-
o = r.toStringTag || "@@toStringTag";
|
|
175
|
-
function i(r, n, o, i) {
|
|
176
|
-
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
177
|
-
u = Object.create(c.prototype);
|
|
178
|
-
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
179
|
-
var i,
|
|
180
|
-
c,
|
|
181
|
-
u,
|
|
182
|
-
f = 0,
|
|
183
|
-
p = o || [],
|
|
184
|
-
y = !1,
|
|
185
|
-
G = {
|
|
186
|
-
p: 0,
|
|
187
|
-
n: 0,
|
|
188
|
-
v: e,
|
|
189
|
-
a: d,
|
|
190
|
-
f: d.bind(e, 4),
|
|
191
|
-
d: function (t, r) {
|
|
192
|
-
return i = t, c = 0, u = e, G.n = r, a;
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
function d(r, n) {
|
|
196
|
-
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
197
|
-
var o,
|
|
198
|
-
i = p[t],
|
|
199
|
-
d = G.p,
|
|
200
|
-
l = i[2];
|
|
201
|
-
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
202
|
-
}
|
|
203
|
-
if (o || r > 1) return a;
|
|
204
|
-
throw y = !0, n;
|
|
205
|
-
}
|
|
206
|
-
return function (o, p, l) {
|
|
207
|
-
if (f > 1) throw TypeError("Generator is already running");
|
|
208
|
-
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
209
|
-
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
210
|
-
try {
|
|
211
|
-
if (f = 2, i) {
|
|
212
|
-
if (c || (o = "next"), t = i[o]) {
|
|
213
|
-
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
214
|
-
if (!t.done) return t;
|
|
215
|
-
u = t.value, c < 2 && (c = 0);
|
|
216
|
-
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
217
|
-
i = e;
|
|
218
|
-
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
219
|
-
} catch (t) {
|
|
220
|
-
i = e, c = 1, u = t;
|
|
221
|
-
} finally {
|
|
222
|
-
f = 1;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return {
|
|
226
|
-
value: t,
|
|
227
|
-
done: y
|
|
228
|
-
};
|
|
229
|
-
};
|
|
230
|
-
}(r, o, i), !0), u;
|
|
231
|
-
}
|
|
232
|
-
var a = {};
|
|
233
|
-
function Generator() {}
|
|
234
|
-
function GeneratorFunction() {}
|
|
235
|
-
function GeneratorFunctionPrototype() {}
|
|
236
|
-
t = Object.getPrototypeOf;
|
|
237
|
-
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
238
|
-
return this;
|
|
239
|
-
}), t),
|
|
240
|
-
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
241
|
-
function f(e) {
|
|
242
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
243
|
-
}
|
|
244
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
245
|
-
return this;
|
|
246
|
-
}), _regeneratorDefine(u, "toString", function () {
|
|
247
|
-
return "[object Generator]";
|
|
248
|
-
}), (_regenerator = function () {
|
|
249
|
-
return {
|
|
250
|
-
w: i,
|
|
251
|
-
m: f
|
|
252
|
-
};
|
|
253
|
-
})();
|
|
254
|
-
}
|
|
255
|
-
function _regeneratorDefine(e, r, n, t) {
|
|
256
|
-
var i = Object.defineProperty;
|
|
257
|
-
try {
|
|
258
|
-
i({}, "", {});
|
|
259
|
-
} catch (e) {
|
|
260
|
-
i = 0;
|
|
261
|
-
}
|
|
262
|
-
_regeneratorDefine = function (e, r, n, t) {
|
|
263
|
-
if (r) i ? i(e, r, {
|
|
264
|
-
value: n,
|
|
265
|
-
enumerable: !t,
|
|
266
|
-
configurable: !t,
|
|
267
|
-
writable: !t
|
|
268
|
-
}) : e[r] = n;else {
|
|
269
|
-
function o(r, n) {
|
|
270
|
-
_regeneratorDefine(e, r, function (e) {
|
|
271
|
-
return this._invoke(r, n, e);
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
o("next", 0), o("throw", 1), o("return", 2);
|
|
275
|
-
}
|
|
276
|
-
}, _regeneratorDefine(e, r, n, t);
|
|
277
|
-
}
|
|
278
|
-
function _regeneratorValues(e) {
|
|
279
|
-
if (null != e) {
|
|
280
|
-
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
281
|
-
r = 0;
|
|
282
|
-
if (t) return t.call(e);
|
|
283
|
-
if ("function" == typeof e.next) return e;
|
|
284
|
-
if (!isNaN(e.length)) return {
|
|
285
|
-
next: function () {
|
|
286
|
-
return e && r >= e.length && (e = void 0), {
|
|
287
|
-
value: e && e[r++],
|
|
288
|
-
done: !e
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
294
|
-
}
|
|
295
|
-
function _slicedToArray(r, e) {
|
|
296
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
297
|
-
}
|
|
298
|
-
function _toConsumableArray(r) {
|
|
299
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
300
|
-
}
|
|
301
|
-
function _toPrimitive(t, r) {
|
|
302
|
-
if ("object" != typeof t || !t) return t;
|
|
303
|
-
var e = t[Symbol.toPrimitive];
|
|
304
|
-
if (void 0 !== e) {
|
|
305
|
-
var i = e.call(t, r || "default");
|
|
306
|
-
if ("object" != typeof i) return i;
|
|
307
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
308
|
-
}
|
|
309
|
-
return ("string" === r ? String : Number)(t);
|
|
310
|
-
}
|
|
311
|
-
function _toPropertyKey(t) {
|
|
312
|
-
var i = _toPrimitive(t, "string");
|
|
313
|
-
return "symbol" == typeof i ? i : i + "";
|
|
314
|
-
}
|
|
315
|
-
function _typeof(o) {
|
|
316
|
-
"@babel/helpers - typeof";
|
|
317
|
-
|
|
318
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
319
|
-
return typeof o;
|
|
320
|
-
} : function (o) {
|
|
321
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
322
|
-
}, _typeof(o);
|
|
323
|
-
}
|
|
324
|
-
function _unsupportedIterableToArray(r, a) {
|
|
325
|
-
if (r) {
|
|
326
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
327
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
328
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
exports.arrayLikeToArray = _arrayLikeToArray;
|
|
333
|
-
exports.arrayWithHoles = _arrayWithHoles;
|
|
334
|
-
exports.arrayWithoutHoles = _arrayWithoutHoles;
|
|
335
|
-
exports.asyncToGenerator = _asyncToGenerator;
|
|
336
|
-
exports.classCallCheck = _classCallCheck;
|
|
337
|
-
exports.createClass = _createClass;
|
|
338
|
-
exports.createForOfIteratorHelper = _createForOfIteratorHelper;
|
|
339
|
-
exports.defineProperty = _defineProperty;
|
|
340
|
-
exports.iterableToArray = _iterableToArray;
|
|
341
|
-
exports.iterableToArrayLimit = _iterableToArrayLimit;
|
|
342
|
-
exports.nonIterableRest = _nonIterableRest;
|
|
343
|
-
exports.nonIterableSpread = _nonIterableSpread;
|
|
344
|
-
exports.objectSpread2 = _objectSpread2;
|
|
345
|
-
exports.regenerator = _regenerator;
|
|
346
|
-
exports.regeneratorDefine = _regeneratorDefine;
|
|
347
|
-
exports.regeneratorValues = _regeneratorValues;
|
|
348
|
-
exports.slicedToArray = _slicedToArray;
|
|
349
|
-
exports.toConsumableArray = _toConsumableArray;
|
|
350
|
-
exports.toPrimitive = _toPrimitive;
|
|
351
|
-
exports.toPropertyKey = _toPropertyKey;
|
|
352
|
-
exports["typeof"] = _typeof;
|
|
353
|
-
exports.unsupportedIterableToArray = _unsupportedIterableToArray;
|
|
1
|
+
"use strict";function t(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=Array(r);n<r;n++)e[n]=t[n];return e}function r(t){if(Array.isArray(t))return t}function n(r){if(Array.isArray(r))return t(r)}function e(t,r,n,e,o,i,u){try{var f=t[i](u),c=f.value}catch(t){return void n(t)}f.done?r(c):Promise.resolve(c).then(e,o)}function o(t,r){for(var n=0;n<r.length;n++){var e=r[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,m(e.key),e)}}function i(t,r,n){return(r=m(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function u(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(u=function(){return!!t})()}function f(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function c(t,r){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var e,o,i,u,f=[],c=!0,a=!1;try{if(i=(n=n.call(t)).next,0===r){if(Object(n)!==n)return;c=!1}else for(;!(c=(e=i.call(n)).done)&&(f.push(e.value),f.length!==r);c=!0);}catch(t){a=!0,o=t}finally{try{if(!c&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(a)throw o}}return f}}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,e)}return n}function b(){var t,r,n="function"==typeof Symbol?Symbol:{},e=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,e,o,i){var c=e&&e.prototype instanceof f?e:f,a=Object.create(c.prototype);return y(a,"_invoke",function(n,e,o){var i,f,c,a=0,l=o||[],s=!1,b={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(r,n){return i=r,f=0,c=t,b.n=n,u}};function y(n,e){for(f=n,c=e,r=0;!s&&a&&!o&&r<l.length;r++){var o,i=l[r],y=b.p,p=i[2];n>3?(o=p===e)&&(c=i[(f=i[4])?5:(f=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(f=0,b.v=e,b.n=i[1]):y<p&&(o=n<3||i[0]>e||e>p)&&(i[4]=n,i[5]=e,b.n=p,f=0))}if(o||n>1)return u;throw s=!0,e}return function(o,l,p){if(a>1)throw TypeError("Generator is already running");for(s&&1===l&&y(l,p),f=l,c=p;(r=f<2?t:c)||!s;){i||(f?f<3?(f>1&&(b.n=-1),y(f,c)):b.n=c:b.v=c);try{if(a=2,i){if(f||(o="next"),r=i[o]){if(!(r=r.call(i,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,f<2&&(f=0)}else 1===f&&(r=i.return)&&r.call(i),f<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),f=1);i=t}else if((r=(s=b.n<0)?c:n.call(e,b))!==u)break}catch(r){i=t,f=1,c=r}finally{a=1}}return{value:r,done:s}}}(n,o,i),!0),a}var u={};function f(){}function c(){}function a(){}r=Object.getPrototypeOf;var l=[][e]?r(r([][e]())):(y(r={},e,function(){return this}),r),s=a.prototype=f.prototype=Object.create(l);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,y(t,o,"GeneratorFunction")),t.prototype=Object.create(s),t}return c.prototype=a,y(s,"constructor",a),y(a,"constructor",c),c.displayName="GeneratorFunction",y(a,o,"GeneratorFunction"),y(s),y(s,o,"Generator"),y(s,e,function(){return this}),y(s,"toString",function(){return"[object Generator]"}),(b=function(){return{w:i,m:p}})()}function y(t,r,n,e){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}y=function(t,r,n,e){if(r)o?o(t,r,{value:n,enumerable:!e,configurable:!e,writable:!e}):t[r]=n;else{function i(r,n){y(t,r,function(t){return this.t(r,n,t)})}i("next",0),i("throw",1),i("return",2)}},y(t,r,n,e)}function p(t,r){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},p(t,r)}function v(t,r){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var e=n.call(t,r||"default");if("object"!=typeof e)return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function m(t){var r=v(t,"string");return"symbol"==typeof r?r:r+""}function d(r,n){if(r){if("string"==typeof r)return t(r,n);var e={}.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?t(r,n):void 0}}Object.defineProperty(exports,"o",{value:!0}),exports.arrayLikeToArray=t,exports.arrayWithHoles=r,exports.arrayWithoutHoles=n,exports.asyncToGenerator=function(t){return function(){var r=this,n=arguments;return new Promise(function(o,i){var u=t.apply(r,n);function f(t){e(u,o,i,f,c,"next",t)}function c(t){e(u,o,i,f,c,"throw",t)}f(void 0)})}},exports.classCallCheck=function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")},exports.construct=function(t,r,n){if(u())return Reflect.construct.apply(null,arguments);var e=[null];e.push.apply(e,r);var o=new(t.bind.apply(t,e));return n&&p(o,n.prototype),o},exports.createClass=function(t,r,n){return r&&o(t.prototype,r),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t},exports.createForOfIteratorHelper=function(t,r){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=d(t))||r&&t&&"number"==typeof t.length){n&&(t=n);var e=0,o=function(){};return{s:o,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,f=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return u=t.done,t},e:function(t){f=!0,i=t},f:function(){try{u||null==n.return||n.return()}finally{if(f)throw i}}}},exports.defineProperty=i,exports.isNativeReflectConstruct=u,exports.iterableToArray=f,exports.iterableToArrayLimit=c,exports.nonIterableRest=a,exports.nonIterableSpread=l,exports.objectSpread2=function(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?s(Object(n),!0).forEach(function(r){i(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t},exports.regenerator=b,exports.regeneratorDefine=y,exports.regeneratorValues=function(t){if(null!=t){var r=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(typeof t+" is not iterable")},exports.setPrototypeOf=p,exports.slicedToArray=function(t,n){return r(t)||c(t,n)||d(t,n)||a()},exports.toConsumableArray=function(t){return n(t)||f(t)||d(t)||l()},exports.toPrimitive=v,exports.toPropertyKey=m,exports.unsupportedIterableToArray=d;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"t",{value:!0});class t{constructor(t=0,s=0,i=0){this.x=t,this.y=s,this.z=i}clone(){return new t(this.x,this.y,this.z)}toArray(){return[this.x,this.y,this.z]}normalize(){const t=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return t>0&&(this.x/=t,this.y/=t,this.z/=t),this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}}class s{constructor(t){this.scene=t}getRoot(){return this.scene.object}getWorldPosition(s){if(!s.userData?.worldBoundingBox)return new t;const{min:i,max:n}=s.userData.worldBoundingBox;return new t((i[0]+n[0])/2,(i[1]+n[1])/2,(i[2]+n[2])/2)}getBoundingBox(s){if(!s.userData?.worldBoundingBox)return null;const{min:i,max:n}=s.userData.worldBoundingBox;return{min:new t(i[0],i[1],i[2]),max:new t(n[0],n[1],n[2])}}findObjectByUUID(t){return this.i(this.getRoot(),t)}i(t,s){if(t.uuid===s)return t;if(t.children)for(const i of t.children){const t=this.i(i,s);if(t)return t}return null}findParentObject(t){return t.userData&&Array.isArray(t.userData.direction)?{isDirectionParent:!0}:this.o(this.getRoot(),t)}o(t,s){if(t.children){for(const i of t.children)if(i.uuid===s.uuid)return"Scene"===t.type?null:t;for(const i of t.children){const t=this.o(i,s);if(t)return t}}return null}isVoxelOccupiedByMesh(s,i){const[n,e,r]=s.split(",").map(Number),o=new t(n*i,e*i,r*i);return this.h(this.getRoot(),o)}h(t,s){if("Mesh"===t.type){const i=this.getBoundingBox(t);if(i&&s.x>=i.min.x&&s.x<=i.max.x&&s.y>=i.min.y&&s.y<=i.max.y&&s.z>=i.min.z&&s.z<=i.max.z)return!0}if(t.children)for(const i of t.children)if(this.h(i,s))return!0;return!1}}class i{constructor(t=.5,s=0){this.gridSize=t,this.safetyMargin=s}voxelKey(t){return[Math.round(t.x/this.gridSize),Math.round(t.y/this.gridSize),Math.round(t.z/this.gridSize)].join(",")}voxelToVec3(s){const[i,n,e]=s.split(",").map(Number);return new t(i*this.gridSize,n*this.gridSize,e*this.gridSize)}getNeighbors(t){const[s,i,n]=t.split(",").map(Number);return[[s+1,i,n],[s-1,i,n],[s,i+1,n],[s,i-1,n],[s,i,n+1],[s,i,n-1]].map(t=>t.join(","))}manhattan(t,s){const[i,n,e]=t.split(",").map(Number),[r,o,h]=s.split(",").map(Number);return Math.abs(i-r)+Math.abs(n-o)+Math.abs(e-h)}worldToVoxelDistance(t){return Math.ceil(t/this.gridSize)}voxelToWorldDistance(t){return t*this.gridSize}getSafetyMarginVoxels(){return this.worldToVoxelDistance(this.safetyMargin)}isVoxelInSafetyMargin(t,s){const i=this.voxelToVec3(t),n=this.safetyMargin;return i.x>=s.min.x-n&&i.x<=s.max.x+n&&i.y>=s.min.y-n&&i.y<=s.max.y+n&&i.z>=s.min.z-n&&i.z<=s.max.z+n}getVoxelsInBoundingBox(t){const s=this.getSafetyMarginVoxels(),i=t.min,n=t.max,e=[];for(let t=Math.round(i.x/this.gridSize)-s;t<=Math.round(n.x/this.gridSize)+s;t++)for(let r=Math.round(i.y/this.gridSize)-s;r<=Math.round(n.y/this.gridSize)+s;r++)for(let o=Math.round(i.z/this.gridSize)-s;o<=Math.round(n.z/this.gridSize)+s;o++)e.push(`${t},${r},${o}`);return e}}class n{constructor(t,s,i,n){this.config=t,this.MIN_SEGMENT_LENGTH=s,this.sceneManager=i,this.gridSystem=n}isConnector(t){return!!this.config.connections&&this.config.connections.some(s=>s.from===t.uuid||s.to===t.uuid)}getConnectorDirection(s){if(s.userData&&Array.isArray(s.userData.direction)){const[i,n,e]=s.userData.direction;return new t(i,n,e)}if(!s.parent)return null;const i=this.sceneManager.getWorldPosition(s);let n;const e=this.sceneManager.getBoundingBox(s.parent);n=e?new t((e.min.x+e.max.x)/2,(e.min.y+e.max.y)/2,(e.min.z+e.max.z)/2):this.sceneManager.getWorldPosition(s.parent);const r=new t(i.x-n.x,i.y-n.y,i.z-n.z).normalize(),o=Math.abs(r.x),h=Math.abs(r.y),c=Math.abs(r.z);return o>=h&&o>=c?(r.y=0,r.z=0,r.x=Math.sign(r.x)):h>=o&&h>=c?(r.x=0,r.z=0,r.y=Math.sign(r.y)):(r.x=0,r.y=0,r.z=Math.sign(r.z)),r}createVirtualSegment(s,i){const n=this.getConnectorDirection(s);if(!n)return null;const e=new t(i.x+n.x*this.MIN_SEGMENT_LENGTH,i.y+n.y*this.MIN_SEGMENT_LENGTH,i.z+n.z*this.MIN_SEGMENT_LENGTH);return{startPos:i,endPos:e,direction:n,startKey:this.gridSystem.voxelKey(i),endKey:this.gridSystem.voxelKey(e)}}processConnectors(t,s,i,n){this.u(t,s,i,n)}u(t,s,i,n){if("Mesh"===t.type){if(t.uuid===i||t.uuid===n)return;const e=this.sceneManager.getWorldPosition(t),r=this.createVirtualSegment(t,e);r&&this.l(r,e,s)}if(t.children)for(const e of t.children)this.u(e,s,i,n)}l(t,s,i){const n=t.direction,e=this.gridSystem.worldToVoxelDistance(this.MIN_SEGMENT_LENGTH+2*this.gridSystem.safetyMargin);for(let t=0;t<=e;t++){const e=`${Math.round(s.x/this.gridSystem.gridSize+n.x*t)},${Math.round(s.y/this.gridSystem.gridSize+n.y*t)},${Math.round(s.z/this.gridSystem.gridSize+n.z*t)}`;i.add(e)}}clusterConnections(s){const i=new Map,n=new Map;let e=0;s.forEach(t=>{const{from:s,to:r}=t;if(i.has(s)||i.has(r)){if(i.has(s)&&!i.has(r)){const t=i.get(s);i.set(r,t),n.get(t).add(r)}else if(!i.has(s)&&i.has(r)){const t=i.get(r);i.set(s,t),n.get(t).add(s)}else if(i.has(s)&&i.has(r)){const t=i.get(s),e=i.get(r);if(t!==e){n.get(e).forEach(s=>{i.set(s,t),n.get(t).add(s)}),n.delete(e)}}}else{const t=e++;i.set(s,t),i.set(r,t),n.set(t,new Set([s,r]))}});const r=Array.from(n.entries()).map(([t,s])=>({clusterId:t,objects:Array.from(s)})).filter(t=>!t.objects.some(t=>t.includes("GATEWAY")));return r.forEach(s=>{s.objectPoints=s.objects.map(s=>{const i=this.sceneManager.findObjectByUUID(s);if(i&&i.userData.worldBoundingBox){return{uuid:s,point:this.sceneManager.getWorldPosition(i),direction:i.userData.direction?new t(...i.userData.direction):null}}return null}).filter(t=>null!==t),s.displacedPoints=s.objectPoints.map(t=>{const s=t.direction?t.point.clone().add(t.direction.multiplyScalar(.5)):t.point.clone();return{uuid:t.uuid,originalPoint:t.point,displacedPoint:s,direction:t.direction}})}),r}}class e{constructor(t,s,i,n,e){this.sceneManager=t,this.gridSystem=s,this.connectorManager=i,this.MIN_SEGMENT_LENGTH=n,this.ASTAR_TIMEOUT=e}astar(t,s,i){const n=new Set([t]),e={},r={[t]:0},o={[t]:this.gridSystem.manhattan(t,s)},h=Date.now();for(;n.size>0;){if(Date.now()-h>this.ASTAR_TIMEOUT)return null;let t=null,c=1/0;for(const s of n)o[s]<c&&(c=o[s],t=s);if(t===s){const s=[t];for(;e[t];)t=e[t],s.unshift(t);return s}n.delete(t);for(const h of this.gridSystem.getNeighbors(t)){if(i.has(h))continue;const c=r[t]+1;c<(r[h]??1/0)&&(e[h]=t,r[h]=c,o[h]=c+this.gridSystem.manhattan(h,s),n.add(h))}}return null}findPathWithVirtualSegments(t,s,i,n,e){let r=t,o=s;const h=new Set(i);if(n){r=n.endKey;const t=n.startPos,s=n.direction,i=this.gridSystem.worldToVoxelDistance(this.MIN_SEGMENT_LENGTH);for(let n=0;n<i;n++){const i=`${Math.round(t.x/this.gridSystem.gridSize+s.x*n)},${Math.round(t.y/this.gridSystem.gridSize+s.y*n)},${Math.round(t.z/this.gridSystem.gridSize+s.z*n)}`;h.add(i)}}if(e){o=e.endKey;const t=e.startPos,s=e.direction,i=this.gridSystem.worldToVoxelDistance(this.MIN_SEGMENT_LENGTH);for(let n=0;n<i;n++){const i=`${Math.round(t.x/this.gridSystem.gridSize+s.x*n)},${Math.round(t.y/this.gridSystem.gridSize+s.y*n)},${Math.round(t.z/this.gridSystem.gridSize+s.z*n)}`;h.add(i)}}const c=this.astar(r,o,h);if(!c)return null;let u=[];return n&&u.push(n.startKey),u=u.concat(c),e&&u.push(e.startKey),u}markAllMeshesAsOccupiedVoxels(t){const s=new Set,i=new Map,n=t=>{if("Mesh"!==t.type)return;const e=this.sceneManager.getBoundingBox(t);if(!e)return;const r=this.gridSystem.getVoxelsInBoundingBox(e),o=new Set(r);for(const t of r)s.add(t);if(i.set(t.uuid,o),t.children)for(const s of t.children)n(s)};if(t.children)for(const s of t.children)n(s);return{occupied:s,occupiedByUUID:i}}processConnection(t,s,i){const n=this.sceneManager.findObjectByUUID(t.from),e=this.sceneManager.findObjectByUUID(t.to);if(!n||!e)return null;if("Mesh"!==n.type||"Mesh"!==e.type)return null;n.parent=this.sceneManager.findParentObject(n),e.parent=this.sceneManager.findParentObject(e);const r=this.sceneManager.getWorldPosition(n),o=this.sceneManager.getWorldPosition(e),h=this.connectorManager.createVirtualSegment(n,r),c=this.connectorManager.createVirtualSegment(e,o),u=new Set(s),f=Array.from(u).map(t=>this.gridSystem.voxelToVec3(t)),a=this.sceneManager.getBoundingBox(n),l=this.sceneManager.getBoundingBox(e);if(!a||!l)return null;if(!h){const t=this.gridSystem.getVoxelsInBoundingBox(a);for(const s of t)u.delete(s)}if(!c){const t=this.gridSystem.getVoxelsInBoundingBox(l);for(const s of t)u.delete(s)}if(h){const t=h.direction,s=this.gridSystem.worldToVoxelDistance(this.MIN_SEGMENT_LENGTH+2*this.gridSystem.safetyMargin);for(let i=0;i<=s;i++){const s=Math.round(r.x/this.gridSystem.gridSize+t.x*i),n=Math.round(r.y/this.gridSystem.gridSize+t.y*i),e=Math.round(r.z/this.gridSystem.gridSize+t.z*i);u.delete(`${s},${n},${e}`)}}if(c){const t=c.direction,s=this.gridSystem.worldToVoxelDistance(this.MIN_SEGMENT_LENGTH+2*this.gridSystem.safetyMargin);for(let i=0;i<=s;i++){const s=Math.round(o.x/this.gridSystem.gridSize+t.x*i),n=Math.round(o.y/this.gridSystem.gridSize+t.y*i),e=Math.round(o.z/this.gridSystem.gridSize+t.z*i);u.delete(`${s},${n},${e}`)}}this.connectorManager.processConnectors(this.sceneManager.getRoot(),u,n.uuid,e.uuid);const M=Array.from(u).map(t=>this.gridSystem.voxelToVec3(t)),d=this.gridSystem.voxelKey(r),w=this.gridSystem.voxelKey(o),S=this.findPathWithVirtualSegments(d,w,u,h,c),m=Array.from(u).map(t=>this.gridSystem.voxelToVec3(t));if(S){const n=S.map(t=>this.gridSystem.voxelToVec3(t)),e=new Set;for(const t of n){const i=this.gridSystem.voxelKey(t);s.add(i),e.add(i)}const r=`path_${t.from}_${t.to}`;return i.set(r,e),{from:t.from,to:t.to,path:n,occupied:m,debug:{initial:f,afterSegments:M},occupiedByUUID:i}}return{from:t.from,to:t.to,path:null,start:r,end:o,occupied:m,debug:{initial:f,afterSegments:M},occupiedByUUID:i}}findPaths(t){if(!this.sceneManager.getRoot())return[];const{occupied:s,occupiedByUUID:i}=this.markAllMeshesAsOccupiedVoxels(this.sceneManager.getRoot()),n=[];for(const e of t){const t=this.processConnection(e,s,i);t&&n.push(t)}return n}}class r{constructor(){}distance(t,s){const i=s.x-t.x,n=s.y-t.y,e=s.z-t.z;return Math.sqrt(i*i+n*n+e*e)}findMST(t){const s=t.length,i=[],n=new Set;for(n.add(0);n.size<s;){let e=1/0,r=null;for(const i of n)for(let o=0;o<s;o++)if(!n.has(o)){const s=this.distance(t[i],t[o]);s<e&&(e=s,r=[i,o])}if(!r)break;i.push(r),n.add(r[1])}return i}findSteinerPoint(s){if(s.length<=2)return null;const i=this.findMST(s);if(0===i.length)return null;let n=null,e=1/0;if(i.forEach(([t,i])=>{const r=this.distance(s[t],s[i]);r<e&&(e=r,n=[s[t],s[i]])}),!n)return null;const r=new t(.5*(n[0].x+n[1].x),.5*(n[0].y+n[1].y),.5*(n[0].z+n[1].z)),o=t=>Math.round(2*t)/2;return r.x=o(r.x),r.y=o(r.y),r.z=o(r.z),r}}exports.Pathfinder=class{constructor(t={}){this.config=t;const s=t.grid||{};this.gridSystem=new i(s.size??.5,s.safetyMargin??0),this.MIN_SEGMENT_LENGTH=s.minSegmentLength??.5,this.ASTAR_TIMEOUT=s.timeout??1e3,this.connectorManager=new n({grid:s},this.MIN_SEGMENT_LENGTH,null,this.gridSystem),this.pathManager=new e(null,this.gridSystem,this.connectorManager,this.MIN_SEGMENT_LENGTH,this.ASTAR_TIMEOUT),this.steinerTreeManager=new r}findPaths(t,i){const n=new s(t);this.connectorManager.sceneManager=n,this.pathManager.sceneManager=n;const e=this.connectorManager.clusterConnections(i),r=e.filter(t=>t.objects.length>2);r.forEach((t,s)=>{const i=t.displacedPoints.map(t=>t.displacedPoint);t.mst=this.steinerTreeManager.findMST(i),t.steinerPoint=this.steinerTreeManager.findSteinerPoint(i)});let o=1;const h=new Map;r.forEach(t=>{if(t.steinerPoint){const s=o++;h.set(t.clusterId,s)}}),r.forEach(s=>{if(s.steinerPoint){const i={uuid:`GATEWAY-${h.get(s.clusterId)}`,type:"Mesh",userData:{worldBoundingBox:{min:[s.steinerPoint.x-.25,s.steinerPoint.y-.25,s.steinerPoint.z-.25],max:[s.steinerPoint.x+.25,s.steinerPoint.y+.25,s.steinerPoint.z+.25]}}};t.object.children.push(i)}});const c=[],u=new Set;i.filter(t=>{const s=e.find(s=>s.objects.includes(t.from)),i=e.find(s=>s.objects.includes(t.to));return!s||!i||s.objects.length<=2||i.objects.length<=2}).forEach(t=>{u.has(JSON.stringify(t))||(c.push(t),u.add(JSON.stringify(t)))});const f=[];i.forEach(t=>{const s=e.find(s=>s.objects.includes(t.from))?.clusterId,i=e.find(s=>s.objects.includes(t.to))?.clusterId;if(void 0!==s&&void 0!==i){const n=`GATEWAY-${h.get(s)}`,e=`GATEWAY-${h.get(i)}`;if(n&&e)if(s===i){const s={from:t.from,to:n},i={from:n,to:t.to};u.has(JSON.stringify(s))||(f.push(s),u.add(JSON.stringify(s))),u.has(JSON.stringify(i))||(f.push(i),u.add(JSON.stringify(i)))}else{const s={from:t.from,to:n},i={from:n,to:e},r={from:e,to:t.to};u.has(JSON.stringify(s))||(f.push(s),u.add(JSON.stringify(s))),u.has(JSON.stringify(i))||(f.push(i),u.add(JSON.stringify(i))),u.has(JSON.stringify(r))||(f.push(r),u.add(JSON.stringify(r)))}}}),f.sort((t,s)=>{const i=n.findObjectByUUID(t.from),e=n.findObjectByUUID(t.to),r=n.findObjectByUUID(s.from),o=n.findObjectByUUID(s.to);if(!(i&&e&&r&&o))return 0;return this.steinerTreeManager.distance(n.getWorldPosition(i),n.getWorldPosition(e))-this.steinerTreeManager.distance(n.getWorldPosition(r),n.getWorldPosition(o))}),c.push(...f);return{paths:this.pathManager.findPaths(c||[]),rewiredConnections:c,gateways:Array.from(h.entries()).map(([t,s])=>({clusterId:t,id:s,position:e.find(s=>s.clusterId===t)?.steinerPoint}))}}};
|