@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
@@ -33,7 +33,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
33
33
  * Initialize the CentralPlant manager
34
34
  *
35
35
  * @constructor
36
- * @version 0.3.45
36
+ * @version 0.3.47
37
37
  * @updated 2025-10-22
38
38
  *
39
39
  * @description Creates a new CentralPlant instance and initializes internal managers and utilities.
@@ -171,6 +171,32 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
171
171
  return this.internals.attachToComponent();
172
172
  }
173
173
 
174
+ /**
175
+ * Check if an object in the scene collides with any other objects
176
+ * @param {string} objectId - The UUID or originalUuid of the object to check
177
+ * @returns {Object|null} Collision info if detected, null otherwise
178
+ */
179
+ }, {
180
+ key: "checkCollision",
181
+ value: function checkCollision(objectId) {
182
+ if (!this.sceneViewer || !this.managers.collisionManager) {
183
+ console.warn('⚠️ checkCollision(): Scene viewer or collision manager not available');
184
+ return null;
185
+ }
186
+ var targetObject = null;
187
+ this.sceneViewer.scene.traverse(function (child) {
188
+ var _child$userData;
189
+ if (child.uuid === objectId || ((_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.originalUuid) === objectId) {
190
+ targetObject = child;
191
+ }
192
+ });
193
+ if (!targetObject) {
194
+ console.warn("\u26A0\uFE0F checkCollision(): Object with ID '".concat(objectId, "' not found"));
195
+ return null;
196
+ }
197
+ return this.managers.collisionManager.checkCollision(targetObject);
198
+ }
199
+
174
200
  /**
175
201
  * Initialize specific managers that need to be created after scene setup
176
202
  * @returns {boolean} True if post-scene managers were initialized successfully, false otherwise
@@ -851,6 +877,104 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
851
877
  return this.internals.addConnection(fromConnectorId, toConnectorId);
852
878
  }
853
879
 
880
+ /**
881
+ * Randomly connect available component connectors in the scene.
882
+ * Attempts to pair as many free connectors as possible.
883
+ * @returns {Array<Object>} List of added connections.
884
+ */
885
+ }, {
886
+ key: "addRandomConnections",
887
+ value: (function () {
888
+ var _addRandomConnections = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
889
+ var _this$sceneViewer4;
890
+ var connectors, scene, currentConns, busyConnectorIds, freeConnectors, i, j, _ref, added, from, _i, to, isCompatible, isDifferentParent, conn;
891
+ return _regenerator().w(function (_context3) {
892
+ while (1) switch (_context3.n) {
893
+ case 0:
894
+ connectors = [];
895
+ scene = (_this$sceneViewer4 = this.sceneViewer) === null || _this$sceneViewer4 === void 0 ? void 0 : _this$sceneViewer4.scene;
896
+ if (scene) {
897
+ _context3.n = 1;
898
+ break;
899
+ }
900
+ return _context3.a(2, []);
901
+ case 1:
902
+ // Find all free connectors in the scene
903
+ scene.traverse(function (obj) {
904
+ var _obj$userData;
905
+ if (((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.objectType) === 'connector' && obj.uuid) {
906
+ connectors.push({
907
+ uuid: obj.uuid,
908
+ flow: obj.userData.flow || 'bi',
909
+ parent: obj.parent
910
+ });
911
+ }
912
+ });
913
+
914
+ // Get current connections to avoid double-connecting
915
+ currentConns = this.getConnections();
916
+ busyConnectorIds = new Set();
917
+ currentConns.forEach(function (conn) {
918
+ busyConnectorIds.add(conn.from);
919
+ busyConnectorIds.add(conn.to);
920
+ });
921
+ freeConnectors = connectors.filter(function (c) {
922
+ return !busyConnectorIds.has(c.uuid);
923
+ }); // Shuffle free connectors
924
+ for (i = freeConnectors.length - 1; i > 0; i--) {
925
+ j = Math.floor(Math.random() * (i + 1));
926
+ _ref = [freeConnectors[j], freeConnectors[i]];
927
+ freeConnectors[i] = _ref[0];
928
+ freeConnectors[j] = _ref[1];
929
+ }
930
+ added = []; // Greedy pairing
931
+ case 2:
932
+ if (!(freeConnectors.length >= 2)) {
933
+ _context3.n = 6;
934
+ break;
935
+ }
936
+ from = freeConnectors.pop();
937
+ _i = 0;
938
+ case 3:
939
+ if (!(_i < freeConnectors.length)) {
940
+ _context3.n = 5;
941
+ break;
942
+ }
943
+ to = freeConnectors[_i]; // Basic flow compatibility check (CentralPlantInternals.addConnection does this too)
944
+ isCompatible = from.flow === 'bi' || to.flow === 'bi' || from.flow !== to.flow;
945
+ isDifferentParent = from.parent !== to.parent;
946
+ if (!(isCompatible && isDifferentParent)) {
947
+ _context3.n = 4;
948
+ break;
949
+ }
950
+ conn = this.addConnection(from.uuid, to.uuid);
951
+ if (!conn) {
952
+ _context3.n = 4;
953
+ break;
954
+ }
955
+ added.push(conn);
956
+ freeConnectors.splice(_i, 1);
957
+ return _context3.a(3, 5);
958
+ case 4:
959
+ _i++;
960
+ _context3.n = 3;
961
+ break;
962
+ case 5:
963
+ _context3.n = 2;
964
+ break;
965
+ case 6:
966
+ if (added.length > 0) {
967
+ this.updatePaths();
968
+ }
969
+ return _context3.a(2, added);
970
+ }
971
+ }, _callee3, this);
972
+ }));
973
+ function addRandomConnections() {
974
+ return _addRandomConnections.apply(this, arguments);
975
+ }
976
+ return addRandomConnections;
977
+ }()
854
978
  /**
855
979
  * Remove a connection between two component connectors
856
980
  * @param {string} fromConnectorId - The UUID of the source connector
@@ -872,6 +996,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
872
996
  * centralPlant.updatePaths();
873
997
  * }
874
998
  */
999
+ )
875
1000
  }, {
876
1001
  key: "removeConnection",
877
1002
  value: function removeConnection(fromConnectorId, toConnectorId) {
@@ -1076,8 +1201,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1076
1201
  }, {
1077
1202
  key: "_dispatchIoState",
1078
1203
  value: function _dispatchIoState(attachmentId, stateId, value, parentUuid) {
1079
- var _this$managers, _this$sceneViewer4, _this$sceneViewer5, _this$managers2, _this$sceneViewer6, _this$sceneViewer7, _this$sceneViewer8;
1080
- 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);
1204
+ var _this$managers, _this$sceneViewer5, _this$sceneViewer6, _this$managers2, _this$sceneViewer7, _this$sceneViewer8, _this$sceneViewer9;
1205
+ 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);
1081
1206
  var stateAdapter = tooltipMgr === null || tooltipMgr === void 0 ? void 0 : tooltipMgr._stateAdapter;
1082
1207
  if (stateAdapter !== null && stateAdapter !== void 0 && stateAdapter.setState) {
1083
1208
  var scopedKey = getScopedAttachmentKey(attachmentId, parentUuid);
@@ -1087,11 +1212,11 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1087
1212
  console.warn('⚠️ _dispatchIoState(): stateAdapter.setState() threw:', err);
1088
1213
  }
1089
1214
  }
1090
- 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);
1215
+ 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);
1091
1216
  if (ioBehavMgr) {
1092
1217
  ioBehavMgr.triggerState(attachmentId, stateId, value, parentUuid);
1093
1218
  }
1094
- (_this$sceneViewer8 = this.sceneViewer) === null || _this$sceneViewer8 === void 0 || _this$sceneViewer8.emit('io-device-state-changed', {
1219
+ (_this$sceneViewer9 = this.sceneViewer) === null || _this$sceneViewer9 === void 0 || _this$sceneViewer9.emit('io-device-state-changed', {
1095
1220
  attachmentId: attachmentId,
1096
1221
  stateId: stateId,
1097
1222
  value: value,
@@ -1106,16 +1231,16 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1106
1231
  }, {
1107
1232
  key: "configureStateAdapter",
1108
1233
  value: function configureStateAdapter(stateAdapter) {
1109
- var _this$managers3, _this$sceneViewer9, _this$managers4, _this$sceneViewer1, _this$sceneViewer10;
1110
- 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);
1234
+ var _this$managers3, _this$sceneViewer0, _this$managers4, _this$sceneViewer10, _this$sceneViewer11;
1235
+ 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);
1111
1236
  if (tooltipMgr !== null && tooltipMgr !== void 0 && tooltipMgr.configure) {
1112
- var _this$sceneViewer0;
1237
+ var _this$sceneViewer1;
1113
1238
  tooltipMgr.configure(stateAdapter);
1114
- if ((_this$sceneViewer0 = this.sceneViewer) !== null && _this$sceneViewer0 !== void 0 && _this$sceneViewer0.managers) {
1239
+ if ((_this$sceneViewer1 = this.sceneViewer) !== null && _this$sceneViewer1 !== void 0 && _this$sceneViewer1.managers) {
1115
1240
  this.sceneViewer.managers.componentTooltipManager = tooltipMgr;
1116
1241
  }
1117
1242
  }
1118
- 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);
1243
+ 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);
1119
1244
  if (ioBehavMgr !== null && ioBehavMgr !== void 0 && ioBehavMgr.configure) {
1120
1245
  ioBehavMgr.configure(stateAdapter);
1121
1246
  }
@@ -1150,13 +1275,13 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1150
1275
  }, {
1151
1276
  key: "getSceneAttachments",
1152
1277
  value: function getSceneAttachments() {
1153
- var _this$sceneViewer11;
1154
- var scene = (_this$sceneViewer11 = this.sceneViewer) === null || _this$sceneViewer11 === void 0 ? void 0 : _this$sceneViewer11.scene;
1278
+ var _this$sceneViewer12;
1279
+ var scene = (_this$sceneViewer12 = this.sceneViewer) === null || _this$sceneViewer12 === void 0 ? void 0 : _this$sceneViewer12.scene;
1155
1280
  if (!scene) return [];
1156
1281
  var results = [];
1157
1282
  scene.traverse(function (obj) {
1158
- var _obj$userData;
1159
- if (((_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.objectType) === 'io-device') {
1283
+ var _obj$userData2;
1284
+ if (((_obj$userData2 = obj.userData) === null || _obj$userData2 === void 0 ? void 0 : _obj$userData2.objectType) === 'io-device') {
1160
1285
  var _parent$userData;
1161
1286
  var attachmentId = obj.userData.attachmentId || obj.name || obj.uuid;
1162
1287
  var label = obj.userData.attachmentLabel || attachmentId;
@@ -1208,7 +1333,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1208
1333
  * List all available I/O Device assets from the component dictionary.
1209
1334
  * @param {Object} [options={}]
1210
1335
  * @param {'all'|'bundled'|'user'} [options.source='all'] - Filter by asset origin
1211
- * @returns {Array<{uuid: string, name: string, assetType: string, ioConfig: Object}>}
1336
+ * @returns {Array<{uuid: string, name: string, assetType: string}>}
1212
1337
  * @example
1213
1338
  * const devices = centralPlant.getIoDevices({ source: 'all' })
1214
1339
  * const bundledOnly = centralPlant.getIoDevices({ source: 'bundled' })
@@ -1216,9 +1341,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1216
1341
  }, {
1217
1342
  key: "getIoDevices",
1218
1343
  value: function getIoDevices() {
1219
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1220
- _ref$source = _ref.source,
1221
- source = _ref$source === void 0 ? 'all' : _ref$source;
1344
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1345
+ _ref2$source = _ref2.source,
1346
+ source = _ref2$source === void 0 ? 'all' : _ref2$source;
1222
1347
  var mp = this.getUtility('modelPreloader');
1223
1348
  var dict = mp === null || mp === void 0 ? void 0 : mp.componentDictionary;
1224
1349
  if (!dict) {
@@ -1235,8 +1360,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1235
1360
  return {
1236
1361
  uuid: entry.uuid || entry.id,
1237
1362
  name: entry.name,
1238
- assetType: entry.assetType,
1239
- ioConfig: entry.ioConfig || {}
1363
+ assetType: entry.assetType
1240
1364
  };
1241
1365
  });
1242
1366
  }
@@ -1254,8 +1378,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1254
1378
  }, {
1255
1379
  key: "getIoDeviceUsage",
1256
1380
  value: function getIoDeviceUsage() {
1257
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1258
- deviceUuid = _ref2.deviceUuid;
1381
+ var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1382
+ deviceUuid = _ref3.deviceUuid;
1259
1383
  if (!deviceUuid) {
1260
1384
  console.warn('⚠️ getIoDeviceUsage(): deviceUuid is required');
1261
1385
  return [];
@@ -1306,38 +1430,38 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1306
1430
  }, {
1307
1431
  key: "createSmartComponent",
1308
1432
  value: (function () {
1309
- var _createSmartComponent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
1310
- var _ref3,
1433
+ var _createSmartComponent = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
1434
+ var _ref4,
1311
1435
  componentUuid,
1312
1436
  name,
1313
1437
  attachments,
1314
1438
  thumbnailBlob,
1315
1439
  newAsset,
1316
1440
  mp,
1317
- _args3 = arguments;
1318
- return _regenerator().w(function (_context3) {
1319
- while (1) switch (_context3.n) {
1441
+ _args4 = arguments;
1442
+ return _regenerator().w(function (_context4) {
1443
+ while (1) switch (_context4.n) {
1320
1444
  case 0:
1321
- _ref3 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, componentUuid = _ref3.componentUuid, name = _ref3.name, attachments = _ref3.attachments, thumbnailBlob = _ref3.thumbnailBlob;
1445
+ _ref4 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, componentUuid = _ref4.componentUuid, name = _ref4.name, attachments = _ref4.attachments, thumbnailBlob = _ref4.thumbnailBlob;
1322
1446
  if (this.assetService) {
1323
- _context3.n = 1;
1447
+ _context4.n = 1;
1324
1448
  break;
1325
1449
  }
1326
1450
  throw new Error('createSmartComponent(): no asset service set — call setAssetService() first');
1327
1451
  case 1:
1328
1452
  if (componentUuid) {
1329
- _context3.n = 2;
1453
+ _context4.n = 2;
1330
1454
  break;
1331
1455
  }
1332
1456
  throw new Error('createSmartComponent(): componentUuid is required');
1333
1457
  case 2:
1334
1458
  if (!(!Array.isArray(attachments) || attachments.length === 0)) {
1335
- _context3.n = 3;
1459
+ _context4.n = 3;
1336
1460
  break;
1337
1461
  }
1338
1462
  throw new Error('createSmartComponent(): at least one attachment is required');
1339
1463
  case 3:
1340
- _context3.n = 4;
1464
+ _context4.n = 4;
1341
1465
  return this.assetService.createSmartComponent({
1342
1466
  componentUuid: componentUuid,
1343
1467
  name: name,
@@ -1345,7 +1469,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1345
1469
  thumbnailBlob: thumbnailBlob
1346
1470
  });
1347
1471
  case 4:
1348
- newAsset = _context3.v;
1472
+ newAsset = _context4.v;
1349
1473
  // Register in model preloader dictionary so addComponent() can use it immediately
1350
1474
  mp = this.getUtility('modelPreloader');
1351
1475
  if (mp !== null && mp !== void 0 && mp.componentDictionary && newAsset !== null && newAsset !== void 0 && newAsset.uuid) {
@@ -1354,9 +1478,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1354
1478
  });
1355
1479
  console.log("\u2705 createSmartComponent(): registered \"".concat(newAsset.name, "\" in component dictionary"));
1356
1480
  }
1357
- return _context3.a(2, newAsset);
1481
+ return _context4.a(2, newAsset);
1358
1482
  }
1359
- }, _callee3, this);
1483
+ }, _callee4, this);
1360
1484
  }));
1361
1485
  function createSmartComponent() {
1362
1486
  return _createSmartComponent.apply(this, arguments);
@@ -1390,42 +1514,42 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1390
1514
  }, {
1391
1515
  key: "addComponentAttachment",
1392
1516
  value: (function () {
1393
- var _addComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
1394
- var _ref4,
1517
+ var _addComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
1518
+ var _ref5,
1395
1519
  componentUuid,
1396
1520
  attachment,
1397
1521
  updatedAsset,
1398
1522
  mp,
1399
- _args4 = arguments;
1400
- return _regenerator().w(function (_context4) {
1401
- while (1) switch (_context4.n) {
1523
+ _args5 = arguments;
1524
+ return _regenerator().w(function (_context5) {
1525
+ while (1) switch (_context5.n) {
1402
1526
  case 0:
1403
- _ref4 = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, componentUuid = _ref4.componentUuid, attachment = _ref4.attachment;
1527
+ _ref5 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, componentUuid = _ref5.componentUuid, attachment = _ref5.attachment;
1404
1528
  if (this.assetService) {
1405
- _context4.n = 1;
1529
+ _context5.n = 1;
1406
1530
  break;
1407
1531
  }
1408
1532
  throw new Error('addComponentAttachment(): no asset service set — call setAssetService() first');
1409
1533
  case 1:
1410
1534
  if (componentUuid) {
1411
- _context4.n = 2;
1535
+ _context5.n = 2;
1412
1536
  break;
1413
1537
  }
1414
1538
  throw new Error('addComponentAttachment(): componentUuid is required');
1415
1539
  case 2:
1416
1540
  if (!(!(attachment !== null && attachment !== void 0 && attachment.attachmentId) || !(attachment !== null && attachment !== void 0 && attachment.deviceId))) {
1417
- _context4.n = 3;
1541
+ _context5.n = 3;
1418
1542
  break;
1419
1543
  }
1420
1544
  throw new Error('addComponentAttachment(): attachment must have attachmentId and deviceId');
1421
1545
  case 3:
1422
- _context4.n = 4;
1546
+ _context5.n = 4;
1423
1547
  return this.assetService.addComponentAttachment({
1424
1548
  componentUuid: componentUuid,
1425
1549
  attachment: attachment
1426
1550
  });
1427
1551
  case 4:
1428
- updatedAsset = _context4.v;
1552
+ updatedAsset = _context5.v;
1429
1553
  // Sync component dictionary
1430
1554
  mp = this.getUtility('modelPreloader');
1431
1555
  if (mp !== null && mp !== void 0 && mp.componentDictionary && updatedAsset !== null && updatedAsset !== void 0 && updatedAsset.uuid) {
@@ -1433,9 +1557,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1433
1557
  id: updatedAsset.uuid
1434
1558
  });
1435
1559
  }
1436
- return _context4.a(2, updatedAsset);
1560
+ return _context5.a(2, updatedAsset);
1437
1561
  }
1438
- }, _callee4, this);
1562
+ }, _callee5, this);
1439
1563
  }));
1440
1564
  function addComponentAttachment() {
1441
1565
  return _addComponentAttachment.apply(this, arguments);
@@ -1461,42 +1585,42 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1461
1585
  }, {
1462
1586
  key: "removeComponentAttachment",
1463
1587
  value: (function () {
1464
- var _removeComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
1465
- var _ref5,
1588
+ var _removeComponentAttachment = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
1589
+ var _ref6,
1466
1590
  componentUuid,
1467
1591
  attachmentId,
1468
1592
  updatedAsset,
1469
1593
  mp,
1470
- _args5 = arguments;
1471
- return _regenerator().w(function (_context5) {
1472
- while (1) switch (_context5.n) {
1594
+ _args6 = arguments;
1595
+ return _regenerator().w(function (_context6) {
1596
+ while (1) switch (_context6.n) {
1473
1597
  case 0:
1474
- _ref5 = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {}, componentUuid = _ref5.componentUuid, attachmentId = _ref5.attachmentId;
1598
+ _ref6 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, componentUuid = _ref6.componentUuid, attachmentId = _ref6.attachmentId;
1475
1599
  if (this.assetService) {
1476
- _context5.n = 1;
1600
+ _context6.n = 1;
1477
1601
  break;
1478
1602
  }
1479
1603
  throw new Error('removeComponentAttachment(): no asset service set — call setAssetService() first');
1480
1604
  case 1:
1481
1605
  if (componentUuid) {
1482
- _context5.n = 2;
1606
+ _context6.n = 2;
1483
1607
  break;
1484
1608
  }
1485
1609
  throw new Error('removeComponentAttachment(): componentUuid is required');
1486
1610
  case 2:
1487
1611
  if (attachmentId) {
1488
- _context5.n = 3;
1612
+ _context6.n = 3;
1489
1613
  break;
1490
1614
  }
1491
1615
  throw new Error('removeComponentAttachment(): attachmentId is required');
1492
1616
  case 3:
1493
- _context5.n = 4;
1617
+ _context6.n = 4;
1494
1618
  return this.assetService.removeComponentAttachment({
1495
1619
  componentUuid: componentUuid,
1496
1620
  attachmentId: attachmentId
1497
1621
  });
1498
1622
  case 4:
1499
- updatedAsset = _context5.v;
1623
+ updatedAsset = _context6.v;
1500
1624
  // Sync component dictionary
1501
1625
  mp = this.getUtility('modelPreloader');
1502
1626
  if (mp !== null && mp !== void 0 && mp.componentDictionary && updatedAsset !== null && updatedAsset !== void 0 && updatedAsset.uuid) {
@@ -1504,9 +1628,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1504
1628
  id: updatedAsset.uuid
1505
1629
  });
1506
1630
  }
1507
- return _context5.a(2, updatedAsset);
1631
+ return _context6.a(2, updatedAsset);
1508
1632
  }
1509
- }, _callee5, this);
1633
+ }, _callee6, this);
1510
1634
  }));
1511
1635
  function removeComponentAttachment() {
1512
1636
  return _removeComponentAttachment.apply(this, arguments);
@@ -1699,41 +1823,41 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1699
1823
  }, {
1700
1824
  key: "getComponents",
1701
1825
  value: (function () {
1702
- var _getComponents = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
1826
+ var _getComponents = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
1703
1827
  var options,
1704
1828
  validation,
1705
1829
  enhancedOptions,
1706
- _args6 = arguments,
1830
+ _args7 = arguments,
1707
1831
  _t;
1708
- return _regenerator().w(function (_context6) {
1709
- while (1) switch (_context6.n) {
1832
+ return _regenerator().w(function (_context7) {
1833
+ while (1) switch (_context7.n) {
1710
1834
  case 0:
1711
- options = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
1835
+ options = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
1712
1836
  // Validate filter options using centralized validator
1713
1837
  validation = this.internals.validator.validateComponentFilter(options);
1714
1838
  if (validation.isValid) {
1715
- _context6.n = 1;
1839
+ _context7.n = 1;
1716
1840
  break;
1717
1841
  }
1718
1842
  console.warn('⚠️ getComponents(): Invalid filter options provided:', validation.message);
1719
- return _context6.a(2, []);
1843
+ return _context7.a(2, []);
1720
1844
  case 1:
1721
- _context6.p = 1;
1845
+ _context7.p = 1;
1722
1846
  // Always include metadata
1723
1847
  enhancedOptions = _objectSpread2(_objectSpread2({}, options), {}, {
1724
1848
  includeMetadata: true
1725
1849
  });
1726
- _context6.n = 2;
1850
+ _context7.n = 2;
1727
1851
  return this.managers.componentDataManager.getDictionaryComponents(enhancedOptions);
1728
1852
  case 2:
1729
- return _context6.a(2, _context6.v);
1853
+ return _context7.a(2, _context7.v);
1730
1854
  case 3:
1731
- _context6.p = 3;
1732
- _t = _context6.v;
1855
+ _context7.p = 3;
1856
+ _t = _context7.v;
1733
1857
  console.error('❌ getDictionaryComponents(): Error retrieving available components:', _t);
1734
- return _context6.a(2, []);
1858
+ return _context7.a(2, []);
1735
1859
  }
1736
- }, _callee6, this, [[1, 3]]);
1860
+ }, _callee7, this, [[1, 3]]);
1737
1861
  }));
1738
1862
  function getComponents() {
1739
1863
  return _getComponents.apply(this, arguments);
@@ -1836,23 +1960,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1836
1960
  }, {
1837
1961
  key: "extendComponentDictionary",
1838
1962
  value: (function () {
1839
- var _extendComponentDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(additionalComponents) {
1840
- return _regenerator().w(function (_context7) {
1841
- while (1) switch (_context7.n) {
1963
+ var _extendComponentDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(additionalComponents) {
1964
+ return _regenerator().w(function (_context8) {
1965
+ while (1) switch (_context8.n) {
1842
1966
  case 0:
1843
1967
  if (this.managers.componentDataManager) {
1844
- _context7.n = 1;
1968
+ _context8.n = 1;
1845
1969
  break;
1846
1970
  }
1847
1971
  console.warn('⚠️ extendComponentDictionary(): Component data manager not available');
1848
- return _context7.a(2, false);
1972
+ return _context8.a(2, false);
1849
1973
  case 1:
1850
- _context7.n = 2;
1974
+ _context8.n = 2;
1851
1975
  return this.managers.componentDataManager.extendComponentDictionary(additionalComponents);
1852
1976
  case 2:
1853
- return _context7.a(2, _context7.v);
1977
+ return _context8.a(2, _context8.v);
1854
1978
  }
1855
- }, _callee7, this);
1979
+ }, _callee8, this);
1856
1980
  }));
1857
1981
  function extendComponentDictionary(_x3) {
1858
1982
  return _extendComponentDictionary.apply(this, arguments);
@@ -1926,23 +2050,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1926
2050
  }, {
1927
2051
  key: "removeS3Components",
1928
2052
  value: (function () {
1929
- var _removeS3Components = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
1930
- return _regenerator().w(function (_context8) {
1931
- while (1) switch (_context8.n) {
2053
+ var _removeS3Components = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
2054
+ return _regenerator().w(function (_context9) {
2055
+ while (1) switch (_context9.n) {
1932
2056
  case 0:
1933
2057
  if (this.managers.componentDataManager) {
1934
- _context8.n = 1;
2058
+ _context9.n = 1;
1935
2059
  break;
1936
2060
  }
1937
2061
  console.warn('⚠️ removeS3Components(): Component data manager not available');
1938
- return _context8.a(2, false);
2062
+ return _context9.a(2, false);
1939
2063
  case 1:
1940
- _context8.n = 2;
2064
+ _context9.n = 2;
1941
2065
  return this.managers.componentDataManager.removeS3Components();
1942
2066
  case 2:
1943
- return _context8.a(2, _context8.v);
2067
+ return _context9.a(2, _context9.v);
1944
2068
  }
1945
- }, _callee8, this);
2069
+ }, _callee9, this);
1946
2070
  }));
1947
2071
  function removeS3Components() {
1948
2072
  return _removeS3Components.apply(this, arguments);
@@ -1966,23 +2090,23 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
1966
2090
  }, {
1967
2091
  key: "removeComponentFromDictionary",
1968
2092
  value: (function () {
1969
- var _removeComponentFromDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(componentKey) {
1970
- return _regenerator().w(function (_context9) {
1971
- while (1) switch (_context9.n) {
2093
+ var _removeComponentFromDictionary = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(componentKey) {
2094
+ return _regenerator().w(function (_context0) {
2095
+ while (1) switch (_context0.n) {
1972
2096
  case 0:
1973
2097
  if (this.managers.componentDataManager) {
1974
- _context9.n = 1;
2098
+ _context0.n = 1;
1975
2099
  break;
1976
2100
  }
1977
2101
  console.warn('⚠️ removeComponentFromDictionary(): Component data manager not available');
1978
- return _context9.a(2, false);
2102
+ return _context0.a(2, false);
1979
2103
  case 1:
1980
- _context9.n = 2;
2104
+ _context0.n = 2;
1981
2105
  return this.managers.componentDataManager.removeComponentFromDictionary(componentKey);
1982
2106
  case 2:
1983
- return _context9.a(2, _context9.v);
2107
+ return _context0.a(2, _context0.v);
1984
2108
  }
1985
- }, _callee9, this);
2109
+ }, _callee0, this);
1986
2110
  }));
1987
2111
  function removeComponentFromDictionary(_x4) {
1988
2112
  return _removeComponentFromDictionary.apply(this, arguments);
@@ -2018,8 +2142,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2018
2142
  var componentDictionary = ((_this$managers$compon = this.managers.componentDataManager) === null || _this$managers$compon === void 0 ? void 0 : _this$managers$compon.componentDictionary) || {};
2019
2143
  var missingIds = [];
2020
2144
  sceneData.scene.children.forEach(function (child) {
2021
- var _child$userData;
2022
- var libraryId = (_child$userData = child.userData) === null || _child$userData === void 0 ? void 0 : _child$userData.libraryId;
2145
+ var _child$userData2;
2146
+ var libraryId = (_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.libraryId;
2023
2147
  if (libraryId && !componentDictionary[libraryId]) {
2024
2148
  // Only add unique IDs
2025
2149
  if (!missingIds.includes(libraryId)) {
@@ -2097,8 +2221,8 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2097
2221
  // If still not found, try finding by originalUuid in userData
2098
2222
  if (!targetObject) {
2099
2223
  this.sceneViewer.scene.traverse(function (child) {
2100
- var _child$userData2;
2101
- if (((_child$userData2 = child.userData) === null || _child$userData2 === void 0 ? void 0 : _child$userData2.originalUuid) === objectId) {
2224
+ var _child$userData3;
2225
+ if (((_child$userData3 = child.userData) === null || _child$userData3 === void 0 ? void 0 : _child$userData3.originalUuid) === objectId) {
2102
2226
  targetObject = child;
2103
2227
  return;
2104
2228
  }
@@ -2229,49 +2353,49 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2229
2353
  }, {
2230
2354
  key: "initialize2DViewport",
2231
2355
  value: function () {
2232
- var _initialize2DViewport = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(container) {
2356
+ var _initialize2DViewport = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(container) {
2233
2357
  var viewType,
2234
2358
  instanceKey,
2235
2359
  success,
2236
- _args0 = arguments,
2360
+ _args1 = arguments,
2237
2361
  _t2;
2238
- return _regenerator().w(function (_context0) {
2239
- while (1) switch (_context0.n) {
2362
+ return _regenerator().w(function (_context1) {
2363
+ while (1) switch (_context1.n) {
2240
2364
  case 0:
2241
- viewType = _args0.length > 1 && _args0[1] !== undefined ? _args0[1] : 'top';
2242
- instanceKey = _args0.length > 2 && _args0[2] !== undefined ? _args0[2] : null;
2365
+ viewType = _args1.length > 1 && _args1[1] !== undefined ? _args1[1] : 'top';
2366
+ instanceKey = _args1.length > 2 && _args1[2] !== undefined ? _args1[2] : null;
2243
2367
  if (container) {
2244
- _context0.n = 1;
2368
+ _context1.n = 1;
2245
2369
  break;
2246
2370
  }
2247
2371
  console.warn('⚠️ initialize2DViewport(): No container provided');
2248
- return _context0.a(2, false);
2372
+ return _context1.a(2, false);
2249
2373
  case 1:
2250
2374
  if (this.managers.viewport2DManager) {
2251
- _context0.n = 2;
2375
+ _context1.n = 2;
2252
2376
  break;
2253
2377
  }
2254
2378
  console.warn('⚠️ initialize2DViewport(): Viewport2D manager not available');
2255
- return _context0.a(2, false);
2379
+ return _context1.a(2, false);
2256
2380
  case 2:
2257
- _context0.p = 2;
2258
- _context0.n = 3;
2381
+ _context1.p = 2;
2382
+ _context1.n = 3;
2259
2383
  return this.managers.viewport2DManager.initialize(container, viewType, instanceKey);
2260
2384
  case 3:
2261
- success = _context0.v;
2385
+ success = _context1.v;
2262
2386
  if (success) {
2263
2387
  console.log("\u2705 2D viewport initialized successfully (".concat(viewType, " view, key: ").concat(instanceKey || viewType, ")"));
2264
2388
  } else {
2265
2389
  console.warn("\u26A0\uFE0F Failed to initialize 2D viewport (".concat(viewType, " view)"));
2266
2390
  }
2267
- return _context0.a(2, success);
2391
+ return _context1.a(2, success);
2268
2392
  case 4:
2269
- _context0.p = 4;
2270
- _t2 = _context0.v;
2393
+ _context1.p = 4;
2394
+ _t2 = _context1.v;
2271
2395
  console.error('❌ initialize2DViewport(): Error initializing 2D viewport:', _t2);
2272
- return _context0.a(2, false);
2396
+ return _context1.a(2, false);
2273
2397
  }
2274
- }, _callee0, this, [[2, 4]]);
2398
+ }, _callee1, this, [[2, 4]]);
2275
2399
  }));
2276
2400
  function initialize2DViewport(_x5) {
2277
2401
  return _initialize2DViewport.apply(this, arguments);
@@ -2449,7 +2573,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2449
2573
  }, {
2450
2574
  key: "initializeModelPreloading",
2451
2575
  value: (function () {
2452
- var _initializeModelPreloading = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
2576
+ var _initializeModelPreloading = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
2453
2577
  var basePath,
2454
2578
  normalizedBasePath,
2455
2579
  dictionaryPath,
@@ -2458,13 +2582,13 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2458
2582
  componentDictionary,
2459
2583
  _modelPreloader2,
2460
2584
  progress,
2461
- _args1 = arguments,
2585
+ _args10 = arguments,
2462
2586
  _t3;
2463
- return _regenerator().w(function (_context1) {
2464
- while (1) switch (_context1.n) {
2587
+ return _regenerator().w(function (_context10) {
2588
+ while (1) switch (_context10.n) {
2465
2589
  case 0:
2466
- basePath = _args1.length > 0 && _args1[0] !== undefined ? _args1[0] : '/library/';
2467
- _context1.p = 1;
2590
+ basePath = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : '/library/';
2591
+ _context10.p = 1;
2468
2592
  // Ensure basePath ends with a slash
2469
2593
  normalizedBasePath = basePath.endsWith('/') ? basePath : "".concat(basePath, "/");
2470
2594
  dictionaryPath = "".concat(normalizedBasePath, "component-dictionary.json");
@@ -2475,39 +2599,39 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2475
2599
  console.log("\uFFFD Models path: ".concat(modelsBasePath));
2476
2600
 
2477
2601
  // Load the component dictionary
2478
- _context1.n = 2;
2602
+ _context10.n = 2;
2479
2603
  return fetch(dictionaryPath);
2480
2604
  case 2:
2481
- response = _context1.v;
2605
+ response = _context10.v;
2482
2606
  if (response.ok) {
2483
- _context1.n = 3;
2607
+ _context10.n = 3;
2484
2608
  break;
2485
2609
  }
2486
2610
  throw new Error("Failed to load component dictionary: ".concat(response.status));
2487
2611
  case 3:
2488
- _context1.n = 4;
2612
+ _context10.n = 4;
2489
2613
  return response.json();
2490
2614
  case 4:
2491
- componentDictionary = _context1.v;
2615
+ componentDictionary = _context10.v;
2492
2616
  console.log('📚 Component dictionary loaded:', Object.keys(componentDictionary));
2493
2617
 
2494
2618
  // Start preloading all models with the specified base path
2495
2619
  _modelPreloader2 = this.getUtility('modelPreloader');
2496
- _context1.n = 5;
2620
+ _context10.n = 5;
2497
2621
  return _modelPreloader2.preloadAllModels(componentDictionary, modelsBasePath);
2498
2622
  case 5:
2499
- progress = _context1.v;
2623
+ progress = _context10.v;
2500
2624
  console.log('🎉 Model preloading completed:', progress);
2501
- return _context1.a(2, progress);
2625
+ return _context10.a(2, progress);
2502
2626
  case 6:
2503
- _context1.p = 6;
2504
- _t3 = _context1.v;
2627
+ _context10.p = 6;
2628
+ _t3 = _context10.v;
2505
2629
  console.error('❌ Failed to initialize model preloading:', _t3);
2506
2630
  throw _t3;
2507
2631
  case 7:
2508
- return _context1.a(2);
2632
+ return _context10.a(2);
2509
2633
  }
2510
- }, _callee1, this, [[1, 6]]);
2634
+ }, _callee10, this, [[1, 6]]);
2511
2635
  }));
2512
2636
  function initializeModelPreloading() {
2513
2637
  return _initializeModelPreloading.apply(this, arguments);
@@ -2524,86 +2648,86 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2524
2648
  }, {
2525
2649
  key: "importScene",
2526
2650
  value: (function () {
2527
- var _importScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(jsonData) {
2651
+ var _importScene = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(jsonData) {
2528
2652
  var validation, missingIds, resolved, _t4, _t5;
2529
- return _regenerator().w(function (_context10) {
2530
- while (1) switch (_context10.n) {
2653
+ return _regenerator().w(function (_context11) {
2654
+ while (1) switch (_context11.n) {
2531
2655
  case 0:
2532
2656
  if (jsonData) {
2533
- _context10.n = 1;
2657
+ _context11.n = 1;
2534
2658
  break;
2535
2659
  }
2536
2660
  console.error('❌ No JSON data provided for import');
2537
- return _context10.a(2, false);
2661
+ return _context11.a(2, false);
2538
2662
  case 1:
2539
- _context10.p = 1;
2663
+ _context11.p = 1;
2540
2664
  // Validate scene data structure
2541
2665
  validation = this.internals.validateAndAnalyzeSceneData(jsonData);
2542
2666
  if (validation.isValid) {
2543
- _context10.n = 2;
2667
+ _context11.n = 2;
2544
2668
  break;
2545
2669
  }
2546
2670
  console.error('❌ Invalid scene data format:', validation.message);
2547
- return _context10.a(2, false);
2671
+ return _context11.a(2, false);
2548
2672
  case 2:
2549
2673
  if (!this._componentDefinitionResolver) {
2550
- _context10.n = 8;
2674
+ _context11.n = 8;
2551
2675
  break;
2552
2676
  }
2553
2677
  missingIds = this.getMissingLibraryIds(jsonData);
2554
2678
  if (!(missingIds.length > 0)) {
2555
- _context10.n = 8;
2679
+ _context11.n = 8;
2556
2680
  break;
2557
2681
  }
2558
- _context10.p = 3;
2682
+ _context11.p = 3;
2559
2683
  console.log("\uD83D\uDD0D importScene(): Resolving ".concat(missingIds.length, " missing component definition(s)..."));
2560
- _context10.n = 4;
2684
+ _context11.n = 4;
2561
2685
  return this._componentDefinitionResolver(missingIds);
2562
2686
  case 4:
2563
- resolved = _context10.v;
2687
+ resolved = _context11.v;
2564
2688
  if (!(resolved && _typeof(resolved) === 'object' && Object.keys(resolved).length > 0)) {
2565
- _context10.n = 6;
2689
+ _context11.n = 6;
2566
2690
  break;
2567
2691
  }
2568
- _context10.n = 5;
2692
+ _context11.n = 5;
2569
2693
  return this.extendComponentDictionary(resolved);
2570
2694
  case 5:
2571
2695
  console.log("\u2705 importScene(): Resolved ".concat(Object.keys(resolved).length, " component definition(s)"));
2572
2696
  case 6:
2573
- _context10.n = 8;
2697
+ _context11.n = 8;
2574
2698
  break;
2575
2699
  case 7:
2576
- _context10.p = 7;
2577
- _t4 = _context10.v;
2700
+ _context11.p = 7;
2701
+ _t4 = _context11.v;
2578
2702
  console.warn('⚠️ importScene(): Component definition resolver failed, continuing with existing dictionary:', _t4);
2579
2703
  case 8:
2580
- _context10.n = 9;
2704
+ _context11.n = 9;
2581
2705
  return this.setImportedSceneData(jsonData);
2582
2706
  case 9:
2583
2707
  if (!(this.sceneViewer && this.sceneViewer.sceneOperationsManager)) {
2584
- _context10.n = 11;
2708
+ _context11.n = 11;
2585
2709
  break;
2586
2710
  }
2587
- _context10.n = 10;
2711
+ _context11.n = 10;
2588
2712
  return this.sceneViewer.sceneOperationsManager.loadSceneFromData(jsonData);
2589
2713
  case 10:
2590
2714
  console.log('✅ Scene imported successfully');
2591
- return _context10.a(2, true);
2715
+ return _context11.a(2, true);
2592
2716
  case 11:
2593
2717
  console.error('❌ SceneViewer not available for scene loading');
2594
- return _context10.a(2, false);
2718
+ return _context11.a(2, false);
2595
2719
  case 12:
2596
- _context10.n = 14;
2720
+ _context11.n = 14;
2597
2721
  break;
2598
2722
  case 13:
2599
- _context10.p = 13;
2600
- _t5 = _context10.v;
2723
+ _context11.p = 13;
2724
+ _t5 = _context11.v;
2601
2725
  console.error('❌ Error importing scene:', _t5);
2602
- return _context10.a(2, false);
2726
+ return _context11.a(2, false);
2603
2727
  case 14:
2604
- return _context10.a(2);
2728
+ return _context11.a(2);
2605
2729
  }
2606
- }, _callee10, this, [[3, 7], [1, 13]]);
2730
+ }, _callee11, this, [[3, 7], [1, 13]]);
2607
2731
  }));
2608
2732
  function importScene(_x6) {
2609
2733
  return _importScene.apply(this, arguments);
@@ -2627,33 +2751,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2627
2751
  }, {
2628
2752
  key: "exportSceneJSON",
2629
2753
  value: (function () {
2630
- var _exportSceneJSON = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
2754
+ var _exportSceneJSON = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
2631
2755
  var filename,
2632
- _args11 = arguments,
2756
+ _args12 = arguments,
2633
2757
  _t6;
2634
- return _regenerator().w(function (_context11) {
2635
- while (1) switch (_context11.n) {
2758
+ return _regenerator().w(function (_context12) {
2759
+ while (1) switch (_context12.n) {
2636
2760
  case 0:
2637
- filename = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : null;
2761
+ filename = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : null;
2638
2762
  if (this.managers.sceneExportManager) {
2639
- _context11.n = 1;
2763
+ _context12.n = 1;
2640
2764
  break;
2641
2765
  }
2642
2766
  console.error('❌ Scene export manager not available');
2643
- return _context11.a(2, false);
2767
+ return _context12.a(2, false);
2644
2768
  case 1:
2645
- _context11.p = 1;
2646
- _context11.n = 2;
2769
+ _context12.p = 1;
2770
+ _context12.n = 2;
2647
2771
  return this.managers.sceneExportManager.downloadSceneJSON(filename);
2648
2772
  case 2:
2649
- return _context11.a(2, _context11.v);
2773
+ return _context12.a(2, _context12.v);
2650
2774
  case 3:
2651
- _context11.p = 3;
2652
- _t6 = _context11.v;
2775
+ _context12.p = 3;
2776
+ _t6 = _context12.v;
2653
2777
  console.error('❌ Error exporting scene as JSON:', _t6);
2654
- return _context11.a(2, false);
2778
+ return _context12.a(2, false);
2655
2779
  }
2656
- }, _callee11, this, [[1, 3]]);
2780
+ }, _callee12, this, [[1, 3]]);
2657
2781
  }));
2658
2782
  function exportSceneJSON() {
2659
2783
  return _exportSceneJSON.apply(this, arguments);
@@ -2678,33 +2802,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2678
2802
  }, {
2679
2803
  key: "exportSceneGLTF",
2680
2804
  value: (function () {
2681
- var _exportSceneGLTF = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
2805
+ var _exportSceneGLTF = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
2682
2806
  var filename,
2683
- _args12 = arguments,
2807
+ _args13 = arguments,
2684
2808
  _t7;
2685
- return _regenerator().w(function (_context12) {
2686
- while (1) switch (_context12.n) {
2809
+ return _regenerator().w(function (_context13) {
2810
+ while (1) switch (_context13.n) {
2687
2811
  case 0:
2688
- filename = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : null;
2812
+ filename = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : null;
2689
2813
  if (this.managers.sceneExportManager) {
2690
- _context12.n = 1;
2814
+ _context13.n = 1;
2691
2815
  break;
2692
2816
  }
2693
2817
  console.error('❌ Scene export manager not available');
2694
- return _context12.a(2, false);
2818
+ return _context13.a(2, false);
2695
2819
  case 1:
2696
- _context12.p = 1;
2697
- _context12.n = 2;
2820
+ _context13.p = 1;
2821
+ _context13.n = 2;
2698
2822
  return this.managers.sceneExportManager.exportSceneAsGLTF(filename, false);
2699
2823
  case 2:
2700
- return _context12.a(2, _context12.v);
2824
+ return _context13.a(2, _context13.v);
2701
2825
  case 3:
2702
- _context12.p = 3;
2703
- _t7 = _context12.v;
2826
+ _context13.p = 3;
2827
+ _t7 = _context13.v;
2704
2828
  console.error('❌ Error exporting scene as GLTF:', _t7);
2705
- return _context12.a(2, false);
2829
+ return _context13.a(2, false);
2706
2830
  }
2707
- }, _callee12, this, [[1, 3]]);
2831
+ }, _callee13, this, [[1, 3]]);
2708
2832
  }));
2709
2833
  function exportSceneGLTF() {
2710
2834
  return _exportSceneGLTF.apply(this, arguments);
@@ -2730,33 +2854,33 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2730
2854
  }, {
2731
2855
  key: "exportSceneGLB",
2732
2856
  value: (function () {
2733
- var _exportSceneGLB = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
2857
+ var _exportSceneGLB = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
2734
2858
  var filename,
2735
- _args13 = arguments,
2859
+ _args14 = arguments,
2736
2860
  _t8;
2737
- return _regenerator().w(function (_context13) {
2738
- while (1) switch (_context13.n) {
2861
+ return _regenerator().w(function (_context14) {
2862
+ while (1) switch (_context14.n) {
2739
2863
  case 0:
2740
- filename = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : null;
2864
+ filename = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : null;
2741
2865
  if (this.managers.sceneExportManager) {
2742
- _context13.n = 1;
2866
+ _context14.n = 1;
2743
2867
  break;
2744
2868
  }
2745
2869
  console.error('❌ Scene export manager not available');
2746
- return _context13.a(2, false);
2870
+ return _context14.a(2, false);
2747
2871
  case 1:
2748
- _context13.p = 1;
2749
- _context13.n = 2;
2872
+ _context14.p = 1;
2873
+ _context14.n = 2;
2750
2874
  return this.managers.sceneExportManager.exportSceneAsGLB(filename);
2751
2875
  case 2:
2752
- return _context13.a(2, _context13.v);
2876
+ return _context14.a(2, _context14.v);
2753
2877
  case 3:
2754
- _context13.p = 3;
2755
- _t8 = _context13.v;
2878
+ _context14.p = 3;
2879
+ _t8 = _context14.v;
2756
2880
  console.error('❌ Error exporting scene as GLB:', _t8);
2757
- return _context13.a(2, false);
2881
+ return _context14.a(2, false);
2758
2882
  }
2759
- }, _callee13, this, [[1, 3]]);
2883
+ }, _callee14, this, [[1, 3]]);
2760
2884
  }));
2761
2885
  function exportSceneGLB() {
2762
2886
  return _exportSceneGLB.apply(this, arguments);
@@ -2795,16 +2919,16 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2795
2919
  }, {
2796
2920
  key: "loadSceneFromData",
2797
2921
  value: (function () {
2798
- var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(sceneData) {
2799
- return _regenerator().w(function (_context14) {
2800
- while (1) switch (_context14.n) {
2922
+ var _loadSceneFromData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(sceneData) {
2923
+ return _regenerator().w(function (_context15) {
2924
+ while (1) switch (_context15.n) {
2801
2925
  case 0:
2802
- _context14.n = 1;
2926
+ _context15.n = 1;
2803
2927
  return this.setImportedSceneData(sceneData);
2804
2928
  case 1:
2805
- return _context14.a(2, true);
2929
+ return _context15.a(2, true);
2806
2930
  }
2807
- }, _callee14, this);
2931
+ }, _callee15, this);
2808
2932
  }));
2809
2933
  function loadSceneFromData(_x7) {
2810
2934
  return _loadSceneFromData.apply(this, arguments);
@@ -2829,9 +2953,9 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
2829
2953
  }, {
2830
2954
  key: "clearScene",
2831
2955
  value: function clearScene() {
2832
- var _this$sceneViewer12;
2956
+ var _this$sceneViewer13;
2833
2957
  this.importedSceneData = null;
2834
- 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;
2958
+ 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;
2835
2959
  if (ioBehavMgr) {
2836
2960
  ioBehavMgr.setCrossComponentBehaviors([]);
2837
2961
  }