@2112-lab/central-plant 0.3.45 → 0.3.47

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 (31) hide show
  1. package/dist/bundle/index.js +635 -337
  2. package/dist/cjs/src/core/centralPlant.js +342 -218
  3. package/dist/cjs/src/core/centralPlantInternals.js +2 -0
  4. package/dist/cjs/src/core/sceneViewer.js +0 -1
  5. package/dist/cjs/src/managers/behaviors/IoBehaviorManager.js +1 -2
  6. package/dist/cjs/src/managers/components/componentDataManager.js +0 -1
  7. package/dist/cjs/src/managers/controls/componentDragManager.js +4 -8
  8. package/dist/cjs/src/managers/pathfinding/pathfindingManager.js +55 -1
  9. package/dist/cjs/src/managers/scene/collisionManager.js +142 -0
  10. package/dist/cjs/src/managers/scene/componentTooltipManager.js +2 -3
  11. package/dist/cjs/src/managers/scene/sceneExportManager.js +32 -11
  12. package/dist/cjs/src/managers/scene/sceneOperationsManager.js +17 -33
  13. package/dist/cjs/src/utils/behaviorDispatch.js +11 -42
  14. package/dist/cjs/src/utils/boundingBoxUtils.js +54 -8
  15. package/dist/cjs/src/utils/ioDeviceUtils.js +3 -9
  16. package/dist/esm/src/core/centralPlant.js +342 -218
  17. package/dist/esm/src/core/centralPlantInternals.js +2 -0
  18. package/dist/esm/src/core/sceneViewer.js +0 -1
  19. package/dist/esm/src/managers/behaviors/IoBehaviorManager.js +1 -2
  20. package/dist/esm/src/managers/components/componentDataManager.js +0 -1
  21. package/dist/esm/src/managers/controls/componentDragManager.js +4 -8
  22. package/dist/esm/src/managers/pathfinding/pathfindingManager.js +56 -2
  23. package/dist/esm/src/managers/scene/collisionManager.js +118 -0
  24. package/dist/esm/src/managers/scene/componentTooltipManager.js +2 -3
  25. package/dist/esm/src/managers/scene/sceneExportManager.js +33 -12
  26. package/dist/esm/src/managers/scene/sceneOperationsManager.js +17 -33
  27. package/dist/esm/src/utils/behaviorDispatch.js +11 -42
  28. package/dist/esm/src/utils/boundingBoxUtils.js +55 -10
  29. package/dist/esm/src/utils/ioDeviceUtils.js +3 -9
  30. package/dist/index.d.ts +0 -6
  31. package/package.json +1 -1
@@ -1190,11 +1190,11 @@ function getIoBehaviorManager(sceneViewer) {
1190
1190
 
1191
1191
  /**
1192
1192
  * Resolve tooltip/drag data points for an I/O device attachment.
1193
- * Prefers behaviorConfig-driven animation data points; merges legacy ioConfig snapshot.
1193
+ * Prefers behaviorConfig-driven animation data points.
1194
1194
  *
1195
1195
  * @param {string} parentUuid
1196
1196
  * @param {string} attachmentId
1197
- * @param {Object} userData - io-device userData (may include dataPoints snapshot)
1197
+ * @param {Object} userData - io-device userData
1198
1198
  * @param {import('../managers/behaviors/IoBehaviorManager.js').IoBehaviorManager|null} ioBehaviorManager
1199
1199
  * @param {THREE.Object3D|null} [hitMesh]
1200
1200
  * @returns {Object[]}
@@ -1202,21 +1202,7 @@ function getIoBehaviorManager(sceneViewer) {
1202
1202
  function resolveDataPoints(parentUuid, attachmentId, userData, ioBehaviorManager) {
1203
1203
  var hitMesh = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
1204
1204
  var fromAnimations = (ioBehaviorManager === null || ioBehaviorManager === void 0 ? void 0 : ioBehaviorManager.getAnimationDataPoints(parentUuid, attachmentId, hitMesh)) || [];
1205
- if (fromAnimations.length) return fromAnimations;
1206
- var legacy = (userData === null || userData === void 0 ? void 0 : userData.dataPoints) || [];
1207
- return legacy.map(function (dp) {
1208
- var _dp$defaultValue;
1209
- return {
1210
- id: dp.id || dp.name,
1211
- name: dp.name || dp.id,
1212
- stateType: dp.stateType || 'binary',
1213
- stateConfig: dp.stateConfig || {},
1214
- defaultValue: (_dp$defaultValue = dp.defaultValue) !== null && _dp$defaultValue !== void 0 ? _dp$defaultValue : null,
1215
- direction: dp.direction || (userData === null || userData === void 0 ? void 0 : userData.ioDirection) || 'output'
1216
- };
1217
- }).filter(function (dp) {
1218
- return dp.id;
1219
- });
1205
+ return fromAnimations;
1220
1206
  }
1221
1207
 
1222
1208
  /**
@@ -1247,35 +1233,18 @@ function applyDefaultIoDeviceStates(centralPlant) {
1247
1233
  if (seen.has(scopedKey)) return;
1248
1234
  seen.add(scopedKey);
1249
1235
  var dps = ioBehavMgr.getAnimationDataPoints(objParentUuid, objAttachmentId) || [];
1250
- if (dps.length) {
1251
- var _iterator = _createForOfIteratorHelper(dps),
1252
- _step;
1253
- try {
1254
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
1255
- var dp = _step.value;
1256
- if (!(dp !== null && dp !== void 0 && dp.id) || dp.defaultValue === undefined || dp.defaultValue === null) continue;
1257
- centralPlant.setIoDeviceState(objAttachmentId, dp.id, dp.defaultValue, objParentUuid);
1258
- }
1259
- } catch (err) {
1260
- _iterator.e(err);
1261
- } finally {
1262
- _iterator.f();
1263
- }
1264
- return;
1265
- }
1266
- var _iterator2 = _createForOfIteratorHelper(obj.userData.dataPoints || []),
1267
- _step2;
1236
+ var _iterator = _createForOfIteratorHelper(dps),
1237
+ _step;
1268
1238
  try {
1269
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1270
- var _dp = _step2.value;
1271
- var dpId = _dp.id || _dp.name;
1272
- if (!dpId || _dp.defaultValue === undefined || _dp.defaultValue === null) continue;
1273
- centralPlant.setIoDeviceState(objAttachmentId, dpId, _dp.defaultValue, objParentUuid);
1239
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1240
+ var dp = _step.value;
1241
+ if (!(dp !== null && dp !== void 0 && dp.id) || dp.defaultValue === undefined || dp.defaultValue === null) continue;
1242
+ centralPlant.setIoDeviceState(objAttachmentId, dp.id, dp.defaultValue, objParentUuid);
1274
1243
  }
1275
1244
  } catch (err) {
1276
- _iterator2.e(err);
1245
+ _iterator.e(err);
1277
1246
  } finally {
1278
- _iterator2.f();
1247
+ _iterator.f();
1279
1248
  }
1280
1249
  });
1281
1250
  }
@@ -3783,6 +3752,51 @@ function computeIODeviceBoundingBoxes(componentObject) {
3783
3752
  return results;
3784
3753
  }
3785
3754
 
3755
+ /**
3756
+ * Computes individual world-space bounding boxes for each connector child
3757
+ * of a component.
3758
+ *
3759
+ * @param {THREE.Object3D} componentObject - The component's Three.js object
3760
+ * @returns {Array<{uuid: string, userData: Object, worldBoundingBox: {min: number[], max: number[]}}>}
3761
+ * Array of connector bounding box descriptors ready for injection into scene data
3762
+ */
3763
+ function computeConnectorBoundingBoxes(componentObject) {
3764
+ var results = [];
3765
+ var _iterator2 = _createForOfIteratorHelper(componentObject.children),
3766
+ _step2;
3767
+ try {
3768
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
3769
+ var _child$userData2;
3770
+ var child = _step2.value;
3771
+ if (((_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.objectType) !== 'connector') continue;
3772
+ var bbox = new THREE__namespace.Box3().setFromObject(child);
3773
+
3774
+ // Fallback if mesh is too small or empty (sometimes connectors are just points)
3775
+ if (bbox.isEmpty() || bbox.getSize(new THREE__namespace.Vector3()).length() < 0.01) {
3776
+ var worldPos = new THREE__namespace.Vector3();
3777
+ child.getWorldPosition(worldPos);
3778
+ var size = 0.1;
3779
+ bbox.setFromCenterAndSize(worldPos, new THREE__namespace.Vector3(size, size, size));
3780
+ }
3781
+ results.push({
3782
+ uuid: child.uuid,
3783
+ userData: _objectSpread2(_objectSpread2({}, child.userData), {}, {
3784
+ objectType: 'connector'
3785
+ }),
3786
+ worldBoundingBox: {
3787
+ min: [bbox.min.x, bbox.min.y, bbox.min.z],
3788
+ max: [bbox.max.x, bbox.max.y, bbox.max.z]
3789
+ }
3790
+ });
3791
+ }
3792
+ } catch (err) {
3793
+ _iterator2.e(err);
3794
+ } finally {
3795
+ _iterator2.f();
3796
+ }
3797
+ return results;
3798
+ }
3799
+
3786
3800
  /**
3787
3801
  * Creates bounding box helpers for a selected object. For smart components
3788
3802
  * (components with io-device children), this produces:
@@ -3841,8 +3855,8 @@ function createSelectionBoxHelpers(object) {
3841
3855
 
3842
3856
  // Check if this object has io-device children (smart component)
3843
3857
  var hasIODevices = (_object$children = object.children) === null || _object$children === void 0 ? void 0 : _object$children.some(function (child) {
3844
- var _child$userData2;
3845
- return ((_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.objectType) === 'io-device';
3858
+ var _child$userData3;
3859
+ return ((_child$userData3 = child.userData) === null || _child$userData3 === void 0 ? void 0 : _child$userData3.objectType) === 'io-device';
3846
3860
  });
3847
3861
  if (hasIODevices) {
3848
3862
  // 1. Create filtered helper for the component body
@@ -3879,11 +3893,11 @@ function createSelectionBoxHelpers(object) {
3879
3893
  * @param {THREE.Scene} scene - The scene (for finding objects by uuid)
3880
3894
  */
3881
3895
  function updateSelectionBoxHelpers(helpers, selectedObjects, scene) {
3882
- var _iterator2 = _createForOfIteratorHelper(helpers),
3883
- _step2;
3896
+ var _iterator3 = _createForOfIteratorHelper(helpers),
3897
+ _step3;
3884
3898
  try {
3885
3899
  var _loop = function _loop() {
3886
- var helper = _step2.value;
3900
+ var helper = _step3.value;
3887
3901
  var _helper$userData = helper.userData,
3888
3902
  sourceObjectUuid = _helper$userData.sourceObjectUuid,
3889
3903
  isFiltered = _helper$userData.isFiltered,
@@ -3914,13 +3928,13 @@ function updateSelectionBoxHelpers(helpers, selectedObjects, scene) {
3914
3928
  helper.update();
3915
3929
  }
3916
3930
  };
3917
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
3931
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
3918
3932
  if (_loop()) continue;
3919
3933
  }
3920
3934
  } catch (err) {
3921
- _iterator2.e(err);
3935
+ _iterator3.e(err);
3922
3936
  } finally {
3923
- _iterator2.f();
3937
+ _iterator3.f();
3924
3938
  }
3925
3939
  }
3926
3940
 
@@ -11931,6 +11945,8 @@ var SceneExportManager = /*#__PURE__*/function () {
11931
11945
  // Internal tracking - not needed in export
11932
11946
  'initialPosition',
11933
11947
  // Internal tracking - not needed in export
11948
+ 'attachedDevices',
11949
+ // Stored in smart component dictionary, not scene JSON
11934
11950
  // Exclude internal segment tracking properties
11935
11951
  'segmentId',
11936
11952
  // Internal tracking
@@ -12003,11 +12019,11 @@ var SceneExportManager = /*#__PURE__*/function () {
12003
12019
  };
12004
12020
  }
12005
12021
 
12006
- // For components: no children exported connector positions are defined in the component
12007
- // dictionary GLB and will be re-injected at import time via _injectConnectorChildrenFromDictionary.
12008
- // Exporting them here would prevent that injection (it skips if children already exist)
12009
- // and would leave the pathfinder with connectors in incompatible local-position format.
12022
+ // For components: only export child connectors if they were manually added/defined.
12023
+ // Most connectors are injected from dictionary at import time, but some (like manually placed ones)
12024
+ // need to be persisted to maintain connections in the exported scene.
12010
12025
  if (threeObject.children && threeObject.children.length > 0) {
12026
+ var _threeObject$userData11;
12011
12027
  var exportableChildren = [];
12012
12028
  if (isManualSegment) {
12013
12029
  // For manual segments, export their connector children
@@ -12021,6 +12037,25 @@ var SceneExportManager = /*#__PURE__*/function () {
12021
12037
  }
12022
12038
  }
12023
12039
  });
12040
+ } else if (((_threeObject$userData11 = threeObject.userData) === null || _threeObject$userData11 === void 0 ? void 0 : _threeObject$userData11.objectType) === 'component') {
12041
+ // For components, only export connectors that have objectType='connector'
12042
+ // Standard dictionary-injected connectors should be exported so connections work on re-import
12043
+ threeObject.children.forEach(function (child) {
12044
+ var _child$userData2;
12045
+ if (((_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.objectType) === 'connector') {
12046
+ exportableChildren.push({
12047
+ uuid: child.uuid,
12048
+ name: child.name,
12049
+ type: 'Mesh',
12050
+ position: {
12051
+ x: roundIfClose(child.position.x),
12052
+ y: roundIfClose(child.position.y),
12053
+ z: roundIfClose(child.position.z)
12054
+ },
12055
+ userData: _objectSpread2({}, child.userData)
12056
+ });
12057
+ }
12058
+ });
12024
12059
  }
12025
12060
  if (exportableChildren.length > 0) {
12026
12061
  jsonObject.children = exportableChildren;
@@ -12035,9 +12070,9 @@ var SceneExportManager = /*#__PURE__*/function () {
12035
12070
  // Extract main scene objects (components and standalone connectors)
12036
12071
  var sceneChildren = [];
12037
12072
  this.sceneViewer.scene.children.forEach(function (child) {
12038
- var _child$userData2;
12073
+ var _child$userData3;
12039
12074
  // Only export components and connectors; skip segments, gateways, polylines, etc.
12040
- var objectType = (_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.objectType;
12075
+ var objectType = (_child$userData3 = child.userData) === null || _child$userData3 === void 0 ? void 0 : _child$userData3.objectType;
12041
12076
  if (objectType !== 'component' && objectType !== 'connector') {
12042
12077
  return;
12043
12078
  }
@@ -12201,14 +12236,14 @@ var SceneExportManager = /*#__PURE__*/function () {
12201
12236
  BufferGeometryUtils$1 = BufferGeometryUtilsModule.BufferGeometryUtils || BufferGeometryUtilsModule.default || BufferGeometryUtilsModule; // Create a new scene for export instead of cloning
12202
12237
  exportScene = new _THREE.Scene(); // Helper function to check if an object should be exported
12203
12238
  shouldExport = function shouldExport(child) {
12204
- var _child$name, _child$userData3, _child$userData4, _child$userData5, _child$userData6;
12239
+ var _child$name, _child$userData4, _child$userData5, _child$userData6, _child$userData7;
12205
12240
  if ((_child$name = child.name) !== null && _child$name !== void 0 && _child$name.includes('Polyline')) return false; // Will handle separately
12206
12241
  if (child.name === 'fogPlane') return false; // Skip fog plane
12207
- if ((_child$userData3 = child.userData) !== null && _child$userData3 !== void 0 && _child$userData3.isBrickWall) return false; // Skip environment
12208
- if ((_child$userData4 = child.userData) !== null && _child$userData4 !== void 0 && _child$userData4.isBaseGround) return false; // Skip environment
12209
- if ((_child$userData5 = child.userData) !== null && _child$userData5 !== void 0 && _child$userData5.isBaseGrid) return false; // Skip environment
12242
+ if ((_child$userData4 = child.userData) !== null && _child$userData4 !== void 0 && _child$userData4.isBrickWall) return false; // Skip environment
12243
+ if ((_child$userData5 = child.userData) !== null && _child$userData5 !== void 0 && _child$userData5.isBaseGround) return false; // Skip environment
12244
+ if ((_child$userData6 = child.userData) !== null && _child$userData6 !== void 0 && _child$userData6.isBaseGrid) return false; // Skip environment
12210
12245
  if (child.isLight) return false; // Skip lights
12211
- if ((_child$userData6 = child.userData) !== null && _child$userData6 !== void 0 && _child$userData6.isTransformControls) return false; // Skip transform controls
12246
+ if ((_child$userData7 = child.userData) !== null && _child$userData7 !== void 0 && _child$userData7.isTransformControls) return false; // Skip transform controls
12212
12247
  if (child.isTransformControls) return false; // Skip transform controls
12213
12248
  if (child.type && child.type.includes('TransformControls')) return false;
12214
12249
  if (child.type && child.type.includes('Helper')) return false; // Skip helpers
@@ -21029,7 +21064,6 @@ var ComponentDataManager = /*#__PURE__*/function (_BaseDisposable) {
21029
21064
  };
21030
21065
  return _objectSpread2(_objectSpread2({}, baseData), {}, {
21031
21066
  metadata: component.metadata || {},
21032
- ioConfig: component.ioConfig || null,
21033
21067
  boundingBox: component.boundingBox || null,
21034
21068
  adaptedBoundingBox: component.adaptedBoundingBox || null,
21035
21069
  children: component.children || [],
@@ -29242,6 +29276,31 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
29242
29276
  }
29243
29277
  });
29244
29278
  }
29279
+
29280
+ // Also reinject connectors from cache
29281
+ if (_cached.connectorBBoxes && _cached.connectorBBoxes.length > 0) {
29282
+ if (!_enrichedChild.children) _enrichedChild.children = [];
29283
+ _cached.connectorBBoxes.forEach(function (connBBox) {
29284
+ var existingIndex = _enrichedChild.children.findIndex(function (c) {
29285
+ return c.uuid === connBBox.uuid;
29286
+ });
29287
+ if (existingIndex >= 0) {
29288
+ _enrichedChild.children[existingIndex] = _objectSpread2(_objectSpread2({}, _enrichedChild.children[existingIndex]), {}, {
29289
+ userData: _objectSpread2(_objectSpread2({}, _enrichedChild.children[existingIndex].userData), {}, {
29290
+ worldBoundingBox: connBBox.worldBoundingBox
29291
+ })
29292
+ });
29293
+ } else {
29294
+ _enrichedChild.children.push({
29295
+ uuid: connBBox.uuid,
29296
+ userData: _objectSpread2(_objectSpread2({}, connBBox.userData), {}, {
29297
+ worldBoundingBox: connBBox.worldBoundingBox
29298
+ }),
29299
+ children: []
29300
+ });
29301
+ }
29302
+ });
29303
+ }
29245
29304
  return _enrichedChild;
29246
29305
  }
29247
29306
 
@@ -29299,11 +29358,40 @@ var PathfindingManager = /*#__PURE__*/function (_BaseDisposable) {
29299
29358
  console.log("\uD83D\uDCE6 Injected ".concat(ioDeviceBBoxes.length, " io-device bounding box(es) for component ").concat(child.uuid));
29300
29359
  }
29301
29360
 
29361
+ // PHASE 2: Enrich Connectors (CRITICAL for pathfinding API)
29362
+ // Also compute world bounding boxes for connectors and inject into children.
29363
+ // This ensures endpoints have world coordinates in sceneDataCopy.
29364
+ var connectorBBoxes = computeConnectorBoundingBoxes(componentObject);
29365
+ if (connectorBBoxes.length > 0) {
29366
+ if (!enrichedChild.children) enrichedChild.children = [];
29367
+ connectorBBoxes.forEach(function (connBBox) {
29368
+ var existingIndex = enrichedChild.children.findIndex(function (c) {
29369
+ return c.uuid === connBBox.uuid;
29370
+ });
29371
+ if (existingIndex >= 0) {
29372
+ enrichedChild.children[existingIndex] = _objectSpread2(_objectSpread2({}, enrichedChild.children[existingIndex]), {}, {
29373
+ userData: _objectSpread2(_objectSpread2({}, enrichedChild.children[existingIndex].userData), {}, {
29374
+ worldBoundingBox: connBBox.worldBoundingBox
29375
+ })
29376
+ });
29377
+ } else {
29378
+ enrichedChild.children.push({
29379
+ uuid: connBBox.uuid,
29380
+ userData: _objectSpread2(_objectSpread2({}, connBBox.userData), {}, {
29381
+ worldBoundingBox: connBBox.worldBoundingBox
29382
+ }),
29383
+ children: []
29384
+ });
29385
+ }
29386
+ });
29387
+ }
29388
+
29302
29389
  // Store in cache
29303
29390
  _this3._bboxCache.set(child.uuid, {
29304
29391
  matrixHash: _hash,
29305
29392
  filteredBBox: _bboxData,
29306
- ioDeviceBBoxes: ioDeviceBBoxes
29393
+ ioDeviceBBoxes: ioDeviceBBoxes,
29394
+ connectorBBoxes: connectorBBoxes
29307
29395
  });
29308
29396
  return enrichedChild;
29309
29397
  } else {
@@ -30072,7 +30160,7 @@ function attachIODevicesToComponent(_x, _x2, _x3, _x4) {
30072
30160
  }
30073
30161
  function _attachIODevicesToComponent() {
30074
30162
  _attachIODevicesToComponent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(componentModel, componentData, modelPreloader, parentComponentId) {
30075
- var attachedDevices, _i, _Object$entries, _Object$entries$_i, attachmentId, attachment, _modelPreloader$compo, _deviceData$ioConfig, _deviceData$ioConfig2, _deviceData$ioConfig3, _attachment$attachmen, _attachment$attachmen2, deviceData, cachedDevice, _modelPreloader$loadi, deviceModel, pos, rot, deg2rad, _t, _t2;
30163
+ var attachedDevices, _i, _Object$entries, _Object$entries$_i, attachmentId, attachment, _modelPreloader$compo, _attachment$attachmen, _attachment$attachmen2, deviceData, cachedDevice, _modelPreloader$loadi, deviceModel, pos, rot, deg2rad, _t, _t2;
30076
30164
  return _regenerator().w(function (_context) {
30077
30165
  while (1) switch (_context.n) {
30078
30166
  case 0:
@@ -30150,20 +30238,14 @@ function _attachIODevicesToComponent() {
30150
30238
  // Name the device model
30151
30239
  deviceModel.name = "".concat(attachment.attachmentLabel || 'IO Device', " (").concat(attachmentId, ")");
30152
30240
 
30153
- // Set user data for identification — include ioConfig data points so the
30154
- // component tooltip can render state displays without an extra lookup.
30241
+ // Set user data for identification
30155
30242
  deviceModel.userData = {
30156
30243
  objectType: 'io-device',
30157
30244
  deviceId: attachment.deviceId,
30158
30245
  attachmentId: attachmentId,
30159
30246
  attachmentLabel: attachment.attachmentLabel,
30160
30247
  parentComponentId: parentComponentId,
30161
- deviceName: deviceData.name || '',
30162
- // Snapshot of the device's data point definitions (stateType, stateConfig, direction, etc.)
30163
- // ioConfig can use either 'states' (preferred) or legacy 'dataPoints' as the array key
30164
- dataPoints: ((_deviceData$ioConfig = deviceData.ioConfig) === null || _deviceData$ioConfig === void 0 ? void 0 : _deviceData$ioConfig.states) || ((_deviceData$ioConfig2 = deviceData.ioConfig) === null || _deviceData$ioConfig2 === void 0 ? void 0 : _deviceData$ioConfig2.dataPoints) || [],
30165
- // Device-level I/O direction: 'input' means the user can write state via the tooltip
30166
- ioDirection: ((_deviceData$ioConfig3 = deviceData.ioConfig) === null || _deviceData$ioConfig3 === void 0 ? void 0 : _deviceData$ioConfig3.direction) || 'output'
30248
+ deviceName: deviceData.name || ''
30167
30249
  };
30168
30250
 
30169
30251
  // Position at the attachment point
@@ -34115,51 +34197,36 @@ var SceneOperationsManager = /*#__PURE__*/function () {
34115
34197
  y: componentModel.scale.y,
34116
34198
  z: componentModel.scale.z
34117
34199
  },
34118
- userData: _objectSpread2(_objectSpread2({}, componentModel.userData), {}, {
34200
+ userData: _objectSpread2(_objectSpread2({}, function () {
34201
+ var ud = _objectSpread2({}, componentModel.userData);
34202
+ delete ud.attachedDevices; // Instance data belongs in dictionary, not scene JSON
34203
+ delete ud.isDeclared; // Runtime flag
34204
+ delete ud.originalUuid; // Runtime tracking
34205
+ return ud;
34206
+ }()), {}, {
34119
34207
  worldBoundingBox: {
34120
34208
  min: boundingBox.min.toArray(),
34121
34209
  max: boundingBox.max.toArray()
34122
34210
  }
34123
34211
  }),
34124
- children: []
34212
+ children: [] // Initialize children array
34125
34213
  };
34126
34214
 
34127
- // Process children (connectors, etc.) if they exist
34128
- if (componentModel.children && componentModel.children.length > 0) {
34215
+ // Collect children that are connectors
34216
+ if (componentModel.children) {
34129
34217
  componentModel.children.forEach(function (child) {
34130
- var _child$userData0, _child$userData1;
34131
- var childType = ((_child$userData0 = child.userData) === null || _child$userData0 === void 0 ? void 0 : _child$userData0.objectType) || ((_child$userData1 = child.userData) === null || _child$userData1 === void 0 ? void 0 : _child$userData1.objectType);
34132
- if (childType === 'connector') {
34133
- var _child$geometry;
34134
- var childBoundingBox = new THREE__namespace.Box3().setFromObject(child);
34135
- var childSceneData = {
34218
+ if (child.userData && child.userData.objectType === 'connector') {
34219
+ componentSceneData.children.push({
34136
34220
  uuid: child.uuid,
34137
34221
  name: child.name,
34138
- type: child.type,
34222
+ type: 'Mesh',
34139
34223
  position: {
34140
34224
  x: child.position.x,
34141
34225
  y: child.position.y,
34142
34226
  z: child.position.z
34143
34227
  },
34144
- rotation: {
34145
- x: THREE__namespace.MathUtils.radToDeg(child.rotation.x),
34146
- y: THREE__namespace.MathUtils.radToDeg(child.rotation.y),
34147
- z: THREE__namespace.MathUtils.radToDeg(child.rotation.z)
34148
- },
34149
- scale: {
34150
- x: child.scale.x,
34151
- y: child.scale.y,
34152
- z: child.scale.z
34153
- },
34154
- userData: _objectSpread2(_objectSpread2({}, child.userData), {}, {
34155
- worldBoundingBox: {
34156
- min: childBoundingBox.min.toArray(),
34157
- max: childBoundingBox.max.toArray()
34158
- }
34159
- }),
34160
- geometry: ((_child$geometry = child.geometry) === null || _child$geometry === void 0 ? void 0 : _child$geometry.uuid) || 'CONNECTOR-GEO'
34161
- };
34162
- componentSceneData.children.push(childSceneData);
34228
+ userData: _objectSpread2({}, child.userData)
34229
+ });
34163
34230
  }
34164
34231
  });
34165
34232
  }
@@ -34172,7 +34239,6 @@ var SceneOperationsManager = /*#__PURE__*/function () {
34172
34239
  console.log('✅ addComponentToSceneData: Component added to scene data successfully', {
34173
34240
  componentId: componentModel.uuid,
34174
34241
  libraryId: (_componentModel$userD = componentModel.userData) === null || _componentModel$userD === void 0 ? void 0 : _componentModel$userD.libraryId,
34175
- childrenCount: componentSceneData.children.length,
34176
34242
  totalSceneChildren: currentSceneData.scene.children.length
34177
34243
  });
34178
34244
  return true;
@@ -34213,8 +34279,8 @@ var SceneOperationsManager = /*#__PURE__*/function () {
34213
34279
  if (segment.children && segment.children.length > 0) {
34214
34280
  var childrenToRemove = _toConsumableArray(segment.children);
34215
34281
  childrenToRemove.forEach(function (child) {
34216
- var _child$userData10;
34217
- if ((_child$userData10 = child.userData) !== null && _child$userData10 !== void 0 && _child$userData10.isPipeElbow) {
34282
+ var _child$userData0;
34283
+ if ((_child$userData0 = child.userData) !== null && _child$userData0 !== void 0 && _child$userData0.isPipeElbow) {
34218
34284
  console.log("\uD83D\uDDD1\uFE0F Removing elbow child from segment before manualization: ".concat(child.uuid));
34219
34285
  segment.remove(child);
34220
34286
  if (child.geometry) child.geometry.dispose();
@@ -34534,6 +34600,120 @@ var SceneOperationsManager = /*#__PURE__*/function () {
34534
34600
  }]);
34535
34601
  }();
34536
34602
 
34603
+ var CollisionManager = /*#__PURE__*/function () {
34604
+ /**
34605
+ * @param {Object} sceneViewer - The scene viewer instance
34606
+ */
34607
+ function CollisionManager(sceneViewer) {
34608
+ _classCallCheck(this, CollisionManager);
34609
+ this.sceneViewer = sceneViewer;
34610
+ }
34611
+
34612
+ /**
34613
+ * Check if a given object overlaps with any other relevant objects in the scene.
34614
+ * @param {THREE.Object3D} object - The object to check for collisions
34615
+ * @param {Array<string>} excludeTypes - Object types to exclude from checking (e.g. ['ground'])
34616
+ * @returns {Object|null} Collision info {object, objectType} if collision detected, null otherwise
34617
+ */
34618
+ return _createClass(CollisionManager, [{
34619
+ key: "checkCollision",
34620
+ value: function checkCollision(object) {
34621
+ var _this$sceneViewer,
34622
+ _this = this;
34623
+ var excludeTypes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['isBaseGround', 'isBaseGrid', 'isBrickWall'];
34624
+ if (!((_this$sceneViewer = this.sceneViewer) !== null && _this$sceneViewer !== void 0 && _this$sceneViewer.scene) || !object) return null;
34625
+
34626
+ // Compute high-quality bounding box for the object being checked
34627
+ // We use setFromObject here because the target object just moved
34628
+ var objectBBox = new THREE__namespace.Box3().setFromObject(object);
34629
+
34630
+ // Narrow down potential colliders
34631
+ var collisionDetected = null;
34632
+
34633
+ // Optimization: Only check the root-level CP objects to avoid O(N^2) complexity with meshes
34634
+ this.sceneViewer.scene.traverse(function (child) {
34635
+ var _child$userData, _child$userData2, _child$userData3, _child$userData4, _child$userData5;
34636
+ if (collisionDetected) return; // Short circuit
34637
+
34638
+ // Skip the object itself and its descendants
34639
+ if (child === object || _this._isDescendantOf(object, child)) return;
34640
+
34641
+ // Filter by CP object types at the root level (skip internal meshes during traverse)
34642
+ var isCPRootObject = ((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.objectType) === 'component' || ((_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.objectType) === 'segment' || ((_child$userData3 = child.userData) === null || _child$userData3 === void 0 ? void 0 : _child$userData3.objectType) === 'gateway' || ((_child$userData4 = child.userData) === null || _child$userData4 === void 0 ? void 0 : _child$userData4.objectType) === 'connector' || ((_child$userData5 = child.userData) === null || _child$userData5 === void 0 ? void 0 : _child$userData5.objectType) === 'io-device';
34643
+ if (isCPRootObject && !_this._shouldExclude(child, excludeTypes)) {
34644
+ // Use cached worldBoundingBox if available, otherwise compute it (and cache it)
34645
+ var childBBox;
34646
+ if (child.userData.worldBoundingBox && !child.userData.isMoving) {
34647
+ var _min$x, _min$y, _min$z, _max$x, _max$y, _max$z;
34648
+ // Use stored worldBoundingBox (handles array or Box3 format)
34649
+ var min = child.userData.worldBoundingBox.min;
34650
+ var max = child.userData.worldBoundingBox.max;
34651
+ childBBox = new THREE__namespace.Box3(new THREE__namespace.Vector3((_min$x = min.x) !== null && _min$x !== void 0 ? _min$x : min[0], (_min$y = min.y) !== null && _min$y !== void 0 ? _min$y : min[1], (_min$z = min.z) !== null && _min$z !== void 0 ? _min$z : min[2]), new THREE__namespace.Vector3((_max$x = max.x) !== null && _max$x !== void 0 ? _max$x : max[0], (_max$y = max.y) !== null && _max$y !== void 0 ? _max$y : max[1], (_max$z = max.z) !== null && _max$z !== void 0 ? _max$z : max[2]));
34652
+ } else {
34653
+ // Fallback to high-quality computation for moving objects or first-time checks
34654
+ childBBox = new THREE__namespace.Box3().setFromObject(child);
34655
+
34656
+ // Cache the result for next time (non-moving objects)
34657
+ if (!child.userData.isMoving) {
34658
+ child.userData.worldBoundingBox = {
34659
+ min: [childBBox.min.x, childBBox.min.y, childBBox.min.z],
34660
+ max: [childBBox.max.x, childBBox.max.y, childBBox.max.z]
34661
+ };
34662
+ }
34663
+ }
34664
+ if (objectBBox.intersectsBox(childBBox)) {
34665
+ collisionDetected = {
34666
+ object: child,
34667
+ objectType: child.userData.objectType,
34668
+ uuid: child.uuid,
34669
+ name: child.name || child.userData.libraryId || child.uuid
34670
+ };
34671
+ }
34672
+ }
34673
+ });
34674
+ return collisionDetected;
34675
+ }
34676
+
34677
+ /**
34678
+ * Helper to check if a node is a descendant of a specific parent
34679
+ * @private
34680
+ */
34681
+ }, {
34682
+ key: "_isDescendantOf",
34683
+ value: function _isDescendantOf(parent, child) {
34684
+ var node = child.parent;
34685
+ while (node !== null) {
34686
+ if (node === parent) return true;
34687
+ node = node.parent;
34688
+ }
34689
+ return false;
34690
+ }
34691
+
34692
+ /**
34693
+ * Helper to determine if an object should be excluded from collision checking
34694
+ * @private
34695
+ */
34696
+ }, {
34697
+ key: "_shouldExclude",
34698
+ value: function _shouldExclude(object, excludeTypes) {
34699
+ if (object.userData.isPreview) return true;
34700
+ var _iterator = _createForOfIteratorHelper(excludeTypes),
34701
+ _step;
34702
+ try {
34703
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
34704
+ var type = _step.value;
34705
+ if (object.userData[type]) return true;
34706
+ }
34707
+ } catch (err) {
34708
+ _iterator.e(err);
34709
+ } finally {
34710
+ _iterator.f();
34711
+ }
34712
+ return false;
34713
+ }
34714
+ }]);
34715
+ }();
34716
+
34537
34717
  var AnimationManager = /*#__PURE__*/function (_BaseDisposable) {
34538
34718
  function AnimationManager(sceneViewer) {
34539
34719
  var _this;
@@ -35087,7 +35267,7 @@ var ComponentDragManager = /*#__PURE__*/function (_BaseDisposable) {
35087
35267
  key: "_attachIODeviceModelsToPreview",
35088
35268
  value: (function () {
35089
35269
  var _attachIODeviceModelsToPreview2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(parentObject, componentData, modelPreloader) {
35090
- var _i, _Object$entries, _Object$entries$_i, attachmentId, attachment, _modelPreloader$compo, _deviceData$ioConfig, _deviceData$ioConfig2, _deviceData$ioConfig3, _attachment$attachmen, _attachment$attachmen2, deviceData, cachedDevice, _modelPreloader$loadi, deviceModel, pos, rot, deg2rad, _t3;
35270
+ var _i, _Object$entries, _Object$entries$_i, attachmentId, attachment, _modelPreloader$compo, _attachment$attachmen, _attachment$attachmen2, deviceData, cachedDevice, _modelPreloader$loadi, deviceModel, pos, rot, deg2rad, _t3;
35091
35271
  return _regenerator().w(function (_context3) {
35092
35272
  while (1) switch (_context3.n) {
35093
35273
  case 0:
@@ -35150,12 +35330,7 @@ var ComponentDragManager = /*#__PURE__*/function (_BaseDisposable) {
35150
35330
  deviceId: attachment.deviceId,
35151
35331
  attachmentId: attachmentId,
35152
35332
  attachmentLabel: attachment.attachmentLabel,
35153
- deviceName: deviceData.name || '',
35154
- // Snapshot of data point definitions so the tooltip can render state
35155
- // ioConfig can use either 'states' (preferred) or legacy 'dataPoints' as the array key
35156
- dataPoints: ((_deviceData$ioConfig = deviceData.ioConfig) === null || _deviceData$ioConfig === void 0 ? void 0 : _deviceData$ioConfig.states) || ((_deviceData$ioConfig2 = deviceData.ioConfig) === null || _deviceData$ioConfig2 === void 0 ? void 0 : _deviceData$ioConfig2.dataPoints) || [],
35157
- // Device-level I/O direction: 'input' means the user can write state via the tooltip
35158
- ioDirection: ((_deviceData$ioConfig3 = deviceData.ioConfig) === null || _deviceData$ioConfig3 === void 0 ? void 0 : _deviceData$ioConfig3.direction) || 'output'
35333
+ deviceName: deviceData.name || ''
35159
35334
  };
35160
35335
  if ((_attachment$attachmen = attachment.attachmentPoint) !== null && _attachment$attachmen !== void 0 && _attachment$attachmen.position) {
35161
35336
  pos = attachment.attachmentPoint.position;
@@ -35409,6 +35584,7 @@ var ComponentDragManager = /*#__PURE__*/function (_BaseDisposable) {
35409
35584
  // Find intersection with ground plane
35410
35585
  var intersection = this.raycaster.ray.intersectPlane(this.dropPlane, this.dropIntersection);
35411
35586
  if (intersection) {
35587
+ var _this$sceneViewer$col;
35412
35588
  // Apply 0.5 unit transform snapping to intersection point
35413
35589
  var snappedPosition = this._applyTransformSnap(intersection);
35414
35590
  this.dragData.previewObject.position.copy(snappedPosition);
@@ -35416,7 +35592,7 @@ var ComponentDragManager = /*#__PURE__*/function (_BaseDisposable) {
35416
35592
 
35417
35593
  // Check for overlap and update color accordingly
35418
35594
  var wasOverlapping = this.dragData.isOverlapping;
35419
- this.dragData.isOverlapping = this._checkBoundingBoxOverlap();
35595
+ this.dragData.isOverlapping = !!((_this$sceneViewer$col = this.sceneViewer.collisionManager) !== null && _this$sceneViewer$col !== void 0 && _this$sceneViewer$col.checkCollision(this.dragData.previewObject));
35420
35596
 
35421
35597
  // Update color if overlap state changed
35422
35598
  if (wasOverlapping !== this.dragData.isOverlapping) {
@@ -37190,8 +37366,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
37190
37366
  if (((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.objectType) === 'io-device') {
37191
37367
  var attachmentId = child.userData.attachmentId || '';
37192
37368
 
37193
- // Use only data points from the animate window (behaviorConfig).
37194
- // The static ioConfig.states[] snapshot on userData is intentionally ignored.
37369
+ // Use data points from the animate window (behaviorConfig).
37195
37370
  var dataPoints = resolveDataPoints(parentUuid, attachmentId, child.userData, getIoBehaviorManager(_this3.sceneViewer));
37196
37371
 
37197
37372
  // When data points come from behaviorConfig they already carry direction:'input'.
@@ -37404,7 +37579,7 @@ var ComponentTooltipManager = /*#__PURE__*/function (_BaseDisposable) {
37404
37579
  * Input / bidirectional → shows an interactive control.
37405
37580
  *
37406
37581
  * @param {string} scopedAttachmentId - Scoped attachment ID (parentUuid::attachmentId) for state isolation
37407
- * @param {Object} dp - data point definition from ioConfig.dataPoints
37582
+ * @param {Object} dp - data point definition
37408
37583
  * @param {string} [deviceDirection] - device-level direction ('input'|'output'), overrides dp.direction
37409
37584
  * @param {string} [originalAttachmentId] - Original attachment ID for behavior triggering
37410
37585
  * @returns {HTMLElement}
@@ -38420,8 +38595,7 @@ var IoBehaviorManager = /*#__PURE__*/function (_BaseDisposable) {
38420
38595
  /**
38421
38596
  * Return tooltip-compatible data point definitions derived from the loaded
38422
38597
  * animation entries for a given attachment. Used by componentTooltipManager
38423
- * to replace the static ioConfig.states[] snapshot with the richer animation
38424
- * state definitions created in the Animate window.
38598
+ * to provide the richer animation state definitions created in the Animate window.
38425
38599
  *
38426
38600
  * One dp object is emitted per unique stateVariable; multiple mesh entries
38427
38601
  * that share the same stateVariable are collapsed into one.
@@ -39398,6 +39572,7 @@ var CentralPlantInternals = /*#__PURE__*/function () {
39398
39572
  this.centralPlant.managers.keyboardControlsManager = new KeyboardControlsManager(this.centralPlant.sceneViewer);
39399
39573
  this.centralPlant.managers.pathfindingManager = new PathfindingManager(this.centralPlant.sceneViewer);
39400
39574
  this.centralPlant.managers.pathFlowManager = new PathFlowManager(this.centralPlant.sceneViewer);
39575
+ this.centralPlant.managers.collisionManager = new CollisionManager(this.centralPlant.sceneViewer);
39401
39576
  this.centralPlant.managers.sceneOperationsManager = new SceneOperationsManager(this.centralPlant.sceneViewer);
39402
39577
  this.centralPlant.managers.animationManager = new AnimationManager(this.centralPlant.sceneViewer);
39403
39578
  this.centralPlant.managers.cameraControlsManager = new CameraControlsManager(this.centralPlant.sceneViewer);
@@ -40836,7 +41011,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
40836
41011
  * Initialize the CentralPlant manager
40837
41012
  *
40838
41013
  * @constructor
40839
- * @version 0.3.45
41014
+ * @version 0.3.47
40840
41015
  * @updated 2025-10-22
40841
41016
  *
40842
41017
  * @description Creates a new CentralPlant instance and initializes internal managers and utilities.
@@ -40974,6 +41149,32 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
40974
41149
  return this.internals.attachToComponent();
40975
41150
  }
40976
41151
 
41152
+ /**
41153
+ * Check if an object in the scene collides with any other objects
41154
+ * @param {string} objectId - The UUID or originalUuid of the object to check
41155
+ * @returns {Object|null} Collision info if detected, null otherwise
41156
+ */
41157
+ }, {
41158
+ key: "checkCollision",
41159
+ value: function checkCollision(objectId) {
41160
+ if (!this.sceneViewer || !this.managers.collisionManager) {
41161
+ console.warn('⚠️ checkCollision(): Scene viewer or collision manager not available');
41162
+ return null;
41163
+ }
41164
+ var targetObject = null;
41165
+ this.sceneViewer.scene.traverse(function (child) {
41166
+ var _child$userData;
41167
+ if (child.uuid === objectId || ((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.originalUuid) === objectId) {
41168
+ targetObject = child;
41169
+ }
41170
+ });
41171
+ if (!targetObject) {
41172
+ console.warn("\u26A0\uFE0F checkCollision(): Object with ID '".concat(objectId, "' not found"));
41173
+ return null;
41174
+ }
41175
+ return this.managers.collisionManager.checkCollision(targetObject);
41176
+ }
41177
+
40977
41178
  /**
40978
41179
  * Initialize specific managers that need to be created after scene setup
40979
41180
  * @returns {boolean} True if post-scene managers were initialized successfully, false otherwise
@@ -41654,6 +41855,104 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
41654
41855
  return this.internals.addConnection(fromConnectorId, toConnectorId);
41655
41856
  }
41656
41857
 
41858
+ /**
41859
+ * Randomly connect available component connectors in the scene.
41860
+ * Attempts to pair as many free connectors as possible.
41861
+ * @returns {Array<Object>} List of added connections.
41862
+ */
41863
+ }, {
41864
+ key: "addRandomConnections",
41865
+ value: (function () {
41866
+ var _addRandomConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
41867
+ var _this$sceneViewer4;
41868
+ var connectors, scene, currentConns, busyConnectorIds, freeConnectors, i, j, _ref, added, from, _i, to, isCompatible, isDifferentParent, conn;
41869
+ return _regenerator().w(function (_context3) {
41870
+ while (1) switch (_context3.n) {
41871
+ case 0:
41872
+ connectors = [];
41873
+ scene = (_this$sceneViewer4 = this.sceneViewer) === null || _this$sceneViewer4 === void 0 ? void 0 : _this$sceneViewer4.scene;
41874
+ if (scene) {
41875
+ _context3.n = 1;
41876
+ break;
41877
+ }
41878
+ return _context3.a(2, []);
41879
+ case 1:
41880
+ // Find all free connectors in the scene
41881
+ scene.traverse(function (obj) {
41882
+ var _obj$userData;
41883
+ if (((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.objectType) === 'connector' && obj.uuid) {
41884
+ connectors.push({
41885
+ uuid: obj.uuid,
41886
+ flow: obj.userData.flow || 'bi',
41887
+ parent: obj.parent
41888
+ });
41889
+ }
41890
+ });
41891
+
41892
+ // Get current connections to avoid double-connecting
41893
+ currentConns = this.getConnections();
41894
+ busyConnectorIds = new Set();
41895
+ currentConns.forEach(function (conn) {
41896
+ busyConnectorIds.add(conn.from);
41897
+ busyConnectorIds.add(conn.to);
41898
+ });
41899
+ freeConnectors = connectors.filter(function (c) {
41900
+ return !busyConnectorIds.has(c.uuid);
41901
+ }); // Shuffle free connectors
41902
+ for (i = freeConnectors.length - 1; i > 0; i--) {
41903
+ j = Math.floor(Math.random() * (i + 1));
41904
+ _ref = [freeConnectors[j], freeConnectors[i]];
41905
+ freeConnectors[i] = _ref[0];
41906
+ freeConnectors[j] = _ref[1];
41907
+ }
41908
+ added = []; // Greedy pairing
41909
+ case 2:
41910
+ if (!(freeConnectors.length >= 2)) {
41911
+ _context3.n = 6;
41912
+ break;
41913
+ }
41914
+ from = freeConnectors.pop();
41915
+ _i = 0;
41916
+ case 3:
41917
+ if (!(_i < freeConnectors.length)) {
41918
+ _context3.n = 5;
41919
+ break;
41920
+ }
41921
+ to = freeConnectors[_i]; // Basic flow compatibility check (CentralPlantInternals.addConnection does this too)
41922
+ isCompatible = from.flow === 'bi' || to.flow === 'bi' || from.flow !== to.flow;
41923
+ isDifferentParent = from.parent !== to.parent;
41924
+ if (!(isCompatible && isDifferentParent)) {
41925
+ _context3.n = 4;
41926
+ break;
41927
+ }
41928
+ conn = this.addConnection(from.uuid, to.uuid);
41929
+ if (!conn) {
41930
+ _context3.n = 4;
41931
+ break;
41932
+ }
41933
+ added.push(conn);
41934
+ freeConnectors.splice(_i, 1);
41935
+ return _context3.a(3, 5);
41936
+ case 4:
41937
+ _i++;
41938
+ _context3.n = 3;
41939
+ break;
41940
+ case 5:
41941
+ _context3.n = 2;
41942
+ break;
41943
+ case 6:
41944
+ if (added.length > 0) {
41945
+ this.updatePaths();
41946
+ }
41947
+ return _context3.a(2, added);
41948
+ }
41949
+ }, _callee3, this);
41950
+ }));
41951
+ function addRandomConnections() {
41952
+ return _addRandomConnections.apply(this, arguments);
41953
+ }
41954
+ return addRandomConnections;
41955
+ }()
41657
41956
  /**
41658
41957
  * Remove a connection between two component connectors
41659
41958
  * @param {string} fromConnectorId - The UUID of the source connector
@@ -41675,6 +41974,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
41675
41974
  * centralPlant.updatePaths();
41676
41975
  * }
41677
41976
  */
41977
+ )
41678
41978
  }, {
41679
41979
  key: "removeConnection",
41680
41980
  value: function removeConnection(fromConnectorId, toConnectorId) {
@@ -41879,8 +42179,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
41879
42179
  }, {
41880
42180
  key: "_dispatchIoState",
41881
42181
  value: function _dispatchIoState(attachmentId, stateId, value, parentUuid) {
41882
- var _this$managers, _this$sceneViewer4, _this$sceneViewer5, _this$managers2, _this$sceneViewer6, _this$sceneViewer7, _this$sceneViewer8;
41883
- var tooltipMgr = ((_this$managers = this.managers) === null || _this$managers === void 0 ? void 0 : _this$managers.componentTooltipManager) || ((_this$sceneViewer4 = this.sceneViewer) === null || _this$sceneViewer4 === void 0 ? void 0 : _this$sceneViewer4.componentTooltipManager) || ((_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 || (_this$sceneViewer5 = _this$sceneViewer5.managers) === null || _this$sceneViewer5 === void 0 ? void 0 : _this$sceneViewer5.componentTooltipManager);
42182
+ var _this$managers, _this$sceneViewer5, _this$sceneViewer6, _this$managers2, _this$sceneViewer7, _this$sceneViewer8, _this$sceneViewer9;
42183
+ var tooltipMgr = ((_this$managers = this.managers) === null || _this$managers === void 0 ? void 0 : _this$managers.componentTooltipManager) || ((_this$sceneViewer5 = this.sceneViewer) === null || _this$sceneViewer5 === void 0 ? void 0 : _this$sceneViewer5.componentTooltipManager) || ((_this$sceneViewer6 = this.sceneViewer) === null || _this$sceneViewer6 === void 0 || (_this$sceneViewer6 = _this$sceneViewer6.managers) === null || _this$sceneViewer6 === void 0 ? void 0 : _this$sceneViewer6.componentTooltipManager);
41884
42184
  var stateAdapter = tooltipMgr === null || tooltipMgr === void 0 ? void 0 : tooltipMgr._stateAdapter;
41885
42185
  if (stateAdapter !== null && stateAdapter !== void 0 && stateAdapter.setState) {
41886
42186
  var scopedKey = getScopedAttachmentKey(attachmentId, parentUuid);
@@ -41890,11 +42190,11 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
41890
42190
  console.warn('⚠️ _dispatchIoState(): stateAdapter.setState() threw:', err);
41891
42191
  }
41892
42192
  }
41893
- var ioBehavMgr = ((_this$managers2 = this.managers) === null || _this$managers2 === void 0 ? void 0 : _this$managers2.ioBehaviorManager) || ((_this$sceneViewer6 = this.sceneViewer) === null || _this$sceneViewer6 === void 0 || (_this$sceneViewer6 = _this$sceneViewer6.managers) === null || _this$sceneViewer6 === void 0 ? void 0 : _this$sceneViewer6.ioBehaviorManager) || ((_this$sceneViewer7 = this.sceneViewer) === null || _this$sceneViewer7 === void 0 ? void 0 : _this$sceneViewer7.ioBehaviorManager);
42193
+ var ioBehavMgr = ((_this$managers2 = this.managers) === null || _this$managers2 === void 0 ? void 0 : _this$managers2.ioBehaviorManager) || ((_this$sceneViewer7 = this.sceneViewer) === null || _this$sceneViewer7 === void 0 || (_this$sceneViewer7 = _this$sceneViewer7.managers) === null || _this$sceneViewer7 === void 0 ? void 0 : _this$sceneViewer7.ioBehaviorManager) || ((_this$sceneViewer8 = this.sceneViewer) === null || _this$sceneViewer8 === void 0 ? void 0 : _this$sceneViewer8.ioBehaviorManager);
41894
42194
  if (ioBehavMgr) {
41895
42195
  ioBehavMgr.triggerState(attachmentId, stateId, value, parentUuid);
41896
42196
  }
41897
- (_this$sceneViewer8 = this.sceneViewer) === null || _this$sceneViewer8 === void 0 || _this$sceneViewer8.emit('io-device-state-changed', {
42197
+ (_this$sceneViewer9 = this.sceneViewer) === null || _this$sceneViewer9 === void 0 || _this$sceneViewer9.emit('io-device-state-changed', {
41898
42198
  attachmentId: attachmentId,
41899
42199
  stateId: stateId,
41900
42200
  value: value,
@@ -41909,16 +42209,16 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
41909
42209
  }, {
41910
42210
  key: "configureStateAdapter",
41911
42211
  value: function configureStateAdapter(stateAdapter) {
41912
- var _this$managers3, _this$sceneViewer9, _this$managers4, _this$sceneViewer1, _this$sceneViewer10;
41913
- var tooltipMgr = ((_this$managers3 = this.managers) === null || _this$managers3 === void 0 ? void 0 : _this$managers3.componentTooltipManager) || ((_this$sceneViewer9 = this.sceneViewer) === null || _this$sceneViewer9 === void 0 ? void 0 : _this$sceneViewer9.componentTooltipManager);
42212
+ var _this$managers3, _this$sceneViewer0, _this$managers4, _this$sceneViewer10, _this$sceneViewer11;
42213
+ var tooltipMgr = ((_this$managers3 = this.managers) === null || _this$managers3 === void 0 ? void 0 : _this$managers3.componentTooltipManager) || ((_this$sceneViewer0 = this.sceneViewer) === null || _this$sceneViewer0 === void 0 ? void 0 : _this$sceneViewer0.componentTooltipManager);
41914
42214
  if (tooltipMgr !== null && tooltipMgr !== void 0 && tooltipMgr.configure) {
41915
- var _this$sceneViewer0;
42215
+ var _this$sceneViewer1;
41916
42216
  tooltipMgr.configure(stateAdapter);
41917
- if ((_this$sceneViewer0 = this.sceneViewer) !== null && _this$sceneViewer0 !== void 0 && _this$sceneViewer0.managers) {
42217
+ if ((_this$sceneViewer1 = this.sceneViewer) !== null && _this$sceneViewer1 !== void 0 && _this$sceneViewer1.managers) {
41918
42218
  this.sceneViewer.managers.componentTooltipManager = tooltipMgr;
41919
42219
  }
41920
42220
  }
41921
- var ioBehavMgr = ((_this$managers4 = this.managers) === null || _this$managers4 === void 0 ? void 0 : _this$managers4.ioBehaviorManager) || ((_this$sceneViewer1 = this.sceneViewer) === null || _this$sceneViewer1 === void 0 || (_this$sceneViewer1 = _this$sceneViewer1.managers) === null || _this$sceneViewer1 === void 0 ? void 0 : _this$sceneViewer1.ioBehaviorManager) || ((_this$sceneViewer10 = this.sceneViewer) === null || _this$sceneViewer10 === void 0 ? void 0 : _this$sceneViewer10.ioBehaviorManager);
42221
+ var ioBehavMgr = ((_this$managers4 = this.managers) === null || _this$managers4 === void 0 ? void 0 : _this$managers4.ioBehaviorManager) || ((_this$sceneViewer10 = this.sceneViewer) === null || _this$sceneViewer10 === void 0 || (_this$sceneViewer10 = _this$sceneViewer10.managers) === null || _this$sceneViewer10 === void 0 ? void 0 : _this$sceneViewer10.ioBehaviorManager) || ((_this$sceneViewer11 = this.sceneViewer) === null || _this$sceneViewer11 === void 0 ? void 0 : _this$sceneViewer11.ioBehaviorManager);
41922
42222
  if (ioBehavMgr !== null && ioBehavMgr !== void 0 && ioBehavMgr.configure) {
41923
42223
  ioBehavMgr.configure(stateAdapter);
41924
42224
  }
@@ -41953,13 +42253,13 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
41953
42253
  }, {
41954
42254
  key: "getSceneAttachments",
41955
42255
  value: function getSceneAttachments() {
41956
- var _this$sceneViewer11;
41957
- var scene = (_this$sceneViewer11 = this.sceneViewer) === null || _this$sceneViewer11 === void 0 ? void 0 : _this$sceneViewer11.scene;
42256
+ var _this$sceneViewer12;
42257
+ var scene = (_this$sceneViewer12 = this.sceneViewer) === null || _this$sceneViewer12 === void 0 ? void 0 : _this$sceneViewer12.scene;
41958
42258
  if (!scene) return [];
41959
42259
  var results = [];
41960
42260
  scene.traverse(function (obj) {
41961
- var _obj$userData;
41962
- if (((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.objectType) === 'io-device') {
42261
+ var _obj$userData2;
42262
+ if (((_obj$userData2 = obj.userData) === null || _obj$userData2 === void 0 ? void 0 : _obj$userData2.objectType) === 'io-device') {
41963
42263
  var _parent$userData;
41964
42264
  var attachmentId = obj.userData.attachmentId || obj.name || obj.uuid;
41965
42265
  var label = obj.userData.attachmentLabel || attachmentId;
@@ -42011,7 +42311,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42011
42311
  * List all available I/O Device assets from the component dictionary.
42012
42312
  * @param {Object} [options={}]
42013
42313
  * @param {'all'|'bundled'|'user'} [options.source='all'] - Filter by asset origin
42014
- * @returns {Array<{uuid: string, name: string, assetType: string, ioConfig: Object}>}
42314
+ * @returns {Array<{uuid: string, name: string, assetType: string}>}
42015
42315
  * @example
42016
42316
  * const devices = centralPlant.getIoDevices({ source: 'all' })
42017
42317
  * const bundledOnly = centralPlant.getIoDevices({ source: 'bundled' })
@@ -42019,9 +42319,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42019
42319
  }, {
42020
42320
  key: "getIoDevices",
42021
42321
  value: function getIoDevices() {
42022
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
42023
- _ref$source = _ref.source,
42024
- source = _ref$source === void 0 ? 'all' : _ref$source;
42322
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
42323
+ _ref2$source = _ref2.source,
42324
+ source = _ref2$source === void 0 ? 'all' : _ref2$source;
42025
42325
  var mp = this.getUtility('modelPreloader');
42026
42326
  var dict = mp === null || mp === void 0 ? void 0 : mp.componentDictionary;
42027
42327
  if (!dict) {
@@ -42038,8 +42338,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42038
42338
  return {
42039
42339
  uuid: entry.uuid || entry.id,
42040
42340
  name: entry.name,
42041
- assetType: entry.assetType,
42042
- ioConfig: entry.ioConfig || {}
42341
+ assetType: entry.assetType
42043
42342
  };
42044
42343
  });
42045
42344
  }
@@ -42057,8 +42356,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42057
42356
  }, {
42058
42357
  key: "getIoDeviceUsage",
42059
42358
  value: function getIoDeviceUsage() {
42060
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
42061
- deviceUuid = _ref2.deviceUuid;
42359
+ var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
42360
+ deviceUuid = _ref3.deviceUuid;
42062
42361
  if (!deviceUuid) {
42063
42362
  console.warn('⚠️ getIoDeviceUsage(): deviceUuid is required');
42064
42363
  return [];
@@ -42109,38 +42408,38 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42109
42408
  }, {
42110
42409
  key: "createSmartComponent",
42111
42410
  value: (function () {
42112
- var _createSmartComponent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
42113
- var _ref3,
42411
+ var _createSmartComponent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
42412
+ var _ref4,
42114
42413
  componentUuid,
42115
42414
  name,
42116
42415
  attachments,
42117
42416
  thumbnailBlob,
42118
42417
  newAsset,
42119
42418
  mp,
42120
- _args3 = arguments;
42121
- return _regenerator().w(function (_context3) {
42122
- while (1) switch (_context3.n) {
42419
+ _args4 = arguments;
42420
+ return _regenerator().w(function (_context4) {
42421
+ while (1) switch (_context4.n) {
42123
42422
  case 0:
42124
- _ref3 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, componentUuid = _ref3.componentUuid, name = _ref3.name, attachments = _ref3.attachments, thumbnailBlob = _ref3.thumbnailBlob;
42423
+ _ref4 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, componentUuid = _ref4.componentUuid, name = _ref4.name, attachments = _ref4.attachments, thumbnailBlob = _ref4.thumbnailBlob;
42125
42424
  if (this.assetService) {
42126
- _context3.n = 1;
42425
+ _context4.n = 1;
42127
42426
  break;
42128
42427
  }
42129
42428
  throw new Error('createSmartComponent(): no asset service set — call setAssetService() first');
42130
42429
  case 1:
42131
42430
  if (componentUuid) {
42132
- _context3.n = 2;
42431
+ _context4.n = 2;
42133
42432
  break;
42134
42433
  }
42135
42434
  throw new Error('createSmartComponent(): componentUuid is required');
42136
42435
  case 2:
42137
42436
  if (!(!Array.isArray(attachments) || attachments.length === 0)) {
42138
- _context3.n = 3;
42437
+ _context4.n = 3;
42139
42438
  break;
42140
42439
  }
42141
42440
  throw new Error('createSmartComponent(): at least one attachment is required');
42142
42441
  case 3:
42143
- _context3.n = 4;
42442
+ _context4.n = 4;
42144
42443
  return this.assetService.createSmartComponent({
42145
42444
  componentUuid: componentUuid,
42146
42445
  name: name,
@@ -42148,7 +42447,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42148
42447
  thumbnailBlob: thumbnailBlob
42149
42448
  });
42150
42449
  case 4:
42151
- newAsset = _context3.v;
42450
+ newAsset = _context4.v;
42152
42451
  // Register in model preloader dictionary so addComponent() can use it immediately
42153
42452
  mp = this.getUtility('modelPreloader');
42154
42453
  if (mp !== null && mp !== void 0 && mp.componentDictionary && newAsset !== null && newAsset !== void 0 && newAsset.uuid) {
@@ -42157,9 +42456,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42157
42456
  });
42158
42457
  console.log("\u2705 createSmartComponent(): registered \"".concat(newAsset.name, "\" in component dictionary"));
42159
42458
  }
42160
- return _context3.a(2, newAsset);
42459
+ return _context4.a(2, newAsset);
42161
42460
  }
42162
- }, _callee3, this);
42461
+ }, _callee4, this);
42163
42462
  }));
42164
42463
  function createSmartComponent() {
42165
42464
  return _createSmartComponent.apply(this, arguments);
@@ -42193,42 +42492,42 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42193
42492
  }, {
42194
42493
  key: "addComponentAttachment",
42195
42494
  value: (function () {
42196
- var _addComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
42197
- var _ref4,
42495
+ var _addComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
42496
+ var _ref5,
42198
42497
  componentUuid,
42199
42498
  attachment,
42200
42499
  updatedAsset,
42201
42500
  mp,
42202
- _args4 = arguments;
42203
- return _regenerator().w(function (_context4) {
42204
- while (1) switch (_context4.n) {
42501
+ _args5 = arguments;
42502
+ return _regenerator().w(function (_context5) {
42503
+ while (1) switch (_context5.n) {
42205
42504
  case 0:
42206
- _ref4 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, componentUuid = _ref4.componentUuid, attachment = _ref4.attachment;
42505
+ _ref5 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, componentUuid = _ref5.componentUuid, attachment = _ref5.attachment;
42207
42506
  if (this.assetService) {
42208
- _context4.n = 1;
42507
+ _context5.n = 1;
42209
42508
  break;
42210
42509
  }
42211
42510
  throw new Error('addComponentAttachment(): no asset service set — call setAssetService() first');
42212
42511
  case 1:
42213
42512
  if (componentUuid) {
42214
- _context4.n = 2;
42513
+ _context5.n = 2;
42215
42514
  break;
42216
42515
  }
42217
42516
  throw new Error('addComponentAttachment(): componentUuid is required');
42218
42517
  case 2:
42219
42518
  if (!(!(attachment !== null && attachment !== void 0 && attachment.attachmentId) || !(attachment !== null && attachment !== void 0 && attachment.deviceId))) {
42220
- _context4.n = 3;
42519
+ _context5.n = 3;
42221
42520
  break;
42222
42521
  }
42223
42522
  throw new Error('addComponentAttachment(): attachment must have attachmentId and deviceId');
42224
42523
  case 3:
42225
- _context4.n = 4;
42524
+ _context5.n = 4;
42226
42525
  return this.assetService.addComponentAttachment({
42227
42526
  componentUuid: componentUuid,
42228
42527
  attachment: attachment
42229
42528
  });
42230
42529
  case 4:
42231
- updatedAsset = _context4.v;
42530
+ updatedAsset = _context5.v;
42232
42531
  // Sync component dictionary
42233
42532
  mp = this.getUtility('modelPreloader');
42234
42533
  if (mp !== null && mp !== void 0 && mp.componentDictionary && updatedAsset !== null && updatedAsset !== void 0 && updatedAsset.uuid) {
@@ -42236,9 +42535,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42236
42535
  id: updatedAsset.uuid
42237
42536
  });
42238
42537
  }
42239
- return _context4.a(2, updatedAsset);
42538
+ return _context5.a(2, updatedAsset);
42240
42539
  }
42241
- }, _callee4, this);
42540
+ }, _callee5, this);
42242
42541
  }));
42243
42542
  function addComponentAttachment() {
42244
42543
  return _addComponentAttachment.apply(this, arguments);
@@ -42264,42 +42563,42 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42264
42563
  }, {
42265
42564
  key: "removeComponentAttachment",
42266
42565
  value: (function () {
42267
- var _removeComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
42268
- var _ref5,
42566
+ var _removeComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
42567
+ var _ref6,
42269
42568
  componentUuid,
42270
42569
  attachmentId,
42271
42570
  updatedAsset,
42272
42571
  mp,
42273
- _args5 = arguments;
42274
- return _regenerator().w(function (_context5) {
42275
- while (1) switch (_context5.n) {
42572
+ _args6 = arguments;
42573
+ return _regenerator().w(function (_context6) {
42574
+ while (1) switch (_context6.n) {
42276
42575
  case 0:
42277
- _ref5 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, componentUuid = _ref5.componentUuid, attachmentId = _ref5.attachmentId;
42576
+ _ref6 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, componentUuid = _ref6.componentUuid, attachmentId = _ref6.attachmentId;
42278
42577
  if (this.assetService) {
42279
- _context5.n = 1;
42578
+ _context6.n = 1;
42280
42579
  break;
42281
42580
  }
42282
42581
  throw new Error('removeComponentAttachment(): no asset service set — call setAssetService() first');
42283
42582
  case 1:
42284
42583
  if (componentUuid) {
42285
- _context5.n = 2;
42584
+ _context6.n = 2;
42286
42585
  break;
42287
42586
  }
42288
42587
  throw new Error('removeComponentAttachment(): componentUuid is required');
42289
42588
  case 2:
42290
42589
  if (attachmentId) {
42291
- _context5.n = 3;
42590
+ _context6.n = 3;
42292
42591
  break;
42293
42592
  }
42294
42593
  throw new Error('removeComponentAttachment(): attachmentId is required');
42295
42594
  case 3:
42296
- _context5.n = 4;
42595
+ _context6.n = 4;
42297
42596
  return this.assetService.removeComponentAttachment({
42298
42597
  componentUuid: componentUuid,
42299
42598
  attachmentId: attachmentId
42300
42599
  });
42301
42600
  case 4:
42302
- updatedAsset = _context5.v;
42601
+ updatedAsset = _context6.v;
42303
42602
  // Sync component dictionary
42304
42603
  mp = this.getUtility('modelPreloader');
42305
42604
  if (mp !== null && mp !== void 0 && mp.componentDictionary && updatedAsset !== null && updatedAsset !== void 0 && updatedAsset.uuid) {
@@ -42307,9 +42606,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42307
42606
  id: updatedAsset.uuid
42308
42607
  });
42309
42608
  }
42310
- return _context5.a(2, updatedAsset);
42609
+ return _context6.a(2, updatedAsset);
42311
42610
  }
42312
- }, _callee5, this);
42611
+ }, _callee6, this);
42313
42612
  }));
42314
42613
  function removeComponentAttachment() {
42315
42614
  return _removeComponentAttachment.apply(this, arguments);
@@ -42502,41 +42801,41 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42502
42801
  }, {
42503
42802
  key: "getComponents",
42504
42803
  value: (function () {
42505
- var _getComponents = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
42804
+ var _getComponents = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
42506
42805
  var options,
42507
42806
  validation,
42508
42807
  enhancedOptions,
42509
- _args6 = arguments,
42808
+ _args7 = arguments,
42510
42809
  _t;
42511
- return _regenerator().w(function (_context6) {
42512
- while (1) switch (_context6.n) {
42810
+ return _regenerator().w(function (_context7) {
42811
+ while (1) switch (_context7.n) {
42513
42812
  case 0:
42514
- options = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
42813
+ options = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
42515
42814
  // Validate filter options using centralized validator
42516
42815
  validation = this.internals.validator.validateComponentFilter(options);
42517
42816
  if (validation.isValid) {
42518
- _context6.n = 1;
42817
+ _context7.n = 1;
42519
42818
  break;
42520
42819
  }
42521
42820
  console.warn('⚠️ getComponents(): Invalid filter options provided:', validation.message);
42522
- return _context6.a(2, []);
42821
+ return _context7.a(2, []);
42523
42822
  case 1:
42524
- _context6.p = 1;
42823
+ _context7.p = 1;
42525
42824
  // Always include metadata
42526
42825
  enhancedOptions = _objectSpread2(_objectSpread2({}, options), {}, {
42527
42826
  includeMetadata: true
42528
42827
  });
42529
- _context6.n = 2;
42828
+ _context7.n = 2;
42530
42829
  return this.managers.componentDataManager.getDictionaryComponents(enhancedOptions);
42531
42830
  case 2:
42532
- return _context6.a(2, _context6.v);
42831
+ return _context7.a(2, _context7.v);
42533
42832
  case 3:
42534
- _context6.p = 3;
42535
- _t = _context6.v;
42833
+ _context7.p = 3;
42834
+ _t = _context7.v;
42536
42835
  console.error('❌ getDictionaryComponents(): Error retrieving available components:', _t);
42537
- return _context6.a(2, []);
42836
+ return _context7.a(2, []);
42538
42837
  }
42539
- }, _callee6, this, [[1, 3]]);
42838
+ }, _callee7, this, [[1, 3]]);
42540
42839
  }));
42541
42840
  function getComponents() {
42542
42841
  return _getComponents.apply(this, arguments);
@@ -42639,23 +42938,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42639
42938
  }, {
42640
42939
  key: "extendComponentDictionary",
42641
42940
  value: (function () {
42642
- var _extendComponentDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(additionalComponents) {
42643
- return _regenerator().w(function (_context7) {
42644
- while (1) switch (_context7.n) {
42941
+ var _extendComponentDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(additionalComponents) {
42942
+ return _regenerator().w(function (_context8) {
42943
+ while (1) switch (_context8.n) {
42645
42944
  case 0:
42646
42945
  if (this.managers.componentDataManager) {
42647
- _context7.n = 1;
42946
+ _context8.n = 1;
42648
42947
  break;
42649
42948
  }
42650
42949
  console.warn('⚠️ extendComponentDictionary(): Component data manager not available');
42651
- return _context7.a(2, false);
42950
+ return _context8.a(2, false);
42652
42951
  case 1:
42653
- _context7.n = 2;
42952
+ _context8.n = 2;
42654
42953
  return this.managers.componentDataManager.extendComponentDictionary(additionalComponents);
42655
42954
  case 2:
42656
- return _context7.a(2, _context7.v);
42955
+ return _context8.a(2, _context8.v);
42657
42956
  }
42658
- }, _callee7, this);
42957
+ }, _callee8, this);
42659
42958
  }));
42660
42959
  function extendComponentDictionary(_x3) {
42661
42960
  return _extendComponentDictionary.apply(this, arguments);
@@ -42729,23 +43028,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42729
43028
  }, {
42730
43029
  key: "removeS3Components",
42731
43030
  value: (function () {
42732
- var _removeS3Components = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
42733
- return _regenerator().w(function (_context8) {
42734
- while (1) switch (_context8.n) {
43031
+ var _removeS3Components = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
43032
+ return _regenerator().w(function (_context9) {
43033
+ while (1) switch (_context9.n) {
42735
43034
  case 0:
42736
43035
  if (this.managers.componentDataManager) {
42737
- _context8.n = 1;
43036
+ _context9.n = 1;
42738
43037
  break;
42739
43038
  }
42740
43039
  console.warn('⚠️ removeS3Components(): Component data manager not available');
42741
- return _context8.a(2, false);
43040
+ return _context9.a(2, false);
42742
43041
  case 1:
42743
- _context8.n = 2;
43042
+ _context9.n = 2;
42744
43043
  return this.managers.componentDataManager.removeS3Components();
42745
43044
  case 2:
42746
- return _context8.a(2, _context8.v);
43045
+ return _context9.a(2, _context9.v);
42747
43046
  }
42748
- }, _callee8, this);
43047
+ }, _callee9, this);
42749
43048
  }));
42750
43049
  function removeS3Components() {
42751
43050
  return _removeS3Components.apply(this, arguments);
@@ -42769,23 +43068,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42769
43068
  }, {
42770
43069
  key: "removeComponentFromDictionary",
42771
43070
  value: (function () {
42772
- var _removeComponentFromDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(componentKey) {
42773
- return _regenerator().w(function (_context9) {
42774
- while (1) switch (_context9.n) {
43071
+ var _removeComponentFromDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(componentKey) {
43072
+ return _regenerator().w(function (_context0) {
43073
+ while (1) switch (_context0.n) {
42775
43074
  case 0:
42776
43075
  if (this.managers.componentDataManager) {
42777
- _context9.n = 1;
43076
+ _context0.n = 1;
42778
43077
  break;
42779
43078
  }
42780
43079
  console.warn('⚠️ removeComponentFromDictionary(): Component data manager not available');
42781
- return _context9.a(2, false);
43080
+ return _context0.a(2, false);
42782
43081
  case 1:
42783
- _context9.n = 2;
43082
+ _context0.n = 2;
42784
43083
  return this.managers.componentDataManager.removeComponentFromDictionary(componentKey);
42785
43084
  case 2:
42786
- return _context9.a(2, _context9.v);
43085
+ return _context0.a(2, _context0.v);
42787
43086
  }
42788
- }, _callee9, this);
43087
+ }, _callee0, this);
42789
43088
  }));
42790
43089
  function removeComponentFromDictionary(_x4) {
42791
43090
  return _removeComponentFromDictionary.apply(this, arguments);
@@ -42821,8 +43120,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42821
43120
  var componentDictionary = ((_this$managers$compon = this.managers.componentDataManager) === null || _this$managers$compon === void 0 ? void 0 : _this$managers$compon.componentDictionary) || {};
42822
43121
  var missingIds = [];
42823
43122
  sceneData.scene.children.forEach(function (child) {
42824
- var _child$userData;
42825
- var libraryId = (_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.libraryId;
43123
+ var _child$userData2;
43124
+ var libraryId = (_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.libraryId;
42826
43125
  if (libraryId && !componentDictionary[libraryId]) {
42827
43126
  // Only add unique IDs
42828
43127
  if (!missingIds.includes(libraryId)) {
@@ -42900,8 +43199,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
42900
43199
  // If still not found, try finding by originalUuid in userData
42901
43200
  if (!targetObject) {
42902
43201
  this.sceneViewer.scene.traverse(function (child) {
42903
- var _child$userData2;
42904
- if (((_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.originalUuid) === objectId) {
43202
+ var _child$userData3;
43203
+ if (((_child$userData3 = child.userData) === null || _child$userData3 === void 0 ? void 0 : _child$userData3.originalUuid) === objectId) {
42905
43204
  targetObject = child;
42906
43205
  return;
42907
43206
  }
@@ -43032,49 +43331,49 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
43032
43331
  }, {
43033
43332
  key: "initialize2DViewport",
43034
43333
  value: function () {
43035
- var _initialize2DViewport = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(container) {
43334
+ var _initialize2DViewport = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(container) {
43036
43335
  var viewType,
43037
43336
  instanceKey,
43038
43337
  success,
43039
- _args0 = arguments,
43338
+ _args1 = arguments,
43040
43339
  _t2;
43041
- return _regenerator().w(function (_context0) {
43042
- while (1) switch (_context0.n) {
43340
+ return _regenerator().w(function (_context1) {
43341
+ while (1) switch (_context1.n) {
43043
43342
  case 0:
43044
- viewType = _args0.length > 1 && _args0[1] !== undefined ? _args0[1] : 'top';
43045
- instanceKey = _args0.length > 2 && _args0[2] !== undefined ? _args0[2] : null;
43343
+ viewType = _args1.length > 1 && _args1[1] !== undefined ? _args1[1] : 'top';
43344
+ instanceKey = _args1.length > 2 && _args1[2] !== undefined ? _args1[2] : null;
43046
43345
  if (container) {
43047
- _context0.n = 1;
43346
+ _context1.n = 1;
43048
43347
  break;
43049
43348
  }
43050
43349
  console.warn('⚠️ initialize2DViewport(): No container provided');
43051
- return _context0.a(2, false);
43350
+ return _context1.a(2, false);
43052
43351
  case 1:
43053
43352
  if (this.managers.viewport2DManager) {
43054
- _context0.n = 2;
43353
+ _context1.n = 2;
43055
43354
  break;
43056
43355
  }
43057
43356
  console.warn('⚠️ initialize2DViewport(): Viewport2D manager not available');
43058
- return _context0.a(2, false);
43357
+ return _context1.a(2, false);
43059
43358
  case 2:
43060
- _context0.p = 2;
43061
- _context0.n = 3;
43359
+ _context1.p = 2;
43360
+ _context1.n = 3;
43062
43361
  return this.managers.viewport2DManager.initialize(container, viewType, instanceKey);
43063
43362
  case 3:
43064
- success = _context0.v;
43363
+ success = _context1.v;
43065
43364
  if (success) {
43066
43365
  console.log("\u2705 2D viewport initialized successfully (".concat(viewType, " view, key: ").concat(instanceKey || viewType, ")"));
43067
43366
  } else {
43068
43367
  console.warn("\u26A0\uFE0F Failed to initialize 2D viewport (".concat(viewType, " view)"));
43069
43368
  }
43070
- return _context0.a(2, success);
43369
+ return _context1.a(2, success);
43071
43370
  case 4:
43072
- _context0.p = 4;
43073
- _t2 = _context0.v;
43371
+ _context1.p = 4;
43372
+ _t2 = _context1.v;
43074
43373
  console.error('❌ initialize2DViewport(): Error initializing 2D viewport:', _t2);
43075
- return _context0.a(2, false);
43374
+ return _context1.a(2, false);
43076
43375
  }
43077
- }, _callee0, this, [[2, 4]]);
43376
+ }, _callee1, this, [[2, 4]]);
43078
43377
  }));
43079
43378
  function initialize2DViewport(_x5) {
43080
43379
  return _initialize2DViewport.apply(this, arguments);
@@ -43252,7 +43551,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
43252
43551
  }, {
43253
43552
  key: "initializeModelPreloading",
43254
43553
  value: (function () {
43255
- var _initializeModelPreloading = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
43554
+ var _initializeModelPreloading = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
43256
43555
  var basePath,
43257
43556
  normalizedBasePath,
43258
43557
  dictionaryPath,
@@ -43261,13 +43560,13 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
43261
43560
  componentDictionary,
43262
43561
  _modelPreloader2,
43263
43562
  progress,
43264
- _args1 = arguments,
43563
+ _args10 = arguments,
43265
43564
  _t3;
43266
- return _regenerator().w(function (_context1) {
43267
- while (1) switch (_context1.n) {
43565
+ return _regenerator().w(function (_context10) {
43566
+ while (1) switch (_context10.n) {
43268
43567
  case 0:
43269
- basePath = _args1.length > 0 && _args1[0] !== undefined ? _args1[0] : '/library/';
43270
- _context1.p = 1;
43568
+ basePath = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : '/library/';
43569
+ _context10.p = 1;
43271
43570
  // Ensure basePath ends with a slash
43272
43571
  normalizedBasePath = basePath.endsWith('/') ? basePath : "".concat(basePath, "/");
43273
43572
  dictionaryPath = "".concat(normalizedBasePath, "component-dictionary.json");
@@ -43278,39 +43577,39 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
43278
43577
  console.log("\uFFFD Models path: ".concat(modelsBasePath));
43279
43578
 
43280
43579
  // Load the component dictionary
43281
- _context1.n = 2;
43580
+ _context10.n = 2;
43282
43581
  return fetch(dictionaryPath);
43283
43582
  case 2:
43284
- response = _context1.v;
43583
+ response = _context10.v;
43285
43584
  if (response.ok) {
43286
- _context1.n = 3;
43585
+ _context10.n = 3;
43287
43586
  break;
43288
43587
  }
43289
43588
  throw new Error("Failed to load component dictionary: ".concat(response.status));
43290
43589
  case 3:
43291
- _context1.n = 4;
43590
+ _context10.n = 4;
43292
43591
  return response.json();
43293
43592
  case 4:
43294
- componentDictionary = _context1.v;
43593
+ componentDictionary = _context10.v;
43295
43594
  console.log('📚 Component dictionary loaded:', Object.keys(componentDictionary));
43296
43595
 
43297
43596
  // Start preloading all models with the specified base path
43298
43597
  _modelPreloader2 = this.getUtility('modelPreloader');
43299
- _context1.n = 5;
43598
+ _context10.n = 5;
43300
43599
  return _modelPreloader2.preloadAllModels(componentDictionary, modelsBasePath);
43301
43600
  case 5:
43302
- progress = _context1.v;
43601
+ progress = _context10.v;
43303
43602
  console.log('🎉 Model preloading completed:', progress);
43304
- return _context1.a(2, progress);
43603
+ return _context10.a(2, progress);
43305
43604
  case 6:
43306
- _context1.p = 6;
43307
- _t3 = _context1.v;
43605
+ _context10.p = 6;
43606
+ _t3 = _context10.v;
43308
43607
  console.error('❌ Failed to initialize model preloading:', _t3);
43309
43608
  throw _t3;
43310
43609
  case 7:
43311
- return _context1.a(2);
43610
+ return _context10.a(2);
43312
43611
  }
43313
- }, _callee1, this, [[1, 6]]);
43612
+ }, _callee10, this, [[1, 6]]);
43314
43613
  }));
43315
43614
  function initializeModelPreloading() {
43316
43615
  return _initializeModelPreloading.apply(this, arguments);
@@ -43327,86 +43626,86 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
43327
43626
  }, {
43328
43627
  key: "importScene",
43329
43628
  value: (function () {
43330
- var _importScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(jsonData) {
43629
+ var _importScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(jsonData) {
43331
43630
  var validation, missingIds, resolved, _t4, _t5;
43332
- return _regenerator().w(function (_context10) {
43333
- while (1) switch (_context10.n) {
43631
+ return _regenerator().w(function (_context11) {
43632
+ while (1) switch (_context11.n) {
43334
43633
  case 0:
43335
43634
  if (jsonData) {
43336
- _context10.n = 1;
43635
+ _context11.n = 1;
43337
43636
  break;
43338
43637
  }
43339
43638
  console.error('❌ No JSON data provided for import');
43340
- return _context10.a(2, false);
43639
+ return _context11.a(2, false);
43341
43640
  case 1:
43342
- _context10.p = 1;
43641
+ _context11.p = 1;
43343
43642
  // Validate scene data structure
43344
43643
  validation = this.internals.validateAndAnalyzeSceneData(jsonData);
43345
43644
  if (validation.isValid) {
43346
- _context10.n = 2;
43645
+ _context11.n = 2;
43347
43646
  break;
43348
43647
  }
43349
43648
  console.error('❌ Invalid scene data format:', validation.message);
43350
- return _context10.a(2, false);
43649
+ return _context11.a(2, false);
43351
43650
  case 2:
43352
43651
  if (!this._componentDefinitionResolver) {
43353
- _context10.n = 8;
43652
+ _context11.n = 8;
43354
43653
  break;
43355
43654
  }
43356
43655
  missingIds = this.getMissingLibraryIds(jsonData);
43357
43656
  if (!(missingIds.length > 0)) {
43358
- _context10.n = 8;
43657
+ _context11.n = 8;
43359
43658
  break;
43360
43659
  }
43361
- _context10.p = 3;
43660
+ _context11.p = 3;
43362
43661
  console.log("\uD83D\uDD0D importScene(): Resolving ".concat(missingIds.length, " missing component definition(s)..."));
43363
- _context10.n = 4;
43662
+ _context11.n = 4;
43364
43663
  return this._componentDefinitionResolver(missingIds);
43365
43664
  case 4:
43366
- resolved = _context10.v;
43665
+ resolved = _context11.v;
43367
43666
  if (!(resolved && _typeof(resolved) === 'object' && Object.keys(resolved).length > 0)) {
43368
- _context10.n = 6;
43667
+ _context11.n = 6;
43369
43668
  break;
43370
43669
  }
43371
- _context10.n = 5;
43670
+ _context11.n = 5;
43372
43671
  return this.extendComponentDictionary(resolved);
43373
43672
  case 5:
43374
43673
  console.log("\u2705 importScene(): Resolved ".concat(Object.keys(resolved).length, " component definition(s)"));
43375
43674
  case 6:
43376
- _context10.n = 8;
43675
+ _context11.n = 8;
43377
43676
  break;
43378
43677
  case 7:
43379
- _context10.p = 7;
43380
- _t4 = _context10.v;
43678
+ _context11.p = 7;
43679
+ _t4 = _context11.v;
43381
43680
  console.warn('⚠️ importScene(): Component definition resolver failed, continuing with existing dictionary:', _t4);
43382
43681
  case 8:
43383
- _context10.n = 9;
43682
+ _context11.n = 9;
43384
43683
  return this.setImportedSceneData(jsonData);
43385
43684
  case 9:
43386
43685
  if (!(this.sceneViewer && this.sceneViewer.sceneOperationsManager)) {
43387
- _context10.n = 11;
43686
+ _context11.n = 11;
43388
43687
  break;
43389
43688
  }
43390
- _context10.n = 10;
43689
+ _context11.n = 10;
43391
43690
  return this.sceneViewer.sceneOperationsManager.loadSceneFromData(jsonData);
43392
43691
  case 10:
43393
43692
  console.log('✅ Scene imported successfully');
43394
- return _context10.a(2, true);
43693
+ return _context11.a(2, true);
43395
43694
  case 11:
43396
43695
  console.error('❌ SceneViewer not available for scene loading');
43397
- return _context10.a(2, false);
43696
+ return _context11.a(2, false);
43398
43697
  case 12:
43399
- _context10.n = 14;
43698
+ _context11.n = 14;
43400
43699
  break;
43401
43700
  case 13:
43402
- _context10.p = 13;
43403
- _t5 = _context10.v;
43701
+ _context11.p = 13;
43702
+ _t5 = _context11.v;
43404
43703
  console.error('❌ Error importing scene:', _t5);
43405
- return _context10.a(2, false);
43704
+ return _context11.a(2, false);
43406
43705
  case 14:
43407
- return _context10.a(2);
43706
+ return _context11.a(2);
43408
43707
  }
43409
- }, _callee10, this, [[3, 7], [1, 13]]);
43708
+ }, _callee11, this, [[3, 7], [1, 13]]);
43410
43709
  }));
43411
43710
  function importScene(_x6) {
43412
43711
  return _importScene.apply(this, arguments);
@@ -43430,33 +43729,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
43430
43729
  }, {
43431
43730
  key: "exportSceneJSON",
43432
43731
  value: (function () {
43433
- var _exportSceneJSON = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
43732
+ var _exportSceneJSON = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
43434
43733
  var filename,
43435
- _args11 = arguments,
43734
+ _args12 = arguments,
43436
43735
  _t6;
43437
- return _regenerator().w(function (_context11) {
43438
- while (1) switch (_context11.n) {
43736
+ return _regenerator().w(function (_context12) {
43737
+ while (1) switch (_context12.n) {
43439
43738
  case 0:
43440
- filename = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : null;
43739
+ filename = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : null;
43441
43740
  if (this.managers.sceneExportManager) {
43442
- _context11.n = 1;
43741
+ _context12.n = 1;
43443
43742
  break;
43444
43743
  }
43445
43744
  console.error('❌ Scene export manager not available');
43446
- return _context11.a(2, false);
43745
+ return _context12.a(2, false);
43447
43746
  case 1:
43448
- _context11.p = 1;
43449
- _context11.n = 2;
43747
+ _context12.p = 1;
43748
+ _context12.n = 2;
43450
43749
  return this.managers.sceneExportManager.downloadSceneJSON(filename);
43451
43750
  case 2:
43452
- return _context11.a(2, _context11.v);
43751
+ return _context12.a(2, _context12.v);
43453
43752
  case 3:
43454
- _context11.p = 3;
43455
- _t6 = _context11.v;
43753
+ _context12.p = 3;
43754
+ _t6 = _context12.v;
43456
43755
  console.error('❌ Error exporting scene as JSON:', _t6);
43457
- return _context11.a(2, false);
43756
+ return _context12.a(2, false);
43458
43757
  }
43459
- }, _callee11, this, [[1, 3]]);
43758
+ }, _callee12, this, [[1, 3]]);
43460
43759
  }));
43461
43760
  function exportSceneJSON() {
43462
43761
  return _exportSceneJSON.apply(this, arguments);
@@ -43481,33 +43780,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
43481
43780
  }, {
43482
43781
  key: "exportSceneGLTF",
43483
43782
  value: (function () {
43484
- var _exportSceneGLTF = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
43783
+ var _exportSceneGLTF = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
43485
43784
  var filename,
43486
- _args12 = arguments,
43785
+ _args13 = arguments,
43487
43786
  _t7;
43488
- return _regenerator().w(function (_context12) {
43489
- while (1) switch (_context12.n) {
43787
+ return _regenerator().w(function (_context13) {
43788
+ while (1) switch (_context13.n) {
43490
43789
  case 0:
43491
- filename = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : null;
43790
+ filename = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : null;
43492
43791
  if (this.managers.sceneExportManager) {
43493
- _context12.n = 1;
43792
+ _context13.n = 1;
43494
43793
  break;
43495
43794
  }
43496
43795
  console.error('❌ Scene export manager not available');
43497
- return _context12.a(2, false);
43796
+ return _context13.a(2, false);
43498
43797
  case 1:
43499
- _context12.p = 1;
43500
- _context12.n = 2;
43798
+ _context13.p = 1;
43799
+ _context13.n = 2;
43501
43800
  return this.managers.sceneExportManager.exportSceneAsGLTF(filename, false);
43502
43801
  case 2:
43503
- return _context12.a(2, _context12.v);
43802
+ return _context13.a(2, _context13.v);
43504
43803
  case 3:
43505
- _context12.p = 3;
43506
- _t7 = _context12.v;
43804
+ _context13.p = 3;
43805
+ _t7 = _context13.v;
43507
43806
  console.error('❌ Error exporting scene as GLTF:', _t7);
43508
- return _context12.a(2, false);
43807
+ return _context13.a(2, false);
43509
43808
  }
43510
- }, _callee12, this, [[1, 3]]);
43809
+ }, _callee13, this, [[1, 3]]);
43511
43810
  }));
43512
43811
  function exportSceneGLTF() {
43513
43812
  return _exportSceneGLTF.apply(this, arguments);
@@ -43533,33 +43832,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
43533
43832
  }, {
43534
43833
  key: "exportSceneGLB",
43535
43834
  value: (function () {
43536
- var _exportSceneGLB = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
43835
+ var _exportSceneGLB = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
43537
43836
  var filename,
43538
- _args13 = arguments,
43837
+ _args14 = arguments,
43539
43838
  _t8;
43540
- return _regenerator().w(function (_context13) {
43541
- while (1) switch (_context13.n) {
43839
+ return _regenerator().w(function (_context14) {
43840
+ while (1) switch (_context14.n) {
43542
43841
  case 0:
43543
- filename = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : null;
43842
+ filename = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : null;
43544
43843
  if (this.managers.sceneExportManager) {
43545
- _context13.n = 1;
43844
+ _context14.n = 1;
43546
43845
  break;
43547
43846
  }
43548
43847
  console.error('❌ Scene export manager not available');
43549
- return _context13.a(2, false);
43848
+ return _context14.a(2, false);
43550
43849
  case 1:
43551
- _context13.p = 1;
43552
- _context13.n = 2;
43850
+ _context14.p = 1;
43851
+ _context14.n = 2;
43553
43852
  return this.managers.sceneExportManager.exportSceneAsGLB(filename);
43554
43853
  case 2:
43555
- return _context13.a(2, _context13.v);
43854
+ return _context14.a(2, _context14.v);
43556
43855
  case 3:
43557
- _context13.p = 3;
43558
- _t8 = _context13.v;
43856
+ _context14.p = 3;
43857
+ _t8 = _context14.v;
43559
43858
  console.error('❌ Error exporting scene as GLB:', _t8);
43560
- return _context13.a(2, false);
43859
+ return _context14.a(2, false);
43561
43860
  }
43562
- }, _callee13, this, [[1, 3]]);
43861
+ }, _callee14, this, [[1, 3]]);
43563
43862
  }));
43564
43863
  function exportSceneGLB() {
43565
43864
  return _exportSceneGLB.apply(this, arguments);
@@ -43598,16 +43897,16 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
43598
43897
  }, {
43599
43898
  key: "loadSceneFromData",
43600
43899
  value: (function () {
43601
- var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(sceneData) {
43602
- return _regenerator().w(function (_context14) {
43603
- while (1) switch (_context14.n) {
43900
+ var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(sceneData) {
43901
+ return _regenerator().w(function (_context15) {
43902
+ while (1) switch (_context15.n) {
43604
43903
  case 0:
43605
- _context14.n = 1;
43904
+ _context15.n = 1;
43606
43905
  return this.setImportedSceneData(sceneData);
43607
43906
  case 1:
43608
- return _context14.a(2, true);
43907
+ return _context15.a(2, true);
43609
43908
  }
43610
- }, _callee14, this);
43909
+ }, _callee15, this);
43611
43910
  }));
43612
43911
  function loadSceneFromData(_x7) {
43613
43912
  return _loadSceneFromData.apply(this, arguments);
@@ -43632,9 +43931,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
43632
43931
  }, {
43633
43932
  key: "clearScene",
43634
43933
  value: function clearScene() {
43635
- var _this$sceneViewer12;
43934
+ var _this$sceneViewer13;
43636
43935
  this.importedSceneData = null;
43637
- var ioBehavMgr = (_this$sceneViewer12 = this.sceneViewer) === null || _this$sceneViewer12 === void 0 || (_this$sceneViewer12 = _this$sceneViewer12.managers) === null || _this$sceneViewer12 === void 0 ? void 0 : _this$sceneViewer12.ioBehaviorManager;
43936
+ var ioBehavMgr = (_this$sceneViewer13 = this.sceneViewer) === null || _this$sceneViewer13 === void 0 || (_this$sceneViewer13 = _this$sceneViewer13.managers) === null || _this$sceneViewer13 === void 0 ? void 0 : _this$sceneViewer13.ioBehaviorManager;
43638
43937
  if (ioBehavMgr) {
43639
43938
  ioBehavMgr.setCrossComponentBehaviors([]);
43640
43939
  }
@@ -44360,7 +44659,6 @@ var sceneViewer = /*#__PURE__*/function (_BaseDisposable) {
44360
44659
  }, {
44361
44660
  key: "updatePaths",
44362
44661
  value: function updatePaths() {
44363
- console.log("updatePaths started");
44364
44662
  // Delegate pathfinding update to PathfindingManager
44365
44663
  if (this.pathfindingManager) {
44366
44664
  this.pathfindingManager.updatePathfindingAfterTransform(this.currentSceneData);