@thatopen/components 2.4.9 → 2.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -6590,7 +6590,7 @@ const _Components = class _Components {
6590
6590
  /**
6591
6591
  * The version of the @thatopen/components library.
6592
6592
  */
6593
- __publicField(_Components, "release", "2.4.9");
6593
+ __publicField(_Components, "release", "2.4.11");
6594
6594
  let Components = _Components;
6595
6595
  class SimpleWorld extends Base {
6596
6596
  constructor() {
@@ -7372,11 +7372,10 @@ class EventDispatcher {
7372
7372
  }
7373
7373
  }
7374
7374
  }
7375
- const VERSION = "2.7.3";
7375
+ var _a;
7376
+ const VERSION = "2.9.0";
7376
7377
  const TOUCH_DOLLY_FACTOR = 1 / 8;
7377
- const isBrowser = typeof window !== "undefined";
7378
- const isMac = isBrowser && /Mac/.test(navigator.platform);
7379
- const isPointerEventsNotSupported = !(isBrowser && "PointerEvent" in window);
7378
+ const isMac = /Mac/.test((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator) === null || _a === void 0 ? void 0 : _a.platform);
7380
7379
  let THREE;
7381
7380
  let _ORIGIN;
7382
7381
  let _AXIS_Y;
@@ -7680,37 +7679,6 @@ class CameraControls extends EventDispatcher {
7680
7679
  this._isDragging = true;
7681
7680
  startDragging(event);
7682
7681
  };
7683
- const onMouseDown = (event) => {
7684
- if (!this._enabled || !this._domElement || this._lockedPointer)
7685
- return;
7686
- if (this._interactiveArea.left !== 0 || this._interactiveArea.top !== 0 || this._interactiveArea.width !== 1 || this._interactiveArea.height !== 1) {
7687
- const elRect = this._domElement.getBoundingClientRect();
7688
- const left = event.clientX / elRect.width;
7689
- const top = event.clientY / elRect.height;
7690
- if (left < this._interactiveArea.left || left > this._interactiveArea.right || top < this._interactiveArea.top || top > this._interactiveArea.bottom)
7691
- return;
7692
- }
7693
- const mouseButton = (event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT ? MOUSE_BUTTON.LEFT : (event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.MIDDLE ? MOUSE_BUTTON.MIDDLE : (event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.RIGHT ? MOUSE_BUTTON.RIGHT : null;
7694
- if (mouseButton !== null) {
7695
- const zombiePointer = this._findPointerByMouseButton(mouseButton);
7696
- zombiePointer && this._disposePointer(zombiePointer);
7697
- }
7698
- const pointer = {
7699
- pointerId: 1,
7700
- clientX: event.clientX,
7701
- clientY: event.clientY,
7702
- deltaX: 0,
7703
- deltaY: 0,
7704
- mouseButton: (event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT ? MOUSE_BUTTON.LEFT : (event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.LEFT ? MOUSE_BUTTON.MIDDLE : (event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.LEFT ? MOUSE_BUTTON.RIGHT : null
7705
- };
7706
- this._activePointers.push(pointer);
7707
- this._domElement.ownerDocument.removeEventListener("mousemove", onMouseMove);
7708
- this._domElement.ownerDocument.removeEventListener("mouseup", onMouseUp);
7709
- this._domElement.ownerDocument.addEventListener("mousemove", onMouseMove);
7710
- this._domElement.ownerDocument.addEventListener("mouseup", onMouseUp);
7711
- this._isDragging = true;
7712
- startDragging(event);
7713
- };
7714
7682
  const onPointerMove2 = (event) => {
7715
7683
  if (event.cancelable)
7716
7684
  event.preventDefault();
@@ -7748,26 +7716,6 @@ class CameraControls extends EventDispatcher {
7748
7716
  }
7749
7717
  dragging();
7750
7718
  };
7751
- const onMouseMove = (event) => {
7752
- const pointer = this._lockedPointer || this._findPointerById(1);
7753
- if (!pointer)
7754
- return;
7755
- pointer.clientX = event.clientX;
7756
- pointer.clientY = event.clientY;
7757
- pointer.deltaX = event.movementX;
7758
- pointer.deltaY = event.movementY;
7759
- this._state = 0;
7760
- if (this._lockedPointer || (event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT) {
7761
- this._state = this._state | this.mouseButtons.left;
7762
- }
7763
- if ((event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.MIDDLE) {
7764
- this._state = this._state | this.mouseButtons.middle;
7765
- }
7766
- if ((event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.RIGHT) {
7767
- this._state = this._state | this.mouseButtons.right;
7768
- }
7769
- dragging();
7770
- };
7771
7719
  const onPointerUp2 = (event) => {
7772
7720
  const pointer = this._findPointerById(event.pointerId);
7773
7721
  if (pointer && pointer === this._lockedPointer)
@@ -7793,14 +7741,6 @@ class CameraControls extends EventDispatcher {
7793
7741
  }
7794
7742
  endDragging();
7795
7743
  };
7796
- const onMouseUp = () => {
7797
- const pointer = this._findPointerById(1);
7798
- if (pointer && pointer === this._lockedPointer)
7799
- return;
7800
- pointer && this._disposePointer(pointer);
7801
- this._state = ACTION.NONE;
7802
- endDragging();
7803
- };
7804
7744
  let lastScrollTimeStamp = -1;
7805
7745
  const onMouseWheel = (event) => {
7806
7746
  if (!this._domElement)
@@ -7858,13 +7798,11 @@ class CameraControls extends EventDispatcher {
7858
7798
  if (!this._domElement || !this._enabled)
7859
7799
  return;
7860
7800
  if (this.mouseButtons.right === CameraControls.ACTION.NONE) {
7861
- const pointerId = event instanceof PointerEvent ? event.pointerId : event instanceof MouseEvent ? 0 : 0;
7801
+ const pointerId = event instanceof PointerEvent ? event.pointerId : 0;
7862
7802
  const pointer = this._findPointerById(pointerId);
7863
7803
  pointer && this._disposePointer(pointer);
7864
7804
  this._domElement.ownerDocument.removeEventListener("pointermove", onPointerMove2, { passive: false });
7865
7805
  this._domElement.ownerDocument.removeEventListener("pointerup", onPointerUp2);
7866
- this._domElement.ownerDocument.removeEventListener("mousemove", onMouseMove);
7867
- this._domElement.ownerDocument.removeEventListener("mouseup", onMouseUp);
7868
7806
  return;
7869
7807
  }
7870
7808
  event.preventDefault();
@@ -7942,7 +7880,7 @@ class CameraControls extends EventDispatcher {
7942
7880
  return;
7943
7881
  this._dragNeedsUpdate = false;
7944
7882
  extractClientCoordFromEvent(this._activePointers, _v2$1);
7945
- const isPointerLockActive = this._domElement && document.pointerLockElement === this._domElement;
7883
+ const isPointerLockActive = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement;
7946
7884
  const lockedPointer = isPointerLockActive ? this._lockedPointer || this._activePointers[0] : null;
7947
7885
  const deltaX = lockedPointer ? -lockedPointer.deltaX : lastDragPosition.x - _v2$1.x;
7948
7886
  const deltaY = lockedPointer ? -lockedPointer.deltaY : lastDragPosition.y - _v2$1.y;
@@ -7998,9 +7936,7 @@ class CameraControls extends EventDispatcher {
7998
7936
  }
7999
7937
  if (this._activePointers.length === 0 && this._domElement) {
8000
7938
  this._domElement.ownerDocument.removeEventListener("pointermove", onPointerMove2, { passive: false });
8001
- this._domElement.ownerDocument.removeEventListener("mousemove", onMouseMove);
8002
7939
  this._domElement.ownerDocument.removeEventListener("pointerup", onPointerUp2);
8003
- this._domElement.ownerDocument.removeEventListener("mouseup", onMouseUp);
8004
7940
  this.dispatchEvent({ type: "controlend" });
8005
7941
  }
8006
7942
  };
@@ -8027,16 +7963,15 @@ class CameraControls extends EventDispatcher {
8027
7963
  startDragging();
8028
7964
  };
8029
7965
  this.unlockPointer = () => {
7966
+ var _a2, _b, _c;
8030
7967
  if (this._lockedPointer !== null) {
8031
7968
  this._disposePointer(this._lockedPointer);
8032
7969
  this._lockedPointer = null;
8033
7970
  }
8034
- document.exitPointerLock();
7971
+ (_a2 = this._domElement) === null || _a2 === void 0 ? void 0 : _a2.ownerDocument.exitPointerLock();
7972
+ (_b = this._domElement) === null || _b === void 0 ? void 0 : _b.ownerDocument.removeEventListener("pointerlockchange", onPointerLockChange);
7973
+ (_c = this._domElement) === null || _c === void 0 ? void 0 : _c.ownerDocument.removeEventListener("pointerlockerror", onPointerLockError);
8035
7974
  this.cancel();
8036
- if (!this._domElement)
8037
- return;
8038
- this._domElement.ownerDocument.removeEventListener("pointerlockchange", onPointerLockChange);
8039
- this._domElement.ownerDocument.removeEventListener("pointerlockerror", onPointerLockError);
8040
7975
  };
8041
7976
  const onPointerLockChange = () => {
8042
7977
  const isPointerLockActive = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement;
@@ -8052,7 +7987,6 @@ class CameraControls extends EventDispatcher {
8052
7987
  this._domElement.style.userSelect = "none";
8053
7988
  this._domElement.style.webkitUserSelect = "none";
8054
7989
  this._domElement.addEventListener("pointerdown", onPointerDown2);
8055
- isPointerEventsNotSupported && this._domElement.addEventListener("mousedown", onMouseDown);
8056
7990
  this._domElement.addEventListener("pointercancel", onPointerUp2);
8057
7991
  this._domElement.addEventListener("wheel", onMouseWheel, { passive: false });
8058
7992
  this._domElement.addEventListener("contextmenu", onContextMenu);
@@ -8064,14 +7998,11 @@ class CameraControls extends EventDispatcher {
8064
7998
  this._domElement.style.userSelect = "";
8065
7999
  this._domElement.style.webkitUserSelect = "";
8066
8000
  this._domElement.removeEventListener("pointerdown", onPointerDown2);
8067
- this._domElement.removeEventListener("mousedown", onMouseDown);
8068
8001
  this._domElement.removeEventListener("pointercancel", onPointerUp2);
8069
8002
  this._domElement.removeEventListener("wheel", onMouseWheel, { passive: false });
8070
8003
  this._domElement.removeEventListener("contextmenu", onContextMenu);
8071
8004
  this._domElement.ownerDocument.removeEventListener("pointermove", onPointerMove2, { passive: false });
8072
- this._domElement.ownerDocument.removeEventListener("mousemove", onMouseMove);
8073
8005
  this._domElement.ownerDocument.removeEventListener("pointerup", onPointerUp2);
8074
- this._domElement.ownerDocument.removeEventListener("mouseup", onMouseUp);
8075
8006
  this._domElement.ownerDocument.removeEventListener("pointerlockchange", onPointerLockChange);
8076
8007
  this._domElement.ownerDocument.removeEventListener("pointerlockerror", onPointerLockError);
8077
8008
  };
@@ -8503,7 +8434,7 @@ class CameraControls extends EventDispatcher {
8503
8434
  lookInDirectionOf(x, y, z, enableTransition = false) {
8504
8435
  const point = _v3A.set(x, y, z);
8505
8436
  const direction = point.sub(this._targetEnd).normalize();
8506
- const position = direction.multiplyScalar(-this._sphericalEnd.radius);
8437
+ const position = direction.multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
8507
8438
  return this.setPosition(position.x, position.y, position.z, enableTransition);
8508
8439
  }
8509
8440
  /**
@@ -8588,8 +8519,8 @@ class CameraControls extends EventDispatcher {
8588
8519
  */
8589
8520
  fitToSphere(sphereOrMesh, enableTransition) {
8590
8521
  const promises = [];
8591
- const isSphere = sphereOrMesh instanceof THREE.Sphere;
8592
- const boundingSphere = isSphere ? _sphere.copy(sphereOrMesh) : CameraControls.createBoundingSphere(sphereOrMesh, _sphere);
8522
+ const isObject3D = "isObject3D" in sphereOrMesh;
8523
+ const boundingSphere = isObject3D ? CameraControls.createBoundingSphere(sphereOrMesh, _sphere) : _sphere.copy(sphereOrMesh);
8593
8524
  promises.push(this.moveTo(boundingSphere.center.x, boundingSphere.center.y, boundingSphere.center.z, enableTransition));
8594
8525
  if (isPerspectiveCamera(this._camera)) {
8595
8526
  const distanceToFit = this.getDistanceToFitSphere(boundingSphere.radius);
@@ -8842,7 +8773,7 @@ class CameraControls extends EventDispatcher {
8842
8773
  * @category Methods
8843
8774
  */
8844
8775
  getSpherical(out, receiveEndValue = true) {
8845
- const _out = !!out && out instanceof THREE.Spherical ? out : new THREE.Spherical();
8776
+ const _out = out || new THREE.Spherical();
8846
8777
  return _out.copy(receiveEndValue ? this._sphericalEnd : this._spherical);
8847
8778
  }
8848
8779
  /**
@@ -8865,6 +8796,15 @@ class CameraControls extends EventDispatcher {
8865
8796
  this._sphericalEnd.theta += PI_2;
8866
8797
  this._spherical.theta += PI_2 * Math.round((this._sphericalEnd.theta - this._spherical.theta) / PI_2);
8867
8798
  }
8799
+ /**
8800
+ * stop all transitions.
8801
+ */
8802
+ stop() {
8803
+ this._focalOffset.copy(this._focalOffsetEnd);
8804
+ this._target.copy(this._targetEnd);
8805
+ this._spherical.copy(this._sphericalEnd);
8806
+ this._zoom = this._zoomEnd;
8807
+ }
8868
8808
  /**
8869
8809
  * Reset all rotation and position to defaults.
8870
8810
  * @param enableTransition
@@ -9385,14 +9325,14 @@ class SimpleCamera extends BaseCamera {
9385
9325
  * {@link Components.renderer}.
9386
9326
  */
9387
9327
  __publicField(this, "updateAspect", () => {
9388
- var _a;
9328
+ var _a2;
9389
9329
  if (!this.currentWorld || !this.currentWorld.renderer)
9390
9330
  return;
9391
9331
  if (this.three instanceof THREE$1.OrthographicCamera) {
9392
9332
  this.onAspectUpdated.trigger();
9393
9333
  return;
9394
9334
  }
9395
- if ((_a = this.currentWorld.renderer) == null ? void 0 : _a.isResizeable()) {
9335
+ if ((_a2 = this.currentWorld.renderer) == null ? void 0 : _a2.isResizeable()) {
9396
9336
  const size = this.currentWorld.renderer.getSize();
9397
9337
  this.three.aspect = size.width / size.height;
9398
9338
  this.three.updateProjectionMatrix();
@@ -12869,12 +12809,12 @@ const _Clipper = class _Clipper extends Component {
12869
12809
  return meshes;
12870
12810
  }
12871
12811
  createPlaneFromIntersection(world, intersect) {
12872
- var _a;
12812
+ var _a2;
12873
12813
  if (!world.renderer) {
12874
12814
  throw new Error("The given world must have a renderer!");
12875
12815
  }
12876
12816
  const constant = intersect.point.distanceTo(new THREE$1.Vector3(0, 0, 0));
12877
- const normal = (_a = intersect.face) == null ? void 0 : _a.normal;
12817
+ const normal = (_a2 = intersect.face) == null ? void 0 : _a2.normal;
12878
12818
  if (!constant || !normal) {
12879
12819
  return null;
12880
12820
  }
@@ -14782,7 +14722,7 @@ const IfcCategoryMap = {
14782
14722
  };
14783
14723
  class IfcPropertiesUtils {
14784
14724
  static async getUnits(group) {
14785
- var _a, _b, _c;
14725
+ var _a2, _b, _c;
14786
14726
  const { IFCUNITASSIGNMENT } = WEBIFC;
14787
14727
  const allUnitsSets = await group.getAllPropertiesOfType(IFCUNITASSIGNMENT);
14788
14728
  if (!allUnitsSets) {
@@ -14808,7 +14748,7 @@ class IfcPropertiesUtils {
14808
14748
  if (unit.Name.value === "FOOT") {
14809
14749
  unitValue = 0.3048;
14810
14750
  }
14811
- if (((_a = unit.Prefix) == null ? void 0 : _a.value) === "MILLI") {
14751
+ if (((_a2 = unit.Prefix) == null ? void 0 : _a2.value) === "MILLI") {
14812
14752
  factor = 1e-3;
14813
14753
  } else if (((_b = unit.Prefix) == null ? void 0 : _b.value) === "CENTI") {
14814
14754
  factor = 0.01;
@@ -14820,18 +14760,18 @@ class IfcPropertiesUtils {
14820
14760
  return 1;
14821
14761
  }
14822
14762
  static async findItemByGuid(model, guid) {
14823
- var _a;
14763
+ var _a2;
14824
14764
  const ids = model.getAllPropertiesIDs();
14825
14765
  for (const id of ids) {
14826
14766
  const property = await model.getProperties(id);
14827
- if (property && ((_a = property.GlobalId) == null ? void 0 : _a.value) === guid) {
14767
+ if (property && ((_a2 = property.GlobalId) == null ? void 0 : _a2.value) === guid) {
14828
14768
  return property;
14829
14769
  }
14830
14770
  }
14831
14771
  return null;
14832
14772
  }
14833
14773
  static async getRelationMap(model, relationType, onElementsFound) {
14834
- var _a;
14774
+ var _a2;
14835
14775
  const defaultCallback = async () => {
14836
14776
  };
14837
14777
  const _onElementsFound = onElementsFound ?? defaultCallback;
@@ -14851,7 +14791,7 @@ class IfcPropertiesUtils {
14851
14791
  );
14852
14792
  if (!(isRelation && relatingKey && relatedKey))
14853
14793
  continue;
14854
- const relating = await model.getProperties((_a = prop[relatingKey]) == null ? void 0 : _a.value);
14794
+ const relating = await model.getProperties((_a2 = prop[relatingKey]) == null ? void 0 : _a2.value);
14855
14795
  const related = prop[relatedKey];
14856
14796
  if (!relating || !related) {
14857
14797
  continue;
@@ -14899,7 +14839,7 @@ class IfcPropertiesUtils {
14899
14839
  return props.filter((prop) => prop !== null);
14900
14840
  }
14901
14841
  static async getPsetRel(model, psetID) {
14902
- var _a;
14842
+ var _a2;
14903
14843
  const prop = await model.getProperties(psetID);
14904
14844
  if (!prop) {
14905
14845
  return null;
@@ -14913,7 +14853,7 @@ class IfcPropertiesUtils {
14913
14853
  const allRels = Object.values(allPropsRels);
14914
14854
  let found = null;
14915
14855
  for (const rel of allRels) {
14916
- if (((_a = rel.RelatingPropertyDefinition) == null ? void 0 : _a.value) === psetID) {
14856
+ if (((_a2 = rel.RelatingPropertyDefinition) == null ? void 0 : _a2.value) === psetID) {
14917
14857
  found = rel.expressID;
14918
14858
  }
14919
14859
  }
@@ -14923,13 +14863,13 @@ class IfcPropertiesUtils {
14923
14863
  return IfcPropertiesUtils.getPsetRel(model, qsetID);
14924
14864
  }
14925
14865
  static async getEntityName(model, entityID) {
14926
- var _a;
14866
+ var _a2;
14927
14867
  const entity = await model.getProperties(entityID);
14928
14868
  if (!entity) {
14929
14869
  return { key: null, name: null };
14930
14870
  }
14931
14871
  const key = Object.keys(entity).find((key2) => key2.endsWith("Name")) ?? null;
14932
- const name = key ? (_a = entity[key]) == null ? void 0 : _a.value : null;
14872
+ const name = key ? (_a2 = entity[key]) == null ? void 0 : _a2.value : null;
14933
14873
  return { key, name };
14934
14874
  }
14935
14875
  static async getQuantityValue(model, quantityID) {
@@ -14960,7 +14900,7 @@ class IfcPropertiesUtils {
14960
14900
  return Object.keys(entity).includes(attribute);
14961
14901
  }
14962
14902
  static async groupEntitiesByType(model, expressIDs) {
14963
- var _a;
14903
+ var _a2;
14964
14904
  const categoriesMap = /* @__PURE__ */ new Map();
14965
14905
  for (const expressID of expressIDs) {
14966
14906
  const entity = await model.getProperties(expressID);
@@ -14971,7 +14911,7 @@ class IfcPropertiesUtils {
14971
14911
  const set = categoriesMap.get(key);
14972
14912
  if (!set)
14973
14913
  categoriesMap.set(key, /* @__PURE__ */ new Set());
14974
- (_a = categoriesMap.get(key)) == null ? void 0 : _a.add(expressID);
14914
+ (_a2 = categoriesMap.get(key)) == null ? void 0 : _a2.add(expressID);
14975
14915
  }
14976
14916
  return categoriesMap;
14977
14917
  }
@@ -16146,7 +16086,7 @@ class Units {
16146
16086
  matrix.copy(result);
16147
16087
  }
16148
16088
  setUp(webIfc) {
16149
- var _a, _b, _c;
16089
+ var _a2, _b, _c;
16150
16090
  this.factor = 1;
16151
16091
  const length = this.getLengthUnits(webIfc);
16152
16092
  if (!length) {
@@ -16160,7 +16100,7 @@ class Units {
16160
16100
  if (length.Name.value === "FOOT") {
16161
16101
  this.factor = 0.3048;
16162
16102
  }
16163
- if (((_a = length.Prefix) == null ? void 0 : _a.value) === "MILLI") {
16103
+ if (((_a2 = length.Prefix) == null ? void 0 : _a2.value) === "MILLI") {
16164
16104
  this.complement = 1e-3;
16165
16105
  } else if (((_b = length.Prefix) == null ? void 0 : _b.value) === "CENTI") {
16166
16106
  this.complement = 0.01;
@@ -16418,7 +16358,7 @@ class CivilReader {
16418
16358
  }
16419
16359
  class IfcMetadataReader {
16420
16360
  getNameInfo(webIfc) {
16421
- var _a;
16361
+ var _a2;
16422
16362
  const data = {};
16423
16363
  const { arguments: dataArguments } = webIfc.GetHeaderLine(0, WEBIFC.FILE_NAME) || {};
16424
16364
  if (!dataArguments)
@@ -16444,7 +16384,7 @@ class IfcMetadataReader {
16444
16384
  if (authorEmail == null ? void 0 : authorEmail.value)
16445
16385
  data.author.email = authorEmail.value;
16446
16386
  }
16447
- if (organization && ((_a = organization[0]) == null ? void 0 : _a.value)) {
16387
+ if (organization && ((_a2 = organization[0]) == null ? void 0 : _a2.value)) {
16448
16388
  data.organization = organization[0].value;
16449
16389
  }
16450
16390
  if (preprocessorVersion == null ? void 0 : preprocessorVersion.value) {
@@ -16459,13 +16399,13 @@ class IfcMetadataReader {
16459
16399
  return data;
16460
16400
  }
16461
16401
  getDescriptionInfo(webIfc) {
16462
- var _a;
16402
+ var _a2;
16463
16403
  const data = {};
16464
16404
  const { arguments: dataArguments } = webIfc.GetHeaderLine(0, WEBIFC.FILE_DESCRIPTION) || {};
16465
16405
  if (!dataArguments)
16466
16406
  return data;
16467
16407
  const [description, implementationLevel] = dataArguments;
16468
- if (Array.isArray(description) && ((_a = description[0]) == null ? void 0 : _a.value)) {
16408
+ if (Array.isArray(description) && ((_a2 = description[0]) == null ? void 0 : _a2.value)) {
16469
16409
  const viewDefinition = description[0].value.match(/\[([^\]]+)\]/);
16470
16410
  if (viewDefinition && viewDefinition[1]) {
16471
16411
  data.viewDefinition = viewDefinition[1];
@@ -22696,12 +22636,12 @@ class Comment {
22696
22636
  * @param value - The new comment text.
22697
22637
  */
22698
22638
  set comment(value) {
22699
- var _a;
22639
+ var _a2;
22700
22640
  const manager = this._components.get(BCFTopics);
22701
22641
  this._comment = value;
22702
22642
  this.modifiedDate = /* @__PURE__ */ new Date();
22703
22643
  this.modifiedAuthor = manager.config.author;
22704
- (_a = this.topic) == null ? void 0 : _a.comments.set(this.guid, this);
22644
+ (_a2 = this.topic) == null ? void 0 : _a2.comments.set(this.guid, this);
22705
22645
  }
22706
22646
  /**
22707
22647
  * Gets the comment text.
@@ -23584,12 +23524,12 @@ ${users}
23584
23524
  return comment;
23585
23525
  }
23586
23526
  getMarkupComments(markup, version) {
23587
- var _a;
23527
+ var _a2;
23588
23528
  let data;
23589
23529
  if (version === "2.1")
23590
23530
  data = markup.Comment;
23591
23531
  if (version === "3")
23592
- data = (_a = markup.Topic.Comments) == null ? void 0 : _a.Comment;
23532
+ data = (_a2 = markup.Topic.Comments) == null ? void 0 : _a2.Comment;
23593
23533
  if (!data)
23594
23534
  return [];
23595
23535
  data = Array.isArray(data) ? data : [data];
@@ -23598,36 +23538,36 @@ ${users}
23598
23538
  return array;
23599
23539
  }
23600
23540
  getMarkupLabels(markup, version) {
23601
- var _a;
23541
+ var _a2;
23602
23542
  let data;
23603
23543
  if (version === "2.1")
23604
23544
  data = markup.Topic.Labels;
23605
23545
  if (version === "3")
23606
- data = (_a = markup.Topic.Labels) == null ? void 0 : _a.Label;
23546
+ data = (_a2 = markup.Topic.Labels) == null ? void 0 : _a2.Label;
23607
23547
  if (!data)
23608
23548
  return [];
23609
23549
  const labels = Array.isArray(data) ? data : [data];
23610
23550
  return labels;
23611
23551
  }
23612
23552
  getMarkupViewpoints(markup, version) {
23613
- var _a;
23553
+ var _a2;
23614
23554
  let data;
23615
23555
  if (version === "2.1")
23616
23556
  data = markup.Viewpoints;
23617
23557
  if (version === "3")
23618
- data = (_a = markup.Topic.Viewpoints) == null ? void 0 : _a.ViewPoint;
23558
+ data = (_a2 = markup.Topic.Viewpoints) == null ? void 0 : _a2.ViewPoint;
23619
23559
  if (!data)
23620
23560
  return [];
23621
23561
  data = Array.isArray(data) ? data : [data];
23622
23562
  return data;
23623
23563
  }
23624
23564
  getMarkupRelatedTopics(markup, version) {
23625
- var _a;
23565
+ var _a2;
23626
23566
  let data;
23627
23567
  if (version === "2.1")
23628
23568
  data = markup.Topic.RelatedTopic;
23629
23569
  if (version === "3")
23630
- data = (_a = markup.Topic.RelatedTopics) == null ? void 0 : _a.RelatedTopic;
23570
+ data = (_a2 = markup.Topic.RelatedTopics) == null ? void 0 : _a2.RelatedTopic;
23631
23571
  if (!data)
23632
23572
  return [];
23633
23573
  const topics = Array.isArray(data) ? data : [data];
@@ -23644,7 +23584,7 @@ ${users}
23644
23584
  * @throws An error if the BCF version is not supported.
23645
23585
  */
23646
23586
  async load(data, world) {
23647
- var _a;
23587
+ var _a2;
23648
23588
  const {
23649
23589
  fallbackVersionOnImport,
23650
23590
  ignoreIncompleteTopicsOnImport,
@@ -23709,7 +23649,7 @@ ${users}
23709
23649
  ViewSetupHints = Components2.ViewSetupHints;
23710
23650
  }
23711
23651
  if (version === "3") {
23712
- ViewSetupHints = (_a = Components2.Visibility) == null ? void 0 : _a.ViewSetupHints;
23652
+ ViewSetupHints = (_a2 = Components2.Visibility) == null ? void 0 : _a2.ViewSetupHints;
23713
23653
  }
23714
23654
  if (ViewSetupHints) {
23715
23655
  if ("OpeningsVisible" in ViewSetupHints) {
@@ -25181,7 +25121,7 @@ const _Classifier = class _Classifier extends Component {
25181
25121
  * @throws Will throw an error if the fragment ID is not found.
25182
25122
  */
25183
25123
  async byPredefinedType(group) {
25184
- var _a;
25124
+ var _a2;
25185
25125
  if (!this.list.predefinedTypes) {
25186
25126
  this.list.predefinedTypes = {};
25187
25127
  }
@@ -25191,7 +25131,7 @@ const _Classifier = class _Classifier extends Component {
25191
25131
  const entity = await group.getProperties(id);
25192
25132
  if (!entity)
25193
25133
  continue;
25194
- const predefinedType = String((_a = entity.PredefinedType) == null ? void 0 : _a.value).toUpperCase();
25134
+ const predefinedType = String((_a2 = entity.PredefinedType) == null ? void 0 : _a2.value).toUpperCase();
25195
25135
  if (!currentTypes[predefinedType]) {
25196
25136
  currentTypes[predefinedType] = {
25197
25137
  map: {},
@@ -25294,7 +25234,7 @@ const _Classifier = class _Classifier extends Component {
25294
25234
  * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
25295
25235
  */
25296
25236
  async bySpatialStructure(model, config = {}) {
25297
- var _a, _b;
25237
+ var _a2, _b;
25298
25238
  const indexer = this.components.get(IfcRelationsIndexer);
25299
25239
  const modelRelations = indexer.relationMaps[model.uuid];
25300
25240
  if (!modelRelations) {
@@ -25328,7 +25268,7 @@ const _Classifier = class _Classifier extends Component {
25328
25268
  if (!spatialRelAttrs) {
25329
25269
  continue;
25330
25270
  }
25331
- relName2 = (_a = spatialRelAttrs.Name) == null ? void 0 : _a.value;
25271
+ relName2 = (_a2 = spatialRelAttrs.Name) == null ? void 0 : _a2.value;
25332
25272
  }
25333
25273
  this.saveItem(model, systemName, relName2, expressID, id);
25334
25274
  }
@@ -26593,7 +26533,7 @@ class Viewpoint {
26593
26533
  }
26594
26534
  }
26595
26535
  async createComponentTags(from) {
26596
- var _a, _b;
26536
+ var _a2, _b;
26597
26537
  const fragments = this._components.get(FragmentsManager);
26598
26538
  const manager = this._components.get(BCFTopics);
26599
26539
  let tags = "";
@@ -26608,7 +26548,7 @@ class Viewpoint {
26608
26548
  const attrs = await model.getProperties(expressID);
26609
26549
  if (!attrs)
26610
26550
  continue;
26611
- const globalID = (_a = attrs.GlobalId) == null ? void 0 : _a.value;
26551
+ const globalID = (_a2 = attrs.GlobalId) == null ? void 0 : _a2.value;
26612
26552
  if (!globalID)
26613
26553
  continue;
26614
26554
  const tag = (_b = attrs.Tag) == null ? void 0 : _b.value;
@@ -27781,14 +27721,14 @@ class IDSAttribute extends IDSFacet {
27781
27721
  // All invalid cases have been treated as failures
27782
27722
  // FragmentsGroup do not hold some of the entities used in the tests
27783
27723
  async test(entities) {
27784
- var _a;
27724
+ var _a2;
27785
27725
  this.testResult = [];
27786
27726
  for (const _expressID in entities) {
27787
27727
  const expressID = Number(_expressID);
27788
27728
  const attrs = entities[expressID];
27789
27729
  const checks = [];
27790
27730
  const result2 = {
27791
- guid: (_a = attrs.GlobalId) == null ? void 0 : _a.value,
27731
+ guid: (_a2 = attrs.GlobalId) == null ? void 0 : _a2.value,
27792
27732
  expressID,
27793
27733
  pass: false,
27794
27734
  checks,
@@ -27882,7 +27822,7 @@ class IDSClassification extends IDSFacet {
27882
27822
  </classification>`;
27883
27823
  }
27884
27824
  async getEntities(model, collector = {}) {
27885
- var _a;
27825
+ var _a2;
27886
27826
  const result = [];
27887
27827
  const references = await model.getAllPropertiesOfType(
27888
27828
  WEBIFC.IFCCLASSIFICATIONREFERENCE
@@ -27897,7 +27837,7 @@ class IDSClassification extends IDSFacet {
27897
27837
  const attrs = await model.getProperties(classificationID);
27898
27838
  if (!attrs)
27899
27839
  continue;
27900
- const referencedSourceID = (_a = attrs.ReferencedSource) == null ? void 0 : _a.value;
27840
+ const referencedSourceID = (_a2 = attrs.ReferencedSource) == null ? void 0 : _a2.value;
27901
27841
  if (!referencedSourceID)
27902
27842
  continue;
27903
27843
  const classificationAttrs = await model.getProperties(referencedSourceID);
@@ -27934,14 +27874,14 @@ class IDSClassification extends IDSFacet {
27934
27874
  return result;
27935
27875
  }
27936
27876
  async test(entities, model) {
27937
- var _a;
27877
+ var _a2;
27938
27878
  this.testResult = [];
27939
27879
  for (const _expressID in entities) {
27940
27880
  const expressID = Number(_expressID);
27941
27881
  const attrs = entities[expressID];
27942
27882
  const checks = [];
27943
27883
  const result2 = {
27944
- guid: (_a = attrs.GlobalId) == null ? void 0 : _a.value,
27884
+ guid: (_a2 = attrs.GlobalId) == null ? void 0 : _a2.value,
27945
27885
  expressID,
27946
27886
  pass: false,
27947
27887
  checks,
@@ -27984,8 +27924,8 @@ class IDSClassification extends IDSFacet {
27984
27924
  return result;
27985
27925
  }
27986
27926
  async processReferencedSource(model, attrs) {
27987
- var _a;
27988
- const sourceID = (_a = attrs.ReferencedSource) == null ? void 0 : _a.value;
27927
+ var _a2;
27928
+ const sourceID = (_a2 = attrs.ReferencedSource) == null ? void 0 : _a2.value;
27989
27929
  if (!sourceID)
27990
27930
  return null;
27991
27931
  const sourceAttrs = await model.getProperties(sourceID);
@@ -28000,7 +27940,7 @@ class IDSClassification extends IDSFacet {
28000
27940
  return sourceAttrs;
28001
27941
  }
28002
27942
  async getSystems(model, expressID) {
28003
- var _a;
27943
+ var _a2;
28004
27944
  const result = [];
28005
27945
  const indexer = this.components.get(IfcRelationsIndexer);
28006
27946
  const ocurrenceAssociations = indexer.getEntityRelations(
@@ -28027,9 +27967,9 @@ class IDSClassification extends IDSFacet {
28027
27967
  }
28028
27968
  }
28029
27969
  const occurrenceSystems = result.map((attrs) => {
28030
- var _a2, _b, _c;
27970
+ var _a3, _b, _c;
28031
27971
  if (attrs.type === WEBIFC.IFCCLASSIFICATION) {
28032
- return (_a2 = attrs.Name) == null ? void 0 : _a2.value;
27972
+ return (_a3 = attrs.Name) == null ? void 0 : _a3.value;
28033
27973
  }
28034
27974
  if (attrs.type === WEBIFC.IFCCLASSIFICATIONREFERENCE) {
28035
27975
  return (_c = (_b = attrs.ReferencedSource) == null ? void 0 : _b.Name) == null ? void 0 : _c.value;
@@ -28051,7 +27991,7 @@ class IDSClassification extends IDSFacet {
28051
27991
  if (!attrs)
28052
27992
  continue;
28053
27993
  if (attrs.type === WEBIFC.IFCCLASSIFICATION) {
28054
- if (occurrenceSystems.includes((_a = attrs.Name) == null ? void 0 : _a.value))
27994
+ if (occurrenceSystems.includes((_a2 = attrs.Name) == null ? void 0 : _a2.value))
28055
27995
  continue;
28056
27996
  result.push(attrs);
28057
27997
  }
@@ -28068,9 +28008,9 @@ class IDSClassification extends IDSFacet {
28068
28008
  return result;
28069
28009
  }
28070
28010
  getSystemName(attrs) {
28071
- var _a, _b, _c, _d;
28011
+ var _a2, _b, _c, _d;
28072
28012
  if (attrs.type === WEBIFC.IFCCLASSIFICATION) {
28073
- return (_a = attrs.Name) == null ? void 0 : _a.value;
28013
+ return (_a2 = attrs.Name) == null ? void 0 : _a2.value;
28074
28014
  }
28075
28015
  if (attrs.type === WEBIFC.IFCCLASSIFICATIONREFERENCE) {
28076
28016
  if (((_b = attrs.ReferencedSource) == null ? void 0 : _b.type) === WEBIFC.IFCCLASSIFICATIONREFERENCE) {
@@ -28126,11 +28066,11 @@ class IDSClassification extends IDSFacet {
28126
28066
  return !!identifier;
28127
28067
  }
28128
28068
  evalURI(attrs, checks) {
28129
- var _a;
28069
+ var _a2;
28130
28070
  if (!this.uri)
28131
28071
  return true;
28132
28072
  const result = this.evalRequirement(
28133
- (_a = attrs.Location) == null ? void 0 : _a.value,
28073
+ (_a2 = attrs.Location) == null ? void 0 : _a2.value,
28134
28074
  {
28135
28075
  type: "simple",
28136
28076
  parameter: this.uri
@@ -28202,14 +28142,14 @@ class IDSEntity extends IDSFacet {
28202
28142
  return result;
28203
28143
  }
28204
28144
  async test(entities, model) {
28205
- var _a;
28145
+ var _a2;
28206
28146
  this.testResult = [];
28207
28147
  for (const _expressID in entities) {
28208
28148
  const expressID = Number(_expressID);
28209
28149
  const attrs = entities[expressID];
28210
28150
  const checks = [];
28211
28151
  const result = {
28212
- guid: (_a = attrs.GlobalId) == null ? void 0 : _a.value,
28152
+ guid: (_a2 = attrs.GlobalId) == null ? void 0 : _a2.value,
28213
28153
  expressID,
28214
28154
  pass: false,
28215
28155
  checks,
@@ -28228,12 +28168,12 @@ class IDSEntity extends IDSFacet {
28228
28168
  return result;
28229
28169
  }
28230
28170
  async evalPredefinedType(model, attrs, checks) {
28231
- var _a, _b, _c, _d;
28171
+ var _a2, _b, _c, _d;
28232
28172
  if (!this.predefinedType)
28233
28173
  return null;
28234
28174
  const indexer = this.components.get(IfcRelationsIndexer);
28235
28175
  const isRequirementUserDefined = typeof this.predefinedType.parameter === "string" && this.predefinedType.parameter === "USERDEFINED";
28236
- let value = (_a = attrs.PredefinedType) == null ? void 0 : _a.value;
28176
+ let value = (_a2 = attrs.PredefinedType) == null ? void 0 : _a2.value;
28237
28177
  if (value === "USERDEFINED" && !isRequirementUserDefined) {
28238
28178
  const attrNames = Object.keys(attrs);
28239
28179
  const result2 = attrNames.find(
@@ -28305,7 +28245,7 @@ class IDSProperty extends IDSFacet {
28305
28245
  </property>`;
28306
28246
  }
28307
28247
  async getEntities(model, collector = {}) {
28308
- var _a, _b;
28248
+ var _a2, _b;
28309
28249
  let sets = {};
28310
28250
  const psets = await model.getAllPropertiesOfType(WEBIFC.IFCPROPERTYSET);
28311
28251
  sets = { ...sets, ...psets };
@@ -28319,7 +28259,7 @@ class IDSProperty extends IDSFacet {
28319
28259
  const attrs = await model.getProperties(setID);
28320
28260
  if (!attrs)
28321
28261
  continue;
28322
- const nameMatches = ((_a = attrs.Name) == null ? void 0 : _a.value) === this.propertySet.parameter;
28262
+ const nameMatches = ((_a2 = attrs.Name) == null ? void 0 : _a2.value) === this.propertySet.parameter;
28323
28263
  if (!nameMatches)
28324
28264
  continue;
28325
28265
  let propsListName;
@@ -28368,14 +28308,14 @@ class IDSProperty extends IDSFacet {
28368
28308
  return [];
28369
28309
  }
28370
28310
  async test(entities, model) {
28371
- var _a;
28311
+ var _a2;
28372
28312
  this.testResult = [];
28373
28313
  for (const _expressID in entities) {
28374
28314
  const expressID = Number(_expressID);
28375
28315
  const attrs = entities[expressID];
28376
28316
  const checks = [];
28377
28317
  const result2 = {
28378
- guid: (_a = attrs.GlobalId) == null ? void 0 : _a.value,
28318
+ guid: (_a2 = attrs.GlobalId) == null ? void 0 : _a2.value,
28379
28319
  expressID,
28380
28320
  pass: false,
28381
28321
  checks,
@@ -28420,12 +28360,12 @@ class IDSProperty extends IDSFacet {
28420
28360
  }
28421
28361
  const items = set.Properties;
28422
28362
  const matchingItems = items.filter((item) => {
28423
- var _a2;
28363
+ var _a3;
28424
28364
  if (this._unsupportedTypes.includes(item.type)) {
28425
28365
  return false;
28426
28366
  }
28427
28367
  const result3 = this.evalRequirement(
28428
- ((_a2 = item.Name) == null ? void 0 : _a2.value) ?? null,
28368
+ ((_a3 = item.Name) == null ? void 0 : _a3.value) ?? null,
28429
28369
  this.baseName,
28430
28370
  "BaseName"
28431
28371
  );
@@ -28474,7 +28414,7 @@ class IDSProperty extends IDSFacet {
28474
28414
  );
28475
28415
  }
28476
28416
  async simplifyPset(model, attrs, propsListName) {
28477
- var _a;
28417
+ var _a2;
28478
28418
  const props = [];
28479
28419
  const list = attrs[propsListName];
28480
28420
  if (!list)
@@ -28485,7 +28425,7 @@ class IDSProperty extends IDSFacet {
28485
28425
  props.push(propAttrs);
28486
28426
  }
28487
28427
  const attrsClone = {
28488
- Name: (_a = attrs.Name) == null ? void 0 : _a.value,
28428
+ Name: (_a2 = attrs.Name) == null ? void 0 : _a2.value,
28489
28429
  Properties: props,
28490
28430
  type: attrs.type
28491
28431
  };
@@ -28512,7 +28452,7 @@ class IDSProperty extends IDSFacet {
28512
28452
  return sets;
28513
28453
  }
28514
28454
  async getPsets(model, expressID) {
28515
- var _a;
28455
+ var _a2;
28516
28456
  const typePsets = await this.getTypePsets(model, expressID);
28517
28457
  const indexer = this.components.get(IfcRelationsIndexer);
28518
28458
  const definitions = indexer.getEntityRelations(
@@ -28540,7 +28480,7 @@ class IDSProperty extends IDSFacet {
28540
28480
  );
28541
28481
  if (typePset) {
28542
28482
  for (const prop of typePset.Properties) {
28543
- const name = (_a = prop.Name) == null ? void 0 : _a.value;
28483
+ const name = (_a2 = prop.Name) == null ? void 0 : _a2.value;
28544
28484
  const existingProp = occurencePset.Properties.find(
28545
28485
  ({ Name }) => Name.value === name
28546
28486
  );