@2112-lab/central-plant 0.1.0 → 0.1.2

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.
Files changed (43) hide show
  1. package/dist/bundle/index.js +7782 -6543
  2. package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js +23 -10
  3. package/dist/cjs/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1448 -0
  4. package/dist/cjs/src/animationManager.js +15 -15
  5. package/dist/cjs/src/componentManager.js +8 -8
  6. package/dist/cjs/src/disposalManager.js +12 -12
  7. package/dist/cjs/src/environmentManager.js +392 -99
  8. package/dist/cjs/src/hotReloadManager.js +26 -26
  9. package/dist/cjs/src/index.js +19 -66
  10. package/dist/cjs/src/keyboardControlsManager.js +23 -23
  11. package/dist/cjs/src/nameUtils.js +21 -21
  12. package/dist/cjs/src/pathfindingManager.js +311 -129
  13. package/dist/cjs/src/performanceMonitor.js +52 -52
  14. package/dist/cjs/src/sceneExportManager.js +23 -23
  15. package/dist/cjs/src/sceneInitializationManager.js +18 -18
  16. package/dist/cjs/src/textureConfig.js +469 -40
  17. package/dist/cjs/src/transformControlsManager.js +79 -79
  18. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +21 -10
  19. package/dist/esm/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1444 -0
  20. package/dist/esm/src/animationManager.js +15 -15
  21. package/dist/esm/src/componentManager.js +8 -8
  22. package/dist/esm/src/disposalManager.js +12 -12
  23. package/dist/esm/src/environmentManager.js +393 -100
  24. package/dist/esm/src/hotReloadManager.js +26 -26
  25. package/dist/esm/src/index.js +19 -66
  26. package/dist/esm/src/keyboardControlsManager.js +23 -23
  27. package/dist/esm/src/nameUtils.js +21 -21
  28. package/dist/esm/src/pathfindingManager.js +313 -129
  29. package/dist/esm/src/performanceMonitor.js +52 -52
  30. package/dist/esm/src/sceneExportManager.js +23 -23
  31. package/dist/esm/src/sceneInitializationManager.js +18 -18
  32. package/dist/esm/src/textureConfig.js +469 -42
  33. package/dist/esm/src/transformControlsManager.js +79 -79
  34. package/dist/index.d.ts +255 -259
  35. package/package.json +52 -53
  36. package/dist/cjs/src/ConnectionManager.js +0 -114
  37. package/dist/cjs/src/Pathfinder.js +0 -88
  38. package/dist/cjs/src/modelPreloader.js +0 -360
  39. package/dist/cjs/src/sceneOperationsManager.js +0 -560
  40. package/dist/esm/src/ConnectionManager.js +0 -110
  41. package/dist/esm/src/Pathfinder.js +0 -84
  42. package/dist/esm/src/modelPreloader.js +0 -337
  43. package/dist/esm/src/sceneOperationsManager.js +0 -536
@@ -4,8 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.js');
6
6
  var THREE = require('three');
7
- var Pathfinder = require('./Pathfinder.js');
7
+ var index_esm = require('../node_modules/@2112-lab/pathfinder/dist/index.esm.js');
8
8
  var debugLogger = require('./debugLogger.js');
9
+ var nameUtils = require('./nameUtils.js');
9
10
 
10
11
  function _interopNamespace(e) {
11
12
  if (e && e.__esModule) return e;
@@ -31,15 +32,13 @@ var PathfindingManager = /*#__PURE__*/function () {
31
32
  function PathfindingManager(component) {
32
33
  _rollupPluginBabelHelpers.classCallCheck(this, PathfindingManager);
33
34
  this.component = component;
35
+ this.pathfinder = null;
34
36
  this.crosscubeTextureSet = null;
35
37
  this.pathfinderVersionInfo = null;
36
-
37
- // Initialize pathfinder
38
- this.pathfinder = new Pathfinder["default"](component === null || component === void 0 ? void 0 : component.sceneData);
39
38
  }
40
39
 
41
- /**
42
- * Get pathfinder version information
40
+ /**
41
+ * Get pathfinder version information
43
42
  */
44
43
  return _rollupPluginBabelHelpers.createClass(PathfindingManager, [{
45
44
  key: "getPathfinderVersionInfo",
@@ -70,8 +69,8 @@ var PathfindingManager = /*#__PURE__*/function () {
70
69
  }
71
70
  return getPathfinderVersionInfo;
72
71
  }()
73
- /**
74
- * Log pathfinder version information
72
+ /**
73
+ * Log pathfinder version information
75
74
  */
76
75
  )
77
76
  }, {
@@ -114,8 +113,8 @@ var PathfindingManager = /*#__PURE__*/function () {
114
113
  }
115
114
  return logPathfinderVersion;
116
115
  }()
117
- /**
118
- * Get path colors for visual distinction
116
+ /**
117
+ * Get path colors for visual distinction
119
118
  */
120
119
  )
121
120
  }, {
@@ -125,8 +124,8 @@ var PathfindingManager = /*#__PURE__*/function () {
125
124
  return colors[index % colors.length];
126
125
  }
127
126
 
128
- /**
129
- * Initialize pathfinder and create paths
127
+ /**
128
+ * Initialize pathfinder and create paths
130
129
  */
131
130
  }, {
132
131
  key: "initializePathfinder",
@@ -137,41 +136,27 @@ var PathfindingManager = /*#__PURE__*/function () {
137
136
  return _rollupPluginBabelHelpers.regenerator().w(function (_context3) {
138
137
  while (1) switch (_context3.n) {
139
138
  case 0:
140
- if (Pathfinder["default"]) {
141
- _context3.n = 1;
142
- break;
143
- }
144
- _context3.n = 1;
145
- return importPathfinder();
146
- case 1:
147
139
  component = this.component;
148
140
  this.crosscubeTextureSet = crosscubeTextureSet;
149
141
 
150
142
  // Log pathfinder version information
151
- _context3.n = 2;
143
+ _context3.n = 1;
152
144
  return this.logPathfinderVersion('Scene Loading');
153
- case 2:
154
- this.pathfinder = new Pathfinder["default"](data);
155
- if (component) component.pathfinder = this.pathfinder;
145
+ case 1:
146
+ this.pathfinder = new index_esm.Pathfinder(data);
147
+ component.pathfinder = this.pathfinder;
156
148
 
157
149
  // Add debugging for pathfinder input
158
150
  console.log('🔍 PATHFINDER DEBUGGING:');
159
151
  console.log('🔗 Connections:', data.connections);
160
152
  console.log('🏗️ Scene structure:', JSON.parse(JSON.stringify((_data$scene = data.scene) === null || _data$scene === void 0 ? void 0 : _data$scene.object)));
161
-
162
- // Ensure connections exist before finding paths
163
- if (!(!data.connections || !Array.isArray(data.connections))) {
164
- _context3.n = 3;
165
- break;
166
- }
167
- console.warn('⚠️ No connections found in scene data, skipping path finding');
168
- return _context3.a(2, []);
169
- case 3:
170
153
  paths = this.pathfinder.findPaths();
171
154
  console.log('Found paths:', paths);
172
155
 
173
156
  // Create pipe paths with materials
174
- return _context3.a(2, this.createPipePaths(paths, crosscubeTextureSet));
157
+ this.createPipePaths(paths, crosscubeTextureSet);
158
+ case 2:
159
+ return _context3.a(2);
175
160
  }
176
161
  }, _callee3, this);
177
162
  }));
@@ -180,142 +165,339 @@ var PathfindingManager = /*#__PURE__*/function () {
180
165
  }
181
166
  return initializePathfinder;
182
167
  }()
183
- /**
184
- * Remove all existing paths from the scene
168
+ /**
169
+ /**
170
+ * Remove all existing paths from the scene
185
171
  */
186
172
  )
187
173
  }, {
188
174
  key: "removeAllPaths",
189
175
  value: function removeAllPaths() {
190
176
  var component = this.component;
191
- if (!component || !component.scene) {
192
- return;
193
- }
194
177
  console.log("removeAllPaths started");
195
178
  var objectsToRemove = [];
196
-
197
- // Find all path objects in the scene
198
- component.scene.traverse(function (child) {
199
- if (child.userData && child.userData.isPathObject) {
200
- objectsToRemove.push(child);
179
+ component.scene.traverse(function (obj) {
180
+ // Check the name property instead of uuid, as UUIDs are auto-generated
181
+ if (obj.name && obj.name.includes("Polyline")) {
182
+ console.log("removeAllPaths ".concat(obj.name, " (uuid: ").concat(obj.uuid, ") found"));
183
+ objectsToRemove.push(obj);
201
184
  }
202
185
  });
203
-
204
- // Remove all found path objects
205
- objectsToRemove.forEach(function (object) {
206
- object.parent.remove(object);
207
-
208
- // Dispose of geometries and materials
209
- if (object.geometry) {
210
- object.geometry.dispose();
211
- }
212
- if (object.material) {
213
- if (Array.isArray(object.material)) {
214
- object.material.forEach(function (material) {
215
- return material.dispose();
186
+ for (var _i = 0, _objectsToRemove = objectsToRemove; _i < _objectsToRemove.length; _i++) {
187
+ var obj = _objectsToRemove[_i];
188
+ component.scene.remove(obj);
189
+ if (obj.geometry) obj.geometry.dispose();
190
+ if (obj.material) {
191
+ if (Array.isArray(obj.material)) {
192
+ obj.material.forEach(function (mat) {
193
+ return mat.dispose();
216
194
  });
217
195
  } else {
218
- object.material.dispose();
196
+ obj.material.dispose();
219
197
  }
220
198
  }
221
- });
222
- console.log("Removed ".concat(objectsToRemove.length, " path objects"));
199
+ }
200
+ console.log("\u2705 Removed ".concat(objectsToRemove.length, " polyline objects from scene"));
223
201
  }
224
202
 
225
- /**
226
- * Material factory function to reduce duplication
203
+ /**
204
+ * Material factory function to reduce duplication
227
205
  */
228
206
  }, {
229
207
  key: "createPipeMaterial",
230
208
  value: function createPipeMaterial(crosscubeTextureSet, pathIndex) {
231
- var color = this.getPathColor(pathIndex);
232
- var material = new THREE__namespace.MeshStandardMaterial({
233
- color: new THREE__namespace.Color(color),
234
- roughness: 0.3,
235
- metalness: 0.8,
236
- envMap: crosscubeTextureSet ? crosscubeTextureSet.envMap : null
237
- });
238
- return material;
209
+ if (crosscubeTextureSet) {
210
+ var materialProps = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, crosscubeTextureSet.config.materialProps), {}, {
211
+ color: this.getPathColor(pathIndex),
212
+ map: crosscubeTextureSet.textures.diffuse,
213
+ normalMap: crosscubeTextureSet.textures.normal,
214
+ roughnessMap: crosscubeTextureSet.textures.roughness,
215
+ metalness: 0.2,
216
+ roughness: 0.9,
217
+ clearcoat: 0.2,
218
+ clearcoatRoughness: 0.2,
219
+ envMapIntensity: 0.6,
220
+ reflectivity: 0.4
221
+ });
222
+
223
+ // Handle normalScale conversion to Vector2
224
+ if (materialProps.normalScale && Array.isArray(materialProps.normalScale)) {
225
+ materialProps.normalScale = _rollupPluginBabelHelpers.construct(THREE__namespace.Vector2, _rollupPluginBabelHelpers.toConsumableArray(materialProps.normalScale));
226
+ }
227
+ var material = new THREE__namespace.MeshPhysicalMaterial(materialProps);
228
+
229
+ // Configure texture wrapping and repeat
230
+ var pipeTextures = [material.map, material.normalMap, material.roughnessMap].filter(Boolean);
231
+ pipeTextures.forEach(function (texture) {
232
+ texture.wrapS = texture.wrapT = THREE__namespace.RepeatWrapping;
233
+ texture.repeat.set(crosscubeTextureSet.config.repeat.x * 2, crosscubeTextureSet.config.repeat.y * 2);
234
+ });
235
+ return material;
236
+ } else {
237
+ return new THREE__namespace.MeshPhysicalMaterial({
238
+ color: this.getPathColor(pathIndex),
239
+ metalness: 0.9,
240
+ roughness: 0.7,
241
+ clearcoat: 0.1,
242
+ clearcoatRoughness: 0.3,
243
+ envMapIntensity: 1.5,
244
+ reflectivity: 0.3
245
+ });
246
+ }
239
247
  }
240
248
 
241
- /**
242
- * Helper function to create pipe paths
249
+ /**
250
+ * Helper function to create pipe paths
243
251
  */
244
252
  }, {
245
253
  key: "createPipePaths",
246
254
  value: function createPipePaths(paths, crosscubeTextureSet) {
247
255
  var _this = this;
248
256
  var component = this.component;
249
- if (!component || !component.scene) {
250
- console.warn('Cannot create pipe paths: component or scene not available');
251
- return [];
252
- }
257
+ paths.forEach(function (pathData, index) {
258
+ if (pathData.path) {
259
+ var polyline = new THREE__namespace.Object3D();
260
+ polyline.name = "Polyline ".concat(pathData.from, "-").concat(pathData.to);
261
+ var pipeRadius = 0.1;
262
+ var pipeMaterial = _this.createPipeMaterial(crosscubeTextureSet, index);
263
+ for (var j = 0; j < pathData.path.length - 1; j++) {
264
+ var start = pathData.path[j];
265
+ var end = pathData.path[j + 1];
266
+ var direction = new THREE__namespace.Vector3().subVectors(end, start);
267
+ var length = direction.length();
268
+ var cylinderGeometry = new THREE__namespace.CylinderGeometry(pipeRadius, pipeRadius, length, 8, 1, false);
269
+ var cylinder = new THREE__namespace.Mesh(cylinderGeometry, pipeMaterial);
270
+ cylinder.position.copy(start).add(end).multiplyScalar(0.5);
271
+ var quaternion = new THREE__namespace.Quaternion();
272
+ var up = new THREE__namespace.Vector3(0, 1, 0);
273
+ quaternion.setFromUnitVectors(up, direction.normalize());
274
+ cylinder.quaternion.copy(quaternion);
275
+ cylinder.castShadow = true;
276
+ cylinder.receiveShadow = true;
277
+ polyline.add(cylinder);
253
278
 
254
- // Remove existing paths before creating new ones
255
- this.removeAllPaths();
256
- var pipeObjects = [];
257
- paths.forEach(function (path, pathIndex) {
258
- if (!path || !path.points || path.points.length < 2) {
259
- console.warn('Invalid path data, skipping:', path);
260
- return;
279
+ // Add junction spheres at 90-degree turns
280
+ if (j < pathData.path.length - 2) {
281
+ var nextStart = pathData.path[j + 1];
282
+ var nextEnd = pathData.path[j + 2];
283
+ var currentDir = direction.normalize();
284
+ var nextDir = new THREE__namespace.Vector3().subVectors(nextEnd, nextStart).normalize();
285
+ var angle = Math.acos(currentDir.dot(nextDir));
286
+ if (Math.abs(angle - Math.PI / 2) < 0.1) {
287
+ var sphereGeometry = new THREE__namespace.SphereGeometry(pipeRadius, 16, 16);
288
+ var sphere = new THREE__namespace.Mesh(sphereGeometry, pipeMaterial);
289
+ sphere.position.copy(end);
290
+ sphere.castShadow = true;
291
+ sphere.receiveShadow = true;
292
+ polyline.add(sphere);
293
+ }
294
+ }
295
+ }
296
+ polyline.name = "Polyline";
297
+ component.scene.add(polyline);
261
298
  }
262
- try {
263
- var material = _this.createPipeMaterial(crosscubeTextureSet, pathIndex);
299
+ });
300
+ }
301
+
302
+ /**
303
+ * Recompute world bounding boxes after transforms
304
+ */
305
+ }, {
306
+ key: "recomputeWorldBoundingBoxes",
307
+ value: function recomputeWorldBoundingBoxes(currentSceneData) {
308
+ var component = this.component;
309
+ component.scene.traverse(function (object) {
310
+ if (object.isMesh) {
311
+ // Find the corresponding JSON object
312
+ var jsonObject = null;
313
+ var _findJsonObject = function findJsonObject(children) {
314
+ var _iterator = _rollupPluginBabelHelpers.createForOfIteratorHelper(children),
315
+ _step;
316
+ try {
317
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
318
+ var _object$userData, _child$userData;
319
+ var child = _step.value;
320
+ // Enhanced matching logic with hardcoded UUID priority
264
321
 
265
- // Create a path from the points
266
- var points = path.points.map(function (point) {
267
- return new THREE__namespace.Vector3(point.x, point.y, point.z);
268
- });
269
- var curve = new THREE__namespace.CatmullRomCurve3(points);
322
+ // Strategy 1: Direct hardcoded UUID match (HIGHEST PRIORITY)
323
+ if (child.uuid === object.uuid || child.uuid === ((_object$userData = object.userData) === null || _object$userData === void 0 ? void 0 : _object$userData.originalUuid) || object.uuid === ((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.originalUuid)) {
324
+ return child;
325
+ }
270
326
 
271
- // Create the pipe geometry
272
- var pipeRadius = 0.15;
273
- var radialSegments = 8;
274
- var tubularSegments = points.length * 3;
275
- var geometry = new THREE__namespace.TubeGeometry(curve, tubularSegments, pipeRadius, radialSegments, false);
327
+ // Strategy 2: Name-based UUID match (FALLBACK)
328
+ if (object.name && child.name) {
329
+ var objectGeneratedUuid = nameUtils.generateUuidFromName(object.name);
330
+ var childGeneratedUuid = nameUtils.generateUuidFromName(child.name);
331
+ if (objectGeneratedUuid === childGeneratedUuid || objectGeneratedUuid === child.uuid || childGeneratedUuid === object.uuid) {
332
+ return child;
333
+ }
334
+ }
276
335
 
277
- // Create the mesh
278
- var pipe = new THREE__namespace.Mesh(geometry, material);
336
+ // Strategy 3: Name match
337
+ if (object.name && child.name && object.name === child.name) {
338
+ return child;
339
+ }
279
340
 
280
- // Add metadata
281
- pipe.userData = {
282
- isPathObject: true,
283
- pathIndex: pathIndex,
284
- connectionId: path.connectionId,
285
- startComponentId: path.startComponentId,
286
- endComponentId: path.endComponentId
341
+ // Recursively search children
342
+ if (child.children) {
343
+ console.log("child children found in:", child);
344
+ var found = _findJsonObject(child.children);
345
+ if (found) return found;
346
+ }
347
+ }
348
+ } catch (err) {
349
+ _iterator.e(err);
350
+ } finally {
351
+ _iterator.f();
352
+ }
353
+ return null;
287
354
  };
355
+ jsonObject = _findJsonObject(currentSceneData.scene.object.children);
356
+ if (jsonObject) {
357
+ // Compute world bounding box
358
+ var boundingBox = new THREE__namespace.Box3().setFromObject(object);
288
359
 
289
- // Add to scene
290
- component.scene.add(pipe);
291
- pipeObjects.push(pipe);
292
- } catch (error) {
293
- console.error('Error creating pipe for path:', path, error);
360
+ // Store in JSON userData for pathfinder
361
+ if (!jsonObject.userData) jsonObject.userData = {};
362
+ jsonObject.userData.worldBoundingBox = {
363
+ min: boundingBox.min.toArray(),
364
+ max: boundingBox.max.toArray()
365
+ };
366
+ console.log("Added world bounding box for ".concat(jsonObject.name, ":"), jsonObject.userData.worldBoundingBox);
367
+ }
294
368
  }
295
369
  });
296
- return pipeObjects;
297
370
  }
298
- }]);
299
- }();
371
+ /**
372
+ * Update pathfinding with new connections data
373
+ */
374
+ }, {
375
+ key: "updatePathfindingWithConnections",
376
+ value: (function () {
377
+ var _updatePathfindingWithConnections = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee4(newConnections) {
378
+ var _component$currentSce, _component$currentSce2, _component$currentSce3, _updatedSceneData$sce;
379
+ var component, updatedSceneData, paths;
380
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context4) {
381
+ while (1) switch (_context4.n) {
382
+ case 0:
383
+ component = this.component; // Check if we have current scene data to work with
384
+ if (component.currentSceneData) {
385
+ _context4.n = 1;
386
+ break;
387
+ }
388
+ console.warn('⚠️ No current scene data available for pathfinder update');
389
+ return _context4.a(2, false);
390
+ case 1:
391
+ // Remove all existing paths from the scene
392
+ this.removeAllPaths();
393
+ console.log('🔄 Updating pathfinder with new connections:', newConnections);
394
+ console.log('🔍 Current scene data structure:', {
395
+ hasConnections: !!component.currentSceneData.connections,
396
+ connectionsCount: ((_component$currentSce = component.currentSceneData.connections) === null || _component$currentSce === void 0 ? void 0 : _component$currentSce.length) || 0,
397
+ hasScene: !!component.currentSceneData.scene,
398
+ hasSceneObject: !!((_component$currentSce2 = component.currentSceneData.scene) !== null && _component$currentSce2 !== void 0 && _component$currentSce2.object),
399
+ childrenCount: ((_component$currentSce3 = component.currentSceneData.scene) === null || _component$currentSce3 === void 0 || (_component$currentSce3 = _component$currentSce3.object) === null || _component$currentSce3 === void 0 || (_component$currentSce3 = _component$currentSce3.children) === null || _component$currentSce3 === void 0 ? void 0 : _component$currentSce3.length) || 0
400
+ });
300
401
 
301
- // Create a singleton instance
302
- var pathfindingManager = null;
402
+ // Create a deep copy of the current scene data to avoid mutations
403
+ updatedSceneData = JSON.parse(JSON.stringify(component.currentSceneData)); // Update the connections in the copied scene data
404
+ updatedSceneData.connections = _rollupPluginBabelHelpers.toConsumableArray(newConnections);
405
+ console.log('🔍 Updated scene data for pathfinder:', {
406
+ connectionsCount: updatedSceneData.connections.length,
407
+ connections: updatedSceneData.connections,
408
+ hasScene: !!updatedSceneData.scene,
409
+ childrenCount: ((_updatedSceneData$sce = updatedSceneData.scene) === null || _updatedSceneData$sce === void 0 || (_updatedSceneData$sce = _updatedSceneData$sce.object) === null || _updatedSceneData$sce === void 0 || (_updatedSceneData$sce = _updatedSceneData$sce.children) === null || _updatedSceneData$sce === void 0 ? void 0 : _updatedSceneData$sce.length) || 0
410
+ });
303
411
 
304
- /**
305
- * Get the global pathfinding manager instance
306
- */
307
- function getPathfindingManager() {
308
- var component = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
309
- if (!pathfindingManager || component && pathfindingManager.component !== component) {
310
- pathfindingManager = new PathfindingManager(component);
311
- }
312
- return pathfindingManager;
313
- }
314
- var pathfindingManager$1 = {
315
- PathfindingManager: PathfindingManager,
316
- getPathfindingManager: getPathfindingManager
317
- };
412
+ // Log pathfinder version for connection updates
413
+ _context4.n = 2;
414
+ return this.logPathfinderVersion('Connections Update');
415
+ case 2:
416
+ // Create new pathfinder instance with updated data
417
+ this.pathfinder = new index_esm.Pathfinder(updatedSceneData);
418
+ component.pathfinder = this.pathfinder;
419
+
420
+ // Find new paths with updated connections
421
+ paths = this.pathfinder.findPaths();
422
+ console.log('🔍 Found paths with updated connections:', {
423
+ pathCount: paths.length,
424
+ paths: paths.map(function (p) {
425
+ var _p$path;
426
+ return {
427
+ from: p.from,
428
+ to: p.to,
429
+ hasPath: !!p.path,
430
+ pathLength: ((_p$path = p.path) === null || _p$path === void 0 ? void 0 : _p$path.length) || 0
431
+ };
432
+ })
433
+ });
434
+
435
+ // Create pipe paths with materials
436
+ this.createPipePaths(paths, this.crosscubeTextureSet);
437
+
438
+ // Update the component's current scene data to reflect the changes
439
+ component.currentSceneData = updatedSceneData;
440
+ console.log('✅ Pathfinding updated successfully with new connections');
441
+ return _context4.a(2, true);
442
+ }
443
+ }, _callee4, this);
444
+ }));
445
+ function updatePathfindingWithConnections(_x3) {
446
+ return _updatePathfindingWithConnections.apply(this, arguments);
447
+ }
448
+ return updatePathfindingWithConnections;
449
+ }()
450
+ /**
451
+ * Update pathfinding after object transforms
452
+ */
453
+ )
454
+ }, {
455
+ key: "updatePathfindingAfterTransform",
456
+ value: (function () {
457
+ var _updatePathfindingAfterTransform = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee5(currentSceneData) {
458
+ var paths;
459
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context5) {
460
+ while (1) switch (_context5.n) {
461
+ case 0:
462
+ // Remove all existing paths from the scene
463
+ this.removeAllPaths();
464
+ console.log('🔄 Starting pathfinding with updated scene data...');
465
+
466
+ // Log pathfinder version for transform updates
467
+ _context5.n = 1;
468
+ return this.logPathfinderVersion('Transform Update');
469
+ case 1:
470
+ this.pathfinder = new index_esm.Pathfinder(currentSceneData);
471
+ this.component.pathfinder = this.pathfinder;
472
+ paths = this.pathfinder.findPaths();
473
+ console.log('Found paths:', paths);
474
+
475
+ // Create pipe paths with materials
476
+ this.createPipePaths(paths, this.crosscubeTextureSet);
477
+ case 2:
478
+ return _context5.a(2);
479
+ }
480
+ }, _callee5, this);
481
+ }));
482
+ function updatePathfindingAfterTransform(_x4) {
483
+ return _updatePathfindingAfterTransform.apply(this, arguments);
484
+ }
485
+ return updatePathfindingAfterTransform;
486
+ }()
487
+ /**
488
+ * Dispose of pathfinding resources
489
+ */
490
+ )
491
+ }, {
492
+ key: "dispose",
493
+ value: function dispose() {
494
+ this.removeAllPaths();
495
+ this.pathfinder = null;
496
+ this.crosscubeTextureSet = null;
497
+ this.pathfinderVersionInfo = null;
498
+ debugLogger.logger.info('PathfindingManager disposed');
499
+ }
500
+ }]);
501
+ }();
318
502
 
319
503
  exports.PathfindingManager = PathfindingManager;
320
- exports["default"] = pathfindingManager$1;
321
- exports.getPathfindingManager = getPathfindingManager;