diff --git a/examples/AngleMeasurement/index.html b/examples/AngleMeasurement/index.html index 2ce2ccfe5..e4def9f92 100644 --- a/examples/AngleMeasurement/index.html +++ b/examples/AngleMeasurement/index.html @@ -26,14 +26,14 @@ - + - - + + - + - + diff --git a/examples/AreaMeasurement/index.html b/examples/AreaMeasurement/index.html index e8353f869..5feb9eab8 100644 --- a/examples/AreaMeasurement/index.html +++ b/examples/AreaMeasurement/index.html @@ -26,14 +26,14 @@ - + - - - + + + - - + + diff --git a/examples/BoundingBoxer/index.html b/examples/BoundingBoxer/index.html index b2b9fef10..6a013bd65 100644 --- a/examples/BoundingBoxer/index.html +++ b/examples/BoundingBoxer/index.html @@ -62,7 +62,7 @@ - + diff --git a/examples/Civil3DNavigator/index.html b/examples/Civil3DNavigator/index.html index 6d88290d8..28676e357 100644 --- a/examples/Civil3DNavigator/index.html +++ b/examples/Civil3DNavigator/index.html @@ -25,14 +25,14 @@ - + - - + + - + diff --git a/examples/CivilCrossSectionNavigator/index.html b/examples/CivilCrossSectionNavigator/index.html index a41b56793..f8f6070dc 100644 --- a/examples/CivilCrossSectionNavigator/index.html +++ b/examples/CivilCrossSectionNavigator/index.html @@ -43,19 +43,19 @@ - + - - + + - + - - - - + + + + diff --git a/examples/CivilElevationNavigator/index.html b/examples/CivilElevationNavigator/index.html index 445021517..d77fe3c37 100644 --- a/examples/CivilElevationNavigator/index.html +++ b/examples/CivilElevationNavigator/index.html @@ -44,17 +44,17 @@ - + - - + + - + - - + + diff --git a/examples/CivilPlanNavigator/index.html b/examples/CivilPlanNavigator/index.html index 30615483d..17fd08a22 100644 --- a/examples/CivilPlanNavigator/index.html +++ b/examples/CivilPlanNavigator/index.html @@ -33,17 +33,17 @@ - + - - + + - + - - + + diff --git a/examples/Classifier/index.html b/examples/Classifier/index.html index ff54734a2..ab22e3da4 100644 --- a/examples/Classifier/index.html +++ b/examples/Classifier/index.html @@ -62,7 +62,7 @@ - + diff --git a/examples/Clipper/index.html b/examples/Clipper/index.html index 96327cc7f..45000107e 100644 --- a/examples/Clipper/index.html +++ b/examples/Clipper/index.html @@ -62,7 +62,7 @@ - + diff --git a/examples/Cullers/index.html b/examples/Cullers/index.html index 5abd9b4d9..5a016bc26 100644 --- a/examples/Cullers/index.html +++ b/examples/Cullers/index.html @@ -61,9 +61,9 @@ - + - + diff --git a/examples/EdgeMeasurement/index.html b/examples/EdgeMeasurement/index.html index 1e6f6a8d6..44c1783f1 100644 --- a/examples/EdgeMeasurement/index.html +++ b/examples/EdgeMeasurement/index.html @@ -28,15 +28,15 @@ - + - - - + + + - - - + + + diff --git a/examples/EdgesClipper/index.html b/examples/EdgesClipper/index.html index f0f564d17..e28c4d4c2 100644 --- a/examples/EdgesClipper/index.html +++ b/examples/EdgesClipper/index.html @@ -29,11 +29,11 @@ - + - - - + + + diff --git a/examples/Exploder/index.html b/examples/Exploder/index.html index a83a75bc3..8835c4139 100644 --- a/examples/Exploder/index.html +++ b/examples/Exploder/index.html @@ -62,7 +62,7 @@ - + diff --git a/examples/FaceMeasurement/index.html b/examples/FaceMeasurement/index.html index 5de193dc5..d9e07af6f 100644 --- a/examples/FaceMeasurement/index.html +++ b/examples/FaceMeasurement/index.html @@ -51,11 +51,11 @@ - + - - - + + + diff --git a/examples/FragmentsManager/index.html b/examples/FragmentsManager/index.html index 91dc04be0..67ecb9717 100644 --- a/examples/FragmentsManager/index.html +++ b/examples/FragmentsManager/index.html @@ -61,7 +61,7 @@ - + diff --git a/examples/Grids/index.html b/examples/Grids/index.html index 19e201d77..7e47fbc05 100644 --- a/examples/Grids/index.html +++ b/examples/Grids/index.html @@ -65,7 +65,7 @@ - + diff --git a/examples/Hider/index.html b/examples/Hider/index.html index 5a28d1b35..8685e591a 100644 --- a/examples/Hider/index.html +++ b/examples/Hider/index.html @@ -62,7 +62,7 @@ - + diff --git a/examples/Highlighter/index.html b/examples/Highlighter/index.html index 40e7a6208..afb68a338 100644 --- a/examples/Highlighter/index.html +++ b/examples/Highlighter/index.html @@ -26,9 +26,9 @@ - + - + diff --git a/examples/IfcGeometryTiler/index.html b/examples/IfcGeometryTiler/index.html index a35f6fc51..60589d746 100644 --- a/examples/IfcGeometryTiler/index.html +++ b/examples/IfcGeometryTiler/index.html @@ -29,7 +29,7 @@ - + diff --git a/examples/IfcJsonExporter/index.html b/examples/IfcJsonExporter/index.html index 980dcd615..29e2b8579 100644 --- a/examples/IfcJsonExporter/index.html +++ b/examples/IfcJsonExporter/index.html @@ -29,10 +29,10 @@ - + - - + + diff --git a/examples/IfcLoader/index.html b/examples/IfcLoader/index.html index 733a74495..8c17dabcb 100644 --- a/examples/IfcLoader/index.html +++ b/examples/IfcLoader/index.html @@ -29,13 +29,13 @@ - - + + - - + + diff --git a/examples/IfcPropertiesTiler/index.html b/examples/IfcPropertiesTiler/index.html index 6197c5ce2..ff40dbe18 100644 --- a/examples/IfcPropertiesTiler/index.html +++ b/examples/IfcPropertiesTiler/index.html @@ -29,8 +29,8 @@ - - + + diff --git a/examples/IfcRelationsIndexer/index.html b/examples/IfcRelationsIndexer/index.html index 7fa0b4a7e..72209aa0a 100644 --- a/examples/IfcRelationsIndexer/index.html +++ b/examples/IfcRelationsIndexer/index.html @@ -27,13 +27,13 @@ - - + + - - + + diff --git a/examples/IfcStreamer/index.html b/examples/IfcStreamer/index.html index 59cc96c2d..864602150 100644 --- a/examples/IfcStreamer/index.html +++ b/examples/IfcStreamer/index.html @@ -27,7 +27,7 @@ - + diff --git a/examples/LengthMeasurement/index.html b/examples/LengthMeasurement/index.html index 1edd79c9b..458e12a77 100644 --- a/examples/LengthMeasurement/index.html +++ b/examples/LengthMeasurement/index.html @@ -28,16 +28,16 @@ - + - - - + + + - - - + + + diff --git a/examples/Marker/index.html b/examples/Marker/index.html index 9795966a9..1c9794aec 100644 --- a/examples/Marker/index.html +++ b/examples/Marker/index.html @@ -25,10 +25,10 @@ - - - - + + + + diff --git a/examples/MiniMap/index.html b/examples/MiniMap/index.html index d2983109c..2919c88e8 100644 --- a/examples/MiniMap/index.html +++ b/examples/MiniMap/index.html @@ -68,7 +68,7 @@ - + diff --git a/examples/OrthoPerspectiveCamera/index.html b/examples/OrthoPerspectiveCamera/index.html index 9fc57f6fa..92bd88eae 100644 --- a/examples/OrthoPerspectiveCamera/index.html +++ b/examples/OrthoPerspectiveCamera/index.html @@ -62,7 +62,7 @@ - + diff --git a/examples/Plans/index.html b/examples/Plans/index.html index 56d6f7b45..733771160 100644 --- a/examples/Plans/index.html +++ b/examples/Plans/index.html @@ -28,13 +28,13 @@ - + - - - - + + + + diff --git a/examples/PostproductionRenderer/index.html b/examples/PostproductionRenderer/index.html index 73930a112..fa33f7284 100644 --- a/examples/PostproductionRenderer/index.html +++ b/examples/PostproductionRenderer/index.html @@ -62,10 +62,10 @@ - + - - + + diff --git a/examples/Raycasters/index.html b/examples/Raycasters/index.html index 65d1ee309..b4907b887 100644 --- a/examples/Raycasters/index.html +++ b/examples/Raycasters/index.html @@ -61,7 +61,7 @@ - + diff --git a/examples/ShadowDropper/index.html b/examples/ShadowDropper/index.html index cbad346a4..e994ff023 100644 --- a/examples/ShadowDropper/index.html +++ b/examples/ShadowDropper/index.html @@ -26,11 +26,11 @@ - + - + diff --git a/examples/Utils/index.html b/examples/Utils/index.html index 6dcce724d..bd2dae3dc 100644 --- a/examples/Utils/index.html +++ b/examples/Utils/index.html @@ -28,10 +28,10 @@ - + - - + + diff --git a/examples/VolumeMeasurement/index.html b/examples/VolumeMeasurement/index.html index 0d4a8cf75..38e4def81 100644 --- a/examples/VolumeMeasurement/index.html +++ b/examples/VolumeMeasurement/index.html @@ -51,13 +51,13 @@ - + - - - + + + - + diff --git a/examples/Worlds/index.html b/examples/Worlds/index.html index c18931ac7..982931c17 100644 --- a/examples/Worlds/index.html +++ b/examples/Worlds/index.html @@ -60,7 +60,7 @@ - + diff --git a/examples/assets/angleMeasurement.js b/examples/assets/angleMeasurement.js index 9e4b65927..d7b9729ce 100644 --- a/examples/assets/angleMeasurement.js +++ b/examples/assets/angleMeasurement.js @@ -1 +1 @@ -var k=Object.defineProperty;var M=(o,n,e)=>n in o?k(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e;var t=(o,n,e)=>(M(o,typeof n!="symbol"?n+"":n,e),e);import{V as m,h as b,B as E,b as A,M as v}from"./web-ifc-api-BC8YMRiS.js";import{S as P}from"./stats.min-GTpOrGrX.js";import{U as d,J as y,f as C,p as x,s as D,k as L,N as G}from"./index-b4ozRbQy.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as B}from"./index-CwA6v-S5.js";import{L as _,a as V,b as N}from"./Line2-7GsqoD5b.js";import{M as K}from"./mark-Cj_PmUva.js";import{n as T}from"./dimension-mark-BiAWnjiH.js";import{G as U}from"./graphic-vertex-picker-CEs1V3AG.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-BOMjjrxA.js";class S{constructor(n,e){t(this,"enabled",!0);t(this,"visible",!0);t(this,"points",[]);t(this,"world");t(this,"onDisposed",new d);t(this,"_lineMaterial",new _({color:6629591,linewidth:2}));t(this,"_lineGeometry",new V);t(this,"_line",new N(this._lineGeometry,this._lineMaterial));t(this,"_labelMarker");t(this,"onAngleComputed",new d);t(this,"onPointAdded",new d);this.world=n;const i=T();this._labelMarker=new K(n,i),this.labelMarker.visible=!0,this.onPointAdded.add(()=>{this.points.length===1&&n.scene.three.add(this._line),this.points.length===3&&(this.labelMarker.visible=!0)}),this.onAngleComputed.add(s=>{this.labelMarker.three.element.textContent=`${s.toFixed(2)}°`,this.labelMarker.three.position.copy(this.points[1]??new m)}),e==null||e.forEach(s=>this.setPoint(s))}set lineMaterial(n){this._lineMaterial.dispose(),this._lineMaterial=n,this._line.material=n,this._lineMaterial.resolution.set(window.innerWidth,window.innerHeight)}get lineMaterial(){return this._lineMaterial}set labelMarker(n){this._labelMarker.dispose(),this._labelMarker=n}get labelMarker(){return this._labelMarker}get angle(){return{points:this.points,angle:this.computeAngle()}}setPoint(n,e){let i;if(e?i=e:i=this.points.length===0?0:this.points.length,![0,1,2].includes(i))return;this.points[i]=n,this.onPointAdded.trigger(n);const s=this.points.map(a=>[a.x,a.y,a.z]);this._lineGeometry.setPositions(s.flat())}toggleLabel(){this.labelMarker.toggleVisibility()}computeAngle(){const n=this.points[0],e=this.points[1],i=this.points[2];if(!(n&&e&&i))return 0;const s=new m().subVectors(e,n),a=new m().subVectors(e,i),w=b.radToDeg(s.angleTo(a));return this.onAngleComputed.trigger(w),w}dispose(){this.points=[],this.labelMarker.dispose(),this.onAngleComputed.reset(),this.onPointAdded.reset(),this.labelMarker.dispose(),this._line.removeFromParent(),this._lineMaterial.dispose(),this._lineGeometry.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}}const h=class h extends y{constructor(e){super(e);t(this,"onDisposed",new d);t(this,"world");t(this,"list",[]);t(this,"_lineMaterial");t(this,"_enabled",!1);t(this,"_vertexPicker");t(this,"_currentAngleElement",null);t(this,"_clickCount",0);t(this,"create",()=>{if(!this.enabled)return;if(!this.world){console.log("No world selected for angle measurement!");return}const e=this._vertexPicker.get(this.world);if(e){if(!this._currentAngleElement){const i=new S(this.world);i.lineMaterial=this.lineMaterial,this._currentAngleElement=i}this._currentAngleElement.setPoint(e,this._clickCount),this._currentAngleElement.setPoint(e,this._clickCount+1),this._currentAngleElement.setPoint(e,this._clickCount+2),this._currentAngleElement.computeAngle(),this._clickCount++,this._clickCount===3&&this.endCreation()}});t(this,"onMouseMove",()=>{if(!this.world){console.log("No world selected for angle measurement!");return}const e=this._vertexPicker.get(this.world);e&&this._currentAngleElement&&(this._currentAngleElement.setPoint(e,this._clickCount),this._currentAngleElement.computeAngle())});t(this,"onKeyDown",e=>{this.enabled&&(e.key==="z"&&e.ctrlKey&&this._currentAngleElement,e.key==="Escape"&&(this._clickCount===0&&!this._currentAngleElement?this.enabled=!1:this.cancelCreation()))});this.components.add(h.uuid,this),this._vertexPicker=new U(e),this._lineMaterial=new _({color:6629591,linewidth:2})}set lineMaterial(e){this._lineMaterial.dispose(),this._lineMaterial=e,this._lineMaterial.resolution.set(window.innerWidth,window.innerHeight)}get lineMaterial(){return this._lineMaterial}set enabled(e){this._enabled=e,this.setupEvents(e),this._vertexPicker.enabled=e,e||this.cancelCreation()}get enabled(){return this._enabled}set workingPlane(e){this._vertexPicker.workingPlane=e}get workingPlane(){return this._vertexPicker.workingPlane}dispose(){this.setupEvents(!1),this._lineMaterial.dispose(),this._vertexPicker.dispose();for(const e of this.list)e.dispose();this._currentAngleElement&&this._currentAngleElement.dispose(),this.components=null,this.onDisposed.trigger(h.uuid),this.onDisposed.reset()}delete(){}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}endCreation(){this._currentAngleElement&&(this.list.push(this._currentAngleElement),this._currentAngleElement.computeAngle(),this._currentAngleElement=null),this._clickCount=0}cancelCreation(){this._currentAngleElement&&(this._currentAngleElement.dispose(),this._currentAngleElement=null),this._clickCount=0}setupEvents(e){if(!this.world)throw new Error("No world selected for angle measurement!");if(!this.world.renderer)throw new Error("The given world doesn't have a renderer!");const s=this.world.renderer.three.domElement.parentElement;e?(s.addEventListener("click",this.create),s.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeyDown)):(s.removeEventListener("click",this.create),s.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeyDown))}};t(h,"uuid","622fb2c9-528c-4b0a-8a0e-6a1375f0a3aa");let g=h;const f=document.getElementById("container"),l=new C,z=l.get(x),r=z.create();r.scene=new D(l);r.renderer=new B(l,f);r.camera=new L(l);l.init();r.camera.controls.setLookAt(5,5,5,0,0,0);r.scene.setup();const F=l.get(G);F.create(r);const H=new E(3,3,3),W=new A({color:"#6528D7"}),p=new v(H,W);p.position.set(0,1.5,0);r.scene.three.add(p);r.meshes.add(p);const u=l.get(g);u.world=r;u.enabled=!0;f.ondblclick=()=>u.create();window.onkeydown=o=>{(o.code==="Delete"||o.code==="Backspace")&&u.delete()};const c=new P;c.showPanel(2);document.body.append(c.dom);c.dom.style.left="0px";r.renderer.onBeforeUpdate.add(()=>c.begin());r.renderer.onAfterUpdate.add(()=>c.end()); +var k=Object.defineProperty;var M=(o,n,e)=>n in o?k(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e;var t=(o,n,e)=>(M(o,typeof n!="symbol"?n+"":n,e),e);import{V as m,h as b,B as E,b as A,M as v}from"./web-ifc-api-BC8YMRiS.js";import{S as P}from"./stats.min-GTpOrGrX.js";import{D as d,J as y,f as C,p as x,s as D,k as L,N as G}from"./index-C-JPXu_n.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as B}from"./index-q_Y48tt2.js";import{L as _,a as V,b as N}from"./Line2-7GsqoD5b.js";import{M as K}from"./mark-Dwn_ERVH.js";import{n as T}from"./dimension-mark-BiAWnjiH.js";import{G as S}from"./graphic-vertex-picker-BH9d5rBm.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-Vj-QiZHm.js";class U{constructor(n,e){t(this,"enabled",!0);t(this,"visible",!0);t(this,"points",[]);t(this,"world");t(this,"onDisposed",new d);t(this,"_lineMaterial",new _({color:6629591,linewidth:2}));t(this,"_lineGeometry",new V);t(this,"_line",new N(this._lineGeometry,this._lineMaterial));t(this,"_labelMarker");t(this,"onAngleComputed",new d);t(this,"onPointAdded",new d);this.world=n;const i=T();this._labelMarker=new K(n,i),this.labelMarker.visible=!0,this.onPointAdded.add(()=>{this.points.length===1&&n.scene.three.add(this._line),this.points.length===3&&(this.labelMarker.visible=!0)}),this.onAngleComputed.add(s=>{this.labelMarker.three.element.textContent=`${s.toFixed(2)}°`,this.labelMarker.three.position.copy(this.points[1]??new m)}),e==null||e.forEach(s=>this.setPoint(s))}set lineMaterial(n){this._lineMaterial.dispose(),this._lineMaterial=n,this._line.material=n,this._lineMaterial.resolution.set(window.innerWidth,window.innerHeight)}get lineMaterial(){return this._lineMaterial}set labelMarker(n){this._labelMarker.dispose(),this._labelMarker=n}get labelMarker(){return this._labelMarker}get angle(){return{points:this.points,angle:this.computeAngle()}}setPoint(n,e){let i;if(e?i=e:i=this.points.length===0?0:this.points.length,![0,1,2].includes(i))return;this.points[i]=n,this.onPointAdded.trigger(n);const s=this.points.map(a=>[a.x,a.y,a.z]);this._lineGeometry.setPositions(s.flat())}toggleLabel(){this.labelMarker.toggleVisibility()}computeAngle(){const n=this.points[0],e=this.points[1],i=this.points[2];if(!(n&&e&&i))return 0;const s=new m().subVectors(e,n),a=new m().subVectors(e,i),w=b.radToDeg(s.angleTo(a));return this.onAngleComputed.trigger(w),w}dispose(){this.points=[],this.labelMarker.dispose(),this.onAngleComputed.reset(),this.onPointAdded.reset(),this.labelMarker.dispose(),this._line.removeFromParent(),this._lineMaterial.dispose(),this._lineGeometry.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}}const h=class h extends y{constructor(e){super(e);t(this,"onDisposed",new d);t(this,"world");t(this,"list",[]);t(this,"_lineMaterial");t(this,"_enabled",!1);t(this,"_vertexPicker");t(this,"_currentAngleElement",null);t(this,"_clickCount",0);t(this,"create",()=>{if(!this.enabled)return;if(!this.world){console.log("No world selected for angle measurement!");return}const e=this._vertexPicker.get(this.world);if(e){if(!this._currentAngleElement){const i=new U(this.world);i.lineMaterial=this.lineMaterial,this._currentAngleElement=i}this._currentAngleElement.setPoint(e,this._clickCount),this._currentAngleElement.setPoint(e,this._clickCount+1),this._currentAngleElement.setPoint(e,this._clickCount+2),this._currentAngleElement.computeAngle(),this._clickCount++,this._clickCount===3&&this.endCreation()}});t(this,"onMouseMove",()=>{if(!this.world){console.log("No world selected for angle measurement!");return}const e=this._vertexPicker.get(this.world);e&&this._currentAngleElement&&(this._currentAngleElement.setPoint(e,this._clickCount),this._currentAngleElement.computeAngle())});t(this,"onKeyDown",e=>{this.enabled&&(e.key==="z"&&e.ctrlKey&&this._currentAngleElement,e.key==="Escape"&&(this._clickCount===0&&!this._currentAngleElement?this.enabled=!1:this.cancelCreation()))});this.components.add(h.uuid,this),this._vertexPicker=new S(e),this._lineMaterial=new _({color:6629591,linewidth:2})}set lineMaterial(e){this._lineMaterial.dispose(),this._lineMaterial=e,this._lineMaterial.resolution.set(window.innerWidth,window.innerHeight)}get lineMaterial(){return this._lineMaterial}set enabled(e){this._enabled=e,this.setupEvents(e),this._vertexPicker.enabled=e,e||this.cancelCreation()}get enabled(){return this._enabled}set workingPlane(e){this._vertexPicker.workingPlane=e}get workingPlane(){return this._vertexPicker.workingPlane}dispose(){this.setupEvents(!1),this._lineMaterial.dispose(),this._vertexPicker.dispose();for(const e of this.list)e.dispose();this._currentAngleElement&&this._currentAngleElement.dispose(),this.components=null,this.onDisposed.trigger(h.uuid),this.onDisposed.reset()}delete(){}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}endCreation(){this._currentAngleElement&&(this.list.push(this._currentAngleElement),this._currentAngleElement.computeAngle(),this._currentAngleElement=null),this._clickCount=0}cancelCreation(){this._currentAngleElement&&(this._currentAngleElement.dispose(),this._currentAngleElement=null),this._clickCount=0}setupEvents(e){if(!this.world)throw new Error("No world selected for angle measurement!");if(this.world.isDisposing)return;if(!this.world.renderer)throw new Error("The given world doesn't have a renderer!");const s=this.world.renderer.three.domElement.parentElement;e?(s.addEventListener("click",this.create),s.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeyDown)):(s.removeEventListener("click",this.create),s.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeyDown))}};t(h,"uuid","622fb2c9-528c-4b0a-8a0e-6a1375f0a3aa");let g=h;const f=document.getElementById("container"),l=new C,z=l.get(x),r=z.create();r.scene=new D(l);r.renderer=new B(l,f);r.camera=new L(l);l.init();r.camera.controls.setLookAt(5,5,5,0,0,0);r.scene.setup();const F=l.get(G);F.create(r);const H=new E(3,3,3),W=new A({color:"#6528D7"}),p=new v(H,W);p.position.set(0,1.5,0);r.scene.three.add(p);r.meshes.add(p);const u=l.get(g);u.world=r;u.enabled=!0;f.ondblclick=()=>u.create();window.onkeydown=o=>{(o.code==="Delete"||o.code==="Backspace")&&u.delete()};const c=new P;c.showPanel(2);document.body.append(c.dom);c.dom.style.left="0px";r.renderer.onBeforeUpdate.add(()=>c.begin());r.renderer.onAfterUpdate.add(()=>c.end()); diff --git a/examples/assets/areaMeasurement.js b/examples/assets/areaMeasurement.js index 017eea14b..b0312fef6 100644 --- a/examples/assets/areaMeasurement.js +++ b/examples/assets/areaMeasurement.js @@ -1 +1 @@ -var P=Object.defineProperty;var v=(a,n,e)=>n in a?P(a,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[n]=e;var i=(a,n,e)=>(v(a,typeof n!="symbol"?n+"":n,e),e);import{L as E,P as A,V as _,a as L,f as x,S as M,B as b,b as C,M as y}from"./web-ifc-api-BC8YMRiS.js";import{S as D}from"./stats.min-GTpOrGrX.js";import{U as h,J as S,f as B,p as V,s as W,k as I,N as R}from"./index-b4ozRbQy.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as G}from"./index-CwA6v-S5.js";import{S as K}from"./index-MPPnu1_m.js";import{M as N}from"./mark-Cj_PmUva.js";import{n as T}from"./dimension-mark-BiAWnjiH.js";import{G as U}from"./graphic-vertex-picker-CEs1V3AG.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-BOMjjrxA.js";class z{constructor(n,e,t){i(this,"enabled",!0);i(this,"visible",!0);i(this,"points",[]);i(this,"workingPlane",null);i(this,"labelMarker");i(this,"world");i(this,"components");i(this,"onDisposed",new h);i(this,"_rotationMatrix",null);i(this,"_dimensionLines",[]);i(this,"_defaultLineMaterial",new E({color:"red"}));i(this,"onAreaComputed",new h);i(this,"onWorkingPlaneComputed",new h);i(this,"onPointAdded",new h);i(this,"onPointRemoved",new h);this.world=e,this.components=n;const s=T();this.labelMarker=new N(e,s),this.labelMarker.visible=!1,this.onPointAdded.add(o=>{this.points.length===3&&!this._dimensionLines[2]&&(this.addDimensionLine(o,this.points[0]),this.labelMarker.visible=!0)}),t==null||t.forEach(o=>this.setPoint(o))}setPoint(n,e){let t;if(e?t=e:t=this.points.length===0?0:this.points.length,t===0){this.points[0]=n;return}if(t<0||t>this.points.length)return;const s=this.points.length>t;this.points[t]=n,this.onPointAdded.trigger(n),s||this.addDimensionLine(this.points[t-1],n);const{previousLine:o,nextLine:m}=this.getLinesBetweenIndex(t);o&&(o.endPoint=n),m&&(m.startPoint=n)}removePoint(n){if(this.points.length===3)return;this.points.splice(n,1);const{previousLine:e,nextLine:t}=this.getLinesBetweenIndex(n);t&&(e.endPoint=t.endPoint),t==null||t.dispose(),this._dimensionLines.splice(n,1),this.onPointRemoved.trigger()}toggleLabel(){this.labelMarker.toggleVisibility()}addDimensionLine(n,e){const t=document.createElement("div");t.className="w-2 h-2 bg-red-600 rounded-full";const s=new K(this.components,this.world,{start:n,end:e,lineMaterial:this._defaultLineMaterial,endpointElement:t});return s.toggleLabel(),this._dimensionLines.length>1?this._dimensionLines.splice(this._dimensionLines.length-1,0,s):this._dimensionLines.push(s),s}getLinesBetweenIndex(n){const e=n===0?this._dimensionLines.length-1:n-1,t=this._dimensionLines[e],s=this._dimensionLines[n];return{previousLine:t,nextLine:s}}computeWorkingPlane(){this.workingPlane=new A().setFromCoplanarPoints(this.points[0],this.points[1],this.points[2]);const n=new _(0,1,0),e=this.workingPlane.normal.angleTo(n),t=new _().crossVectors(this.workingPlane.normal,n).normalize();this._rotationMatrix=new L().makeRotationAxis(t,e),this.onWorkingPlaneComputed.trigger(this.workingPlane)}computeArea(){if(!(this._rotationMatrix&&this.workingPlane))return this.onAreaComputed.trigger(0),0;let n=0,e=0;const t=this._rotationMatrix,s=this.points.map(m=>{const f=m.clone().applyMatrix4(t),p=new x(f.x,f.z);return n+=p.x,e+=p.y,p}),o=Math.abs(M.area(s));return this.labelMarker.three.element.textContent=`${o.toFixed(2)} m²`,this.labelMarker.three.position.set(n/s.length,-this.workingPlane.constant,e/s.length).applyMatrix4(t.clone().invert()),this.onAreaComputed.trigger(o),o}dispose(){this.onAreaComputed.reset(),this.onWorkingPlaneComputed.reset(),this.onPointAdded.reset(),this.onPointRemoved.reset();for(const n of this._dimensionLines)n.dispose();this.labelMarker.dispose(),this._dimensionLines=[],this.points=[],this._rotationMatrix=null,this.workingPlane=null,this._defaultLineMaterial.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return{points:this.points,workingPlane:this.workingPlane,area:this.computeArea()}}}const d=class d extends S{constructor(e){super(e);i(this,"onDisposed",new h);i(this,"list",[]);i(this,"world");i(this,"_enabled",!1);i(this,"_vertexPicker");i(this,"_currentAreaElement",null);i(this,"_clickCount",0);i(this,"create",()=>{if(!this.enabled)return;if(!this.world)throw new Error("World not defined for the area measurement!");const e=this._vertexPicker.get(this.world);if(e){if(!this._currentAreaElement){const t=new z(this.components,this.world);t.onPointAdded.add(()=>{this._clickCount===3&&!t.workingPlane&&(t.computeWorkingPlane(),this._vertexPicker.workingPlane=t.workingPlane)}),t.onPointRemoved.add(()=>this._clickCount--),this._currentAreaElement=t}this._currentAreaElement.setPoint(e,this._clickCount),this._currentAreaElement.computeArea(),this._clickCount++}});i(this,"onMouseMove",()=>{if(!this.world){console.log("No world given for the area measurement!");return}const e=this._vertexPicker.get(this.world);e&&this._currentAreaElement&&(this._currentAreaElement.setPoint(e,this._clickCount),this._currentAreaElement.computeArea())});i(this,"onKeydown",e=>{this.enabled&&(e.key==="z"&&e.ctrlKey&&this._currentAreaElement&&this._currentAreaElement.removePoint(this._clickCount-1),e.key==="Enter"&&this._currentAreaElement&&this.endCreation(),e.key==="Escape"&&(this._clickCount===0&&!this._currentAreaElement?this.enabled=!1:this.cancelCreation()))});this.components.add(d.uuid,this),this._vertexPicker=new U(e)}set enabled(e){this._enabled=e,this._vertexPicker.enabled=e,this.setupEvents(e),e||this.cancelCreation()}get enabled(){return this._enabled}set workingPlane(e){this._vertexPicker.workingPlane=e}get workingPlane(){return this._vertexPicker.workingPlane}dispose(){this.setupEvents(!1),this._vertexPicker.dispose(),this._currentAreaElement&&this._currentAreaElement.dispose();for(const e of this.list)e.dispose();this.components=null,this.onDisposed.trigger(d.uuid),this.onDisposed.reset()}delete(){}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}endCreation(){this._currentAreaElement&&(this.list.push(this._currentAreaElement),this._currentAreaElement.removePoint(this._clickCount),this._currentAreaElement.computeWorkingPlane(),this._currentAreaElement.computeArea(),this._currentAreaElement=null),this._vertexPicker.workingPlane=null,this._clickCount=0}cancelCreation(){this._currentAreaElement&&(this._currentAreaElement.dispose(),this._currentAreaElement=null),this._vertexPicker.workingPlane=null,this._clickCount=0}setupEvents(e){if(!this.world)throw new Error("The area measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the area measurement needs a renderer!");const s=this.world.renderer.three.domElement.parentElement;e?(s.addEventListener("click",this.create),s.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown)):(s.removeEventListener("click",this.create),s.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown))}};i(d,"uuid","c453a99e-f054-4781-9060-33df617db4a5");let w=d;const g=document.getElementById("container"),l=new B,F=l.get(V),r=F.create();r.scene=new W(l);r.renderer=new G(l,g);r.camera=new I(l);l.init();r.camera.controls.setLookAt(5,5,5,0,0,0);r.scene.setup();const J=l.get(R);J.create(r);const $=new b(3,3,3),j=new C({color:"#6528D7"}),k=new y($,j);k.position.set(0,1.5,0);r.scene.three.add(k);r.meshes.add(k);const u=new w(l);u.world=r;u.enabled=!0;g.ondblclick=()=>u.create();g.oncontextmenu=()=>u.endCreation();window.onkeydown=a=>{a.code==="Delete"||a.code};const c=new D;c.showPanel(2);document.body.append(c.dom);c.dom.style.left="0px";r.renderer.onBeforeUpdate.add(()=>c.begin());r.renderer.onAfterUpdate.add(()=>c.end()); +var P=Object.defineProperty;var v=(a,n,e)=>n in a?P(a,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[n]=e;var i=(a,n,e)=>(v(a,typeof n!="symbol"?n+"":n,e),e);import{L as E,P as A,V as _,a as L,f as x,S as M,B as b,b as C,M as y}from"./web-ifc-api-BC8YMRiS.js";import{S as D}from"./stats.min-GTpOrGrX.js";import{D as h,J as S,f as B,p as V,s as W,k as I,N as R}from"./index-C-JPXu_n.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as G}from"./index-q_Y48tt2.js";import{S as K}from"./index-CYkvDr46.js";import{M as N}from"./mark-Dwn_ERVH.js";import{n as T}from"./dimension-mark-BiAWnjiH.js";import{G as z}from"./graphic-vertex-picker-BH9d5rBm.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-Vj-QiZHm.js";class U{constructor(n,e,t){i(this,"enabled",!0);i(this,"visible",!0);i(this,"points",[]);i(this,"workingPlane",null);i(this,"labelMarker");i(this,"world");i(this,"components");i(this,"onDisposed",new h);i(this,"_rotationMatrix",null);i(this,"_dimensionLines",[]);i(this,"_defaultLineMaterial",new E({color:"red"}));i(this,"onAreaComputed",new h);i(this,"onWorkingPlaneComputed",new h);i(this,"onPointAdded",new h);i(this,"onPointRemoved",new h);this.world=e,this.components=n;const s=T();this.labelMarker=new N(e,s),this.labelMarker.visible=!1,this.onPointAdded.add(o=>{this.points.length===3&&!this._dimensionLines[2]&&(this.addDimensionLine(o,this.points[0]),this.labelMarker.visible=!0)}),t==null||t.forEach(o=>this.setPoint(o))}setPoint(n,e){let t;if(e?t=e:t=this.points.length===0?0:this.points.length,t===0){this.points[0]=n;return}if(t<0||t>this.points.length)return;const s=this.points.length>t;this.points[t]=n,this.onPointAdded.trigger(n),s||this.addDimensionLine(this.points[t-1],n);const{previousLine:o,nextLine:m}=this.getLinesBetweenIndex(t);o&&(o.endPoint=n),m&&(m.startPoint=n)}removePoint(n){if(this.points.length===3)return;this.points.splice(n,1);const{previousLine:e,nextLine:t}=this.getLinesBetweenIndex(n);t&&(e.endPoint=t.endPoint),t==null||t.dispose(),this._dimensionLines.splice(n,1),this.onPointRemoved.trigger()}toggleLabel(){this.labelMarker.toggleVisibility()}addDimensionLine(n,e){const t=document.createElement("div");t.className="w-2 h-2 bg-red-600 rounded-full";const s=new K(this.components,this.world,{start:n,end:e,lineMaterial:this._defaultLineMaterial,endpointElement:t});return s.toggleLabel(),this._dimensionLines.length>1?this._dimensionLines.splice(this._dimensionLines.length-1,0,s):this._dimensionLines.push(s),s}getLinesBetweenIndex(n){const e=n===0?this._dimensionLines.length-1:n-1,t=this._dimensionLines[e],s=this._dimensionLines[n];return{previousLine:t,nextLine:s}}computeWorkingPlane(){this.workingPlane=new A().setFromCoplanarPoints(this.points[0],this.points[1],this.points[2]);const n=new _(0,1,0),e=this.workingPlane.normal.angleTo(n),t=new _().crossVectors(this.workingPlane.normal,n).normalize();this._rotationMatrix=new L().makeRotationAxis(t,e),this.onWorkingPlaneComputed.trigger(this.workingPlane)}computeArea(){if(!(this._rotationMatrix&&this.workingPlane))return this.onAreaComputed.trigger(0),0;let n=0,e=0;const t=this._rotationMatrix,s=this.points.map(m=>{const f=m.clone().applyMatrix4(t),p=new x(f.x,f.z);return n+=p.x,e+=p.y,p}),o=Math.abs(M.area(s));return this.labelMarker.three.element.textContent=`${o.toFixed(2)} m²`,this.labelMarker.three.position.set(n/s.length,-this.workingPlane.constant,e/s.length).applyMatrix4(t.clone().invert()),this.onAreaComputed.trigger(o),o}dispose(){this.onAreaComputed.reset(),this.onWorkingPlaneComputed.reset(),this.onPointAdded.reset(),this.onPointRemoved.reset();for(const n of this._dimensionLines)n.dispose();this.labelMarker.dispose(),this._dimensionLines=[],this.points=[],this._rotationMatrix=null,this.workingPlane=null,this._defaultLineMaterial.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return{points:this.points,workingPlane:this.workingPlane,area:this.computeArea()}}}const d=class d extends S{constructor(e){super(e);i(this,"onDisposed",new h);i(this,"list",[]);i(this,"world");i(this,"_enabled",!1);i(this,"_vertexPicker");i(this,"_currentAreaElement",null);i(this,"_clickCount",0);i(this,"create",()=>{if(!this.enabled)return;if(!this.world)throw new Error("World not defined for the area measurement!");const e=this._vertexPicker.get(this.world);if(e){if(!this._currentAreaElement){const t=new U(this.components,this.world);t.onPointAdded.add(()=>{this._clickCount===3&&!t.workingPlane&&(t.computeWorkingPlane(),this._vertexPicker.workingPlane=t.workingPlane)}),t.onPointRemoved.add(()=>this._clickCount--),this._currentAreaElement=t}this._currentAreaElement.setPoint(e,this._clickCount),this._currentAreaElement.computeArea(),this._clickCount++}});i(this,"onMouseMove",()=>{if(!this.world){console.log("No world given for the area measurement!");return}const e=this._vertexPicker.get(this.world);e&&this._currentAreaElement&&(this._currentAreaElement.setPoint(e,this._clickCount),this._currentAreaElement.computeArea())});i(this,"onKeydown",e=>{this.enabled&&(e.key==="z"&&e.ctrlKey&&this._currentAreaElement&&this._currentAreaElement.removePoint(this._clickCount-1),e.key==="Enter"&&this._currentAreaElement&&this.endCreation(),e.key==="Escape"&&(this._clickCount===0&&!this._currentAreaElement?this.enabled=!1:this.cancelCreation()))});this.components.add(d.uuid,this),this._vertexPicker=new z(e)}set enabled(e){this._enabled=e,this._vertexPicker.enabled=e,this.setupEvents(e),e||this.cancelCreation()}get enabled(){return this._enabled}set workingPlane(e){this._vertexPicker.workingPlane=e}get workingPlane(){return this._vertexPicker.workingPlane}dispose(){this.setupEvents(!1),this._vertexPicker.dispose(),this._currentAreaElement&&this._currentAreaElement.dispose();for(const e of this.list)e.dispose();this.components=null,this.onDisposed.trigger(d.uuid),this.onDisposed.reset()}delete(){}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}endCreation(){this._currentAreaElement&&(this.list.push(this._currentAreaElement),this._currentAreaElement.removePoint(this._clickCount),this._currentAreaElement.computeWorkingPlane(),this._currentAreaElement.computeArea(),this._currentAreaElement=null),this._vertexPicker.workingPlane=null,this._clickCount=0}cancelCreation(){this._currentAreaElement&&(this._currentAreaElement.dispose(),this._currentAreaElement=null),this._vertexPicker.workingPlane=null,this._clickCount=0}setupEvents(e){if(!this.world)throw new Error("The area measurement needs a world to work!");if(this.world.isDisposing)return;if(!this.world.renderer)throw new Error("The world of the area measurement needs a renderer!");const s=this.world.renderer.three.domElement.parentElement;e?(s.addEventListener("click",this.create),s.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown)):(s.removeEventListener("click",this.create),s.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown))}};i(d,"uuid","c453a99e-f054-4781-9060-33df617db4a5");let w=d;const g=document.getElementById("container"),l=new B,F=l.get(V),r=F.create();r.scene=new W(l);r.renderer=new G(l,g);r.camera=new I(l);l.init();r.camera.controls.setLookAt(5,5,5,0,0,0);r.scene.setup();const J=l.get(R);J.create(r);const $=new b(3,3,3),j=new C({color:"#6528D7"}),k=new y($,j);k.position.set(0,1.5,0);r.scene.three.add(k);r.meshes.add(k);const u=new w(l);u.world=r;u.enabled=!0;g.ondblclick=()=>u.create();g.oncontextmenu=()=>u.endCreation();window.onkeydown=a=>{a.code==="Delete"||a.code};const c=new D;c.showPanel(2);document.body.append(c.dom);c.dom.style.left="0px";r.renderer.onBeforeUpdate.add(()=>c.begin());r.renderer.onAfterUpdate.add(()=>c.end()); diff --git a/examples/assets/boundingBoxer.js b/examples/assets/boundingBoxer.js index ca6a46293..7e0686dbe 100644 --- a/examples/assets/boundingBoxer.js +++ b/examples/assets/boundingBoxer.js @@ -1,4 +1,4 @@ -import"./web-ifc-api-BC8YMRiS.js";import{S as c}from"./stats.min-GTpOrGrX.js";import{p as l,a,m as r}from"./index-DyM33b1I.js";import{f as d,p as m,s as p,i as b,k as u,N as f,u as g,A as w}from"./index-b4ozRbQy.js";import"./_commonjsHelpers-Cpj98o6Y.js";const h=document.getElementById("container"),t=new d,y=t.get(m),e=y.create();e.scene=new p(t);e.renderer=new b(t,h);e.camera=new u(t);t.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const B=t.get(f);B.create(e);e.scene.three.background=null;const k=t.get(g),v=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),x=await v.arrayBuffer(),A=new Uint8Array(x),i=k.load(A);e.scene.three.add(i);const s=t.get(w);s.add(i);const L=s.getMesh();s.reset();const n=new c;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end());l.init();const o=a.create(()=>r` +import"./web-ifc-api-BC8YMRiS.js";import{S as c}from"./stats.min-GTpOrGrX.js";import{p as l,a,m as r}from"./index-DyM33b1I.js";import{f as d,p as m,s as p,i as b,k as u,N as f,u as g,A as w}from"./index-C-JPXu_n.js";import"./_commonjsHelpers-Cpj98o6Y.js";const h=document.getElementById("container"),t=new d,y=t.get(m),e=y.create();e.scene=new p(t);e.renderer=new b(t,h);e.camera=new u(t);t.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const B=t.get(f);B.create(e);e.scene.three.background=null;const k=t.get(g),v=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),x=await v.arrayBuffer(),A=new Uint8Array(x),i=k.load(A);e.scene.three.add(i);const s=t.get(w);s.add(i);const L=s.getMesh();s.reset();const n=new c;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end());l.init();const o=a.create(()=>r` diff --git a/examples/assets/civil3DNavigator.js b/examples/assets/civil3DNavigator.js index ff1a6c9f1..a357f40a3 100644 --- a/examples/assets/civil3DNavigator.js +++ b/examples/assets/civil3DNavigator.js @@ -1 +1 @@ -import{I as p,y as l}from"./web-ifc-api-BC8YMRiS.js";import{f as m,p as h,s as f,k as g,N as u,u as w,C as v}from"./index-b4ozRbQy.js";import{p as y}from"./index-DyM33b1I.js";import{Z as C,C as b}from"./index-Ch1tb-j6.js";import{S as A}from"./stats.min-GTpOrGrX.js";import{R as U}from"./renderer-with-2d-BOMjjrxA.js";import"./import-wrapper-prod-LhqN7JJy.js";import"./Line2-7GsqoD5b.js";import"./mark-Cj_PmUva.js";import"./_commonjsHelpers-Cpj98o6Y.js";y.init();C.init();const d=document.getElementById("container"),t=new m,P=t.get(h),e=P.create();e.scene=new f(t);e.renderer=new U(t,d);e.camera=new g(t);t.init();e.scene.setup();e.camera.controls.setLookAt(5,5,5,0,0,0);d.appendChild(e.renderer.three2D.domElement);const S=t.get(u);S.create(e);const k=t.get(w),B=await fetch("https://thatopen.github.io/engine_components/resources/road.frag"),D=await B.arrayBuffer(),E=new Uint8Array(D),s=await k.load(E);e.scene.three.add(s);const I=await fetch("https://thatopen.github.io/engine_components/resources/road.json");s.setLocalProperties(await I.json());const r=t.get(b);r.world=e;r.draw(s);const L=t.get(v),i=L.create(e);i.threshold=10;for(const o of s.children)o instanceof p&&i.add(o);i.needsUpdate=!0;e.camera.controls.addEventListener("sleep",()=>{i.needsUpdate=!0});r.highlighter.hoverCurve.material.color.set(1,1,1);const{material:a}=r.highlighter.hoverPoints;if(Array.isArray(a)){const o=a[0];"color"in o&&o.color.set(1,1,1)}else"color"in a&&a.color.set(1,1,1);const c=new l(void 0,20);r.onHighlight.add(({point:o})=>{c.center.copy(o),e.camera.controls.fitToSphere(c,!0)});const n=new A;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end()); +import{I as p,y as l}from"./web-ifc-api-BC8YMRiS.js";import{f as m,p as h,s as f,k as g,N as u,u as w,C as v}from"./index-C-JPXu_n.js";import{p as y}from"./index-DyM33b1I.js";import{Z as C,C as b}from"./index-B13Jg0iu.js";import{S as A}from"./stats.min-GTpOrGrX.js";import{R as U}from"./renderer-with-2d-Vj-QiZHm.js";import"./import-wrapper-prod-LhqN7JJy.js";import"./Line2-7GsqoD5b.js";import"./mark-Dwn_ERVH.js";import"./_commonjsHelpers-Cpj98o6Y.js";y.init();C.init();const d=document.getElementById("container"),t=new m,P=t.get(h),e=P.create();e.scene=new f(t);e.renderer=new U(t,d);e.camera=new g(t);t.init();e.scene.setup();e.camera.controls.setLookAt(5,5,5,0,0,0);d.appendChild(e.renderer.three2D.domElement);const S=t.get(u);S.create(e);const k=t.get(w),B=await fetch("https://thatopen.github.io/engine_components/resources/road.frag"),D=await B.arrayBuffer(),E=new Uint8Array(D),s=await k.load(E);e.scene.three.add(s);const I=await fetch("https://thatopen.github.io/engine_components/resources/road.json");s.setLocalProperties(await I.json());const r=t.get(b);r.world=e;r.draw(s);const L=t.get(v),i=L.create(e);i.threshold=10;for(const o of s.children)o instanceof p&&i.add(o);i.needsUpdate=!0;e.camera.controls.addEventListener("sleep",()=>{i.needsUpdate=!0});r.highlighter.hoverCurve.material.color.set(1,1,1);const{material:a}=r.highlighter.hoverPoints;if(Array.isArray(a)){const o=a[0];"color"in o&&o.color.set(1,1,1)}else"color"in a&&a.color.set(1,1,1);const c=new l(void 0,20);r.onHighlight.add(({point:o})=>{c.center.copy(o),e.camera.controls.fitToSphere(c,!0)});const n=new A;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end()); diff --git a/examples/assets/civilCrossSectionNavigator.js b/examples/assets/civilCrossSectionNavigator.js index 9066017b4..9edf73426 100644 --- a/examples/assets/civilCrossSectionNavigator.js +++ b/examples/assets/civilCrossSectionNavigator.js @@ -1 +1 @@ -var L=Object.defineProperty;var R=(t,o,e)=>o in t?L(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e;var d=(t,o,e)=>(R(t,typeof o!="symbol"?o+"":o,e),e);import{V as y,C as T,L as I}from"./web-ifc-api-BC8YMRiS.js";import{J as F,m as U,f as V,p as W,s as _,n as j,N as H,u as Z,R as z}from"./index-b4ozRbQy.js";import{p as G}from"./index-DyM33b1I.js";import{Z as J,C as Y}from"./index-Ch1tb-j6.js";import{S as $}from"./stats.min-GTpOrGrX.js";import{C as q}from"./index-C9jIYBP8.js";import{R as K}from"./renderer-with-2d-BOMjjrxA.js";import{E as O,C as Q}from"./index-Dbd7DdKu.js";import"./import-wrapper-prod-LhqN7JJy.js";import"./Line2-7GsqoD5b.js";import"./mark-Cj_PmUva.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./index-WVnKWA4H.js";import"./index-CwA6v-S5.js";const g=class g extends F{constructor(e){super(e);d(this,"world",null);d(this,"enabled",!0);d(this,"plane");d(this,"_world3D",null);this.components.add(g.uuid,this)}get world3D(){return this._world3D}set world3D(e){var i;if(this._world3D=e,(i=this.plane)==null||i.dispose(),!e)return;const n=this.components.get(U),a=n.Type;n.Type=O,this.plane=n.createFromNormalAndCoplanarPoint(e,new y(1,0,0),new y),n.Type=a,this.plane.visible=!1,this.plane.enabled=!1}async set(e,n){if(!this.world||!this.plane)throw new Error("You must set a world before using this component");this.plane.enabled=!0;const a=e.curve.getPercentageAt(n);if(a===null)return;const{startPoint:i,endPoint:S}=e.curve.getSegmentAt(a);if(e.geometry.index===null)throw new Error("Geometry must be indexed!");const w=new y;w.subVectors(S,i),w.normalize(),this.plane.setFromNormalAndCoplanarPoint(w,n),this.plane.edges.update();const x=this.plane.helper.matrix.clone();x.invert();const A=this.world.scene.three,M=this.plane.edges.get();for(const k in M){const{mesh:l}=M[k];l.position.set(0,0,0),l.rotation.set(0,0,0),l.updateMatrix(),l.applyMatrix4(x),l.parent!==A&&A.add(l)}this.plane.enabled=!1}};d(g,"uuid","96b2c87e-d90b-4639-8257-8f01136fe324");let b=g;G.init();J.init();const B=document.getElementById("container"),r=new V,X=r.get(W),s=X.create();s.scene=new _(r);s.renderer=new K(r,B);s.camera=new j(r);r.init();s.scene.setup();s.camera.controls.setLookAt(5,5,5,0,0,0);B.appendChild(s.renderer.three2D.domElement);const ee=r.get(H);ee.create(s);const N=r.get(Z),te=await fetch("https://thatopen.github.io/engine_components/resources/road.frag"),oe=await te.arrayBuffer(),ne=new Uint8Array(oe),m=N.load(ne);s.scene.three.add(m);const re=await fetch("https://thatopen.github.io/engine_components/resources/road.json");m.setLocalProperties(await re.json());const D=document.getElementById("scene-2d-left");D.components=r;if(!D.world)throw new Error("World not found!");const c=new q(r);c.world=D.world;await c.draw(m);const p=new Y(r);p.world=s;p.draw(m);p.highlighter.hoverCurve.material.color.set(1,1,1);const{material:f}=c.highlighter.hoverPoints;if(Array.isArray(f)){const t=f[0];"color"in t&&t.color.set(1,1,1)}else"color"in f&&f.color.set(1,1,1);c.onHighlight.add(({mesh:t})=>{p.highlighter.select(t);const o=t.curve.index,e=t.curve.alignment.absolute[o];e.mesh.geometry.computeBoundingSphere();const n=e.mesh.geometry.boundingSphere;n&&s.camera.controls.fitToSphere(n,!0)});const u=document.getElementById("scene-2d-right");u.components=r;if(!u.world)throw new Error("World not found!");const v=new b(r);v.world=u.world;v.world3D=s;c.onMarkerChange.add(({alignment:t,percentage:o,type:e,curve:n})=>{if(p.setMarker(t,o,e),e==="select"){const a=n.alignment.absolute[n.index].mesh,i=t.getPointAt(o,"absolute");v.set(a,i)}});c.onMarkerHidden.add(({type:t})=>{p.hideMarker(t)});const E=new z(r);E.byEntity(m);const se=E.list,P=r.get(Q),C=P.styles.list;for(const t in se.entities){const o=E.find({entities:[t]}),e=new T(Math.random(),Math.random(),Math.random()),n=new I({color:e});P.styles.create(t,new Set,u.world,n);for(const a in o){const i=N.list.get(a);i&&(C[t].fragments[a]=new Set(o[a]),C[t].meshes.add(i.mesh))}}P.update(!0);const h=new $;h.showPanel(2);document.body.append(h.dom);h.dom.style.left="0px";s.renderer.onBeforeUpdate.add(()=>h.begin());s.renderer.onAfterUpdate.add(()=>h.end()); +var L=Object.defineProperty;var R=(t,o,e)=>o in t?L(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e;var d=(t,o,e)=>(R(t,typeof o!="symbol"?o+"":o,e),e);import{V as y,C as T,L as I}from"./web-ifc-api-BC8YMRiS.js";import{J as F,m as U,f as V,p as W,s as _,n as j,N as H,u as Z,R as z}from"./index-C-JPXu_n.js";import{p as G}from"./index-DyM33b1I.js";import{Z as J,C as Y}from"./index-B13Jg0iu.js";import{S as $}from"./stats.min-GTpOrGrX.js";import{C as q}from"./index-D2zeH9ie.js";import{R as K}from"./renderer-with-2d-Vj-QiZHm.js";import{E as O,C as Q}from"./index-DHD4JXQh.js";import"./import-wrapper-prod-LhqN7JJy.js";import"./Line2-7GsqoD5b.js";import"./mark-Dwn_ERVH.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./index-B1Q8f4gg.js";import"./index-q_Y48tt2.js";const g=class g extends F{constructor(e){super(e);d(this,"world",null);d(this,"enabled",!0);d(this,"plane");d(this,"_world3D",null);this.components.add(g.uuid,this)}get world3D(){return this._world3D}set world3D(e){var i;if(this._world3D=e,(i=this.plane)==null||i.dispose(),!e)return;const n=this.components.get(U),a=n.Type;n.Type=O,this.plane=n.createFromNormalAndCoplanarPoint(e,new y(1,0,0),new y),n.Type=a,this.plane.visible=!1,this.plane.enabled=!1}async set(e,n){if(!this.world||!this.plane)throw new Error("You must set a world before using this component");this.plane.enabled=!0;const a=e.curve.getPercentageAt(n);if(a===null)return;const{startPoint:i,endPoint:S}=e.curve.getSegmentAt(a);if(e.geometry.index===null)throw new Error("Geometry must be indexed!");const w=new y;w.subVectors(S,i),w.normalize(),this.plane.setFromNormalAndCoplanarPoint(w,n),this.plane.edges.update();const x=this.plane.helper.matrix.clone();x.invert();const A=this.world.scene.three,M=this.plane.edges.get();for(const k in M){const{mesh:l}=M[k];l.position.set(0,0,0),l.rotation.set(0,0,0),l.updateMatrix(),l.applyMatrix4(x),l.parent!==A&&A.add(l)}this.plane.enabled=!1}};d(g,"uuid","96b2c87e-d90b-4639-8257-8f01136fe324");let b=g;G.init();J.init();const B=document.getElementById("container"),r=new V,X=r.get(W),s=X.create();s.scene=new _(r);s.renderer=new K(r,B);s.camera=new j(r);r.init();s.scene.setup();s.camera.controls.setLookAt(5,5,5,0,0,0);B.appendChild(s.renderer.three2D.domElement);const ee=r.get(H);ee.create(s);const N=r.get(Z),te=await fetch("https://thatopen.github.io/engine_components/resources/road.frag"),oe=await te.arrayBuffer(),ne=new Uint8Array(oe),m=N.load(ne);s.scene.three.add(m);const re=await fetch("https://thatopen.github.io/engine_components/resources/road.json");m.setLocalProperties(await re.json());const D=document.getElementById("scene-2d-left");D.components=r;if(!D.world)throw new Error("World not found!");const c=new q(r);c.world=D.world;await c.draw(m);const p=new Y(r);p.world=s;p.draw(m);p.highlighter.hoverCurve.material.color.set(1,1,1);const{material:f}=c.highlighter.hoverPoints;if(Array.isArray(f)){const t=f[0];"color"in t&&t.color.set(1,1,1)}else"color"in f&&f.color.set(1,1,1);c.onHighlight.add(({mesh:t})=>{p.highlighter.select(t);const o=t.curve.index,e=t.curve.alignment.absolute[o];e.mesh.geometry.computeBoundingSphere();const n=e.mesh.geometry.boundingSphere;n&&s.camera.controls.fitToSphere(n,!0)});const u=document.getElementById("scene-2d-right");u.components=r;if(!u.world)throw new Error("World not found!");const v=new b(r);v.world=u.world;v.world3D=s;c.onMarkerChange.add(({alignment:t,percentage:o,type:e,curve:n})=>{if(p.setMarker(t,o,e),e==="select"){const a=n.alignment.absolute[n.index].mesh,i=t.getPointAt(o,"absolute");v.set(a,i)}});c.onMarkerHidden.add(({type:t})=>{p.hideMarker(t)});const E=new z(r);E.byEntity(m);const se=E.list,P=r.get(Q),C=P.styles.list;for(const t in se.entities){const o=E.find({entities:[t]}),e=new T(Math.random(),Math.random(),Math.random()),n=new I({color:e});P.styles.create(t,new Set,u.world,n);for(const a in o){const i=N.list.get(a);i&&(C[t].fragments[a]=new Set(o[a]),C[t].meshes.add(i.mesh))}}P.update(!0);const h=new $;h.showPanel(2);document.body.append(h.dom);h.dom.style.left="0px";s.renderer.onBeforeUpdate.add(()=>h.begin());s.renderer.onAfterUpdate.add(()=>h.end()); diff --git a/examples/assets/civilElevationNavigator.js b/examples/assets/civilElevationNavigator.js index f86fe62bb..09ab8418d 100644 --- a/examples/assets/civilElevationNavigator.js +++ b/examples/assets/civilElevationNavigator.js @@ -1 +1 @@ -var A=Object.defineProperty;var B=(e,t,o)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var v=(e,t,o)=>(B(e,typeof t!="symbol"?t+"":t,o),o);import"./web-ifc-api-BC8YMRiS.js";import{f as C,p as D,s as K,n as E,N as I,u as N}from"./index-b4ozRbQy.js";import{p as x}from"./index-DyM33b1I.js";import{Z as H,C as $}from"./index-Ch1tb-j6.js";import{S as F}from"./stats.min-GTpOrGrX.js";import{a as R,b as T,C as U}from"./index-C9jIYBP8.js";import{R as W}from"./renderer-with-2d-BOMjjrxA.js";import"./import-wrapper-prod-LhqN7JJy.js";import"./Line2-7GsqoD5b.js";import"./mark-Cj_PmUva.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./index-WVnKWA4H.js";const S=class S extends R{constructor(o){super(o);v(this,"view","vertical");v(this,"enabled",!0);this.components.add(S.uuid,this)}get world(){return super.world}set world(o){this.world!==o&&(super.world=o,this._highlighter&&this._highlighter.onSelect.add(g=>{if(!this.world)throw new Error("A world is needed to work with this component!");const s=this.components.get(T);s.deleteByType(["Slope","Height","InitialKPV","FinalKPV"]);const{alignment:r}=g.curve,d=[];for(const a of r.vertical){const f=a.mesh.geometry.attributes.position.array;d.push(f)}const{defSegments:p,slope:w}=this.setDefSegments(d),u=this.world.scene.three;for(let a=0;a{h.setMarker(e,t,"hover"),l.setMarker(e,t,"hover")});b.onHighlight.add(({mesh:e,point:t})=>{const{index:o,alignment:g}=e.curve,s=g.getPercentageAt(t,"horizontal");if(s===null)return;const{curve:r}=g.getCurveAt(s,"vertical");if(h.highlighter.select(r.mesh),h.setMarker(r.alignment,s,"select"),c.world){r.mesh.geometry.boundingSphere||r.mesh.geometry.computeBoundingSphere();const w=r.mesh.geometry.boundingSphere.clone();w.radius*=1.5,c.world.camera.controls.fitToSphere(w,!0)}l.highlighter.select(e);const d=e.curve.alignment.absolute[o];d.mesh.geometry.computeBoundingSphere();const p=d.mesh.geometry.boundingSphere;p&&i.camera.controls.fitToSphere(p,!0)});const m=new F;m.showPanel(2);document.body.append(m.dom);m.dom.style.left="0px";i.renderer.onBeforeUpdate.add(()=>m.begin());i.renderer.onAfterUpdate.add(()=>m.end()); +var A=Object.defineProperty;var B=(e,t,o)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var v=(e,t,o)=>(B(e,typeof t!="symbol"?t+"":t,o),o);import"./web-ifc-api-BC8YMRiS.js";import{f as C,p as D,s as K,n as E,N as I,u as N}from"./index-C-JPXu_n.js";import{p as x}from"./index-DyM33b1I.js";import{Z as H,C as $}from"./index-B13Jg0iu.js";import{S as F}from"./stats.min-GTpOrGrX.js";import{a as R,b as T,C as U}from"./index-D2zeH9ie.js";import{R as W}from"./renderer-with-2d-Vj-QiZHm.js";import"./import-wrapper-prod-LhqN7JJy.js";import"./Line2-7GsqoD5b.js";import"./mark-Dwn_ERVH.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./index-B1Q8f4gg.js";const S=class S extends R{constructor(o){super(o);v(this,"view","vertical");v(this,"enabled",!0);this.components.add(S.uuid,this)}get world(){return super.world}set world(o){this.world!==o&&(super.world=o,this._highlighter&&this._highlighter.onSelect.add(g=>{if(!this.world)throw new Error("A world is needed to work with this component!");const s=this.components.get(T);s.deleteByType(["Slope","Height","InitialKPV","FinalKPV"]);const{alignment:r}=g.curve,d=[];for(const a of r.vertical){const f=a.mesh.geometry.attributes.position.array;d.push(f)}const{defSegments:p,slope:w}=this.setDefSegments(d),u=this.world.scene.three;for(let a=0;a{h.setMarker(e,t,"hover"),l.setMarker(e,t,"hover")});b.onHighlight.add(({mesh:e,point:t})=>{const{index:o,alignment:g}=e.curve,s=g.getPercentageAt(t,"horizontal");if(s===null)return;const{curve:r}=g.getCurveAt(s,"vertical");if(h.highlighter.select(r.mesh),h.setMarker(r.alignment,s,"select"),c.world){r.mesh.geometry.boundingSphere||r.mesh.geometry.computeBoundingSphere();const w=r.mesh.geometry.boundingSphere.clone();w.radius*=1.5,c.world.camera.controls.fitToSphere(w,!0)}l.highlighter.select(e);const d=e.curve.alignment.absolute[o];d.mesh.geometry.computeBoundingSphere();const p=d.mesh.geometry.boundingSphere;p&&i.camera.controls.fitToSphere(p,!0)});const m=new F;m.showPanel(2);document.body.append(m.dom);m.dom.style.left="0px";i.renderer.onBeforeUpdate.add(()=>m.begin());i.renderer.onAfterUpdate.add(()=>m.end()); diff --git a/examples/assets/civilPlanNavigator.js b/examples/assets/civilPlanNavigator.js index 897a7208d..c4ded4caa 100644 --- a/examples/assets/civilPlanNavigator.js +++ b/examples/assets/civilPlanNavigator.js @@ -1 +1 @@ -import"./web-ifc-api-BC8YMRiS.js";import{f as h,p as g,s as f,n as w,N as u,u as v}from"./index-b4ozRbQy.js";import{p as y}from"./index-DyM33b1I.js";import{Z as b,C}from"./index-Ch1tb-j6.js";import{S as A}from"./stats.min-GTpOrGrX.js";import{C as B}from"./index-C9jIYBP8.js";import{R as N}from"./renderer-with-2d-BOMjjrxA.js";import"./import-wrapper-prod-LhqN7JJy.js";import"./Line2-7GsqoD5b.js";import"./mark-Cj_PmUva.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./index-WVnKWA4H.js";y.init();b.init();const l=document.getElementById("container"),t=new h,S=t.get(g),e=S.create();e.scene=new f(t);e.renderer=new N(t,l);e.camera=new w(t);t.init();e.scene.setup();e.camera.controls.setLookAt(5,5,5,0,0,0);l.appendChild(e.renderer.three2D.domElement);const D=t.get(u);D.create(e);const E=t.get(v),P=await fetch("https://thatopen.github.io/engine_components/resources/road.frag"),x=await P.arrayBuffer(),U=new Uint8Array(x),i=E.load(U);e.scene.three.add(i);const r=new C(t);r.world=e;r.draw(i);r.highlighter.hoverCurve.material.color.set(1,1,1);const{material:a}=r.highlighter.hoverPoints;if(Array.isArray(a)){const o=a[0];"color"in o&&o.color.set(1,1,1)}else"color"in a&&a.color.set(1,1,1);const s=document.getElementById("scene-2d"),c=new B(t);s.components=t;if(!s.world)throw new Error("World not found!");c.world=s.world;await c.draw(i);c.onHighlight.add(({mesh:o})=>{r.highlighter.select(o);const p=o.curve.index,d=o.curve.alignment.absolute[p];d.mesh.geometry.computeBoundingSphere();const m=d.mesh.geometry.boundingSphere;m&&e.camera.controls.fitToSphere(m,!0)});const n=new A;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end()); +import"./web-ifc-api-BC8YMRiS.js";import{f as h,p as g,s as f,n as w,N as u,u as v}from"./index-C-JPXu_n.js";import{p as y}from"./index-DyM33b1I.js";import{Z as b,C}from"./index-B13Jg0iu.js";import{S as A}from"./stats.min-GTpOrGrX.js";import{C as B}from"./index-D2zeH9ie.js";import{R as N}from"./renderer-with-2d-Vj-QiZHm.js";import"./import-wrapper-prod-LhqN7JJy.js";import"./Line2-7GsqoD5b.js";import"./mark-Dwn_ERVH.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./index-B1Q8f4gg.js";y.init();b.init();const l=document.getElementById("container"),t=new h,S=t.get(g),e=S.create();e.scene=new f(t);e.renderer=new N(t,l);e.camera=new w(t);t.init();e.scene.setup();e.camera.controls.setLookAt(5,5,5,0,0,0);l.appendChild(e.renderer.three2D.domElement);const D=t.get(u);D.create(e);const E=t.get(v),P=await fetch("https://thatopen.github.io/engine_components/resources/road.frag"),x=await P.arrayBuffer(),U=new Uint8Array(x),i=E.load(U);e.scene.three.add(i);const r=new C(t);r.world=e;r.draw(i);r.highlighter.hoverCurve.material.color.set(1,1,1);const{material:a}=r.highlighter.hoverPoints;if(Array.isArray(a)){const o=a[0];"color"in o&&o.color.set(1,1,1)}else"color"in a&&a.color.set(1,1,1);const s=document.getElementById("scene-2d"),c=new B(t);s.components=t;if(!s.world)throw new Error("World not found!");c.world=s.world;await c.draw(i);c.onHighlight.add(({mesh:o})=>{r.highlighter.select(o);const p=o.curve.index,d=o.curve.alignment.absolute[p];d.mesh.geometry.computeBoundingSphere();const m=d.mesh.geometry.boundingSphere;m&&e.camera.controls.fitToSphere(m,!0)});const n=new A;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end()); diff --git a/examples/assets/classifier.js b/examples/assets/classifier.js index 7218f9c8d..f8a46db8b 100644 --- a/examples/assets/classifier.js +++ b/examples/assets/classifier.js @@ -1,4 +1,4 @@ -import{a7 as u,C as m}from"./web-ifc-api-BC8YMRiS.js";import{S as d}from"./stats.min-GTpOrGrX.js";import{p,a,m as c}from"./index-DyM33b1I.js";import{f as b,p as f,s as C,i as w,k as I,N as g,u as y,R as A}from"./index-b4ozRbQy.js";import"./_commonjsHelpers-Cpj98o6Y.js";const E=document.getElementById("container"),s=new b,L=s.get(f),t=L.create();t.scene=new C(s);t.renderer=new w(s,E);t.camera=new I(s);s.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const R=s.get(g);R.create(t);t.scene.three.background=null;const F=new y(s),N=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),S=await N.arrayBuffer(),h=new Uint8Array(S),i=F.load(h);t.scene.three.add(i);const o=s.get(A);o.byEntity(i);o.byIfcRel(i,u,"storeys");o.byModel(i.uuid,i);const T=o.find({entities:["IFCWALLSTANDARDCASE"]}),$=o.find({entities:["IFCSLAB"]}),k=o.find({entities:["IFCMEMBER","IFCPLATE"]}),U=o.find({entities:["IFCFURNISHINGELEMENT"]}),v=o.find({entities:["IFCDOOR"]}),B=o.find({models:[i.uuid]}),l=new d;l.showPanel(2);document.body.append(l.dom);l.dom.style.left="0px";l.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>l.begin());t.renderer.onAfterUpdate.add(()=>l.end());p.init();const e=new m,r=a.create(()=>c` +import{a7 as u,C as m}from"./web-ifc-api-BC8YMRiS.js";import{S as d}from"./stats.min-GTpOrGrX.js";import{p,a,m as c}from"./index-DyM33b1I.js";import{f as b,p as f,s as C,i as w,k as I,N as g,u as y,R as A}from"./index-C-JPXu_n.js";import"./_commonjsHelpers-Cpj98o6Y.js";const E=document.getElementById("container"),s=new b,L=s.get(f),t=L.create();t.scene=new C(s);t.renderer=new w(s,E);t.camera=new I(s);s.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const R=s.get(g);R.create(t);t.scene.three.background=null;const F=new y(s),N=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),S=await N.arrayBuffer(),h=new Uint8Array(S),i=F.load(h);t.scene.three.add(i);const o=s.get(A);o.byEntity(i);o.byIfcRel(i,u,"storeys");o.byModel(i.uuid,i);const T=o.find({entities:["IFCWALLSTANDARDCASE"]}),$=o.find({entities:["IFCSLAB"]}),k=o.find({entities:["IFCMEMBER","IFCPLATE"]}),U=o.find({entities:["IFCFURNISHINGELEMENT"]}),v=o.find({entities:["IFCDOOR"]}),B=o.find({models:[i.uuid]}),l=new d;l.showPanel(2);document.body.append(l.dom);l.dom.style.left="0px";l.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>l.begin());t.renderer.onAfterUpdate.add(()=>l.end());p.init();const e=new m,r=a.create(()=>c` diff --git a/examples/assets/clipper.js b/examples/assets/clipper.js index b8b38872e..17906c529 100644 --- a/examples/assets/clipper.js +++ b/examples/assets/clipper.js @@ -1,4 +1,4 @@ -import{B as r,b as m,M as p}from"./web-ifc-api-BC8YMRiS.js";import{S as d}from"./stats.min-GTpOrGrX.js";import{p as u,a as s,m as c}from"./index-DyM33b1I.js";import{f as h,p as k,s as g,i as w,k as y,H as f,m as v}from"./index-b4ozRbQy.js";import"./_commonjsHelpers-Cpj98o6Y.js";const b=document.getElementById("container"),a=new h,M=a.get(k),e=M.create();e.scene=new g(a);e.renderer=new w(a,b);e.camera=new y(a);a.init();e.camera.controls.setLookAt(10,10,10,0,0,0);e.scene.setup();e.scene.three.background=null;const x=new r(3,3,3),$=new m({color:"#6528D7"}),l=new p(x,$);l.position.set(0,1.5,0);e.scene.three.add(l);e.meshes.add(l);const P=a.get(f);P.get(e);const n=a.get(v);n.enabled=!0;b.ondblclick=()=>n.create(e);window.onkeydown=t=>{(t.code==="Delete"||t.code==="Backspace")&&n.delete(e)};const o=new d;o.showPanel(2);document.body.append(o.dom);o.dom.style.left="0px";o.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>o.begin());e.renderer.onAfterUpdate.add(()=>o.end());u.init();const i=s.create(()=>c` +import{B as r,b as m,M as p}from"./web-ifc-api-BC8YMRiS.js";import{S as d}from"./stats.min-GTpOrGrX.js";import{p as u,a as s,m as c}from"./index-DyM33b1I.js";import{f as h,p as k,s as g,i as w,k as y,H as f,m as v}from"./index-C-JPXu_n.js";import"./_commonjsHelpers-Cpj98o6Y.js";const b=document.getElementById("container"),a=new h,M=a.get(k),e=M.create();e.scene=new g(a);e.renderer=new w(a,b);e.camera=new y(a);a.init();e.camera.controls.setLookAt(10,10,10,0,0,0);e.scene.setup();e.scene.three.background=null;const x=new r(3,3,3),$=new m({color:"#6528D7"}),l=new p(x,$);l.position.set(0,1.5,0);e.scene.three.add(l);e.meshes.add(l);const P=a.get(f);P.get(e);const n=a.get(v);n.enabled=!0;b.ondblclick=()=>n.create(e);window.onkeydown=t=>{(t.code==="Delete"||t.code==="Backspace")&&n.delete(e)};const o=new d;o.showPanel(2);document.body.append(o.dom);o.dom.style.left="0px";o.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>o.begin());e.renderer.onAfterUpdate.add(()=>o.end());u.init();const i=s.create(()=>c` diff --git a/examples/assets/cullers.js b/examples/assets/cullers.js index 4d4538f7f..ac720a171 100644 --- a/examples/assets/cullers.js +++ b/examples/assets/cullers.js @@ -1 +1 @@ -import{B as c,k as m,M as i}from"./web-ifc-api-BC8YMRiS.js";import{S as l}from"./stats.min-GTpOrGrX.js";import{a as p,W as u,S as b,b as y,c as f,G as g}from"./index-BraZXcLv.js";import{C as w}from"./index-D6HCkz61.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./async-event-D8tC9awa.js";const h=document.getElementById("container"),t=new p,S=t.get(u),e=S.create();e.scene=new b(t);e.renderer=new y(t,h);e.camera=new f(t);t.init();e.camera.controls.setLookAt(13,13,13,0,0,0);e.scene.setup();const x=t.get(g);x.create(e);e.scene.three.background=null;const C=t.get(w),o=C.create(e);o.threshold=200;o.renderDebugFrame=!0;const s=o.renderer.domElement;document.body.appendChild(s);s.style.position="fixed";s.style.left="0";s.style.bottom="0";s.style.visibility="collapse";const M=new c(2,2,2),B=new m({color:"#6528D7"});function d(a){return Math.random()*a}function U(){for(let a=0;a<300;a++){const n=new i(M,B);n.position.x=d(10),n.position.y=d(10),n.position.z=d(10),n.updateMatrix(),e.scene.three.add(n),o.add(n)}}U();o.needsUpdate=!0;e.camera.controls.addEventListener("controlend",()=>{o.needsUpdate=!0});const r=new l;r.showPanel(2);document.body.append(r.dom);r.dom.style.left="0px";r.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>r.begin());e.renderer.onAfterUpdate.add(()=>r.end()); +import{B as c,k as m,M as i}from"./web-ifc-api-BC8YMRiS.js";import{S as l}from"./stats.min-GTpOrGrX.js";import{a as p,W as u,S as b,b as y,c as f,G as g}from"./index-BZiAUaTo.js";import{C as w}from"./index-CF1rTqG5.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./async-event-D8tC9awa.js";const h=document.getElementById("container"),t=new p,S=t.get(u),e=S.create();e.scene=new b(t);e.renderer=new y(t,h);e.camera=new f(t);t.init();e.camera.controls.setLookAt(13,13,13,0,0,0);e.scene.setup();const x=t.get(g);x.create(e);e.scene.three.background=null;const C=t.get(w),o=C.create(e);o.threshold=200;o.renderDebugFrame=!0;const s=o.renderer.domElement;document.body.appendChild(s);s.style.position="fixed";s.style.left="0";s.style.bottom="0";s.style.visibility="collapse";const M=new c(2,2,2),B=new m({color:"#6528D7"});function d(a){return Math.random()*a}function U(){for(let a=0;a<300;a++){const n=new i(M,B);n.position.x=d(10),n.position.y=d(10),n.position.z=d(10),n.updateMatrix(),e.scene.three.add(n),o.add(n)}}U();o.needsUpdate=!0;e.camera.controls.addEventListener("controlend",()=>{o.needsUpdate=!0});const r=new l;r.showPanel(2);document.body.append(r.dom);r.dom.style.left="0px";r.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>r.begin());e.renderer.onAfterUpdate.add(()=>r.end()); diff --git a/examples/assets/edgeMeasurement.js b/examples/assets/edgeMeasurement.js index a3aec6c67..39aed8512 100644 --- a/examples/assets/edgeMeasurement.js +++ b/examples/assets/edgeMeasurement.js @@ -1 +1 @@ -var D=Object.defineProperty;var K=(n,c,e)=>c in n?D(n,c,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[c]=e;var i=(n,c,e)=>(K(n,typeof c!="symbol"?c+"":c,e),e);import{L as T,V as v,M as _,I as z}from"./web-ifc-api-BC8YMRiS.js";import{S as C}from"./stats.min-GTpOrGrX.js";import{J as I,U,H as B,_ as k,f as N,p as O,s as V,k as j,N as F,u as H}from"./index-b4ozRbQy.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as R}from"./index-CwA6v-S5.js";import{S as J}from"./index-MPPnu1_m.js";import{L as p}from"./index-s8v5I1cn.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-BOMjjrxA.js";import"./mark-Cj_PmUva.js";import"./dimension-mark-BiAWnjiH.js";import"./graphic-vertex-picker-CEs1V3AG.js";const g=class g extends I{constructor(e){super(e);i(this,"preview");i(this,"tolerance",.3);i(this,"world");i(this,"onDisposed",new U);i(this,"_enabled",!1);i(this,"_lineMaterial",new T({color:"#DC2626",linewidth:2,depthTest:!1,transparent:!0}));i(this,"create",async()=>{if(!this.preview||!this.enabled||!this.preview.visible)return;const e=this.components.get(p);e.world=this.world;const s=this.preview.startPoint.clone(),t=this.preview.endPoint.clone();e.createOnPoints(s,t)});i(this,"onMouseMove",()=>{if(!this.preview)return;if(!this.world)throw new Error("The edge measurement needs a world to work!");if(!this.enabled){this.preview.visible=!1;return}const t=this.components.get(B).get(this.world).castRay();if(!t||!t.object){this.preview.visible=!1;return}const{object:r,faceIndex:d,point:a}=t;if(d===void 0){this.preview.visible=!1;return}r instanceof _||r instanceof z?this.updateSelection(r,a,d,t.instanceId):this.preview.visible=!1});i(this,"onKeydown",e=>{});this.components.add(g.uuid,this)}set enabled(e){if(this._enabled=e,this.setupEvents(e),e){if(!this.world)throw new Error("The edge measurement needs a world to work!");if(!this.preview){const s=document.createElement("div");s.className="w-2 h-2 bg-red-600 rounded-full",this.preview=new J(this.components,this.world,{start:new v,end:new v,lineMaterial:this._lineMaterial,endpointElement:s}),this.preview.visible=!1}}else this.cancelCreation()}get enabled(){return this._enabled}dispose(){this.preview&&this.preview.dispose(),this._lineMaterial.dispose(),this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset(),this.components=null}delete(){if(!this.enabled)return;const e=this.components.get(p),s=e.enabled;e.enabled=!0,e.delete(),e.enabled=s}deleteAll(){this.components.get(p).deleteAll()}endCreation(){}cancelCreation(){}get(){const s=this.components.get(p).list,t=[];for(const r of s){const d=r.startPoint,a=r.endPoint,w=[d.x,d.y,d.z,a.x,a.y,a.z];t.push(w)}return t}set(e){const s=this.components.get(p);s.world=this.world;for(const t of e){const[r,d,a,w,u,m]=t,b=new v(r,d,a),y=new v(w,u,m);s.createOnPoints(b,y)}}setupEvents(e){if(!this.world)throw new Error("The edge measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the edge measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;e?(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown)):(t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown))}updateSelection(e,s,t,r){if(!this.preview||!e.geometry.index)return;const a=this.components.get(k).getFace(e,t,r);if(!a)return;const{edges:w}=a;let u=Number.MAX_VALUE,m=[];for(const P of w){const[A,S]=P.points,E=k.distanceFromPointToLine(s,A,S,!0);E{n.code==="KeyO"?h.delete():n.code==="KeyS"?(L=h.get(),h.deleteAll()):n.code==="KeyL"&&L&&h.set(L)});const f=new C;f.showPanel(2);document.body.append(f.dom);f.dom.style.left="0px";o.renderer.onBeforeUpdate.add(()=>f.begin());o.renderer.onAfterUpdate.add(()=>f.end()); +var S=Object.defineProperty;var K=(n,c,e)=>c in n?S(n,c,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[c]=e;var i=(n,c,e)=>(K(n,typeof c!="symbol"?c+"":c,e),e);import{L as T,V as v,M as _,I as z}from"./web-ifc-api-BC8YMRiS.js";import{S as C}from"./stats.min-GTpOrGrX.js";import{J as I,D as B,H as N,_ as k,f as U,p as O,s as V,k as j,N as F,u as H}from"./index-C-JPXu_n.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as R}from"./index-q_Y48tt2.js";import{S as J}from"./index-CYkvDr46.js";import{L as p}from"./index-CwB6Igrg.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-Vj-QiZHm.js";import"./mark-Dwn_ERVH.js";import"./dimension-mark-BiAWnjiH.js";import"./graphic-vertex-picker-BH9d5rBm.js";const g=class g extends I{constructor(e){super(e);i(this,"preview");i(this,"tolerance",.3);i(this,"world");i(this,"onDisposed",new B);i(this,"_enabled",!1);i(this,"_lineMaterial",new T({color:"#DC2626",linewidth:2,depthTest:!1,transparent:!0}));i(this,"create",async()=>{if(!this.preview||!this.enabled||!this.preview.visible)return;const e=this.components.get(p);e.world=this.world;const s=this.preview.startPoint.clone(),t=this.preview.endPoint.clone();e.createOnPoints(s,t)});i(this,"onMouseMove",()=>{if(!this.preview)return;if(!this.world)throw new Error("The edge measurement needs a world to work!");if(!this.enabled){this.preview.visible=!1;return}const t=this.components.get(N).get(this.world).castRay();if(!t||!t.object){this.preview.visible=!1;return}const{object:r,faceIndex:a,point:d}=t;if(a===void 0){this.preview.visible=!1;return}r instanceof _||r instanceof z?this.updateSelection(r,d,a,t.instanceId):this.preview.visible=!1});i(this,"onKeydown",e=>{});this.components.add(g.uuid,this)}set enabled(e){if(this._enabled=e,this.setupEvents(e),e){if(!this.world)throw new Error("The edge measurement needs a world to work!");if(!this.preview){const s=document.createElement("div");s.className="w-2 h-2 bg-red-600 rounded-full",this.preview=new J(this.components,this.world,{start:new v,end:new v,lineMaterial:this._lineMaterial,endpointElement:s}),this.preview.visible=!1}}else this.cancelCreation()}get enabled(){return this._enabled}dispose(){this.preview&&this.preview.dispose(),this._lineMaterial.dispose(),this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset(),this.components=null}delete(){if(!this.enabled)return;const e=this.components.get(p),s=e.enabled;e.enabled=!0,e.delete(),e.enabled=s}deleteAll(){this.components.get(p).deleteAll()}endCreation(){}cancelCreation(){}get(){const s=this.components.get(p).list,t=[];for(const r of s){const a=r.startPoint,d=r.endPoint,w=[a.x,a.y,a.z,d.x,d.y,d.z];t.push(w)}return t}set(e){const s=this.components.get(p);s.world=this.world;for(const t of e){const[r,a,d,w,u,m]=t,b=new v(r,a,d),y=new v(w,u,m);s.createOnPoints(b,y)}}setupEvents(e){if(!this.world)throw new Error("The edge measurement needs a world to work!");if(this.world.isDisposing)return;if(!this.world.renderer)throw new Error("The world of the edge measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;e?(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown)):(t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown))}updateSelection(e,s,t,r){if(!this.preview||!e.geometry.index)return;const d=this.components.get(k).getFace(e,t,r);if(!d)return;const{edges:w}=d;let u=Number.MAX_VALUE,m=[];for(const P of w){const[A,D]=P.points,E=k.distanceFromPointToLine(s,A,D,!0);E{n.code==="KeyO"?h.delete():n.code==="KeyS"?(L=h.get(),h.deleteAll()):n.code==="KeyL"&&L&&h.set(L)});const f=new C;f.showPanel(2);document.body.append(f.dom);f.dom.style.left="0px";o.renderer.onBeforeUpdate.add(()=>f.begin());o.renderer.onAfterUpdate.add(()=>f.end()); diff --git a/examples/assets/edgesClipper.js b/examples/assets/edgesClipper.js index da61c7269..5263230a7 100644 --- a/examples/assets/edgesClipper.js +++ b/examples/assets/edgesClipper.js @@ -1,4 +1,4 @@ -import{B as h,b as w,M as c,d as s,L as d}from"./web-ifc-api-BC8YMRiS.js";import{S as M}from"./stats.min-GTpOrGrX.js";import{p as g,a as f,m as x}from"./index-DyM33b1I.js";import{f as y,p as k,s as P,k as v,N as B,H as C,m as $}from"./index-b4ozRbQy.js";import{C as E,E as I}from"./index-Dbd7DdKu.js";import{P as D}from"./index-CwA6v-S5.js";import"./import-wrapper-prod-LhqN7JJy.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-BOMjjrxA.js";const p=document.getElementById("container"),a=new y,L=a.get(k),e=L.create();e.scene=new P(a);e.renderer=new D(a,p);e.camera=new v(a);e.renderer.postproduction.enabled=!0;e.renderer.postproduction.customEffects.outlineEnabled=!0;a.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const b=a.get(B);b.config.color.setHex(6710886);const S=b.create(e);e.renderer.postproduction.customEffects.excludedMeshes.push(S.three);const m=new h(3,3,3),u=new w({color:"#6528D7"}),n=new c(m,u);n.position.set(-2,1.5,0);e.scene.three.add(n);e.meshes.add(n);const l=new c(m,u);l.position.set(2,1.5,0);e.scene.three.add(l);e.meshes.add(l);const z=a.get(C);z.get(e);const o=a.get($);o.enabled=!0;const r=a.get(E);o.Type=I;const A=new s({color:"lightblue",side:2}),H=new d({color:"blue"}),O=new s({color:"blue",opacity:.5,side:2,transparent:!0});r.styles.create("Red lines",new Set([n]),e,H,A,O);const R=new s({color:"salmon",side:2}),F=new d({color:"red"}),G=new s({color:"red",opacity:.5,side:2,transparent:!0});r.styles.create("Blue lines",new Set([l]),e,F,R,G);p.ondblclick=()=>o.create(e);window.onkeydown=t=>{(t.code==="Delete"||t.code==="Backspace")&&o.delete(e)};const i=new M;i.showPanel(2);document.body.append(i.dom);i.dom.style.left="0px";e.renderer.onBeforeUpdate.add(()=>i.begin());e.renderer.onAfterUpdate.add(()=>i.end());g.init();const N=f.create(()=>x` +import{B as h,b as w,M as c,d as s,L as d}from"./web-ifc-api-BC8YMRiS.js";import{S as M}from"./stats.min-GTpOrGrX.js";import{p as g,a as f,m as x}from"./index-DyM33b1I.js";import{f as y,p as k,s as P,k as v,N as B,H as C,m as $}from"./index-C-JPXu_n.js";import{C as E,E as I}from"./index-DHD4JXQh.js";import{P as D}from"./index-q_Y48tt2.js";import"./import-wrapper-prod-LhqN7JJy.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-Vj-QiZHm.js";const p=document.getElementById("container"),a=new y,L=a.get(k),e=L.create();e.scene=new P(a);e.renderer=new D(a,p);e.camera=new v(a);e.renderer.postproduction.enabled=!0;e.renderer.postproduction.customEffects.outlineEnabled=!0;a.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const b=a.get(B);b.config.color.setHex(6710886);const S=b.create(e);e.renderer.postproduction.customEffects.excludedMeshes.push(S.three);const m=new h(3,3,3),u=new w({color:"#6528D7"}),n=new c(m,u);n.position.set(-2,1.5,0);e.scene.three.add(n);e.meshes.add(n);const l=new c(m,u);l.position.set(2,1.5,0);e.scene.three.add(l);e.meshes.add(l);const z=a.get(C);z.get(e);const o=a.get($);o.enabled=!0;const r=a.get(E);o.Type=I;const A=new s({color:"lightblue",side:2}),H=new d({color:"blue"}),O=new s({color:"blue",opacity:.5,side:2,transparent:!0});r.styles.create("Red lines",new Set([n]),e,H,A,O);const R=new s({color:"salmon",side:2}),F=new d({color:"red"}),G=new s({color:"red",opacity:.5,side:2,transparent:!0});r.styles.create("Blue lines",new Set([l]),e,F,R,G);p.ondblclick=()=>o.create(e);window.onkeydown=t=>{(t.code==="Delete"||t.code==="Backspace")&&o.delete(e)};const i=new M;i.showPanel(2);document.body.append(i.dom);i.dom.style.left="0px";e.renderer.onBeforeUpdate.add(()=>i.begin());e.renderer.onAfterUpdate.add(()=>i.end());g.init();const N=f.create(()=>x` diff --git a/examples/assets/exploder.js b/examples/assets/exploder.js index b7e4ecd9a..4299e0afe 100644 --- a/examples/assets/exploder.js +++ b/examples/assets/exploder.js @@ -1,4 +1,4 @@ -import{a7 as c}from"./web-ifc-api-BC8YMRiS.js";import{S as l}from"./stats.min-GTpOrGrX.js";import{p,a,m as i}from"./index-DyM33b1I.js";import{f as d,p as m,s as b,i as u,k as f,N as g,u as h,O as w,R as y}from"./index-b4ozRbQy.js";import"./_commonjsHelpers-Cpj98o6Y.js";const k=document.getElementById("container"),t=new d,x=t.get(m),e=x.create();e.scene=new b(t);e.renderer=new u(t,k);e.camera=new f(t);t.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const I=t.get(g);I.create(e);e.scene.three.background=null;const L=new h(t),v=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),A=await v.arrayBuffer(),E=new Uint8Array(A),s=L.load(E);e.scene.three.add(s);const R=await fetch("https://thatopen.github.io/engine_components/resources/small.json");s.setLocalProperties(await R.json());const N=t.get(w),T=t.get(y);T.byIfcRel(s,c,"storeys");const n=new l;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end());p.init();const o=a.create(()=>i` +import{a7 as c}from"./web-ifc-api-BC8YMRiS.js";import{S as l}from"./stats.min-GTpOrGrX.js";import{p,a,m as i}from"./index-DyM33b1I.js";import{f as d,p as m,s as b,i as u,k as f,N as g,u as h,O as w,R as y}from"./index-C-JPXu_n.js";import"./_commonjsHelpers-Cpj98o6Y.js";const k=document.getElementById("container"),t=new d,x=t.get(m),e=x.create();e.scene=new b(t);e.renderer=new u(t,k);e.camera=new f(t);t.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const I=t.get(g);I.create(e);e.scene.three.background=null;const L=new h(t),v=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),A=await v.arrayBuffer(),E=new Uint8Array(A),s=L.load(E);e.scene.three.add(s);const R=await fetch("https://thatopen.github.io/engine_components/resources/small.json");s.setLocalProperties(await R.json());const N=t.get(w),T=t.get(y);T.byIfcRel(s,c,"storeys");const n=new l;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end());p.init();const o=a.create(()=>i` l in i?_(i,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[l]=e;var c=(i,l,e)=>(C(i,typeof l!="symbol"?l+"":l,e),e);import{M as f,c as E,d as S,e as A,I,T as N}from"./web-ifc-api-BC8YMRiS.js";import{S as j}from"./stats.min-GTpOrGrX.js";import{J as K,U as z,H as x,_ as L,f as D,p as H,s as O,k as U,N as R,u as V}from"./index-b4ozRbQy.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as G}from"./index-CwA6v-S5.js";import{M as J}from"./mark-Cj_PmUva.js";import{n as q}from"./dimension-mark-BiAWnjiH.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-BOMjjrxA.js";const y=class y extends K{constructor(e){super(e);c(this,"selection",[]);c(this,"preview",new f(new E,new S({side:2,depthTest:!1,transparent:!0,opacity:.25,color:"#BCF124"})));c(this,"selectionMaterial",new S({side:2,depthTest:!1,transparent:!0,color:"#BCF124",opacity:.75}));c(this,"world");c(this,"onDisposed",new z);c(this,"_enabled",!1);c(this,"_currentSelelection",null);c(this,"create",()=>{if(!this.world)throw new Error("No world given to the face measurement!");if(!this.enabled||!this._currentSelelection)return;const e=this.world.scene.three,o=new E,t=new f(o,this.selectionMaterial);o.setAttribute("position",this.preview.geometry.attributes.position),e.add(t),o.computeBoundingSphere();const{area:s,perimeter:r}=this._currentSelelection,n=this.newLabel(o,s);t.add(n.three),this.selection.push({area:s,perimeter:r,mesh:t,label:n})});c(this,"onMouseMove",()=>{if(!this.world)throw new Error("The face measurement needs a world to work!");if(!this.enabled){this.unselect();return}const t=this.components.get(x).get(this.world).castRay();if(!t||!t.object||t.faceIndex===void 0){this.unselect();return}const{object:s,faceIndex:r}=t;s instanceof f||s instanceof I?this.updateSelection(s,r,t.instanceId):this.unselect()});c(this,"onKeydown",e=>{});this.components.add(y.uuid,this),this.preview.frustumCulled=!1}set enabled(e){if(!this.world)throw new Error("No world given for the Face measurement!");this._enabled=e,this.setupEvents(e),e?this.world.scene.three.add(this.preview):(this.preview.removeFromParent(),this.cancelCreation()),this.setVisibility(e)}get enabled(){return this._enabled}dispose(){this.setupEvents(!1),this.deleteAll(),this.preview.removeFromParent(),this.preview.material.dispose(),this.preview.geometry.dispose(),this.selectionMaterial.dispose(),this.onDisposed.trigger(),this.onDisposed.reset(),this.components=null}delete(){if(!this.world)throw new Error("No world given to the face measurement!");const e=this.selection.map(a=>a.mesh),s=this.components.get(x).get(this.world).castRay(e);if(!s||!s.object)return;const r=this.selection.find(a=>a.mesh===s.object);if(!r)return;r.mesh.removeFromParent(),r.mesh.geometry.dispose(),r.label.dispose();const n=this.selection.indexOf(r);this.selection.splice(n,1)}deleteAll(){for(const e of this.selection)e.mesh.removeFromParent(),e.mesh.geometry.dispose(),e.label.dispose();this.selection=[]}endCreation(){}cancelCreation(){}get(){const e=[];for(const o of this.selection){const t=o.mesh.geometry,{area:s,perimeter:r}=o,n=t.attributes.position.array;e.push({position:n,area:s,perimeter:r})}return e}set(e){if(!this.world)throw new Error("No world given to the face measurement!");const o=this.world.scene.three;for(const t of e){const s=new E,r=new f(s,this.selectionMaterial);o.add(r);const n=new A(t.position,3);s.setAttribute("position",n),s.computeBoundingSphere();const{area:a,perimeter:m}=t,w=this.newLabel(s,a);r.add(w.three),this.selection.push({area:a,perimeter:m,mesh:r,label:w})}}setupEvents(e){if(!this.world)throw new Error("The face measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the face measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown),e&&(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown))}setVisibility(e){if(!this.world)throw new Error("The face measurement needs a world to work!");const o=this.world.scene.three;for(const t of this.selection){const s=t.label.three;e?(o.add(t.mesh),t.mesh.add(s)):(t.mesh.removeFromParent(),s.removeFromParent())}}unselect(){this.preview.removeFromParent(),this._currentSelelection=null}updateSelection(e,o,t){if(!this.world)throw new Error("The face measurement needs a world to work!");this.world.scene.three.add(this.preview);const n=this.components.get(L).getFace(e,o,t);if(n===null)return;const a=this.regenerateHighlight(e,n.indices,t);let m=0;for(const{distance:w}of n.edges)m+=w;this._currentSelelection={perimeter:m,area:a}}newLabel(e,o){if(!e.boundingSphere)throw new Error("Error computing area geometry");if(!this.world)throw new Error("The face measurement needs a world to work!");const{center:t}=e.boundingSphere,s=q(),r=Math.trunc(o*100)/100;s.textContent=r.toString();const n=new J(this.world,s);return n.three.position.copy(t),n}regenerateHighlight(e,o,t){const s=[],r=[];let n=0,a=0;const m=new N,w=this.components.get(L);for(const P of o){const{p1:g,p2:b,p3:v}=w.getVerticesAndNormal(e,P,t);s.push(g.x,g.y,g.z),s.push(b.x,b.y,b.z),s.push(v.x,v.y,v.z),m.set(g,b,v),a+=m.getArea(),r.push(n,n+1,n+2),n+=3}const B=new Float32Array(s),F=new A(B,3);return this.preview.geometry.setAttribute("position",F),this.preview.geometry.setIndex(r),a}};c(y,"uuid","30279548-1309-44f6-aa97-ce26eed73522");let k=y;const Q=document.getElementById("container"),h=new D,W=h.get(H),d=W.create();d.scene=new O(h);d.renderer=new G(h,Q);d.camera=new U(h);h.init();d.camera.controls.setLookAt(5,5,5,0,0,0);d.scene.setup();const X=h.get(R);X.create(d);const p=new k(h);p.world=d;p.enabled=!0;const Y=new V(h),Z=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),$=await Z.arrayBuffer(),ee=new Uint8Array($),T=Y.load(ee);d.scene.three.add(T);for(const i of T.children)i instanceof f&&d.meshes.add(i);let M;window.addEventListener("keydown",i=>{i.code==="KeyO"?p.delete():i.code==="KeyS"?(M=p.get(),p.deleteAll()):i.code==="KeyL"&&M&&p.set(M)});const u=new j;u.showPanel(2);document.body.append(u.dom);u.dom.style.left="0px";d.renderer.onBeforeUpdate.add(()=>u.begin());d.renderer.onAfterUpdate.add(()=>u.end()); +var _=Object.defineProperty;var C=(i,l,e)=>l in i?_(i,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[l]=e;var c=(i,l,e)=>(C(i,typeof l!="symbol"?l+"":l,e),e);import{M as f,c as E,d as S,e as A,I,T as N}from"./web-ifc-api-BC8YMRiS.js";import{S as j}from"./stats.min-GTpOrGrX.js";import{J as D,D as K,H as x,_ as L,f as z,p as H,s as O,k as R,N as U,u as V}from"./index-C-JPXu_n.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as G}from"./index-q_Y48tt2.js";import{M as J}from"./mark-Dwn_ERVH.js";import{n as q}from"./dimension-mark-BiAWnjiH.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-Vj-QiZHm.js";const y=class y extends D{constructor(e){super(e);c(this,"selection",[]);c(this,"preview",new f(new E,new S({side:2,depthTest:!1,transparent:!0,opacity:.25,color:"#BCF124"})));c(this,"selectionMaterial",new S({side:2,depthTest:!1,transparent:!0,color:"#BCF124",opacity:.75}));c(this,"world");c(this,"onDisposed",new K);c(this,"_enabled",!1);c(this,"_currentSelelection",null);c(this,"create",()=>{if(!this.world)throw new Error("No world given to the face measurement!");if(!this.enabled||!this._currentSelelection)return;const e=this.world.scene.three,o=new E,t=new f(o,this.selectionMaterial);o.setAttribute("position",this.preview.geometry.attributes.position),e.add(t),o.computeBoundingSphere();const{area:s,perimeter:r}=this._currentSelelection,n=this.newLabel(o,s);t.add(n.three),this.selection.push({area:s,perimeter:r,mesh:t,label:n})});c(this,"onMouseMove",()=>{if(!this.world)throw new Error("The face measurement needs a world to work!");if(!this.enabled){this.unselect();return}const t=this.components.get(x).get(this.world).castRay();if(!t||!t.object||t.faceIndex===void 0){this.unselect();return}const{object:s,faceIndex:r}=t;s instanceof f||s instanceof I?this.updateSelection(s,r,t.instanceId):this.unselect()});c(this,"onKeydown",e=>{});this.components.add(y.uuid,this),this.preview.frustumCulled=!1}set enabled(e){if(!this.world)throw new Error("No world given for the Face measurement!");this._enabled=e,this.setupEvents(e),e?this.world.scene.three.add(this.preview):(this.preview.removeFromParent(),this.cancelCreation()),this.setVisibility(e)}get enabled(){return this._enabled}dispose(){this.setupEvents(!1),this.deleteAll(),this.preview.removeFromParent(),this.preview.material.dispose(),this.preview.geometry.dispose(),this.selectionMaterial.dispose(),this.onDisposed.trigger(),this.onDisposed.reset(),this.components=null}delete(){if(!this.world)throw new Error("No world given to the face measurement!");const e=this.selection.map(a=>a.mesh),s=this.components.get(x).get(this.world).castRay(e);if(!s||!s.object)return;const r=this.selection.find(a=>a.mesh===s.object);if(!r)return;r.mesh.removeFromParent(),r.mesh.geometry.dispose(),r.label.dispose();const n=this.selection.indexOf(r);this.selection.splice(n,1)}deleteAll(){for(const e of this.selection)e.mesh.removeFromParent(),e.mesh.geometry.dispose(),e.label.dispose();this.selection=[]}endCreation(){}cancelCreation(){}get(){const e=[];for(const o of this.selection){const t=o.mesh.geometry,{area:s,perimeter:r}=o,n=t.attributes.position.array;e.push({position:n,area:s,perimeter:r})}return e}set(e){if(!this.world)throw new Error("No world given to the face measurement!");const o=this.world.scene.three;for(const t of e){const s=new E,r=new f(s,this.selectionMaterial);o.add(r);const n=new A(t.position,3);s.setAttribute("position",n),s.computeBoundingSphere();const{area:a,perimeter:m}=t,w=this.newLabel(s,a);r.add(w.three),this.selection.push({area:a,perimeter:m,mesh:r,label:w})}}setupEvents(e){if(!this.world)throw new Error("The face measurement needs a world to work!");if(this.world.isDisposing)return;if(!this.world.renderer)throw new Error("The world of the face measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown),e&&(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown))}setVisibility(e){if(!this.world)throw new Error("The face measurement needs a world to work!");const o=this.world.scene.three;for(const t of this.selection){const s=t.label.three;e?(o.add(t.mesh),t.mesh.add(s)):(t.mesh.removeFromParent(),s.removeFromParent())}}unselect(){this.preview.removeFromParent(),this._currentSelelection=null}updateSelection(e,o,t){if(!this.world)throw new Error("The face measurement needs a world to work!");this.world.scene.three.add(this.preview);const n=this.components.get(L).getFace(e,o,t);if(n===null)return;const a=this.regenerateHighlight(e,n.indices,t);let m=0;for(const{distance:w}of n.edges)m+=w;this._currentSelelection={perimeter:m,area:a}}newLabel(e,o){if(!e.boundingSphere)throw new Error("Error computing area geometry");if(!this.world)throw new Error("The face measurement needs a world to work!");const{center:t}=e.boundingSphere,s=q(),r=Math.trunc(o*100)/100;s.textContent=r.toString();const n=new J(this.world,s);return n.three.position.copy(t),n}regenerateHighlight(e,o,t){const s=[],r=[];let n=0,a=0;const m=new N,w=this.components.get(L);for(const P of o){const{p1:g,p2:b,p3:v}=w.getVerticesAndNormal(e,P,t);s.push(g.x,g.y,g.z),s.push(b.x,b.y,b.z),s.push(v.x,v.y,v.z),m.set(g,b,v),a+=m.getArea(),r.push(n,n+1,n+2),n+=3}const B=new Float32Array(s),F=new A(B,3);return this.preview.geometry.setAttribute("position",F),this.preview.geometry.setIndex(r),a}};c(y,"uuid","30279548-1309-44f6-aa97-ce26eed73522");let k=y;const Q=document.getElementById("container"),h=new z,W=h.get(H),d=W.create();d.scene=new O(h);d.renderer=new G(h,Q);d.camera=new R(h);h.init();d.camera.controls.setLookAt(5,5,5,0,0,0);d.scene.setup();const X=h.get(U);X.create(d);const p=new k(h);p.world=d;p.enabled=!0;const Y=new V(h),Z=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),$=await Z.arrayBuffer(),ee=new Uint8Array($),T=Y.load(ee);d.scene.three.add(T);for(const i of T.children)i instanceof f&&d.meshes.add(i);let M;window.addEventListener("keydown",i=>{i.code==="KeyO"?p.delete():i.code==="KeyS"?(M=p.get(),p.deleteAll()):i.code==="KeyL"&&M&&p.set(M)});const u=new j;u.showPanel(2);document.body.append(u.dom);u.dom.style.left="0px";d.renderer.onBeforeUpdate.add(()=>u.begin());d.renderer.onAfterUpdate.add(()=>u.end()); diff --git a/examples/assets/fragmentsManager.js b/examples/assets/fragmentsManager.js index f53f3e6bf..889ac6228 100644 --- a/examples/assets/fragmentsManager.js +++ b/examples/assets/fragmentsManager.js @@ -1,4 +1,4 @@ -import"./web-ifc-api-BC8YMRiS.js";import{S as u}from"./stats.min-GTpOrGrX.js";import{f as p,p as b,s as f,i as g,k as w,N as h,u as k}from"./index-b4ozRbQy.js";import{p as y,a as l,m}from"./index-DyM33b1I.js";import"./_commonjsHelpers-Cpj98o6Y.js";const L=document.getElementById("container"),n=new p,v=n.get(b),e=v.create();e.scene=new f(n);e.renderer=new g(n,L);e.camera=new w(n);n.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const x=n.get(h);x.create(e);e.scene.three.background=null;const s=n.get(k);let d="";async function F(){if(s.groups.size)return;const t=await(await fetch("https://thatopen.github.io/engine_components/resources/small.frag")).arrayBuffer(),c=new Uint8Array(t),i=s.load(c);e.scene.three.add(i),d=i.uuid}function U(o){const t=document.createElement("a");t.href=URL.createObjectURL(o),t.download=o.name,document.body.appendChild(t),t.click(),t.remove()}function $(){if(!s.groups.size)return;const o=s.groups.get(d);if(!o)return;const t=s.export(o),c=new Blob([t]),i=new File([c],"small.frag");U(i)}function B(){s.dispose()}const a=new u;a.showPanel(2);document.body.append(a.dom);a.dom.style.left="0px";a.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>a.begin());e.renderer.onAfterUpdate.add(()=>a.end());y.init();const r=l.create(()=>m` +import"./web-ifc-api-BC8YMRiS.js";import{S as u}from"./stats.min-GTpOrGrX.js";import{f as p,p as b,s as f,i as g,k as w,N as h,u as k}from"./index-C-JPXu_n.js";import{p as y,a as l,m}from"./index-DyM33b1I.js";import"./_commonjsHelpers-Cpj98o6Y.js";const L=document.getElementById("container"),n=new p,v=n.get(b),e=v.create();e.scene=new f(n);e.renderer=new g(n,L);e.camera=new w(n);n.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const x=n.get(h);x.create(e);e.scene.three.background=null;const s=n.get(k);let d="";async function F(){if(s.groups.size)return;const t=await(await fetch("https://thatopen.github.io/engine_components/resources/small.frag")).arrayBuffer(),c=new Uint8Array(t),i=s.load(c);e.scene.three.add(i),d=i.uuid}function U(o){const t=document.createElement("a");t.href=URL.createObjectURL(o),t.download=o.name,document.body.appendChild(t),t.click(),t.remove()}function $(){if(!s.groups.size)return;const o=s.groups.get(d);if(!o)return;const t=s.export(o),c=new Blob([t]),i=new File([c],"small.frag");U(i)}function B(){s.dispose()}const a=new u;a.showPanel(2);document.body.append(a.dom);a.dom.style.left="0px";a.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>a.begin());e.renderer.onAfterUpdate.add(()=>a.end());y.init();const r=l.create(()=>m` diff --git a/examples/assets/graphic-vertex-picker-CEs1V3AG.js b/examples/assets/graphic-vertex-picker-BH9d5rBm.js similarity index 84% rename from examples/assets/graphic-vertex-picker-CEs1V3AG.js rename to examples/assets/graphic-vertex-picker-BH9d5rBm.js index c803467cf..2b4415e8a 100644 --- a/examples/assets/graphic-vertex-picker-CEs1V3AG.js +++ b/examples/assets/graphic-vertex-picker-BH9d5rBm.js @@ -1 +1 @@ -var a=Object.defineProperty;var m=(s,r,e)=>r in s?a(s,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[r]=e;var t=(s,r,e)=>(m(s,typeof r!="symbol"?r+"":r,e),e);import{e as o,U as h}from"./index-b4ozRbQy.js";import{M as k}from"./mark-Cj_PmUva.js";import"./web-ifc-api-BC8YMRiS.js";import"./import-wrapper-prod-LhqN7JJy.js";class l extends o{constructor(){super(...arguments);t(this,"onDisposed",new h);t(this,"marker",null)}dispose(){this.marker&&this.marker.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(e){const i=super.get(e);return i?(this.marker||(this.marker=new k(e)),this.marker.world!==e&&(this.marker.world=e,this.marker.three.removeFromParent(),e.scene.three.add(this.marker.three)),this.marker.visible=!0,this.marker.three.position.copy(i)):this.marker&&(this.marker.visible=!1),i}}export{l as G}; +var a=Object.defineProperty;var m=(s,r,e)=>r in s?a(s,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[r]=e;var t=(s,r,e)=>(m(s,typeof r!="symbol"?r+"":r,e),e);import{e as o,D as h}from"./index-C-JPXu_n.js";import{M as k}from"./mark-Dwn_ERVH.js";import"./web-ifc-api-BC8YMRiS.js";import"./import-wrapper-prod-LhqN7JJy.js";class l extends o{constructor(){super(...arguments);t(this,"onDisposed",new h);t(this,"marker",null)}dispose(){this.marker&&this.marker.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(e){const i=super.get(e);return i?(this.marker||(this.marker=new k(e)),this.marker.world!==e&&(this.marker.world=e,this.marker.three.removeFromParent(),e.scene.three.add(this.marker.three)),this.marker.visible=!0,this.marker.three.position.copy(i)):this.marker&&(this.marker.visible=!1),i}}export{l as G}; diff --git a/examples/assets/grids.js b/examples/assets/grids.js index 03c86f00e..93681fa8f 100644 --- a/examples/assets/grids.js +++ b/examples/assets/grids.js @@ -1 +1 @@ -import{M as o,B as s}from"./web-ifc-api-BC8YMRiS.js";import{f as r,p as a,s as d,i as c,k as i,N as m}from"./index-b4ozRbQy.js";const l=document.getElementById("container"),n=new r,p=n.get(a),e=p.create();e.scene=new d(n);e.renderer=new c(n,l);e.camera=new i(n);n.init();const w=new o(new s);e.scene.three.add(w);e.scene.three.background=null;const g=n.get(m),f=g.create(e);console.log(f);const t=new Stats;t.showPanel(2);document.body.append(t.dom);t.dom.style.left="0px";t.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>t.begin());e.renderer.onAfterUpdate.add(()=>t.end()); +import{M as o,B as s}from"./web-ifc-api-BC8YMRiS.js";import{f as r,p as a,s as d,i as c,k as i,N as m}from"./index-C-JPXu_n.js";const l=document.getElementById("container"),n=new r,p=n.get(a),e=p.create();e.scene=new d(n);e.renderer=new c(n,l);e.camera=new i(n);n.init();const w=new o(new s);e.scene.three.add(w);e.scene.three.background=null;const g=n.get(m),f=g.create(e);console.log(f);const t=new Stats;t.showPanel(2);document.body.append(t.dom);t.dom.style.left="0px";t.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>t.begin());e.renderer.onAfterUpdate.add(()=>t.end()); diff --git a/examples/assets/hider.js b/examples/assets/hider.js index f97abee89..786a89283 100644 --- a/examples/assets/hider.js +++ b/examples/assets/hider.js @@ -1,4 +1,4 @@ -import"./web-ifc-api-BC8YMRiS.js";import{S as g}from"./stats.min-GTpOrGrX.js";import{p as h,a as i,m as r}from"./index-DyM33b1I.js";import{f as w,p as y,s as k,i as S,k as x,N as v,u as $,W as j,g as L,R as N}from"./index-b4ozRbQy.js";import"./_commonjsHelpers-Cpj98o6Y.js";const F=document.getElementById("container"),e=new w,R=e.get(y),t=R.create();t.scene=new k(e);t.renderer=new S(e,F);t.camera=new x(e);e.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const A=e.get(v);A.create(t);t.scene.three.background=null;const B=e.get($),C=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),O=await C.arrayBuffer(),U=new Uint8Array(O),c=B.load(U);t.scene.three.add(c);const _=await fetch("https://thatopen.github.io/engine_components/resources/small.json");c.setLocalProperties(await _.json());const d=e.get(j),q=await fetch("https://thatopen.github.io/engine_components/resources/small-relations.json"),E=d.getRelationsMapFromJSON(await q.text());d.setRelationMap(c,E);const u=e.get(L),o=e.get(N);o.byEntity(c);await o.bySpatialStructure(c);const a=new g;a.showPanel(2);document.body.append(a.dom);a.dom.style.left="0px";a.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>a.begin());t.renderer.onAfterUpdate.add(()=>a.end());h.init();const b={},I=Object.keys(o.list.spatialStructures);for(const n of I)b[n]=!0;const f={},M=Object.keys(o.list.entities);for(const n of M)f[n]=!0;const s=i.create(()=>r` +import"./web-ifc-api-BC8YMRiS.js";import{S as g}from"./stats.min-GTpOrGrX.js";import{p as h,a as i,m as r}from"./index-DyM33b1I.js";import{f as w,p as y,s as k,i as S,k as x,N as v,u as $,W as j,g as L,R as N}from"./index-C-JPXu_n.js";import"./_commonjsHelpers-Cpj98o6Y.js";const F=document.getElementById("container"),e=new w,R=e.get(y),t=R.create();t.scene=new k(e);t.renderer=new S(e,F);t.camera=new x(e);e.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const A=e.get(v);A.create(t);t.scene.three.background=null;const B=e.get($),C=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),O=await C.arrayBuffer(),U=new Uint8Array(O),c=B.load(U);t.scene.three.add(c);const _=await fetch("https://thatopen.github.io/engine_components/resources/small.json");c.setLocalProperties(await _.json());const d=e.get(j),q=await fetch("https://thatopen.github.io/engine_components/resources/small-relations.json"),E=d.getRelationsMapFromJSON(await q.text());d.setRelationMap(c,E);const u=e.get(L),o=e.get(N);o.byEntity(c);await o.bySpatialStructure(c);const a=new g;a.showPanel(2);document.body.append(a.dom);a.dom.style.left="0px";a.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>a.begin());t.renderer.onAfterUpdate.add(()=>a.end());h.init();const b={},I=Object.keys(o.list.spatialStructures);for(const n of I)b[n]=!0;const f={},M=Object.keys(o.list.entities);for(const n of M)f[n]=!0;const s=i.create(()=>r` diff --git a/examples/assets/highlighter.js b/examples/assets/highlighter.js index dfe476249..46ed98198 100644 --- a/examples/assets/highlighter.js +++ b/examples/assets/highlighter.js @@ -1 +1 @@ -import"./web-ifc-api-BC8YMRiS.js";import{S as r}from"./stats.min-GTpOrGrX.js";import{f as s,p as a,s as c,i,k as d,N as m,u as p}from"./index-b4ozRbQy.js";import"./import-wrapper-prod-LhqN7JJy.js";import{H as f}from"./index-DHjX9tRF.js";import"./_commonjsHelpers-Cpj98o6Y.js";const l=document.getElementById("container"),t=new s,g=t.get(a),e=g.create();e.scene=new c(t);e.renderer=new i(t,l);e.camera=new d(t);t.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const w=t.get(m);w.create(e);const h=new p(t),u=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),y=await u.arrayBuffer(),b=new Uint8Array(y),k=h.load(b);e.scene.three.add(k);const n=t.get(f);n.setup({world:e});n.zoomToSelection=!0;const o=new r;o.showPanel(2);document.body.append(o.dom);o.dom.style.left="0px";e.renderer.onBeforeUpdate.add(()=>o.begin());e.renderer.onAfterUpdate.add(()=>o.end()); +import"./web-ifc-api-BC8YMRiS.js";import{S as r}from"./stats.min-GTpOrGrX.js";import{f as s,p as a,s as c,i,k as d,N as m,u as p}from"./index-C-JPXu_n.js";import"./import-wrapper-prod-LhqN7JJy.js";import{H as f}from"./index-C5tZttZE.js";import"./_commonjsHelpers-Cpj98o6Y.js";const l=document.getElementById("container"),t=new s,g=t.get(a),e=g.create();e.scene=new c(t);e.renderer=new i(t,l);e.camera=new d(t);t.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const w=t.get(m);w.create(e);const h=new p(t),u=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),y=await u.arrayBuffer(),b=new Uint8Array(y),k=h.load(b);e.scene.three.add(k);const n=t.get(f);n.setup({world:e});n.zoomToSelection=!0;const o=new r;o.showPanel(2);document.body.append(o.dom);o.dom.style.left="0px";e.renderer.onBeforeUpdate.add(()=>o.begin());e.renderer.onAfterUpdate.add(()=>o.end()); diff --git a/examples/assets/ifcGeometryTiler.js b/examples/assets/ifcGeometryTiler.js index c176bdea5..b193e3d9e 100644 --- a/examples/assets/ifcGeometryTiler.js +++ b/examples/assets/ifcGeometryTiler.js @@ -1,4 +1,4 @@ -var _t=Object.defineProperty;var Et=(d,t,e)=>t in d?_t(d,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[t]=e;var y=(d,t,e)=>(Et(d,typeof t!="symbol"?t+"":t,e),e);import{V as w,r as Tt,P as Ct,T as Dt,_ as V,a as B,a8 as bt,X as Pt,$ as At,a9 as Gt,aa as Vt,ab as Lt,h as kt,ac as Nt}from"./web-ifc-api-BC8YMRiS.js";import{S as Ut}from"./stats.min-GTpOrGrX.js";import{p as qt,a as Bt,m as Ht}from"./index-DyM33b1I.js";import{C as jt,E as H,a as Ot,W as Rt,S as Wt,b as $t,c as Xt,G as Jt}from"./index-BraZXcLv.js";import{I as Kt}from"./streaming-settings-CK_tvevt.js";import{S as Qt,I as Yt,C as Zt}from"./ifc-metadata-reader-j9dl-lHS.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./ifc-fragment-settings-CiVry-YT.js";const tt=0,te=1,ee=new w,vt=new Tt,rt=new Ct,Ft=new w,Z=new Dt;class se{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new St,this.unassigned=new St,this.vertices=[]}setFromPoints(t){if(t.length>=4){this.makeEmpty();for(let e=0,s=t.length;ethis.tolerance)return!1;return!0}intersectRay(t,e){const s=this.faces;let i=-1/0,n=1/0;for(let a=0,o=s.length;a0&&u>=0)return null;const f=u!==0?-r/u:0;if(!(f<=0)&&(u>0?n=Math.min(f,n):i=Math.max(f,i),i>n))return null}return i!==-1/0?t.at(i,e):t.at(n,e),e}intersectsRay(t){return this.intersectRay(t,ee)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(t,e){return t.face=e,e.outside===null?this.assigned.append(t):this.assigned.insertBefore(e.outside,t),e.outside=t,this}removeVertexFromFace(t,e){return t===e.outside&&(t.next!==null&&t.next.face===e?e.outside=t.next:e.outside=null),this.assigned.remove(t),this}removeAllVerticesFromFace(t){if(t.outside!==null){const e=t.outside;let s=t.outside;for(;s.next!==null&&s.next.face===t;)s=s.next;return this.assigned.removeSubList(e,s),e.prev=s.next=null,t.outside=null,e}}deleteFaceVertices(t,e){const s=this.removeAllVerticesFromFace(t);if(s!==void 0)if(e===void 0)this.unassigned.appendChain(s);else{let i=s;do{const n=i.next;e.distanceToPoint(i.point)>this.tolerance?this.addVertexToFace(i,e):this.unassigned.append(i),i=n}while(i!==null)}return this}resolveUnassignedPoints(t){if(this.unassigned.isEmpty()===!1){let e=this.unassigned.first();do{const s=e.next;let i=this.tolerance,n=null;for(let a=0;ai&&(i=c,n=o),i>1e3*this.tolerance)break}}n!==null&&this.addVertexToFace(e,n),e=s}while(e!==null)}return this}computeExtremes(){const t=new w,e=new w,s=[],i=[];for(let n=0;n<3;n++)s[n]=i[n]=this.vertices[0];t.copy(this.vertices[0].point),e.copy(this.vertices[0].point);for(let n=0,a=this.vertices.length;ne.getComponent(r)&&(e.setComponent(r,c.getComponent(r)),i[r]=o)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(t.x),Math.abs(e.x))+Math.max(Math.abs(t.y),Math.abs(e.y))+Math.max(Math.abs(t.z),Math.abs(e.z))),{min:s,max:i}}computeInitialHull(){const t=this.vertices,e=this.computeExtremes(),s=e.min,i=e.max;let n=0,a=0;for(let h=0;h<3;h++){const l=i[h].point.getComponent(h)-s[h].point.getComponent(h);l>n&&(n=l,a=h)}const o=s[a],c=i[a];let r,u;n=0,vt.set(o.point,c.point);for(let h=0,l=this.vertices.length;hn&&(n=p,r=m)}}n=-1,rt.setFromCoplanarPoints(o.point,c.point,r.point);for(let h=0,l=this.vertices.length;hn&&(n=p,u=m)}}const f=[];if(rt.distanceToPoint(u.point)<0){f.push(_.create(o,c,r),_.create(u,c,o),_.create(u,r,c),_.create(u,o,r));for(let h=0;h<3;h++){const l=(h+1)%3;f[h+1].getEdge(2).setTwin(f[0].getEdge(l)),f[h+1].getEdge(1).setTwin(f[l+1].getEdge(0))}}else{f.push(_.create(o,r,c),_.create(u,o,c),_.create(u,c,r),_.create(u,r,o));for(let h=0;h<3;h++){const l=(h+1)%3;f[h+1].getEdge(2).setTwin(f[0].getEdge((3-h)%3)),f[h+1].getEdge(0).setTwin(f[l+1].getEdge(1))}}for(let h=0;h<4;h++)this.faces.push(f[h]);for(let h=0,l=t.length;hn&&(n=z,p=this.faces[F])}p!==null&&this.addVertexToFace(m,p)}}return this}reindexFaces(){const t=[];for(let e=0;ee&&(e=n,t=i),i=i.next}while(i!==null&&i.face===s);return t}}computeHorizon(t,e,s,i){this.deleteFaceVertices(s),s.mark=te;let n;e===null?n=e=s.getEdge(0):n=e.next;do{const a=n.twin,o=a.face;o.mark===tt&&(o.distanceToPoint(t)>this.tolerance?this.computeHorizon(t,a,o,i):i.push(n)),n=n.next}while(n!==e);return this}addAdjoiningFace(t,e){const s=_.create(t,e.tail(),e.head());return this.faces.push(s),s.getEdge(-1).setTwin(e.twin),s.getEdge(0)}addNewFaces(t,e){this.newFaces=[];let s=null,i=null;for(let n=0;n0;)e=e.next,t--;for(;t<0;)e=e.prev,t++;return e}compute(){const t=this.edge.tail(),e=this.edge.head(),s=this.edge.next.head();return Z.set(t.point,e.point,s.point),Z.getNormal(this.normal),Z.getMidpoint(this.midpoint),this.area=Z.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(t){return this.normal.dot(t)-this.constant}}class ct{constructor(t,e){this.vertex=t,this.prev=null,this.next=null,this.twin=null,this.face=e}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const t=this.head(),e=this.tail();return e!==null?e.point.distanceTo(t.point):-1}lengthSquared(){const t=this.head(),e=this.tail();return e!==null?e.point.distanceToSquared(t.point):-1}setTwin(t){return this.twin=t,t.twin=this,this}}class ne{constructor(t){this.point=t,this.prev=null,this.next=null,this.face=null}}class St{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(t,e){return e.prev=t.prev,e.next=t,e.prev===null?this.head=e:e.prev.next=e,t.prev=e,this}insertAfter(t,e){return e.prev=t,e.next=t.next,e.next===null?this.tail=e:e.next.prev=e,t.next=e,this}append(t){return this.head===null?this.head=t:this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t,this}appendChain(t){for(this.head===null?this.head=t:this.tail.next=t,t.prev=this.tail;t.next!==null;)t=t.next;return this.tail=t,this}remove(t){return t.prev===null?this.head=t.next:t.prev.next=t.next,t.next===null?this.tail=t.prev:t.next.prev=t.prev,this}removeSubList(t,e){return t.prev===null?this.head=e.next:t.prev.next=e.next,e.next===null?this.tail=t.prev:e.next.prev=t.prev,this}isEmpty(){return this.head===null}}const lt=[2,2,1],ht=[1,0,0];function E(d,t){return d*3+t}function ie(d){const t=d.elements;let e=0;for(let s=0;s<9;s++)e+=t[s]*t[s];return Math.sqrt(e)}function oe(d){const t=d.elements;let e=0;for(let s=0;s<3;s++){const i=t[E(lt[s],ht[s])];e+=2*i*i}return Math.sqrt(e)}function ae(d,t){let e=0,s=1;const i=d.elements;for(let r=0;r<3;r++){const u=Math.abs(i[E(lt[r],ht[r])]);u>e&&(e=u,s=r)}let n=1,a=0;const o=ht[s],c=lt[s];if(Math.abs(i[E(c,o)])>Number.EPSILON){const r=i[E(c,c)],u=i[E(o,o)],f=i[E(c,o)],h=(r-u)/2/f;let l;h<0?l=-1/(-h+Math.sqrt(1+h*h)):l=1/(h+Math.sqrt(1+h*h)),n=1/Math.sqrt(1+l*l),a=l*n}return t.identity(),t.elements[E(o,o)]=n,t.elements[E(c,c)]=n,t.elements[E(c,o)]=a,t.elements[E(o,c)]=-a,t}function re(d,t){let e=0,s=0;const i=10;t.unitary.identity(),t.diagonal.copy(d);const n=t.unitary,a=t.diagonal,o=new V,c=new V,r=Number.EPSILON*ie(a);for(;sr;)ae(a,o),c.copy(o).transpose(),a.multiply(o),a.premultiply(c),n.multiply(o),++e>2&&(s++,e=0);return t}function ce(d){const t=[];for(let b=0;b0}const st=class st extends jt{constructor(e){super(e);y(this,"onGeometryStreamed",new H);y(this,"onAssetStreamed",new H);y(this,"onProgress",new H);y(this,"onIfcLoaded",new H);y(this,"onDisposed",new H);y(this,"settings",new Kt);y(this,"enabled",!0);y(this,"webIfc",new bt);y(this,"_spatialTree",new Qt);y(this,"_metaData",new Yt);y(this,"_visitedGeometries",new Map);y(this,"_streamSerializer",new Pt);y(this,"_geometries",new Map);y(this,"_geometryCount",0);y(this,"_civil",new Zt);y(this,"_groupSerializer",new At);y(this,"_assets",[]);y(this,"_meshesWithHoles",new Set);this.components.add(st.uuid,this),this.settings.excludedCategories.add(Gt)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(e){const s=performance.now();await this.readIfcFile(e),await this.streamAllGeometries(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-s} ms!`)}async streamFromCallBack(e){const s=performance.now();await this.streamIfcFile(e),await this.streamAllGeometries(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-s} ms!`)}async readIfcFile(e){const{path:s,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(s,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(e,this.settings.webIfc)}async streamIfcFile(e){const{path:s,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(s,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:e,minAssetsSize:s}=this.settings;this._spatialTree.setUp(this.webIfc);const i=this.webIfc.GetIfcEntityList(0),n=[[]],a=new Vt,{FILE_NAME:o,FILE_DESCRIPTION:c}=Nt;a.ifcMetadata={name:this._metaData.get(this.webIfc,o),description:this._metaData.get(this.webIfc,c),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let r=0,u=0;for(const g of i){if(!this.webIfc.IsIfcElement(g)&&g!==Lt||this.settings.excludedCategories.has(g))continue;const I=this.webIfc.GetLineIDsWithType(0,g),S=I.size();console.log(S);for(let M=0;Me&&(r=0,u++,n.push([]));const v=I.get(M);n[u].push(v);const R=this._spatialTree.itemsByFloor[v]||0;a.data.set(v,[[],[R,g]]),r++}}this._spatialTree.cleanUp();let f=.01,h=0;for(const g of n){h++,this.webIfc.StreamMeshes(0,g,S=>{this.getMesh(this.webIfc,S,a)}),this._geometryCount>e&&await this.streamGeometries(),this._assets.length>s&&await this.streamAssets();const I=h/n.length;I>f&&(f+=.01,f=Math.max(f,I),this.onProgress.trigger(Math.round(f*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:l,transparent:m}=a.geometryIDs;for(const[g,{index:I,uuid:S}]of this._visitedGeometries)a.keyFragments.set(I,S),(g>1?l:m).set(g,I);const p=a.data.keys();for(const g of p){const[I]=a.data.get(g);I.length||a.data.delete(g)}const F=this.webIfc.GetCoordinationMatrix(0);a.coordinationMatrix.fromArray(F),a.civilData=this._civil.read(this.webIfc);const z=this._groupSerializer.export(a);this.onIfcLoaded.trigger(z),a.dispose(!0)}cleanUp(){this.webIfc=null,this.webIfc=new bt,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(e,s,i){const n=s.geometries.size(),a=s.expressID,o={id:a,geometries:[]};for(let c=0;c{const{buffer:t,data:e}=d,s=`small.ifc-processed-geometries-${ut}`;for(const i in e){const n=e[i];n.geometryFile=s,mt[i]=n}j.push({name:s,bits:[t]}),ut++});let et=[];T.onAssetStreamed.add(d=>{et=[...et,...d]});T.onIfcLoaded.add(d=>{j.push({name:"small.ifc-processed-global",bits:[d]})});function fe(d,...t){const e=new File(t,d),s=document.createElement("a"),i=URL.createObjectURL(e);s.href=i,s.download=e.name,s.click(),URL.revokeObjectURL(i)}async function pe(d){for(const{name:t,bits:e}of d)fe(t,...e),await new Promise(s=>{setTimeout(s,100)})}T.onProgress.add(d=>{d===1&&setTimeout(async()=>{const t={geometries:mt,assets:et,globalDataFileId:"small.ifc-processed-global"};j.push({name:"small.ifc-processed.json",bits:[JSON.stringify(t)]}),await pe(j),et=[],mt={},j=[],ut=1})});async function ge(){const t=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),e=new Uint8Array(t);await T.streamFromBuffer(e)}qt.init();const we=Bt.create(()=>Ht` +var _t=Object.defineProperty;var Et=(d,t,e)=>t in d?_t(d,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[t]=e;var y=(d,t,e)=>(Et(d,typeof t!="symbol"?t+"":t,e),e);import{V as w,r as Tt,P as Ct,T as Dt,_ as V,a as B,a8 as bt,X as Pt,$ as At,a9 as Gt,aa as Vt,ab as Lt,h as kt,ac as Nt}from"./web-ifc-api-BC8YMRiS.js";import{S as Ut}from"./stats.min-GTpOrGrX.js";import{p as qt,a as Bt,m as Ht}from"./index-DyM33b1I.js";import{C as jt,E as H,a as Ot,W as Rt,S as Wt,b as $t,c as Xt,G as Jt}from"./index-BZiAUaTo.js";import{I as Kt}from"./streaming-settings-CK_tvevt.js";import{S as Qt,I as Yt,C as Zt}from"./ifc-metadata-reader-j9dl-lHS.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./ifc-fragment-settings-CiVry-YT.js";const tt=0,te=1,ee=new w,vt=new Tt,rt=new Ct,Ft=new w,Z=new Dt;class se{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new St,this.unassigned=new St,this.vertices=[]}setFromPoints(t){if(t.length>=4){this.makeEmpty();for(let e=0,s=t.length;ethis.tolerance)return!1;return!0}intersectRay(t,e){const s=this.faces;let i=-1/0,n=1/0;for(let a=0,o=s.length;a0&&u>=0)return null;const f=u!==0?-r/u:0;if(!(f<=0)&&(u>0?n=Math.min(f,n):i=Math.max(f,i),i>n))return null}return i!==-1/0?t.at(i,e):t.at(n,e),e}intersectsRay(t){return this.intersectRay(t,ee)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(t,e){return t.face=e,e.outside===null?this.assigned.append(t):this.assigned.insertBefore(e.outside,t),e.outside=t,this}removeVertexFromFace(t,e){return t===e.outside&&(t.next!==null&&t.next.face===e?e.outside=t.next:e.outside=null),this.assigned.remove(t),this}removeAllVerticesFromFace(t){if(t.outside!==null){const e=t.outside;let s=t.outside;for(;s.next!==null&&s.next.face===t;)s=s.next;return this.assigned.removeSubList(e,s),e.prev=s.next=null,t.outside=null,e}}deleteFaceVertices(t,e){const s=this.removeAllVerticesFromFace(t);if(s!==void 0)if(e===void 0)this.unassigned.appendChain(s);else{let i=s;do{const n=i.next;e.distanceToPoint(i.point)>this.tolerance?this.addVertexToFace(i,e):this.unassigned.append(i),i=n}while(i!==null)}return this}resolveUnassignedPoints(t){if(this.unassigned.isEmpty()===!1){let e=this.unassigned.first();do{const s=e.next;let i=this.tolerance,n=null;for(let a=0;ai&&(i=c,n=o),i>1e3*this.tolerance)break}}n!==null&&this.addVertexToFace(e,n),e=s}while(e!==null)}return this}computeExtremes(){const t=new w,e=new w,s=[],i=[];for(let n=0;n<3;n++)s[n]=i[n]=this.vertices[0];t.copy(this.vertices[0].point),e.copy(this.vertices[0].point);for(let n=0,a=this.vertices.length;ne.getComponent(r)&&(e.setComponent(r,c.getComponent(r)),i[r]=o)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(t.x),Math.abs(e.x))+Math.max(Math.abs(t.y),Math.abs(e.y))+Math.max(Math.abs(t.z),Math.abs(e.z))),{min:s,max:i}}computeInitialHull(){const t=this.vertices,e=this.computeExtremes(),s=e.min,i=e.max;let n=0,a=0;for(let h=0;h<3;h++){const l=i[h].point.getComponent(h)-s[h].point.getComponent(h);l>n&&(n=l,a=h)}const o=s[a],c=i[a];let r,u;n=0,vt.set(o.point,c.point);for(let h=0,l=this.vertices.length;hn&&(n=p,r=m)}}n=-1,rt.setFromCoplanarPoints(o.point,c.point,r.point);for(let h=0,l=this.vertices.length;hn&&(n=p,u=m)}}const f=[];if(rt.distanceToPoint(u.point)<0){f.push(_.create(o,c,r),_.create(u,c,o),_.create(u,r,c),_.create(u,o,r));for(let h=0;h<3;h++){const l=(h+1)%3;f[h+1].getEdge(2).setTwin(f[0].getEdge(l)),f[h+1].getEdge(1).setTwin(f[l+1].getEdge(0))}}else{f.push(_.create(o,r,c),_.create(u,o,c),_.create(u,c,r),_.create(u,r,o));for(let h=0;h<3;h++){const l=(h+1)%3;f[h+1].getEdge(2).setTwin(f[0].getEdge((3-h)%3)),f[h+1].getEdge(0).setTwin(f[l+1].getEdge(1))}}for(let h=0;h<4;h++)this.faces.push(f[h]);for(let h=0,l=t.length;hn&&(n=z,p=this.faces[F])}p!==null&&this.addVertexToFace(m,p)}}return this}reindexFaces(){const t=[];for(let e=0;ee&&(e=n,t=i),i=i.next}while(i!==null&&i.face===s);return t}}computeHorizon(t,e,s,i){this.deleteFaceVertices(s),s.mark=te;let n;e===null?n=e=s.getEdge(0):n=e.next;do{const a=n.twin,o=a.face;o.mark===tt&&(o.distanceToPoint(t)>this.tolerance?this.computeHorizon(t,a,o,i):i.push(n)),n=n.next}while(n!==e);return this}addAdjoiningFace(t,e){const s=_.create(t,e.tail(),e.head());return this.faces.push(s),s.getEdge(-1).setTwin(e.twin),s.getEdge(0)}addNewFaces(t,e){this.newFaces=[];let s=null,i=null;for(let n=0;n0;)e=e.next,t--;for(;t<0;)e=e.prev,t++;return e}compute(){const t=this.edge.tail(),e=this.edge.head(),s=this.edge.next.head();return Z.set(t.point,e.point,s.point),Z.getNormal(this.normal),Z.getMidpoint(this.midpoint),this.area=Z.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(t){return this.normal.dot(t)-this.constant}}class ct{constructor(t,e){this.vertex=t,this.prev=null,this.next=null,this.twin=null,this.face=e}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const t=this.head(),e=this.tail();return e!==null?e.point.distanceTo(t.point):-1}lengthSquared(){const t=this.head(),e=this.tail();return e!==null?e.point.distanceToSquared(t.point):-1}setTwin(t){return this.twin=t,t.twin=this,this}}class ne{constructor(t){this.point=t,this.prev=null,this.next=null,this.face=null}}class St{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(t,e){return e.prev=t.prev,e.next=t,e.prev===null?this.head=e:e.prev.next=e,t.prev=e,this}insertAfter(t,e){return e.prev=t,e.next=t.next,e.next===null?this.tail=e:e.next.prev=e,t.next=e,this}append(t){return this.head===null?this.head=t:this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t,this}appendChain(t){for(this.head===null?this.head=t:this.tail.next=t,t.prev=this.tail;t.next!==null;)t=t.next;return this.tail=t,this}remove(t){return t.prev===null?this.head=t.next:t.prev.next=t.next,t.next===null?this.tail=t.prev:t.next.prev=t.prev,this}removeSubList(t,e){return t.prev===null?this.head=e.next:t.prev.next=e.next,e.next===null?this.tail=t.prev:e.next.prev=t.prev,this}isEmpty(){return this.head===null}}const lt=[2,2,1],ht=[1,0,0];function E(d,t){return d*3+t}function ie(d){const t=d.elements;let e=0;for(let s=0;s<9;s++)e+=t[s]*t[s];return Math.sqrt(e)}function oe(d){const t=d.elements;let e=0;for(let s=0;s<3;s++){const i=t[E(lt[s],ht[s])];e+=2*i*i}return Math.sqrt(e)}function ae(d,t){let e=0,s=1;const i=d.elements;for(let r=0;r<3;r++){const u=Math.abs(i[E(lt[r],ht[r])]);u>e&&(e=u,s=r)}let n=1,a=0;const o=ht[s],c=lt[s];if(Math.abs(i[E(c,o)])>Number.EPSILON){const r=i[E(c,c)],u=i[E(o,o)],f=i[E(c,o)],h=(r-u)/2/f;let l;h<0?l=-1/(-h+Math.sqrt(1+h*h)):l=1/(h+Math.sqrt(1+h*h)),n=1/Math.sqrt(1+l*l),a=l*n}return t.identity(),t.elements[E(o,o)]=n,t.elements[E(c,c)]=n,t.elements[E(c,o)]=a,t.elements[E(o,c)]=-a,t}function re(d,t){let e=0,s=0;const i=10;t.unitary.identity(),t.diagonal.copy(d);const n=t.unitary,a=t.diagonal,o=new V,c=new V,r=Number.EPSILON*ie(a);for(;sr;)ae(a,o),c.copy(o).transpose(),a.multiply(o),a.premultiply(c),n.multiply(o),++e>2&&(s++,e=0);return t}function ce(d){const t=[];for(let b=0;b0}const st=class st extends jt{constructor(e){super(e);y(this,"onGeometryStreamed",new H);y(this,"onAssetStreamed",new H);y(this,"onProgress",new H);y(this,"onIfcLoaded",new H);y(this,"onDisposed",new H);y(this,"settings",new Kt);y(this,"enabled",!0);y(this,"webIfc",new bt);y(this,"_spatialTree",new Qt);y(this,"_metaData",new Yt);y(this,"_visitedGeometries",new Map);y(this,"_streamSerializer",new Pt);y(this,"_geometries",new Map);y(this,"_geometryCount",0);y(this,"_civil",new Zt);y(this,"_groupSerializer",new At);y(this,"_assets",[]);y(this,"_meshesWithHoles",new Set);this.components.add(st.uuid,this),this.settings.excludedCategories.add(Gt)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(e){const s=performance.now();await this.readIfcFile(e),await this.streamAllGeometries(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-s} ms!`)}async streamFromCallBack(e){const s=performance.now();await this.streamIfcFile(e),await this.streamAllGeometries(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-s} ms!`)}async readIfcFile(e){const{path:s,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(s,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(e,this.settings.webIfc)}async streamIfcFile(e){const{path:s,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(s,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:e,minAssetsSize:s}=this.settings;this._spatialTree.setUp(this.webIfc);const i=this.webIfc.GetIfcEntityList(0),n=[[]],a=new Vt,{FILE_NAME:o,FILE_DESCRIPTION:c}=Nt;a.ifcMetadata={name:this._metaData.get(this.webIfc,o),description:this._metaData.get(this.webIfc,c),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let r=0,u=0;for(const g of i){if(!this.webIfc.IsIfcElement(g)&&g!==Lt||this.settings.excludedCategories.has(g))continue;const I=this.webIfc.GetLineIDsWithType(0,g),S=I.size();console.log(S);for(let M=0;Me&&(r=0,u++,n.push([]));const v=I.get(M);n[u].push(v);const R=this._spatialTree.itemsByFloor[v]||0;a.data.set(v,[[],[R,g]]),r++}}this._spatialTree.cleanUp();let f=.01,h=0;for(const g of n){h++,this.webIfc.StreamMeshes(0,g,S=>{this.getMesh(this.webIfc,S,a)}),this._geometryCount>e&&await this.streamGeometries(),this._assets.length>s&&await this.streamAssets();const I=h/n.length;I>f&&(f+=.01,f=Math.max(f,I),this.onProgress.trigger(Math.round(f*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:l,transparent:m}=a.geometryIDs;for(const[g,{index:I,uuid:S}]of this._visitedGeometries)a.keyFragments.set(I,S),(g>1?l:m).set(g,I);const p=a.data.keys();for(const g of p){const[I]=a.data.get(g);I.length||a.data.delete(g)}const F=this.webIfc.GetCoordinationMatrix(0);a.coordinationMatrix.fromArray(F),a.civilData=this._civil.read(this.webIfc);const z=this._groupSerializer.export(a);this.onIfcLoaded.trigger(z),a.dispose(!0)}cleanUp(){this.webIfc=null,this.webIfc=new bt,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(e,s,i){const n=s.geometries.size(),a=s.expressID,o={id:a,geometries:[]};for(let c=0;c{const{buffer:t,data:e}=d,s=`small.ifc-processed-geometries-${ut}`;for(const i in e){const n=e[i];n.geometryFile=s,mt[i]=n}j.push({name:s,bits:[t]}),ut++});let et=[];T.onAssetStreamed.add(d=>{et=[...et,...d]});T.onIfcLoaded.add(d=>{j.push({name:"small.ifc-processed-global",bits:[d]})});function fe(d,...t){const e=new File(t,d),s=document.createElement("a"),i=URL.createObjectURL(e);s.href=i,s.download=e.name,s.click(),URL.revokeObjectURL(i)}async function pe(d){for(const{name:t,bits:e}of d)fe(t,...e),await new Promise(s=>{setTimeout(s,100)})}T.onProgress.add(d=>{d===1&&setTimeout(async()=>{const t={geometries:mt,assets:et,globalDataFileId:"small.ifc-processed-global"};j.push({name:"small.ifc-processed.json",bits:[JSON.stringify(t)]}),await pe(j),et=[],mt={},j=[],ut=1})});async function ge(){const t=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),e=new Uint8Array(t);await T.streamFromBuffer(e)}qt.init();const we=Bt.create(()=>Ht` diff --git a/examples/assets/ifcJsonExporter.js b/examples/assets/ifcJsonExporter.js index 55470553f..f619f32fd 100644 --- a/examples/assets/ifcJsonExporter.js +++ b/examples/assets/ifcJsonExporter.js @@ -1,4 +1,4 @@ -import{a8 as p}from"./web-ifc-api-BC8YMRiS.js";import{S as m}from"./stats.min-GTpOrGrX.js";import{p as l,a as d,m as f}from"./index-DyM33b1I.js";import{a as w,W as g,S as b,b as u,c as h,G as y}from"./index-BraZXcLv.js";import{I as x}from"./index-DvHc-rVc.js";import{F as S}from"./index-DDOiyGyA.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./ifc-geometry-types-C3SKrzrZ.js";const I=document.getElementById("container"),t=new w,U=t.get(g),e=U.create();e.scene=new b(t);e.renderer=new u(t,I);e.camera=new h(t);t.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const B=t.get(y);B.create(e);const k=new S(t),F=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),O=await F.arrayBuffer(),A=new Uint8Array(O),E=k.load(A);e.scene.three.add(E);const r=new p;r.SetWasmPath("https://unpkg.com/web-ifc@0.0.53/",!0);await r.Init();const L=await fetch("https://thatopen.github.io/engine_components/resources/small.ifc"),R=await L.arrayBuffer(),j=new Uint8Array(R),J=r.OpenModel(j),v=t.get(x);l.init();const C=d.create(()=>f` +import{a8 as p}from"./web-ifc-api-BC8YMRiS.js";import{S as m}from"./stats.min-GTpOrGrX.js";import{p as l,a as d,m as f}from"./index-DyM33b1I.js";import{a as w,W as g,S as b,b as u,c as h,G as y}from"./index-BZiAUaTo.js";import{I as x}from"./index-BPt-VIyQ.js";import{F as S}from"./index-CiqD_kld.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./ifc-geometry-types-C3SKrzrZ.js";const I=document.getElementById("container"),t=new w,U=t.get(g),e=U.create();e.scene=new b(t);e.renderer=new u(t,I);e.camera=new h(t);t.init();e.camera.controls.setLookAt(12,6,8,0,0,-10);e.scene.setup();const B=t.get(y);B.create(e);const k=new S(t),F=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),O=await F.arrayBuffer(),A=new Uint8Array(O),E=k.load(A);e.scene.three.add(E);const r=new p;r.SetWasmPath("https://unpkg.com/web-ifc@0.0.53/",!0);await r.Init();const L=await fetch("https://thatopen.github.io/engine_components/resources/small.ifc"),R=await L.arrayBuffer(),j=new Uint8Array(R),J=r.OpenModel(j),v=t.get(x);l.init();const C=d.create(()=>f` diff --git a/examples/assets/ifcLoader.js b/examples/assets/ifcLoader.js index be570a7d2..9ebfe6f95 100644 --- a/examples/assets/ifcLoader.js +++ b/examples/assets/ifcLoader.js @@ -1,4 +1,4 @@ -import{aX as d,aY as l,aZ as p}from"./web-ifc-api-BC8YMRiS.js";import{p as f,a as u,m as b}from"./index-DyM33b1I.js";import{S as g}from"./stats.min-GTpOrGrX.js";import{a as I,W as w,S as F,b as C,c as y,G as E}from"./index-BraZXcLv.js";import{F as O}from"./index-DDOiyGyA.js";import{I as R}from"./index-PenRR3X-.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./ifc-metadata-reader-j9dl-lHS.js";import"./ifc-fragment-settings-CiVry-YT.js";import"./index-DvHc-rVc.js";import"./ifc-geometry-types-C3SKrzrZ.js";const x=document.getElementById("container"),n=new I,L=n.get(w),o=L.create();o.scene=new F(n);o.renderer=new C(n,x);o.camera=new y(n);n.init();o.camera.controls.setLookAt(12,6,8,0,0,-10);o.scene.setup();const N=n.get(E);N.create(o);const a=n.get(O),s=n.get(R);await s.setup();const h=[d,l,p];for(const e of h)s.settings.excludedCategories.add(e);s.settings.webIfc.COORDINATE_TO_ORIGIN=!0;s.settings.webIfc.OPTIMIZE_PROFILES=!0;async function S(){const t=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),i=new Uint8Array(t),c=await s.load(i);c.name="example",o.scene.three.add(c)}function m(e){const t=document.createElement("a");t.href=URL.createObjectURL(e),t.download=e.name,document.body.appendChild(t),t.click(),t.remove()}async function A(){if(!a.groups.size)return;const e=Array.from(a.groups.values())[0],t=a.export(e);m(new File([new Blob([t])],"small.frag"));const i=e.getLocalProperties();i&&m(new File([JSON.stringify(i)],"small.json"))}function k(){a.dispose()}const r=new g;r.showPanel(2);document.body.append(r.dom);r.dom.style.left="0px";o.renderer.onBeforeUpdate.add(()=>r.begin());o.renderer.onAfterUpdate.add(()=>r.end());f.init();const T=u.create(()=>b` +import{aX as d,aY as l,aZ as p}from"./web-ifc-api-BC8YMRiS.js";import{p as f,a as u,m as b}from"./index-DyM33b1I.js";import{S as g}from"./stats.min-GTpOrGrX.js";import{a as I,W as w,S as F,b as C,c as y,G as E}from"./index-BZiAUaTo.js";import{F as O}from"./index-CiqD_kld.js";import{I as R}from"./index-DgTKnZy1.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./ifc-metadata-reader-j9dl-lHS.js";import"./ifc-fragment-settings-CiVry-YT.js";import"./index-BPt-VIyQ.js";import"./ifc-geometry-types-C3SKrzrZ.js";const x=document.getElementById("container"),n=new I,L=n.get(w),o=L.create();o.scene=new F(n);o.renderer=new C(n,x);o.camera=new y(n);n.init();o.camera.controls.setLookAt(12,6,8,0,0,-10);o.scene.setup();const N=n.get(E);N.create(o);const a=n.get(O),s=n.get(R);await s.setup();const h=[d,l,p];for(const e of h)s.settings.excludedCategories.add(e);s.settings.webIfc.COORDINATE_TO_ORIGIN=!0;s.settings.webIfc.OPTIMIZE_PROFILES=!0;async function S(){const t=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),i=new Uint8Array(t),c=await s.load(i);c.name="example",o.scene.three.add(c)}function m(e){const t=document.createElement("a");t.href=URL.createObjectURL(e),t.download=e.name,document.body.appendChild(t),t.click(),t.remove()}async function A(){if(!a.groups.size)return;const e=Array.from(a.groups.values())[0],t=a.export(e);m(new File([new Blob([t])],"small.frag"));const i=e.getLocalProperties();i&&m(new File([JSON.stringify(i)],"small.json"))}function k(){a.dispose()}const r=new g;r.showPanel(2);document.body.append(r.dom);r.dom.style.left="0px";o.renderer.onBeforeUpdate.add(()=>r.begin());o.renderer.onAfterUpdate.add(()=>r.end());f.init();const T=u.create(()=>b` diff --git a/examples/assets/ifcPropertiesTiler.js b/examples/assets/ifcPropertiesTiler.js index ccb603065..02e750e10 100644 --- a/examples/assets/ifcPropertiesTiler.js +++ b/examples/assets/ifcPropertiesTiler.js @@ -1,4 +1,4 @@ -var k=Object.defineProperty;var G=(t,o,e)=>o in t?k(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e;var a=(t,o,e)=>(G(t,typeof o!="symbol"?o+"":o,e),e);import{a8 as B,aj as R,ak as v,al as O,i as T,ab as D}from"./web-ifc-api-BC8YMRiS.js";import{S as j}from"./stats.min-GTpOrGrX.js";import{p as W,a as $,m as z}from"./index-DyM33b1I.js";import{C as M,E as N,a as J,W as q,S as Y,b as _,c as H,G as K}from"./index-BraZXcLv.js";import{I as U}from"./index-DDOiyGyA.js";import{A as F}from"./async-event-D8tC9awa.js";import{P as Q}from"./streaming-settings-CK_tvevt.js";import{G as V}from"./ifc-geometry-types-C3SKrzrZ.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./ifc-fragment-settings-CiVry-YT.js";class A extends M{constructor(){super(...arguments);a(this,"onPropertiesStreamed",new F);a(this,"onProgress",new F);a(this,"onIndicesStreamed",new F);a(this,"onDisposed",new N);a(this,"enabled",!0);a(this,"settings",new Q);a(this,"webIfc",new B)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(e){const s=performance.now();await this.readIfcFile(e),await this.streamAllProperties(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-s} ms!`)}async streamFromCallBack(e){const s=performance.now();await this.streamIfcFile(e),await this.streamAllProperties(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-s} ms!`)}async readIfcFile(e){const{path:s,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(s,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(e,this.settings.webIfc)}async streamIfcFile(e){const{path:s,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(s,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:e}=this.settings,s=new Set(this.webIfc.GetIfcEntityList(0)),i=new Set([R,v,O,T,D]);for(const c of i)s.add(c);let n=.01,C=0;for(const c of s){if(C++,V.has(c))continue;const L=i.has(c),u=this.webIfc.GetLineIDsWithType(0,c),y=u.size();let S=0;for(let p=0;pn&&(n+=.01,n=Math.max(n,x),await this.onProgress.trigger(Math.round(n*100)/100))}const E=await this.components.get(U).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(E)}cleanUp(){this.webIfc=null,this.webIfc=new B}}a(A,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");const X=document.getElementById("container"),r=new J,Z=r.get(q),l=Z.create();l.scene=new Y(r);l.renderer=new _(r,X);l.camera=new H(r);r.init();l.camera.controls.setLookAt(12,6,8,0,0,-10);const ee=r.get(K);ee.create(l);function te(t,o){const e=new File([o],t),s=document.createElement("a"),i=URL.createObjectURL(e);s.href=i,s.download=e.name,s.click(),URL.revokeObjectURL(i)}async function se(t){for(const{name:o,bits:e}of t)te(o,e),await new Promise(s=>{setTimeout(s,100)})}const h=new A(r);h.settings.wasm={path:"https://unpkg.com/web-ifc@0.0.53/",absolute:!0};const w={types:{},ids:{},indexesFile:"small.ifc-processed-properties-indexes"};let b=0;const g=[];h.onPropertiesStreamed.add(async t=>{w.types[t.type]||(w.types[t.type]=[]),w.types[t.type].push(b);for(const s in t.data)w.ids[s]=b;const o=`small.ifc-processed-properties-${b}`,e=new Blob([JSON.stringify(t.data)]);g.push({bits:e,name:o}),b++});h.onProgress.add(async t=>{console.log(t)});h.onIndicesStreamed.add(async t=>{g.push({name:"small.ifc-processed-properties.json",bits:new Blob([JSON.stringify(w)])});const e=r.get(U).serializeRelations(t);g.push({name:"small.ifc-processed-properties-indexes",bits:new Blob([e])}),await se(g)});async function oe(){const o=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),e=new Uint8Array(o);await h.streamFromBuffer(e)}W.init();const ne=$.create(()=>z` +var k=Object.defineProperty;var G=(t,o,e)=>o in t?k(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e;var a=(t,o,e)=>(G(t,typeof o!="symbol"?o+"":o,e),e);import{a8 as B,aj as R,ak as v,al as O,i as T,ab as D}from"./web-ifc-api-BC8YMRiS.js";import{S as j}from"./stats.min-GTpOrGrX.js";import{p as W,a as $,m as z}from"./index-DyM33b1I.js";import{C as M,E as N,a as J,W as q,S as Y,b as _,c as H,G as K}from"./index-BZiAUaTo.js";import{I as U}from"./index-CiqD_kld.js";import{A as F}from"./async-event-D8tC9awa.js";import{P as Q}from"./streaming-settings-CK_tvevt.js";import{G as V}from"./ifc-geometry-types-C3SKrzrZ.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./ifc-fragment-settings-CiVry-YT.js";class A extends M{constructor(){super(...arguments);a(this,"onPropertiesStreamed",new F);a(this,"onProgress",new F);a(this,"onIndicesStreamed",new F);a(this,"onDisposed",new N);a(this,"enabled",!0);a(this,"settings",new Q);a(this,"webIfc",new B)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(e){const s=performance.now();await this.readIfcFile(e),await this.streamAllProperties(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-s} ms!`)}async streamFromCallBack(e){const s=performance.now();await this.streamIfcFile(e),await this.streamAllProperties(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-s} ms!`)}async readIfcFile(e){const{path:s,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(s,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(e,this.settings.webIfc)}async streamIfcFile(e){const{path:s,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(s,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:e}=this.settings,s=new Set(this.webIfc.GetIfcEntityList(0)),i=new Set([R,v,O,T,D]);for(const c of i)s.add(c);let n=.01,C=0;for(const c of s){if(C++,V.has(c))continue;const L=i.has(c),u=this.webIfc.GetLineIDsWithType(0,c),y=u.size();let S=0;for(let p=0;pn&&(n+=.01,n=Math.max(n,x),await this.onProgress.trigger(Math.round(n*100)/100))}const E=await this.components.get(U).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(E)}cleanUp(){this.webIfc=null,this.webIfc=new B}}a(A,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");const X=document.getElementById("container"),r=new J,Z=r.get(q),l=Z.create();l.scene=new Y(r);l.renderer=new _(r,X);l.camera=new H(r);r.init();l.camera.controls.setLookAt(12,6,8,0,0,-10);const ee=r.get(K);ee.create(l);function te(t,o){const e=new File([o],t),s=document.createElement("a"),i=URL.createObjectURL(e);s.href=i,s.download=e.name,s.click(),URL.revokeObjectURL(i)}async function se(t){for(const{name:o,bits:e}of t)te(o,e),await new Promise(s=>{setTimeout(s,100)})}const h=new A(r);h.settings.wasm={path:"https://unpkg.com/web-ifc@0.0.53/",absolute:!0};const w={types:{},ids:{},indexesFile:"small.ifc-processed-properties-indexes"};let b=0;const g=[];h.onPropertiesStreamed.add(async t=>{w.types[t.type]||(w.types[t.type]=[]),w.types[t.type].push(b);for(const s in t.data)w.ids[s]=b;const o=`small.ifc-processed-properties-${b}`,e=new Blob([JSON.stringify(t.data)]);g.push({bits:e,name:o}),b++});h.onProgress.add(async t=>{console.log(t)});h.onIndicesStreamed.add(async t=>{g.push({name:"small.ifc-processed-properties.json",bits:new Blob([JSON.stringify(w)])});const e=r.get(U).serializeRelations(t);g.push({name:"small.ifc-processed-properties-indexes",bits:new Blob([e])}),await se(g)});async function oe(){const o=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),e=new Uint8Array(o);await h.streamFromBuffer(e)}W.init();const ne=$.create(()=>z` diff --git a/examples/assets/ifcRelationsIndexer.js b/examples/assets/ifcRelationsIndexer.js index 3040b91c4..23fa3031e 100644 --- a/examples/assets/ifcRelationsIndexer.js +++ b/examples/assets/ifcRelationsIndexer.js @@ -1,4 +1,4 @@ -import"./web-ifc-api-BC8YMRiS.js";import{p as d,a as m,m as f}from"./index-DyM33b1I.js";import{a as w,W as g,S as u,b,c as y,G as I}from"./index-BraZXcLv.js";import{I as R,a as x}from"./index-DDOiyGyA.js";import{I as S}from"./index-PenRR3X-.js";import"./ifc-metadata-reader-j9dl-lHS.js";import"./ifc-fragment-settings-CiVry-YT.js";import"./index-DvHc-rVc.js";import"./ifc-geometry-types-C3SKrzrZ.js";const L=document.getElementById("container"),t=new w,h=t.get(g),n=h.create();n.scene=new u(t);n.renderer=new b(t,L);n.camera=new y(t);t.init();n.camera.controls.setLookAt(12,6,8,0,0,-10);n.scene.setup();const O=t.get(I);O.create(n);const p=t.get(S);await p.setup();const P=await fetch("/resources/small.ifc"),U=await P.arrayBuffer(),j=new Uint8Array(U),e=await p.load(j);n.scene.three.add(e);const o=t.get(R);await o.process(e);const c=o.getEntityRelations(e,6518,"IsDefinedBy");if(c)for(const a of c){const r=await e.getProperties(a);console.log(r),await x.getPsetProps(e,a,async i=>{const s=await e.getProperties(i);console.log(s)})}const E=(a,r)=>{const i=new File([a],r),s=document.createElement("a");s.href=URL.createObjectURL(i),s.download=i.name,s.click(),URL.revokeObjectURL(s.href)},k=o.serializeModelRelations(e);console.log(k);const A=o.serializeAllRelations();delete o.relationMaps[e.uuid];const C=await fetch("/resources/small-relations.json"),F=o.getRelationsMapFromJSON(await C.text());o.setRelationMap(e,F);const l=o.getEntityRelations(e,6518,"ContainedInStructure");if(l&&l[0]){const a=await e.getProperties(l[0]);console.log(a)}d.init();const J=m.create(()=>f` +import"./web-ifc-api-BC8YMRiS.js";import{p as d,a as m,m as f}from"./index-DyM33b1I.js";import{a as w,W as g,S as u,b,c as y,G as I}from"./index-BZiAUaTo.js";import{I as R,a as x}from"./index-CiqD_kld.js";import{I as S}from"./index-DgTKnZy1.js";import"./ifc-metadata-reader-j9dl-lHS.js";import"./ifc-fragment-settings-CiVry-YT.js";import"./index-BPt-VIyQ.js";import"./ifc-geometry-types-C3SKrzrZ.js";const L=document.getElementById("container"),t=new w,h=t.get(g),n=h.create();n.scene=new u(t);n.renderer=new b(t,L);n.camera=new y(t);t.init();n.camera.controls.setLookAt(12,6,8,0,0,-10);n.scene.setup();const O=t.get(I);O.create(n);const p=t.get(S);await p.setup();const P=await fetch("/resources/small.ifc"),U=await P.arrayBuffer(),j=new Uint8Array(U),e=await p.load(j);n.scene.three.add(e);const o=t.get(R);await o.process(e);const c=o.getEntityRelations(e,6518,"IsDefinedBy");if(c)for(const a of c){const r=await e.getProperties(a);console.log(r),await x.getPsetProps(e,a,async i=>{const s=await e.getProperties(i);console.log(s)})}const E=(a,r)=>{const i=new File([a],r),s=document.createElement("a");s.href=URL.createObjectURL(i),s.download=i.name,s.click(),URL.revokeObjectURL(s.href)},k=o.serializeModelRelations(e);console.log(k);const A=o.serializeAllRelations();delete o.relationMaps[e.uuid];const C=await fetch("/resources/small-relations.json"),F=o.getRelationsMapFromJSON(await C.text());o.setRelationMap(e,F);const l=o.getEntityRelations(e,6518,"ContainedInStructure");if(l&&l[0]){const a=await e.getProperties(l[0]);console.log(a)}d.init();const J=m.create(()=>f` diff --git a/examples/assets/ifcStreamer.js b/examples/assets/ifcStreamer.js index f5253155f..2597e344f 100644 --- a/examples/assets/ifcStreamer.js +++ b/examples/assets/ifcStreamer.js @@ -1,4 +1,4 @@ -var tt=Object.defineProperty;var et=(p,t,e)=>t in p?tt(p,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):p[t]=e;var g=(p,t,e)=>(et(p,typeof t!="symbol"?t+"":t,e),e);import{d as it,B as st,j as V,a as U,N,G as ot,C as X,X as nt,k as Z,c as rt,e as Q}from"./web-ifc-api-BC8YMRiS.js";import{S as at}from"./stats.min-GTpOrGrX.js";import{Y as lt,K as dt,J as ht,U as P,u as B,W as ct,f as ut,p as gt,s as pt,i as mt,k as ft,N as wt}from"./index-b4ozRbQy.js";import{D as bt}from"./import-wrapper-prod-LhqN7JJy.js";import"./_commonjsHelpers-Cpj98o6Y.js";class vt extends lt{constructor(e,i,o){super(e,i,o);g(this,"threshold",50);g(this,"bboxThreshold",200);g(this,"maxLostTime",3e4);g(this,"maxHiddenTime",5e3);g(this,"boxes",new Map);g(this,"_geometry");g(this,"_material",new it({transparent:!0,side:2,opacity:1}));g(this,"onViewUpdated",new dt);g(this,"_modelIDIndex",new Map);g(this,"_indexModelID",new Map);g(this,"_nextModelID",0);g(this,"_geometries",new Map);g(this,"_geometriesGroups",new Map);g(this,"_foundGeometries",new Set);g(this,"_intervalID",null);g(this,"codes",new Map);g(this,"handleWorkerMessage",async e=>{const i=e.data.colors,o={},s={},n={},a={},d=performance.now();let c=!1;const r=new Set(this._foundGeometries);for(const[u,h]of i){const l=this._geometries.get(u);if(!l)continue;const w=h>this.threshold,{exists:b}=l;if(!w&&!b)continue;const m=this._indexModelID.get(l.modelIndex);r.delete(u),w&&b?(l.time=d,a[m]||(a[m]=new Set),a[m].add(l.geometryID),this._foundGeometries.add(u),c=!0):w&&!b?(o[m]||(o[m]=new Map),l.time=d,l.exists=!0,o[m].has(h)||o[m].set(h,new Set),o[m].get(h).add(l.geometryID),this._foundGeometries.add(u),c=!0):!w&&b&&(this.handleLostGeometries(d,u,l,s,n),c=!0)}c&&await this.onViewUpdated.trigger({toLoad:o,toRemove:s,toHide:n,toShow:a}),this._isWorkerBusy=!1});this.updateInterval=500,this._geometry=new st(1,1,1),this._geometry.groups=[],this._geometry.deleteAttribute("uv");const s=this._geometry.attributes.position.array;for(let n=0;nparseInt(w,10)),l=[];for(const w of o.ids){const b=o.get(w);if(!b.colors)throw new Error("Malformed fragments!");for(const m of b.colors)m.setRGB(r/255,u/255,h/255,"srgb");l.push(b)}c.fragment.add(l),V.enabled=s,this.needsUpdate=!0}removeFragment(e,i){const o=this._modelIDIndex.get(e),n=this.codes.get(o).get(i),a=this._geometries.get(n);if(a.hidden||this.setGeometryVisibility(a,!0,!1),a.fragment){const{fragment:d}=a;d.dispose(!1),a.fragment=void 0}}setModelTransformation(e,i){const o=this._modelIDIndex.get(e);if(o===void 0)throw new Error("Model not found!");const s=this.boxes.get(o);s&&(s.mesh.position.set(0,0,0),s.mesh.rotation.set(0,0,0),s.mesh.scale.set(1,1,1),s.mesh.applyMatrix4(i));const n=this._geometriesGroups.get(o);n&&(n.position.set(0,0,0),n.rotation.set(0,0,0),n.scale.set(1,1,1),n.applyMatrix4(i))}setVisibility(e,i,o){const s=this._modelIDIndex.get(i);if(s!==void 0)for(const[n,a]of o){const d=this.codes.get(s);if(d===void 0)throw new Error("Map not found!");const c=d.get(n),r=this._geometries.get(c);if(r===void 0)throw new Error("Geometry not found!");r.hidden=!e,this.setGeometryVisibility(r,e,!0,a)}}setGeometryVisibility(e,i,o,s){const{modelIndex:n,geometryID:a,assetIDs:d}=e,c=this.boxes.get(n);if(c===void 0)throw new Error("Model not found!");const r=s||d;if(o&&e.fragment)e.fragment.setVisibility(i,r);else{const u=new Set;for(const h of r){const l=this.getInstanceID(h,a);u.add(l)}c.setVisibility(i,u)}}handleLostGeometries(e,i,o,s,n){const a=this._indexModelID.get(o.modelIndex),d=e-o.time;d>this.maxLostTime?(s[a]||(s[a]=new Set),o.exists=!1,s[a].add(o.geometryID),this._foundGeometries.delete(i)):d>this.maxHiddenTime&&(n[a]||(n[a]=new Set),n[a].add(o.geometryID))}createModelIndex(e){if(this._modelIDIndex.has(e))throw new Error("Can't load the same model twice!");const i=this._nextModelID;return this._nextModelID++,this._modelIDIndex.set(e,i),this._indexModelID.set(i,e),i}getInstanceID(e,i){const s=10**(Math.log(i)*Math.LOG10E+1|0);return e+i/s}}class _t extends bt{constructor(){super("MyAppDatabase");g(this,"files");this.version(1).stores({files:"id, file"})}}const z=class z extends ht{constructor(e){super(e);g(this,"enabled",!0);g(this,"onFragmentsDeleted",new P);g(this,"onFragmentsLoaded",new P);g(this,"onDisposed",new P);g(this,"models",{});g(this,"serializer",new nt);g(this,"maxRamTime",5e3);g(this,"useCache",!0);g(this,"_culler",null);g(this,"_world",null);g(this,"_ramCache",new Map);g(this,"_fileCache",new _t);g(this,"_url",null);g(this,"_isDisposing",!1);g(this,"_geometryInstances",{});g(this,"_loadedFragments",{});g(this,"fragIDData",new Map);g(this,"_baseMaterial",new Z);g(this,"_baseMaterialT",new Z({transparent:!0,opacity:.5}));this.components.add(z.uuid,this)}get url(){if(!this._url)throw new Error("url must be set before using the streaming service!");return this._url}set url(e){this._url=e}get world(){if(!this._world)throw new Error("You must set a world before using the streamer!");return this._world}set world(e){var i;this._world=e,(i=this._culler)==null||i.dispose(),this._culler=new vt(this.components,e),this._culler.onViewUpdated.add(async({toLoad:o,toRemove:s,toShow:n,toHide:a})=>{await this.loadFoundGeometries(o),await this.unloadLostGeometries(s),this.setMeshVisibility(n,!0),this.setMeshVisibility(a,!1)})}get culler(){if(!this._culler)throw new Error("You must set a world before using the streamer!");return this._culler}dispose(){var e;this._isDisposing=!0,this.onFragmentsLoaded.reset(),this.onFragmentsDeleted.reset(),this._ramCache.clear(),this.models={},this._geometryInstances={},this._loadedFragments={},this.fragIDData.clear(),this._baseMaterial.dispose(),this._baseMaterialT.dispose(),(e=this._culler)==null||e.dispose(),this.onDisposed.trigger(z.uuid),this.onDisposed.reset(),this._isDisposing=!1}async load(e,i,o){const{assets:s,geometries:n,globalDataFileId:a}=e,d=this.url+a,r=await(await fetch(d)).arrayBuffer(),u=new Uint8Array(r),l=this.components.get(B).load(u,{coordinate:i});this.world.scene.three.add(l);const{opaque:w,transparent:b}=l.geometryIDs;for(const[f,_]of w){const v=l.keyFragments.get(_);if(v===void 0)throw new Error("Malformed fragments group!");this.fragIDData.set(v,[l,f,new Set])}for(const[f,_]of b){const v=l.keyFragments.get(_);if(v===void 0)throw new Error("Malformed fragments group!");this.fragIDData.set(v,[l,Math.abs(f),new Set])}this.culler.add(l.uuid,s,n),this.models[l.uuid]={assets:s,geometries:n};const m=new Map;for(const f of s){const _=f.id;for(const{transformation:v,geometryID:x,color:$}of f.geometries){m.has(x)||m.set(x,[]);const y=m.get(x);if(!y)throw new Error("Malformed instances");y.push({id:_,transformation:v,color:$})}}if(this._geometryInstances[l.uuid]=m,o){const f=new Map,_=new Map;for(const E in o.ids){const D=o.ids[E],A=parseInt(E,10);f.set(A,D)}for(const E in o.types){const D=o.types[E],A=parseInt(E,10);_.set(A,D)}const v=a.replace("-global","-properties");l.streamSettings={baseUrl:this.url,baseFileName:v,ids:f,types:_};const{indexesFile:x}=o,y=await(await fetch(this.url+x)).text(),I=this.components.get(ct);I.setRelationMap(l,I.getRelationsMapFromJSON(y))}return this.culler.needsUpdate=!0,l}remove(e){this._isDisposing=!0;const o=this.components.get(B).groups.get(e);if(o===void 0){console.log("Group to delete not found.");return}delete this.models[e],delete this._geometryInstances[e],delete this._loadedFragments[e];const s=o.keyFragments.values();for(const n of s)this.fragIDData.delete(n);this.culler.remove(e),this._isDisposing=!1}setVisibility(e,i){const o=new Map;for(const s in i){const n=this.fragIDData.get(s);if(n===void 0)throw new Error("Geometry not found!");const[a,d,c]=n,r=a.uuid;o.has(r)||o.set(r,new Map);const u=o.get(r),h=i[s];for(const w of h)e?c.delete(w):c.add(w);u.get(d)||u.set(d,new Set);const l=u.get(d);for(const w of h)l.add(w)}for(const[s,n]of o){this.culler.setVisibility(e,s,n);for(const[a]of n){const d=this._loadedFragments[s];if(!d)continue;const c=d[a];if(c)for(const r of c){const u=i[r.id];u&&r.setVisibility(e,u)}}}this.culler.needsUpdate=!0}async clearCache(){await this._fileCache.delete()}get(){}update(){}async loadFoundGeometries(e){for(const i in e){if(this._isDisposing)return;const s=this.components.get(B).groups.get(i);if(!s)return;const{geometries:n}=this.models[i],a=new Map,d=new Set;for(const[h,l]of e[i])for(const w of l){d.add(w);const b=n[w];if(!b)throw new Error("Geometry not found");if(b.geometryFile){const m=b.geometryFile,f=a.get(m)||0;a.set(m,f+h)}}const c=Array.from(a).sort((h,l)=>l[1]-h[1]);for(const[h]of c){const l=this.url+h;if(!this._ramCache.has(l)){let m=new Uint8Array;if(this.useCache){const _=await this._fileCache.files.get(l);if(_)m=_.file;else{const x=await(await fetch(l)).arrayBuffer();m=new Uint8Array(x),this._fileCache.files.add({file:m,id:l})}}else{const v=await(await fetch(l)).arrayBuffer();m=new Uint8Array(v)}const f=this.serializer.import(m);this._ramCache.set(l,{data:f,time:performance.now()})}const w=this._ramCache.get(l);if(!w)continue;w.time=performance.now();const b=[];if(w)for(const[m,{position:f,index:_,normal:v}]of w.data){if(this._isDisposing)return;if(!d.has(m)||!this._geometryInstances[i]||!this._geometryInstances[i].has(m))continue;const $=this._geometryInstances[i].get(m);if(!$)throw new Error("Instances not found!");const y=new rt,I=new Q(f,3),E=new Q(v,3);y.setAttribute("position",I),y.setAttribute("normal",E),y.setIndex(Array.from(_));const D=[],A=[];for(const F of $)F.color[3]===1?A.push(F):D.push(F);this.newFragment(s,m,y,D,!0,b),this.newFragment(s,m,y,A,!1,b)}b.length&&!this._isDisposing&&this.onFragmentsLoaded.trigger(b)}const r=new Set,u=performance.now();for(const[h,{time:l}]of this._ramCache)u-l>this.maxRamTime&&r.add(h);for(const h of r)this._ramCache.delete(h)}}async unloadLostGeometries(e){if(this._isDisposing)return;const i=[],o=this.components.get(B);for(const s in e){const n=o.groups.get(s);if(!n)throw new Error("Fragment group not found!");if(!this._loadedFragments[s])continue;const a=this._loadedFragments[s],d=e[s];for(const c of d){if(this.culler.removeFragment(n.uuid,c),!a[c])continue;const r=a[c];for(const u of r)n.items.splice(n.items.indexOf(u),1),i.push(u);delete a[c]}}i.length&&this.onFragmentsDeleted.trigger(i);for(const s of i)o.list.delete(s.id),this.world.meshes.delete(s.mesh),s.mesh.material=[],s.dispose(!0)}setMeshVisibility(e,i){for(const o in e)for(const s of e[o]){const n=this._loadedFragments[o];if(!n)continue;const a=n[s];if(a)for(const d of a)d.mesh.visible=i}}newFragment(e,i,o,s,n,a){if(s.length===0||this._isDisposing)return;const d=e.geometryIDs,c=n?d.transparent:d.opaque,u=i*(n?-1:1),h=c.get(u);if(h===void 0)return;const l=e.keyFragments.get(h);if(l===void 0)return;const w=this.components.get(B);if(w.list.has(l))return;const m=n?this._baseMaterialT:this._baseMaterial,f=new N(o,m,s.length);f.id=l,f.mesh.uuid=l,f.group=e,e.add(f.mesh),e.items.push(f),w.list.set(f.id,f),this.world.meshes.add(f.mesh),this._loadedFragments[e.uuid]||(this._loadedFragments[e.uuid]={});const _=this._loadedFragments[e.uuid];_[i]||(_[i]=[]),_[i].push(f);const v=new Map;for(let I=0;It in p?tt(p,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):p[t]=e;var g=(p,t,e)=>(et(p,typeof t!="symbol"?t+"":t,e),e);import{d as it,B as st,j as V,a as U,N,G as ot,C as X,X as nt,k as Z,c as rt,e as Q}from"./web-ifc-api-BC8YMRiS.js";import{S as at}from"./stats.min-GTpOrGrX.js";import{Y as lt,K as dt,J as ht,D as P,u as B,W as ct,f as ut,p as gt,s as pt,i as mt,k as ft,N as wt}from"./index-C-JPXu_n.js";import{D as bt}from"./import-wrapper-prod-LhqN7JJy.js";import"./_commonjsHelpers-Cpj98o6Y.js";class vt extends lt{constructor(e,i,o){super(e,i,o);g(this,"threshold",50);g(this,"bboxThreshold",200);g(this,"maxLostTime",3e4);g(this,"maxHiddenTime",5e3);g(this,"boxes",new Map);g(this,"_geometry");g(this,"_material",new it({transparent:!0,side:2,opacity:1}));g(this,"onViewUpdated",new dt);g(this,"_modelIDIndex",new Map);g(this,"_indexModelID",new Map);g(this,"_nextModelID",0);g(this,"_geometries",new Map);g(this,"_geometriesGroups",new Map);g(this,"_foundGeometries",new Set);g(this,"_intervalID",null);g(this,"codes",new Map);g(this,"handleWorkerMessage",async e=>{const i=e.data.colors,o={},s={},n={},a={},d=performance.now();let c=!1;const r=new Set(this._foundGeometries);for(const[u,h]of i){const l=this._geometries.get(u);if(!l)continue;const w=h>this.threshold,{exists:b}=l;if(!w&&!b)continue;const m=this._indexModelID.get(l.modelIndex);r.delete(u),w&&b?(l.time=d,a[m]||(a[m]=new Set),a[m].add(l.geometryID),this._foundGeometries.add(u),c=!0):w&&!b?(o[m]||(o[m]=new Map),l.time=d,l.exists=!0,o[m].has(h)||o[m].set(h,new Set),o[m].get(h).add(l.geometryID),this._foundGeometries.add(u),c=!0):!w&&b&&(this.handleLostGeometries(d,u,l,s,n),c=!0)}c&&await this.onViewUpdated.trigger({toLoad:o,toRemove:s,toHide:n,toShow:a}),this._isWorkerBusy=!1});this.updateInterval=500,this._geometry=new st(1,1,1),this._geometry.groups=[],this._geometry.deleteAttribute("uv");const s=this._geometry.attributes.position.array;for(let n=0;nparseInt(w,10)),l=[];for(const w of o.ids){const b=o.get(w);if(!b.colors)throw new Error("Malformed fragments!");for(const m of b.colors)m.setRGB(r/255,u/255,h/255,"srgb");l.push(b)}c.fragment.add(l),V.enabled=s,this.needsUpdate=!0}removeFragment(e,i){const o=this._modelIDIndex.get(e),n=this.codes.get(o).get(i),a=this._geometries.get(n);if(a.hidden||this.setGeometryVisibility(a,!0,!1),a.fragment){const{fragment:d}=a;d.dispose(!1),a.fragment=void 0}}setModelTransformation(e,i){const o=this._modelIDIndex.get(e);if(o===void 0)throw new Error("Model not found!");const s=this.boxes.get(o);s&&(s.mesh.position.set(0,0,0),s.mesh.rotation.set(0,0,0),s.mesh.scale.set(1,1,1),s.mesh.applyMatrix4(i));const n=this._geometriesGroups.get(o);n&&(n.position.set(0,0,0),n.rotation.set(0,0,0),n.scale.set(1,1,1),n.applyMatrix4(i))}setVisibility(e,i,o){const s=this._modelIDIndex.get(i);if(s!==void 0)for(const[n,a]of o){const d=this.codes.get(s);if(d===void 0)throw new Error("Map not found!");const c=d.get(n),r=this._geometries.get(c);if(r===void 0)throw new Error("Geometry not found!");r.hidden=!e,this.setGeometryVisibility(r,e,!0,a)}}setGeometryVisibility(e,i,o,s){const{modelIndex:n,geometryID:a,assetIDs:d}=e,c=this.boxes.get(n);if(c===void 0)throw new Error("Model not found!");const r=s||d;if(o&&e.fragment)e.fragment.setVisibility(i,r);else{const u=new Set;for(const h of r){const l=this.getInstanceID(h,a);u.add(l)}c.setVisibility(i,u)}}handleLostGeometries(e,i,o,s,n){const a=this._indexModelID.get(o.modelIndex),d=e-o.time;d>this.maxLostTime?(s[a]||(s[a]=new Set),o.exists=!1,s[a].add(o.geometryID),this._foundGeometries.delete(i)):d>this.maxHiddenTime&&(n[a]||(n[a]=new Set),n[a].add(o.geometryID))}createModelIndex(e){if(this._modelIDIndex.has(e))throw new Error("Can't load the same model twice!");const i=this._nextModelID;return this._nextModelID++,this._modelIDIndex.set(e,i),this._indexModelID.set(i,e),i}getInstanceID(e,i){const s=10**(Math.log(i)*Math.LOG10E+1|0);return e+i/s}}class _t extends bt{constructor(){super("MyAppDatabase");g(this,"files");this.version(1).stores({files:"id, file"})}}const z=class z extends ht{constructor(e){super(e);g(this,"enabled",!0);g(this,"onFragmentsDeleted",new P);g(this,"onFragmentsLoaded",new P);g(this,"onDisposed",new P);g(this,"models",{});g(this,"serializer",new nt);g(this,"maxRamTime",5e3);g(this,"useCache",!0);g(this,"_culler",null);g(this,"_world",null);g(this,"_ramCache",new Map);g(this,"_fileCache",new _t);g(this,"_url",null);g(this,"_isDisposing",!1);g(this,"_geometryInstances",{});g(this,"_loadedFragments",{});g(this,"fragIDData",new Map);g(this,"_baseMaterial",new Z);g(this,"_baseMaterialT",new Z({transparent:!0,opacity:.5}));this.components.add(z.uuid,this)}get url(){if(!this._url)throw new Error("url must be set before using the streaming service!");return this._url}set url(e){this._url=e}get world(){if(!this._world)throw new Error("You must set a world before using the streamer!");return this._world}set world(e){var i;this._world=e,(i=this._culler)==null||i.dispose(),this._culler=new vt(this.components,e),this._culler.onViewUpdated.add(async({toLoad:o,toRemove:s,toShow:n,toHide:a})=>{await this.loadFoundGeometries(o),await this.unloadLostGeometries(s),this.setMeshVisibility(n,!0),this.setMeshVisibility(a,!1)})}get culler(){if(!this._culler)throw new Error("You must set a world before using the streamer!");return this._culler}dispose(){var e;this._isDisposing=!0,this.onFragmentsLoaded.reset(),this.onFragmentsDeleted.reset(),this._ramCache.clear(),this.models={},this._geometryInstances={},this._loadedFragments={},this.fragIDData.clear(),this._baseMaterial.dispose(),this._baseMaterialT.dispose(),(e=this._culler)==null||e.dispose(),this.onDisposed.trigger(z.uuid),this.onDisposed.reset(),this._isDisposing=!1}async load(e,i,o){const{assets:s,geometries:n,globalDataFileId:a}=e,d=this.url+a,r=await(await fetch(d)).arrayBuffer(),u=new Uint8Array(r),l=this.components.get(B).load(u,{coordinate:i});this.world.scene.three.add(l);const{opaque:w,transparent:b}=l.geometryIDs;for(const[f,_]of w){const v=l.keyFragments.get(_);if(v===void 0)throw new Error("Malformed fragments group!");this.fragIDData.set(v,[l,f,new Set])}for(const[f,_]of b){const v=l.keyFragments.get(_);if(v===void 0)throw new Error("Malformed fragments group!");this.fragIDData.set(v,[l,Math.abs(f),new Set])}this.culler.add(l.uuid,s,n),this.models[l.uuid]={assets:s,geometries:n};const m=new Map;for(const f of s){const _=f.id;for(const{transformation:v,geometryID:x,color:$}of f.geometries){m.has(x)||m.set(x,[]);const y=m.get(x);if(!y)throw new Error("Malformed instances");y.push({id:_,transformation:v,color:$})}}if(this._geometryInstances[l.uuid]=m,o){const f=new Map,_=new Map;for(const E in o.ids){const D=o.ids[E],A=parseInt(E,10);f.set(A,D)}for(const E in o.types){const D=o.types[E],A=parseInt(E,10);_.set(A,D)}const v=a.replace("-global","-properties");l.streamSettings={baseUrl:this.url,baseFileName:v,ids:f,types:_};const{indexesFile:x}=o,y=await(await fetch(this.url+x)).text(),I=this.components.get(ct);I.setRelationMap(l,I.getRelationsMapFromJSON(y))}return this.culler.needsUpdate=!0,l}remove(e){this._isDisposing=!0;const o=this.components.get(B).groups.get(e);if(o===void 0){console.log("Group to delete not found.");return}delete this.models[e],delete this._geometryInstances[e],delete this._loadedFragments[e];const s=o.keyFragments.values();for(const n of s)this.fragIDData.delete(n);this.culler.remove(e),this._isDisposing=!1}setVisibility(e,i){const o=new Map;for(const s in i){const n=this.fragIDData.get(s);if(n===void 0)throw new Error("Geometry not found!");const[a,d,c]=n,r=a.uuid;o.has(r)||o.set(r,new Map);const u=o.get(r),h=i[s];for(const w of h)e?c.delete(w):c.add(w);u.get(d)||u.set(d,new Set);const l=u.get(d);for(const w of h)l.add(w)}for(const[s,n]of o){this.culler.setVisibility(e,s,n);for(const[a]of n){const d=this._loadedFragments[s];if(!d)continue;const c=d[a];if(c)for(const r of c){const u=i[r.id];u&&r.setVisibility(e,u)}}}this.culler.needsUpdate=!0}async clearCache(){await this._fileCache.delete()}get(){}update(){}async loadFoundGeometries(e){for(const i in e){if(this._isDisposing)return;const s=this.components.get(B).groups.get(i);if(!s)return;const{geometries:n}=this.models[i],a=new Map,d=new Set;for(const[h,l]of e[i])for(const w of l){d.add(w);const b=n[w];if(!b)throw new Error("Geometry not found");if(b.geometryFile){const m=b.geometryFile,f=a.get(m)||0;a.set(m,f+h)}}const c=Array.from(a).sort((h,l)=>l[1]-h[1]);for(const[h]of c){const l=this.url+h;if(!this._ramCache.has(l)){let m=new Uint8Array;if(this.useCache){const _=await this._fileCache.files.get(l);if(_)m=_.file;else{const x=await(await fetch(l)).arrayBuffer();m=new Uint8Array(x),this._fileCache.files.add({file:m,id:l})}}else{const v=await(await fetch(l)).arrayBuffer();m=new Uint8Array(v)}const f=this.serializer.import(m);this._ramCache.set(l,{data:f,time:performance.now()})}const w=this._ramCache.get(l);if(!w)continue;w.time=performance.now();const b=[];if(w)for(const[m,{position:f,index:_,normal:v}]of w.data){if(this._isDisposing)return;if(!d.has(m)||!this._geometryInstances[i]||!this._geometryInstances[i].has(m))continue;const $=this._geometryInstances[i].get(m);if(!$)throw new Error("Instances not found!");const y=new rt,I=new Q(f,3),E=new Q(v,3);y.setAttribute("position",I),y.setAttribute("normal",E),y.setIndex(Array.from(_));const D=[],A=[];for(const F of $)F.color[3]===1?A.push(F):D.push(F);this.newFragment(s,m,y,D,!0,b),this.newFragment(s,m,y,A,!1,b)}b.length&&!this._isDisposing&&this.onFragmentsLoaded.trigger(b)}const r=new Set,u=performance.now();for(const[h,{time:l}]of this._ramCache)u-l>this.maxRamTime&&r.add(h);for(const h of r)this._ramCache.delete(h)}}async unloadLostGeometries(e){if(this._isDisposing)return;const i=[],o=this.components.get(B);for(const s in e){const n=o.groups.get(s);if(!n)throw new Error("Fragment group not found!");if(!this._loadedFragments[s])continue;const a=this._loadedFragments[s],d=e[s];for(const c of d){if(this.culler.removeFragment(n.uuid,c),!a[c])continue;const r=a[c];for(const u of r)n.items.splice(n.items.indexOf(u),1),i.push(u);delete a[c]}}i.length&&this.onFragmentsDeleted.trigger(i);for(const s of i)o.list.delete(s.id),this.world.meshes.delete(s.mesh),s.mesh.material=[],s.dispose(!0)}setMeshVisibility(e,i){for(const o in e)for(const s of e[o]){const n=this._loadedFragments[o];if(!n)continue;const a=n[s];if(a)for(const d of a)d.mesh.visible=i}}newFragment(e,i,o,s,n,a){if(s.length===0||this._isDisposing)return;const d=e.geometryIDs,c=n?d.transparent:d.opaque,u=i*(n?-1:1),h=c.get(u);if(h===void 0)return;const l=e.keyFragments.get(h);if(l===void 0)return;const w=this.components.get(B);if(w.list.has(l))return;const m=n?this._baseMaterialT:this._baseMaterial,f=new N(o,m,s.length);f.id=l,f.mesh.uuid=l,f.group=e,e.add(f.mesh),e.items.push(f),w.list.set(f.id,f),this.world.meshes.add(f.mesh),this._loadedFragments[e.uuid]||(this._loadedFragments[e.uuid]={});const _=this._loadedFragments[e.uuid];_[i]||(_[i]=[]),_[i].push(f);const v=new Map;for(let I=0;Ie in s?gv(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var et=(s,e,t)=>(vv(s,typeof e!="symbol"?e+"":e,t),t);import{U as Pa,J as yv,p as Ev,s as bv,n as wv,u as zs,W as to,c as Iv,R as Cv,d as Yh}from"./index-b4ozRbQy.js";import{z as io,f as Ve,V as O,c as Ne,e as gt,A as ff,F as mf,P as an,r as Dt,p as Ke,M as le,T as On,E as gf,a as Ee,U as Gh,K as Oa,v as Vs,y as Gn,o as jn,Y as Ps,u as vf,C as Rt,d as Xt,Z as no,I as Kt,_ as Fn,B as ut,J as yf,$ as Ef,a0 as jh,a1 as Wh,a2 as Xh,a3 as Kh,a4 as cl,a5 as Qh,a6 as bf,a7 as hl,a8 as tn,k as za,a9 as wf,aa as If,ab as Wn,N as Va,ac as ii,ad as Tv,ae as Qo,af as zr,X as Cf,h as so,ag as Fa,n as Xn,l as Tf,m as ul,G as Os,W as Ri,q as wt,g as st,L as Di,i as dl,ah as Ha,ai as Tt,O as kn,j as Si,aj as pl,ak as Zh,al as qh,am as Jh,an as xv,ao as Av,ap as Sv,aq as _v,Q as Vt,S as Rv,ar as ad,as as Pv,at as Ov,au as Fv,av as Mv,aw as Zo,ax as Lv,ay as pr,az as Dv,aA as Nv,aB as Qc,aC as xs,aD as Uv,D as kv,s as xf,x as Bv,H as $h,t as zv,aE as fr,w as Ai,aF as Vv,aG as Hv,aH as Yv,aI as Gv,aJ as jv,aK as ld,aL as Wv,aM as Xv,aN as Kv,R as Af,aO as Qv,aP as Zv,aQ as Sf,aR as qv,aS as Jv,aT as _f,aU as Rf,aV as Pf,aW as $v}from"./web-ifc-api-BC8YMRiS.js";import{a as cd,L as ey,b as ty}from"./Line2-7GsqoD5b.js";import{M as iy}from"./mark-Cj_PmUva.js";import"./import-wrapper-prod-LhqN7JJy.js";const al=class al{constructor(e,t){et(this,"scene");et(this,"onSelect",new Pa);et(this,"type");et(this,"selectCurve");et(this,"selectPoints");et(this,"hoverCurve");et(this,"hoverPoints");et(this,"caster",new io);this.scene=e,this.type=t,this.hoverCurve=this.newCurve(.003,4473924,!1),this.hoverPoints=this.newPoints(5,4473924),this.selectCurve=this.newCurve(.005,16777215,!0),this.selectPoints=this.newPoints(7,16777215)}dispose(){this.selectCurve&&this.scene.remove(this.selectCurve),this.selectCurve.material.dispose(),this.selectCurve.geometry.dispose(),this.selectCurve=null,this.hoverCurve.material.dispose(),this.hoverCurve.geometry.dispose(),this.hoverCurve=null,this.hoverPoints.material.dispose(),this.hoverPoints.geometry.dispose(),this.selectPoints.material.dispose(),this.selectPoints.geometry.dispose(),this.scene=null}castRay(e,t,i,n){const r=new Ve,o=i.getBoundingClientRect();r.x=(e.clientX-o.left)/o.width*2-1,r.y=-((e.clientY-o.top)/o.height)*2+1,this.caster.setFromCamera(r,t);const a=this.caster.intersectObjects(n);return a.length?a[0]:null}select(e){this.highlight(e,this.selectCurve,this.selectPoints,!0),this.onSelect.trigger(e)}unSelect(){this.selectCurve.removeFromParent(),this.selectPoints.removeFromParent()}hover(e){this.highlight(e,this.hoverCurve,this.hoverPoints,!1)}unHover(){this.hoverCurve.removeFromParent(),this.hoverPoints.removeFromParent()}setResolution({x:e,y:t}){this.selectCurve.material.resolution.set(e/t,1),this.hoverCurve.material.resolution.set(e/t,1)}highlight(e,t,i,n){const{alignment:r}=e.curve;this.scene.add(t),this.scene.add(i);const o=[],a=[],l=[];for(const f of r[this.type]){const g=f.mesh.geometry.attributes.position;for(const T of g.array)o.push(T);if(n){let T;if(this.type==="absolute"){const{horizontal:_}=f.alignment;T=_[f.index].data.TYPE}else T=f.data.TYPE;const S=al.settings.colors[T]||[1,1,1];for(let _=0;_t.geometry.attributes.position.count&&(t.geometry.dispose(),t.geometry=new cd),t.geometry.setPositions(o),n&&t.geometry.setColors(a),i.geometry.setFromPoints(l)}newCurve(e,t,i){const n=new cd,r=new ey({color:t,linewidth:e,vertexColors:i,worldUnits:!1,depthTest:!1}),o=new ty(n,r);return this.scene.add(o),o}newPoints(e,t){const i=new Ne,n=new gt(new Float32Array,3);i.setAttribute("position",n);const r=new ff({size:e,color:t,sizeAttenuation:!1,depthTest:!1}),o=new mf(i,r);return o.frustumCulled=!1,this.scene.add(o),o}};et(al,"settings",{colors:{LINE:[213/255,0/255,255/255],CIRCULARARC:[0/255,46,255/255],CLOTHOID:[0/255,255/255,0/255],PARABOLICARC:[0/255,255/255,72/255],CONSTANTGRADIENT:[213/255,0/255,255/255]}});let Zc=al;const ll=class ll extends yv{constructor(t){super(t);et(this,"onHighlight",new Pa);et(this,"enabled",!0);et(this,"_highlighter");et(this,"mouseMarkers");et(this,"onMarkerChange",new Pa);et(this,"onMarkerHidden",new Pa);et(this,"_curves",[]);et(this,"_world",null);et(this,"updateLinesResolution",t=>{var i;(i=this.highlighter)==null||i.setResolution(t)});et(this,"onClick",t=>{if(!this.enabled||!this._highlighter)return;if(!this.world)throw new Error("No world found!");if(!this.world.renderer)return;const i=this.world.renderer.three.domElement,n=this.world.camera.three,r=this._highlighter.castRay(t,n,i,this._curves);if(r){const o=r.object;this._highlighter.select(o),this.updateMarker(r,"select");const{point:a,index:l}=r;l!==void 0&&this.onHighlight.trigger({curve:o,point:a,index:l});return}this._highlighter.unSelect(),this.mouseMarkers&&(this.mouseMarkers.hover.visible=!1),this.onMarkerHidden.trigger({type:"hover"})});et(this,"onMouseMove",async t=>{if(!this.enabled||!this._highlighter)return;if(!this.world)throw new Error("No world found!");if(!this.world.renderer)return;const i=this.world.renderer.three.domElement,n=this.world.camera.three,r=this._highlighter.castRay(t,n,i,this._curves);if(r){this._highlighter.hover(r.object),this.updateMarker(r,"hover");return}this._highlighter.unHover()});this.components.add(ll.uuid,this)}get world(){return this._world}set world(t){var n,r,o;if(t===this._world||(this._world&&this.setupEvents(!1),this._world=t,(n=this._highlighter)==null||n.dispose(),(r=this.mouseMarkers)==null||r.hover.dispose(),(o=this.mouseMarkers)==null||o.select.dispose(),!t))return;const i=t.scene.three;this._highlighter=new Zc(i,"absolute"),this.mouseMarkers={select:this.newMouseMarker("#ffffff",t),hover:this.newMouseMarker("#575757",t)},this.setupEvents(!0)}get highlighter(){if(!this._highlighter)throw new Error("Navigator not initialized!");return this._highlighter}draw(t){if(!t.civilData)throw new Error("Model must have civil data!");if(!this.world)throw new Error("A world must be given before drawing an alignment!");const i=this.world.scene.three;for(const[n,r]of t.civilData.alignments)for(const{mesh:o}of r.absolute)i.add(o),this._curves.push(o)}newMouseMarker(t,i){const n=i.scene.three,r=document.createElement("div");r.style.backgroundColor=t,r.style.width="1rem",r.style.height="1rem",r.style.borderRadius="1rem";const o=new iy(i,r,n);return o.visible=!1,o}setMarker(t,i,n){if(!this.mouseMarkers)throw new Error("No mouse markers found! Initialize the world before using this.");const r=t.getPointAt(i,"absolute");this.mouseMarkers[n].visible=!0,this.mouseMarkers[n].three.position.copy(r)}hideMarker(t){if(!this.mouseMarkers)throw new Error("No mouse markers found! Initialize the world before using this.");const i=this.mouseMarkers[t].three;i.visible=!1}setupEvents(t){var n,r;if(!this.world)throw new Error("No world found!");if(!this.world.renderer)return;const i=this.world.renderer.three.domElement;(n=this.world.renderer)==null||n.onResize.remove(this.updateLinesResolution),i.removeEventListener("click",this.onClick),i.removeEventListener("mousemove",this.onMouseMove),t&&(i.addEventListener("click",this.onClick),i.addEventListener("mousemove",this.onMouseMove),(r=this.world.renderer)==null||r.onResize.add(this.updateLinesResolution))}updateMarker(t,i){if(!this.mouseMarkers)return;const{point:n,object:r}=t,o=r,a=o.curve,l=o.curve.alignment,h=l.getPercentageAt(n,"absolute");this.mouseMarkers[i].visible=!0,this.mouseMarkers[i].three.position.copy(n),h!==null&&this.onMarkerChange.trigger({alignment:l,percentage:h,type:i,curve:a})}};et(ll,"uuid","0a59c09e-2b49-474a-9320-99f51f40f182");let hd=ll;var ny=Object.defineProperty,sy=(s,e,t)=>e in s?ny(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,x=(s,e,t)=>(sy(s,typeof e!="symbol"?e+"":e,t),t),ry=Object.defineProperty,oy=(s,e,t)=>e in s?ry(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,A=(s,e,t)=>(oy(s,typeof e!="symbol"?e+"":e,t),t);const Of=0,ay=1,ly=2,ud=2,Ec=1.25,dd=1,Ma=6*4+4+4,fl=65535,cy=Math.pow(2,-24),bc=Symbol("SKIP_GENERATION");function hy(s){return s.index?s.index.count:s.attributes.position.count}function Hs(s){return hy(s)/3}function uy(s,e=ArrayBuffer){return s>65535?new Uint32Array(new e(4*s)):new Uint16Array(new e(2*s))}function dy(s,e){if(!s.index){const t=s.attributes.position.count,i=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,n=uy(t,i);s.setIndex(new gt(n,1));for(let r=0;ra-l);for(let a=0;ar.offset-o.offset),i=t[t.length-1];i.count=Math.min(e-i.offset,i.count);let n=0;return t.forEach(({count:r})=>n+=r),e!==n}function Je(s,e,t){return t.min.x=e[s],t.min.y=e[s+1],t.min.z=e[s+2],t.max.x=e[s+3],t.max.y=e[s+4],t.max.z=e[s+5],t}function fy(s){s[0]=s[1]=s[2]=1/0,s[3]=s[4]=s[5]=-1/0}function pd(s){let e=-1,t=-1/0;for(let i=0;i<3;i++){const n=s[i+3]-s[i];n>t&&(t=n,e=i)}return e}function fd(s,e){e.set(s)}function md(s,e,t){let i,n;for(let r=0;r<3;r++){const o=r+3;i=s[r],n=e[r],t[r]=in?i:n}}function qo(s,e,t){for(let i=0;i<3;i++){const n=e[s+2*i],r=e[s+2*i+1],o=n-r,a=n+r;ot[i+3]&&(t[i+3]=a)}}function mr(s){const e=s[3]-s[0],t=s[4]-s[1],i=s[5]-s[2];return 2*(e*t+t*i+i*e)}function wc(s,e,t,i,n=null){let r=1/0,o=1/0,a=1/0,l=-1/0,h=-1/0,d=-1/0,p=1/0,f=1/0,g=1/0,v=-1/0,b=-1/0,w=-1/0;const T=n!==null;for(let S=e*6,_=(e+t)*6;S<_;S+=6){const I=s[S+0],P=s[S+1],M=I-P,k=I+P;Ml&&(l=k),T&&Iv&&(v=I);const V=s[S+2],W=s[S+3],j=V-W,Q=V+W;jh&&(h=Q),T&&Vb&&(b=V);const $=s[S+4],ne=s[S+5],oe=$-ne,ve=$+ne;oed&&(d=ve),T&&$w&&(w=$)}i[0]=r,i[1]=o,i[2]=a,i[3]=l,i[4]=h,i[5]=d,T&&(n[0]=p,n[1]=f,n[2]=g,n[3]=v,n[4]=b,n[5]=w)}function my(s,e,t,i){let n=1/0,r=1/0,o=1/0,a=-1/0,l=-1/0,h=-1/0;for(let d=e*6,p=(e+t)*6;da&&(a=f);const g=s[d+2];gl&&(l=g);const v=s[d+4];vh&&(h=v)}i[0]=n,i[1]=r,i[2]=o,i[3]=a,i[4]=l,i[5]=h}function gy(s,e){fy(e);const t=s.attributes.position,i=s.index?s.index.array:null,n=Hs(s),r=new Float32Array(n*6),o=t.normalized,a=t.array,l=t.offset||0;let h=3;t.isInterleavedBufferAttribute&&(h=t.data.stride);const d=["getX","getY","getZ"];for(let p=0;pM&&(M=_),I>M&&(M=I);const k=(M-P)/2,V=T*2;r[g+V+0]=P+k,r[g+V+1]=k+(Math.abs(P)+k)*cy,Pe[T+3]&&(e[T+3]=M)}}return r}const Ti=32,vy=(s,e)=>s.candidate-e.candidate,Xi=new Array(Ti).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),Jo=new Float32Array(6);function yy(s,e,t,i,n,r){let o=-1,a=0;if(r===Of)o=pd(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(r===ay)o=pd(s),o!==-1&&(a=Ey(t,i,n,o));else if(r===ly){const l=mr(s);let h=Ec*n;const d=i*6,p=(i+n)*6;for(let f=0;f<3;f++){const g=e[f],v=(e[f+3]-g)/Ti;if(n=P.candidate?qo(S,t,P.rightCacheBounds):(qo(S,t,P.leftCacheBounds),P.count++)}}for(let S=0;S=Ti&&(S=Ti-1);const _=Xi[S];_.count++,qo(T,t,_.bounds)}const b=Xi[Ti-1];fd(b.bounds,b.rightCacheBounds);for(let T=Ti-2;T>=0;T--){const S=Xi[T],_=Xi[T+1];md(S.bounds,_.rightCacheBounds,S.rightCacheBounds)}let w=0;for(let T=0;T=l;)a--;if(o=l;)a--;if(o2**16,n=i?4:2,r=e?new SharedArrayBuffer(t*n):new ArrayBuffer(t*n),o=i?new Uint32Array(r):new Uint16Array(r);for(let a=0,l=o.length;a=n&&(p=!0,r&&(console.warn(`MeshBVH: Max depth of ${n} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),M<=o||V>=n)return S(P+M),I.offset=P,I.count=M,I;const W=yy(I.boundingData,k,v,P,M,a);if(W.axis===-1)return S(P+M),I.offset=P,I.count=M,I;const j=b(d,i,v,P,M,W);if(j===P||j===P+M)S(P+M),I.offset=P,I.count=M;else{I.splitAxis=W.axis;const Q=new $o,$=P,ne=j-P;I.left=Q,Q.boundingData=new Float32Array(6),wc(v,$,ne,Q.boundingData,g),_(Q,$,ne,g,V+1);const oe=new $o,ve=j,re=M-ne;I.right=oe,oe.boundingData=new Float32Array(6),wc(v,ve,re,oe.boundingData,g),_(oe,ve,re,g,V+1)}return I}}function Ty(s,e){const t=s.geometry;e.indirect&&(s._indirectBuffer=Iy(t,e.useSharedArrayBuffer),py(t)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),s._indirectBuffer||dy(t,e);const i=Cy(s,e);let n,r,o;const a=[],l=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let p=0;pMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return r[g+6]=I/4,I=d(I,S),r[g+7]=_,I}}}let Oi=class{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let i=1/0,n=-1/0;for(let r=0,o=e.length;rn?a:n}this.min=i,this.max=n}setFromPoints(e,t){let i=1/0,n=-1/0;for(let r=0,o=t.length;rn?l:n}this.min=i,this.max=n}isSeparated(e){return this.min>e.max||e.min>this.max}};Oi.prototype.setFromBox=function(){const s=new O;return function(e,t){const i=t.min,n=t.max;let r=1/0,o=-1/0;for(let a=0;a<=1;a++)for(let l=0;l<=1;l++)for(let h=0;h<=1;h++){s.x=i.x*a+n.x*(1-a),s.y=i.y*l+n.y*(1-l),s.z=i.z*h+n.z*(1-h);const d=e.dot(s);r=Math.min(d,r),o=Math.max(d,o)}this.min=r,this.max=o}}();const xy=function(){const s=new O,e=new O,t=new O;return function(i,n,r){const o=i.start,a=s,l=n.start,h=e;t.subVectors(o,l),s.subVectors(i.end,i.start),e.subVectors(n.end,n.start);const d=t.dot(h),p=h.dot(a),f=h.dot(h),g=t.dot(a),v=a.dot(a)*f-p*p;let b,w;v!==0?b=(d*p-g*f)/v:b=0,w=(d+b*p)/f,r.x=b,r.y=w}}(),eu=function(){const s=new Ve,e=new O,t=new O;return function(i,n,r,o){xy(i,n,s);let a=s.x,l=s.y;if(a>=0&&a<=1&&l>=0&&l<=1){i.at(a,r),n.at(l,o);return}else if(a>=0&&a<=1){l<0?n.at(0,o):n.at(1,o),i.closestPointToPoint(o,!0,r);return}else if(l>=0&&l<=1){a<0?i.at(0,r):i.at(1,r),n.closestPointToPoint(r,!0,o);return}else{let h;a<0?h=i.start:h=i.end;let d;l<0?d=n.start:d=n.end;const p=e,f=t;if(i.closestPointToPoint(d,!0,e),n.closestPointToPoint(h,!0,t),p.distanceToSquared(d)<=f.distanceToSquared(h)){r.copy(p),o.copy(d);return}else{r.copy(h),o.copy(f);return}}}}(),Ay=function(){const s=new O,e=new O,t=new an,i=new Dt;return function(n,r){const{radius:o,center:a}=n,{a:l,b:h,c:d}=r;if(i.start=l,i.end=h,i.closestPointToPoint(a,!0,s).distanceTo(a)<=o||(i.start=l,i.end=d,i.closestPointToPoint(a,!0,s).distanceTo(a)<=o)||(i.start=h,i.end=d,i.closestPointToPoint(a,!0,s).distanceTo(a)<=o))return!0;const p=r.getPlane(t);if(Math.abs(p.distanceToPoint(a))<=o){const f=p.projectPoint(a,e);if(r.containsPoint(f))return!0}return!1}}(),Sy=1e-15;function Ic(s){return Math.abs(s)new O),this.satBounds=new Array(4).fill().map(()=>new Oi),this.points=[this.a,this.b,this.c],this.sphere=new Gn,this.plane=new an,this.needsUpdate=!0}intersectsSphere(e){return Ay(e,this)}update(){const e=this.a,t=this.b,i=this.c,n=this.points,r=this.satAxes,o=this.satBounds,a=r[0],l=o[0];this.getNormal(a),l.setFromPoints(a,n);const h=r[1],d=o[1];h.subVectors(e,t),d.setFromPoints(h,n);const p=r[2],f=o[2];p.subVectors(t,i),f.setFromPoints(p,n);const g=r[3],v=o[3];g.subVectors(i,e),v.setFromPoints(g,n),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}};si.prototype.closestPointToSegment=function(){const s=new O,e=new O,t=new Dt;return function(i,n=null,r=null){const{start:o,end:a}=i,l=this.points;let h,d=1/0;for(let p=0;p<3;p++){const f=(p+1)%3;t.start.copy(l[p]),t.end.copy(l[f]),eu(t,i,s,e),h=s.distanceToSquared(e),h=2){(I===1?T.start:T.end).copy(g),_=2;break}if(_++,_===2&&I===-1)break}}return _}return function(b,w=null,T=!1){this.needsUpdate&&this.update(),b.isExtendedTriangle?b.needsUpdate&&b.update():(s.copy(b),s.update(),b=s);const S=this.plane,_=b.plane;if(Math.abs(S.normal.dot(_.normal))>1-1e-10){const I=this.satBounds,P=this.satAxes;t[0]=b.a,t[1]=b.b,t[2]=b.c;for(let V=0;V<4;V++){const W=I[V],j=P[V];if(i.setFromPoints(j,t),W.isSeparated(i))return!1}const M=b.satBounds,k=b.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let V=0;V<4;V++){const W=M[V],j=k[V];if(i.setFromPoints(j,e),W.isSeparated(i))return!1}for(let V=0;V<4;V++){const W=P[V];for(let j=0;j<4;j++){const Q=k[j];if(r.crossVectors(W,Q),i.setFromPoints(r,e),n.setFromPoints(r,t),i.isSeparated(n))return!1}}return w&&(T||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),w.start.set(0,0,0),w.end.set(0,0,0)),!0}else{const I=v(this,_,p);if(I===1&&b.containsPoint(p.end))return w&&(w.start.copy(p.end),w.end.copy(p.end)),!0;if(I!==2)return!1;const P=v(b,S,f);if(P===1&&this.containsPoint(f.end))return w&&(w.start.copy(f.end),w.end.copy(f.end)),!0;if(P!==2)return!1;if(p.delta(a),f.delta(l),a.dot(l)<0){let $=f.start;f.start=f.end,f.end=$}const M=p.start.dot(a),k=p.end.dot(a),V=f.start.dot(a),W=f.end.dot(a),j=k0?w.start.copy(p.start):w.start.copy(f.start),h.subVectors(p.end,f.end),h.dot(a)<0?w.end.copy(p.end):w.end.copy(f.end)),!0)}}}();si.prototype.distanceToPoint=function(){const s=new O;return function(e){return this.closestPointToPoint(e,s),e.distanceTo(s)}}();si.prototype.distanceToTriangle=function(){const s=new O,e=new O,t=["a","b","c"],i=new Dt,n=new Dt;return function(r,o=null,a=null){const l=o||a?i:null;if(this.intersectsTriangle(r,l))return(o||a)&&(o&&l.getCenter(o),a&&l.getCenter(a)),0;let h=1/0;for(let d=0;d<3;d++){let p;const f=t[d],g=r[f];this.closestPointToPoint(g,s),p=g.distanceToSquared(s),pnew O),this.satAxes=new Array(3).fill().map(()=>new O),this.satBounds=new Array(3).fill().map(()=>new Oi),this.alignedSatBounds=new Array(3).fill().map(()=>new Oi),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),i&&this.matrix.copy(i)}set(e,t,i){this.min.copy(e),this.max.copy(t),this.matrix.copy(i),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}};xt.prototype.update=function(){return function(){const s=this.matrix,e=this.min,t=this.max,i=this.points;for(let l=0;l<=1;l++)for(let h=0;h<=1;h++)for(let d=0;d<=1;d++){const p=1*l|2*h|4*d,f=i[p];f.x=l?t.x:e.x,f.y=h?t.y:e.y,f.z=d?t.z:e.z,f.applyMatrix4(s)}const n=this.satBounds,r=this.satAxes,o=i[0];for(let l=0;l<3;l++){const h=r[l],d=n[l],p=1<new Dt),t=new Array(12).fill().map(()=>new Dt),i=new O,n=new O;return function(r,o=0,a=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(r))return(a||l)&&(r.getCenter(n),this.closestPointToPoint(n,i),r.closestPointToPoint(i,n),a&&a.copy(i),l&&l.copy(n)),0;const h=o*o,d=r.min,p=r.max,f=this.points;let g=1/0;for(let b=0;b<8;b++){const w=f[b];n.copy(w).clamp(d,p);const T=w.distanceToSquared(n);if(Tnew si)}}const Yt=new _y;function Ft(s,e){return e[s+15]===65535}function Lt(s,e){return e[s+6]}function Gt(s,e){return e[s+14]}function jt(s){return s+8}function Wt(s,e){return e[s+6]}function Lf(s,e){return e[s+7]}class Ry{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=i=>{t&&e.push(t),t=i,this.float32Array=new Float32Array(i),this.uint16Array=new Uint16Array(i),this.uint32Array=new Uint32Array(i)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const Qe=new Ry;let Ji,As;const os=[],ea=new tu(()=>new Ke);function Py(s,e,t,i,n,r){Ji=ea.getPrimitive(),As=ea.getPrimitive(),os.push(Ji,As),Qe.setBuffer(s._roots[e]);const o=qc(0,s.geometry,t,i,n,r);Qe.clearBuffer(),ea.releasePrimitive(Ji),ea.releasePrimitive(As),os.pop(),os.pop();const a=os.length;return a>0&&(As=os[a-1],Ji=os[a-2]),o}function qc(s,e,t,i,n=null,r=0,o=0){const{float32Array:a,uint16Array:l,uint32Array:h}=Qe;let d=s*2;if(Ft(d,l)){const p=Lt(s,h),f=Gt(d,l);return Je(s,a,Ji),i(p,f,!1,o,r+s,Ji)}else{let p=function(Q){const{uint16Array:$,uint32Array:ne}=Qe;let oe=Q*2;for(;!Ft(oe,$);)Q=jt(Q),oe=Q*2;return Lt(Q,ne)},f=function(Q){const{uint16Array:$,uint32Array:ne}=Qe;let oe=Q*2;for(;!Ft(oe,$);)Q=Wt(Q,ne),oe=Q*2;return Lt(Q,ne)+Gt(oe,$)};const g=jt(s),v=Wt(s,h);let b=g,w=v,T,S,_,I;if(n&&(_=Ji,I=As,Je(b,a,_),Je(w,a,I),T=n(_),S=n(I),S(gr.copy(e).clamp(d.min,d.max),gr.distanceToSquared(e)),intersectsBounds:(d,p,f)=>f{d.closestPointToPoint(e,gr);const f=e.distanceToSquared(gr);return f0&&h.normal.multiplyScalar(-1));const d={a:r,b:o,c:a,normal:new O,materialIndex:0};On.getNormal(as,ls,cs,d.normal),h.face=d,h.faceIndex=r}return h}function ml(s,e,t,i,n){const r=i*3;let o=r+0,a=r+1,l=r+2;const h=s.index;s.index&&(o=h.getX(o),a=h.getX(a),l=h.getX(l));const{position:d,normal:p,uv:f,uv1:g}=s.attributes,v=My(t,d,p,f,g,o,a,l,e);return v?(v.faceIndex=i,n&&n.push(v),v):null}function ot(s,e,t,i){const n=s.a,r=s.b,o=s.c;let a=e,l=e+1,h=e+2;t&&(a=t.getX(a),l=t.getX(l),h=t.getX(h)),n.x=i.getX(a),n.y=i.getY(a),n.z=i.getZ(a),r.x=i.getX(l),r.y=i.getY(l),r.z=i.getZ(l),o.x=i.getX(h),o.y=i.getY(h),o.z=i.getZ(h)}function Ly(s,e,t,i,n,r){const{geometry:o,_indirectBuffer:a}=s;for(let l=i,h=i+n;lP&&(P=Q),$<_&&(_=$),$>M&&(M=$),nek&&(k=ne)}return l[f+0]!==S||l[f+1]!==_||l[f+2]!==I||l[f+3]!==P||l[f+4]!==M||l[f+5]!==k?(l[f+0]=S,l[f+1]=_,l[f+2]=I,l[f+3]=P,l[f+4]=M,l[f+5]=k,!0):!1}else{const w=f+8,T=o[f+6],S=w+g,_=T+g;let I=v,P=!1,M=!1;e?I||(P=e.has(S),M=e.has(_),I=!P&&!M):(P=!0,M=!0);const k=I||P,V=I||M;let W=!1;k&&(W=p(w,g,I));let j=!1;V&&(j=p(T,g,I));const Q=W||j;if(Q)for(let $=0;$<3;$++){const ne=w+$,oe=T+$,ve=l[ne],re=l[ne+3],ge=l[oe],me=l[oe+3];l[f+$]=veme?re:me}return Q}}}const Ed=new Ke;function nn(s,e,t,i){return Je(s,e,Ed),t.intersectBox(Ed,i)}function ky(s,e,t,i,n,r){const{geometry:o,_indirectBuffer:a}=s;for(let l=i,h=i+n;l=0;let p,f;d?(p=jt(s),f=Wt(s,o)):(p=Wt(s,o),f=jt(s));const g=nn(p,n,i,wd)?$c(p,e,t,i):null;if(g){const b=g.point[h];if(d?b<=n[f+l]:b>=n[f+l+3])return g}const v=nn(f,n,i,wd)?$c(f,e,t,i):null;return g&&v?g.distance<=v.distance?g:v:g||v||null}}const ra=new Ke,hs=new si,us=new si,vr=new Ee,Id=new xt,oa=new xt;function Gy(s,e,t,i){Qe.setBuffer(s._roots[e]);const n=eh(0,s,t,i);return Qe.clearBuffer(),n}function eh(s,e,t,i,n=null){const{float32Array:r,uint16Array:o,uint32Array:a}=Qe;let l=s*2;if(n===null&&(t.boundingBox||t.computeBoundingBox(),Id.set(t.boundingBox.min,t.boundingBox.max,i),n=Id),Ft(l,o)){const h=e.geometry,d=h.index,p=h.attributes.position,f=t.index,g=t.attributes.position,v=Lt(s,a),b=Gt(l,o);if(vr.copy(i).invert(),t.boundsTree)return Je(s,r,oa),oa.matrix.copy(vr),oa.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:w=>oa.intersectsBox(w),intersectsTriangle:w=>{w.a.applyMatrix4(i),w.b.applyMatrix4(i),w.c.applyMatrix4(i),w.needsUpdate=!0;for(let T=v*3,S=(b+v)*3;TTc.distanceToBox(P),intersectsBounds:(P,M,k)=>k{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:k=>yr.distanceToBox(k),intersectsBounds:(k,V,W)=>W{for(let W=k,j=k+V;WP&&(P=ne),oe<_&&(_=oe),oe>M&&(M=oe),vek&&(k=ve)}}return l[f+0]!==S||l[f+1]!==_||l[f+2]!==I||l[f+3]!==P||l[f+4]!==M||l[f+5]!==k?(l[f+0]=S,l[f+1]=_,l[f+2]=I,l[f+3]=P,l[f+4]=M,l[f+5]=k,!0):!1}else{const w=f+8,T=o[f+6],S=w+g,_=T+g;let I=v,P=!1,M=!1;e?I||(P=e.has(S),M=e.has(_),I=!P&&!M):(P=!0,M=!0);const k=I||P,V=I||M;let W=!1;k&&(W=p(w,g,I));let j=!1;V&&(j=p(T,g,I));const Q=W||j;if(Q)for(let $=0;$<3;$++){const ne=w+$,oe=T+$,ve=l[ne],re=l[ne+3],ge=l[oe],me=l[oe+3];l[f+$]=veme?re:me}return Q}}}const Cd=new O;function qy(s,e,t,i,n){Qe.setBuffer(s._roots[e]),th(0,s,t,i,n),Qe.clearBuffer()}function th(s,e,t,i,n){const{float32Array:r,uint16Array:o,uint32Array:a}=Qe,l=s*2;if(Ft(l,o)){const h=Lt(s,a),d=Gt(l,o);ky(e,t,i,h,d,n)}else{const h=jt(s);nn(h,r,i,Cd)&&th(h,e,t,i,n);const d=Wt(s,a);nn(d,r,i,Cd)&&th(d,e,t,i,n)}}const Td=new O,Jy=["x","y","z"];function $y(s,e,t,i){Qe.setBuffer(s._roots[e]);const n=ih(0,s,t,i);return Qe.clearBuffer(),n}function ih(s,e,t,i){const{float32Array:n,uint16Array:r,uint32Array:o}=Qe;let a=s*2;if(Ft(a,r)){const l=Lt(s,o),h=Gt(a,r);return By(e,t,i,l,h)}else{const l=Lf(s,o),h=Jy[l],d=i.direction[h]>=0;let p,f;d?(p=jt(s),f=Wt(s,o)):(p=Wt(s,o),f=jt(s));const g=nn(p,n,i,Td)?ih(p,e,t,i):null;if(g){const b=g.point[h];if(d?b<=n[f+l]:b>=n[f+l+3])return g}const v=nn(f,n,i,Td)?ih(f,e,t,i):null;return g&&v?g.distance<=v.distance?g:v:g||v||null}}const la=new Ke,ds=new si,ps=new si,Er=new Ee,xd=new xt,ca=new xt;function e1(s,e,t,i){Qe.setBuffer(s._roots[e]);const n=nh(0,s,t,i);return Qe.clearBuffer(),n}function nh(s,e,t,i,n=null){const{float32Array:r,uint16Array:o,uint32Array:a}=Qe;let l=s*2;if(n===null&&(t.boundingBox||t.computeBoundingBox(),xd.set(t.boundingBox.min,t.boundingBox.max,i),n=xd),Ft(l,o)){const h=e.geometry,d=h.index,p=h.attributes.position,f=t.index,g=t.attributes.position,v=Lt(s,a),b=Gt(l,o);if(Er.copy(i).invert(),t.boundsTree)return Je(s,r,ca),ca.matrix.copy(Er),ca.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:w=>ca.intersectsBox(w),intersectsTriangle:w=>{w.a.applyMatrix4(i),w.b.applyMatrix4(i),w.c.applyMatrix4(i),w.needsUpdate=!0;for(let T=v,S=b+v;Txc.distanceToBox(P),intersectsBounds:(P,M,k)=>k{if(e.boundsTree){const k=e.boundsTree;return k.shapecast({boundsTraverseOrder:V=>br.distanceToBox(V),intersectsBounds:(V,W,j)=>j{for(let j=V,Q=V+W;jnew Ke),fs=new Ke,ms=new Ke,Ac=new Ke,Sc=new Ke;let _c=!1;function a1(s,e,t,i){if(_c)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");_c=!0;const n=s._roots,r=e._roots;let o,a=0,l=0;const h=new Ee().copy(t).invert();for(let d=0,p=n.length;dl.slice()),index:o.array.slice(),indirectBuffer:r?r.slice():null}:a={roots:n,index:o.array,indirectBuffer:r},a}static deserialize(e,t,i={}){i={setIndex:!0,indirect:!!e.indirectBuffer,...i};const{index:n,roots:r,indirectBuffer:o}=e,a=new Df(t,{...i,[bc]:!0});if(a._roots=r,a._indirectBuffer=o||null,i.setIndex){const l=t.getIndex();if(l===null){const h=new gt(e.index,1,!1);t.setIndex(h)}else l.array!==n&&(l.array.set(n),l.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:Of,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[bc]:!1},t),t.useSharedArrayBuffer&&!o1())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[bc]||(Ty(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new Ke)));const{_indirectBuffer:i}=this;this.resolveTriangleIndex=t.indirect?n=>i[n]:n=>n}refit(e=null){return(this.indirect?Zy:Uy)(this,e)}traverse(e,t=0){const i=this._roots[t],n=new Uint32Array(i),r=new Uint16Array(i);o(0);function o(a,l=0){const h=a*2,d=r[h+15]===fl;if(d){const p=n[a+6],f=r[h+14];e(l,d,new Float32Array(i,a*4,6),p,f)}else{const p=a+Ma/4,f=n[a+6],g=n[a+7];e(l,d,new Float32Array(i,a*4,6),g)||(o(p,l+1),o(f,l+1))}}}raycast(e,t=ad){const i=this._roots,n=this.geometry,r=[],o=t.isMaterial,a=Array.isArray(t),l=n.groups,h=o?t.side:t,d=this.indirect?qy:Vy;for(let p=0,f=i.length;pp(f,g,v,b,w)?!0:i(f,g,this,a,v,b,t)}else o||(a?o=(p,f,g,v)=>i(p,f,this,a,g,v,t):o=(p,f,g)=>g);let l=!1,h=0;const d=this._roots;for(let p=0,f=d.length;p{const b=this.resolveTriangleIndex(v);ot(o,b*3,a,l)}:v=>{ot(o,v*3,a,l)},d=Yt.getPrimitive(),p=e.geometry.index,f=e.geometry.attributes.position,g=e.indirect?v=>{const b=e.resolveTriangleIndex(v);ot(d,b*3,p,f)}:v=>{ot(d,v*3,p,f)};if(r){const v=(b,w,T,S,_,I,P,M)=>{for(let k=T,V=T+S;kua.intersectsBox(i),intersectsTriangle:i=>ua.intersectsTriangle(i)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,i={},n={},r=0,o=1/0){return(this.indirect?r1:Qy)(this,e,t,i,n,r,o)}closestPointToPoint(e,t={},i=0,n=1/0){return Oy(this,e,t,i,n)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(t=>{Je(0,new Float32Array(t),Ad),e.union(Ad)}),e}};function Sd(s,e,t){return s===null||(s.point.applyMatrix4(e.matrixWorld),s.distance=s.point.distanceTo(t.ray.origin),s.object=e,s.distancet.far)?null:s}const Rc=new Pv,_d=new Ee,c1=le.prototype.raycast;function h1(s,e){if(this.geometry.boundsTree){if(this.material===void 0)return;_d.copy(this.matrixWorld).invert(),Rc.copy(s.ray).applyMatrix4(_d);const t=this.geometry.boundsTree;if(s.firstHitOnly===!0){const i=Sd(t.raycastFirst(Rc,this.material),this,s);i&&e.push(i)}else{const i=t.raycast(Rc,this.material);for(let n=0,r=i.length;n{const t=this.handlers.slice(0);for(const i of t)i(e)}),A(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}}let $i=class{constructor(){A(this,"trigger",async e=>{const t=this.handlers.slice(0);for(const i of t)await i(e)}),A(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}},iu=class{constructor(e){A(this,"isDisposeable",()=>"dispose"in this&&"onDisposed"in this),A(this,"isResizeable",()=>"resize"in this&&"getSize"in this),A(this,"isUpdateable",()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this),A(this,"isHideable",()=>"visible"in this),A(this,"isConfigurable",()=>"setup"in this&&"config"in this&&"onSetup"in this),this.components=e}},Re=class extends iu{},Nf=class extends iu{constructor(e){super(e),A(this,"worlds",new Map),A(this,"onWorldChanged",new ee),A(this,"currentWorld",null),this.onWorldChanged.add(({world:t,action:i})=>{i==="removed"&&this.worlds.delete(t.uuid)})}};class p1 extends Nf{constructor(){super(...arguments),A(this,"hasCameraControls",()=>"controls"in this)}}class f1 extends Nf{constructor(){super(...arguments),A(this,"onAfterUpdate",new ee),A(this,"onBeforeUpdate",new ee),A(this,"onDisposed",new ee),A(this,"onResize",new ee),A(this,"onClippingPlanesUpdated",new ee),A(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(e,t,i){t.isLocal=i;const n=this.clippingPlanes.indexOf(t);e&&n===-1?this.clippingPlanes.push(t):!e&&n>-1&&this.clippingPlanes.splice(n,1),this.three.clippingPlanes=this.clippingPlanes.filter(r=>!r.isLocal)}}const Uf=class sh extends Re{constructor(e){super(e),A(this,"_disposedComponents",new Set),A(this,"enabled",!0),e.add(sh.uuid,this)}get(){return this._disposedComponents}destroy(e,t=!0,i=!0){e.removeFromParent();const n=e;n.dispose&&n.dispose(),this.disposeGeometryAndMaterials(e,t),i&&n.children&&n.children.length&&this.disposeChildren(n),e.children.length=0}disposeGeometry(e){const t=e;t.boundsTree&&t.disposeBoundsTree(),e.dispose()}disposeGeometryAndMaterials(e,t){const i=e;i.geometry&&this.disposeGeometry(i.geometry),t&&i.material&&sh.disposeMaterial(i),i.material=[],i.geometry=null}disposeChildren(e){for(const t of e.children)this.destroy(t)}static disposeMaterial(e){if(e.material)if(Array.isArray(e.material))for(const t of e.material)t.dispose();else e.material.dispose()}};A(Uf,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let Fi=Uf;const La=0,m1=1,g1=new O,Rd=new Dt,Pc=new an,Pd=new O,da=new On;class v1{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new Od,this.unassigned=new Od,this.vertices=[]}setFromPoints(e){if(e.length>=4){this.makeEmpty();for(let t=0,i=e.length;tthis.tolerance)return!1;return!0}intersectRay(e,t){const i=this.faces;let n=-1/0,r=1/0;for(let o=0,a=i.length;o0&&d>=0)return null;const p=d!==0?-h/d:0;if(!(p<=0)&&(d>0?r=Math.min(p,r):n=Math.max(p,n),n>r))return null}return n!==-1/0?e.at(n,t):e.at(r,t),t}intersectsRay(e){return this.intersectRay(e,g1)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(e,t){return e.face=t,t.outside===null?this.assigned.append(e):this.assigned.insertBefore(t.outside,e),t.outside=e,this}removeVertexFromFace(e,t){return e===t.outside&&(e.next!==null&&e.next.face===t?t.outside=e.next:t.outside=null),this.assigned.remove(e),this}removeAllVerticesFromFace(e){if(e.outside!==null){const t=e.outside;let i=e.outside;for(;i.next!==null&&i.next.face===e;)i=i.next;return this.assigned.removeSubList(t,i),t.prev=i.next=null,e.outside=null,t}}deleteFaceVertices(e,t){const i=this.removeAllVerticesFromFace(e);if(i!==void 0)if(t===void 0)this.unassigned.appendChain(i);else{let n=i;do{const r=n.next;t.distanceToPoint(n.point)>this.tolerance?this.addVertexToFace(n,t):this.unassigned.append(n),n=r}while(n!==null)}return this}resolveUnassignedPoints(e){if(this.unassigned.isEmpty()===!1){let t=this.unassigned.first();do{const i=t.next;let n=this.tolerance,r=null;for(let o=0;on&&(n=l,r=a),n>1e3*this.tolerance)break}}r!==null&&this.addVertexToFace(t,r),t=i}while(t!==null)}return this}computeExtremes(){const e=new O,t=new O,i=[],n=[];for(let r=0;r<3;r++)i[r]=n[r]=this.vertices[0];e.copy(this.vertices[0].point),t.copy(this.vertices[0].point);for(let r=0,o=this.vertices.length;rt.getComponent(h)&&(t.setComponent(h,l.getComponent(h)),n[h]=a)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(e.x),Math.abs(t.x))+Math.max(Math.abs(e.y),Math.abs(t.y))+Math.max(Math.abs(e.z),Math.abs(t.z))),{min:i,max:n}}computeInitialHull(){const e=this.vertices,t=this.computeExtremes(),i=t.min,n=t.max;let r=0,o=0;for(let f=0;f<3;f++){const g=n[f].point.getComponent(f)-i[f].point.getComponent(f);g>r&&(r=g,o=f)}const a=i[o],l=n[o];let h,d;r=0,Rd.set(a.point,l.point);for(let f=0,g=this.vertices.length;fr&&(r=b,h=v)}}r=-1,Pc.setFromCoplanarPoints(a.point,l.point,h.point);for(let f=0,g=this.vertices.length;fr&&(r=b,d=v)}}const p=[];if(Pc.distanceToPoint(d.point)<0){p.push(Ci.create(a,l,h),Ci.create(d,l,a),Ci.create(d,h,l),Ci.create(d,a,h));for(let f=0;f<3;f++){const g=(f+1)%3;p[f+1].getEdge(2).setTwin(p[0].getEdge(g)),p[f+1].getEdge(1).setTwin(p[g+1].getEdge(0))}}else{p.push(Ci.create(a,h,l),Ci.create(d,a,l),Ci.create(d,l,h),Ci.create(d,h,a));for(let f=0;f<3;f++){const g=(f+1)%3;p[f+1].getEdge(2).setTwin(p[0].getEdge((3-f)%3)),p[f+1].getEdge(0).setTwin(p[g+1].getEdge(1))}}for(let f=0;f<4;f++)this.faces.push(p[f]);for(let f=0,g=e.length;fr&&(r=T,b=this.faces[w])}b!==null&&this.addVertexToFace(v,b)}}return this}reindexFaces(){const e=[];for(let t=0;tt&&(t=r,e=n),n=n.next}while(n!==null&&n.face===i);return e}}computeHorizon(e,t,i,n){this.deleteFaceVertices(i),i.mark=m1;let r;t===null?r=t=i.getEdge(0):r=t.next;do{const o=r.twin,a=o.face;a.mark===La&&(a.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,o,a,n):n.push(r)),r=r.next}while(r!==t);return this}addAdjoiningFace(e,t){const i=Ci.create(e,t.tail(),t.head());return this.faces.push(i),i.getEdge(-1).setTwin(t.twin),i.getEdge(0)}addNewFaces(e,t){this.newFaces=[];let i=null,n=null;for(let r=0;r0;)t=t.next,e--;for(;e<0;)t=t.prev,e++;return t}compute(){const e=this.edge.tail(),t=this.edge.head(),i=this.edge.next.head();return da.set(e.point,t.point,i.point),da.getNormal(this.normal),da.getMidpoint(this.midpoint),this.area=da.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}},Oc=class{constructor(e,t){this.vertex=e,this.prev=null,this.next=null,this.twin=null,this.face=t}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const e=this.head(),t=this.tail();return t!==null?t.point.distanceTo(e.point):-1}lengthSquared(){const e=this.head(),t=this.tail();return t!==null?t.point.distanceToSquared(e.point):-1}setTwin(e){return this.twin=e,e.twin=this,this}};class y1{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}}let Od=class{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(e,t){return t.prev=e.prev,t.next=e,t.prev===null?this.head=t:t.prev.next=t,e.prev=t,this}insertAfter(e,t){return t.prev=e,t.next=e.next,t.next===null?this.tail=t:t.next.prev=t,e.next=t,this}append(e){return this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this}appendChain(e){for(this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail;e.next!==null;)e=e.next;return this.tail=e,this}remove(e){return e.prev===null?this.head=e.next:e.prev.next=e.next,e.next===null?this.tail=e.prev:e.next.prev=e.prev,this}removeSubList(e,t){return e.prev===null?this.head=t.next:e.prev.next=t.next,t.next===null?this.tail=e.prev:t.next.prev=e.prev,this}isEmpty(){return this.head===null}};const rh=[2,2,1],oh=[1,0,0];function gi(s,e){return s*3+e}function E1(s){const e=s.elements;let t=0;for(let i=0;i<9;i++)t+=e[i]*e[i];return Math.sqrt(t)}function b1(s){const e=s.elements;let t=0;for(let i=0;i<3;i++){const n=e[gi(rh[i],oh[i])];t+=2*n*n}return Math.sqrt(t)}function w1(s,e){let t=0,i=1;const n=s.elements;for(let h=0;h<3;h++){const d=Math.abs(n[gi(rh[h],oh[h])]);d>t&&(t=d,i=h)}let r=1,o=0;const a=oh[i],l=rh[i];if(Math.abs(n[gi(l,a)])>Number.EPSILON){const h=n[gi(l,l)],d=n[gi(a,a)],p=n[gi(l,a)],f=(h-d)/2/p;let g;f<0?g=-1/(-f+Math.sqrt(1+f*f)):g=1/(f+Math.sqrt(1+f*f)),r=1/Math.sqrt(1+g*g),o=g*r}return e.identity(),e.elements[gi(a,a)]=r,e.elements[gi(l,l)]=r,e.elements[gi(l,a)]=o,e.elements[gi(a,l)]=-o,e}function I1(s,e){let t=0,i=0;const n=10;e.unitary.identity(),e.diagonal.copy(s);const r=e.unitary,o=e.diagonal,a=new Fn,l=new Fn,h=Number.EPSILON*E1(o);for(;ih;)w1(o,a),l.copy(a).transpose(),o.multiply(a),o.premultiply(l),r.multiply(a),++t>2&&(i++,t=0);return e}function C1(s){const e=[];for(let He=0;He0}let Fd=class{static isTransparent(e){return e.transparent&&e.opacity<1}};const ah=class ht{static create(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return`${ht._lut[e&255]+ht._lut[e>>8&255]+ht._lut[e>>16&255]+ht._lut[e>>24&255]}-${ht._lut[t&255]}${ht._lut[t>>8&255]}-${ht._lut[t>>16&15|64]}${ht._lut[t>>24&255]}-${ht._lut[i&63|128]}${ht._lut[i>>8&255]}-${ht._lut[i>>16&255]}${ht._lut[i>>24&255]}${ht._lut[n&255]}${ht._lut[n>>8&255]}${ht._lut[n>>16&255]}${ht._lut[n>>24&255]}`.toLowerCase()}static validate(e){if(!ht._pattern.test(e))throw new Error(`${e} is not a valid UUID v4. +var gv=Object.defineProperty;var vv=(s,e,t)=>e in s?gv(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var et=(s,e,t)=>(vv(s,typeof e!="symbol"?e+"":e,t),t);import{D as Pa,J as yv,p as Ev,s as bv,n as wv,u as zs,W as to,c as Iv,R as Cv,d as Yh}from"./index-C-JPXu_n.js";import{z as io,f as Ve,V as O,c as Ne,e as gt,A as ff,F as mf,P as an,r as Dt,p as Ke,M as le,T as On,E as gf,a as Ee,U as Gh,K as Oa,v as Vs,y as Gn,o as jn,Y as Ps,u as vf,C as Rt,d as Xt,Z as no,I as Kt,_ as Fn,B as ut,J as yf,$ as Ef,a0 as jh,a1 as Wh,a2 as Xh,a3 as Kh,a4 as cl,a5 as Qh,a6 as bf,a7 as hl,a8 as tn,k as za,a9 as wf,aa as If,ab as Wn,N as Va,ac as ii,ad as Tv,ae as Qo,af as zr,X as Cf,h as so,ag as Fa,n as Xn,l as Tf,m as ul,G as Os,W as Ri,q as wt,g as st,L as Di,i as dl,ah as Ha,ai as Tt,O as kn,j as Si,aj as pl,ak as Zh,al as qh,am as Jh,an as xv,ao as Av,ap as Sv,aq as _v,Q as Vt,S as Rv,ar as ad,as as Pv,at as Ov,au as Fv,av as Mv,aw as Zo,ax as Lv,ay as pr,az as Dv,aA as Nv,aB as Qc,aC as xs,aD as Uv,D as kv,s as xf,x as Bv,H as $h,t as zv,aE as fr,w as Ai,aF as Vv,aG as Hv,aH as Yv,aI as Gv,aJ as jv,aK as ld,aL as Wv,aM as Xv,aN as Kv,R as Af,aO as Qv,aP as Zv,aQ as Sf,aR as qv,aS as Jv,aT as _f,aU as Rf,aV as Pf,aW as $v}from"./web-ifc-api-BC8YMRiS.js";import{a as cd,L as ey,b as ty}from"./Line2-7GsqoD5b.js";import{M as iy}from"./mark-Dwn_ERVH.js";import"./import-wrapper-prod-LhqN7JJy.js";const al=class al{constructor(e,t){et(this,"scene");et(this,"onSelect",new Pa);et(this,"type");et(this,"selectCurve");et(this,"selectPoints");et(this,"hoverCurve");et(this,"hoverPoints");et(this,"caster",new io);this.scene=e,this.type=t,this.hoverCurve=this.newCurve(.003,4473924,!1),this.hoverPoints=this.newPoints(5,4473924),this.selectCurve=this.newCurve(.005,16777215,!0),this.selectPoints=this.newPoints(7,16777215)}dispose(){this.selectCurve&&this.scene.remove(this.selectCurve),this.selectCurve.material.dispose(),this.selectCurve.geometry.dispose(),this.selectCurve=null,this.hoverCurve.material.dispose(),this.hoverCurve.geometry.dispose(),this.hoverCurve=null,this.hoverPoints.material.dispose(),this.hoverPoints.geometry.dispose(),this.selectPoints.material.dispose(),this.selectPoints.geometry.dispose(),this.scene=null}castRay(e,t,i,n){const r=new Ve,o=i.getBoundingClientRect();r.x=(e.clientX-o.left)/o.width*2-1,r.y=-((e.clientY-o.top)/o.height)*2+1,this.caster.setFromCamera(r,t);const a=this.caster.intersectObjects(n);return a.length?a[0]:null}select(e){this.highlight(e,this.selectCurve,this.selectPoints,!0),this.onSelect.trigger(e)}unSelect(){this.selectCurve.removeFromParent(),this.selectPoints.removeFromParent()}hover(e){this.highlight(e,this.hoverCurve,this.hoverPoints,!1)}unHover(){this.hoverCurve.removeFromParent(),this.hoverPoints.removeFromParent()}setResolution({x:e,y:t}){this.selectCurve.material.resolution.set(e/t,1),this.hoverCurve.material.resolution.set(e/t,1)}highlight(e,t,i,n){const{alignment:r}=e.curve;this.scene.add(t),this.scene.add(i);const o=[],a=[],l=[];for(const f of r[this.type]){const g=f.mesh.geometry.attributes.position;for(const T of g.array)o.push(T);if(n){let T;if(this.type==="absolute"){const{horizontal:_}=f.alignment;T=_[f.index].data.TYPE}else T=f.data.TYPE;const S=al.settings.colors[T]||[1,1,1];for(let _=0;_t.geometry.attributes.position.count&&(t.geometry.dispose(),t.geometry=new cd),t.geometry.setPositions(o),n&&t.geometry.setColors(a),i.geometry.setFromPoints(l)}newCurve(e,t,i){const n=new cd,r=new ey({color:t,linewidth:e,vertexColors:i,worldUnits:!1,depthTest:!1}),o=new ty(n,r);return this.scene.add(o),o}newPoints(e,t){const i=new Ne,n=new gt(new Float32Array,3);i.setAttribute("position",n);const r=new ff({size:e,color:t,sizeAttenuation:!1,depthTest:!1}),o=new mf(i,r);return o.frustumCulled=!1,this.scene.add(o),o}};et(al,"settings",{colors:{LINE:[213/255,0/255,255/255],CIRCULARARC:[0/255,46,255/255],CLOTHOID:[0/255,255/255,0/255],PARABOLICARC:[0/255,255/255,72/255],CONSTANTGRADIENT:[213/255,0/255,255/255]}});let Zc=al;const ll=class ll extends yv{constructor(t){super(t);et(this,"onHighlight",new Pa);et(this,"enabled",!0);et(this,"_highlighter");et(this,"mouseMarkers");et(this,"onMarkerChange",new Pa);et(this,"onMarkerHidden",new Pa);et(this,"_curves",[]);et(this,"_world",null);et(this,"updateLinesResolution",t=>{var i;(i=this.highlighter)==null||i.setResolution(t)});et(this,"onClick",t=>{if(!this.enabled||!this._highlighter)return;if(!this.world)throw new Error("No world found!");if(!this.world.renderer)return;const i=this.world.renderer.three.domElement,n=this.world.camera.three,r=this._highlighter.castRay(t,n,i,this._curves);if(r){const o=r.object;this._highlighter.select(o),this.updateMarker(r,"select");const{point:a,index:l}=r;l!==void 0&&this.onHighlight.trigger({curve:o,point:a,index:l});return}this._highlighter.unSelect(),this.mouseMarkers&&(this.mouseMarkers.hover.visible=!1),this.onMarkerHidden.trigger({type:"hover"})});et(this,"onMouseMove",async t=>{if(!this.enabled||!this._highlighter)return;if(!this.world)throw new Error("No world found!");if(!this.world.renderer)return;const i=this.world.renderer.three.domElement,n=this.world.camera.three,r=this._highlighter.castRay(t,n,i,this._curves);if(r){this._highlighter.hover(r.object),this.updateMarker(r,"hover");return}this._highlighter.unHover()});this.components.add(ll.uuid,this)}get world(){return this._world}set world(t){var n,r,o;if(t===this._world||(this._world&&this.setupEvents(!1),this._world=t,(n=this._highlighter)==null||n.dispose(),(r=this.mouseMarkers)==null||r.hover.dispose(),(o=this.mouseMarkers)==null||o.select.dispose(),!t))return;const i=t.scene.three;this._highlighter=new Zc(i,"absolute"),this.mouseMarkers={select:this.newMouseMarker("#ffffff",t),hover:this.newMouseMarker("#575757",t)},this.setupEvents(!0)}get highlighter(){if(!this._highlighter)throw new Error("Navigator not initialized!");return this._highlighter}draw(t){if(!t.civilData)throw new Error("Model must have civil data!");if(!this.world)throw new Error("A world must be given before drawing an alignment!");const i=this.world.scene.three;for(const[n,r]of t.civilData.alignments)for(const{mesh:o}of r.absolute)i.add(o),this._curves.push(o)}newMouseMarker(t,i){const n=i.scene.three,r=document.createElement("div");r.style.backgroundColor=t,r.style.width="1rem",r.style.height="1rem",r.style.borderRadius="1rem";const o=new iy(i,r,n);return o.visible=!1,o}setMarker(t,i,n){if(!this.mouseMarkers)throw new Error("No mouse markers found! Initialize the world before using this.");const r=t.getPointAt(i,"absolute");this.mouseMarkers[n].visible=!0,this.mouseMarkers[n].three.position.copy(r)}hideMarker(t){if(!this.mouseMarkers)throw new Error("No mouse markers found! Initialize the world before using this.");const i=this.mouseMarkers[t].three;i.visible=!1}setupEvents(t){var n,r;if(!this.world)throw new Error("No world found!");if(this.world.isDisposing||!this.world.renderer)return;const i=this.world.renderer.three.domElement;(n=this.world.renderer)==null||n.onResize.remove(this.updateLinesResolution),i.removeEventListener("click",this.onClick),i.removeEventListener("mousemove",this.onMouseMove),t&&(i.addEventListener("click",this.onClick),i.addEventListener("mousemove",this.onMouseMove),(r=this.world.renderer)==null||r.onResize.add(this.updateLinesResolution))}updateMarker(t,i){if(!this.mouseMarkers)return;const{point:n,object:r}=t,o=r,a=o.curve,l=o.curve.alignment,h=l.getPercentageAt(n,"absolute");this.mouseMarkers[i].visible=!0,this.mouseMarkers[i].three.position.copy(n),h!==null&&this.onMarkerChange.trigger({alignment:l,percentage:h,type:i,curve:a})}};et(ll,"uuid","0a59c09e-2b49-474a-9320-99f51f40f182");let hd=ll;var ny=Object.defineProperty,sy=(s,e,t)=>e in s?ny(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,x=(s,e,t)=>(sy(s,typeof e!="symbol"?e+"":e,t),t),ry=Object.defineProperty,oy=(s,e,t)=>e in s?ry(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,A=(s,e,t)=>(oy(s,typeof e!="symbol"?e+"":e,t),t);const Of=0,ay=1,ly=2,ud=2,Ec=1.25,dd=1,Ma=6*4+4+4,fl=65535,cy=Math.pow(2,-24),bc=Symbol("SKIP_GENERATION");function hy(s){return s.index?s.index.count:s.attributes.position.count}function Hs(s){return hy(s)/3}function uy(s,e=ArrayBuffer){return s>65535?new Uint32Array(new e(4*s)):new Uint16Array(new e(2*s))}function dy(s,e){if(!s.index){const t=s.attributes.position.count,i=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,n=uy(t,i);s.setIndex(new gt(n,1));for(let r=0;ra-l);for(let a=0;ar.offset-o.offset),i=t[t.length-1];i.count=Math.min(e-i.offset,i.count);let n=0;return t.forEach(({count:r})=>n+=r),e!==n}function Je(s,e,t){return t.min.x=e[s],t.min.y=e[s+1],t.min.z=e[s+2],t.max.x=e[s+3],t.max.y=e[s+4],t.max.z=e[s+5],t}function fy(s){s[0]=s[1]=s[2]=1/0,s[3]=s[4]=s[5]=-1/0}function pd(s){let e=-1,t=-1/0;for(let i=0;i<3;i++){const n=s[i+3]-s[i];n>t&&(t=n,e=i)}return e}function fd(s,e){e.set(s)}function md(s,e,t){let i,n;for(let r=0;r<3;r++){const o=r+3;i=s[r],n=e[r],t[r]=in?i:n}}function qo(s,e,t){for(let i=0;i<3;i++){const n=e[s+2*i],r=e[s+2*i+1],o=n-r,a=n+r;ot[i+3]&&(t[i+3]=a)}}function mr(s){const e=s[3]-s[0],t=s[4]-s[1],i=s[5]-s[2];return 2*(e*t+t*i+i*e)}function wc(s,e,t,i,n=null){let r=1/0,o=1/0,a=1/0,l=-1/0,h=-1/0,d=-1/0,p=1/0,f=1/0,g=1/0,v=-1/0,b=-1/0,w=-1/0;const T=n!==null;for(let S=e*6,_=(e+t)*6;S<_;S+=6){const I=s[S+0],P=s[S+1],M=I-P,k=I+P;Ml&&(l=k),T&&Iv&&(v=I);const V=s[S+2],W=s[S+3],j=V-W,Q=V+W;jh&&(h=Q),T&&Vb&&(b=V);const ee=s[S+4],ne=s[S+5],oe=ee-ne,ve=ee+ne;oed&&(d=ve),T&&eew&&(w=ee)}i[0]=r,i[1]=o,i[2]=a,i[3]=l,i[4]=h,i[5]=d,T&&(n[0]=p,n[1]=f,n[2]=g,n[3]=v,n[4]=b,n[5]=w)}function my(s,e,t,i){let n=1/0,r=1/0,o=1/0,a=-1/0,l=-1/0,h=-1/0;for(let d=e*6,p=(e+t)*6;da&&(a=f);const g=s[d+2];gl&&(l=g);const v=s[d+4];vh&&(h=v)}i[0]=n,i[1]=r,i[2]=o,i[3]=a,i[4]=l,i[5]=h}function gy(s,e){fy(e);const t=s.attributes.position,i=s.index?s.index.array:null,n=Hs(s),r=new Float32Array(n*6),o=t.normalized,a=t.array,l=t.offset||0;let h=3;t.isInterleavedBufferAttribute&&(h=t.data.stride);const d=["getX","getY","getZ"];for(let p=0;pM&&(M=_),I>M&&(M=I);const k=(M-P)/2,V=T*2;r[g+V+0]=P+k,r[g+V+1]=k+(Math.abs(P)+k)*cy,Pe[T+3]&&(e[T+3]=M)}}return r}const Ti=32,vy=(s,e)=>s.candidate-e.candidate,Xi=new Array(Ti).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),Jo=new Float32Array(6);function yy(s,e,t,i,n,r){let o=-1,a=0;if(r===Of)o=pd(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(r===ay)o=pd(s),o!==-1&&(a=Ey(t,i,n,o));else if(r===ly){const l=mr(s);let h=Ec*n;const d=i*6,p=(i+n)*6;for(let f=0;f<3;f++){const g=e[f],v=(e[f+3]-g)/Ti;if(n=P.candidate?qo(S,t,P.rightCacheBounds):(qo(S,t,P.leftCacheBounds),P.count++)}}for(let S=0;S=Ti&&(S=Ti-1);const _=Xi[S];_.count++,qo(T,t,_.bounds)}const b=Xi[Ti-1];fd(b.bounds,b.rightCacheBounds);for(let T=Ti-2;T>=0;T--){const S=Xi[T],_=Xi[T+1];md(S.bounds,_.rightCacheBounds,S.rightCacheBounds)}let w=0;for(let T=0;T=l;)a--;if(o=l;)a--;if(o2**16,n=i?4:2,r=e?new SharedArrayBuffer(t*n):new ArrayBuffer(t*n),o=i?new Uint32Array(r):new Uint16Array(r);for(let a=0,l=o.length;a=n&&(p=!0,r&&(console.warn(`MeshBVH: Max depth of ${n} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),M<=o||V>=n)return S(P+M),I.offset=P,I.count=M,I;const W=yy(I.boundingData,k,v,P,M,a);if(W.axis===-1)return S(P+M),I.offset=P,I.count=M,I;const j=b(d,i,v,P,M,W);if(j===P||j===P+M)S(P+M),I.offset=P,I.count=M;else{I.splitAxis=W.axis;const Q=new $o,ee=P,ne=j-P;I.left=Q,Q.boundingData=new Float32Array(6),wc(v,ee,ne,Q.boundingData,g),_(Q,ee,ne,g,V+1);const oe=new $o,ve=j,re=M-ne;I.right=oe,oe.boundingData=new Float32Array(6),wc(v,ve,re,oe.boundingData,g),_(oe,ve,re,g,V+1)}return I}}function Ty(s,e){const t=s.geometry;e.indirect&&(s._indirectBuffer=Iy(t,e.useSharedArrayBuffer),py(t)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),s._indirectBuffer||dy(t,e);const i=Cy(s,e);let n,r,o;const a=[],l=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let p=0;pMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return r[g+6]=I/4,I=d(I,S),r[g+7]=_,I}}}let Oi=class{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let i=1/0,n=-1/0;for(let r=0,o=e.length;rn?a:n}this.min=i,this.max=n}setFromPoints(e,t){let i=1/0,n=-1/0;for(let r=0,o=t.length;rn?l:n}this.min=i,this.max=n}isSeparated(e){return this.min>e.max||e.min>this.max}};Oi.prototype.setFromBox=function(){const s=new O;return function(e,t){const i=t.min,n=t.max;let r=1/0,o=-1/0;for(let a=0;a<=1;a++)for(let l=0;l<=1;l++)for(let h=0;h<=1;h++){s.x=i.x*a+n.x*(1-a),s.y=i.y*l+n.y*(1-l),s.z=i.z*h+n.z*(1-h);const d=e.dot(s);r=Math.min(d,r),o=Math.max(d,o)}this.min=r,this.max=o}}();const xy=function(){const s=new O,e=new O,t=new O;return function(i,n,r){const o=i.start,a=s,l=n.start,h=e;t.subVectors(o,l),s.subVectors(i.end,i.start),e.subVectors(n.end,n.start);const d=t.dot(h),p=h.dot(a),f=h.dot(h),g=t.dot(a),v=a.dot(a)*f-p*p;let b,w;v!==0?b=(d*p-g*f)/v:b=0,w=(d+b*p)/f,r.x=b,r.y=w}}(),eu=function(){const s=new Ve,e=new O,t=new O;return function(i,n,r,o){xy(i,n,s);let a=s.x,l=s.y;if(a>=0&&a<=1&&l>=0&&l<=1){i.at(a,r),n.at(l,o);return}else if(a>=0&&a<=1){l<0?n.at(0,o):n.at(1,o),i.closestPointToPoint(o,!0,r);return}else if(l>=0&&l<=1){a<0?i.at(0,r):i.at(1,r),n.closestPointToPoint(r,!0,o);return}else{let h;a<0?h=i.start:h=i.end;let d;l<0?d=n.start:d=n.end;const p=e,f=t;if(i.closestPointToPoint(d,!0,e),n.closestPointToPoint(h,!0,t),p.distanceToSquared(d)<=f.distanceToSquared(h)){r.copy(p),o.copy(d);return}else{r.copy(h),o.copy(f);return}}}}(),Ay=function(){const s=new O,e=new O,t=new an,i=new Dt;return function(n,r){const{radius:o,center:a}=n,{a:l,b:h,c:d}=r;if(i.start=l,i.end=h,i.closestPointToPoint(a,!0,s).distanceTo(a)<=o||(i.start=l,i.end=d,i.closestPointToPoint(a,!0,s).distanceTo(a)<=o)||(i.start=h,i.end=d,i.closestPointToPoint(a,!0,s).distanceTo(a)<=o))return!0;const p=r.getPlane(t);if(Math.abs(p.distanceToPoint(a))<=o){const f=p.projectPoint(a,e);if(r.containsPoint(f))return!0}return!1}}(),Sy=1e-15;function Ic(s){return Math.abs(s)new O),this.satBounds=new Array(4).fill().map(()=>new Oi),this.points=[this.a,this.b,this.c],this.sphere=new Gn,this.plane=new an,this.needsUpdate=!0}intersectsSphere(e){return Ay(e,this)}update(){const e=this.a,t=this.b,i=this.c,n=this.points,r=this.satAxes,o=this.satBounds,a=r[0],l=o[0];this.getNormal(a),l.setFromPoints(a,n);const h=r[1],d=o[1];h.subVectors(e,t),d.setFromPoints(h,n);const p=r[2],f=o[2];p.subVectors(t,i),f.setFromPoints(p,n);const g=r[3],v=o[3];g.subVectors(i,e),v.setFromPoints(g,n),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}};si.prototype.closestPointToSegment=function(){const s=new O,e=new O,t=new Dt;return function(i,n=null,r=null){const{start:o,end:a}=i,l=this.points;let h,d=1/0;for(let p=0;p<3;p++){const f=(p+1)%3;t.start.copy(l[p]),t.end.copy(l[f]),eu(t,i,s,e),h=s.distanceToSquared(e),h=2){(I===1?T.start:T.end).copy(g),_=2;break}if(_++,_===2&&I===-1)break}}return _}return function(b,w=null,T=!1){this.needsUpdate&&this.update(),b.isExtendedTriangle?b.needsUpdate&&b.update():(s.copy(b),s.update(),b=s);const S=this.plane,_=b.plane;if(Math.abs(S.normal.dot(_.normal))>1-1e-10){const I=this.satBounds,P=this.satAxes;t[0]=b.a,t[1]=b.b,t[2]=b.c;for(let V=0;V<4;V++){const W=I[V],j=P[V];if(i.setFromPoints(j,t),W.isSeparated(i))return!1}const M=b.satBounds,k=b.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let V=0;V<4;V++){const W=M[V],j=k[V];if(i.setFromPoints(j,e),W.isSeparated(i))return!1}for(let V=0;V<4;V++){const W=P[V];for(let j=0;j<4;j++){const Q=k[j];if(r.crossVectors(W,Q),i.setFromPoints(r,e),n.setFromPoints(r,t),i.isSeparated(n))return!1}}return w&&(T||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),w.start.set(0,0,0),w.end.set(0,0,0)),!0}else{const I=v(this,_,p);if(I===1&&b.containsPoint(p.end))return w&&(w.start.copy(p.end),w.end.copy(p.end)),!0;if(I!==2)return!1;const P=v(b,S,f);if(P===1&&this.containsPoint(f.end))return w&&(w.start.copy(f.end),w.end.copy(f.end)),!0;if(P!==2)return!1;if(p.delta(a),f.delta(l),a.dot(l)<0){let ee=f.start;f.start=f.end,f.end=ee}const M=p.start.dot(a),k=p.end.dot(a),V=f.start.dot(a),W=f.end.dot(a),j=k0?w.start.copy(p.start):w.start.copy(f.start),h.subVectors(p.end,f.end),h.dot(a)<0?w.end.copy(p.end):w.end.copy(f.end)),!0)}}}();si.prototype.distanceToPoint=function(){const s=new O;return function(e){return this.closestPointToPoint(e,s),e.distanceTo(s)}}();si.prototype.distanceToTriangle=function(){const s=new O,e=new O,t=["a","b","c"],i=new Dt,n=new Dt;return function(r,o=null,a=null){const l=o||a?i:null;if(this.intersectsTriangle(r,l))return(o||a)&&(o&&l.getCenter(o),a&&l.getCenter(a)),0;let h=1/0;for(let d=0;d<3;d++){let p;const f=t[d],g=r[f];this.closestPointToPoint(g,s),p=g.distanceToSquared(s),pnew O),this.satAxes=new Array(3).fill().map(()=>new O),this.satBounds=new Array(3).fill().map(()=>new Oi),this.alignedSatBounds=new Array(3).fill().map(()=>new Oi),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),i&&this.matrix.copy(i)}set(e,t,i){this.min.copy(e),this.max.copy(t),this.matrix.copy(i),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}};xt.prototype.update=function(){return function(){const s=this.matrix,e=this.min,t=this.max,i=this.points;for(let l=0;l<=1;l++)for(let h=0;h<=1;h++)for(let d=0;d<=1;d++){const p=1*l|2*h|4*d,f=i[p];f.x=l?t.x:e.x,f.y=h?t.y:e.y,f.z=d?t.z:e.z,f.applyMatrix4(s)}const n=this.satBounds,r=this.satAxes,o=i[0];for(let l=0;l<3;l++){const h=r[l],d=n[l],p=1<new Dt),t=new Array(12).fill().map(()=>new Dt),i=new O,n=new O;return function(r,o=0,a=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(r))return(a||l)&&(r.getCenter(n),this.closestPointToPoint(n,i),r.closestPointToPoint(i,n),a&&a.copy(i),l&&l.copy(n)),0;const h=o*o,d=r.min,p=r.max,f=this.points;let g=1/0;for(let b=0;b<8;b++){const w=f[b];n.copy(w).clamp(d,p);const T=w.distanceToSquared(n);if(Tnew si)}}const Yt=new _y;function Ft(s,e){return e[s+15]===65535}function Lt(s,e){return e[s+6]}function Gt(s,e){return e[s+14]}function jt(s){return s+8}function Wt(s,e){return e[s+6]}function Lf(s,e){return e[s+7]}class Ry{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=i=>{t&&e.push(t),t=i,this.float32Array=new Float32Array(i),this.uint16Array=new Uint16Array(i),this.uint32Array=new Uint32Array(i)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const Qe=new Ry;let Ji,As;const os=[],ea=new tu(()=>new Ke);function Py(s,e,t,i,n,r){Ji=ea.getPrimitive(),As=ea.getPrimitive(),os.push(Ji,As),Qe.setBuffer(s._roots[e]);const o=qc(0,s.geometry,t,i,n,r);Qe.clearBuffer(),ea.releasePrimitive(Ji),ea.releasePrimitive(As),os.pop(),os.pop();const a=os.length;return a>0&&(As=os[a-1],Ji=os[a-2]),o}function qc(s,e,t,i,n=null,r=0,o=0){const{float32Array:a,uint16Array:l,uint32Array:h}=Qe;let d=s*2;if(Ft(d,l)){const p=Lt(s,h),f=Gt(d,l);return Je(s,a,Ji),i(p,f,!1,o,r+s,Ji)}else{let p=function(Q){const{uint16Array:ee,uint32Array:ne}=Qe;let oe=Q*2;for(;!Ft(oe,ee);)Q=jt(Q),oe=Q*2;return Lt(Q,ne)},f=function(Q){const{uint16Array:ee,uint32Array:ne}=Qe;let oe=Q*2;for(;!Ft(oe,ee);)Q=Wt(Q,ne),oe=Q*2;return Lt(Q,ne)+Gt(oe,ee)};const g=jt(s),v=Wt(s,h);let b=g,w=v,T,S,_,I;if(n&&(_=Ji,I=As,Je(b,a,_),Je(w,a,I),T=n(_),S=n(I),S(gr.copy(e).clamp(d.min,d.max),gr.distanceToSquared(e)),intersectsBounds:(d,p,f)=>f{d.closestPointToPoint(e,gr);const f=e.distanceToSquared(gr);return f0&&h.normal.multiplyScalar(-1));const d={a:r,b:o,c:a,normal:new O,materialIndex:0};On.getNormal(as,ls,cs,d.normal),h.face=d,h.faceIndex=r}return h}function ml(s,e,t,i,n){const r=i*3;let o=r+0,a=r+1,l=r+2;const h=s.index;s.index&&(o=h.getX(o),a=h.getX(a),l=h.getX(l));const{position:d,normal:p,uv:f,uv1:g}=s.attributes,v=My(t,d,p,f,g,o,a,l,e);return v?(v.faceIndex=i,n&&n.push(v),v):null}function ot(s,e,t,i){const n=s.a,r=s.b,o=s.c;let a=e,l=e+1,h=e+2;t&&(a=t.getX(a),l=t.getX(l),h=t.getX(h)),n.x=i.getX(a),n.y=i.getY(a),n.z=i.getZ(a),r.x=i.getX(l),r.y=i.getY(l),r.z=i.getZ(l),o.x=i.getX(h),o.y=i.getY(h),o.z=i.getZ(h)}function Ly(s,e,t,i,n,r){const{geometry:o,_indirectBuffer:a}=s;for(let l=i,h=i+n;lP&&(P=Q),ee<_&&(_=ee),ee>M&&(M=ee),nek&&(k=ne)}return l[f+0]!==S||l[f+1]!==_||l[f+2]!==I||l[f+3]!==P||l[f+4]!==M||l[f+5]!==k?(l[f+0]=S,l[f+1]=_,l[f+2]=I,l[f+3]=P,l[f+4]=M,l[f+5]=k,!0):!1}else{const w=f+8,T=o[f+6],S=w+g,_=T+g;let I=v,P=!1,M=!1;e?I||(P=e.has(S),M=e.has(_),I=!P&&!M):(P=!0,M=!0);const k=I||P,V=I||M;let W=!1;k&&(W=p(w,g,I));let j=!1;V&&(j=p(T,g,I));const Q=W||j;if(Q)for(let ee=0;ee<3;ee++){const ne=w+ee,oe=T+ee,ve=l[ne],re=l[ne+3],ge=l[oe],me=l[oe+3];l[f+ee]=veme?re:me}return Q}}}const Ed=new Ke;function nn(s,e,t,i){return Je(s,e,Ed),t.intersectBox(Ed,i)}function ky(s,e,t,i,n,r){const{geometry:o,_indirectBuffer:a}=s;for(let l=i,h=i+n;l=0;let p,f;d?(p=jt(s),f=Wt(s,o)):(p=Wt(s,o),f=jt(s));const g=nn(p,n,i,wd)?$c(p,e,t,i):null;if(g){const b=g.point[h];if(d?b<=n[f+l]:b>=n[f+l+3])return g}const v=nn(f,n,i,wd)?$c(f,e,t,i):null;return g&&v?g.distance<=v.distance?g:v:g||v||null}}const ra=new Ke,hs=new si,us=new si,vr=new Ee,Id=new xt,oa=new xt;function Gy(s,e,t,i){Qe.setBuffer(s._roots[e]);const n=eh(0,s,t,i);return Qe.clearBuffer(),n}function eh(s,e,t,i,n=null){const{float32Array:r,uint16Array:o,uint32Array:a}=Qe;let l=s*2;if(n===null&&(t.boundingBox||t.computeBoundingBox(),Id.set(t.boundingBox.min,t.boundingBox.max,i),n=Id),Ft(l,o)){const h=e.geometry,d=h.index,p=h.attributes.position,f=t.index,g=t.attributes.position,v=Lt(s,a),b=Gt(l,o);if(vr.copy(i).invert(),t.boundsTree)return Je(s,r,oa),oa.matrix.copy(vr),oa.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:w=>oa.intersectsBox(w),intersectsTriangle:w=>{w.a.applyMatrix4(i),w.b.applyMatrix4(i),w.c.applyMatrix4(i),w.needsUpdate=!0;for(let T=v*3,S=(b+v)*3;TTc.distanceToBox(P),intersectsBounds:(P,M,k)=>k{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:k=>yr.distanceToBox(k),intersectsBounds:(k,V,W)=>W{for(let W=k,j=k+V;WP&&(P=ne),oe<_&&(_=oe),oe>M&&(M=oe),vek&&(k=ve)}}return l[f+0]!==S||l[f+1]!==_||l[f+2]!==I||l[f+3]!==P||l[f+4]!==M||l[f+5]!==k?(l[f+0]=S,l[f+1]=_,l[f+2]=I,l[f+3]=P,l[f+4]=M,l[f+5]=k,!0):!1}else{const w=f+8,T=o[f+6],S=w+g,_=T+g;let I=v,P=!1,M=!1;e?I||(P=e.has(S),M=e.has(_),I=!P&&!M):(P=!0,M=!0);const k=I||P,V=I||M;let W=!1;k&&(W=p(w,g,I));let j=!1;V&&(j=p(T,g,I));const Q=W||j;if(Q)for(let ee=0;ee<3;ee++){const ne=w+ee,oe=T+ee,ve=l[ne],re=l[ne+3],ge=l[oe],me=l[oe+3];l[f+ee]=veme?re:me}return Q}}}const Cd=new O;function qy(s,e,t,i,n){Qe.setBuffer(s._roots[e]),th(0,s,t,i,n),Qe.clearBuffer()}function th(s,e,t,i,n){const{float32Array:r,uint16Array:o,uint32Array:a}=Qe,l=s*2;if(Ft(l,o)){const h=Lt(s,a),d=Gt(l,o);ky(e,t,i,h,d,n)}else{const h=jt(s);nn(h,r,i,Cd)&&th(h,e,t,i,n);const d=Wt(s,a);nn(d,r,i,Cd)&&th(d,e,t,i,n)}}const Td=new O,Jy=["x","y","z"];function $y(s,e,t,i){Qe.setBuffer(s._roots[e]);const n=ih(0,s,t,i);return Qe.clearBuffer(),n}function ih(s,e,t,i){const{float32Array:n,uint16Array:r,uint32Array:o}=Qe;let a=s*2;if(Ft(a,r)){const l=Lt(s,o),h=Gt(a,r);return By(e,t,i,l,h)}else{const l=Lf(s,o),h=Jy[l],d=i.direction[h]>=0;let p,f;d?(p=jt(s),f=Wt(s,o)):(p=Wt(s,o),f=jt(s));const g=nn(p,n,i,Td)?ih(p,e,t,i):null;if(g){const b=g.point[h];if(d?b<=n[f+l]:b>=n[f+l+3])return g}const v=nn(f,n,i,Td)?ih(f,e,t,i):null;return g&&v?g.distance<=v.distance?g:v:g||v||null}}const la=new Ke,ds=new si,ps=new si,Er=new Ee,xd=new xt,ca=new xt;function e1(s,e,t,i){Qe.setBuffer(s._roots[e]);const n=nh(0,s,t,i);return Qe.clearBuffer(),n}function nh(s,e,t,i,n=null){const{float32Array:r,uint16Array:o,uint32Array:a}=Qe;let l=s*2;if(n===null&&(t.boundingBox||t.computeBoundingBox(),xd.set(t.boundingBox.min,t.boundingBox.max,i),n=xd),Ft(l,o)){const h=e.geometry,d=h.index,p=h.attributes.position,f=t.index,g=t.attributes.position,v=Lt(s,a),b=Gt(l,o);if(Er.copy(i).invert(),t.boundsTree)return Je(s,r,ca),ca.matrix.copy(Er),ca.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:w=>ca.intersectsBox(w),intersectsTriangle:w=>{w.a.applyMatrix4(i),w.b.applyMatrix4(i),w.c.applyMatrix4(i),w.needsUpdate=!0;for(let T=v,S=b+v;Txc.distanceToBox(P),intersectsBounds:(P,M,k)=>k{if(e.boundsTree){const k=e.boundsTree;return k.shapecast({boundsTraverseOrder:V=>br.distanceToBox(V),intersectsBounds:(V,W,j)=>j{for(let j=V,Q=V+W;jnew Ke),fs=new Ke,ms=new Ke,Ac=new Ke,Sc=new Ke;let _c=!1;function a1(s,e,t,i){if(_c)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");_c=!0;const n=s._roots,r=e._roots;let o,a=0,l=0;const h=new Ee().copy(t).invert();for(let d=0,p=n.length;dl.slice()),index:o.array.slice(),indirectBuffer:r?r.slice():null}:a={roots:n,index:o.array,indirectBuffer:r},a}static deserialize(e,t,i={}){i={setIndex:!0,indirect:!!e.indirectBuffer,...i};const{index:n,roots:r,indirectBuffer:o}=e,a=new Df(t,{...i,[bc]:!0});if(a._roots=r,a._indirectBuffer=o||null,i.setIndex){const l=t.getIndex();if(l===null){const h=new gt(e.index,1,!1);t.setIndex(h)}else l.array!==n&&(l.array.set(n),l.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:Of,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[bc]:!1},t),t.useSharedArrayBuffer&&!o1())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[bc]||(Ty(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new Ke)));const{_indirectBuffer:i}=this;this.resolveTriangleIndex=t.indirect?n=>i[n]:n=>n}refit(e=null){return(this.indirect?Zy:Uy)(this,e)}traverse(e,t=0){const i=this._roots[t],n=new Uint32Array(i),r=new Uint16Array(i);o(0);function o(a,l=0){const h=a*2,d=r[h+15]===fl;if(d){const p=n[a+6],f=r[h+14];e(l,d,new Float32Array(i,a*4,6),p,f)}else{const p=a+Ma/4,f=n[a+6],g=n[a+7];e(l,d,new Float32Array(i,a*4,6),g)||(o(p,l+1),o(f,l+1))}}}raycast(e,t=ad){const i=this._roots,n=this.geometry,r=[],o=t.isMaterial,a=Array.isArray(t),l=n.groups,h=o?t.side:t,d=this.indirect?qy:Vy;for(let p=0,f=i.length;pp(f,g,v,b,w)?!0:i(f,g,this,a,v,b,t)}else o||(a?o=(p,f,g,v)=>i(p,f,this,a,g,v,t):o=(p,f,g)=>g);let l=!1,h=0;const d=this._roots;for(let p=0,f=d.length;p{const b=this.resolveTriangleIndex(v);ot(o,b*3,a,l)}:v=>{ot(o,v*3,a,l)},d=Yt.getPrimitive(),p=e.geometry.index,f=e.geometry.attributes.position,g=e.indirect?v=>{const b=e.resolveTriangleIndex(v);ot(d,b*3,p,f)}:v=>{ot(d,v*3,p,f)};if(r){const v=(b,w,T,S,_,I,P,M)=>{for(let k=T,V=T+S;kua.intersectsBox(i),intersectsTriangle:i=>ua.intersectsTriangle(i)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,i={},n={},r=0,o=1/0){return(this.indirect?r1:Qy)(this,e,t,i,n,r,o)}closestPointToPoint(e,t={},i=0,n=1/0){return Oy(this,e,t,i,n)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(t=>{Je(0,new Float32Array(t),Ad),e.union(Ad)}),e}};function Sd(s,e,t){return s===null||(s.point.applyMatrix4(e.matrixWorld),s.distance=s.point.distanceTo(t.ray.origin),s.object=e,s.distancet.far)?null:s}const Rc=new Pv,_d=new Ee,c1=le.prototype.raycast;function h1(s,e){if(this.geometry.boundsTree){if(this.material===void 0)return;_d.copy(this.matrixWorld).invert(),Rc.copy(s.ray).applyMatrix4(_d);const t=this.geometry.boundsTree;if(s.firstHitOnly===!0){const i=Sd(t.raycastFirst(Rc,this.material),this,s);i&&e.push(i)}else{const i=t.raycast(Rc,this.material);for(let n=0,r=i.length;n{const t=this.handlers.slice(0);for(const i of t)i(e)}),A(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}}let $i=class{constructor(){A(this,"trigger",async e=>{const t=this.handlers.slice(0);for(const i of t)await i(e)}),A(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}},iu=class{constructor(e){A(this,"isDisposeable",()=>"dispose"in this&&"onDisposed"in this),A(this,"isResizeable",()=>"resize"in this&&"getSize"in this),A(this,"isUpdateable",()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this),A(this,"isHideable",()=>"visible"in this),A(this,"isConfigurable",()=>"setup"in this&&"config"in this&&"onSetup"in this),this.components=e}},Re=class extends iu{},Nf=class extends iu{constructor(e){super(e),A(this,"worlds",new Map),A(this,"onWorldChanged",new $),A(this,"currentWorld",null),this.onWorldChanged.add(({world:t,action:i})=>{i==="removed"&&this.worlds.delete(t.uuid)})}};class p1 extends Nf{constructor(){super(...arguments),A(this,"hasCameraControls",()=>"controls"in this)}}class f1 extends Nf{constructor(){super(...arguments),A(this,"onAfterUpdate",new $),A(this,"onBeforeUpdate",new $),A(this,"onDisposed",new $),A(this,"onResize",new $),A(this,"onClippingPlanesUpdated",new $),A(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(e,t,i){t.isLocal=i;const n=this.clippingPlanes.indexOf(t);e&&n===-1?this.clippingPlanes.push(t):!e&&n>-1&&this.clippingPlanes.splice(n,1),this.three.clippingPlanes=this.clippingPlanes.filter(r=>!r.isLocal)}}const Uf=class sh extends Re{constructor(e){super(e),A(this,"_disposedComponents",new Set),A(this,"enabled",!0),e.add(sh.uuid,this)}get(){return this._disposedComponents}destroy(e,t=!0,i=!0){e.removeFromParent();const n=e;n.dispose&&n.dispose(),this.disposeGeometryAndMaterials(e,t),i&&n.children&&n.children.length&&this.disposeChildren(n),e.children.length=0}disposeGeometry(e){const t=e;t.boundsTree&&t.disposeBoundsTree(),e.dispose()}disposeGeometryAndMaterials(e,t){const i=e;i.geometry&&this.disposeGeometry(i.geometry),t&&i.material&&sh.disposeMaterial(i),i.material=[],i.geometry=null}disposeChildren(e){for(const t of e.children)this.destroy(t)}static disposeMaterial(e){if(e.material)if(Array.isArray(e.material))for(const t of e.material)t.dispose();else e.material.dispose()}};A(Uf,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let Fi=Uf;const La=0,m1=1,g1=new O,Rd=new Dt,Pc=new an,Pd=new O,da=new On;class v1{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new Od,this.unassigned=new Od,this.vertices=[]}setFromPoints(e){if(e.length>=4){this.makeEmpty();for(let t=0,i=e.length;tthis.tolerance)return!1;return!0}intersectRay(e,t){const i=this.faces;let n=-1/0,r=1/0;for(let o=0,a=i.length;o0&&d>=0)return null;const p=d!==0?-h/d:0;if(!(p<=0)&&(d>0?r=Math.min(p,r):n=Math.max(p,n),n>r))return null}return n!==-1/0?e.at(n,t):e.at(r,t),t}intersectsRay(e){return this.intersectRay(e,g1)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(e,t){return e.face=t,t.outside===null?this.assigned.append(e):this.assigned.insertBefore(t.outside,e),t.outside=e,this}removeVertexFromFace(e,t){return e===t.outside&&(e.next!==null&&e.next.face===t?t.outside=e.next:t.outside=null),this.assigned.remove(e),this}removeAllVerticesFromFace(e){if(e.outside!==null){const t=e.outside;let i=e.outside;for(;i.next!==null&&i.next.face===e;)i=i.next;return this.assigned.removeSubList(t,i),t.prev=i.next=null,e.outside=null,t}}deleteFaceVertices(e,t){const i=this.removeAllVerticesFromFace(e);if(i!==void 0)if(t===void 0)this.unassigned.appendChain(i);else{let n=i;do{const r=n.next;t.distanceToPoint(n.point)>this.tolerance?this.addVertexToFace(n,t):this.unassigned.append(n),n=r}while(n!==null)}return this}resolveUnassignedPoints(e){if(this.unassigned.isEmpty()===!1){let t=this.unassigned.first();do{const i=t.next;let n=this.tolerance,r=null;for(let o=0;on&&(n=l,r=a),n>1e3*this.tolerance)break}}r!==null&&this.addVertexToFace(t,r),t=i}while(t!==null)}return this}computeExtremes(){const e=new O,t=new O,i=[],n=[];for(let r=0;r<3;r++)i[r]=n[r]=this.vertices[0];e.copy(this.vertices[0].point),t.copy(this.vertices[0].point);for(let r=0,o=this.vertices.length;rt.getComponent(h)&&(t.setComponent(h,l.getComponent(h)),n[h]=a)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(e.x),Math.abs(t.x))+Math.max(Math.abs(e.y),Math.abs(t.y))+Math.max(Math.abs(e.z),Math.abs(t.z))),{min:i,max:n}}computeInitialHull(){const e=this.vertices,t=this.computeExtremes(),i=t.min,n=t.max;let r=0,o=0;for(let f=0;f<3;f++){const g=n[f].point.getComponent(f)-i[f].point.getComponent(f);g>r&&(r=g,o=f)}const a=i[o],l=n[o];let h,d;r=0,Rd.set(a.point,l.point);for(let f=0,g=this.vertices.length;fr&&(r=b,h=v)}}r=-1,Pc.setFromCoplanarPoints(a.point,l.point,h.point);for(let f=0,g=this.vertices.length;fr&&(r=b,d=v)}}const p=[];if(Pc.distanceToPoint(d.point)<0){p.push(Ci.create(a,l,h),Ci.create(d,l,a),Ci.create(d,h,l),Ci.create(d,a,h));for(let f=0;f<3;f++){const g=(f+1)%3;p[f+1].getEdge(2).setTwin(p[0].getEdge(g)),p[f+1].getEdge(1).setTwin(p[g+1].getEdge(0))}}else{p.push(Ci.create(a,h,l),Ci.create(d,a,l),Ci.create(d,l,h),Ci.create(d,h,a));for(let f=0;f<3;f++){const g=(f+1)%3;p[f+1].getEdge(2).setTwin(p[0].getEdge((3-f)%3)),p[f+1].getEdge(0).setTwin(p[g+1].getEdge(1))}}for(let f=0;f<4;f++)this.faces.push(p[f]);for(let f=0,g=e.length;fr&&(r=T,b=this.faces[w])}b!==null&&this.addVertexToFace(v,b)}}return this}reindexFaces(){const e=[];for(let t=0;tt&&(t=r,e=n),n=n.next}while(n!==null&&n.face===i);return e}}computeHorizon(e,t,i,n){this.deleteFaceVertices(i),i.mark=m1;let r;t===null?r=t=i.getEdge(0):r=t.next;do{const o=r.twin,a=o.face;a.mark===La&&(a.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,o,a,n):n.push(r)),r=r.next}while(r!==t);return this}addAdjoiningFace(e,t){const i=Ci.create(e,t.tail(),t.head());return this.faces.push(i),i.getEdge(-1).setTwin(t.twin),i.getEdge(0)}addNewFaces(e,t){this.newFaces=[];let i=null,n=null;for(let r=0;r0;)t=t.next,e--;for(;e<0;)t=t.prev,e++;return t}compute(){const e=this.edge.tail(),t=this.edge.head(),i=this.edge.next.head();return da.set(e.point,t.point,i.point),da.getNormal(this.normal),da.getMidpoint(this.midpoint),this.area=da.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}},Oc=class{constructor(e,t){this.vertex=e,this.prev=null,this.next=null,this.twin=null,this.face=t}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const e=this.head(),t=this.tail();return t!==null?t.point.distanceTo(e.point):-1}lengthSquared(){const e=this.head(),t=this.tail();return t!==null?t.point.distanceToSquared(e.point):-1}setTwin(e){return this.twin=e,e.twin=this,this}};class y1{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}}let Od=class{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(e,t){return t.prev=e.prev,t.next=e,t.prev===null?this.head=t:t.prev.next=t,e.prev=t,this}insertAfter(e,t){return t.prev=e,t.next=e.next,t.next===null?this.tail=t:t.next.prev=t,e.next=t,this}append(e){return this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this}appendChain(e){for(this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail;e.next!==null;)e=e.next;return this.tail=e,this}remove(e){return e.prev===null?this.head=e.next:e.prev.next=e.next,e.next===null?this.tail=e.prev:e.next.prev=e.prev,this}removeSubList(e,t){return e.prev===null?this.head=t.next:e.prev.next=t.next,t.next===null?this.tail=e.prev:t.next.prev=e.prev,this}isEmpty(){return this.head===null}};const rh=[2,2,1],oh=[1,0,0];function gi(s,e){return s*3+e}function E1(s){const e=s.elements;let t=0;for(let i=0;i<9;i++)t+=e[i]*e[i];return Math.sqrt(t)}function b1(s){const e=s.elements;let t=0;for(let i=0;i<3;i++){const n=e[gi(rh[i],oh[i])];t+=2*n*n}return Math.sqrt(t)}function w1(s,e){let t=0,i=1;const n=s.elements;for(let h=0;h<3;h++){const d=Math.abs(n[gi(rh[h],oh[h])]);d>t&&(t=d,i=h)}let r=1,o=0;const a=oh[i],l=rh[i];if(Math.abs(n[gi(l,a)])>Number.EPSILON){const h=n[gi(l,l)],d=n[gi(a,a)],p=n[gi(l,a)],f=(h-d)/2/p;let g;f<0?g=-1/(-f+Math.sqrt(1+f*f)):g=1/(f+Math.sqrt(1+f*f)),r=1/Math.sqrt(1+g*g),o=g*r}return e.identity(),e.elements[gi(a,a)]=r,e.elements[gi(l,l)]=r,e.elements[gi(l,a)]=o,e.elements[gi(a,l)]=-o,e}function I1(s,e){let t=0,i=0;const n=10;e.unitary.identity(),e.diagonal.copy(s);const r=e.unitary,o=e.diagonal,a=new Fn,l=new Fn,h=Number.EPSILON*E1(o);for(;ih;)w1(o,a),l.copy(a).transpose(),o.multiply(a),o.premultiply(l),r.multiply(a),++t>2&&(i++,t=0);return e}function C1(s){const e=[];for(let He=0;He0}let Fd=class{static isTransparent(e){return e.transparent&&e.opacity<1}};const ah=class ht{static create(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return`${ht._lut[e&255]+ht._lut[e>>8&255]+ht._lut[e>>16&255]+ht._lut[e>>24&255]}-${ht._lut[t&255]}${ht._lut[t>>8&255]}-${ht._lut[t>>16&15|64]}${ht._lut[t>>24&255]}-${ht._lut[i&63|128]}${ht._lut[i>>8&255]}-${ht._lut[i>>16&255]}${ht._lut[i>>24&255]}${ht._lut[n&255]}${ht._lut[n>>8&255]}${ht._lut[n>>16&255]}${ht._lut[n>>24&255]}`.toLowerCase()}static validate(e){if(!ht._pattern.test(e))throw new Error(`${e} is not a valid UUID v4. - If you're the tool creator, you can take one from https://www.uuidgenerator.net/. -- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};A(ah,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),A(ah,"_lut",["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]);let nu=ah;class x1 extends Re{constructor(e,t){super(e),A(this,"onVertexFound",new ee),A(this,"onVertexLost",new ee),A(this,"components"),A(this,"_pickedPoint",null),A(this,"_config"),A(this,"_enabled",!1),A(this,"_workingPlane",null),this.components=e,this.config={snapDistance:.25,showOnlyVertex:!1,...t},this.enabled=!1}set enabled(e){this._enabled=e,e||(this._pickedPoint=null)}get enabled(){return this._enabled}set workingPlane(e){this._workingPlane=e}get workingPlane(){return this._workingPlane}set config(e){this._config={...this._config,...e}}get config(){return this._config}dispose(){this.onVertexFound.reset(),this.onVertexLost.reset(),this.components=null}get(e){if(!this.enabled)return this._pickedPoint;const t=this.components.get(ni).get(e).castRay();if(!t)return this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const i=this.getClosestVertex(t);return i?!this.workingPlane||Math.abs(this.workingPlane.distanceToPoint(i))<.001?((this._pickedPoint===null||!this._pickedPoint.equals(i))&&(this._pickedPoint=i.clone(),this.onVertexFound.trigger(this._pickedPoint)),this._pickedPoint):(this._pickedPoint=null,this._pickedPoint):(this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint)}getClosestVertex(e){let t=new O,i=!1,n=Number.MAX_SAFE_INTEGER;const r=this.getVertices(e);return r==null||r.forEach(o=>{if(!o)return;const a=e.point.distanceTo(o);a>n||a>this._config.snapDistance||(i=!0,t=o,n=e.point.distanceTo(o))}),i?t:this.config.showOnlyVertex?null:e.point}getVertices(e){const t=e.object;if(!e.face||!t)return null;const i=t.geometry;return[this.getVertex(e.face.a,i),this.getVertex(e.face.b,i),this.getVertex(e.face.c,i)].map(n=>n==null?void 0:n.applyMatrix4(t.matrixWorld))}getVertex(e,t){if(e===void 0)return null;const i=t.attributes.position;return new O(i.getX(e),i.getY(e),i.getZ(e))}}const Bf=class zf{constructor(){A(this,"onDisposed",new ee),A(this,"list",new Map),A(this,"enabled",!1),A(this,"_clock"),A(this,"update",()=>{if(!this.enabled)return;const e=this._clock.getDelta();for(const[t,i]of this.list)i.enabled&&i.isUpdateable()&&i.update(e);requestAnimationFrame(this.update)}),this._clock=new vf,zf.setupBVH()}add(e,t){if(this.list.has(e))throw new Error("You're trying to add a component that already exists in the components intance. Use Components.get() instead.");nu.validate(e),this.list.set(e,t)}get(e){const t=e.uuid;if(!this.list.has(t)){const i=new e(this);return this.list.has(t)||this.add(t,i),i}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){Ne.prototype.computeBoundsTree=u1,Ne.prototype.disposeBoundsTree=d1,le.prototype.raycast=h1}};A(Bf,"release","1.4.21");let A1=Bf;class S1{constructor(e){A(this,"_event"),A(this,"_position",new Ve),A(this,"onDisposed",new ee),A(this,"updateMouseInfo",t=>{this._event=t}),this.dom=e,this.setupEvents(!0)}get position(){if(this._event){const e=this.dom.getBoundingClientRect();this._position.x=this.getPositionX(e,this._event),this._position.y=this.getPositionY(e,this._event)}return this._position}dispose(){this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset()}getPositionY(e,t){return-((t.clientY-e.top)/(e.bottom-e.top))*2+1}getPositionX(e,t){return(t.clientX-e.left)/(e.right-e.left)*2-1}setupEvents(e){e?this.dom.addEventListener("mousemove",this.updateMouseInfo):this.dom.removeEventListener("mousemove",this.updateMouseInfo)}}class _1{constructor(e,t){A(this,"enabled",!0),A(this,"components"),A(this,"onDisposed",new ee),A(this,"mouse"),A(this,"three",new io),A(this,"world");const i=t.renderer;if(!i)throw new Error("A renderer is needed for the raycaster to work!");this.world=t,this.mouse=new S1(i.three.domElement),this.components=e}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(e=Array.from(this.world.meshes)){if(!this.world)throw new Error("A world is needed to cast rays!");const t=this.world.camera.three;return this.three.setFromCamera(this.mouse.position,t),this.intersect(e)}castRayFromVector(e,t,i=Array.from(this.world.meshes)){return this.three.set(e,t),this.intersect(i)}intersect(e=Array.from(this.world.meshes)){const t=this.three.intersectObjects(e),i=this.filterClippingPlanes(t);return i.length>0?i[0]:null}filterClippingPlanes(e){if(!this.world.renderer)throw new Error("Renderer not found!");const t=this.world.renderer.three;if(!t.clippingPlanes)return e;const i=t.clippingPlanes;return e.length<=0||!i||(i==null?void 0:i.length)<=0?e:e.filter(n=>i.every(r=>r.distanceToPoint(n.point)>0))}}const Vf=class Hf extends Re{constructor(e){super(e),A(this,"enabled",!0),A(this,"list",new Map),A(this,"onDisposed",new ee),e.add(Hf.uuid,this)}get(e){if(this.list.has(e.uuid))return this.list.get(e.uuid);const t=new _1(this.components,e);return this.list.set(e.uuid,t),e.onDisposed.add(()=>{this.delete(e)}),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}};A(Vf,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let ni=Vf;class R1 extends iu{constructor(e){super(e),A(this,"meshes",new Set),A(this,"onAfterUpdate",new ee),A(this,"onBeforeUpdate",new ee),A(this,"enabled",!0),A(this,"uuid",nu.create()),A(this,"onDisposed",new ee),A(this,"_scene"),A(this,"_camera"),A(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(e){this._scene=e,e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(e){this._camera=e,e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(e){this._renderer=e,e&&(e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"}))}update(e){this.enabled&&(!this._scene||!this._camera||(this.scene.currentWorld=this,this.camera.currentWorld=this,this.renderer&&(this.renderer.currentWorld=this),this.onBeforeUpdate.trigger(),this.scene.isUpdateable()&&this.scene.update(e),this.camera.isUpdateable()&&this.camera.update(e),this.renderer&&this.renderer.update(e),this.onAfterUpdate.trigger()))}dispose(e=!0){if(this.enabled=!1,this.scene.onWorldChanged.trigger({world:this,action:"removed"}),this.camera.onWorldChanged.trigger({world:this,action:"removed"}),this.renderer&&this.renderer.onWorldChanged.trigger({world:this,action:"removed"}),e){const t=this.components.get(Fi);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const i of this.meshes)t.destroy(i);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.onDisposed.trigger()}}class P1 extends f1{constructor(e,t,i){super(e),A(this,"enabled",!0),A(this,"container"),A(this,"three"),A(this,"_canvas"),A(this,"_parameters"),A(this,"_resizeObserver",null),A(this,"onContainerUpdated",new ee),A(this,"_resizing",!1),A(this,"resize",o=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const a=o?o.x:this.container.clientWidth,l=o?o.y:this.container.clientHeight;this.three.setSize(a,l),this.onResize.trigger(new Ve(a,l)),this._resizing=!1}),A(this,"resizeEvent",()=>{this.resize()}),A(this,"onContextLost",o=>{o.preventDefault(),this.enabled=!1}),A(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new Ha({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0}),this.container=t,this._parameters=i,this.three=new Ha({antialias:!0,alpha:!0,...i}),this.three.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.setupRenderer(),this.setupEvents(!0),this.resize(),this._canvas=this.three.domElement;const n=this.three.getContext(),{canvas:r}=n;r.addEventListener("webglcontextlost",this.onContextLost,!1),r.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const e=this.currentWorld.scene.three,t=this.currentWorld.camera.three;this.three.render(e,t),this.onAfterUpdate.trigger(this)}dispose(){this.enabled=!1,this.setupEvents(!1),this.three.domElement.remove(),this.three.dispose(),this.onResize.reset(),this.onAfterUpdate.reset(),this.onBeforeUpdate.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}getSize(){return new Ve(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(e){const t=this.three.domElement.parentElement;if(!t)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),e&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(t),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}}/*! +- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};A(ah,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),A(ah,"_lut",["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]);let nu=ah;class x1 extends Re{constructor(e,t){super(e),A(this,"onVertexFound",new $),A(this,"onVertexLost",new $),A(this,"components"),A(this,"_pickedPoint",null),A(this,"_config"),A(this,"_enabled",!1),A(this,"_workingPlane",null),this.components=e,this.config={snapDistance:.25,showOnlyVertex:!1,...t},this.enabled=!1}set enabled(e){this._enabled=e,e||(this._pickedPoint=null)}get enabled(){return this._enabled}set workingPlane(e){this._workingPlane=e}get workingPlane(){return this._workingPlane}set config(e){this._config={...this._config,...e}}get config(){return this._config}dispose(){this.onVertexFound.reset(),this.onVertexLost.reset(),this.components=null}get(e){if(!this.enabled)return this._pickedPoint;const t=this.components.get(ni).get(e).castRay();if(!t)return this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const i=this.getClosestVertex(t);return i?!this.workingPlane||Math.abs(this.workingPlane.distanceToPoint(i))<.001?((this._pickedPoint===null||!this._pickedPoint.equals(i))&&(this._pickedPoint=i.clone(),this.onVertexFound.trigger(this._pickedPoint)),this._pickedPoint):(this._pickedPoint=null,this._pickedPoint):(this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint)}getClosestVertex(e){let t=new O,i=!1,n=Number.MAX_SAFE_INTEGER;const r=this.getVertices(e);return r==null||r.forEach(o=>{if(!o)return;const a=e.point.distanceTo(o);a>n||a>this._config.snapDistance||(i=!0,t=o,n=e.point.distanceTo(o))}),i?t:this.config.showOnlyVertex?null:e.point}getVertices(e){const t=e.object;if(!e.face||!t)return null;const i=t.geometry;return[this.getVertex(e.face.a,i),this.getVertex(e.face.b,i),this.getVertex(e.face.c,i)].map(n=>n==null?void 0:n.applyMatrix4(t.matrixWorld))}getVertex(e,t){if(e===void 0)return null;const i=t.attributes.position;return new O(i.getX(e),i.getY(e),i.getZ(e))}}const Bf=class zf{constructor(){A(this,"onDisposed",new $),A(this,"list",new Map),A(this,"enabled",!1),A(this,"_clock"),A(this,"update",()=>{if(!this.enabled)return;const e=this._clock.getDelta();for(const[t,i]of this.list)i.enabled&&i.isUpdateable()&&i.update(e);requestAnimationFrame(this.update)}),this._clock=new vf,zf.setupBVH()}add(e,t){if(this.list.has(e))throw new Error("You're trying to add a component that already exists in the components intance. Use Components.get() instead.");nu.validate(e),this.list.set(e,t)}get(e){const t=e.uuid;if(!this.list.has(t)){const i=new e(this);return this.list.has(t)||this.add(t,i),i}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){Ne.prototype.computeBoundsTree=u1,Ne.prototype.disposeBoundsTree=d1,le.prototype.raycast=h1}};A(Bf,"release","1.4.21");let A1=Bf;class S1{constructor(e){A(this,"_event"),A(this,"_position",new Ve),A(this,"onDisposed",new $),A(this,"updateMouseInfo",t=>{this._event=t}),this.dom=e,this.setupEvents(!0)}get position(){if(this._event){const e=this.dom.getBoundingClientRect();this._position.x=this.getPositionX(e,this._event),this._position.y=this.getPositionY(e,this._event)}return this._position}dispose(){this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset()}getPositionY(e,t){return-((t.clientY-e.top)/(e.bottom-e.top))*2+1}getPositionX(e,t){return(t.clientX-e.left)/(e.right-e.left)*2-1}setupEvents(e){e?this.dom.addEventListener("mousemove",this.updateMouseInfo):this.dom.removeEventListener("mousemove",this.updateMouseInfo)}}class _1{constructor(e,t){A(this,"enabled",!0),A(this,"components"),A(this,"onDisposed",new $),A(this,"mouse"),A(this,"three",new io),A(this,"world");const i=t.renderer;if(!i)throw new Error("A renderer is needed for the raycaster to work!");this.world=t,this.mouse=new S1(i.three.domElement),this.components=e}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(e=Array.from(this.world.meshes)){if(!this.world)throw new Error("A world is needed to cast rays!");const t=this.world.camera.three;return this.three.setFromCamera(this.mouse.position,t),this.intersect(e)}castRayFromVector(e,t,i=Array.from(this.world.meshes)){return this.three.set(e,t),this.intersect(i)}intersect(e=Array.from(this.world.meshes)){const t=this.three.intersectObjects(e),i=this.filterClippingPlanes(t);return i.length>0?i[0]:null}filterClippingPlanes(e){if(!this.world.renderer)throw new Error("Renderer not found!");const t=this.world.renderer.three;if(!t.clippingPlanes)return e;const i=t.clippingPlanes;return e.length<=0||!i||(i==null?void 0:i.length)<=0?e:e.filter(n=>i.every(r=>r.distanceToPoint(n.point)>0))}}const Vf=class Hf extends Re{constructor(e){super(e),A(this,"enabled",!0),A(this,"list",new Map),A(this,"onDisposed",new $),e.add(Hf.uuid,this)}get(e){if(this.list.has(e.uuid))return this.list.get(e.uuid);const t=new _1(this.components,e);return this.list.set(e.uuid,t),e.onDisposed.add(()=>{this.delete(e)}),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}};A(Vf,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let ni=Vf;class R1 extends iu{constructor(e){super(e),A(this,"meshes",new Set),A(this,"onAfterUpdate",new $),A(this,"onBeforeUpdate",new $),A(this,"isDisposing",!1),A(this,"enabled",!0),A(this,"uuid",nu.create()),A(this,"name"),A(this,"onDisposed",new $),A(this,"_scene"),A(this,"_camera"),A(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(e){this._scene=e,e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(e){this._camera=e,e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(e){this._renderer=e,e&&(e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"}))}update(e){this.enabled&&(!this._scene||!this._camera||(this.scene.currentWorld=this,this.camera.currentWorld=this,this.renderer&&(this.renderer.currentWorld=this),this.onBeforeUpdate.trigger(),this.scene.isUpdateable()&&this.scene.update(e),this.camera.isUpdateable()&&this.camera.update(e),this.renderer&&this.renderer.update(e),this.onAfterUpdate.trigger()))}dispose(e=!0){if(this.enabled=!1,this.isDisposing=!0,this.scene.onWorldChanged.trigger({world:this,action:"removed"}),this.camera.onWorldChanged.trigger({world:this,action:"removed"}),this.renderer&&this.renderer.onWorldChanged.trigger({world:this,action:"removed"}),e){const t=this.components.get(Fi);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const i of this.meshes)t.destroy(i);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.onDisposed.trigger()}}class P1 extends f1{constructor(e,t,i){super(e),A(this,"enabled",!0),A(this,"container"),A(this,"three"),A(this,"_canvas"),A(this,"_parameters"),A(this,"_resizeObserver",null),A(this,"onContainerUpdated",new $),A(this,"_resizing",!1),A(this,"resize",o=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const a=o?o.x:this.container.clientWidth,l=o?o.y:this.container.clientHeight;this.three.setSize(a,l),this.onResize.trigger(new Ve(a,l)),this._resizing=!1}),A(this,"resizeEvent",()=>{this.resize()}),A(this,"onContextLost",o=>{o.preventDefault(),this.enabled=!1}),A(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new Ha({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0}),this.container=t,this._parameters=i,this.three=new Ha({antialias:!0,alpha:!0,...i}),this.three.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.setupRenderer(),this.setupEvents(!0),this.resize(),this._canvas=this.three.domElement;const n=this.three.getContext(),{canvas:r}=n;r.addEventListener("webglcontextlost",this.onContextLost,!1),r.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const e=this.currentWorld.scene.three,t=this.currentWorld.camera.three;this.three.render(e,t),this.onAfterUpdate.trigger(this)}dispose(){this.enabled=!1,this.setupEvents(!1),this.three.domElement.remove(),this.three.dispose(),this.onResize.reset(),this.onAfterUpdate.reset(),this.onBeforeUpdate.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}getSize(){return new Ve(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(e){const t=this.three.domElement.parentElement;if(!t)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),e&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(t),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}}/*! * camera-controls * https://github.com/yomotsu/camera-controls * (c) 2017 @yomotsu * Released under the MIT License. - */const Ce={LEFT:1,RIGHT:2,MIDDLE:4},J=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),gs={NONE:0,IN:1,OUT:-1};function Cn(s){return s.isPerspectiveCamera}function Qi(s){return s.isOrthographicCamera}const vs=Math.PI*2,Md=Math.PI/2,Yf=1e-5,wr=Math.PI/180;function ti(s,e,t){return Math.max(e,Math.min(t,s))}function Ye(s,e=Yf){return Math.abs(s)0==g>d&&(g=d,t.value=(g-d)/r),g}function Dd(s,e,t,i,n=1/0,r,o){i=Math.max(1e-4,i);const a=2/i,l=a*r,h=1/(1+l+.48*l*l+.235*l*l*l);let d=e.x,p=e.y,f=e.z,g=s.x-d,v=s.y-p,b=s.z-f;const w=d,T=p,S=f,_=n*i,I=_*_,P=g*g+v*v+b*b;if(P>I){const ve=Math.sqrt(P);g=g/ve*_,v=v/ve*_,b=b/ve*_}d=s.x-g,p=s.y-v,f=s.z-b;const M=(t.x+a*g)*r,k=(t.y+a*v)*r,V=(t.z+a*b)*r;t.x=(t.x-a*M)*h,t.y=(t.y-a*k)*h,t.z=(t.z-a*V)*h,o.x=d+(g+M)*h,o.y=p+(v+k)*h,o.z=f+(b+V)*h;const W=w-s.x,j=T-s.y,Q=S-s.z,$=o.x-w,ne=o.y-T,oe=o.z-S;return W*$+j*ne+Q*oe>0&&(o.x=w,o.y=T,o.z=S,t.x=(o.x-w)/r,t.y=(o.y-T)/r,t.z=(o.z-S)/r),o}function Fc(s,e){e.set(0,0),s.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=s.length,e.y/=s.length}function Mc(s,e){return Qi(s)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class O1{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const n=i.indexOf(t);n!==-1&&i.splice(n,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const t=this._listeners[e.type];if(t!==void 0){e.target=this;const i=t.slice(0);for(let n=0,r=i.length;n{},this._enabled=!0,this._state=J.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=gs.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new be.Vector3,this._focalOffsetVelocity=new be.Vector3,this._zoomVelocity={value:0},this._truckInternal=(I,P,M)=>{let k,V;if(Cn(this._camera)){const W=Te.copy(this._camera.position).sub(this._target),j=this._camera.getEffectiveFOV()*wr,Q=W.length()*Math.tan(j*.5);k=this.truckSpeed*I*Q/this._elementRect.height,V=this.truckSpeed*P*Q/this._elementRect.height}else if(Qi(this._camera)){const W=this._camera;k=I*(W.right-W.left)/W.zoom/this._elementRect.width,V=P*(W.top-W.bottom)/W.zoom/this._elementRect.height}else return;this.verticalDragToForward?(M?this.setFocalOffset(this._focalOffsetEnd.x+k,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(k,0,!0),this.forward(-V,!0)):M?this.setFocalOffset(this._focalOffsetEnd.x+k,this._focalOffsetEnd.y+V,this._focalOffsetEnd.z,!0):this.truck(k,V,!0)},this._rotateInternal=(I,P)=>{const M=vs*this.azimuthRotateSpeed*I/this._elementRect.height,k=vs*this.polarRotateSpeed*P/this._elementRect.height;this.rotate(M,k,!0)},this._dollyInternal=(I,P,M)=>{const k=Math.pow(.95,-I*this.dollySpeed),V=this._sphericalEnd.radius,W=this._sphericalEnd.radius*k,j=ti(W,this.minDistance,this.maxDistance),Q=j-W;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(W,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(Q,!0),this._dollyToNoClamp(j,!0)):this._dollyToNoClamp(j,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?W:j)-V,this._dollyControlCoord.set(P,M)),this._lastDollyDirection=Math.sign(-I)},this._zoomInternal=(I,P,M)=>{const k=Math.pow(.95,I*this.dollySpeed),V=this._zoom,W=this._zoom*k;this.zoomTo(W,!0),this.dollyToCursor&&(this._changedZoom+=W-V,this._dollyControlCoord.set(P,M))},typeof be>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new be.Quaternion().setFromUnitVectors(this._camera.up,ma),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=J.NONE,this._target=new be.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new be.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new be.Spherical().setFromVector3(Te.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new be.Vector3,new be.Vector3,new be.Vector3,new be.Vector3],this._updateNearPlaneCorners(),this._boundary=new be.Box3(new be.Vector3(-1/0,-1/0,-1/0),new be.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new be.Vector2,this.mouseButtons={left:J.ROTATE,middle:J.DOLLY,right:J.TRUCK,wheel:Cn(this._camera)?J.DOLLY:Qi(this._camera)?J.ZOOM:J.NONE},this.touches={one:J.TOUCH_ROTATE,two:Cn(this._camera)?J.TOUCH_DOLLY_TRUCK:Qi(this._camera)?J.TOUCH_ZOOM_TRUCK:J.NONE,three:J.TOUCH_TRUCK};const i=new be.Vector2,n=new be.Vector2,r=new be.Vector2,o=I=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const k=this._domElement.getBoundingClientRect(),V=I.clientX/k.width,W=I.clientY/k.height;if(Vthis._interactiveArea.right||Wthis._interactiveArea.bottom)return}const P=I.pointerType!=="mouse"?null:(I.buttons&Ce.LEFT)===Ce.LEFT?Ce.LEFT:(I.buttons&Ce.MIDDLE)===Ce.MIDDLE?Ce.MIDDLE:(I.buttons&Ce.RIGHT)===Ce.RIGHT?Ce.RIGHT:null;if(P!==null){const k=this._findPointerByMouseButton(P);k&&this._disposePointer(k)}if((I.buttons&Ce.LEFT)===Ce.LEFT&&this._lockedPointer)return;const M={pointerId:I.pointerId,clientX:I.clientX,clientY:I.clientY,deltaX:0,deltaY:0,mouseButton:P};this._activePointers.push(M),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),this._isDragging=!0,b(I)},a=I=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const k=this._domElement.getBoundingClientRect(),V=I.clientX/k.width,W=I.clientY/k.height;if(Vthis._interactiveArea.right||Wthis._interactiveArea.bottom)return}const P=(I.buttons&Ce.LEFT)===Ce.LEFT?Ce.LEFT:(I.buttons&Ce.MIDDLE)===Ce.MIDDLE?Ce.MIDDLE:(I.buttons&Ce.RIGHT)===Ce.RIGHT?Ce.RIGHT:null;if(P!==null){const k=this._findPointerByMouseButton(P);k&&this._disposePointer(k)}const M={pointerId:1,clientX:I.clientX,clientY:I.clientY,deltaX:0,deltaY:0,mouseButton:(I.buttons&Ce.LEFT)===Ce.LEFT?Ce.LEFT:(I.buttons&Ce.MIDDLE)===Ce.LEFT?Ce.MIDDLE:(I.buttons&Ce.RIGHT)===Ce.LEFT?Ce.RIGHT:null};this._activePointers.push(M),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("mouseup",p),this._domElement.ownerDocument.addEventListener("mousemove",h),this._domElement.ownerDocument.addEventListener("mouseup",p),this._isDragging=!0,b(I)},l=I=>{I.cancelable&&I.preventDefault();const P=I.pointerId,M=this._lockedPointer||this._findPointerById(P);if(M){if(M.clientX=I.clientX,M.clientY=I.clientY,M.deltaX=I.movementX,M.deltaY=I.movementY,this._state=0,I.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(I.buttons&Ce.LEFT)===Ce.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(I.buttons&Ce.MIDDLE)===Ce.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(I.buttons&Ce.RIGHT)===Ce.RIGHT&&(this._state=this._state|this.mouseButtons.right);w()}},h=I=>{const P=this._lockedPointer||this._findPointerById(1);P&&(P.clientX=I.clientX,P.clientY=I.clientY,P.deltaX=I.movementX,P.deltaY=I.movementY,this._state=0,(this._lockedPointer||(I.buttons&Ce.LEFT)===Ce.LEFT)&&(this._state=this._state|this.mouseButtons.left),(I.buttons&Ce.MIDDLE)===Ce.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(I.buttons&Ce.RIGHT)===Ce.RIGHT&&(this._state=this._state|this.mouseButtons.right),w())},d=I=>{const P=this._findPointerById(I.pointerId);if(!(P&&P===this._lockedPointer)){if(P&&this._disposePointer(P),I.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=J.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=J.NONE;T()}},p=()=>{const I=this._findPointerById(1);I&&I===this._lockedPointer||(I&&this._disposePointer(I),this._state=J.NONE,T())};let f=-1;const g=I=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===J.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const W=this._domElement.getBoundingClientRect(),j=I.clientX/W.width,Q=I.clientY/W.height;if(jthis._interactiveArea.right||Qthis._interactiveArea.bottom)return}if(I.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===J.ROTATE||this.mouseButtons.wheel===J.TRUCK){const W=performance.now();f-W<1e3&&this._getClientRect(this._elementRect),f=W}const P=M1?-1:-3,M=I.deltaMode===1?I.deltaY/P:I.deltaY/(P*10),k=this.dollyToCursor?(I.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,V=this.dollyToCursor?(I.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case J.ROTATE:{this._rotateInternal(I.deltaX,I.deltaY),this._isUserControllingRotate=!0;break}case J.TRUCK:{this._truckInternal(I.deltaX,I.deltaY,!1),this._isUserControllingTruck=!0;break}case J.OFFSET:{this._truckInternal(I.deltaX,I.deltaY,!0),this._isUserControllingOffset=!0;break}case J.DOLLY:{this._dollyInternal(-M,k,V),this._isUserControllingDolly=!0;break}case J.ZOOM:{this._zoomInternal(-M,k,V),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},v=I=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===lh.ACTION.NONE){const P=I instanceof PointerEvent?I.pointerId:0,M=this._findPointerById(P);M&&this._disposePointer(M),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("mouseup",p);return}I.preventDefault()}},b=I=>{if(this._enabled){if(Fc(this._activePointers,St),this._getClientRect(this._elementRect),i.copy(St),n.copy(St),this._activePointers.length>=2){const P=St.x-this._activePointers[1].clientX,M=St.y-this._activePointers[1].clientY,k=Math.sqrt(P*P+M*M);r.set(0,k);const V=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,W=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;n.set(V,W)}if(this._state=0,!I)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in I&&I.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(I.buttons&Ce.LEFT)===Ce.LEFT&&(this._state=this._state|this.mouseButtons.left),(I.buttons&Ce.MIDDLE)===Ce.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(I.buttons&Ce.RIGHT)===Ce.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&J.ROTATE)===J.ROTATE||(this._state&J.TOUCH_ROTATE)===J.TOUCH_ROTATE||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE||(this._state&J.TOUCH_ZOOM_ROTATE)===J.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&J.TRUCK)===J.TRUCK||(this._state&J.TOUCH_TRUCK)===J.TOUCH_TRUCK||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_ZOOM_TRUCK)===J.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&J.DOLLY)===J.DOLLY||(this._state&J.TOUCH_DOLLY)===J.TOUCH_DOLLY||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&J.ZOOM)===J.ZOOM||(this._state&J.TOUCH_ZOOM)===J.TOUCH_ZOOM||(this._state&J.TOUCH_ZOOM_TRUCK)===J.TOUCH_ZOOM_TRUCK||(this._state&J.TOUCH_ZOOM_OFFSET)===J.TOUCH_ZOOM_OFFSET||(this._state&J.TOUCH_ZOOM_ROTATE)===J.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&J.OFFSET)===J.OFFSET||(this._state&J.TOUCH_OFFSET)===J.TOUCH_OFFSET||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET||(this._state&J.TOUCH_ZOOM_OFFSET)===J.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})}},w=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Fc(this._activePointers,St);const I=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,P=I?-I.deltaX:n.x-St.x,M=I?-I.deltaY:n.y-St.y;if(n.copy(St),((this._state&J.ROTATE)===J.ROTATE||(this._state&J.TOUCH_ROTATE)===J.TOUCH_ROTATE||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE||(this._state&J.TOUCH_ZOOM_ROTATE)===J.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(P,M),this._isUserControllingRotate=!0),(this._state&J.DOLLY)===J.DOLLY||(this._state&J.ZOOM)===J.ZOOM){const k=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,V=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,W=this.dollyDragInverted?-1:1;(this._state&J.DOLLY)===J.DOLLY?(this._dollyInternal(W*M*fa,k,V),this._isUserControllingDolly=!0):(this._zoomInternal(W*M*fa,k,V),this._isUserControllingZoom=!0)}if((this._state&J.TOUCH_DOLLY)===J.TOUCH_DOLLY||(this._state&J.TOUCH_ZOOM)===J.TOUCH_ZOOM||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_ZOOM_TRUCK)===J.TOUCH_ZOOM_TRUCK||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET||(this._state&J.TOUCH_ZOOM_OFFSET)===J.TOUCH_ZOOM_OFFSET||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE||(this._state&J.TOUCH_ZOOM_ROTATE)===J.TOUCH_ZOOM_ROTATE){const k=St.x-this._activePointers[1].clientX,V=St.y-this._activePointers[1].clientY,W=Math.sqrt(k*k+V*V),j=r.y-W;r.set(0,W);const Q=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,$=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&J.TOUCH_DOLLY)===J.TOUCH_DOLLY||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET?(this._dollyInternal(j*fa,Q,$),this._isUserControllingDolly=!0):(this._zoomInternal(j*fa,Q,$),this._isUserControllingZoom=!0)}((this._state&J.TRUCK)===J.TRUCK||(this._state&J.TOUCH_TRUCK)===J.TOUCH_TRUCK||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_ZOOM_TRUCK)===J.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(P,M,!1),this._isUserControllingTruck=!0),((this._state&J.OFFSET)===J.OFFSET||(this._state&J.TOUCH_OFFSET)===J.TOUCH_OFFSET||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET||(this._state&J.TOUCH_ZOOM_OFFSET)===J.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(P,M,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},T=()=>{Fc(this._activePointers,St),n.copy(St),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",p),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",S),this._domElement.ownerDocument.addEventListener("pointerlockerror",_),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),b())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",S),this._domElement.ownerDocument.removeEventListener("pointerlockerror",_))};const S=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},_=()=>{this.unlockPointer()};this._addAllEventListeners=I=>{this._domElement=I,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),L1&&this._domElement.addEventListener("mousedown",a),this._domElement.addEventListener("pointercancel",d),this._domElement.addEventListener("wheel",g,{passive:!1}),this._domElement.addEventListener("contextmenu",v)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("mousedown",a),this._domElement.removeEventListener("pointercancel",d),this._domElement.removeEventListener("wheel",g,{passive:!1}),this._domElement.removeEventListener("contextmenu",v),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",p),this._domElement.ownerDocument.removeEventListener("pointerlockchange",S),this._domElement.ownerDocument.removeEventListener("pointerlockerror",_))},this.cancel=()=>{this._state!==J.NONE&&(this._state=J.NONE,this._activePointers.length=0,T())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=ti(e.width,0,1),this._interactiveArea.height=ti(e.height,0,1),this._interactiveArea.x=ti(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=ti(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,i=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,i)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,i=!1){this._isUserControllingRotate=!1;const n=ti(e,this.minAzimuthAngle,this.maxAzimuthAngle),r=ti(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=n,this._sphericalEnd.phi=r,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,i||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!i||De(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&De(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=gs.NONE,this._changedDolly=0,this._dollyToNoClamp(ti(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const r=this._collisionTest(),o=De(r,this._spherical.radius);if(!(i>e)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,r)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const n=!t||De(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(n)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Tr).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||De(this._target.x,this._targetEnd.x,this.restThreshold)&&De(this._target.y,this._targetEnd.y,this.restThreshold)&&De(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=ti(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||De(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(i)}pan(e,t,i=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,i)}truck(e,t,i=!1){this._camera.updateMatrix(),ui.setFromMatrixColumn(this._camera.matrix,0),di.setFromMatrixColumn(this._camera.matrix,1),ui.multiplyScalar(e),di.multiplyScalar(-t);const n=Te.copy(ui).add(di),r=Oe.copy(this._targetEnd).add(n);return this.moveTo(r.x,r.y,r.z,i)}forward(e,t=!1){Te.setFromMatrixColumn(this._camera.matrix,0),Te.crossVectors(this._camera.up,Te),Te.multiplyScalar(e);const i=Oe.copy(this._targetEnd).add(Te);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return Te.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+Te.x,this._targetEnd.y+Te.y,this._targetEnd.z+Te.z,t)}moveTo(e,t,i,n=!1){this._isUserControllingTruck=!1;const r=Te.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,r,this.boundaryFriction),this._needsUpdate=!0,n||this._target.copy(this._targetEnd);const o=!n||De(this._target.x,this._targetEnd.x,this.restThreshold)&&De(this._target.y,this._targetEnd.y,this.restThreshold)&&De(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,i,n=!1){const r=Te.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(r.x,r.y,r.z,n)}fitToBox(e,t,{cover:i=!1,paddingLeft:n=0,paddingRight:r=0,paddingBottom:o=0,paddingTop:a=0}={}){const l=[],h=e.isBox3?Es.copy(e):Es.setFromObject(e);h.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const d=Ld(this._sphericalEnd.theta,Md),p=Ld(this._sphericalEnd.phi,Md);l.push(this.rotateTo(d,p,t));const f=Te.setFromSpherical(this._sphericalEnd).normalize(),g=zd.setFromUnitVectors(f,Lc),v=De(Math.abs(f.y),1);v&&g.multiply(Nc.setFromAxisAngle(ma,d)),g.multiply(this._yAxisUpSpaceInverse);const b=Bd.makeEmpty();Oe.copy(h.min).applyQuaternion(g),b.expandByPoint(Oe),Oe.copy(h.min).setX(h.max.x).applyQuaternion(g),b.expandByPoint(Oe),Oe.copy(h.min).setY(h.max.y).applyQuaternion(g),b.expandByPoint(Oe),Oe.copy(h.max).setZ(h.min.z).applyQuaternion(g),b.expandByPoint(Oe),Oe.copy(h.min).setZ(h.max.z).applyQuaternion(g),b.expandByPoint(Oe),Oe.copy(h.max).setY(h.min.y).applyQuaternion(g),b.expandByPoint(Oe),Oe.copy(h.max).setX(h.min.x).applyQuaternion(g),b.expandByPoint(Oe),Oe.copy(h.max).applyQuaternion(g),b.expandByPoint(Oe),b.min.x-=n,b.min.y-=o,b.max.x+=r,b.max.y+=a,g.setFromUnitVectors(Lc,f),v&&g.premultiply(Nc.invert()),g.premultiply(this._yAxisUpSpace);const w=b.getSize(Te),T=b.getCenter(Oe).applyQuaternion(g);if(Cn(this._camera)){const S=this.getDistanceToFitBox(w.x,w.y,w.z,i);l.push(this.moveTo(T.x,T.y,T.z,t)),l.push(this.dollyTo(S,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(Qi(this._camera)){const S=this._camera,_=S.right-S.left,I=S.top-S.bottom,P=i?Math.max(_/w.x,I/w.y):Math.min(_/w.x,I/w.y);l.push(this.moveTo(T.x,T.y,T.z,t)),l.push(this.zoomTo(P,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const i=[],n=e instanceof be.Sphere?Dc.copy(e):lh.createBoundingSphere(e,Dc);if(i.push(this.moveTo(n.center.x,n.center.y,n.center.z,t)),Cn(this._camera)){const r=this.getDistanceToFitSphere(n.radius);i.push(this.dollyTo(r,t))}else if(Qi(this._camera)){const r=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,a=2*n.radius,l=Math.min(r/a,o/a);i.push(this.zoomTo(l,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,n,r,o,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=gs.NONE,this._changedDolly=0;const l=Oe.set(n,r,o),h=Te.set(e,t,i);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(h.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const d=!a||De(this._target.x,this._targetEnd.x,this.restThreshold)&&De(this._target.y,this._targetEnd.y,this.restThreshold)&&De(this._target.z,this._targetEnd.z,this.restThreshold)&&De(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&De(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&De(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(d)}lerpLookAt(e,t,i,n,r,o,a,l,h,d,p,f,g,v=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=gs.NONE,this._changedDolly=0;const b=Te.set(n,r,o),w=Oe.set(e,t,i);zt.setFromVector3(w.sub(b).applyQuaternion(this._yAxisUpSpace));const T=ys.set(d,p,f),S=Oe.set(a,l,h);xr.setFromVector3(S.sub(T).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(b.lerp(T,g));const _=xr.theta-zt.theta,I=xr.phi-zt.phi,P=xr.radius-zt.radius;this._sphericalEnd.set(zt.radius+P*g,zt.phi+I*g,zt.theta+_*g),this.normalizeRotations(),this._needsUpdate=!0,v||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const M=!v||De(this._target.x,this._targetEnd.x,this.restThreshold)&&De(this._target.y,this._targetEnd.y,this.restThreshold)&&De(this._target.z,this._targetEnd.z,this.restThreshold)&&De(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&De(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&De(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(M)}setPosition(e,t,i,n=!1){return this.setLookAt(e,t,i,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,n)}setTarget(e,t,i,n=!1){const r=this.getPosition(Te),o=this.setLookAt(r.x,r.y,r.z,e,t,i,n);return this._sphericalEnd.phi=ti(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,i,n=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,i),this._needsUpdate=!0,n||this._focalOffset.copy(this._focalOffsetEnd);const r=!n||De(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&De(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&De(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),ui.setFromMatrixColumn(this._camera.matrixWorldInverse,0),di.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Tn.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const n=Te.set(e,t,i),r=n.distanceTo(this._camera.position),o=n.sub(this._camera.position);ui.multiplyScalar(o.x),di.multiplyScalar(o.y),Tn.multiplyScalar(o.z),Te.copy(ui).add(di).add(Tn),Te.z=Te.z+r,this.dollyTo(r,!1),this.setFocalOffset(-Te.x,Te.y,-Te.z,!1),this.moveTo(e,t,i,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,i,n){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new be.Vector4,typeof e=="number"?this._viewport.set(e,t,i,n):this._viewport.copy(e)}getDistanceToFitBox(e,t,i,n=!1){if(Mc(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const r=e/t,o=this._camera.getEffectiveFOV()*wr,a=this._camera.aspect;return((n?r>a:rt.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,i){const n=t.lengthSq();if(n===0)return e;const r=Oe.copy(t).add(e),o=this._boundary.clampPoint(r,ys).sub(r),a=o.lengthSq();if(a===0)return e.add(t);if(a===n)return e;if(i===0)return e.add(t).add(o);{const l=1+i*a/t.dot(o);return e.add(Oe.copy(t).multiplyScalar(l)).add(o.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(Cn(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*wr,n=Math.tan(i*.5)*t,r=n*e.aspect;this._nearPlaneCorners[0].set(-r,-n,0),this._nearPlaneCorners[1].set(r,-n,0),this._nearPlaneCorners[2].set(r,n,0),this._nearPlaneCorners[3].set(-r,n,0)}else if(Qi(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,n=e.right*t,r=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(i,r,0),this._nearPlaneCorners[1].set(n,r,0),this._nearPlaneCorners[2].set(n,o,0),this._nearPlaneCorners[3].set(i,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Mc(this._camera,"_collisionTest"))return e;const t=this._getTargetDirection(Tr);Uc.lookAt(Nd,t,this._camera.up);for(let i=0;i<4;i++){const n=Oe.copy(this._nearPlaneCorners[i]);n.applyMatrix4(Uc);const r=ys.addVectors(this._target,n);ga.set(r,t),ga.far=this._spherical.radius+1;const o=ga.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance{const i=()=>{this.removeEventListener("rest",i),t()};this.addEventListener("rest",i)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new be.Sphere){const i=t,n=i.center;Es.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&Es.expandByObject(o)}),Es.getCenter(n);let r=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const a=o,l=a.geometry.clone();l.applyMatrix4(a.matrixWorld);const h=l.attributes.position;for(let d=0,p=h.count;d{var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof jn){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const i=this.currentWorld.renderer.getSize();this.three.aspect=i.width/i.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}}),this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:t,world:i})=>{if(t==="added"){const n=this.newCameraControls();this._allControls.set(i.uuid,n)}if(t==="removed"){const n=this._allControls.get(i.uuid);n&&(n.dispose(),this._allControls.delete(i.uuid))}})}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const e=this._allControls.get(this.currentWorld.uuid);if(!e)throw new Error("Controls not found!");return e}get enabled(){return this.currentWorld===null?!1:this.controls.enabled}set enabled(e){this.controls.enabled=e}dispose(){this.setupEvents(!1),this.enabled=!1,this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[e,t]of this._allControls)t.dispose()}update(e){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(e),this.onAfterUpdate.trigger(this))}setupCamera(){const e=window.innerWidth/window.innerHeight,t=new Ov(60,e,1,1e3);return t.position.set(50,50,50),t.lookAt(new O(0,0,0)),t}newCameraControls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");if(!this.currentWorld.renderer)throw new Error("This camera needs a renderer to work!");Mt.install({THREE:jf.getSubsetOfThree()});const{domElement:e}=this.currentWorld.renderer.three,t=new Mt(this.three,e);return t.smoothTime=.2,t.dollyToCursor=!0,t.infinityDolly=!0,t}setupEvents(e){e?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:Fv,Vector2:Ve,Vector3:O,Vector4:Vs,Quaternion:Vt,Matrix4:Ee,Spherical:Mv,Box3:Ke,Sphere:Gn,Raycaster:io,MathUtils:so}}};const Wf=class Xf extends Re{constructor(e){super(e),A(this,"onAfterUpdate",new ee),A(this,"onBeforeUpdate",new ee),A(this,"onDisposed",new ee),A(this,"list",new Map),A(this,"enabled",!0),e.add(Xf.uuid,this)}create(){const e=new R1(this.components),t=e.uuid;if(this.list.has(t))throw new Error("There is already a world with this name!");return this.list.set(t,e),e}delete(e){this.list.delete(e.uuid),e.dispose()}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}update(e){if(this.enabled)for(const[t,i]of this.list)i.update(e)}};A(Wf,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let D1=Wf;class N1{constructor(e,t,i){A(this,"onDisposed",new ee),A(this,"world"),A(this,"components"),A(this,"three"),A(this,"_fade",3),A(this,"updateZoom",()=>{this.world.camera instanceof ch&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)}),this.world=t;const{color:n,size1:r,size2:o,distance:a}=i;this.components=e;const l=new ul(2,2,1,1),h=new wt({side:no,uniforms:{uSize1:{value:r},uSize2:{value:o},uColor:{value:n},uDistance:{value:a},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:` + */const Ce={LEFT:1,RIGHT:2,MIDDLE:4},J=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),gs={NONE:0,IN:1,OUT:-1};function Cn(s){return s.isPerspectiveCamera}function Qi(s){return s.isOrthographicCamera}const vs=Math.PI*2,Md=Math.PI/2,Yf=1e-5,wr=Math.PI/180;function ti(s,e,t){return Math.max(e,Math.min(t,s))}function Ye(s,e=Yf){return Math.abs(s)0==g>d&&(g=d,t.value=(g-d)/r),g}function Dd(s,e,t,i,n=1/0,r,o){i=Math.max(1e-4,i);const a=2/i,l=a*r,h=1/(1+l+.48*l*l+.235*l*l*l);let d=e.x,p=e.y,f=e.z,g=s.x-d,v=s.y-p,b=s.z-f;const w=d,T=p,S=f,_=n*i,I=_*_,P=g*g+v*v+b*b;if(P>I){const ve=Math.sqrt(P);g=g/ve*_,v=v/ve*_,b=b/ve*_}d=s.x-g,p=s.y-v,f=s.z-b;const M=(t.x+a*g)*r,k=(t.y+a*v)*r,V=(t.z+a*b)*r;t.x=(t.x-a*M)*h,t.y=(t.y-a*k)*h,t.z=(t.z-a*V)*h,o.x=d+(g+M)*h,o.y=p+(v+k)*h,o.z=f+(b+V)*h;const W=w-s.x,j=T-s.y,Q=S-s.z,ee=o.x-w,ne=o.y-T,oe=o.z-S;return W*ee+j*ne+Q*oe>0&&(o.x=w,o.y=T,o.z=S,t.x=(o.x-w)/r,t.y=(o.y-T)/r,t.z=(o.z-S)/r),o}function Fc(s,e){e.set(0,0),s.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=s.length,e.y/=s.length}function Mc(s,e){return Qi(s)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class O1{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const n=i.indexOf(t);n!==-1&&i.splice(n,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const t=this._listeners[e.type];if(t!==void 0){e.target=this;const i=t.slice(0);for(let n=0,r=i.length;n{},this._enabled=!0,this._state=J.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=gs.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new be.Vector3,this._focalOffsetVelocity=new be.Vector3,this._zoomVelocity={value:0},this._truckInternal=(I,P,M)=>{let k,V;if(Cn(this._camera)){const W=Te.copy(this._camera.position).sub(this._target),j=this._camera.getEffectiveFOV()*wr,Q=W.length()*Math.tan(j*.5);k=this.truckSpeed*I*Q/this._elementRect.height,V=this.truckSpeed*P*Q/this._elementRect.height}else if(Qi(this._camera)){const W=this._camera;k=I*(W.right-W.left)/W.zoom/this._elementRect.width,V=P*(W.top-W.bottom)/W.zoom/this._elementRect.height}else return;this.verticalDragToForward?(M?this.setFocalOffset(this._focalOffsetEnd.x+k,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(k,0,!0),this.forward(-V,!0)):M?this.setFocalOffset(this._focalOffsetEnd.x+k,this._focalOffsetEnd.y+V,this._focalOffsetEnd.z,!0):this.truck(k,V,!0)},this._rotateInternal=(I,P)=>{const M=vs*this.azimuthRotateSpeed*I/this._elementRect.height,k=vs*this.polarRotateSpeed*P/this._elementRect.height;this.rotate(M,k,!0)},this._dollyInternal=(I,P,M)=>{const k=Math.pow(.95,-I*this.dollySpeed),V=this._sphericalEnd.radius,W=this._sphericalEnd.radius*k,j=ti(W,this.minDistance,this.maxDistance),Q=j-W;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(W,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(Q,!0),this._dollyToNoClamp(j,!0)):this._dollyToNoClamp(j,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?W:j)-V,this._dollyControlCoord.set(P,M)),this._lastDollyDirection=Math.sign(-I)},this._zoomInternal=(I,P,M)=>{const k=Math.pow(.95,I*this.dollySpeed),V=this._zoom,W=this._zoom*k;this.zoomTo(W,!0),this.dollyToCursor&&(this._changedZoom+=W-V,this._dollyControlCoord.set(P,M))},typeof be>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new be.Quaternion().setFromUnitVectors(this._camera.up,ma),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=J.NONE,this._target=new be.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new be.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new be.Spherical().setFromVector3(Te.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new be.Vector3,new be.Vector3,new be.Vector3,new be.Vector3],this._updateNearPlaneCorners(),this._boundary=new be.Box3(new be.Vector3(-1/0,-1/0,-1/0),new be.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new be.Vector2,this.mouseButtons={left:J.ROTATE,middle:J.DOLLY,right:J.TRUCK,wheel:Cn(this._camera)?J.DOLLY:Qi(this._camera)?J.ZOOM:J.NONE},this.touches={one:J.TOUCH_ROTATE,two:Cn(this._camera)?J.TOUCH_DOLLY_TRUCK:Qi(this._camera)?J.TOUCH_ZOOM_TRUCK:J.NONE,three:J.TOUCH_TRUCK};const i=new be.Vector2,n=new be.Vector2,r=new be.Vector2,o=I=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const k=this._domElement.getBoundingClientRect(),V=I.clientX/k.width,W=I.clientY/k.height;if(Vthis._interactiveArea.right||Wthis._interactiveArea.bottom)return}const P=I.pointerType!=="mouse"?null:(I.buttons&Ce.LEFT)===Ce.LEFT?Ce.LEFT:(I.buttons&Ce.MIDDLE)===Ce.MIDDLE?Ce.MIDDLE:(I.buttons&Ce.RIGHT)===Ce.RIGHT?Ce.RIGHT:null;if(P!==null){const k=this._findPointerByMouseButton(P);k&&this._disposePointer(k)}if((I.buttons&Ce.LEFT)===Ce.LEFT&&this._lockedPointer)return;const M={pointerId:I.pointerId,clientX:I.clientX,clientY:I.clientY,deltaX:0,deltaY:0,mouseButton:P};this._activePointers.push(M),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),this._isDragging=!0,b(I)},a=I=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const k=this._domElement.getBoundingClientRect(),V=I.clientX/k.width,W=I.clientY/k.height;if(Vthis._interactiveArea.right||Wthis._interactiveArea.bottom)return}const P=(I.buttons&Ce.LEFT)===Ce.LEFT?Ce.LEFT:(I.buttons&Ce.MIDDLE)===Ce.MIDDLE?Ce.MIDDLE:(I.buttons&Ce.RIGHT)===Ce.RIGHT?Ce.RIGHT:null;if(P!==null){const k=this._findPointerByMouseButton(P);k&&this._disposePointer(k)}const M={pointerId:1,clientX:I.clientX,clientY:I.clientY,deltaX:0,deltaY:0,mouseButton:(I.buttons&Ce.LEFT)===Ce.LEFT?Ce.LEFT:(I.buttons&Ce.MIDDLE)===Ce.LEFT?Ce.MIDDLE:(I.buttons&Ce.RIGHT)===Ce.LEFT?Ce.RIGHT:null};this._activePointers.push(M),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("mouseup",p),this._domElement.ownerDocument.addEventListener("mousemove",h),this._domElement.ownerDocument.addEventListener("mouseup",p),this._isDragging=!0,b(I)},l=I=>{I.cancelable&&I.preventDefault();const P=I.pointerId,M=this._lockedPointer||this._findPointerById(P);if(M){if(M.clientX=I.clientX,M.clientY=I.clientY,M.deltaX=I.movementX,M.deltaY=I.movementY,this._state=0,I.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(I.buttons&Ce.LEFT)===Ce.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(I.buttons&Ce.MIDDLE)===Ce.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(I.buttons&Ce.RIGHT)===Ce.RIGHT&&(this._state=this._state|this.mouseButtons.right);w()}},h=I=>{const P=this._lockedPointer||this._findPointerById(1);P&&(P.clientX=I.clientX,P.clientY=I.clientY,P.deltaX=I.movementX,P.deltaY=I.movementY,this._state=0,(this._lockedPointer||(I.buttons&Ce.LEFT)===Ce.LEFT)&&(this._state=this._state|this.mouseButtons.left),(I.buttons&Ce.MIDDLE)===Ce.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(I.buttons&Ce.RIGHT)===Ce.RIGHT&&(this._state=this._state|this.mouseButtons.right),w())},d=I=>{const P=this._findPointerById(I.pointerId);if(!(P&&P===this._lockedPointer)){if(P&&this._disposePointer(P),I.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=J.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=J.NONE;T()}},p=()=>{const I=this._findPointerById(1);I&&I===this._lockedPointer||(I&&this._disposePointer(I),this._state=J.NONE,T())};let f=-1;const g=I=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===J.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const W=this._domElement.getBoundingClientRect(),j=I.clientX/W.width,Q=I.clientY/W.height;if(jthis._interactiveArea.right||Qthis._interactiveArea.bottom)return}if(I.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===J.ROTATE||this.mouseButtons.wheel===J.TRUCK){const W=performance.now();f-W<1e3&&this._getClientRect(this._elementRect),f=W}const P=M1?-1:-3,M=I.deltaMode===1?I.deltaY/P:I.deltaY/(P*10),k=this.dollyToCursor?(I.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,V=this.dollyToCursor?(I.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case J.ROTATE:{this._rotateInternal(I.deltaX,I.deltaY),this._isUserControllingRotate=!0;break}case J.TRUCK:{this._truckInternal(I.deltaX,I.deltaY,!1),this._isUserControllingTruck=!0;break}case J.OFFSET:{this._truckInternal(I.deltaX,I.deltaY,!0),this._isUserControllingOffset=!0;break}case J.DOLLY:{this._dollyInternal(-M,k,V),this._isUserControllingDolly=!0;break}case J.ZOOM:{this._zoomInternal(-M,k,V),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},v=I=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===lh.ACTION.NONE){const P=I instanceof PointerEvent?I.pointerId:0,M=this._findPointerById(P);M&&this._disposePointer(M),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("mouseup",p);return}I.preventDefault()}},b=I=>{if(this._enabled){if(Fc(this._activePointers,St),this._getClientRect(this._elementRect),i.copy(St),n.copy(St),this._activePointers.length>=2){const P=St.x-this._activePointers[1].clientX,M=St.y-this._activePointers[1].clientY,k=Math.sqrt(P*P+M*M);r.set(0,k);const V=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,W=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;n.set(V,W)}if(this._state=0,!I)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in I&&I.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(I.buttons&Ce.LEFT)===Ce.LEFT&&(this._state=this._state|this.mouseButtons.left),(I.buttons&Ce.MIDDLE)===Ce.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(I.buttons&Ce.RIGHT)===Ce.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&J.ROTATE)===J.ROTATE||(this._state&J.TOUCH_ROTATE)===J.TOUCH_ROTATE||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE||(this._state&J.TOUCH_ZOOM_ROTATE)===J.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&J.TRUCK)===J.TRUCK||(this._state&J.TOUCH_TRUCK)===J.TOUCH_TRUCK||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_ZOOM_TRUCK)===J.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&J.DOLLY)===J.DOLLY||(this._state&J.TOUCH_DOLLY)===J.TOUCH_DOLLY||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&J.ZOOM)===J.ZOOM||(this._state&J.TOUCH_ZOOM)===J.TOUCH_ZOOM||(this._state&J.TOUCH_ZOOM_TRUCK)===J.TOUCH_ZOOM_TRUCK||(this._state&J.TOUCH_ZOOM_OFFSET)===J.TOUCH_ZOOM_OFFSET||(this._state&J.TOUCH_ZOOM_ROTATE)===J.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&J.OFFSET)===J.OFFSET||(this._state&J.TOUCH_OFFSET)===J.TOUCH_OFFSET||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET||(this._state&J.TOUCH_ZOOM_OFFSET)===J.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})}},w=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Fc(this._activePointers,St);const I=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,P=I?-I.deltaX:n.x-St.x,M=I?-I.deltaY:n.y-St.y;if(n.copy(St),((this._state&J.ROTATE)===J.ROTATE||(this._state&J.TOUCH_ROTATE)===J.TOUCH_ROTATE||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE||(this._state&J.TOUCH_ZOOM_ROTATE)===J.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(P,M),this._isUserControllingRotate=!0),(this._state&J.DOLLY)===J.DOLLY||(this._state&J.ZOOM)===J.ZOOM){const k=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,V=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,W=this.dollyDragInverted?-1:1;(this._state&J.DOLLY)===J.DOLLY?(this._dollyInternal(W*M*fa,k,V),this._isUserControllingDolly=!0):(this._zoomInternal(W*M*fa,k,V),this._isUserControllingZoom=!0)}if((this._state&J.TOUCH_DOLLY)===J.TOUCH_DOLLY||(this._state&J.TOUCH_ZOOM)===J.TOUCH_ZOOM||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_ZOOM_TRUCK)===J.TOUCH_ZOOM_TRUCK||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET||(this._state&J.TOUCH_ZOOM_OFFSET)===J.TOUCH_ZOOM_OFFSET||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE||(this._state&J.TOUCH_ZOOM_ROTATE)===J.TOUCH_ZOOM_ROTATE){const k=St.x-this._activePointers[1].clientX,V=St.y-this._activePointers[1].clientY,W=Math.sqrt(k*k+V*V),j=r.y-W;r.set(0,W);const Q=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,ee=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&J.TOUCH_DOLLY)===J.TOUCH_DOLLY||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET?(this._dollyInternal(j*fa,Q,ee),this._isUserControllingDolly=!0):(this._zoomInternal(j*fa,Q,ee),this._isUserControllingZoom=!0)}((this._state&J.TRUCK)===J.TRUCK||(this._state&J.TOUCH_TRUCK)===J.TOUCH_TRUCK||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_ZOOM_TRUCK)===J.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(P,M,!1),this._isUserControllingTruck=!0),((this._state&J.OFFSET)===J.OFFSET||(this._state&J.TOUCH_OFFSET)===J.TOUCH_OFFSET||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET||(this._state&J.TOUCH_ZOOM_OFFSET)===J.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(P,M,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},T=()=>{Fc(this._activePointers,St),n.copy(St),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",p),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",S),this._domElement.ownerDocument.addEventListener("pointerlockerror",_),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),b())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",S),this._domElement.ownerDocument.removeEventListener("pointerlockerror",_))};const S=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},_=()=>{this.unlockPointer()};this._addAllEventListeners=I=>{this._domElement=I,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),L1&&this._domElement.addEventListener("mousedown",a),this._domElement.addEventListener("pointercancel",d),this._domElement.addEventListener("wheel",g,{passive:!1}),this._domElement.addEventListener("contextmenu",v)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("mousedown",a),this._domElement.removeEventListener("pointercancel",d),this._domElement.removeEventListener("wheel",g,{passive:!1}),this._domElement.removeEventListener("contextmenu",v),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",p),this._domElement.ownerDocument.removeEventListener("pointerlockchange",S),this._domElement.ownerDocument.removeEventListener("pointerlockerror",_))},this.cancel=()=>{this._state!==J.NONE&&(this._state=J.NONE,this._activePointers.length=0,T())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=ti(e.width,0,1),this._interactiveArea.height=ti(e.height,0,1),this._interactiveArea.x=ti(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=ti(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,i=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,i)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,i=!1){this._isUserControllingRotate=!1;const n=ti(e,this.minAzimuthAngle,this.maxAzimuthAngle),r=ti(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=n,this._sphericalEnd.phi=r,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,i||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!i||De(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&De(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=gs.NONE,this._changedDolly=0,this._dollyToNoClamp(ti(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const r=this._collisionTest(),o=De(r,this._spherical.radius);if(!(i>e)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,r)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const n=!t||De(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(n)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Tr).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||De(this._target.x,this._targetEnd.x,this.restThreshold)&&De(this._target.y,this._targetEnd.y,this.restThreshold)&&De(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=ti(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||De(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(i)}pan(e,t,i=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,i)}truck(e,t,i=!1){this._camera.updateMatrix(),ui.setFromMatrixColumn(this._camera.matrix,0),di.setFromMatrixColumn(this._camera.matrix,1),ui.multiplyScalar(e),di.multiplyScalar(-t);const n=Te.copy(ui).add(di),r=Oe.copy(this._targetEnd).add(n);return this.moveTo(r.x,r.y,r.z,i)}forward(e,t=!1){Te.setFromMatrixColumn(this._camera.matrix,0),Te.crossVectors(this._camera.up,Te),Te.multiplyScalar(e);const i=Oe.copy(this._targetEnd).add(Te);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return Te.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+Te.x,this._targetEnd.y+Te.y,this._targetEnd.z+Te.z,t)}moveTo(e,t,i,n=!1){this._isUserControllingTruck=!1;const r=Te.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,r,this.boundaryFriction),this._needsUpdate=!0,n||this._target.copy(this._targetEnd);const o=!n||De(this._target.x,this._targetEnd.x,this.restThreshold)&&De(this._target.y,this._targetEnd.y,this.restThreshold)&&De(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,i,n=!1){const r=Te.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(r.x,r.y,r.z,n)}fitToBox(e,t,{cover:i=!1,paddingLeft:n=0,paddingRight:r=0,paddingBottom:o=0,paddingTop:a=0}={}){const l=[],h=e.isBox3?Es.copy(e):Es.setFromObject(e);h.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const d=Ld(this._sphericalEnd.theta,Md),p=Ld(this._sphericalEnd.phi,Md);l.push(this.rotateTo(d,p,t));const f=Te.setFromSpherical(this._sphericalEnd).normalize(),g=zd.setFromUnitVectors(f,Lc),v=De(Math.abs(f.y),1);v&&g.multiply(Nc.setFromAxisAngle(ma,d)),g.multiply(this._yAxisUpSpaceInverse);const b=Bd.makeEmpty();Oe.copy(h.min).applyQuaternion(g),b.expandByPoint(Oe),Oe.copy(h.min).setX(h.max.x).applyQuaternion(g),b.expandByPoint(Oe),Oe.copy(h.min).setY(h.max.y).applyQuaternion(g),b.expandByPoint(Oe),Oe.copy(h.max).setZ(h.min.z).applyQuaternion(g),b.expandByPoint(Oe),Oe.copy(h.min).setZ(h.max.z).applyQuaternion(g),b.expandByPoint(Oe),Oe.copy(h.max).setY(h.min.y).applyQuaternion(g),b.expandByPoint(Oe),Oe.copy(h.max).setX(h.min.x).applyQuaternion(g),b.expandByPoint(Oe),Oe.copy(h.max).applyQuaternion(g),b.expandByPoint(Oe),b.min.x-=n,b.min.y-=o,b.max.x+=r,b.max.y+=a,g.setFromUnitVectors(Lc,f),v&&g.premultiply(Nc.invert()),g.premultiply(this._yAxisUpSpace);const w=b.getSize(Te),T=b.getCenter(Oe).applyQuaternion(g);if(Cn(this._camera)){const S=this.getDistanceToFitBox(w.x,w.y,w.z,i);l.push(this.moveTo(T.x,T.y,T.z,t)),l.push(this.dollyTo(S,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(Qi(this._camera)){const S=this._camera,_=S.right-S.left,I=S.top-S.bottom,P=i?Math.max(_/w.x,I/w.y):Math.min(_/w.x,I/w.y);l.push(this.moveTo(T.x,T.y,T.z,t)),l.push(this.zoomTo(P,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const i=[],n=e instanceof be.Sphere?Dc.copy(e):lh.createBoundingSphere(e,Dc);if(i.push(this.moveTo(n.center.x,n.center.y,n.center.z,t)),Cn(this._camera)){const r=this.getDistanceToFitSphere(n.radius);i.push(this.dollyTo(r,t))}else if(Qi(this._camera)){const r=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,a=2*n.radius,l=Math.min(r/a,o/a);i.push(this.zoomTo(l,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,n,r,o,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=gs.NONE,this._changedDolly=0;const l=Oe.set(n,r,o),h=Te.set(e,t,i);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(h.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const d=!a||De(this._target.x,this._targetEnd.x,this.restThreshold)&&De(this._target.y,this._targetEnd.y,this.restThreshold)&&De(this._target.z,this._targetEnd.z,this.restThreshold)&&De(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&De(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&De(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(d)}lerpLookAt(e,t,i,n,r,o,a,l,h,d,p,f,g,v=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=gs.NONE,this._changedDolly=0;const b=Te.set(n,r,o),w=Oe.set(e,t,i);zt.setFromVector3(w.sub(b).applyQuaternion(this._yAxisUpSpace));const T=ys.set(d,p,f),S=Oe.set(a,l,h);xr.setFromVector3(S.sub(T).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(b.lerp(T,g));const _=xr.theta-zt.theta,I=xr.phi-zt.phi,P=xr.radius-zt.radius;this._sphericalEnd.set(zt.radius+P*g,zt.phi+I*g,zt.theta+_*g),this.normalizeRotations(),this._needsUpdate=!0,v||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const M=!v||De(this._target.x,this._targetEnd.x,this.restThreshold)&&De(this._target.y,this._targetEnd.y,this.restThreshold)&&De(this._target.z,this._targetEnd.z,this.restThreshold)&&De(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&De(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&De(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(M)}setPosition(e,t,i,n=!1){return this.setLookAt(e,t,i,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,n)}setTarget(e,t,i,n=!1){const r=this.getPosition(Te),o=this.setLookAt(r.x,r.y,r.z,e,t,i,n);return this._sphericalEnd.phi=ti(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,i,n=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,i),this._needsUpdate=!0,n||this._focalOffset.copy(this._focalOffsetEnd);const r=!n||De(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&De(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&De(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),ui.setFromMatrixColumn(this._camera.matrixWorldInverse,0),di.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Tn.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const n=Te.set(e,t,i),r=n.distanceTo(this._camera.position),o=n.sub(this._camera.position);ui.multiplyScalar(o.x),di.multiplyScalar(o.y),Tn.multiplyScalar(o.z),Te.copy(ui).add(di).add(Tn),Te.z=Te.z+r,this.dollyTo(r,!1),this.setFocalOffset(-Te.x,Te.y,-Te.z,!1),this.moveTo(e,t,i,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,i,n){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new be.Vector4,typeof e=="number"?this._viewport.set(e,t,i,n):this._viewport.copy(e)}getDistanceToFitBox(e,t,i,n=!1){if(Mc(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const r=e/t,o=this._camera.getEffectiveFOV()*wr,a=this._camera.aspect;return((n?r>a:rt.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,i){const n=t.lengthSq();if(n===0)return e;const r=Oe.copy(t).add(e),o=this._boundary.clampPoint(r,ys).sub(r),a=o.lengthSq();if(a===0)return e.add(t);if(a===n)return e;if(i===0)return e.add(t).add(o);{const l=1+i*a/t.dot(o);return e.add(Oe.copy(t).multiplyScalar(l)).add(o.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(Cn(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*wr,n=Math.tan(i*.5)*t,r=n*e.aspect;this._nearPlaneCorners[0].set(-r,-n,0),this._nearPlaneCorners[1].set(r,-n,0),this._nearPlaneCorners[2].set(r,n,0),this._nearPlaneCorners[3].set(-r,n,0)}else if(Qi(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,n=e.right*t,r=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(i,r,0),this._nearPlaneCorners[1].set(n,r,0),this._nearPlaneCorners[2].set(n,o,0),this._nearPlaneCorners[3].set(i,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Mc(this._camera,"_collisionTest"))return e;const t=this._getTargetDirection(Tr);Uc.lookAt(Nd,t,this._camera.up);for(let i=0;i<4;i++){const n=Oe.copy(this._nearPlaneCorners[i]);n.applyMatrix4(Uc);const r=ys.addVectors(this._target,n);ga.set(r,t),ga.far=this._spherical.radius+1;const o=ga.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance{const i=()=>{this.removeEventListener("rest",i),t()};this.addEventListener("rest",i)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new be.Sphere){const i=t,n=i.center;Es.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&Es.expandByObject(o)}),Es.getCenter(n);let r=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const a=o,l=a.geometry.clone();l.applyMatrix4(a.matrixWorld);const h=l.attributes.position;for(let d=0,p=h.count;d{var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof jn){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const i=this.currentWorld.renderer.getSize();this.three.aspect=i.width/i.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}}),this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:t,world:i})=>{if(t==="added"){const n=this.newCameraControls();this._allControls.set(i.uuid,n)}if(t==="removed"){const n=this._allControls.get(i.uuid);n&&(n.dispose(),this._allControls.delete(i.uuid))}})}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const e=this._allControls.get(this.currentWorld.uuid);if(!e)throw new Error("Controls not found!");return e}get enabled(){return this.currentWorld===null?!1:this.controls.enabled}set enabled(e){this.controls.enabled=e}dispose(){this.setupEvents(!1),this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[e,t]of this._allControls)t.dispose()}update(e){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(e),this.onAfterUpdate.trigger(this))}setupCamera(){const e=window.innerWidth/window.innerHeight,t=new Ov(60,e,1,1e3);return t.position.set(50,50,50),t.lookAt(new O(0,0,0)),t}newCameraControls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");if(!this.currentWorld.renderer)throw new Error("This camera needs a renderer to work!");Mt.install({THREE:jf.getSubsetOfThree()});const{domElement:e}=this.currentWorld.renderer.three,t=new Mt(this.three,e);return t.smoothTime=.2,t.dollyToCursor=!0,t.infinityDolly=!0,t}setupEvents(e){e?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:Fv,Vector2:Ve,Vector3:O,Vector4:Vs,Quaternion:Vt,Matrix4:Ee,Spherical:Mv,Box3:Ke,Sphere:Gn,Raycaster:io,MathUtils:so}}};const Wf=class Xf extends Re{constructor(e){super(e),A(this,"onAfterUpdate",new $),A(this,"onBeforeUpdate",new $),A(this,"onDisposed",new $),A(this,"onWorldCreated",new $),A(this,"onWorldDeleted",new $),A(this,"list",new Map),A(this,"enabled",!0),e.add(Xf.uuid,this)}create(){const e=new R1(this.components),t=e.uuid;if(this.list.has(t))throw new Error("There is already a world with this name!");return this.list.set(t,e),this.onWorldCreated.trigger(e),e}delete(e){const t=e.uuid;this.list.delete(e.uuid),e.dispose(),this.onWorldDeleted.trigger(t)}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}update(e){if(this.enabled)for(const[t,i]of this.list)i.update(e)}};A(Wf,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let D1=Wf;class N1{constructor(e,t,i){A(this,"onDisposed",new $),A(this,"world"),A(this,"components"),A(this,"three"),A(this,"_fade",3),A(this,"updateZoom",()=>{this.world.camera instanceof ch&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)}),this.world=t;const{color:n,size1:r,size2:o,distance:a}=i;this.components=e;const l=new ul(2,2,1,1),h=new wt({side:no,uniforms:{uSize1:{value:r},uSize2:{value:o},uColor:{value:n},uDistance:{value:a},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:` varying vec3 worldPosition; @@ -68,7 +68,7 @@ var gv=Object.defineProperty;var vv=(s,e,t)=>e in s?gv(s,e,{enumerable:!0,config } - `,extensions:{derivatives:!0}});this.three=new le(l,h),this.three.frustumCulled=!1,t.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(e){e?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(e){this._fade=e?3:0,this.material.uniforms.uFade.value=this._fade}[Symbol.dispose](){throw new Error("Method not implemented.")}dispose(){this.setupEvents(!1),this.components.get(Fi).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(e){if(!(this.world.camera instanceof ch))return;const t=this.world.camera.controls;e?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}class U1 extends Re{constructor(){super(...arguments),A(this,"list",new Map),A(this,"onDisposed",new ee),A(this,"config",{color:new Rt(12303291),size1:1,size2:10,distance:500}),A(this,"enabled",!0)}create(e){if(this.list.has(e.uuid))throw new Error("This world already has a grid!");const t=new N1(this.components,e,this.config);return this.list.set(e.uuid,t),e.onDisposed.add(()=>{this.delete(e)}),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}}A(U1,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");const xn=new io,bt=new O,Ki=new O,qe=new Vt,Vd={X:new O(1,0,0),Y:new O(0,1,0),Z:new O(0,0,1)},kc={type:"change"},Hd={type:"mouseDown"},Yd={type:"mouseUp",mode:null},Gd={type:"objectChange"};class k1 extends kn{constructor(e,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const i=new G1;this._gizmo=i,this.add(i);const n=new j1;this._plane=n,this.add(n);const r=this;function o(S,_){let I=_;Object.defineProperty(r,S,{get:function(){return I!==void 0?I:_},set:function(P){I!==P&&(I=P,n[S]=P,i[S]=P,r.dispatchEvent({type:S+"-changed",value:P}),r.dispatchEvent(kc))}}),r[S]=_,n[S]=_,i[S]=_}o("camera",e),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const a=new O,l=new O,h=new Vt,d=new Vt,p=new O,f=new Vt,g=new O,v=new O,b=new O,w=0,T=new O;o("worldPosition",a),o("worldPositionStart",l),o("worldQuaternion",h),o("worldQuaternionStart",d),o("cameraPosition",p),o("cameraQuaternion",f),o("pointStart",g),o("pointEnd",v),o("rotationAxis",b),o("rotationAngle",w),o("eye",T),this._offset=new O,this._startNorm=new O,this._endNorm=new O,this._cameraScale=new O,this._parentPosition=new O,this._parentQuaternion=new Vt,this._parentQuaternionInv=new Vt,this._parentScale=new O,this._worldScaleStart=new O,this._worldQuaternionInv=new Vt,this._worldScale=new O,this._positionStart=new O,this._quaternionStart=new Vt,this._scaleStart=new O,this._getPointer=B1.bind(this),this._onPointerDown=V1.bind(this),this._onPointerHover=z1.bind(this),this._onPointerMove=H1.bind(this),this._onPointerUp=Y1.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;xn.setFromCamera(e,this.camera);const t=Bc(this._gizmo.picker[this.mode],xn);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e.button!==0)&&this.axis!==null){xn.setFromCamera(e,this.camera);const t=Bc(this._plane,xn,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,Hd.mode=this.mode,this.dispatchEvent(Hd)}}pointerMove(e){const t=this.axis,i=this.mode,n=this.object;let r=this.space;if(i==="scale"?r="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(r="world"),n===void 0||t===null||this.dragging===!1||e.button!==-1)return;xn.setFromCamera(e,this.camera);const o=Bc(this._plane,xn,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),r==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),r==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(r==="local"&&(n.position.applyQuaternion(qe.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),r==="world"&&(n.parent&&n.position.add(bt.setFromMatrixPosition(n.parent.matrixWorld)),t.search("X")!==-1&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(bt.setFromMatrixPosition(n.parent.matrixWorld))));else if(i==="scale"){if(t.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),Ki.set(a,a,a)}else bt.copy(this.pointStart),Ki.copy(this.pointEnd),bt.applyQuaternion(this._worldQuaternionInv),Ki.applyQuaternion(this._worldQuaternionInv),Ki.divide(bt),t.search("X")===-1&&(Ki.x=1),t.search("Y")===-1&&(Ki.y=1),t.search("Z")===-1&&(Ki.z=1);n.scale.copy(this._scaleStart).multiply(Ki),this.scaleSnap&&(t.search("X")!==-1&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(i==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(bt.setFromMatrixPosition(this.camera.matrixWorld));let l=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(bt.copy(this.rotationAxis).cross(this.eye))*a):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Vd[t]),bt.copy(Vd[t]),r==="local"&&bt.applyQuaternion(this.worldQuaternion),bt.cross(this.eye),bt.length()===0?l=!0:this.rotationAngle=this._offset.dot(bt.normalize())*a),(t==="E"||l)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),r==="local"&&t!=="E"&&t!=="XYZE"?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(qe.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(qe.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(kc),this.dispatchEvent(Gd)}}pointerUp(e){e.button===0&&(this.dragging&&this.axis!==null&&(Yd.mode=this.mode,this.dispatchEvent(Yd)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(kc),this.dispatchEvent(Gd),this.pointStart.copy(this.pointEnd))}getRaycaster(){return xn}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function B1(s){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:s.button};{const e=this.domElement.getBoundingClientRect();return{x:(s.clientX-e.left)/e.width*2-1,y:-(s.clientY-e.top)/e.height*2+1,button:s.button}}}function z1(s){if(this.enabled)switch(s.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(s));break}}function V1(s){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(s.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(s)),this.pointerDown(this._getPointer(s)))}function H1(s){this.enabled&&this.pointerMove(this._getPointer(s))}function Y1(s){this.enabled&&(this.domElement.releasePointerCapture(s.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(s)))}function Bc(s,e,t){const i=e.intersectObject(s,!0);for(let n=0;n.9&&(r.visible=!1)),this.axis==="Y"&&(qe.setFromEuler(va.set(0,0,Math.PI/2)),r.quaternion.copy(t).multiply(qe),Math.abs(ze.copy(Pn).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Z"&&(qe.setFromEuler(va.set(0,Math.PI/2,0)),r.quaternion.copy(t).multiply(qe),Math.abs(ze.copy(Fr).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="XYZE"&&(qe.setFromEuler(va.set(0,Math.PI/2,0)),ze.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix(Wd.lookAt(jd,ze,Pn)),r.quaternion.multiply(qe),r.visible=this.dragging),this.axis==="E"&&(r.visible=!1)):r.name==="START"?(r.position.copy(this.worldPositionStart),r.visible=this.dragging):r.name==="END"?(r.position.copy(this.worldPosition),r.visible=this.dragging):r.name==="DELTA"?(r.position.copy(this.worldPositionStart),r.quaternion.copy(this.worldQuaternionStart),bt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),bt.applyQuaternion(this.worldQuaternionStart.clone().invert()),r.scale.copy(bt),r.visible=this.dragging):(r.quaternion.copy(t),this.dragging?r.position.copy(this.worldPositionStart):r.position.copy(this.worldPosition),this.axis&&(r.visible=this.axis.search(r.name)!==-1));continue}r.quaternion.copy(t),this.mode==="translate"||this.mode==="scale"?(r.name==="X"&&Math.abs(ze.copy(Or).applyQuaternion(t).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Y"&&Math.abs(ze.copy(Pn).applyQuaternion(t).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Z"&&Math.abs(ze.copy(Fr).applyQuaternion(t).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XY"&&Math.abs(ze.copy(Fr).applyQuaternion(t).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="YZ"&&Math.abs(ze.copy(Or).applyQuaternion(t).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XZ"&&Math.abs(ze.copy(Pn).applyQuaternion(t).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1)):this.mode==="rotate"&&(ya.copy(t),ze.copy(this.eye).applyQuaternion(qe.copy(t).invert()),r.name.search("E")!==-1&&r.quaternion.setFromRotationMatrix(Wd.lookAt(this.eye,jd,Pn)),r.name==="X"&&(qe.setFromAxisAngle(Or,Math.atan2(-ze.y,ze.z)),qe.multiplyQuaternions(ya,qe),r.quaternion.copy(qe)),r.name==="Y"&&(qe.setFromAxisAngle(Pn,Math.atan2(ze.x,ze.z)),qe.multiplyQuaternions(ya,qe),r.quaternion.copy(qe)),r.name==="Z"&&(qe.setFromAxisAngle(Fr,Math.atan2(ze.y,ze.x)),qe.multiplyQuaternions(ya,qe),r.quaternion.copy(qe))),r.visible=r.visible&&(r.name.indexOf("X")===-1||this.showX),r.visible=r.visible&&(r.name.indexOf("Y")===-1||this.showY),r.visible=r.visible&&(r.name.indexOf("Z")===-1||this.showZ),r.visible=r.visible&&(r.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),r.material._color=r.material._color||r.material.color.clone(),r.material._opacity=r.material._opacity||r.material.opacity,r.material.color.copy(r.material._color),r.material.opacity=r.material._opacity,this.enabled&&this.axis&&(r.name===this.axis||this.axis.split("").some(function(a){return r.name===a}))&&(r.material.color.setHex(16776960),r.material.opacity=1)}super.updateMatrixWorld(e)}}class j1 extends le{constructor(){super(new ul(1e5,1e5,2,2),new Xt({visible:!1,wireframe:!0,side:no,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),Ea.copy(Or).applyQuaternion(t==="local"?this.worldQuaternion:Da),Ar.copy(Pn).applyQuaternion(t==="local"?this.worldQuaternion:Da),Sr.copy(Fr).applyQuaternion(t==="local"?this.worldQuaternion:Da),ze.copy(Ar),this.mode){case"translate":case"scale":switch(this.axis){case"X":ze.copy(this.eye).cross(Ea),pi.copy(Ea).cross(ze);break;case"Y":ze.copy(this.eye).cross(Ar),pi.copy(Ar).cross(ze);break;case"Z":ze.copy(this.eye).cross(Sr),pi.copy(Sr).cross(ze);break;case"XY":pi.copy(Sr);break;case"YZ":pi.copy(Ea);break;case"XZ":ze.copy(Sr),pi.copy(Ar);break;case"XYZ":case"E":pi.set(0,0,0);break}break;case"rotate":default:pi.set(0,0,0)}pi.length()===0?this.quaternion.copy(this.cameraQuaternion):(Xd.lookAt(bt.set(0,0,0),pi,ze),this.quaternion.setFromRotationMatrix(Xd)),super.updateMatrixWorld(e)}}let Kf=class Qf{constructor(e,t,i,n,r,o=5,a=!0){if(A(this,"onDraggingStarted",new ee),A(this,"onDraggingEnded",new ee),A(this,"onDisposed",new ee),A(this,"normal"),A(this,"origin"),A(this,"three",new an),A(this,"_helper"),A(this,"_visible",!0),A(this,"_enabled",!0),A(this,"components"),A(this,"world"),A(this,"_controlsActive",!1),A(this,"_arrowBoundBox",new le),A(this,"_planeMesh"),A(this,"_controls"),A(this,"_hiddenMaterial",new Xt({visible:!1})),A(this,"update",()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)}),A(this,"changeDrag",l=>{this._visible=!l.value,this.preventCameraMovement(),this.notifyDraggingChanged(l)}),this.components=e,this.world=t,!t.renderer)throw new Error("The given world must have a renderer!");this.normal=n,this.origin=i,t.renderer.setPlane(!0,this.three),this._planeMesh=Qf.newPlaneMesh(o,r),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(n,i),a&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(e){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=e,this.world.renderer.setPlane(e,this.three)}get visible(){return this._visible}set visible(e){this._visible=e,this._controls.visible=e,this._helper.visible=e,this.toggleControls(e)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(e){this._planeMesh.material=e}get size(){return this._planeMesh.scale.x}set size(e){this._planeMesh.scale.set(e,e,e)}get helper(){return this._helper}setFromNormalAndCoplanarPoint(e,t){this.reset(),this.normal.equals(e)||(this.normal.copy(e),this._helper.lookAt(e)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix(),this.update()}dispose(){this._enabled=!1,this.onDraggingStarted.reset(),this.onDraggingEnded.reset(),this._helper.removeFromParent(),this.world.renderer&&this.world.renderer.setPlane(!1,this.three),this._arrowBoundBox.removeFromParent(),this._arrowBoundBox.geometry.dispose(),this._planeMesh.geometry.dispose(),this._controls.removeFromParent(),this._controls.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}reset(){const e=new O(1,0,0),t=new O;this.normal.equals(e)||(this.normal.copy(e),this._helper.lookAt(e)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix()}toggleControls(e){if(e){if(this._controlsActive)return;this._controls.addEventListener("change",this.update),this._controls.addEventListener("dragging-changed",this.changeDrag)}else this._controls.removeEventListener("change",this.update),this._controls.removeEventListener("dragging-changed",this.changeDrag);this._controlsActive=e}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const e=this.world.camera.three,t=this.world.renderer.three.domElement,i=new k1(e,t);return this.initializeControls(i),this.world.scene.three.add(i),i}initializeControls(e){e.attach(this._helper),e.showX=!1,e.showY=!1,e.setSpace("local"),this.createArrowBoundingBox(),e.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new Tt(.18,.18,1.2),this._arrowBoundBox.material=this._hiddenMaterial,this._arrowBoundBox.rotateX(Math.PI/2),this._arrowBoundBox.updateMatrix(),this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix)}notifyDraggingChanged(e){e.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const e=new kn;return e.lookAt(this.normal),e.position.copy(this.origin),this._planeMesh.position.z+=.01,e.add(this._planeMesh),this.world.scene.three.add(e),e}static newPlaneMesh(e,t){const i=new ul(1),n=new le(i,t);return n.scale.set(e,e,e),n}};const Zf=class hh extends Re{constructor(e){super(e),A(this,"onAfterCreate",new ee),A(this,"onAfterDelete",new ee),A(this,"onBeforeDrag",new ee),A(this,"onAfterDrag",new ee),A(this,"onBeforeCreate",new ee),A(this,"onBeforeCancel",new ee),A(this,"onAfterCancel",new ee),A(this,"onBeforeDelete",new ee),A(this,"onDisposed",new ee),A(this,"orthogonalY",!1),A(this,"toleranceOrthogonalY",.7),A(this,"Type",Kf),A(this,"list",[]),A(this,"_material",new Xt({color:12255487,side:no,transparent:!0,opacity:.2})),A(this,"_size",5),A(this,"_enabled",!1),A(this,"_visible",!0),A(this,"_onStartDragging",()=>{this.onBeforeDrag.trigger()}),A(this,"_onEndDragging",()=>{this.onAfterDrag.trigger()}),this.components.add(hh.uuid,this)}get enabled(){return this._enabled}set enabled(e){this._enabled=e;for(const t of this.list)t.enabled=e;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(e){this._visible=e;for(const t of this.list)t.visible=e}get material(){return this._material}set material(e){this._material=e;for(const t of this.list)t.planeMaterial=e}get size(){return this._size}set size(e){this._size=e;for(const t of this.list)t.size=e}dispose(){this._enabled=!1;for(const e of this.list)e.dispose();this.list.length=0,this._material.dispose(),this.onBeforeCreate.reset(),this.onBeforeCancel.reset(),this.onBeforeDelete.reset(),this.onBeforeDrag.reset(),this.onAfterCreate.reset(),this.onAfterCancel.reset(),this.onAfterDelete.reset(),this.onAfterDrag.reset(),this.onDisposed.trigger(hh.uuid),this.onDisposed.reset()}create(e){if(!this.enabled)return;const t=this.components.get(ni).get(e).castRay();t&&this.createPlaneFromIntersection(e,t)}createFromNormalAndCoplanarPoint(e,t,i){const n=this.newPlane(e,i,t);return this.updateMaterialsAndPlanes(),n}delete(e,t){this.enabled&&(t||(t=this.pickPlane(e)),t&&this.deletePlane(t))}deleteAll(){for(;this.list.length>0;){const e=this.list[0];this.delete(e.world,e)}}deletePlane(e){const t=this.list.indexOf(e);if(t!==-1){if(this.list.splice(t,1),!e.world.renderer)throw new Error("Renderer not found for this plane's world!");e.world.renderer.setPlane(!1,e.three),e.dispose(),this.updateMaterialsAndPlanes(),this.onAfterDelete.trigger(e)}}pickPlane(e){const t=this.components.get(ni).get(e),i=this.getAllPlaneMeshes(),n=t.castRay(i);if(n){const r=n.object;return this.list.find(o=>o.meshes.includes(r))}}getAllPlaneMeshes(){const e=[];for(const t of this.list)e.push(...t.meshes);return e}createPlaneFromIntersection(e,t){var i;if(!e.renderer)throw new Error("The given world must have a renderer!");const n=t.point.distanceTo(new O(0,0,0)),r=(i=t.face)==null?void 0:i.normal;if(!n||!r)return;const o=this.getWorldNormal(t,r),a=this.newPlane(e,t.point,o.negate());a.visible=this._visible,a.size=this._size,e.renderer.setPlane(!0,a.three),this.updateMaterialsAndPlanes()}getWorldNormal(e,t){const i=e.object;let n=e.object.matrixWorld.clone();if(i instanceof Kt&&e.instanceId!==void 0){const a=new Ee;i.getMatrixAt(e.instanceId,a),n=a.multiply(n)}const r=new Fn().getNormalMatrix(n),o=t.clone().applyMatrix3(r).normalize();return this.normalizePlaneDirectionY(o),o}normalizePlaneDirectionY(e){this.orthogonalY&&(e.y>this.toleranceOrthogonalY&&(e.x=0,e.y=1,e.z=0),e.y<-this.toleranceOrthogonalY&&(e.x=0,e.y=-1,e.z=0))}newPlane(e,t,i){const n=new this.Type(this.components,e,t,i,this._material);return n.onDraggingStarted.add(this._onStartDragging),n.onDraggingEnded.add(this._onEndDragging),this.list.push(n),this.onAfterCreate.trigger(n),n}updateMaterialsAndPlanes(){const e=this.components.get(D1);for(const[t,i]of e.list){if(!i.renderer)continue;i.renderer.updateClippingPlanes();const{clippingPlanes:n}=i.renderer;for(const r of i.meshes)if(Array.isArray(r.material))for(const o of r.material)o.clippingPlanes=n;else r.material.clippingPlanes=n}}};A(Zf,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let Ga=Zf;function W1(s,e,t,i){return new Promise((n,r)=>{function o(){const a=s.clientWaitSync(e,t,0);if(a===s.WAIT_FAILED){r();return}if(a===s.TIMEOUT_EXPIRED){setTimeout(o,i);return}n()}o()})}async function X1(s,e,t,i,n,r,o){const a=s.fenceSync(s.SYNC_GPU_COMMANDS_COMPLETE,0);s.flush(),await W1(s,a,0,10),s.deleteSync(a),s.bindBuffer(e,t),s.getBufferSubData(e,i,n,r,o),s.bindBuffer(e,null)}async function K1(s,e,t,i,n,r,o,a){const l=s.createBuffer();return s.bindBuffer(s.PIXEL_PACK_BUFFER,l),s.bufferData(s.PIXEL_PACK_BUFFER,a.byteLength,s.STREAM_READ),s.readPixels(e,t,i,n,r,o,0),s.bindBuffer(s.PIXEL_PACK_BUFFER,null),await X1(s,s.PIXEL_PACK_BUFFER,l,0,a),s.deleteBuffer(l),a}let qf=class{constructor(e,t,i){if(A(this,"onDisposed",new ee),A(this,"onViewUpdated",new $i),A(this,"enabled",!0),A(this,"needsUpdate",!1),A(this,"renderDebugFrame",!1),A(this,"components"),A(this,"world"),A(this,"renderer"),A(this,"autoUpdate",!0),A(this,"updateInterval",1e3),A(this,"worker"),A(this,"scene",new Xn),A(this,"_width",512),A(this,"_height",512),A(this,"_availableColor",1),A(this,"renderTarget"),A(this,"bufferSize"),A(this,"_buffer"),A(this,"_isWorkerBusy",!1),A(this,"updateVisibility",async o=>{if(!this.enabled||!this.needsUpdate&&!o||this._isWorkerBusy)return;this._isWorkerBusy=!0;const a=this.world.camera.three;a.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,a);const l=this.renderer.getContext();await K1(l,0,0,this._width,this._height,l.RGBA,l.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,a),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1}),!t.renderer)throw new Error("The given world must have a renderer!");this.components=e,this.applySettings(i),this.world=t,this.renderer=new Ha,this.renderTarget=new Ri(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const n=` + `,extensions:{derivatives:!0}});this.three=new le(l,h),this.three.frustumCulled=!1,t.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(e){e?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(e){this._fade=e?3:0,this.material.uniforms.uFade.value=this._fade}[Symbol.dispose](){throw new Error("Method not implemented.")}dispose(){this.setupEvents(!1),this.components.get(Fi).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(e){if(this.world.isDisposing||!(this.world.camera instanceof ch))return;const t=this.world.camera.controls;e?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}class U1 extends Re{constructor(){super(...arguments),A(this,"list",new Map),A(this,"onDisposed",new $),A(this,"config",{color:new Rt(12303291),size1:1,size2:10,distance:500}),A(this,"enabled",!0)}create(e){if(this.list.has(e.uuid))throw new Error("This world already has a grid!");const t=new N1(this.components,e,this.config);return this.list.set(e.uuid,t),e.onDisposed.add(()=>{this.delete(e)}),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}}A(U1,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");const xn=new io,bt=new O,Ki=new O,qe=new Vt,Vd={X:new O(1,0,0),Y:new O(0,1,0),Z:new O(0,0,1)},kc={type:"change"},Hd={type:"mouseDown"},Yd={type:"mouseUp",mode:null},Gd={type:"objectChange"};class k1 extends kn{constructor(e,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const i=new G1;this._gizmo=i,this.add(i);const n=new j1;this._plane=n,this.add(n);const r=this;function o(S,_){let I=_;Object.defineProperty(r,S,{get:function(){return I!==void 0?I:_},set:function(P){I!==P&&(I=P,n[S]=P,i[S]=P,r.dispatchEvent({type:S+"-changed",value:P}),r.dispatchEvent(kc))}}),r[S]=_,n[S]=_,i[S]=_}o("camera",e),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const a=new O,l=new O,h=new Vt,d=new Vt,p=new O,f=new Vt,g=new O,v=new O,b=new O,w=0,T=new O;o("worldPosition",a),o("worldPositionStart",l),o("worldQuaternion",h),o("worldQuaternionStart",d),o("cameraPosition",p),o("cameraQuaternion",f),o("pointStart",g),o("pointEnd",v),o("rotationAxis",b),o("rotationAngle",w),o("eye",T),this._offset=new O,this._startNorm=new O,this._endNorm=new O,this._cameraScale=new O,this._parentPosition=new O,this._parentQuaternion=new Vt,this._parentQuaternionInv=new Vt,this._parentScale=new O,this._worldScaleStart=new O,this._worldQuaternionInv=new Vt,this._worldScale=new O,this._positionStart=new O,this._quaternionStart=new Vt,this._scaleStart=new O,this._getPointer=B1.bind(this),this._onPointerDown=V1.bind(this),this._onPointerHover=z1.bind(this),this._onPointerMove=H1.bind(this),this._onPointerUp=Y1.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;xn.setFromCamera(e,this.camera);const t=Bc(this._gizmo.picker[this.mode],xn);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e.button!==0)&&this.axis!==null){xn.setFromCamera(e,this.camera);const t=Bc(this._plane,xn,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,Hd.mode=this.mode,this.dispatchEvent(Hd)}}pointerMove(e){const t=this.axis,i=this.mode,n=this.object;let r=this.space;if(i==="scale"?r="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(r="world"),n===void 0||t===null||this.dragging===!1||e.button!==-1)return;xn.setFromCamera(e,this.camera);const o=Bc(this._plane,xn,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),r==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),r==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(r==="local"&&(n.position.applyQuaternion(qe.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),r==="world"&&(n.parent&&n.position.add(bt.setFromMatrixPosition(n.parent.matrixWorld)),t.search("X")!==-1&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(bt.setFromMatrixPosition(n.parent.matrixWorld))));else if(i==="scale"){if(t.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),Ki.set(a,a,a)}else bt.copy(this.pointStart),Ki.copy(this.pointEnd),bt.applyQuaternion(this._worldQuaternionInv),Ki.applyQuaternion(this._worldQuaternionInv),Ki.divide(bt),t.search("X")===-1&&(Ki.x=1),t.search("Y")===-1&&(Ki.y=1),t.search("Z")===-1&&(Ki.z=1);n.scale.copy(this._scaleStart).multiply(Ki),this.scaleSnap&&(t.search("X")!==-1&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(i==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(bt.setFromMatrixPosition(this.camera.matrixWorld));let l=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(bt.copy(this.rotationAxis).cross(this.eye))*a):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Vd[t]),bt.copy(Vd[t]),r==="local"&&bt.applyQuaternion(this.worldQuaternion),bt.cross(this.eye),bt.length()===0?l=!0:this.rotationAngle=this._offset.dot(bt.normalize())*a),(t==="E"||l)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),r==="local"&&t!=="E"&&t!=="XYZE"?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(qe.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(qe.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(kc),this.dispatchEvent(Gd)}}pointerUp(e){e.button===0&&(this.dragging&&this.axis!==null&&(Yd.mode=this.mode,this.dispatchEvent(Yd)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(kc),this.dispatchEvent(Gd),this.pointStart.copy(this.pointEnd))}getRaycaster(){return xn}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function B1(s){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:s.button};{const e=this.domElement.getBoundingClientRect();return{x:(s.clientX-e.left)/e.width*2-1,y:-(s.clientY-e.top)/e.height*2+1,button:s.button}}}function z1(s){if(this.enabled)switch(s.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(s));break}}function V1(s){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(s.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(s)),this.pointerDown(this._getPointer(s)))}function H1(s){this.enabled&&this.pointerMove(this._getPointer(s))}function Y1(s){this.enabled&&(this.domElement.releasePointerCapture(s.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(s)))}function Bc(s,e,t){const i=e.intersectObject(s,!0);for(let n=0;n.9&&(r.visible=!1)),this.axis==="Y"&&(qe.setFromEuler(va.set(0,0,Math.PI/2)),r.quaternion.copy(t).multiply(qe),Math.abs(ze.copy(Pn).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Z"&&(qe.setFromEuler(va.set(0,Math.PI/2,0)),r.quaternion.copy(t).multiply(qe),Math.abs(ze.copy(Fr).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="XYZE"&&(qe.setFromEuler(va.set(0,Math.PI/2,0)),ze.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix(Wd.lookAt(jd,ze,Pn)),r.quaternion.multiply(qe),r.visible=this.dragging),this.axis==="E"&&(r.visible=!1)):r.name==="START"?(r.position.copy(this.worldPositionStart),r.visible=this.dragging):r.name==="END"?(r.position.copy(this.worldPosition),r.visible=this.dragging):r.name==="DELTA"?(r.position.copy(this.worldPositionStart),r.quaternion.copy(this.worldQuaternionStart),bt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),bt.applyQuaternion(this.worldQuaternionStart.clone().invert()),r.scale.copy(bt),r.visible=this.dragging):(r.quaternion.copy(t),this.dragging?r.position.copy(this.worldPositionStart):r.position.copy(this.worldPosition),this.axis&&(r.visible=this.axis.search(r.name)!==-1));continue}r.quaternion.copy(t),this.mode==="translate"||this.mode==="scale"?(r.name==="X"&&Math.abs(ze.copy(Or).applyQuaternion(t).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Y"&&Math.abs(ze.copy(Pn).applyQuaternion(t).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Z"&&Math.abs(ze.copy(Fr).applyQuaternion(t).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XY"&&Math.abs(ze.copy(Fr).applyQuaternion(t).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="YZ"&&Math.abs(ze.copy(Or).applyQuaternion(t).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XZ"&&Math.abs(ze.copy(Pn).applyQuaternion(t).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1)):this.mode==="rotate"&&(ya.copy(t),ze.copy(this.eye).applyQuaternion(qe.copy(t).invert()),r.name.search("E")!==-1&&r.quaternion.setFromRotationMatrix(Wd.lookAt(this.eye,jd,Pn)),r.name==="X"&&(qe.setFromAxisAngle(Or,Math.atan2(-ze.y,ze.z)),qe.multiplyQuaternions(ya,qe),r.quaternion.copy(qe)),r.name==="Y"&&(qe.setFromAxisAngle(Pn,Math.atan2(ze.x,ze.z)),qe.multiplyQuaternions(ya,qe),r.quaternion.copy(qe)),r.name==="Z"&&(qe.setFromAxisAngle(Fr,Math.atan2(ze.y,ze.x)),qe.multiplyQuaternions(ya,qe),r.quaternion.copy(qe))),r.visible=r.visible&&(r.name.indexOf("X")===-1||this.showX),r.visible=r.visible&&(r.name.indexOf("Y")===-1||this.showY),r.visible=r.visible&&(r.name.indexOf("Z")===-1||this.showZ),r.visible=r.visible&&(r.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),r.material._color=r.material._color||r.material.color.clone(),r.material._opacity=r.material._opacity||r.material.opacity,r.material.color.copy(r.material._color),r.material.opacity=r.material._opacity,this.enabled&&this.axis&&(r.name===this.axis||this.axis.split("").some(function(a){return r.name===a}))&&(r.material.color.setHex(16776960),r.material.opacity=1)}super.updateMatrixWorld(e)}}class j1 extends le{constructor(){super(new ul(1e5,1e5,2,2),new Xt({visible:!1,wireframe:!0,side:no,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),Ea.copy(Or).applyQuaternion(t==="local"?this.worldQuaternion:Da),Ar.copy(Pn).applyQuaternion(t==="local"?this.worldQuaternion:Da),Sr.copy(Fr).applyQuaternion(t==="local"?this.worldQuaternion:Da),ze.copy(Ar),this.mode){case"translate":case"scale":switch(this.axis){case"X":ze.copy(this.eye).cross(Ea),pi.copy(Ea).cross(ze);break;case"Y":ze.copy(this.eye).cross(Ar),pi.copy(Ar).cross(ze);break;case"Z":ze.copy(this.eye).cross(Sr),pi.copy(Sr).cross(ze);break;case"XY":pi.copy(Sr);break;case"YZ":pi.copy(Ea);break;case"XZ":ze.copy(Sr),pi.copy(Ar);break;case"XYZ":case"E":pi.set(0,0,0);break}break;case"rotate":default:pi.set(0,0,0)}pi.length()===0?this.quaternion.copy(this.cameraQuaternion):(Xd.lookAt(bt.set(0,0,0),pi,ze),this.quaternion.setFromRotationMatrix(Xd)),super.updateMatrixWorld(e)}}let Kf=class Qf{constructor(e,t,i,n,r,o=5,a=!0){if(A(this,"onDraggingStarted",new $),A(this,"onDraggingEnded",new $),A(this,"onDisposed",new $),A(this,"normal"),A(this,"origin"),A(this,"three",new an),A(this,"_helper"),A(this,"_visible",!0),A(this,"_enabled",!0),A(this,"components"),A(this,"world"),A(this,"_controlsActive",!1),A(this,"_arrowBoundBox",new le),A(this,"_planeMesh"),A(this,"_controls"),A(this,"_hiddenMaterial",new Xt({visible:!1})),A(this,"update",()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)}),A(this,"changeDrag",l=>{this._visible=!l.value,this.preventCameraMovement(),this.notifyDraggingChanged(l)}),this.components=e,this.world=t,!t.renderer)throw new Error("The given world must have a renderer!");this.normal=n,this.origin=i,t.renderer.setPlane(!0,this.three),this._planeMesh=Qf.newPlaneMesh(o,r),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(n,i),a&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(e){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=e,this.world.renderer.setPlane(e,this.three)}get visible(){return this._visible}set visible(e){this._visible=e,this._controls.visible=e,this._helper.visible=e,this.toggleControls(e)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(e){this._planeMesh.material=e}get size(){return this._planeMesh.scale.x}set size(e){this._planeMesh.scale.set(e,e,e)}get helper(){return this._helper}setFromNormalAndCoplanarPoint(e,t){this.reset(),this.normal.equals(e)||(this.normal.copy(e),this._helper.lookAt(e)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix(),this.update()}dispose(){this._enabled=!1,this.onDraggingStarted.reset(),this.onDraggingEnded.reset(),this._helper.removeFromParent(),this.world.renderer&&this.world.renderer.setPlane(!1,this.three),this._arrowBoundBox.removeFromParent(),this._arrowBoundBox.geometry.dispose(),this._planeMesh.geometry.dispose(),this._controls.removeFromParent(),this._controls.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}reset(){const e=new O(1,0,0),t=new O;this.normal.equals(e)||(this.normal.copy(e),this._helper.lookAt(e)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix()}toggleControls(e){if(e){if(this._controlsActive)return;this._controls.addEventListener("change",this.update),this._controls.addEventListener("dragging-changed",this.changeDrag)}else this._controls.removeEventListener("change",this.update),this._controls.removeEventListener("dragging-changed",this.changeDrag);this._controlsActive=e}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const e=this.world.camera.three,t=this.world.renderer.three.domElement,i=new k1(e,t);return this.initializeControls(i),this.world.scene.three.add(i),i}initializeControls(e){e.attach(this._helper),e.showX=!1,e.showY=!1,e.setSpace("local"),this.createArrowBoundingBox(),e.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new Tt(.18,.18,1.2),this._arrowBoundBox.material=this._hiddenMaterial,this._arrowBoundBox.rotateX(Math.PI/2),this._arrowBoundBox.updateMatrix(),this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix)}notifyDraggingChanged(e){e.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const e=new kn;return e.lookAt(this.normal),e.position.copy(this.origin),this._planeMesh.position.z+=.01,e.add(this._planeMesh),this.world.scene.three.add(e),e}static newPlaneMesh(e,t){const i=new ul(1),n=new le(i,t);return n.scale.set(e,e,e),n}};const Zf=class hh extends Re{constructor(e){super(e),A(this,"onAfterCreate",new $),A(this,"onAfterDelete",new $),A(this,"onBeforeDrag",new $),A(this,"onAfterDrag",new $),A(this,"onBeforeCreate",new $),A(this,"onBeforeCancel",new $),A(this,"onAfterCancel",new $),A(this,"onBeforeDelete",new $),A(this,"onDisposed",new $),A(this,"orthogonalY",!1),A(this,"toleranceOrthogonalY",.7),A(this,"Type",Kf),A(this,"list",[]),A(this,"_material",new Xt({color:12255487,side:no,transparent:!0,opacity:.2})),A(this,"_size",5),A(this,"_enabled",!1),A(this,"_visible",!0),A(this,"_onStartDragging",()=>{this.onBeforeDrag.trigger()}),A(this,"_onEndDragging",()=>{this.onAfterDrag.trigger()}),this.components.add(hh.uuid,this)}get enabled(){return this._enabled}set enabled(e){this._enabled=e;for(const t of this.list)t.enabled=e;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(e){this._visible=e;for(const t of this.list)t.visible=e}get material(){return this._material}set material(e){this._material=e;for(const t of this.list)t.planeMaterial=e}get size(){return this._size}set size(e){this._size=e;for(const t of this.list)t.size=e}dispose(){this._enabled=!1;for(const e of this.list)e.dispose();this.list.length=0,this._material.dispose(),this.onBeforeCreate.reset(),this.onBeforeCancel.reset(),this.onBeforeDelete.reset(),this.onBeforeDrag.reset(),this.onAfterCreate.reset(),this.onAfterCancel.reset(),this.onAfterDelete.reset(),this.onAfterDrag.reset(),this.onDisposed.trigger(hh.uuid),this.onDisposed.reset()}create(e){if(!this.enabled)return;const t=this.components.get(ni).get(e).castRay();t&&this.createPlaneFromIntersection(e,t)}createFromNormalAndCoplanarPoint(e,t,i){const n=this.newPlane(e,i,t);return this.updateMaterialsAndPlanes(),n}delete(e,t){this.enabled&&(t||(t=this.pickPlane(e)),t&&this.deletePlane(t))}deleteAll(){for(;this.list.length>0;){const e=this.list[0];this.delete(e.world,e)}}deletePlane(e){const t=this.list.indexOf(e);if(t!==-1){if(this.list.splice(t,1),!e.world.renderer)throw new Error("Renderer not found for this plane's world!");e.world.renderer.setPlane(!1,e.three),e.dispose(),this.updateMaterialsAndPlanes(),this.onAfterDelete.trigger(e)}}pickPlane(e){const t=this.components.get(ni).get(e),i=this.getAllPlaneMeshes(),n=t.castRay(i);if(n){const r=n.object;return this.list.find(o=>o.meshes.includes(r))}}getAllPlaneMeshes(){const e=[];for(const t of this.list)e.push(...t.meshes);return e}createPlaneFromIntersection(e,t){var i;if(!e.renderer)throw new Error("The given world must have a renderer!");const n=t.point.distanceTo(new O(0,0,0)),r=(i=t.face)==null?void 0:i.normal;if(!n||!r)return;const o=this.getWorldNormal(t,r),a=this.newPlane(e,t.point,o.negate());a.visible=this._visible,a.size=this._size,e.renderer.setPlane(!0,a.three),this.updateMaterialsAndPlanes()}getWorldNormal(e,t){const i=e.object;let n=e.object.matrixWorld.clone();if(i instanceof Kt&&e.instanceId!==void 0){const a=new Ee;i.getMatrixAt(e.instanceId,a),n=a.multiply(n)}const r=new Fn().getNormalMatrix(n),o=t.clone().applyMatrix3(r).normalize();return this.normalizePlaneDirectionY(o),o}normalizePlaneDirectionY(e){this.orthogonalY&&(e.y>this.toleranceOrthogonalY&&(e.x=0,e.y=1,e.z=0),e.y<-this.toleranceOrthogonalY&&(e.x=0,e.y=-1,e.z=0))}newPlane(e,t,i){const n=new this.Type(this.components,e,t,i,this._material);return n.onDraggingStarted.add(this._onStartDragging),n.onDraggingEnded.add(this._onEndDragging),this.list.push(n),this.onAfterCreate.trigger(n),n}updateMaterialsAndPlanes(){const e=this.components.get(D1);for(const[t,i]of e.list){if(!i.renderer)continue;i.renderer.updateClippingPlanes();const{clippingPlanes:n}=i.renderer;for(const r of i.meshes)if(Array.isArray(r.material))for(const o of r.material)o.clippingPlanes=n;else r.material.clippingPlanes=n}}};A(Zf,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let Ga=Zf;function W1(s,e,t,i){return new Promise((n,r)=>{function o(){const a=s.clientWaitSync(e,t,0);if(a===s.WAIT_FAILED){r();return}if(a===s.TIMEOUT_EXPIRED){setTimeout(o,i);return}n()}o()})}async function X1(s,e,t,i,n,r,o){const a=s.fenceSync(s.SYNC_GPU_COMMANDS_COMPLETE,0);s.flush(),await W1(s,a,0,10),s.deleteSync(a),s.bindBuffer(e,t),s.getBufferSubData(e,i,n,r,o),s.bindBuffer(e,null)}async function K1(s,e,t,i,n,r,o,a){const l=s.createBuffer();return s.bindBuffer(s.PIXEL_PACK_BUFFER,l),s.bufferData(s.PIXEL_PACK_BUFFER,a.byteLength,s.STREAM_READ),s.readPixels(e,t,i,n,r,o,0),s.bindBuffer(s.PIXEL_PACK_BUFFER,null),await X1(s,s.PIXEL_PACK_BUFFER,l,0,a),s.deleteBuffer(l),a}let qf=class{constructor(e,t,i){if(A(this,"onDisposed",new $),A(this,"onViewUpdated",new $i),A(this,"enabled",!0),A(this,"needsUpdate",!1),A(this,"renderDebugFrame",!1),A(this,"components"),A(this,"world"),A(this,"renderer"),A(this,"autoUpdate",!0),A(this,"updateInterval",1e3),A(this,"worker"),A(this,"scene",new Xn),A(this,"_width",512),A(this,"_height",512),A(this,"_availableColor",1),A(this,"renderTarget"),A(this,"bufferSize"),A(this,"_buffer"),A(this,"_isWorkerBusy",!1),A(this,"updateVisibility",async o=>{if(!this.enabled||!this.needsUpdate&&!o||this._isWorkerBusy)return;this._isWorkerBusy=!0;const a=this.world.camera.three;a.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,a);const l=this.renderer.getContext();await K1(l,0,0,this._width,this._height,l.RGBA,l.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,a),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1}),!t.renderer)throw new Error("The given world must have a renderer!");this.components=e,this.applySettings(i),this.world=t,this.renderer=new Ha,this.renderTarget=new Ri(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const n=` addEventListener("message", (event) => { const { buffer } = event.data; const colors = new Map(); @@ -85,7 +85,7 @@ var gv=Object.defineProperty;var vv=(s,e,t)=>e in s?gv(s,e,{enumerable:!0,config } postMessage({ colors }); }); - `,r=new Blob([n],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(r))}dispose(){this.enabled=!1;for(const e of this.scene.children)e.removeFromParent();this.onViewUpdated.reset(),this.worker.terminate(),this.renderer.dispose(),this.renderTarget.dispose(),this._buffer=null,this.onDisposed.reset()}getAvailableColor(){let e=BigInt(this._availableColor.toString());const t=[];do t.unshift(Number(e%256n)),e/=256n;while(e);for(;t.length!==3;)t.unshift(0);const[i,n,r]=t,o=`${i}-${n}-${r}`;return{r:i,g:n,b:r,code:o}}increaseColor(){if(this._availableColor===256*256*256){console.warn("Color can't be increased over 256 x 256 x 256!");return}this._availableColor++}decreaseColor(){if(this._availableColor===1){console.warn("Color can't be decreased under 0!");return}this._availableColor--}applySettings(e){e&&(e.updateInterval!==void 0&&(this.updateInterval=e.updateInterval),e.height!==void 0&&(this._height=e.height),e.width!==void 0&&(this._width=e.width),e.autoUpdate!==void 0&&(this.autoUpdate=e.autoUpdate))}};class Q1 extends qf{constructor(e,t,i){super(e,t,i),A(this,"threshold",100),A(this,"onViewUpdated",new ee),A(this,"colorMeshes",new Map),A(this,"isProcessing",!1),A(this,"_colorCodeMeshMap",new Map),A(this,"_meshIDColorCodeMap",new Map),A(this,"_currentVisibleMeshes",new Set),A(this,"_recentlyHiddenMeshes",new Set),A(this,"_intervalID",null),A(this,"_transparentMat",new Xt({transparent:!0,opacity:0})),A(this,"handleWorkerMessage",async n=>{if(this.isProcessing)return;const r=n.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[o,a]of r){if(a{this.isProcessing||await this.updateVisibility()},this.updateInterval),this.onViewUpdated.add(({seen:n,unseen:r})=>{for(const o of n)o.visible=!0;for(const o of r)o.visible=!1})}dispose(){super.dispose(),this._intervalID!==null&&(window.clearInterval(this._intervalID),this._intervalID=null),this._currentVisibleMeshes.clear(),this._recentlyHiddenMeshes.clear(),this._meshIDColorCodeMap.clear(),this._transparentMat.dispose(),this._colorCodeMeshMap.clear();const e=this.components.get(Fi);for(const t in this.colorMeshes){const i=this.colorMeshes.get(t);i&&e.destroy(i,!0)}this.colorMeshes.clear()}add(e){if(!this.enabled)return;if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const t=e instanceof Kt,{geometry:i,material:n}=e,{colorMaterial:r,code:o}=this.getAvailableMaterial();let a;if(Array.isArray(n)){let d=!0;const p=[];for(const f of n)Fd.isTransparent(f)?p.push(this._transparentMat):(d=!1,p.push(r));if(d){r.dispose(),this.isProcessing=!1;return}a=p}else if(Fd.isTransparent(n)){r.dispose(),this.isProcessing=!1;return}else a=r;this._colorCodeMeshMap.set(o,e),this._meshIDColorCodeMap.set(e.uuid,o);const l=t?e.count:1,h=new Kt(i,a,l);t?h.instanceMatrix=e.instanceMatrix:h.setMatrixAt(0,new Ee),e.visible=!1,h.applyMatrix4(e.matrix),h.updateMatrix(),this.scene.add(h),this.colorMeshes.set(e.uuid,h),this.increaseColor(),this.isProcessing=!1}remove(e){if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const t=this.components.get(Fi);this._currentVisibleMeshes.delete(e),this._recentlyHiddenMeshes.delete(e);const i=this.colorMeshes.get(e.uuid),n=this._meshIDColorCodeMap.get(e.uuid);if(!i||!n){this.isProcessing=!1,console.log(e.visible);return}this._colorCodeMeshMap.delete(n),this._meshIDColorCodeMap.delete(e.uuid),this.colorMeshes.delete(e.uuid),i.geometry=void 0,i.material=[],t.destroy(i,!0),this._recentlyHiddenMeshes.delete(e),this._currentVisibleMeshes.delete(e),this.isProcessing=!1}getAvailableMaterial(){const{r:e,g:t,b:i,code:n}=this.getAvailableColor(),r=Si.enabled;Si.enabled=!1;const o=new Rt(`rgb(${e}, ${t}, ${i})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const a=this.world.renderer.clippingPlanes,l=new Xt({color:o,clippingPlanes:a,side:no});return Si.enabled=r,{colorMaterial:l,code:n}}}const Jf=class uh extends Re{constructor(e){super(e),A(this,"_enabled",!0),A(this,"list",new Map),A(this,"onDisposed",new ee),e.add(uh.uuid,this)}get enabled(){return this._enabled}set enabled(e){this._enabled=e;for(const[t,i]of this.list)i.enabled=e}create(e,t){if(this.list.has(e.uuid))return this.list.get(e.uuid);const i=new Q1(this.components,e,t);return this.list.set(e.uuid,i),i}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(uh.uuid),this.onDisposed.reset();for(const[e,t]of this.list)t.dispose();this.list.clear()}};A(Jf,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let Z1=Jf;class q1{constructor(e){if(A(this,"onDisposed",new ee),A(this,"onAfterUpdate",new ee),A(this,"onBeforeUpdate",new ee),A(this,"onResize",new ee),A(this,"frontOffset",0),A(this,"overrideMaterial",new Tf),A(this,"backgroundColor",new Rt(395274)),A(this,"renderer"),A(this,"enabled",!0),A(this,"world"),A(this,"_lockRotation",!0),A(this,"_camera"),A(this,"_plane"),A(this,"_size",new Ve(320,160)),A(this,"_tempVector1",new O),A(this,"_tempVector2",new O),A(this,"_tempTarget",new O),A(this,"down",new O(0,-1,0)),A(this,"updatePlanes",()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const n=[],r=this.world.renderer.three;for(const o of r.clippingPlanes)n.push(o);n.push(this._plane),this.renderer.clippingPlanes=n}),this.world=e,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new Ha,this.renderer.setSize(this._size.x,this._size.y);const t=1,i=this._size.x/this._size.y;this._camera=new jn(t*i/-2,t*i/2,t/2,t/-2),this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes),this._camera.position.set(0,200,0),this._camera.zoom=.1,this._camera.rotation.x=-Math.PI/2,this._plane=new an(this.down,200),this.updatePlanes()}get lockRotation(){return this._lockRotation}set lockRotation(e){this._lockRotation=e,e&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(e){this._camera.zoom=e,this._camera.updateProjectionMatrix()}dispose(){this.enabled=!1,this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.onResize.reset(),this.overrideMaterial.dispose(),this.renderer.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return this._camera}update(){if(!this.enabled)return;this.onBeforeUpdate.trigger();const e=this.world.scene.three,t=this.world.camera;if(!t.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(e instanceof Xn))throw new Error("The given world must have a THREE.Scene as a root!");const i=t.controls;if(i.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,this.frontOffset!==0&&(i.getTarget(this._tempVector2),this._tempVector2.sub(this._tempVector1),this._tempVector2.normalize().multiplyScalar(this.frontOffset),this._camera.position.x+=this._tempVector2.x,this._camera.position.z+=this._tempVector2.z),!this._lockRotation){i.getTarget(this._tempTarget);const r=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=r+Math.PI}this._plane.set(this.down,this._tempVector1.y);const n=e.background;e.background=this.backgroundColor,this.renderer.render(e,this._camera),e.background=n,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(e=this._size){this._size.copy(e),this.renderer.setSize(e.x,e.y);const t=e.x/e.y,i=1;this._camera.left=i*t/-2,this._camera.right=i*t/2,this._camera.top=i/2,this._camera.bottom=-i/2,this._camera.updateProjectionMatrix(),this.onResize.trigger(e)}}const J1=class $f extends Re{constructor(e){super(e),A(this,"onAfterUpdate",new ee),A(this,"onBeforeUpdate",new ee),A(this,"onDisposed",new ee),A(this,"enabled",!0),A(this,"list",new Map),this.components.add($f.uuid,this)}create(e){if(this.list.has(e.uuid))throw new Error("This world already has a minimap!");const t=new q1(e);return this.list.set(e.uuid,t),t}delete(e){const t=this.list.get(e);t&&t.dispose(),this.list.delete(e)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[e,t]of this.list)t.update()}};A(J1,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");class $1{constructor(e){A(this,"enabled",!1),A(this,"id","FirstPerson"),this.camera=e}set(e){if(this.enabled=e,e){if(this.camera.projection.current!=="Perspective"){this.camera.set("Orbit");return}this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const e=this.camera.controls,t=new O;e.distance--,e.getPosition(t),e.minDistance=1,e.maxDistance=1,e.distance=1,e.moveTo(t.x,t.y,t.z),e.truckSpeed=50,e.mouseButtons.wheel=Mt.ACTION.DOLLY,e.touches.two=Mt.ACTION.TOUCH_ZOOM_TRUCK}}class eE{constructor(e){A(this,"enabled",!0),A(this,"id","Orbit"),this.camera=e,this.activateOrbitControls()}set(e){this.enabled=e,e&&this.activateOrbitControls()}activateOrbitControls(){const e=this.camera.controls;e.minDistance=1,e.maxDistance=300;const t=new O;e.getPosition(t);const i=t.length();e.distance=i,e.truckSpeed=2;const{rotation:n}=this.camera.three,r=new O(0,0,-1).applyEuler(n),o=t.addScaledVector(r,i);e.moveTo(o.x,o.y,o.z)}}class tE{constructor(e){A(this,"enabled",!1),A(this,"id","Plan"),A(this,"mouseAction1"),A(this,"mouseAction2"),A(this,"mouseInitialized",!1),A(this,"defaultAzimuthSpeed"),A(this,"defaultPolarSpeed"),this.camera=e,this.defaultAzimuthSpeed=e.controls.azimuthRotateSpeed,this.defaultPolarSpeed=e.controls.polarRotateSpeed}set(e){this.enabled=e;const t=this.camera.controls;t.azimuthRotateSpeed=e?0:this.defaultAzimuthSpeed,t.polarRotateSpeed=e?0:this.defaultPolarSpeed,this.mouseInitialized||(this.mouseAction1=t.touches.one,this.mouseAction2=t.touches.two,this.mouseInitialized=!0),e?(t.mouseButtons.left=Mt.ACTION.TRUCK,t.touches.one=Mt.ACTION.TOUCH_TRUCK,t.touches.two=Mt.ACTION.TOUCH_ZOOM):(t.mouseButtons.left=Mt.ACTION.ROTATE,t.touches.one=this.mouseAction1,t.touches.two=this.mouseAction2)}}class iE{constructor(e){A(this,"onChanged",new ee),A(this,"current","Perspective"),A(this,"camera"),A(this,"_component"),A(this,"_previousDistance",-1),A(this,"matchOrthoDistanceEnabled",!1),this._component=e,this.camera=e.three}async set(e){this.current!==e&&(e==="Orthographic"?this.setOrthoCamera():await this.setPerspectiveCamera(),this.onChanged.trigger(this.camera))}async toggle(){const e=this.current==="Perspective"?"Orthographic":"Perspective";await this.set(e)}setOrthoCamera(){if(this._component.mode===null||this._component.mode.id==="FirstPerson")return;this._previousDistance=this._component.controls.distance,this._component.controls.distance=200;const e=this.getPerspectiveDims();if(!e)return;const{width:t,height:i}=e;this.setupOrthoCamera(i,t),this.camera=this._component.threeOrtho,this.current="Orthographic"}getPerspectiveDims(){const e=this._component.currentWorld;if(!e||!e.renderer)return null;const t=new O;this._component.threePersp.getWorldDirection(t);const i=new O;this._component.controls.getTarget(i);const n=i.clone().sub(this._component.threePersp.position).dot(t),r=e.renderer.getSize(),o=r.x/r.y,a=this._component.threePersp,l=n*2*Math.atan(a.fov*(Math.PI/180)/2);return{width:l*o,height:l}}setupOrthoCamera(e,t){this._component.controls.mouseButtons.wheel=Mt.ACTION.ZOOM,this._component.controls.mouseButtons.middle=Mt.ACTION.ZOOM;const i=this._component.threePersp,n=this._component.threeOrtho;n.zoom=1,n.left=t/-2,n.right=t/2,n.top=e/2,n.bottom=e/-2,n.updateProjectionMatrix(),n.position.copy(i.position),n.quaternion.copy(i.quaternion),this._component.controls.camera=n}getDistance(){const e=this._component.threePersp,t=this._component.threeOrtho;return(t.top-t.bottom)/t.zoom/(2*Math.atan(e.fov*(Math.PI/180)/2))}async setPerspectiveCamera(){this._component.controls.mouseButtons.wheel=Mt.ACTION.DOLLY,this._component.controls.mouseButtons.middle=Mt.ACTION.DOLLY;const e=this._component.threePersp,t=this._component.threeOrtho;e.position.copy(t.position),e.quaternion.copy(t.quaternion),this._component.controls.mouseButtons.wheel=Mt.ACTION.DOLLY,this.matchOrthoDistanceEnabled?this._component.controls.distance=this.getDistance():this._component.controls.distance=this._previousDistance,await this._component.controls.zoomTo(1),e.updateProjectionMatrix(),this._component.controls.camera=e,this.camera=e,this.current="Perspective"}}class nE extends ch{constructor(e){super(e),A(this,"_mode",null),A(this,"projection"),A(this,"threeOrtho"),A(this,"threePersp"),A(this,"_userInputButtons",{}),A(this,"_frustumSize",50),A(this,"_navigationModes",new Map),A(this,"previousSize",null),this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new iE(this),this.onAspectUpdated.add(()=>{this.setOrthoPerspCameraAspect()}),this.projection.onChanged.add(t=>{this.three=t,this.updateAspect()}),this.onWorldChanged.add(()=>{this._navigationModes.clear(),this._navigationModes.set("Orbit",new eE(this)),this._navigationModes.set("FirstPerson",new $1(this)),this._navigationModes.set("Plan",new tE(this)),this._mode=this._navigationModes.get("Orbit"),this.mode.set(!0,{preventTargetAdjustment:!0}),this.currentWorld&&this.currentWorld.renderer&&(this.previousSize=this.currentWorld.renderer.getSize().clone())})}get mode(){if(!this._mode)throw new Error("Mode not found, camera not initialized");return this._mode}dispose(){super.dispose(),this.threeOrtho.removeFromParent()}set(e){if(this.mode!==null&&this.mode.id!==e){if(this.mode.set(!1),!this._navigationModes.has(e))throw new Error("The specified mode does not exist!");this._mode=this._navigationModes.get(e),this.mode.set(!0)}}async fit(e,t=1.5){if(!this.enabled)return;const i=Number.MAX_VALUE,n=Number.MIN_VALUE,r=new O(i,i,i),o=new O(n,n,n);for(const f of e){const g=new Ke().setFromObject(f);g.min.xo.x&&(o.x=g.max.x),g.max.y>o.y&&(o.y=g.max.y),g.max.z>o.z&&(o.z=g.max.z)}const a=new Ke(r,o),l=new O;a.getSize(l);const h=new O;a.getCenter(h);const d=Math.max(l.x,l.y,l.z)*t,p=new Gn(h,d);await this.controls.fitToSphere(p,!0)}setUserInput(e){e?this.enableUserInput():this.disableUserInput()}disableUserInput(){this._userInputButtons.left=this.controls.mouseButtons.left,this._userInputButtons.right=this.controls.mouseButtons.right,this._userInputButtons.middle=this.controls.mouseButtons.middle,this._userInputButtons.wheel=this.controls.mouseButtons.wheel,this.controls.mouseButtons.left=0,this.controls.mouseButtons.right=0,this.controls.mouseButtons.middle=0,this.controls.mouseButtons.wheel=0}enableUserInput(){Object.keys(this._userInputButtons).length!==0&&(this.controls.mouseButtons.left=this._userInputButtons.left,this.controls.mouseButtons.right=this._userInputButtons.right,this.controls.mouseButtons.middle=this._userInputButtons.middle,this.controls.mouseButtons.wheel=this._userInputButtons.wheel)}newOrthoCamera(){const e=window.innerWidth/window.innerHeight;return new jn(this._frustumSize*e/-2,this._frustumSize*e/2,this._frustumSize/2,this._frustumSize/-2,.1,1e3)}setOrthoPerspCameraAspect(){if(!this.currentWorld||!this.currentWorld.renderer||!this.previousSize)return;const e=this.currentWorld.renderer.getSize(),t=this.threeOrtho.top,i=this.threeOrtho.right,n=e.y/this.previousSize.y,r=e.x/this.previousSize.x,o=t*n,a=i*r;this.threeOrtho.left=-a,this.threeOrtho.right=a,this.threeOrtho.top=o,this.threeOrtho.bottom=-o,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(e)}}const em=class xi extends Re{constructor(e){super(e),A(this,"enabled",!0),A(this,"onDisposed",new ee),A(this,"_absoluteMin"),A(this,"_absoluteMax"),A(this,"_meshes",[]),this.components.add(xi.uuid,this),this._absoluteMin=xi.newBound(!0),this._absoluteMax=xi.newBound(!1)}static getDimensions(e){const{min:t,max:i}=e,n=Math.abs(i.x-t.x),r=Math.abs(i.y-t.y),o=Math.abs(i.z-t.z),a=new O;return a.subVectors(i,t).divideScalar(2).add(t),{width:n,height:r,depth:o,center:a}}static newBound(e){const t=e?1:-1;return new O(t*Number.MAX_VALUE,t*Number.MAX_VALUE,t*Number.MAX_VALUE)}static getBounds(e,t,i){const n=i||this.newBound(!1),r=t||this.newBound(!0);for(const o of e)o.xn.x&&(n.x=o.x),o.y>n.y&&(n.y=o.y),o.z>n.z&&(n.z=o.z);return new Ke(t,i)}dispose(){const e=this.components.get(Fi);for(const t of this._meshes)e.destroy(t);this._meshes=[],this.onDisposed.trigger(xi.uuid),this.onDisposed.reset()}get(){const e=this._absoluteMin.clone(),t=this._absoluteMax.clone();return new Ke(e,t)}getSphere(){const e=this._absoluteMin.clone(),t=this._absoluteMax.clone(),i=Math.abs((t.x-e.x)/2),n=Math.abs((t.y-e.y)/2),r=Math.abs((t.z-e.z)/2),o=new O(e.x+i,e.y+n,e.z+r),a=o.distanceTo(e);return new Gn(o,a)}getMesh(){const e=new Ke(this._absoluteMin,this._absoluteMax),t=xi.getDimensions(e),{width:i,height:n,depth:r,center:o}=t,a=new ut(i,n,r),l=new le(a);return this._meshes.push(l),l.position.copy(o),l}reset(){this._absoluteMin=xi.newBound(!0),this._absoluteMax=xi.newBound(!1)}add(e){for(const t of e.items)this.addMesh(t.mesh)}addMesh(e,t){if(!e.geometry.index)return;const i=xi.getFragmentBounds(e);e.updateMatrixWorld();const n=e.matrixWorld,r=new Ee,o=e instanceof Kt,a=new Set;if(t&&e instanceof yf)for(const l of t){const h=e.fragment.getInstancesIDs(l);if(h)for(const d of h)a.add(d)}else a.add(0);for(const l of a){const h=i.min.clone(),d=i.max.clone();o&&(e.getMatrixAt(l,r),h.applyMatrix4(r),d.applyMatrix4(r)),h.applyMatrix4(n),d.applyMatrix4(n),h.xthis._absoluteMax.x&&(this._absoluteMax.x=h.x),h.y>this._absoluteMax.y&&(this._absoluteMax.y=h.y),h.z>this._absoluteMax.z&&(this._absoluteMax.z=h.z),d.x>this._absoluteMax.x&&(this._absoluteMax.x=d.x),d.y>this._absoluteMax.y&&(this._absoluteMax.y=d.y),d.z>this._absoluteMax.z&&(this._absoluteMax.z=d.z),d.xo.x&&(o.x=d),p>o.y&&(o.y=p),f>o.z&&(o.z=f)}return new Ke(r,o)}};A(em,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let tm=em;const su=new Set([1123145078,574549367,1675464909,2059837836,3798115385,32440307,3125803723,3207858831,2740243338,2624227202,4240577450,3615266464,3724593414,220341763,477187591,1878645084,1300840506,3303107099,1607154358,1878645084,846575682,1351298697,2417041796,3049322572,3331915920,1416205885,776857604,3285139300,3958052878,2827736869,2732653382,673634403,3448662350,4142052618,2924175390,803316827,2556980723,1809719519,2205249479,807026263,3737207727,1660063152,2347385850,3940055652,2705031697,3732776249,2485617015,2611217952,1704287377,2937912522,2770003689,1281925730,1484403080,3448662350,4142052618,3800577675,4006246654,3590301190,1383045692,2775532180,2047409740,370225590,3593883385,2665983363,4124623270,812098782,3649129432,987898635,1105321065,3510044353,1635779807,2603310189,3406155212,1310608509,4261334040,2736907675,3649129432,1136057603,1260505505,4182860854,2713105998,2898889636,59481748,3749851601,3486308946,3150382593,1062206242,3264961684,15328376,1485152156,370225590,1981873012,2859738748,45288368,2614616156,2732653382,775493141,2147822146,2601014836,2629017746,1186437898,2367409068,1213902940,3632507154,3900360178,476780140,1472233963,2804161546,3008276851,738692330,374418227,315944413,3905492369,3570813810,2571569899,178912537,2294589976,1437953363,2133299955,572779678,3092502836,388784114,2624227202,1425443689,3057273783,2347385850,1682466193,2519244187,2839578677,3958567839,2513912981,2830218821,427810014]),im=class nm extends Re{constructor(e){super(e),A(this,"enabled",!0),e.add(nm.uuid,this)}async export(e,t,i=!1,n=!0){const r={},o=new Set(e.GetIfcEntityList(t)),a=new Set([pl,Zh,qh,dl,Wn]);for(const l of a)o.add(l);for(const l of o){if(su.has(l))continue;const h=a.has(l)&&n,d=e.GetLineIDsWithType(t,l);for(const p of d){const f=e.GetLine(0,p,h,i);r[f.expressID]=f}}return r}};A(im,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let sE=im;const sm=class rm extends Re{constructor(e){super(e),A(this,"onDisposed",new ee),A(this,"onFragmentsLoaded",new ee),A(this,"onFragmentsDisposed",new ee),A(this,"list",new Map),A(this,"groups",new Map),A(this,"enabled",!0),A(this,"baseCoordinationModel",""),A(this,"_loader",new Ef),this.components.add(rm.uuid,this)}get meshes(){const e=[];for(const[t,i]of this.list)e.push(i.mesh);return e}dispose(){for(const[e,t]of this.groups)t.dispose(!0);this.baseCoordinationModel="",this.groups.clear(),this.list.clear(),this.onFragmentsLoaded.reset(),this.onFragmentsDisposed.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}disposeGroup(e){const{uuid:t}=e,i=[];for(const n of e.items)i.push(n.id),this.list.delete(n.id);e.dispose(!0),this.groups.delete(e.uuid),this.onFragmentsDisposed.trigger({groupID:t,fragmentIDs:i})}load(e,t){const i={coordinate:!0,...t},{coordinate:n,properties:r,relationsMap:o}=i,a=this._loader.import(e);for(const l of a.items)l.group=a,this.list.set(l.id,l);return n&&this.coordinate([a]),this.groups.set(a.uuid,a),r&&a.setLocalProperties(r),o&&this.components.get(gl).setRelationMap(a,o),this.onFragmentsLoaded.trigger(a),a}export(e){return this._loader.export(e)}coordinate(e=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const i=e.pop();if(!i)return;this.baseCoordinationModel=i.uuid}if(!e.length)return;const t=this.groups.get(this.baseCoordinationModel);if(!t){console.log("No base model found for coordination!");return}for(const i of e)i!==t&&(i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),i.updateMatrix(),i.applyMatrix4(i.coordinationMatrix.clone().invert()),i.applyMatrix4(t.coordinationMatrix))}};A(sm,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let rt=sm;const om={950732822:"IFCURIREFERENCE",4075327185:"IFCTIME",1209108979:"IFCTEMPERATURERATEOFCHANGEMEASURE",3457685358:"IFCSOUNDPRESSURELEVELMEASURE",4157543285:"IFCSOUNDPOWERLEVELMEASURE",2798247006:"IFCPROPERTYSETDEFINITIONSET",1790229001:"IFCPOSITIVEINTEGER",525895558:"IFCNONNEGATIVELENGTHMEASURE",1774176899:"IFCLINEINDEX",1275358634:"IFCLANGUAGEID",2541165894:"IFCDURATION",3701338814:"IFCDAYINWEEKNUMBER",2195413836:"IFCDATETIME",937566702:"IFCDATE",1683019596:"IFCCARDINALPOINTREFERENCE",2314439260:"IFCBINARY",1500781891:"IFCAREADENSITYMEASURE",3683503648:"IFCARCINDEX",4065007721:"IFCYEARNUMBER",1718600412:"IFCWARPINGMOMENTMEASURE",51269191:"IFCWARPINGCONSTANTMEASURE",2593997549:"IFCVOLUMETRICFLOWRATEMEASURE",3458127941:"IFCVOLUMEMEASURE",3345633955:"IFCVAPORPERMEABILITYMEASURE",1278329552:"IFCTORQUEMEASURE",2591213694:"IFCTIMESTAMP",2726807636:"IFCTIMEMEASURE",743184107:"IFCTHERMODYNAMICTEMPERATUREMEASURE",2016195849:"IFCTHERMALTRANSMITTANCEMEASURE",857959152:"IFCTHERMALRESISTANCEMEASURE",2281867870:"IFCTHERMALEXPANSIONCOEFFICIENTMEASURE",2645777649:"IFCTHERMALCONDUCTIVITYMEASURE",232962298:"IFCTHERMALADMITTANCEMEASURE",296282323:"IFCTEXTTRANSFORMATION",603696268:"IFCTEXTFONTNAME",3490877962:"IFCTEXTDECORATION",1460886941:"IFCTEXTALIGNMENT",2801250643:"IFCTEXT",58845555:"IFCTEMPERATUREGRADIENTMEASURE",361837227:"IFCSPECULARROUGHNESS",2757832317:"IFCSPECULAREXPONENT",3477203348:"IFCSPECIFICHEATCAPACITYMEASURE",993287707:"IFCSOUNDPRESSUREMEASURE",846465480:"IFCSOUNDPOWERMEASURE",3471399674:"IFCSOLIDANGLEMEASURE",408310005:"IFCSHEARMODULUSMEASURE",2190458107:"IFCSECTIONALAREAINTEGRALMEASURE",3467162246:"IFCSECTIONMODULUSMEASURE",2766185779:"IFCSECONDINMINUTE",3211557302:"IFCROTATIONALSTIFFNESSMEASURE",1755127002:"IFCROTATIONALMASSMEASURE",2133746277:"IFCROTATIONALFREQUENCYMEASURE",200335297:"IFCREAL",96294661:"IFCRATIOMEASURE",3972513137:"IFCRADIOACTIVITYMEASURE",3665567075:"IFCPRESSUREMEASURE",2169031380:"IFCPRESENTABLETEXT",1364037233:"IFCPOWERMEASURE",1245737093:"IFCPOSITIVERATIOMEASURE",3054510233:"IFCPOSITIVEPLANEANGLEMEASURE",2815919920:"IFCPOSITIVELENGTHMEASURE",4042175685:"IFCPLANEANGLEMEASURE",2642773653:"IFCPLANARFORCEMEASURE",2260317790:"IFCPARAMETERVALUE",929793134:"IFCPHMEASURE",2395907400:"IFCNUMERICMEASURE",2095195183:"IFCNORMALISEDRATIOMEASURE",765770214:"IFCMONTHINYEARNUMBER",2615040989:"IFCMONETARYMEASURE",3114022597:"IFCMOMENTOFINERTIAMEASURE",1648970520:"IFCMOLECULARWEIGHTMEASURE",3177669450:"IFCMOISTUREDIFFUSIVITYMEASURE",1753493141:"IFCMODULUSOFSUBGRADEREACTIONMEASURE",1052454078:"IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE",2173214787:"IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE",3341486342:"IFCMODULUSOFELASTICITYMEASURE",102610177:"IFCMINUTEINHOUR",3531705166:"IFCMASSPERLENGTHMEASURE",3124614049:"IFCMASSMEASURE",4017473158:"IFCMASSFLOWRATEMEASURE",1477762836:"IFCMASSDENSITYMEASURE",2486716878:"IFCMAGNETICFLUXMEASURE",286949696:"IFCMAGNETICFLUXDENSITYMEASURE",151039812:"IFCLUMINOUSINTENSITYMEASURE",2755797622:"IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE",2095003142:"IFCLUMINOUSFLUXMEASURE",503418787:"IFCLOGICAL",3086160713:"IFCLINEARVELOCITYMEASURE",1307019551:"IFCLINEARSTIFFNESSMEASURE",2128979029:"IFCLINEARMOMENTMEASURE",191860431:"IFCLINEARFORCEMEASURE",1243674935:"IFCLENGTHMEASURE",3258342251:"IFCLABEL",2054016361:"IFCKINEMATICVISCOSITYMEASURE",3192672207:"IFCISOTHERMALMOISTURECAPACITYMEASURE",3686016028:"IFCIONCONCENTRATIONMEASURE",3809634241:"IFCINTEGERCOUNTRATEMEASURE",1939436016:"IFCINTEGER",2679005408:"IFCINDUCTANCEMEASURE",3358199106:"IFCILLUMINANCEMEASURE",983778844:"IFCIDENTIFIER",2589826445:"IFCHOURINDAY",1158859006:"IFCHEATINGVALUEMEASURE",3113092358:"IFCHEATFLUXDENSITYMEASURE",3064340077:"IFCGLOBALLYUNIQUEID",3044325142:"IFCFREQUENCYMEASURE",1361398929:"IFCFORCEMEASURE",2590844177:"IFCFONTWEIGHT",2715512545:"IFCFONTVARIANT",1102727119:"IFCFONTSTYLE",2078135608:"IFCENERGYMEASURE",2506197118:"IFCELECTRICVOLTAGEMEASURE",2951915441:"IFCELECTRICRESISTANCEMEASURE",3790457270:"IFCELECTRICCURRENTMEASURE",2093906313:"IFCELECTRICCONDUCTANCEMEASURE",3818826038:"IFCELECTRICCHARGEMEASURE",1827137117:"IFCELECTRICCAPACITANCEMEASURE",69416015:"IFCDYNAMICVISCOSITYMEASURE",524656162:"IFCDOSEEQUIVALENTMEASURE",4134073009:"IFCDIMENSIONCOUNT",1514641115:"IFCDESCRIPTIVEMEASURE",300323983:"IFCDAYLIGHTSAVINGHOUR",86635668:"IFCDAYINMONTHNUMBER",94842927:"IFCCURVATUREMEASURE",1778710042:"IFCCOUNTMEASURE",3238673880:"IFCCONTEXTDEPENDENTMEASURE",3812528620:"IFCCOMPOUNDPLANEANGLEMEASURE",2991860651:"IFCCOMPLEXNUMBER",1867003952:"IFCBOXALIGNMENT",2735952531:"IFCBOOLEAN",2650437152:"IFCAREAMEASURE",632304761:"IFCANGULARVELOCITYMEASURE",360377573:"IFCAMOUNTOFSUBSTANCEMEASURE",4182062534:"IFCACCELERATIONMEASURE",3699917729:"IFCABSORBEDDOSEMEASURE",1971632696:"IFCGEOSLICE",2680139844:"IFCGEOMODEL",24726584:"IFCELECTRICFLOWTREATMENTDEVICE",3693000487:"IFCDISTRIBUTIONBOARD",3460952963:"IFCCONVEYORSEGMENT",3999819293:"IFCCAISSONFOUNDATION",3314249567:"IFCBOREHOLE",4196446775:"IFCBEARING",325726236:"IFCALIGNMENT",3425753595:"IFCTRACKELEMENT",991950508:"IFCSIGNAL",3798194928:"IFCREINFORCEDSOIL",3290496277:"IFCRAIL",1383356374:"IFCPAVEMENT",2182337498:"IFCNAVIGATIONELEMENT",234836483:"IFCMOORINGDEVICE",2078563270:"IFCMOBILETELECOMMUNICATIONSAPPLIANCE",1638804497:"IFCLIQUIDTERMINAL",1154579445:"IFCLINEARPOSITIONINGELEMENT",2696325953:"IFCKERB",2713699986:"IFCGEOTECHNICALASSEMBLY",2142170206:"IFCELECTRICFLOWTREATMENTDEVICETYPE",3376911765:"IFCEARTHWORKSFILL",1077100507:"IFCEARTHWORKSELEMENT",3071239417:"IFCEARTHWORKSCUT",479945903:"IFCDISTRIBUTIONBOARDTYPE",3426335179:"IFCDEEPFOUNDATION",1502416096:"IFCCOURSE",2940368186:"IFCCONVEYORSEGMENTTYPE",3203706013:"IFCCAISSONFOUNDATIONTYPE",3862327254:"IFCBUILTSYSTEM",1876633798:"IFCBUILTELEMENT",963979645:"IFCBRIDGEPART",644574406:"IFCBRIDGE",3649138523:"IFCBEARINGTYPE",1662888072:"IFCALIGNMENTVERTICAL",317615605:"IFCALIGNMENTSEGMENT",1545765605:"IFCALIGNMENTHORIZONTAL",4266260250:"IFCALIGNMENTCANT",3956297820:"IFCVIBRATIONDAMPERTYPE",1530820697:"IFCVIBRATIONDAMPER",840318589:"IFCVEHICLE",1953115116:"IFCTRANSPORTATIONDEVICE",618700268:"IFCTRACKELEMENTTYPE",2281632017:"IFCTENDONCONDUITTYPE",3663046924:"IFCTENDONCONDUIT",42703149:"IFCSINESPIRAL",1894708472:"IFCSIGNALTYPE",3599934289:"IFCSIGNTYPE",33720170:"IFCSIGN",1027922057:"IFCSEVENTHORDERPOLYNOMIALSPIRAL",544395925:"IFCSEGMENTEDREFERENCECURVE",3649235739:"IFCSECONDORDERPOLYNOMIALSPIRAL",550521510:"IFCROADPART",146592293:"IFCROAD",3818125796:"IFCRELADHERESTOELEMENT",4021432810:"IFCREFERENT",1891881377:"IFCRAILWAYPART",3992365140:"IFCRAILWAY",1763565496:"IFCRAILTYPE",1946335990:"IFCPOSITIONINGELEMENT",514975943:"IFCPAVEMENTTYPE",506776471:"IFCNAVIGATIONELEMENTTYPE",710110818:"IFCMOORINGDEVICETYPE",1950438474:"IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE",976884017:"IFCMARINEPART",525669439:"IFCMARINEFACILITY",1770583370:"IFCLIQUIDTERMINALTYPE",2176059722:"IFCLINEARELEMENT",679976338:"IFCKERBTYPE",3948183225:"IFCIMPACTPROTECTIONDEVICETYPE",2568555532:"IFCIMPACTPROTECTIONDEVICE",2898700619:"IFCGRADIENTCURVE",1594536857:"IFCGEOTECHNICALSTRATUM",4230923436:"IFCGEOTECHNICALELEMENT",4228831410:"IFCFACILITYPARTCOMMON",1310830890:"IFCFACILITYPART",24185140:"IFCFACILITY",4234616927:"IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID",1306400036:"IFCDEEPFOUNDATIONTYPE",4189326743:"IFCCOURSETYPE",2000195564:"IFCCOSINESPIRAL",3497074424:"IFCCLOTHOID",1626504194:"IFCBUILTELEMENTTYPE",3651464721:"IFCVEHICLETYPE",1229763772:"IFCTRIANGULATEDIRREGULARNETWORK",3665877780:"IFCTRANSPORTATIONDEVICETYPE",782932809:"IFCTHIRDORDERPOLYNOMIALSPIRAL",2735484536:"IFCSPIRAL",1356537516:"IFCSECTIONEDSURFACE",1290935644:"IFCSECTIONEDSOLIDHORIZONTAL",1862484736:"IFCSECTIONEDSOLID",1441486842:"IFCRELPOSITIONS",1033248425:"IFCRELASSOCIATESPROFILEDEF",3381221214:"IFCPOLYNOMIALCURVE",2485787929:"IFCOFFSETCURVEBYDISTANCES",590820931:"IFCOFFSETCURVE",3465909080:"IFCINDEXEDPOLYGONALTEXTUREMAP",593015953:"IFCDIRECTRIXCURVESWEPTAREASOLID",4212018352:"IFCCURVESEGMENT",3425423356:"IFCAXIS2PLACEMENTLINEAR",823603102:"IFCSEGMENT",2165702409:"IFCPOINTBYDISTANCEEXPRESSION",182550632:"IFCOPENCROSSPROFILEDEF",388784114:"IFCLINEARPLACEMENT",536804194:"IFCALIGNMENTHORIZONTALSEGMENT",3752311538:"IFCALIGNMENTCANTSEGMENT",1010789467:"IFCTEXTURECOORDINATEINDICESWITHVOIDS",222769930:"IFCTEXTURECOORDINATEINDICES",2691318326:"IFCQUANTITYNUMBER",3633395639:"IFCALIGNMENTVERTICALSEGMENT",2879124712:"IFCALIGNMENTPARAMETERSEGMENT",25142252:"IFCCONTROLLER",3087945054:"IFCALARM",4288193352:"IFCACTUATOR",630975310:"IFCUNITARYCONTROLELEMENT",4086658281:"IFCSENSOR",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",182646315:"IFCFLOWINSTRUMENT",1426591983:"IFCFIRESUPPRESSIONTERMINAL",819412036:"IFCFILTER",3415622556:"IFCFAN",1003880860:"IFCELECTRICTIMECONTROL",402227799:"IFCELECTRICMOTOR",264262732:"IFCELECTRICGENERATOR",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",862014818:"IFCELECTRICDISTRIBUTIONBOARD",1904799276:"IFCELECTRICAPPLIANCE",1360408905:"IFCDUCTSILENCER",3518393246:"IFCDUCTSEGMENT",342316401:"IFCDUCTFITTING",562808652:"IFCDISTRIBUTIONCIRCUIT",4074379575:"IFCDAMPER",3640358203:"IFCCOOLINGTOWER",4136498852:"IFCCOOLEDBEAM",2272882330:"IFCCONDENSER",3571504051:"IFCCOMPRESSOR",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",639361253:"IFCCOIL",3902619387:"IFCCHILLER",4217484030:"IFCCABLESEGMENT",1051757585:"IFCCABLEFITTING",3758799889:"IFCCABLECARRIERSEGMENT",635142910:"IFCCABLECARRIERFITTING",2938176219:"IFCBURNER",32344328:"IFCBOILER",2906023776:"IFCBEAMSTANDARDCASE",277319702:"IFCAUDIOVISUALAPPLIANCE",2056796094:"IFCAIRTOAIRHEATRECOVERY",177149247:"IFCAIRTERMINALBOX",1634111441:"IFCAIRTERMINAL",486154966:"IFCWINDOWSTANDARDCASE",4237592921:"IFCWASTETERMINAL",4156078855:"IFCWALLELEMENTEDCASE",4207607924:"IFCVALVE",4292641817:"IFCUNITARYEQUIPMENT",3179687236:"IFCUNITARYCONTROLELEMENTTYPE",3026737570:"IFCTUBEBUNDLE",3825984169:"IFCTRANSFORMER",812556717:"IFCTANK",1162798199:"IFCSWITCHINGDEVICE",385403989:"IFCSTRUCTURALLOADCASE",1404847402:"IFCSTACKTERMINAL",1999602285:"IFCSPACEHEATER",3420628829:"IFCSOLARDEVICE",3027962421:"IFCSLABSTANDARDCASE",3127900445:"IFCSLABELEMENTEDCASE",1329646415:"IFCSHADINGDEVICE",3053780830:"IFCSANITARYTERMINAL",2572171363:"IFCREINFORCINGBARTYPE",1232101972:"IFCRATIONALBSPLINECURVEWITHKNOTS",90941305:"IFCPUMP",655969474:"IFCPROTECTIVEDEVICETRIPPINGUNITTYPE",738039164:"IFCPROTECTIVEDEVICE",1156407060:"IFCPLATESTANDARDCASE",3612865200:"IFCPIPESEGMENT",310824031:"IFCPIPEFITTING",3694346114:"IFCOUTLET",144952367:"IFCOUTERBOUNDARYCURVE",2474470126:"IFCMOTORCONNECTION",1911478936:"IFCMEMBERSTANDARDCASE",1437502449:"IFCMEDICALDEVICE",629592764:"IFCLIGHTFIXTURE",76236018:"IFCLAMP",2176052936:"IFCJUNCTIONBOX",4175244083:"IFCINTERCEPTOR",2068733104:"IFCHUMIDIFIER",3319311131:"IFCHEATEXCHANGER",2188021234:"IFCFLOWMETER",1209101575:"IFCEXTERNALSPATIALELEMENT",484807127:"IFCEVAPORATOR",3747195512:"IFCEVAPORATIVECOOLER",2814081492:"IFCENGINE",2417008758:"IFCELECTRICDISTRIBUTIONBOARDTYPE",3242481149:"IFCDOORSTANDARDCASE",3205830791:"IFCDISTRIBUTIONSYSTEM",400855858:"IFCCOMMUNICATIONSAPPLIANCETYPE",905975707:"IFCCOLUMNSTANDARDCASE",1677625105:"IFCCIVILELEMENT",3296154744:"IFCCHIMNEY",2674252688:"IFCCABLEFITTINGTYPE",2188180465:"IFCBURNERTYPE",1177604601:"IFCBUILDINGSYSTEM",39481116:"IFCBUILDINGELEMENTPARTTYPE",1136057603:"IFCBOUNDARYCURVE",2461110595:"IFCBSPLINECURVEWITHKNOTS",1532957894:"IFCAUDIOVISUALAPPLIANCETYPE",4088093105:"IFCWORKCALENDAR",4009809668:"IFCWINDOWTYPE",926996030:"IFCVOIDINGFEATURE",2391383451:"IFCVIBRATIONISOLATOR",2415094496:"IFCTENDONTYPE",3081323446:"IFCTENDONANCHORTYPE",413509423:"IFCSYSTEMFURNITUREELEMENT",3101698114:"IFCSURFACEFEATURE",3657597509:"IFCSTRUCTURALSURFACEACTION",2757150158:"IFCSTRUCTURALCURVEREACTION",1004757350:"IFCSTRUCTURALCURVEACTION",338393293:"IFCSTAIRTYPE",1072016465:"IFCSOLARDEVICETYPE",4074543187:"IFCSHADINGDEVICETYPE",2157484638:"IFCSEAMCURVE",2781568857:"IFCROOFTYPE",2310774935:"IFCREINFORCINGMESHTYPE",964333572:"IFCREINFORCINGELEMENTTYPE",683857671:"IFCRATIONALBSPLINESURFACEWITHKNOTS",1469900589:"IFCRAMPTYPE",2839578677:"IFCPOLYGONALFACESET",1158309216:"IFCPILETYPE",3079942009:"IFCOPENINGSTANDARDCASE",1114901282:"IFCMEDICALDEVICETYPE",3113134337:"IFCINTERSECTIONCURVE",3946677679:"IFCINTERCEPTORTYPE",2571569899:"IFCINDEXEDPOLYCURVE",3493046030:"IFCGEOGRAPHICELEMENT",1509553395:"IFCFURNITURE",1893162501:"IFCFOOTINGTYPE",2853485674:"IFCEXTERNALSPATIALSTRUCTUREELEMENT",4148101412:"IFCEVENT",132023988:"IFCENGINETYPE",2397081782:"IFCELEMENTASSEMBLYTYPE",2323601079:"IFCDOORTYPE",1213902940:"IFCCYLINDRICALSURFACE",1525564444:"IFCCONSTRUCTIONPRODUCTRESOURCETYPE",4105962743:"IFCCONSTRUCTIONMATERIALRESOURCETYPE",2185764099:"IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE",15328376:"IFCCOMPOSITECURVEONSURFACE",3875453745:"IFCCOMPLEXPROPERTYTEMPLATE",3893394355:"IFCCIVILELEMENTTYPE",2197970202:"IFCCHIMNEYTYPE",167062518:"IFCBSPLINESURFACEWITHKNOTS",2887950389:"IFCBSPLINESURFACE",2603310189:"IFCADVANCEDBREPWITHVOIDS",1635779807:"IFCADVANCEDBREP",2916149573:"IFCTRIANGULATEDFACESET",1935646853:"IFCTOROIDALSURFACE",2387106220:"IFCTESSELLATEDFACESET",3206491090:"IFCTASKTYPE",699246055:"IFCSURFACECURVE",4095615324:"IFCSUBCONTRACTRESOURCETYPE",603775116:"IFCSTRUCTURALSURFACEREACTION",4015995234:"IFCSPHERICALSURFACE",2481509218:"IFCSPATIALZONETYPE",463610769:"IFCSPATIALZONE",710998568:"IFCSPATIALELEMENTTYPE",1412071761:"IFCSPATIALELEMENT",3663146110:"IFCSIMPLEPROPERTYTEMPLATE",3243963512:"IFCREVOLVEDAREASOLIDTAPERED",816062949:"IFCREPARAMETRISEDCOMPOSITECURVESEGMENT",1521410863:"IFCRELSPACEBOUNDARY2NDLEVEL",3523091289:"IFCRELSPACEBOUNDARY1STLEVEL",427948657:"IFCRELINTERFERESELEMENTS",307848117:"IFCRELDEFINESBYTEMPLATE",1462361463:"IFCRELDEFINESBYOBJECT",2565941209:"IFCRELDECLARES",1027710054:"IFCRELASSIGNSTOGROUPBYFACTOR",3521284610:"IFCPROPERTYTEMPLATE",492091185:"IFCPROPERTYSETTEMPLATE",653396225:"IFCPROJECTLIBRARY",569719735:"IFCPROCEDURETYPE",3967405729:"IFCPREDEFINEDPROPERTYSET",1682466193:"IFCPCURVE",428585644:"IFCLABORRESOURCETYPE",2294589976:"IFCINDEXEDPOLYGONALFACEWITHVOIDS",178912537:"IFCINDEXEDPOLYGONALFACE",4095422895:"IFCGEOGRAPHICELEMENTTYPE",2652556860:"IFCFIXEDREFERENCESWEPTAREASOLID",2804161546:"IFCEXTRUDEDAREASOLIDTAPERED",4024345920:"IFCEVENTTYPE",2629017746:"IFCCURVEBOUNDEDSURFACE",1815067380:"IFCCREWRESOURCETYPE",3419103109:"IFCCONTEXT",2574617495:"IFCCONSTRUCTIONRESOURCETYPE",2059837836:"IFCCARTESIANPOINTLIST3D",1675464909:"IFCCARTESIANPOINTLIST2D",574549367:"IFCCARTESIANPOINTLIST",3406155212:"IFCADVANCEDFACE",3698973494:"IFCTYPERESOURCE",3736923433:"IFCTYPEPROCESS",901063453:"IFCTESSELLATEDITEM",1096409881:"IFCSWEPTDISKSOLIDPOLYGONAL",1042787934:"IFCRESOURCETIME",1608871552:"IFCRESOURCECONSTRAINTRELATIONSHIP",2943643501:"IFCRESOURCEAPPROVALRELATIONSHIP",2090586900:"IFCQUANTITYSET",1482703590:"IFCPROPERTYTEMPLATEDEFINITION",3778827333:"IFCPREDEFINEDPROPERTIES",2998442950:"IFCMIRROREDPROFILEDEF",853536259:"IFCMATERIALRELATIONSHIP",3404854881:"IFCMATERIALPROFILESETUSAGETAPERING",3079605661:"IFCMATERIALPROFILESETUSAGE",2852063980:"IFCMATERIALCONSTITUENTSET",3708119e3:"IFCMATERIALCONSTITUENT",1585845231:"IFCLAGTIME",2133299955:"IFCINDEXEDTRIANGLETEXTUREMAP",1437953363:"IFCINDEXEDTEXTUREMAP",3570813810:"IFCINDEXEDCOLOURMAP",1437805879:"IFCEXTERNALREFERENCERELATIONSHIP",297599258:"IFCEXTENDEDPROPERTIES",211053100:"IFCEVENTTIME",2713554722:"IFCCONVERSIONBASEDUNITWITHOFFSET",3285139300:"IFCCOLOURRGBLIST",1236880293:"IFCWORKTIME",1199560280:"IFCTIMEPERIOD",3611470254:"IFCTEXTUREVERTEXLIST",2771591690:"IFCTASKTIMERECURRING",1549132990:"IFCTASKTIME",2043862942:"IFCTABLECOLUMN",2934153892:"IFCSURFACEREINFORCEMENTAREA",609421318:"IFCSTRUCTURALLOADORRESULT",3478079324:"IFCSTRUCTURALLOADCONFIGURATION",1054537805:"IFCSCHEDULINGTIME",2439245199:"IFCRESOURCELEVELRELATIONSHIP",2433181523:"IFCREFERENCE",3915482550:"IFCRECURRENCEPATTERN",986844984:"IFCPROPERTYABSTRACTION",3843373140:"IFCPROJECTEDCRS",677532197:"IFCPRESENTATIONITEM",1507914824:"IFCMATERIALUSAGEDEFINITION",552965576:"IFCMATERIALPROFILEWITHOFFSETS",164193824:"IFCMATERIALPROFILESET",2235152071:"IFCMATERIALPROFILE",1847252529:"IFCMATERIALLAYERWITHOFFSETS",760658860:"IFCMATERIALDEFINITION",3057273783:"IFCMAPCONVERSION",4294318154:"IFCEXTERNALINFORMATION",1466758467:"IFCCOORDINATEREFERENCESYSTEM",1785450214:"IFCCOORDINATEOPERATION",775493141:"IFCCONNECTIONVOLUMEGEOMETRY",979691226:"IFCREINFORCINGBAR",3700593921:"IFCELECTRICDISTRIBUTIONPOINT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",578613899:"IFCCONTROLLERTYPE",2454782716:"IFCCHAMFEREDGEFEATURE",753842376:"IFCBEAM",3001207471:"IFCALARMTYPE",2874132201:"IFCACTUATORTYPE",3304561284:"IFCWINDOW",3512223829:"IFCWALLSTANDARDCASE",2391406946:"IFCWALL",3313531582:"IFCVIBRATIONISOLATORTYPE",2347447852:"IFCTENDONANCHOR",3824725483:"IFCTENDON",2515109513:"IFCSTRUCTURALANALYSISMODEL",4252922144:"IFCSTAIRFLIGHT",331165859:"IFCSTAIR",1529196076:"IFCSLAB",1783015770:"IFCSENSORTYPE",1376911519:"IFCROUNDEDEDGEFEATURE",2016517767:"IFCROOF",2320036040:"IFCREINFORCINGMESH",3027567501:"IFCREINFORCINGELEMENT",3055160366:"IFCRATIONALBEZIERCURVE",3283111854:"IFCRAMPFLIGHT",3024970846:"IFCRAMP",2262370178:"IFCRAILING",3171933400:"IFCPLATE",1687234759:"IFCPILE",1073191201:"IFCMEMBER",900683007:"IFCFOOTING",3508470533:"IFCFLOWTREATMENTDEVICE",2223149337:"IFCFLOWTERMINAL",707683696:"IFCFLOWSTORAGEDEVICE",987401354:"IFCFLOWSEGMENT",3132237377:"IFCFLOWMOVINGDEVICE",4037862832:"IFCFLOWINSTRUMENTTYPE",4278956645:"IFCFLOWFITTING",2058353004:"IFCFLOWCONTROLLER",4222183408:"IFCFIRESUPPRESSIONTERMINALTYPE",1810631287:"IFCFILTERTYPE",346874300:"IFCFANTYPE",1658829314:"IFCENERGYCONVERSIONDEVICE",857184966:"IFCELECTRICALELEMENT",1634875225:"IFCELECTRICALCIRCUIT",712377611:"IFCELECTRICTIMECONTROLTYPE",1217240411:"IFCELECTRICMOTORTYPE",1365060375:"IFCELECTRICHEATERTYPE",1534661035:"IFCELECTRICGENERATORTYPE",3277789161:"IFCELECTRICFLOWSTORAGEDEVICETYPE",663422040:"IFCELECTRICAPPLIANCETYPE",855621170:"IFCEDGEFEATURE",2030761528:"IFCDUCTSILENCERTYPE",3760055223:"IFCDUCTSEGMENTTYPE",869906466:"IFCDUCTFITTINGTYPE",395920057:"IFCDOOR",3041715199:"IFCDISTRIBUTIONPORT",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",1945004755:"IFCDISTRIBUTIONELEMENT",2063403501:"IFCDISTRIBUTIONCONTROLELEMENTTYPE",1599208980:"IFCDISTRIBUTIONCHAMBERELEMENTTYPE",2635815018:"IFCDISCRETEACCESSORYTYPE",1335981549:"IFCDISCRETEACCESSORY",4147604152:"IFCDIAMETERDIMENSION",3961806047:"IFCDAMPERTYPE",3495092785:"IFCCURTAINWALL",1973544240:"IFCCOVERING",2954562838:"IFCCOOLINGTOWERTYPE",335055490:"IFCCOOLEDBEAMTYPE",488727124:"IFCCONSTRUCTIONPRODUCTRESOURCE",1060000209:"IFCCONSTRUCTIONMATERIALRESOURCE",3898045240:"IFCCONSTRUCTIONEQUIPMENTRESOURCE",1163958913:"IFCCONDITIONCRITERION",2188551683:"IFCCONDITION",2816379211:"IFCCONDENSERTYPE",3850581409:"IFCCOMPRESSORTYPE",843113511:"IFCCOLUMN",2301859152:"IFCCOILTYPE",2611217952:"IFCCIRCLE",2951183804:"IFCCHILLERTYPE",1285652485:"IFCCABLESEGMENTTYPE",3293546465:"IFCCABLECARRIERSEGMENTTYPE",395041908:"IFCCABLECARRIERFITTINGTYPE",1909888760:"IFCBUILDINGELEMENTPROXYTYPE",1095909175:"IFCBUILDINGELEMENTPROXY",2979338954:"IFCBUILDINGELEMENTPART",52481810:"IFCBUILDINGELEMENTCOMPONENT",3299480353:"IFCBUILDINGELEMENT",231477066:"IFCBOILERTYPE",1916977116:"IFCBEZIERCURVE",819618141:"IFCBEAMTYPE",1967976161:"IFCBSPLINECURVE",3460190687:"IFCASSET",2470393545:"IFCANGULARDIMENSION",1871374353:"IFCAIRTOAIRHEATRECOVERYTYPE",3352864051:"IFCAIRTERMINALTYPE",1411407467:"IFCAIRTERMINALBOXTYPE",3821786052:"IFCACTIONREQUEST",1213861670:"IFC2DCOMPOSITECURVE",1033361043:"IFCZONE",3342526732:"IFCWORKSCHEDULE",4218914973:"IFCWORKPLAN",1028945134:"IFCWORKCONTROL",1133259667:"IFCWASTETERMINALTYPE",1898987631:"IFCWALLTYPE",2769231204:"IFCVIRTUALELEMENT",728799441:"IFCVALVETYPE",1911125066:"IFCUNITARYEQUIPMENTTYPE",1600972822:"IFCTUBEBUNDLETYPE",3593883385:"IFCTRIMMEDCURVE",1620046519:"IFCTRANSPORTELEMENT",1692211062:"IFCTRANSFORMERTYPE",1637806684:"IFCTIMESERIESSCHEDULE",5716631:"IFCTANKTYPE",2254336722:"IFCSYSTEM",2315554128:"IFCSWITCHINGDEVICETYPE",148013059:"IFCSUBCONTRACTRESOURCE",1975003073:"IFCSTRUCTURALSURFACECONNECTION",2986769608:"IFCSTRUCTURALRESULTGROUP",1235345126:"IFCSTRUCTURALPOINTREACTION",734778138:"IFCSTRUCTURALPOINTCONNECTION",2082059205:"IFCSTRUCTURALPOINTACTION",3987759626:"IFCSTRUCTURALPLANARACTIONVARYING",1621171031:"IFCSTRUCTURALPLANARACTION",1252848954:"IFCSTRUCTURALLOADGROUP",1721250024:"IFCSTRUCTURALLINEARACTIONVARYING",1807405624:"IFCSTRUCTURALLINEARACTION",2445595289:"IFCSTRUCTURALCURVEMEMBERVARYING",214636428:"IFCSTRUCTURALCURVEMEMBER",4243806635:"IFCSTRUCTURALCURVECONNECTION",1179482911:"IFCSTRUCTURALCONNECTION",682877961:"IFCSTRUCTURALACTION",1039846685:"IFCSTAIRFLIGHTTYPE",3112655638:"IFCSTACKTERMINALTYPE",3812236995:"IFCSPACETYPE",652456506:"IFCSPACEPROGRAM",1305183839:"IFCSPACEHEATERTYPE",3856911033:"IFCSPACE",2533589738:"IFCSLABTYPE",4097777520:"IFCSITE",4105383287:"IFCSERVICELIFE",3517283431:"IFCSCHEDULETIMECONTROL",1768891740:"IFCSANITARYTERMINALTYPE",2863920197:"IFCRELASSIGNSTASKS",160246688:"IFCRELAGGREGATES",2324767716:"IFCRAMPFLIGHTTYPE",2893384427:"IFCRAILINGTYPE",3248260540:"IFCRADIUSDIMENSION",2250791053:"IFCPUMPTYPE",1842657554:"IFCPROTECTIVEDEVICETYPE",3651124850:"IFCPROJECTIONELEMENT",3642467123:"IFCPROJECTORDERRECORD",2904328755:"IFCPROJECTORDER",2744685151:"IFCPROCEDURE",3740093272:"IFCPORT",3724593414:"IFCPOLYLINE",4017108033:"IFCPLATETYPE",4231323485:"IFCPIPESEGMENTTYPE",804291784:"IFCPIPEFITTINGTYPE",3327091369:"IFCPERMIT",2382730787:"IFCPERFORMANCEHISTORY",2837617999:"IFCOUTLETTYPE",3425660407:"IFCORDERACTION",3588315303:"IFCOPENINGELEMENT",4143007308:"IFCOCCUPANT",1916936684:"IFCMOVE",977012517:"IFCMOTORCONNECTIONTYPE",3181161470:"IFCMEMBERTYPE",2108223431:"IFCMECHANICALFASTENERTYPE",377706215:"IFCMECHANICALFASTENER",2506943328:"IFCLINEARDIMENSION",1161773419:"IFCLIGHTFIXTURETYPE",1051575348:"IFCLAMPTYPE",3827777499:"IFCLABORRESOURCE",4288270099:"IFCJUNCTIONBOXTYPE",2391368822:"IFCINVENTORY",1806887404:"IFCHUMIDIFIERTYPE",1251058090:"IFCHEATEXCHANGERTYPE",2706460486:"IFCGROUP",3009204131:"IFCGRID",200128114:"IFCGASTERMINALTYPE",814719939:"IFCFURNITURESTANDARD",263784265:"IFCFURNISHINGELEMENT",3009222698:"IFCFLOWTREATMENTDEVICETYPE",2297155007:"IFCFLOWTERMINALTYPE",1339347760:"IFCFLOWSTORAGEDEVICETYPE",1834744321:"IFCFLOWSEGMENTTYPE",1482959167:"IFCFLOWMOVINGDEVICETYPE",3815607619:"IFCFLOWMETERTYPE",3198132628:"IFCFLOWFITTINGTYPE",3907093117:"IFCFLOWCONTROLLERTYPE",1287392070:"IFCFEATUREELEMENTSUBTRACTION",2143335405:"IFCFEATUREELEMENTADDITION",2827207264:"IFCFEATUREELEMENT",2489546625:"IFCFASTENERTYPE",647756555:"IFCFASTENER",3737207727:"IFCFACETEDBREPWITHVOIDS",807026263:"IFCFACETEDBREP",3390157468:"IFCEVAPORATORTYPE",3174744832:"IFCEVAPORATIVECOOLERTYPE",3272907226:"IFCEQUIPMENTSTANDARD",1962604670:"IFCEQUIPMENTELEMENT",2107101300:"IFCENERGYCONVERSIONDEVICETYPE",1704287377:"IFCELLIPSE",2590856083:"IFCELEMENTCOMPONENTTYPE",1623761950:"IFCELEMENTCOMPONENT",4123344466:"IFCELEMENTASSEMBLY",1758889154:"IFCELEMENT",360485395:"IFCELECTRICALBASEPROPERTIES",3849074793:"IFCDISTRIBUTIONFLOWELEMENTTYPE",3256556792:"IFCDISTRIBUTIONELEMENTTYPE",681481545:"IFCDIMENSIONCURVEDIRECTEDCALLOUT",1457835157:"IFCCURTAINWALLTYPE",3295246426:"IFCCREWRESOURCE",1916426348:"IFCCOVERINGTYPE",1419761937:"IFCCOSTSCHEDULE",3895139033:"IFCCOSTITEM",3293443760:"IFCCONTROL",2559216714:"IFCCONSTRUCTIONRESOURCE",2510884976:"IFCCONIC",3732776249:"IFCCOMPOSITECURVE",300633059:"IFCCOLUMNTYPE",2937912522:"IFCCIRCLEHOLLOWPROFILEDEF",3124254112:"IFCBUILDINGSTOREY",1950629157:"IFCBUILDINGELEMENTTYPE",4031249490:"IFCBUILDING",1260505505:"IFCBOUNDEDCURVE",3649129432:"IFCBOOLEANCLIPPINGRESULT",1334484129:"IFCBLOCK",3207858831:"IFCASYMMETRICISHAPEPROFILEDEF",1674181508:"IFCANNOTATION",2296667514:"IFCACTOR",2097647324:"IFCTRANSPORTELEMENTTYPE",3473067441:"IFCTASK",1580310250:"IFCSYSTEMFURNITUREELEMENTTYPE",4124788165:"IFCSURFACEOFREVOLUTION",2809605785:"IFCSURFACEOFLINEAREXTRUSION",2028607225:"IFCSURFACECURVESWEPTAREASOLID",4070609034:"IFCSTRUCTUREDDIMENSIONCALLOUT",2218152070:"IFCSTRUCTURALSURFACEMEMBERVARYING",3979015343:"IFCSTRUCTURALSURFACEMEMBER",3689010777:"IFCSTRUCTURALREACTION",530289379:"IFCSTRUCTURALMEMBER",3136571912:"IFCSTRUCTURALITEM",3544373492:"IFCSTRUCTURALACTIVITY",451544542:"IFCSPHERE",3893378262:"IFCSPATIALSTRUCTUREELEMENTTYPE",2706606064:"IFCSPATIALSTRUCTUREELEMENT",3626867408:"IFCRIGHTCIRCULARCYLINDER",4158566097:"IFCRIGHTCIRCULARCONE",1856042241:"IFCREVOLVEDAREASOLID",2914609552:"IFCRESOURCE",1401173127:"IFCRELVOIDSELEMENT",3451746338:"IFCRELSPACEBOUNDARY",366585022:"IFCRELSERVICESBUILDINGS",4122056220:"IFCRELSEQUENCE",1058617721:"IFCRELSCHEDULESCOSTITEMS",1245217292:"IFCRELREFERENCEDINSPATIALSTRUCTURE",750771296:"IFCRELPROJECTSELEMENT",202636808:"IFCRELOVERRIDESPROPERTIES",2051452291:"IFCRELOCCUPIESSPACES",3268803585:"IFCRELNESTS",4189434867:"IFCRELINTERACTIONREQUIREMENTS",279856033:"IFCRELFLOWCONTROLELEMENTS",3940055652:"IFCRELFILLSELEMENT",781010003:"IFCRELDEFINESBYTYPE",4186316022:"IFCRELDEFINESBYPROPERTIES",693640335:"IFCRELDEFINES",2551354335:"IFCRELDECOMPOSES",2802773753:"IFCRELCOVERSSPACES",886880790:"IFCRELCOVERSBLDGELEMENTS",3242617779:"IFCRELCONTAINEDINSPATIALSTRUCTURE",3678494232:"IFCRELCONNECTSWITHREALIZINGELEMENTS",504942748:"IFCRELCONNECTSWITHECCENTRICITY",1638771189:"IFCRELCONNECTSSTRUCTURALMEMBER",3912681535:"IFCRELCONNECTSSTRUCTURALELEMENT",2127690289:"IFCRELCONNECTSSTRUCTURALACTIVITY",3190031847:"IFCRELCONNECTSPORTS",4201705270:"IFCRELCONNECTSPORTTOELEMENT",3945020480:"IFCRELCONNECTSPATHELEMENTS",1204542856:"IFCRELCONNECTSELEMENTS",826625072:"IFCRELCONNECTS",2851387026:"IFCRELASSOCIATESPROFILEPROPERTIES",2655215786:"IFCRELASSOCIATESMATERIAL",3840914261:"IFCRELASSOCIATESLIBRARY",982818633:"IFCRELASSOCIATESDOCUMENT",2728634034:"IFCRELASSOCIATESCONSTRAINT",919958153:"IFCRELASSOCIATESCLASSIFICATION",4095574036:"IFCRELASSOCIATESAPPROVAL",1327628568:"IFCRELASSOCIATESAPPLIEDVALUE",1865459582:"IFCRELASSOCIATES",205026976:"IFCRELASSIGNSTORESOURCE",3372526763:"IFCRELASSIGNSTOPROJECTORDER",2857406711:"IFCRELASSIGNSTOPRODUCT",4278684876:"IFCRELASSIGNSTOPROCESS",1307041759:"IFCRELASSIGNSTOGROUP",2495723537:"IFCRELASSIGNSTOCONTROL",1683148259:"IFCRELASSIGNSTOACTOR",3939117080:"IFCRELASSIGNS",3454111270:"IFCRECTANGULARTRIMMEDSURFACE",2798486643:"IFCRECTANGULARPYRAMID",2770003689:"IFCRECTANGLEHOLLOWPROFILEDEF",3219374653:"IFCPROXY",1451395588:"IFCPROPERTYSET",4194566429:"IFCPROJECTIONCURVE",103090709:"IFCPROJECT",4208778838:"IFCPRODUCT",2945172077:"IFCPROCESS",220341763:"IFCPLANE",603570806:"IFCPLANARBOX",3566463478:"IFCPERMEABLECOVERINGPROPERTIES",3505215534:"IFCOFFSETCURVE3D",3388369263:"IFCOFFSETCURVE2D",3888040117:"IFCOBJECT",1425443689:"IFCMANIFOLDSOLIDBREP",1281925730:"IFCLINE",572779678:"IFCLSHAPEPROFILEDEF",1484403080:"IFCISHAPEPROFILEDEF",987898635:"IFCGEOMETRICCURVESET",1268542332:"IFCFURNITURETYPE",4238390223:"IFCFURNISHINGELEMENTTYPE",3455213021:"IFCFLUIDFLOWPROPERTIES",315944413:"IFCFILLAREASTYLETILES",4203026998:"IFCFILLAREASTYLETILESYMBOLWITHSTYLE",374418227:"IFCFILLAREASTYLEHATCHING",2047409740:"IFCFACEBASEDSURFACEMODEL",477187591:"IFCEXTRUDEDAREASOLID",80994333:"IFCENERGYPROPERTIES",2835456948:"IFCELLIPSEPROFILEDEF",2777663545:"IFCELEMENTARYSURFACE",339256511:"IFCELEMENTTYPE",1883228015:"IFCELEMENTQUANTITY",1472233963:"IFCEDGELOOP",4006246654:"IFCDRAUGHTINGPREDEFINEDCURVEFONT",445594917:"IFCDRAUGHTINGPREDEFINEDCOLOUR",3073041342:"IFCDRAUGHTINGCALLOUT",526551008:"IFCDOORSTYLE",1714330368:"IFCDOORPANELPROPERTIES",2963535650:"IFCDOORLININGPROPERTIES",32440307:"IFCDIRECTION",4054601972:"IFCDIMENSIONCURVETERMINATOR",606661476:"IFCDIMENSIONCURVE",693772133:"IFCDEFINEDSYMBOL",2827736869:"IFCCURVEBOUNDEDPLANE",2601014836:"IFCCURVE",2147822146:"IFCCSGSOLID",2506170314:"IFCCSGPRIMITIVE3D",194851669:"IFCCRANERAILFSHAPEPROFILEDEF",4133800736:"IFCCRANERAILASHAPEPROFILEDEF",2485617015:"IFCCOMPOSITECURVESEGMENT",2205249479:"IFCCLOSEDSHELL",1383045692:"IFCCIRCLEPROFILEDEF",1416205885:"IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM",3331915920:"IFCCARTESIANTRANSFORMATIONOPERATOR3D",3486308946:"IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM",3749851601:"IFCCARTESIANTRANSFORMATIONOPERATOR2D",59481748:"IFCCARTESIANTRANSFORMATIONOPERATOR",1123145078:"IFCCARTESIANPOINT",2898889636:"IFCCSHAPEPROFILEDEF",2713105998:"IFCBOXEDHALFSPACE",2581212453:"IFCBOUNDINGBOX",4182860854:"IFCBOUNDEDSURFACE",2736907675:"IFCBOOLEANRESULT",2740243338:"IFCAXIS2PLACEMENT3D",3125803723:"IFCAXIS2PLACEMENT2D",4261334040:"IFCAXIS1PLACEMENT",1302238472:"IFCANNOTATIONSURFACE",2265737646:"IFCANNOTATIONFILLAREAOCCURRENCE",669184980:"IFCANNOTATIONFILLAREA",3288037868:"IFCANNOTATIONCURVEOCCURRENCE",2543172580:"IFCZSHAPEPROFILEDEF",1299126871:"IFCWINDOWSTYLE",512836454:"IFCWINDOWPANELPROPERTIES",336235671:"IFCWINDOWLININGPROPERTIES",2759199220:"IFCVERTEXLOOP",1417489154:"IFCVECTOR",427810014:"IFCUSHAPEPROFILEDEF",2347495698:"IFCTYPEPRODUCT",1628702193:"IFCTYPEOBJECT",1345879162:"IFCTWODIRECTIONREPEATFACTOR",2715220739:"IFCTRAPEZIUMPROFILEDEF",3124975700:"IFCTEXTLITERALWITHEXTENT",4282788508:"IFCTEXTLITERAL",3028897424:"IFCTERMINATORSYMBOL",3071757647:"IFCTSHAPEPROFILEDEF",230924584:"IFCSWEPTSURFACE",1260650574:"IFCSWEPTDISKSOLID",2247615214:"IFCSWEPTAREASOLID",1878645084:"IFCSURFACESTYLERENDERING",2513912981:"IFCSURFACE",2233826070:"IFCSUBEDGE",3653947884:"IFCSTRUCTURALSTEELPROFILEPROPERTIES",3843319758:"IFCSTRUCTURALPROFILEPROPERTIES",1190533807:"IFCSTRUCTURALLOADSINGLEFORCEWARPING",1597423693:"IFCSTRUCTURALLOADSINGLEFORCE",1973038258:"IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION",2473145415:"IFCSTRUCTURALLOADSINGLEDISPLACEMENT",2668620305:"IFCSTRUCTURALLOADPLANARFORCE",1595516126:"IFCSTRUCTURALLOADLINEARFORCE",390701378:"IFCSPACETHERMALLOADPROPERTIES",1202362311:"IFCSOUNDVALUE",2485662743:"IFCSOUNDPROPERTIES",723233188:"IFCSOLIDMODEL",2609359061:"IFCSLIPPAGECONNECTIONCONDITION",4124623270:"IFCSHELLBASEDSURFACEMODEL",2411513650:"IFCSERVICELIFEFACTOR",1509187699:"IFCSECTIONEDSPINE",2778083089:"IFCROUNDEDRECTANGLEPROFILEDEF",478536968:"IFCRELATIONSHIP",3765753017:"IFCREINFORCEMENTDEFINITIONPROPERTIES",3413951693:"IFCREGULARTIMESERIES",3615266464:"IFCRECTANGLEPROFILEDEF",110355661:"IFCPROPERTYTABLEVALUE",3650150729:"IFCPROPERTYSINGLEVALUE",3357820518:"IFCPROPERTYSETDEFINITION",941946838:"IFCPROPERTYREFERENCEVALUE",2752243245:"IFCPROPERTYLISTVALUE",4166981789:"IFCPROPERTYENUMERATEDVALUE",1680319473:"IFCPROPERTYDEFINITION",871118103:"IFCPROPERTYBOUNDEDVALUE",673634403:"IFCPRODUCTDEFINITIONSHAPE",179317114:"IFCPREDEFINEDPOINTMARKERSYMBOL",433424934:"IFCPREDEFINEDDIMENSIONSYMBOL",2559016684:"IFCPREDEFINEDCURVEFONT",759155922:"IFCPREDEFINEDCOLOUR",2775532180:"IFCPOLYGONALBOUNDEDHALFSPACE",2924175390:"IFCPOLYLOOP",1423911732:"IFCPOINTONSURFACE",4022376103:"IFCPOINTONCURVE",2067069095:"IFCPOINT",1663979128:"IFCPLANAREXTENT",2004835150:"IFCPLACEMENT",597895409:"IFCPIXELTEXTURE",3021840470:"IFCPHYSICALCOMPLEXQUANTITY",2519244187:"IFCPATH",2529465313:"IFCPARAMETERIZEDPROFILEDEF",1029017970:"IFCORIENTEDEDGE",2665983363:"IFCOPENSHELL",2833995503:"IFCONEDIRECTIONREPEATFACTOR",219451334:"IFCOBJECTDEFINITION",1430189142:"IFCMECHANICALCONCRETEMATERIALPROPERTIES",2022407955:"IFCMATERIALDEFINITIONREPRESENTATION",2347385850:"IFCMAPPEDITEM",1008929658:"IFCLOOP",2624227202:"IFCLOCALPLACEMENT",3422422726:"IFCLIGHTSOURCESPOT",1520743889:"IFCLIGHTSOURCEPOSITIONAL",4266656042:"IFCLIGHTSOURCEGONIOMETRIC",2604431987:"IFCLIGHTSOURCEDIRECTIONAL",125510826:"IFCLIGHTSOURCEAMBIENT",1402838566:"IFCLIGHTSOURCE",3741457305:"IFCIRREGULARTIMESERIES",3905492369:"IFCIMAGETEXTURE",2445078500:"IFCHYGROSCOPICMATERIALPROPERTIES",812098782:"IFCHALFSPACESOLID",178086475:"IFCGRIDPLACEMENT",3590301190:"IFCGEOMETRICSET",4142052618:"IFCGEOMETRICREPRESENTATIONSUBCONTEXT",2453401579:"IFCGEOMETRICREPRESENTATIONITEM",3448662350:"IFCGEOMETRICREPRESENTATIONCONTEXT",1446786286:"IFCGENERALPROFILEPROPERTIES",803998398:"IFCGENERALMATERIALPROPERTIES",3857492461:"IFCFUELPROPERTIES",738692330:"IFCFILLAREASTYLE",4219587988:"IFCFAILURECONNECTIONCONDITION",3008276851:"IFCFACESURFACE",803316827:"IFCFACEOUTERBOUND",1809719519:"IFCFACEBOUND",2556980723:"IFCFACE",1860660968:"IFCEXTENDEDMATERIALPROPERTIES",476780140:"IFCEDGECURVE",3900360178:"IFCEDGE",4170525392:"IFCDRAUGHTINGPREDEFINEDTEXTFONT",3732053477:"IFCDOCUMENTREFERENCE",1694125774:"IFCDIMENSIONPAIR",2273265877:"IFCDIMENSIONCALLOUTRELATIONSHIP",3632507154:"IFCDERIVEDPROFILEDEF",3800577675:"IFCCURVESTYLE",2889183280:"IFCCONVERSIONBASEDUNIT",3050246964:"IFCCONTEXTDEPENDENTUNIT",45288368:"IFCCONNECTIONPOINTECCENTRICITY",1981873012:"IFCCONNECTIONCURVEGEOMETRY",370225590:"IFCCONNECTEDFACESET",1485152156:"IFCCOMPOSITEPROFILEDEF",2542286263:"IFCCOMPLEXPROPERTY",776857604:"IFCCOLOURRGB",647927063:"IFCCLASSIFICATIONREFERENCE",3150382593:"IFCCENTERLINEPROFILEDEF",616511568:"IFCBLOBTEXTURE",2705031697:"IFCARBITRARYPROFILEDEFWITHVOIDS",1310608509:"IFCARBITRARYOPENPROFILEDEF",3798115385:"IFCARBITRARYCLOSEDPROFILEDEF",2297822566:"IFCANNOTATIONTEXTOCCURRENCE",3612888222:"IFCANNOTATIONSYMBOLOCCURRENCE",962685235:"IFCANNOTATIONSURFACEOCCURRENCE",2442683028:"IFCANNOTATIONOCCURRENCE",1065908215:"IFCWATERPROPERTIES",891718957:"IFCVIRTUALGRIDINTERSECTION",1907098498:"IFCVERTEXPOINT",3304826586:"IFCVERTEXBASEDTEXTUREMAP",2799835756:"IFCVERTEX",180925521:"IFCUNITASSIGNMENT",1735638870:"IFCTOPOLOGYREPRESENTATION",1377556343:"IFCTOPOLOGICALREPRESENTATIONITEM",581633288:"IFCTIMESERIESVALUE",1718945513:"IFCTIMESERIESREFERENCERELATIONSHIP",3101149627:"IFCTIMESERIES",3317419933:"IFCTHERMALMATERIALPROPERTIES",1210645708:"IFCTEXTUREVERTEX",2552916305:"IFCTEXTUREMAP",1742049831:"IFCTEXTURECOORDINATEGENERATOR",280115917:"IFCTEXTURECOORDINATE",1484833681:"IFCTEXTSTYLEWITHBOXCHARACTERISTICS",1640371178:"IFCTEXTSTYLETEXTMODEL",2636378356:"IFCTEXTSTYLEFORDEFINEDFONT",1983826977:"IFCTEXTSTYLEFONTMODEL",1447204868:"IFCTEXTSTYLE",912023232:"IFCTELECOMADDRESS",531007025:"IFCTABLEROW",985171141:"IFCTABLE",1290481447:"IFCSYMBOLSTYLE",626085974:"IFCSURFACETEXTURE",1351298697:"IFCSURFACESTYLEWITHTEXTURES",846575682:"IFCSURFACESTYLESHADING",1607154358:"IFCSURFACESTYLEREFRACTION",3303107099:"IFCSURFACESTYLELIGHTING",1300840506:"IFCSURFACESTYLE",3049322572:"IFCSTYLEDREPRESENTATION",3958052878:"IFCSTYLEDITEM",2830218821:"IFCSTYLEMODEL",3408363356:"IFCSTRUCTURALLOADTEMPERATURE",2525727697:"IFCSTRUCTURALLOADSTATIC",2162789131:"IFCSTRUCTURALLOAD",2273995522:"IFCSTRUCTURALCONNECTIONCONDITION",3692461612:"IFCSIMPLEPROPERTY",4240577450:"IFCSHAPEREPRESENTATION",3982875396:"IFCSHAPEMODEL",867548509:"IFCSHAPEASPECT",4165799628:"IFCSECTIONREINFORCEMENTPROPERTIES",2042790032:"IFCSECTIONPROPERTIES",448429030:"IFCSIUNIT",2341007311:"IFCROOT",3679540991:"IFCRIBPLATEPROFILEPROPERTIES",1660063152:"IFCREPRESENTATIONMAP",3008791417:"IFCREPRESENTATIONITEM",3377609919:"IFCREPRESENTATIONCONTEXT",1076942058:"IFCREPRESENTATION",1222501353:"IFCRELAXATION",1580146022:"IFCREINFORCEMENTBARPROPERTIES",2692823254:"IFCREFERENCESVALUEDOCUMENT",825690147:"IFCQUANTITYWEIGHT",2405470396:"IFCQUANTITYVOLUME",3252649465:"IFCQUANTITYTIME",931644368:"IFCQUANTITYLENGTH",2093928680:"IFCQUANTITYCOUNT",2044713172:"IFCQUANTITYAREA",3710013099:"IFCPROPERTYENUMERATION",148025276:"IFCPROPERTYDEPENDENCYRELATIONSHIP",3896028662:"IFCPROPERTYCONSTRAINTRELATIONSHIP",2598011224:"IFCPROPERTY",2802850158:"IFCPROFILEPROPERTIES",3958567839:"IFCPROFILEDEF",2267347899:"IFCPRODUCTSOFCOMBUSTIONPROPERTIES",2095639259:"IFCPRODUCTREPRESENTATION",2417041796:"IFCPRESENTATIONSTYLEASSIGNMENT",3119450353:"IFCPRESENTATIONSTYLE",1304840413:"IFCPRESENTATIONLAYERWITHSTYLE",2022622350:"IFCPRESENTATIONLAYERASSIGNMENT",1775413392:"IFCPREDEFINEDTEXTFONT",3213052703:"IFCPREDEFINEDTERMINATORSYMBOL",990879717:"IFCPREDEFINEDSYMBOL",3727388367:"IFCPREDEFINEDITEM",3355820592:"IFCPOSTALADDRESS",2226359599:"IFCPHYSICALSIMPLEQUANTITY",2483315170:"IFCPHYSICALQUANTITY",101040310:"IFCPERSONANDORGANIZATION",2077209135:"IFCPERSON",1207048766:"IFCOWNERHISTORY",1411181986:"IFCORGANIZATIONRELATIONSHIP",4251960020:"IFCORGANIZATION",1227763645:"IFCOPTICALMATERIALPROPERTIES",2251480897:"IFCOBJECTIVE",3701648758:"IFCOBJECTPLACEMENT",1918398963:"IFCNAMEDUNIT",2706619895:"IFCMONETARYUNIT",3368373690:"IFCMETRIC",677618848:"IFCMECHANICALSTEELMATERIALPROPERTIES",4256014907:"IFCMECHANICALMATERIALPROPERTIES",2597039031:"IFCMEASUREWITHUNIT",3265635763:"IFCMATERIALPROPERTIES",2199411900:"IFCMATERIALLIST",1303795690:"IFCMATERIALLAYERSETUSAGE",3303938423:"IFCMATERIALLAYERSET",248100487:"IFCMATERIALLAYER",1847130766:"IFCMATERIALCLASSIFICATIONRELATIONSHIP",1838606355:"IFCMATERIAL",30780891:"IFCLOCALTIME",1566485204:"IFCLIGHTINTENSITYDISTRIBUTION",4162380809:"IFCLIGHTDISTRIBUTIONDATA",3452421091:"IFCLIBRARYREFERENCE",2655187982:"IFCLIBRARYINFORMATION",3020489413:"IFCIRREGULARTIMESERIESVALUE",852622518:"IFCGRIDAXIS",3548104201:"IFCEXTERNALLYDEFINEDTEXTFONT",3207319532:"IFCEXTERNALLYDEFINEDSYMBOL",1040185647:"IFCEXTERNALLYDEFINEDSURFACESTYLE",2242383968:"IFCEXTERNALLYDEFINEDHATCHSTYLE",3200245327:"IFCEXTERNALREFERENCE",1648886627:"IFCENVIRONMENTALIMPACTVALUE",3796139169:"IFCDRAUGHTINGCALLOUTRELATIONSHIP",770865208:"IFCDOCUMENTINFORMATIONRELATIONSHIP",1154170062:"IFCDOCUMENTINFORMATION",1376555844:"IFCDOCUMENTELECTRONICFORMAT",2949456006:"IFCDIMENSIONALEXPONENTS",1045800335:"IFCDERIVEDUNITELEMENT",1765591967:"IFCDERIVEDUNIT",1072939445:"IFCDATEANDTIME",3510044353:"IFCCURVESTYLEFONTPATTERN",2367409068:"IFCCURVESTYLEFONTANDSCALING",1105321065:"IFCCURVESTYLEFONT",539742890:"IFCCURRENCYRELATIONSHIP",602808272:"IFCCOSTVALUE",1065062679:"IFCCOORDINATEDUNIVERSALTIMEOFFSET",347226245:"IFCCONSTRAINTRELATIONSHIP",613356794:"IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP",1658513725:"IFCCONSTRAINTAGGREGATIONRELATIONSHIP",1959218052:"IFCCONSTRAINT",2732653382:"IFCCONNECTIONSURFACEGEOMETRY",4257277454:"IFCCONNECTIONPORTGEOMETRY",2614616156:"IFCCONNECTIONPOINTGEOMETRY",2859738748:"IFCCONNECTIONGEOMETRY",3264961684:"IFCCOLOURSPECIFICATION",3639012971:"IFCCLASSIFICATIONNOTATIONFACET",938368621:"IFCCLASSIFICATIONNOTATION",1098599126:"IFCCLASSIFICATIONITEMRELATIONSHIP",1767535486:"IFCCLASSIFICATIONITEM",747523909:"IFCCLASSIFICATION",622194075:"IFCCALENDARDATE",2069777674:"IFCBOUNDARYNODECONDITIONWARPING",1387855156:"IFCBOUNDARYNODECONDITION",3367102660:"IFCBOUNDARYFACECONDITION",1560379544:"IFCBOUNDARYEDGECONDITION",4037036970:"IFCBOUNDARYCONDITION",3869604511:"IFCAPPROVALRELATIONSHIP",390851274:"IFCAPPROVALPROPERTYRELATIONSHIP",2080292479:"IFCAPPROVALACTORRELATIONSHIP",130549933:"IFCAPPROVAL",1110488051:"IFCAPPLIEDVALUERELATIONSHIP",411424972:"IFCAPPLIEDVALUE",639542469:"IFCAPPLICATION",618182010:"IFCADDRESS",3630933823:"IFCACTORROLE",599546466:"FILE_DESCRIPTION",1390159747:"FILE_NAME",1109904537:"FILE_SCHEMA"};let Dn=class am{static async getUnits(e){var t;const{IFCUNITASSIGNMENT:i}=ii,n=await e.getAllPropertiesOfType(i);if(!n)return 1;const r=Object.keys(n),o=n[parseInt(r[0],10)];for(const a of o.Units){if(a.value===void 0||a.value===null)continue;const l=await e.getProperties(a.value);if(!l||!l.UnitType||!l.UnitType.value||l.UnitType.value!=="LENGTHUNIT")continue;let h=1,d=1;return l.Name.value==="METRE"&&(d=1),l.Name.value==="FOOT"&&(d=.3048),((t=l.Prefix)==null?void 0:t.value)==="MILLI"&&(h=.001),d*h}return 1}static async findItemByGuid(e,t){var i;const n=e.getAllPropertiesIDs();for(const r of n){const o=await e.getProperties(r);if(o&&((i=o.GlobalId)==null?void 0:i.value)===t)return o}return null}static async getRelationMap(e,t,i){var n;const r=i??(async()=>{}),o={},a=e.getAllPropertiesIDs();for(const l of a){const h=await e.getProperties(l);if(!h)continue;const d=h.type===t,p=Object.keys(h).find(w=>w.startsWith("Relating")),f=Object.keys(h).find(w=>w.startsWith("Related"));if(!(d&&p&&f))continue;const g=await e.getProperties((n=h[p])==null?void 0:n.value),v=h[f];if(!g||!v||!(v&&Array.isArray(v)))continue;const b=v.map(w=>w.value);await r(g.expressID,b),o[g.expressID]=b}return o}static async getQsetQuantities(e,t,i){const n=i??(()=>{}),r=await e.getProperties(t);return!r||r.type!==Jh?null:(r.Quantities??[{}]).map(o=>(o.value&&n(o.value),o.value)).filter(o=>o!==null)}static async getPsetProps(e,t,i){const n=i??(()=>{}),r=await e.getProperties(t);return!r||r.type!==zr?null:(r.HasProperties??[{}]).map(o=>(o.value&&n(o.value),o.value)).filter(o=>o!==null)}static async getPsetRel(e,t){var i;if(!await e.getProperties(t))return null;const n=await e.getAllPropertiesOfType(cl);if(!n)return null;const r=Object.values(n);let o=null;for(const a of r)((i=a.RelatingPropertyDefinition)==null?void 0:i.value)===t&&(o=a.expressID);return o}static async getQsetRel(e,t){return am.getPsetRel(e,t)}static async getEntityName(e,t){var i;const n=await e.getProperties(t);if(!n)return{key:null,name:null};const r=Object.keys(n).find(a=>a.endsWith("Name"))??null,o=r?(i=n[r])==null?void 0:i.value:null;return{key:r,name:o}}static async getQuantityValue(e,t){const i=await e.getProperties(t);if(!i)return{key:null,value:null};const n=Object.keys(i).find(o=>o.endsWith("Value"))??null;let r;return n===null||i[n]===void 0||i[n]===null?r=null:r=i[n].value,{key:n,value:r}}static isRel(e){return om[e].startsWith("IFCREL")}static async attributeExists(e,t,i){const n=await e.getProperties(t);return n?Object.keys(n).includes(i):!1}static async groupEntitiesByType(e,t){var i;const n=new Map;for(const r of t){const o=await e.getProperties(r);if(!o)continue;const a=o.type;n.get(a)||n.set(a,new Set),(i=n.get(a))==null||i.add(r)}return n}};const rE=new Map([[jh,{forRelating:"IsDecomposedBy",forRelated:"Decomposes"}],[Wh,{forRelating:"AssociatedTo",forRelated:"HasAssociations"}],[Xh,{forRelating:"ClassificationForObjects",forRelated:"HasAssociations"}],[Kh,{forRelating:"IsGroupedBy",forRelated:"HasAssignments"}],[cl,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[Qh,{forRelated:"IsTypedBy",forRelating:"Types"}],[bf,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[hl,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}]]),lm=class dh extends Re{constructor(e){super(e),A(this,"onDisposed",new ee),A(this,"enabled",!0),A(this,"onRelationsIndexed",new ee),A(this,"_relToAttributesMap",rE),A(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements"]),A(this,"_ifcRels",[jh,Wh,Xh,Kh,cl,Qh,bf,hl]),A(this,"relationMaps",{}),A(this,"onFragmentsDisposed",t=>{delete this.relationMaps[t.groupID]}),this.components.add(dh.uuid,this),e.get(rt).onFragmentsDisposed.add(this.onFragmentsDisposed)}setRelationMap(e,t){this.relationMaps[e.uuid]=t,this.onRelationsIndexed.trigger({modelID:e.uuid,relationsMap:t})}async process(e){if(!e.hasProperties)throw new Error("FragmentsGroup properties not found");let t=this.relationMaps[e.uuid];if(t)return t;t=new Map;for(const i of this._ifcRels)await Dn.getRelationMap(e,i,async(n,r)=>{const o=this._relToAttributesMap.get(i);if(!o)return;const{forRelated:a,forRelating:l}=o,h=t.get(n)??new Map,d=this._inverseAttributes.indexOf(l);h.set(d,r),t.set(n,h);for(const p of r){const f=t.get(p)??new Map,g=this._inverseAttributes.indexOf(a),v=f.get(g)??[];v.push(n),f.set(g,v),t.set(p,f)}});return this.setRelationMap(e,t),t}async processFromWebIfc(e,t){const i=new Map;for(const n of this._ifcRels){const r=this._relToAttributesMap.get(n);if(!r)continue;const{forRelated:o,forRelating:a}=r,l=e.GetLineIDsWithType(t,n);for(let h=0;hT.startsWith("Relating")),f=Object.keys(d).find(T=>T.startsWith("Related"));if(!(p&&f))continue;const g=d[p].value,v=d[f].map(T=>T.value),b=i.get(g)??new Map,w=this._inverseAttributes.indexOf(a);b.set(w,v),i.set(g,b);for(const T of v){const S=i.get(T)??new Map,_=this._inverseAttributes.indexOf(o),I=S.get(_)??[];I.push(g),S.set(_,I),i.set(T,S)}}}return this.onRelationsIndexed.trigger({modelID:t.toString(),relationsMap:i}),i}getEntityRelations(e,t,i){const n=this.relationMaps[e.uuid];if(!n)return null;const r=n.get(t),o=this._inverseAttributes.indexOf(i);return!r||o===-1?null:r.get(o)||null}serializeRelations(e){const t={};for(const[i,n]of e.entries()){t[i]||(t[i]={});for(const[r,o]of n.entries())t[i][r]=o}return JSON.stringify(t)}serializeModelRelations(e){const t=this.relationMaps[e.uuid];return t?this.serializeRelations(t):null}serializeAllRelations(){const e={};for(const t in this.relationMaps){const i=this.relationMaps[t],n={};for(const[r,o]of i.entries()){n[r]||(n[r]={});for(const[a,l]of o.entries())n[r][a]=l}e[t]=n}return JSON.stringify(e)}getRelationsMapFromJSON(e){const t=JSON.parse(e),i=new Map;for(const n in t){const r=t[n],o=new Map;for(const a in r)o.set(Number(a),r[a]);i.set(Number(n),o)}return i}dispose(){this.relationMaps={},this.components.get(rt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(dh.uuid),this.onDisposed.reset()}};A(lm,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let gl=lm;class oE{constructor(){A(this,"factor",1),A(this,"complement",1)}apply(e){const t=this.getScaleMatrix().multiply(e);e.copy(t)}setUp(e){var t;this.factor=1;const i=this.getLengthUnits(e);if(!i)return;const n=i==null,r=i.Name===void 0||i.Name===null;n||r||(i.Name.value==="FOOT"?this.factor=.3048:((t=i.Prefix)==null?void 0:t.value)==="MILLI"&&(this.complement=.001))}getLengthUnits(e){try{const t=e.GetLineIDsWithType(0,Dv).get(0),i=e.GetLine(0,t);for(const n of i.Units){if(!n||n.value===null||n.value===void 0)continue;const r=e.GetLine(0,n.value);if(r.UnitType&&r.UnitType.value==="LENGTHUNIT")return r}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const e=this.factor;return new Ee().fromArray([e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1])}}let cm=class{constructor(){A(this,"itemsByFloor",{}),A(this,"_units",new oE)}setUp(e){this._units.setUp(e),this.cleanUp();try{const t=e.GetLineIDsWithType(0,hl),i=new Set,n=e.GetLineIDsWithType(0,Wn);for(let h=0;h{this.getMesh(a,t)});for(const a of this._visitedFragments){const{index:l,fragment:h}=a[1];t.keyFragments.set(l,h.id)}for(const a of t.items){const l=this._fragmentInstances.get(a.id);if(!l)throw new Error("Fragment not found!");const h=[];for(const[d,p]of l)h.push(p);a.add(h)}const o=this.webIfc.GetCoordinationMatrix(0);return t.coordinationMatrix.fromArray(o),t.civilData=this._civil.read(this.webIfc),t}cleanUp(){this.webIfc=null,this.webIfc=new tn,this._visitedFragments.clear(),this._fragmentInstances.clear()}getMesh(e,t){const i=e.geometries.size(),n=e.expressID;for(let r=0;rparseInt(o,10)),n=t[i[0]],r=new Qo(n.expressID);return{ownerHistory:n,ownerHistoryHandle:r}}registerChange(e,...t){this.changeMap[e.uuid]||(this.changeMap[e.uuid]=new Set);for(const i of t)this.changeMap[e.uuid].add(i),this.onDataChanged.trigger({model:e,expressID:i})}async setData(e,...t){for(const i of t){const n=i.expressID;n&&(await e.setProperties(n,i),this.registerChange(e,n))}}async newPset(e,t,i){const n=ws.getIFCSchema(e),{ownerHistoryHandle:r}=await this.getOwnerHistory(e),o=this.newGUID(e),a=new ii[n].IfcLabel(t),l=i?new ii[n].IfcText(i):null,h=new ii[n].IfcPropertySet(o,r,a,l,[]);h.expressID=this.increaseMaxID(e);const d=this.newGUID(e),p=new ii[n].IfcRelDefinesByProperties(d,r,null,null,[],new Qo(h.expressID));return p.expressID=this.increaseMaxID(e),await this.setData(e,h,p),{pset:h,rel:p}}async removePset(e,...t){for(const i of t){const n=await e.getProperties(i);if((n==null?void 0:n.type)!==zr)continue;const r=await Dn.getPsetRel(e,i);if(r&&(await e.setProperties(r,null),this.registerChange(e,r)),n){for(const o of n.HasProperties)await e.setProperties(o.value,null);await e.setProperties(i,null),this.onPsetRemoved.trigger({model:e,psetID:i}),this.registerChange(e,i)}}}async newSingleProperty(e,t,i,n){const r=ws.getIFCSchema(e),o=new ii[r].IfcIdentifier(i),a=new ii[r][t](n),l=new ii[r].IfcPropertySingleValue(o,null,a,null);return l.expressID=this.increaseMaxID(e),await this.setData(e,l),l}newSingleStringProperty(e,t,i,n){return this.newSingleProperty(e,t,i,n)}newSingleNumericProperty(e,t,i,n){return this.newSingleProperty(e,t,i,n)}newSingleBooleanProperty(e,t,i,n){return this.newSingleProperty(e,t,i,n)}async removePsetProp(e,t,i){const n=await e.getProperties(t),r=await e.getProperties(i);!n||!r||n.type===zr&&r&&(n.HasProperties=n.HasProperties.filter(o=>o.value!==i),await e.setProperties(i,null),this.registerChange(e,t,i))}async addElementToPset(e,t,...i){const n=await Dn.getPsetRel(e,t);if(!n)return;const r=await e.getProperties(n);if(r){for(const o of i){const a=new Qo(o);r.RelatedObjects.push(a),this.onElementToPset.trigger({model:e,psetID:t,elementID:o})}this.registerChange(e,t)}}async addPropToPset(e,t,...i){const n=await e.getProperties(t);if(n){for(const r of i){if(n.HasProperties.includes(r))continue;const o=new Qo(r);n.HasProperties.push(o),this.onPropToPset.trigger({model:e,psetID:t,propID:r})}this.registerChange(e,t)}}async saveToIfc(e,t){const i=this.components.get(aE),n=i.webIfc,r=await i.readIfcFile(t),o=this.changeMap[e.uuid]??[];for(const l of o){const h=await e.getProperties(l);if(h)try{n.WriteLine(r,h)}catch{}else try{n.DeleteLine(r,l)}catch{}}const a=n.SaveModel(r);return i.webIfc.CloseModel(r),i.cleanUp(),a}async setAttributeListener(e,t,i){this.attributeListeners[e.uuid]||(this.attributeListeners[e.uuid]={});const n=this.attributeListeners[e.uuid][t]?this.attributeListeners[e.uuid][t][i]:null;if(n)return n;const r=await e.getProperties(t);if(!r)throw new Error(`Entity with expressID ${t} doesn't exists.`);const o=r[i];if(Array.isArray(o)||!o)throw new Error(`Attribute ${i} is array or null, and it can't have a listener.`);const a=o.value;if(a===void 0||a==null)throw new Error(`Attribute ${i} has a badly defined handle.`);const l=new ee;return Object.defineProperty(r[i],"value",{get(){return this._value},async set(h){this._value=h,l.trigger(h)}}),r[i].value=a,this.attributeListeners[e.uuid][t]||(this.attributeListeners[e.uuid][t]={}),this.attributeListeners[e.uuid][t][i]=l,l}};A(lE,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");const pm=class fm extends Re{constructor(e){super(e),A(this,"enabled",!0),A(this,"list",{}),A(this,"onDisposed",new ee),A(this,"onFragmentsDisposed",t=>{const{groupID:i,fragmentIDs:n}=t;for(const r in this.list){const o=this.list[r],a=Object.keys(o);if(a.includes(i))delete o[i],Object.values(o).length===0&&delete this.list[r];else for(const l of a){const h=o[l];for(const d of n)delete h[d];Object.values(h).length===0&&delete o[l]}}}),e.add(fm.uuid,this),e.get(rt).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(rt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(e){for(const t in this.list){const i=this.list[t];for(const n in i){const r=i[n];delete r[e]}}}find(e){const t=this.components.get(rt);if(!e){const o={};for(const[a,l]of t.list)o[a]=new Set(l.ids);return o}const i=Object.keys(e).length,n={};for(const o in e){const a=e[o];if(!this.list[o]){console.warn(`Classification ${o} does not exist.`);continue}for(const l of a){const h=this.list[o][l];if(h)for(const d in h){n[d]||(n[d]=new Map);for(const p of h[d]){const f=n[d].get(p);f===void 0?n[d].set(p,1):n[d].set(p,f+1)}}}}const r={};for(const o in n){const a=n[o];for(const[l,h]of a){if(h===void 0)throw new Error("Malformed fragments map!");h===i&&(r[o]||(r[o]=new Set),r[o].add(l))}}return r}byModel(e,t){this.list.models||(this.list.models={});const i=this.list.models;i[e]||(i[e]={});const n=i[e];for(const[r,o]of t.data){const a=o[0];for(const l of a){const h=t.keyFragments.get(l);h&&(n[h]||(n[h]=new Set),n[h].add(r))}}}async byPredefinedType(e){var t;this.list.predefinedTypes||(this.list.predefinedTypes={});const i=this.list.predefinedTypes,n=e.getAllPropertiesIDs();for(const r of n){const o=await e.getProperties(r);if(!o)continue;const a=String((t=o.PredefinedType)==null?void 0:t.value).toUpperCase();i[a]||(i[a]={});const l=i[a];for(const[h,d]of e.data){const p=d[0];for(const f of p){const g=e.keyFragments.get(f);if(!g)throw new Error("Fragment ID not found!");l[g]||(l[g]=new Set),l[g].add(o.expressID)}}}}byEntity(e){this.list.entities||(this.list.entities={});for(const[t,i]of e.data){const n=i[1][1],r=om[n];this.saveItem(e,"entities",r,t)}}async byIfcRel(e,t,i){Dn.isRel(t)&&await Dn.getRelationMap(e,t,async(n,r)=>{const{name:o}=await Dn.getEntityName(e,n);for(const a of r)this.saveItem(e,i,o??"NO REL NAME",a)})}async bySpatialStructure(e){var t;const i=this.components.get(gl),n=i.relationMaps[e.uuid];if(!n)throw new Error(`Classifier: model relations of ${e.name||e.uuid} have to exists to group by spatial structure.`);const r="spatialStructures";for(const[o]of n){const a=i.getEntityRelations(e,o,"ContainsElements"),l=await e.getProperties(o);if(!(a&&l))continue;const h=(t=l.Name)==null?void 0:t.value;for(const d of a){this.saveItem(e,r,h,d);const p=i.getEntityRelations(e,Number(d),"IsDecomposedBy");if(p)for(const f of p)this.saveItem(e,r,h,f)}}}setColor(e,t,i=!1){const n=this.components.get(rt);for(const r in e){const o=n.list.get(r);if(!o)continue;const a=e[r];o.setColor(t,a,i)}}resetColor(e){const t=this.components.get(rt);for(const i in e){const n=t.list.get(i);if(!n)continue;const r=e[i];n.resetColor(r)}}saveItem(e,t,i,n){this.list[t]||(this.list[t]={});const r=e.data.get(n);if(r)for(const o of r[0]){const a=e.keyFragments.get(o);if(a){const l=this.list[t];l[i]||(l[i]={}),l[i][a]||(l[i][a]=new Set),l[i][a].add(n)}}}};A(pm,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let cE=pm;const hE=class mm extends Re{constructor(e){super(e),A(this,"enabled",!0),A(this,"height",10),A(this,"groupName","storeys"),A(this,"onDisposed",new ee),A(this,"list",new Set),e.add(mm.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(e){if(!this.enabled)return;const t=this.components.get(cE),i=this.components.get(rt),n=e?1:-1;let r=0;const o=t.list[this.groupName],a=new Ee;for(const l in o){a.elements[13]=r*n*this.height;for(const h in o[l]){const d=i.list.get(h),p=l+h,f=this.list.has(p);if(!d||e&&f||!e&&!f)continue;e?this.list.add(p):this.list.delete(p);const g=o[l][h];d.applyTransform(g,a)}r++}}};A(hE,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");const uE=class gm extends Re{constructor(e){super(e),A(this,"enabled",!0),this.components.add(gm.uuid,this)}set(e,t){const i=this.components.get(rt);if(!t){for(const n in i.list){const r=i.list.get(n);r&&(r.setVisibility(e),this.updateCulledVisibility(r))}return}for(const n in t){const r=t[n],o=i.list.get(n);o&&(o.setVisibility(e,r),this.updateCulledVisibility(o))}}isolate(e){this.set(!1),this.set(!0,e)}updateCulledVisibility(e){const t=this.components.get(Z1);for(const[i,n]of t.list){const r=n.colorMeshes.get(e.id);r&&(r.count=e.mesh.count)}}};A(uE,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");class dE extends ru{constructor(){super(...arguments),A(this,"minGeometrySize",10),A(this,"minAssetsSize",1e3)}}let vm=class extends ru{constructor(){super(...arguments),A(this,"propertiesSize",100)}};class pE extends Re{constructor(){super(...arguments),A(this,"onPropertiesStreamed",new $i),A(this,"onProgress",new $i),A(this,"onIndicesStreamed",new $i),A(this,"onDisposed",new ee),A(this,"enabled",!0),A(this,"settings",new vm),A(this,"webIfc",new tn)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(e){const t=performance.now();await this.readIfcFile(e),await this.streamAllProperties(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-t} ms!`)}async streamFromCallBack(e){const t=performance.now();await this.streamIfcFile(e),await this.streamAllProperties(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-t} ms!`)}async readIfcFile(e){const{path:t,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(e,this.settings.webIfc)}async streamIfcFile(e){const{path:t,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:e}=this.settings,t=new Set(this.webIfc.GetIfcEntityList(0)),i=[cl,Qh,Wh,hl,Xh,Kh],n=new Map,r=new Set([pl,Zh,qh,dl,Wn]);for(const h of r)t.add(h);let o=.01,a=0;for(const h of t){if(a++,su.has(h))continue;const d=r.has(h),p=this.webIfc.GetLineIDsWithType(0,h),f=p.size();let g=0;for(let b=0;bo&&(o+=.01,o=Math.max(o,v),await this.onProgress.trigger(Math.round(o*100)/100))}const l=[];for(const[h,d]of n)l.push([h,...d]);await this.onIndicesStreamed.trigger(l)}getIndices(e,t,i){const n=e.RelatedObjects||e.RelatedElements;if(!n){console.log(`Related objects not found: ${t}`);return}const r=e.RelatingType||e.RelatingMaterial||e.RelatingStructure||e.RelatingPropertyDefinition||e.RelatingGroup||e.RelatingClassification;if(!r){console.log(`Relating object not found: ${t}`);return}if(!Array.isArray(n)||r.value===void 0)return;const o=r.value;for(const a of n){if(a.value===void 0||a.value===null)continue;const l=a.value;i.has(l)||i.set(l,new Set),i.get(l).add(o)}}cleanUp(){this.webIfc=null,this.webIfc=new tn}}A(pE,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");const fE=class ym extends Re{constructor(e){super(e),A(this,"onGeometryStreamed",new ee),A(this,"onAssetStreamed",new ee),A(this,"onProgress",new ee),A(this,"onIfcLoaded",new ee),A(this,"onDisposed",new ee),A(this,"settings",new dE),A(this,"enabled",!0),A(this,"webIfc",new tn),A(this,"_spatialTree",new cm),A(this,"_metaData",new um),A(this,"_visitedGeometries",new Map),A(this,"_streamSerializer",new Cf),A(this,"_geometries",new Map),A(this,"_geometryCount",0),A(this,"_civil",new hm),A(this,"_groupSerializer",new Ef),A(this,"_assets",[]),A(this,"_meshesWithHoles",new Set),this.components.add(ym.uuid,this),this.settings.excludedCategories.add(wf)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(e){const t=performance.now();await this.readIfcFile(e),await this.streamAllGeometries(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-t} ms!`)}async streamFromCallBack(e){const t=performance.now();await this.streamIfcFile(e),await this.streamAllGeometries(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-t} ms!`)}async readIfcFile(e){const{path:t,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(e,this.settings.webIfc)}async streamIfcFile(e){const{path:t,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:e,minAssetsSize:t}=this.settings;this._spatialTree.setUp(this.webIfc);const i=this.webIfc.GetIfcEntityList(0),n=[[]],r=new If,{FILE_NAME:o,FILE_DESCRIPTION:a}=ii;r.ifcMetadata={name:this._metaData.get(this.webIfc,o),description:this._metaData.get(this.webIfc,a),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let l=0,h=0;for(const T of i){if(!this.webIfc.IsIfcElement(T)&&T!==Wn||this.settings.excludedCategories.has(T))continue;const S=this.webIfc.GetLineIDsWithType(0,T),_=S.size();console.log(_);for(let I=0;I<_;I++){l>e&&(l=0,h++,n.push([]));const P=S.get(I);n[h].push(P);const M=this._spatialTree.itemsByFloor[P]||0;r.data.set(P,[[],[M,T]]),l++}}this._spatialTree.cleanUp();let d=.01,p=0;for(const T of n){p++,this.webIfc.StreamMeshes(0,T,_=>{this.getMesh(this.webIfc,_,r)}),this._geometryCount>e&&await this.streamGeometries(),this._assets.length>t&&await this.streamAssets();const S=p/n.length;S>d&&(d+=.01,d=Math.max(d,S),this.onProgress.trigger(Math.round(d*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:f,transparent:g}=r.geometryIDs;for(const[T,{index:S,uuid:_}]of this._visitedGeometries)r.keyFragments.set(S,_),(T>1?f:g).set(T,S);const v=r.data.keys();for(const T of v){const[S]=r.data.get(T);S.length||r.data.delete(T)}const b=this.webIfc.GetCoordinationMatrix(0);r.coordinationMatrix.fromArray(b),r.civilData=this._civil.read(this.webIfc);const w=this._groupSerializer.export(r);this.onIfcLoaded.trigger(w),r.dispose(!0)}cleanUp(){this.webIfc=null,this.webIfc=new tn,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(e,t,i){const n=t.geometries.size(),r=t.expressID,o={id:r,geometries:[]};for(let a=0;an&&(n+=.01,n=Math.max(n,f),await this.onProgress.trigger(Math.round(n*100)/100))}const o=await this.components.get(gl).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(o)}cleanUp(){this.webIfc=null,this.webIfc=new tn}}A(mE,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");const Em=class bm extends Re{constructor(e){super(e),A(this,"enabled",!0),e.add(bm.uuid,this)}getFace(e,t,i){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const n=new Map,r=e.geometry.index.array,{plane:o}=this.getFaceData(t,i,e),a=[];for(let p=0;pI.id);if(!g.size){const I=l++;for(const{id:P}of f)h.set(P,I);d.set(I,{edges:new Set(v),indices:new Set([p])});continue}let b=null;const w=new Set,T=new Set(v);for(const[I,P]of g){b===null?b=P:P!==b&&w.add(P),h.delete(I);const{edges:M}=d.get(P);M.delete(I),T.delete(I)}if(b===null)throw new Error("Error computing face!");const S=d.get(b),{indices:_}=S;_.add(p);for(const I of T){h.set(I,b);const{edges:P}=S;P.add(I)}for(const I of w){const P=d.get(I),{edges:M,indices:k}=P,V=d.get(b),{edges:W,indices:j}=V;for(const Q of M)W.add(Q),h.set(Q,b);for(const Q of k)j.add(Q);d.delete(I)}}for(const[p,{indices:f,edges:g}]of d)if(f.has(t)){const v=[];for(const b of g){const w=n.get(b);v.push(w)}return{edges:v,indices:f}}return null}static distanceFromPointToLine(e,t,i,n=!1){const r=new Dt,o=new O;return r.set(t,i),r.closestPointToPoint(e,n,o),o.distanceTo(e)}getFaceData(e,t,i){const n=this.getVerticesAndNormal(i,e,t),{p1:r,p2:o,p3:a,faceNormal:l}=n;this.round(r),this.round(o),this.round(a),this.round(l);const h=[{id:`${r.x}|${r.y}|${r.z}`,value:r},{id:`${o.x}|${o.y}|${o.z}`,value:o},{id:`${a.x}|${a.y}|${a.z}`,value:a}];h.sort((S,_)=>S.id<_.id?-1:S.id>_.id?1:0);const[{id:d,value:p},{id:f,value:g},{id:v,value:b}]=h,w=[{id:`${d}|${f}`,distance:p.distanceTo(g),points:[p,g]},{id:`${f}|${v}`,distance:g.distanceTo(b),points:[g,b]},{id:`${d}|${v}`,distance:p.distanceTo(b),points:[p,b]}],T=new an;return T.setFromNormalAndCoplanarPoint(l,r),T.constant=Math.round(T.constant*10)/10,{plane:T,edges:w}}getVerticesAndNormal(e,t,i){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const n=e.geometry.index.array,r=e.geometry.attributes.position.array,o=e.geometry.attributes.normal.array,a=n[t*3]*3,l=n[t*3+1]*3,h=n[t*3+2]*3,d=new O(r[a],r[a+1],r[a+2]),p=new O(r[l],r[l+1],r[l+2]),f=new O(r[h],r[h+1],r[h+2]),g=new O(o[a],o[a+1],o[a+2]),v=new O(o[l],o[l+1],o[l+2]),b=new O(o[h],o[h+1],o[h+2]),w=(g.x+v.x+b.x)/3,T=(g.y+v.y+b.y)/3,S=(g.z+v.z+b.z)/3,_=new O(w,T,S);if(i!==void 0&&e instanceof Kt){const I=new Ee;e.getMatrixAt(i,I);const P=new Ee;P.extractRotation(I),_.applyMatrix4(P),d.applyMatrix4(I),p.applyMatrix4(I),f.applyMatrix4(I)}return{p1:d,p2:p,p3:f,faceNormal:_}}round(e){e.x=Math.trunc(e.x*1e3)/1e3,e.y=Math.trunc(e.y*1e3)/1e3,e.z=Math.trunc(e.z*1e3)/1e3}};A(Em,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let ja=Em;const Kd=new Ke,ba=new O;class wm extends Nv{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new Ps(e,3)),this.setAttribute("uv",new Ps(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new Qc(t,6,1);return this.setAttribute("instanceStart",new xs(i,3,0)),this.setAttribute("instanceEnd",new xs(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new Qc(t,6,1);return this.setAttribute("instanceColorStart",new xs(i,3,0)),this.setAttribute("instanceColorEnd",new xs(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Uv(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ke);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Kd.setFromBufferAttribute(t),this.boundingBox.union(Kd))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Gn),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let n=0;for(let r=0,o=e.count;r{if(this.isProcessing)return;const r=n.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[o,a]of r){if(a{this.isProcessing||await this.updateVisibility()},this.updateInterval),this.onViewUpdated.add(({seen:n,unseen:r})=>{for(const o of n)o.visible=!0;for(const o of r)o.visible=!1})}dispose(){super.dispose(),this._intervalID!==null&&(window.clearInterval(this._intervalID),this._intervalID=null),this._currentVisibleMeshes.clear(),this._recentlyHiddenMeshes.clear(),this._meshIDColorCodeMap.clear(),this._transparentMat.dispose(),this._colorCodeMeshMap.clear();const e=this.components.get(Fi);for(const t in this.colorMeshes){const i=this.colorMeshes.get(t);i&&e.destroy(i,!0)}this.colorMeshes.clear()}add(e){if(!this.enabled)return;if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const t=e instanceof Kt,{geometry:i,material:n}=e,{colorMaterial:r,code:o}=this.getAvailableMaterial();let a;if(Array.isArray(n)){let d=!0;const p=[];for(const f of n)Fd.isTransparent(f)?p.push(this._transparentMat):(d=!1,p.push(r));if(d){r.dispose(),this.isProcessing=!1;return}a=p}else if(Fd.isTransparent(n)){r.dispose(),this.isProcessing=!1;return}else a=r;this._colorCodeMeshMap.set(o,e),this._meshIDColorCodeMap.set(e.uuid,o);const l=t?e.count:1,h=new Kt(i,a,l);t?h.instanceMatrix=e.instanceMatrix:h.setMatrixAt(0,new Ee),e.visible=!1,h.applyMatrix4(e.matrix),h.updateMatrix(),this.scene.add(h),this.colorMeshes.set(e.uuid,h),this.increaseColor(),this.isProcessing=!1}remove(e){if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const t=this.components.get(Fi);this._currentVisibleMeshes.delete(e),this._recentlyHiddenMeshes.delete(e);const i=this.colorMeshes.get(e.uuid),n=this._meshIDColorCodeMap.get(e.uuid);if(!i||!n){this.isProcessing=!1,console.log(e.visible);return}this._colorCodeMeshMap.delete(n),this._meshIDColorCodeMap.delete(e.uuid),this.colorMeshes.delete(e.uuid),i.geometry=void 0,i.material=[],t.destroy(i,!0),this._recentlyHiddenMeshes.delete(e),this._currentVisibleMeshes.delete(e),this.isProcessing=!1}getAvailableMaterial(){const{r:e,g:t,b:i,code:n}=this.getAvailableColor(),r=Si.enabled;Si.enabled=!1;const o=new Rt(`rgb(${e}, ${t}, ${i})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const a=this.world.renderer.clippingPlanes,l=new Xt({color:o,clippingPlanes:a,side:no});return Si.enabled=r,{colorMaterial:l,code:n}}}const Jf=class uh extends Re{constructor(e){super(e),A(this,"_enabled",!0),A(this,"list",new Map),A(this,"onDisposed",new $),e.add(uh.uuid,this)}get enabled(){return this._enabled}set enabled(e){this._enabled=e;for(const[t,i]of this.list)i.enabled=e}create(e,t){if(this.list.has(e.uuid))return this.list.get(e.uuid);const i=new Q1(this.components,e,t);return this.list.set(e.uuid,i),i}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(uh.uuid),this.onDisposed.reset();for(const[e,t]of this.list)t.dispose();this.list.clear()}};A(Jf,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let Z1=Jf;class q1{constructor(e){if(A(this,"onDisposed",new $),A(this,"onAfterUpdate",new $),A(this,"onBeforeUpdate",new $),A(this,"onResize",new $),A(this,"frontOffset",0),A(this,"overrideMaterial",new Tf),A(this,"backgroundColor",new Rt(395274)),A(this,"renderer"),A(this,"enabled",!0),A(this,"world"),A(this,"_lockRotation",!0),A(this,"_camera"),A(this,"_plane"),A(this,"_size",new Ve(320,160)),A(this,"_tempVector1",new O),A(this,"_tempVector2",new O),A(this,"_tempTarget",new O),A(this,"down",new O(0,-1,0)),A(this,"updatePlanes",()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const n=[],r=this.world.renderer.three;for(const o of r.clippingPlanes)n.push(o);n.push(this._plane),this.renderer.clippingPlanes=n}),this.world=e,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new Ha,this.renderer.setSize(this._size.x,this._size.y);const t=1,i=this._size.x/this._size.y;this._camera=new jn(t*i/-2,t*i/2,t/2,t/-2),this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes),this._camera.position.set(0,200,0),this._camera.zoom=.1,this._camera.rotation.x=-Math.PI/2,this._plane=new an(this.down,200),this.updatePlanes()}get lockRotation(){return this._lockRotation}set lockRotation(e){this._lockRotation=e,e&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(e){this._camera.zoom=e,this._camera.updateProjectionMatrix()}dispose(){this.enabled=!1,this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.onResize.reset(),this.overrideMaterial.dispose(),this.renderer.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return this._camera}update(){if(!this.enabled)return;this.onBeforeUpdate.trigger();const e=this.world.scene.three,t=this.world.camera;if(!t.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(e instanceof Xn))throw new Error("The given world must have a THREE.Scene as a root!");const i=t.controls;if(i.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,this.frontOffset!==0&&(i.getTarget(this._tempVector2),this._tempVector2.sub(this._tempVector1),this._tempVector2.normalize().multiplyScalar(this.frontOffset),this._camera.position.x+=this._tempVector2.x,this._camera.position.z+=this._tempVector2.z),!this._lockRotation){i.getTarget(this._tempTarget);const r=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=r+Math.PI}this._plane.set(this.down,this._tempVector1.y);const n=e.background;e.background=this.backgroundColor,this.renderer.render(e,this._camera),e.background=n,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(e=this._size){this._size.copy(e),this.renderer.setSize(e.x,e.y);const t=e.x/e.y,i=1;this._camera.left=i*t/-2,this._camera.right=i*t/2,this._camera.top=i/2,this._camera.bottom=-i/2,this._camera.updateProjectionMatrix(),this.onResize.trigger(e)}}const J1=class $f extends Re{constructor(e){super(e),A(this,"onAfterUpdate",new $),A(this,"onBeforeUpdate",new $),A(this,"onDisposed",new $),A(this,"enabled",!0),A(this,"list",new Map),this.components.add($f.uuid,this)}create(e){if(this.list.has(e.uuid))throw new Error("This world already has a minimap!");const t=new q1(e);return this.list.set(e.uuid,t),t}delete(e){const t=this.list.get(e);t&&t.dispose(),this.list.delete(e)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[e,t]of this.list)t.update()}};A(J1,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");class $1{constructor(e){A(this,"enabled",!1),A(this,"id","FirstPerson"),this.camera=e}set(e){if(this.enabled=e,e){if(this.camera.projection.current!=="Perspective"){this.camera.set("Orbit");return}this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const e=this.camera.controls,t=new O;e.distance--,e.getPosition(t),e.minDistance=1,e.maxDistance=1,e.distance=1,e.moveTo(t.x,t.y,t.z),e.truckSpeed=50,e.mouseButtons.wheel=Mt.ACTION.DOLLY,e.touches.two=Mt.ACTION.TOUCH_ZOOM_TRUCK}}class eE{constructor(e){A(this,"enabled",!0),A(this,"id","Orbit"),this.camera=e,this.activateOrbitControls()}set(e){this.enabled=e,e&&this.activateOrbitControls()}activateOrbitControls(){const e=this.camera.controls;e.minDistance=1,e.maxDistance=300;const t=new O;e.getPosition(t);const i=t.length();e.distance=i,e.truckSpeed=2;const{rotation:n}=this.camera.three,r=new O(0,0,-1).applyEuler(n),o=t.addScaledVector(r,i);e.moveTo(o.x,o.y,o.z)}}class tE{constructor(e){A(this,"enabled",!1),A(this,"id","Plan"),A(this,"mouseAction1"),A(this,"mouseAction2"),A(this,"mouseInitialized",!1),A(this,"defaultAzimuthSpeed"),A(this,"defaultPolarSpeed"),this.camera=e,this.defaultAzimuthSpeed=e.controls.azimuthRotateSpeed,this.defaultPolarSpeed=e.controls.polarRotateSpeed}set(e){this.enabled=e;const t=this.camera.controls;t.azimuthRotateSpeed=e?0:this.defaultAzimuthSpeed,t.polarRotateSpeed=e?0:this.defaultPolarSpeed,this.mouseInitialized||(this.mouseAction1=t.touches.one,this.mouseAction2=t.touches.two,this.mouseInitialized=!0),e?(t.mouseButtons.left=Mt.ACTION.TRUCK,t.touches.one=Mt.ACTION.TOUCH_TRUCK,t.touches.two=Mt.ACTION.TOUCH_ZOOM):(t.mouseButtons.left=Mt.ACTION.ROTATE,t.touches.one=this.mouseAction1,t.touches.two=this.mouseAction2)}}class iE{constructor(e){A(this,"onChanged",new $),A(this,"current","Perspective"),A(this,"camera"),A(this,"_component"),A(this,"_previousDistance",-1),A(this,"matchOrthoDistanceEnabled",!1),this._component=e,this.camera=e.three}async set(e){this.current!==e&&(e==="Orthographic"?this.setOrthoCamera():await this.setPerspectiveCamera(),this.onChanged.trigger(this.camera))}async toggle(){const e=this.current==="Perspective"?"Orthographic":"Perspective";await this.set(e)}setOrthoCamera(){if(this._component.mode===null||this._component.mode.id==="FirstPerson")return;this._previousDistance=this._component.controls.distance,this._component.controls.distance=200;const e=this.getPerspectiveDims();if(!e)return;const{width:t,height:i}=e;this.setupOrthoCamera(i,t),this.camera=this._component.threeOrtho,this.current="Orthographic"}getPerspectiveDims(){const e=this._component.currentWorld;if(!e||!e.renderer)return null;const t=new O;this._component.threePersp.getWorldDirection(t);const i=new O;this._component.controls.getTarget(i);const n=i.clone().sub(this._component.threePersp.position).dot(t),r=e.renderer.getSize(),o=r.x/r.y,a=this._component.threePersp,l=n*2*Math.atan(a.fov*(Math.PI/180)/2);return{width:l*o,height:l}}setupOrthoCamera(e,t){this._component.controls.mouseButtons.wheel=Mt.ACTION.ZOOM,this._component.controls.mouseButtons.middle=Mt.ACTION.ZOOM;const i=this._component.threePersp,n=this._component.threeOrtho;n.zoom=1,n.left=t/-2,n.right=t/2,n.top=e/2,n.bottom=e/-2,n.updateProjectionMatrix(),n.position.copy(i.position),n.quaternion.copy(i.quaternion),this._component.controls.camera=n}getDistance(){const e=this._component.threePersp,t=this._component.threeOrtho;return(t.top-t.bottom)/t.zoom/(2*Math.atan(e.fov*(Math.PI/180)/2))}async setPerspectiveCamera(){this._component.controls.mouseButtons.wheel=Mt.ACTION.DOLLY,this._component.controls.mouseButtons.middle=Mt.ACTION.DOLLY;const e=this._component.threePersp,t=this._component.threeOrtho;e.position.copy(t.position),e.quaternion.copy(t.quaternion),this._component.controls.mouseButtons.wheel=Mt.ACTION.DOLLY,this.matchOrthoDistanceEnabled?this._component.controls.distance=this.getDistance():this._component.controls.distance=this._previousDistance,await this._component.controls.zoomTo(1),e.updateProjectionMatrix(),this._component.controls.camera=e,this.camera=e,this.current="Perspective"}}class nE extends ch{constructor(e){super(e),A(this,"_mode",null),A(this,"projection"),A(this,"threeOrtho"),A(this,"threePersp"),A(this,"_userInputButtons",{}),A(this,"_frustumSize",50),A(this,"_navigationModes",new Map),A(this,"previousSize",null),this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new iE(this),this.onAspectUpdated.add(()=>{this.setOrthoPerspCameraAspect()}),this.projection.onChanged.add(t=>{this.three=t,this.updateAspect()}),this.onWorldChanged.add(({action:t})=>{t==="added"&&(this._navigationModes.clear(),this._navigationModes.set("Orbit",new eE(this)),this._navigationModes.set("FirstPerson",new $1(this)),this._navigationModes.set("Plan",new tE(this)),this._mode=this._navigationModes.get("Orbit"),this.mode.set(!0,{preventTargetAdjustment:!0}),this.currentWorld&&this.currentWorld.renderer&&(this.previousSize=this.currentWorld.renderer.getSize().clone()))})}get mode(){if(!this._mode)throw new Error("Mode not found, camera not initialized");return this._mode}dispose(){super.dispose(),this.threeOrtho.removeFromParent()}set(e){if(this.mode!==null&&this.mode.id!==e){if(this.mode.set(!1),!this._navigationModes.has(e))throw new Error("The specified mode does not exist!");this._mode=this._navigationModes.get(e),this.mode.set(!0)}}async fit(e,t=1.5){if(!this.enabled)return;const i=Number.MAX_VALUE,n=Number.MIN_VALUE,r=new O(i,i,i),o=new O(n,n,n);for(const f of e){const g=new Ke().setFromObject(f);g.min.xo.x&&(o.x=g.max.x),g.max.y>o.y&&(o.y=g.max.y),g.max.z>o.z&&(o.z=g.max.z)}const a=new Ke(r,o),l=new O;a.getSize(l);const h=new O;a.getCenter(h);const d=Math.max(l.x,l.y,l.z)*t,p=new Gn(h,d);await this.controls.fitToSphere(p,!0)}setUserInput(e){e?this.enableUserInput():this.disableUserInput()}disableUserInput(){this._userInputButtons.left=this.controls.mouseButtons.left,this._userInputButtons.right=this.controls.mouseButtons.right,this._userInputButtons.middle=this.controls.mouseButtons.middle,this._userInputButtons.wheel=this.controls.mouseButtons.wheel,this.controls.mouseButtons.left=0,this.controls.mouseButtons.right=0,this.controls.mouseButtons.middle=0,this.controls.mouseButtons.wheel=0}enableUserInput(){Object.keys(this._userInputButtons).length!==0&&(this.controls.mouseButtons.left=this._userInputButtons.left,this.controls.mouseButtons.right=this._userInputButtons.right,this.controls.mouseButtons.middle=this._userInputButtons.middle,this.controls.mouseButtons.wheel=this._userInputButtons.wheel)}newOrthoCamera(){const e=window.innerWidth/window.innerHeight;return new jn(this._frustumSize*e/-2,this._frustumSize*e/2,this._frustumSize/2,this._frustumSize/-2,.1,1e3)}setOrthoPerspCameraAspect(){if(!this.currentWorld||!this.currentWorld.renderer||!this.previousSize)return;const e=this.currentWorld.renderer.getSize(),t=this.threeOrtho.top,i=this.threeOrtho.right,n=e.y/this.previousSize.y,r=e.x/this.previousSize.x,o=t*n,a=i*r;this.threeOrtho.left=-a,this.threeOrtho.right=a,this.threeOrtho.top=o,this.threeOrtho.bottom=-o,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(e)}}const em=class xi extends Re{constructor(e){super(e),A(this,"enabled",!0),A(this,"onDisposed",new $),A(this,"_absoluteMin"),A(this,"_absoluteMax"),A(this,"_meshes",[]),this.components.add(xi.uuid,this),this._absoluteMin=xi.newBound(!0),this._absoluteMax=xi.newBound(!1)}static getDimensions(e){const{min:t,max:i}=e,n=Math.abs(i.x-t.x),r=Math.abs(i.y-t.y),o=Math.abs(i.z-t.z),a=new O;return a.subVectors(i,t).divideScalar(2).add(t),{width:n,height:r,depth:o,center:a}}static newBound(e){const t=e?1:-1;return new O(t*Number.MAX_VALUE,t*Number.MAX_VALUE,t*Number.MAX_VALUE)}static getBounds(e,t,i){const n=i||this.newBound(!1),r=t||this.newBound(!0);for(const o of e)o.xn.x&&(n.x=o.x),o.y>n.y&&(n.y=o.y),o.z>n.z&&(n.z=o.z);return new Ke(t,i)}dispose(){const e=this.components.get(Fi);for(const t of this._meshes)e.destroy(t);this._meshes=[],this.onDisposed.trigger(xi.uuid),this.onDisposed.reset()}get(){const e=this._absoluteMin.clone(),t=this._absoluteMax.clone();return new Ke(e,t)}getSphere(){const e=this._absoluteMin.clone(),t=this._absoluteMax.clone(),i=Math.abs((t.x-e.x)/2),n=Math.abs((t.y-e.y)/2),r=Math.abs((t.z-e.z)/2),o=new O(e.x+i,e.y+n,e.z+r),a=o.distanceTo(e);return new Gn(o,a)}getMesh(){const e=new Ke(this._absoluteMin,this._absoluteMax),t=xi.getDimensions(e),{width:i,height:n,depth:r,center:o}=t,a=new ut(i,n,r),l=new le(a);return this._meshes.push(l),l.position.copy(o),l}reset(){this._absoluteMin=xi.newBound(!0),this._absoluteMax=xi.newBound(!1)}add(e){for(const t of e.items)this.addMesh(t.mesh)}addMesh(e,t){if(!e.geometry.index)return;const i=xi.getFragmentBounds(e);e.updateMatrixWorld();const n=e.matrixWorld,r=new Ee,o=e instanceof Kt,a=new Set;if(t&&e instanceof yf)for(const l of t){const h=e.fragment.getInstancesIDs(l);if(h)for(const d of h)a.add(d)}else a.add(0);for(const l of a){const h=i.min.clone(),d=i.max.clone();o&&(e.getMatrixAt(l,r),h.applyMatrix4(r),d.applyMatrix4(r)),h.applyMatrix4(n),d.applyMatrix4(n),h.xthis._absoluteMax.x&&(this._absoluteMax.x=h.x),h.y>this._absoluteMax.y&&(this._absoluteMax.y=h.y),h.z>this._absoluteMax.z&&(this._absoluteMax.z=h.z),d.x>this._absoluteMax.x&&(this._absoluteMax.x=d.x),d.y>this._absoluteMax.y&&(this._absoluteMax.y=d.y),d.z>this._absoluteMax.z&&(this._absoluteMax.z=d.z),d.xo.x&&(o.x=d),p>o.y&&(o.y=p),f>o.z&&(o.z=f)}return new Ke(r,o)}};A(em,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let tm=em;const su=new Set([1123145078,574549367,1675464909,2059837836,3798115385,32440307,3125803723,3207858831,2740243338,2624227202,4240577450,3615266464,3724593414,220341763,477187591,1878645084,1300840506,3303107099,1607154358,1878645084,846575682,1351298697,2417041796,3049322572,3331915920,1416205885,776857604,3285139300,3958052878,2827736869,2732653382,673634403,3448662350,4142052618,2924175390,803316827,2556980723,1809719519,2205249479,807026263,3737207727,1660063152,2347385850,3940055652,2705031697,3732776249,2485617015,2611217952,1704287377,2937912522,2770003689,1281925730,1484403080,3448662350,4142052618,3800577675,4006246654,3590301190,1383045692,2775532180,2047409740,370225590,3593883385,2665983363,4124623270,812098782,3649129432,987898635,1105321065,3510044353,1635779807,2603310189,3406155212,1310608509,4261334040,2736907675,3649129432,1136057603,1260505505,4182860854,2713105998,2898889636,59481748,3749851601,3486308946,3150382593,1062206242,3264961684,15328376,1485152156,370225590,1981873012,2859738748,45288368,2614616156,2732653382,775493141,2147822146,2601014836,2629017746,1186437898,2367409068,1213902940,3632507154,3900360178,476780140,1472233963,2804161546,3008276851,738692330,374418227,315944413,3905492369,3570813810,2571569899,178912537,2294589976,1437953363,2133299955,572779678,3092502836,388784114,2624227202,1425443689,3057273783,2347385850,1682466193,2519244187,2839578677,3958567839,2513912981,2830218821,427810014]),im=class nm extends Re{constructor(e){super(e),A(this,"enabled",!0),e.add(nm.uuid,this)}async export(e,t,i=!1,n=!0){const r={},o=new Set(e.GetIfcEntityList(t)),a=new Set([pl,Zh,qh,dl,Wn]);for(const l of a)o.add(l);for(const l of o){if(su.has(l))continue;const h=a.has(l)&&n,d=e.GetLineIDsWithType(t,l);for(const p of d){const f=e.GetLine(0,p,h,i);r[f.expressID]=f}}return r}};A(im,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let sE=im;const sm=class rm extends Re{constructor(e){super(e),A(this,"onDisposed",new $),A(this,"onFragmentsLoaded",new $),A(this,"onFragmentsDisposed",new $),A(this,"list",new Map),A(this,"groups",new Map),A(this,"enabled",!0),A(this,"baseCoordinationModel",""),A(this,"_loader",new Ef),this.components.add(rm.uuid,this)}get meshes(){const e=[];for(const[t,i]of this.list)e.push(i.mesh);return e}dispose(){for(const[e,t]of this.groups)t.dispose(!0);this.baseCoordinationModel="",this.groups.clear(),this.list.clear(),this.onFragmentsLoaded.reset(),this.onFragmentsDisposed.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}disposeGroup(e){const{uuid:t}=e,i=[];for(const n of e.items)i.push(n.id),this.list.delete(n.id);e.dispose(!0),this.groups.delete(e.uuid),this.onFragmentsDisposed.trigger({groupID:t,fragmentIDs:i})}load(e,t){const i={coordinate:!0,...t},{coordinate:n,properties:r,relationsMap:o}=i,a=this._loader.import(e);for(const l of a.items)l.group=a,this.list.set(l.id,l);return n&&this.coordinate([a]),this.groups.set(a.uuid,a),r&&a.setLocalProperties(r),o&&this.components.get(gl).setRelationMap(a,o),this.onFragmentsLoaded.trigger(a),a}export(e){return this._loader.export(e)}coordinate(e=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const i=e.pop();if(!i)return;this.baseCoordinationModel=i.uuid}if(!e.length)return;const t=this.groups.get(this.baseCoordinationModel);if(!t){console.log("No base model found for coordination!");return}for(const i of e)i!==t&&(i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),i.updateMatrix(),i.applyMatrix4(i.coordinationMatrix.clone().invert()),i.applyMatrix4(t.coordinationMatrix))}};A(sm,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let rt=sm;const om={950732822:"IFCURIREFERENCE",4075327185:"IFCTIME",1209108979:"IFCTEMPERATURERATEOFCHANGEMEASURE",3457685358:"IFCSOUNDPRESSURELEVELMEASURE",4157543285:"IFCSOUNDPOWERLEVELMEASURE",2798247006:"IFCPROPERTYSETDEFINITIONSET",1790229001:"IFCPOSITIVEINTEGER",525895558:"IFCNONNEGATIVELENGTHMEASURE",1774176899:"IFCLINEINDEX",1275358634:"IFCLANGUAGEID",2541165894:"IFCDURATION",3701338814:"IFCDAYINWEEKNUMBER",2195413836:"IFCDATETIME",937566702:"IFCDATE",1683019596:"IFCCARDINALPOINTREFERENCE",2314439260:"IFCBINARY",1500781891:"IFCAREADENSITYMEASURE",3683503648:"IFCARCINDEX",4065007721:"IFCYEARNUMBER",1718600412:"IFCWARPINGMOMENTMEASURE",51269191:"IFCWARPINGCONSTANTMEASURE",2593997549:"IFCVOLUMETRICFLOWRATEMEASURE",3458127941:"IFCVOLUMEMEASURE",3345633955:"IFCVAPORPERMEABILITYMEASURE",1278329552:"IFCTORQUEMEASURE",2591213694:"IFCTIMESTAMP",2726807636:"IFCTIMEMEASURE",743184107:"IFCTHERMODYNAMICTEMPERATUREMEASURE",2016195849:"IFCTHERMALTRANSMITTANCEMEASURE",857959152:"IFCTHERMALRESISTANCEMEASURE",2281867870:"IFCTHERMALEXPANSIONCOEFFICIENTMEASURE",2645777649:"IFCTHERMALCONDUCTIVITYMEASURE",232962298:"IFCTHERMALADMITTANCEMEASURE",296282323:"IFCTEXTTRANSFORMATION",603696268:"IFCTEXTFONTNAME",3490877962:"IFCTEXTDECORATION",1460886941:"IFCTEXTALIGNMENT",2801250643:"IFCTEXT",58845555:"IFCTEMPERATUREGRADIENTMEASURE",361837227:"IFCSPECULARROUGHNESS",2757832317:"IFCSPECULAREXPONENT",3477203348:"IFCSPECIFICHEATCAPACITYMEASURE",993287707:"IFCSOUNDPRESSUREMEASURE",846465480:"IFCSOUNDPOWERMEASURE",3471399674:"IFCSOLIDANGLEMEASURE",408310005:"IFCSHEARMODULUSMEASURE",2190458107:"IFCSECTIONALAREAINTEGRALMEASURE",3467162246:"IFCSECTIONMODULUSMEASURE",2766185779:"IFCSECONDINMINUTE",3211557302:"IFCROTATIONALSTIFFNESSMEASURE",1755127002:"IFCROTATIONALMASSMEASURE",2133746277:"IFCROTATIONALFREQUENCYMEASURE",200335297:"IFCREAL",96294661:"IFCRATIOMEASURE",3972513137:"IFCRADIOACTIVITYMEASURE",3665567075:"IFCPRESSUREMEASURE",2169031380:"IFCPRESENTABLETEXT",1364037233:"IFCPOWERMEASURE",1245737093:"IFCPOSITIVERATIOMEASURE",3054510233:"IFCPOSITIVEPLANEANGLEMEASURE",2815919920:"IFCPOSITIVELENGTHMEASURE",4042175685:"IFCPLANEANGLEMEASURE",2642773653:"IFCPLANARFORCEMEASURE",2260317790:"IFCPARAMETERVALUE",929793134:"IFCPHMEASURE",2395907400:"IFCNUMERICMEASURE",2095195183:"IFCNORMALISEDRATIOMEASURE",765770214:"IFCMONTHINYEARNUMBER",2615040989:"IFCMONETARYMEASURE",3114022597:"IFCMOMENTOFINERTIAMEASURE",1648970520:"IFCMOLECULARWEIGHTMEASURE",3177669450:"IFCMOISTUREDIFFUSIVITYMEASURE",1753493141:"IFCMODULUSOFSUBGRADEREACTIONMEASURE",1052454078:"IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE",2173214787:"IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE",3341486342:"IFCMODULUSOFELASTICITYMEASURE",102610177:"IFCMINUTEINHOUR",3531705166:"IFCMASSPERLENGTHMEASURE",3124614049:"IFCMASSMEASURE",4017473158:"IFCMASSFLOWRATEMEASURE",1477762836:"IFCMASSDENSITYMEASURE",2486716878:"IFCMAGNETICFLUXMEASURE",286949696:"IFCMAGNETICFLUXDENSITYMEASURE",151039812:"IFCLUMINOUSINTENSITYMEASURE",2755797622:"IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE",2095003142:"IFCLUMINOUSFLUXMEASURE",503418787:"IFCLOGICAL",3086160713:"IFCLINEARVELOCITYMEASURE",1307019551:"IFCLINEARSTIFFNESSMEASURE",2128979029:"IFCLINEARMOMENTMEASURE",191860431:"IFCLINEARFORCEMEASURE",1243674935:"IFCLENGTHMEASURE",3258342251:"IFCLABEL",2054016361:"IFCKINEMATICVISCOSITYMEASURE",3192672207:"IFCISOTHERMALMOISTURECAPACITYMEASURE",3686016028:"IFCIONCONCENTRATIONMEASURE",3809634241:"IFCINTEGERCOUNTRATEMEASURE",1939436016:"IFCINTEGER",2679005408:"IFCINDUCTANCEMEASURE",3358199106:"IFCILLUMINANCEMEASURE",983778844:"IFCIDENTIFIER",2589826445:"IFCHOURINDAY",1158859006:"IFCHEATINGVALUEMEASURE",3113092358:"IFCHEATFLUXDENSITYMEASURE",3064340077:"IFCGLOBALLYUNIQUEID",3044325142:"IFCFREQUENCYMEASURE",1361398929:"IFCFORCEMEASURE",2590844177:"IFCFONTWEIGHT",2715512545:"IFCFONTVARIANT",1102727119:"IFCFONTSTYLE",2078135608:"IFCENERGYMEASURE",2506197118:"IFCELECTRICVOLTAGEMEASURE",2951915441:"IFCELECTRICRESISTANCEMEASURE",3790457270:"IFCELECTRICCURRENTMEASURE",2093906313:"IFCELECTRICCONDUCTANCEMEASURE",3818826038:"IFCELECTRICCHARGEMEASURE",1827137117:"IFCELECTRICCAPACITANCEMEASURE",69416015:"IFCDYNAMICVISCOSITYMEASURE",524656162:"IFCDOSEEQUIVALENTMEASURE",4134073009:"IFCDIMENSIONCOUNT",1514641115:"IFCDESCRIPTIVEMEASURE",300323983:"IFCDAYLIGHTSAVINGHOUR",86635668:"IFCDAYINMONTHNUMBER",94842927:"IFCCURVATUREMEASURE",1778710042:"IFCCOUNTMEASURE",3238673880:"IFCCONTEXTDEPENDENTMEASURE",3812528620:"IFCCOMPOUNDPLANEANGLEMEASURE",2991860651:"IFCCOMPLEXNUMBER",1867003952:"IFCBOXALIGNMENT",2735952531:"IFCBOOLEAN",2650437152:"IFCAREAMEASURE",632304761:"IFCANGULARVELOCITYMEASURE",360377573:"IFCAMOUNTOFSUBSTANCEMEASURE",4182062534:"IFCACCELERATIONMEASURE",3699917729:"IFCABSORBEDDOSEMEASURE",1971632696:"IFCGEOSLICE",2680139844:"IFCGEOMODEL",24726584:"IFCELECTRICFLOWTREATMENTDEVICE",3693000487:"IFCDISTRIBUTIONBOARD",3460952963:"IFCCONVEYORSEGMENT",3999819293:"IFCCAISSONFOUNDATION",3314249567:"IFCBOREHOLE",4196446775:"IFCBEARING",325726236:"IFCALIGNMENT",3425753595:"IFCTRACKELEMENT",991950508:"IFCSIGNAL",3798194928:"IFCREINFORCEDSOIL",3290496277:"IFCRAIL",1383356374:"IFCPAVEMENT",2182337498:"IFCNAVIGATIONELEMENT",234836483:"IFCMOORINGDEVICE",2078563270:"IFCMOBILETELECOMMUNICATIONSAPPLIANCE",1638804497:"IFCLIQUIDTERMINAL",1154579445:"IFCLINEARPOSITIONINGELEMENT",2696325953:"IFCKERB",2713699986:"IFCGEOTECHNICALASSEMBLY",2142170206:"IFCELECTRICFLOWTREATMENTDEVICETYPE",3376911765:"IFCEARTHWORKSFILL",1077100507:"IFCEARTHWORKSELEMENT",3071239417:"IFCEARTHWORKSCUT",479945903:"IFCDISTRIBUTIONBOARDTYPE",3426335179:"IFCDEEPFOUNDATION",1502416096:"IFCCOURSE",2940368186:"IFCCONVEYORSEGMENTTYPE",3203706013:"IFCCAISSONFOUNDATIONTYPE",3862327254:"IFCBUILTSYSTEM",1876633798:"IFCBUILTELEMENT",963979645:"IFCBRIDGEPART",644574406:"IFCBRIDGE",3649138523:"IFCBEARINGTYPE",1662888072:"IFCALIGNMENTVERTICAL",317615605:"IFCALIGNMENTSEGMENT",1545765605:"IFCALIGNMENTHORIZONTAL",4266260250:"IFCALIGNMENTCANT",3956297820:"IFCVIBRATIONDAMPERTYPE",1530820697:"IFCVIBRATIONDAMPER",840318589:"IFCVEHICLE",1953115116:"IFCTRANSPORTATIONDEVICE",618700268:"IFCTRACKELEMENTTYPE",2281632017:"IFCTENDONCONDUITTYPE",3663046924:"IFCTENDONCONDUIT",42703149:"IFCSINESPIRAL",1894708472:"IFCSIGNALTYPE",3599934289:"IFCSIGNTYPE",33720170:"IFCSIGN",1027922057:"IFCSEVENTHORDERPOLYNOMIALSPIRAL",544395925:"IFCSEGMENTEDREFERENCECURVE",3649235739:"IFCSECONDORDERPOLYNOMIALSPIRAL",550521510:"IFCROADPART",146592293:"IFCROAD",3818125796:"IFCRELADHERESTOELEMENT",4021432810:"IFCREFERENT",1891881377:"IFCRAILWAYPART",3992365140:"IFCRAILWAY",1763565496:"IFCRAILTYPE",1946335990:"IFCPOSITIONINGELEMENT",514975943:"IFCPAVEMENTTYPE",506776471:"IFCNAVIGATIONELEMENTTYPE",710110818:"IFCMOORINGDEVICETYPE",1950438474:"IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE",976884017:"IFCMARINEPART",525669439:"IFCMARINEFACILITY",1770583370:"IFCLIQUIDTERMINALTYPE",2176059722:"IFCLINEARELEMENT",679976338:"IFCKERBTYPE",3948183225:"IFCIMPACTPROTECTIONDEVICETYPE",2568555532:"IFCIMPACTPROTECTIONDEVICE",2898700619:"IFCGRADIENTCURVE",1594536857:"IFCGEOTECHNICALSTRATUM",4230923436:"IFCGEOTECHNICALELEMENT",4228831410:"IFCFACILITYPARTCOMMON",1310830890:"IFCFACILITYPART",24185140:"IFCFACILITY",4234616927:"IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID",1306400036:"IFCDEEPFOUNDATIONTYPE",4189326743:"IFCCOURSETYPE",2000195564:"IFCCOSINESPIRAL",3497074424:"IFCCLOTHOID",1626504194:"IFCBUILTELEMENTTYPE",3651464721:"IFCVEHICLETYPE",1229763772:"IFCTRIANGULATEDIRREGULARNETWORK",3665877780:"IFCTRANSPORTATIONDEVICETYPE",782932809:"IFCTHIRDORDERPOLYNOMIALSPIRAL",2735484536:"IFCSPIRAL",1356537516:"IFCSECTIONEDSURFACE",1290935644:"IFCSECTIONEDSOLIDHORIZONTAL",1862484736:"IFCSECTIONEDSOLID",1441486842:"IFCRELPOSITIONS",1033248425:"IFCRELASSOCIATESPROFILEDEF",3381221214:"IFCPOLYNOMIALCURVE",2485787929:"IFCOFFSETCURVEBYDISTANCES",590820931:"IFCOFFSETCURVE",3465909080:"IFCINDEXEDPOLYGONALTEXTUREMAP",593015953:"IFCDIRECTRIXCURVESWEPTAREASOLID",4212018352:"IFCCURVESEGMENT",3425423356:"IFCAXIS2PLACEMENTLINEAR",823603102:"IFCSEGMENT",2165702409:"IFCPOINTBYDISTANCEEXPRESSION",182550632:"IFCOPENCROSSPROFILEDEF",388784114:"IFCLINEARPLACEMENT",536804194:"IFCALIGNMENTHORIZONTALSEGMENT",3752311538:"IFCALIGNMENTCANTSEGMENT",1010789467:"IFCTEXTURECOORDINATEINDICESWITHVOIDS",222769930:"IFCTEXTURECOORDINATEINDICES",2691318326:"IFCQUANTITYNUMBER",3633395639:"IFCALIGNMENTVERTICALSEGMENT",2879124712:"IFCALIGNMENTPARAMETERSEGMENT",25142252:"IFCCONTROLLER",3087945054:"IFCALARM",4288193352:"IFCACTUATOR",630975310:"IFCUNITARYCONTROLELEMENT",4086658281:"IFCSENSOR",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",182646315:"IFCFLOWINSTRUMENT",1426591983:"IFCFIRESUPPRESSIONTERMINAL",819412036:"IFCFILTER",3415622556:"IFCFAN",1003880860:"IFCELECTRICTIMECONTROL",402227799:"IFCELECTRICMOTOR",264262732:"IFCELECTRICGENERATOR",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",862014818:"IFCELECTRICDISTRIBUTIONBOARD",1904799276:"IFCELECTRICAPPLIANCE",1360408905:"IFCDUCTSILENCER",3518393246:"IFCDUCTSEGMENT",342316401:"IFCDUCTFITTING",562808652:"IFCDISTRIBUTIONCIRCUIT",4074379575:"IFCDAMPER",3640358203:"IFCCOOLINGTOWER",4136498852:"IFCCOOLEDBEAM",2272882330:"IFCCONDENSER",3571504051:"IFCCOMPRESSOR",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",639361253:"IFCCOIL",3902619387:"IFCCHILLER",4217484030:"IFCCABLESEGMENT",1051757585:"IFCCABLEFITTING",3758799889:"IFCCABLECARRIERSEGMENT",635142910:"IFCCABLECARRIERFITTING",2938176219:"IFCBURNER",32344328:"IFCBOILER",2906023776:"IFCBEAMSTANDARDCASE",277319702:"IFCAUDIOVISUALAPPLIANCE",2056796094:"IFCAIRTOAIRHEATRECOVERY",177149247:"IFCAIRTERMINALBOX",1634111441:"IFCAIRTERMINAL",486154966:"IFCWINDOWSTANDARDCASE",4237592921:"IFCWASTETERMINAL",4156078855:"IFCWALLELEMENTEDCASE",4207607924:"IFCVALVE",4292641817:"IFCUNITARYEQUIPMENT",3179687236:"IFCUNITARYCONTROLELEMENTTYPE",3026737570:"IFCTUBEBUNDLE",3825984169:"IFCTRANSFORMER",812556717:"IFCTANK",1162798199:"IFCSWITCHINGDEVICE",385403989:"IFCSTRUCTURALLOADCASE",1404847402:"IFCSTACKTERMINAL",1999602285:"IFCSPACEHEATER",3420628829:"IFCSOLARDEVICE",3027962421:"IFCSLABSTANDARDCASE",3127900445:"IFCSLABELEMENTEDCASE",1329646415:"IFCSHADINGDEVICE",3053780830:"IFCSANITARYTERMINAL",2572171363:"IFCREINFORCINGBARTYPE",1232101972:"IFCRATIONALBSPLINECURVEWITHKNOTS",90941305:"IFCPUMP",655969474:"IFCPROTECTIVEDEVICETRIPPINGUNITTYPE",738039164:"IFCPROTECTIVEDEVICE",1156407060:"IFCPLATESTANDARDCASE",3612865200:"IFCPIPESEGMENT",310824031:"IFCPIPEFITTING",3694346114:"IFCOUTLET",144952367:"IFCOUTERBOUNDARYCURVE",2474470126:"IFCMOTORCONNECTION",1911478936:"IFCMEMBERSTANDARDCASE",1437502449:"IFCMEDICALDEVICE",629592764:"IFCLIGHTFIXTURE",76236018:"IFCLAMP",2176052936:"IFCJUNCTIONBOX",4175244083:"IFCINTERCEPTOR",2068733104:"IFCHUMIDIFIER",3319311131:"IFCHEATEXCHANGER",2188021234:"IFCFLOWMETER",1209101575:"IFCEXTERNALSPATIALELEMENT",484807127:"IFCEVAPORATOR",3747195512:"IFCEVAPORATIVECOOLER",2814081492:"IFCENGINE",2417008758:"IFCELECTRICDISTRIBUTIONBOARDTYPE",3242481149:"IFCDOORSTANDARDCASE",3205830791:"IFCDISTRIBUTIONSYSTEM",400855858:"IFCCOMMUNICATIONSAPPLIANCETYPE",905975707:"IFCCOLUMNSTANDARDCASE",1677625105:"IFCCIVILELEMENT",3296154744:"IFCCHIMNEY",2674252688:"IFCCABLEFITTINGTYPE",2188180465:"IFCBURNERTYPE",1177604601:"IFCBUILDINGSYSTEM",39481116:"IFCBUILDINGELEMENTPARTTYPE",1136057603:"IFCBOUNDARYCURVE",2461110595:"IFCBSPLINECURVEWITHKNOTS",1532957894:"IFCAUDIOVISUALAPPLIANCETYPE",4088093105:"IFCWORKCALENDAR",4009809668:"IFCWINDOWTYPE",926996030:"IFCVOIDINGFEATURE",2391383451:"IFCVIBRATIONISOLATOR",2415094496:"IFCTENDONTYPE",3081323446:"IFCTENDONANCHORTYPE",413509423:"IFCSYSTEMFURNITUREELEMENT",3101698114:"IFCSURFACEFEATURE",3657597509:"IFCSTRUCTURALSURFACEACTION",2757150158:"IFCSTRUCTURALCURVEREACTION",1004757350:"IFCSTRUCTURALCURVEACTION",338393293:"IFCSTAIRTYPE",1072016465:"IFCSOLARDEVICETYPE",4074543187:"IFCSHADINGDEVICETYPE",2157484638:"IFCSEAMCURVE",2781568857:"IFCROOFTYPE",2310774935:"IFCREINFORCINGMESHTYPE",964333572:"IFCREINFORCINGELEMENTTYPE",683857671:"IFCRATIONALBSPLINESURFACEWITHKNOTS",1469900589:"IFCRAMPTYPE",2839578677:"IFCPOLYGONALFACESET",1158309216:"IFCPILETYPE",3079942009:"IFCOPENINGSTANDARDCASE",1114901282:"IFCMEDICALDEVICETYPE",3113134337:"IFCINTERSECTIONCURVE",3946677679:"IFCINTERCEPTORTYPE",2571569899:"IFCINDEXEDPOLYCURVE",3493046030:"IFCGEOGRAPHICELEMENT",1509553395:"IFCFURNITURE",1893162501:"IFCFOOTINGTYPE",2853485674:"IFCEXTERNALSPATIALSTRUCTUREELEMENT",4148101412:"IFCEVENT",132023988:"IFCENGINETYPE",2397081782:"IFCELEMENTASSEMBLYTYPE",2323601079:"IFCDOORTYPE",1213902940:"IFCCYLINDRICALSURFACE",1525564444:"IFCCONSTRUCTIONPRODUCTRESOURCETYPE",4105962743:"IFCCONSTRUCTIONMATERIALRESOURCETYPE",2185764099:"IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE",15328376:"IFCCOMPOSITECURVEONSURFACE",3875453745:"IFCCOMPLEXPROPERTYTEMPLATE",3893394355:"IFCCIVILELEMENTTYPE",2197970202:"IFCCHIMNEYTYPE",167062518:"IFCBSPLINESURFACEWITHKNOTS",2887950389:"IFCBSPLINESURFACE",2603310189:"IFCADVANCEDBREPWITHVOIDS",1635779807:"IFCADVANCEDBREP",2916149573:"IFCTRIANGULATEDFACESET",1935646853:"IFCTOROIDALSURFACE",2387106220:"IFCTESSELLATEDFACESET",3206491090:"IFCTASKTYPE",699246055:"IFCSURFACECURVE",4095615324:"IFCSUBCONTRACTRESOURCETYPE",603775116:"IFCSTRUCTURALSURFACEREACTION",4015995234:"IFCSPHERICALSURFACE",2481509218:"IFCSPATIALZONETYPE",463610769:"IFCSPATIALZONE",710998568:"IFCSPATIALELEMENTTYPE",1412071761:"IFCSPATIALELEMENT",3663146110:"IFCSIMPLEPROPERTYTEMPLATE",3243963512:"IFCREVOLVEDAREASOLIDTAPERED",816062949:"IFCREPARAMETRISEDCOMPOSITECURVESEGMENT",1521410863:"IFCRELSPACEBOUNDARY2NDLEVEL",3523091289:"IFCRELSPACEBOUNDARY1STLEVEL",427948657:"IFCRELINTERFERESELEMENTS",307848117:"IFCRELDEFINESBYTEMPLATE",1462361463:"IFCRELDEFINESBYOBJECT",2565941209:"IFCRELDECLARES",1027710054:"IFCRELASSIGNSTOGROUPBYFACTOR",3521284610:"IFCPROPERTYTEMPLATE",492091185:"IFCPROPERTYSETTEMPLATE",653396225:"IFCPROJECTLIBRARY",569719735:"IFCPROCEDURETYPE",3967405729:"IFCPREDEFINEDPROPERTYSET",1682466193:"IFCPCURVE",428585644:"IFCLABORRESOURCETYPE",2294589976:"IFCINDEXEDPOLYGONALFACEWITHVOIDS",178912537:"IFCINDEXEDPOLYGONALFACE",4095422895:"IFCGEOGRAPHICELEMENTTYPE",2652556860:"IFCFIXEDREFERENCESWEPTAREASOLID",2804161546:"IFCEXTRUDEDAREASOLIDTAPERED",4024345920:"IFCEVENTTYPE",2629017746:"IFCCURVEBOUNDEDSURFACE",1815067380:"IFCCREWRESOURCETYPE",3419103109:"IFCCONTEXT",2574617495:"IFCCONSTRUCTIONRESOURCETYPE",2059837836:"IFCCARTESIANPOINTLIST3D",1675464909:"IFCCARTESIANPOINTLIST2D",574549367:"IFCCARTESIANPOINTLIST",3406155212:"IFCADVANCEDFACE",3698973494:"IFCTYPERESOURCE",3736923433:"IFCTYPEPROCESS",901063453:"IFCTESSELLATEDITEM",1096409881:"IFCSWEPTDISKSOLIDPOLYGONAL",1042787934:"IFCRESOURCETIME",1608871552:"IFCRESOURCECONSTRAINTRELATIONSHIP",2943643501:"IFCRESOURCEAPPROVALRELATIONSHIP",2090586900:"IFCQUANTITYSET",1482703590:"IFCPROPERTYTEMPLATEDEFINITION",3778827333:"IFCPREDEFINEDPROPERTIES",2998442950:"IFCMIRROREDPROFILEDEF",853536259:"IFCMATERIALRELATIONSHIP",3404854881:"IFCMATERIALPROFILESETUSAGETAPERING",3079605661:"IFCMATERIALPROFILESETUSAGE",2852063980:"IFCMATERIALCONSTITUENTSET",3708119e3:"IFCMATERIALCONSTITUENT",1585845231:"IFCLAGTIME",2133299955:"IFCINDEXEDTRIANGLETEXTUREMAP",1437953363:"IFCINDEXEDTEXTUREMAP",3570813810:"IFCINDEXEDCOLOURMAP",1437805879:"IFCEXTERNALREFERENCERELATIONSHIP",297599258:"IFCEXTENDEDPROPERTIES",211053100:"IFCEVENTTIME",2713554722:"IFCCONVERSIONBASEDUNITWITHOFFSET",3285139300:"IFCCOLOURRGBLIST",1236880293:"IFCWORKTIME",1199560280:"IFCTIMEPERIOD",3611470254:"IFCTEXTUREVERTEXLIST",2771591690:"IFCTASKTIMERECURRING",1549132990:"IFCTASKTIME",2043862942:"IFCTABLECOLUMN",2934153892:"IFCSURFACEREINFORCEMENTAREA",609421318:"IFCSTRUCTURALLOADORRESULT",3478079324:"IFCSTRUCTURALLOADCONFIGURATION",1054537805:"IFCSCHEDULINGTIME",2439245199:"IFCRESOURCELEVELRELATIONSHIP",2433181523:"IFCREFERENCE",3915482550:"IFCRECURRENCEPATTERN",986844984:"IFCPROPERTYABSTRACTION",3843373140:"IFCPROJECTEDCRS",677532197:"IFCPRESENTATIONITEM",1507914824:"IFCMATERIALUSAGEDEFINITION",552965576:"IFCMATERIALPROFILEWITHOFFSETS",164193824:"IFCMATERIALPROFILESET",2235152071:"IFCMATERIALPROFILE",1847252529:"IFCMATERIALLAYERWITHOFFSETS",760658860:"IFCMATERIALDEFINITION",3057273783:"IFCMAPCONVERSION",4294318154:"IFCEXTERNALINFORMATION",1466758467:"IFCCOORDINATEREFERENCESYSTEM",1785450214:"IFCCOORDINATEOPERATION",775493141:"IFCCONNECTIONVOLUMEGEOMETRY",979691226:"IFCREINFORCINGBAR",3700593921:"IFCELECTRICDISTRIBUTIONPOINT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",578613899:"IFCCONTROLLERTYPE",2454782716:"IFCCHAMFEREDGEFEATURE",753842376:"IFCBEAM",3001207471:"IFCALARMTYPE",2874132201:"IFCACTUATORTYPE",3304561284:"IFCWINDOW",3512223829:"IFCWALLSTANDARDCASE",2391406946:"IFCWALL",3313531582:"IFCVIBRATIONISOLATORTYPE",2347447852:"IFCTENDONANCHOR",3824725483:"IFCTENDON",2515109513:"IFCSTRUCTURALANALYSISMODEL",4252922144:"IFCSTAIRFLIGHT",331165859:"IFCSTAIR",1529196076:"IFCSLAB",1783015770:"IFCSENSORTYPE",1376911519:"IFCROUNDEDEDGEFEATURE",2016517767:"IFCROOF",2320036040:"IFCREINFORCINGMESH",3027567501:"IFCREINFORCINGELEMENT",3055160366:"IFCRATIONALBEZIERCURVE",3283111854:"IFCRAMPFLIGHT",3024970846:"IFCRAMP",2262370178:"IFCRAILING",3171933400:"IFCPLATE",1687234759:"IFCPILE",1073191201:"IFCMEMBER",900683007:"IFCFOOTING",3508470533:"IFCFLOWTREATMENTDEVICE",2223149337:"IFCFLOWTERMINAL",707683696:"IFCFLOWSTORAGEDEVICE",987401354:"IFCFLOWSEGMENT",3132237377:"IFCFLOWMOVINGDEVICE",4037862832:"IFCFLOWINSTRUMENTTYPE",4278956645:"IFCFLOWFITTING",2058353004:"IFCFLOWCONTROLLER",4222183408:"IFCFIRESUPPRESSIONTERMINALTYPE",1810631287:"IFCFILTERTYPE",346874300:"IFCFANTYPE",1658829314:"IFCENERGYCONVERSIONDEVICE",857184966:"IFCELECTRICALELEMENT",1634875225:"IFCELECTRICALCIRCUIT",712377611:"IFCELECTRICTIMECONTROLTYPE",1217240411:"IFCELECTRICMOTORTYPE",1365060375:"IFCELECTRICHEATERTYPE",1534661035:"IFCELECTRICGENERATORTYPE",3277789161:"IFCELECTRICFLOWSTORAGEDEVICETYPE",663422040:"IFCELECTRICAPPLIANCETYPE",855621170:"IFCEDGEFEATURE",2030761528:"IFCDUCTSILENCERTYPE",3760055223:"IFCDUCTSEGMENTTYPE",869906466:"IFCDUCTFITTINGTYPE",395920057:"IFCDOOR",3041715199:"IFCDISTRIBUTIONPORT",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",1945004755:"IFCDISTRIBUTIONELEMENT",2063403501:"IFCDISTRIBUTIONCONTROLELEMENTTYPE",1599208980:"IFCDISTRIBUTIONCHAMBERELEMENTTYPE",2635815018:"IFCDISCRETEACCESSORYTYPE",1335981549:"IFCDISCRETEACCESSORY",4147604152:"IFCDIAMETERDIMENSION",3961806047:"IFCDAMPERTYPE",3495092785:"IFCCURTAINWALL",1973544240:"IFCCOVERING",2954562838:"IFCCOOLINGTOWERTYPE",335055490:"IFCCOOLEDBEAMTYPE",488727124:"IFCCONSTRUCTIONPRODUCTRESOURCE",1060000209:"IFCCONSTRUCTIONMATERIALRESOURCE",3898045240:"IFCCONSTRUCTIONEQUIPMENTRESOURCE",1163958913:"IFCCONDITIONCRITERION",2188551683:"IFCCONDITION",2816379211:"IFCCONDENSERTYPE",3850581409:"IFCCOMPRESSORTYPE",843113511:"IFCCOLUMN",2301859152:"IFCCOILTYPE",2611217952:"IFCCIRCLE",2951183804:"IFCCHILLERTYPE",1285652485:"IFCCABLESEGMENTTYPE",3293546465:"IFCCABLECARRIERSEGMENTTYPE",395041908:"IFCCABLECARRIERFITTINGTYPE",1909888760:"IFCBUILDINGELEMENTPROXYTYPE",1095909175:"IFCBUILDINGELEMENTPROXY",2979338954:"IFCBUILDINGELEMENTPART",52481810:"IFCBUILDINGELEMENTCOMPONENT",3299480353:"IFCBUILDINGELEMENT",231477066:"IFCBOILERTYPE",1916977116:"IFCBEZIERCURVE",819618141:"IFCBEAMTYPE",1967976161:"IFCBSPLINECURVE",3460190687:"IFCASSET",2470393545:"IFCANGULARDIMENSION",1871374353:"IFCAIRTOAIRHEATRECOVERYTYPE",3352864051:"IFCAIRTERMINALTYPE",1411407467:"IFCAIRTERMINALBOXTYPE",3821786052:"IFCACTIONREQUEST",1213861670:"IFC2DCOMPOSITECURVE",1033361043:"IFCZONE",3342526732:"IFCWORKSCHEDULE",4218914973:"IFCWORKPLAN",1028945134:"IFCWORKCONTROL",1133259667:"IFCWASTETERMINALTYPE",1898987631:"IFCWALLTYPE",2769231204:"IFCVIRTUALELEMENT",728799441:"IFCVALVETYPE",1911125066:"IFCUNITARYEQUIPMENTTYPE",1600972822:"IFCTUBEBUNDLETYPE",3593883385:"IFCTRIMMEDCURVE",1620046519:"IFCTRANSPORTELEMENT",1692211062:"IFCTRANSFORMERTYPE",1637806684:"IFCTIMESERIESSCHEDULE",5716631:"IFCTANKTYPE",2254336722:"IFCSYSTEM",2315554128:"IFCSWITCHINGDEVICETYPE",148013059:"IFCSUBCONTRACTRESOURCE",1975003073:"IFCSTRUCTURALSURFACECONNECTION",2986769608:"IFCSTRUCTURALRESULTGROUP",1235345126:"IFCSTRUCTURALPOINTREACTION",734778138:"IFCSTRUCTURALPOINTCONNECTION",2082059205:"IFCSTRUCTURALPOINTACTION",3987759626:"IFCSTRUCTURALPLANARACTIONVARYING",1621171031:"IFCSTRUCTURALPLANARACTION",1252848954:"IFCSTRUCTURALLOADGROUP",1721250024:"IFCSTRUCTURALLINEARACTIONVARYING",1807405624:"IFCSTRUCTURALLINEARACTION",2445595289:"IFCSTRUCTURALCURVEMEMBERVARYING",214636428:"IFCSTRUCTURALCURVEMEMBER",4243806635:"IFCSTRUCTURALCURVECONNECTION",1179482911:"IFCSTRUCTURALCONNECTION",682877961:"IFCSTRUCTURALACTION",1039846685:"IFCSTAIRFLIGHTTYPE",3112655638:"IFCSTACKTERMINALTYPE",3812236995:"IFCSPACETYPE",652456506:"IFCSPACEPROGRAM",1305183839:"IFCSPACEHEATERTYPE",3856911033:"IFCSPACE",2533589738:"IFCSLABTYPE",4097777520:"IFCSITE",4105383287:"IFCSERVICELIFE",3517283431:"IFCSCHEDULETIMECONTROL",1768891740:"IFCSANITARYTERMINALTYPE",2863920197:"IFCRELASSIGNSTASKS",160246688:"IFCRELAGGREGATES",2324767716:"IFCRAMPFLIGHTTYPE",2893384427:"IFCRAILINGTYPE",3248260540:"IFCRADIUSDIMENSION",2250791053:"IFCPUMPTYPE",1842657554:"IFCPROTECTIVEDEVICETYPE",3651124850:"IFCPROJECTIONELEMENT",3642467123:"IFCPROJECTORDERRECORD",2904328755:"IFCPROJECTORDER",2744685151:"IFCPROCEDURE",3740093272:"IFCPORT",3724593414:"IFCPOLYLINE",4017108033:"IFCPLATETYPE",4231323485:"IFCPIPESEGMENTTYPE",804291784:"IFCPIPEFITTINGTYPE",3327091369:"IFCPERMIT",2382730787:"IFCPERFORMANCEHISTORY",2837617999:"IFCOUTLETTYPE",3425660407:"IFCORDERACTION",3588315303:"IFCOPENINGELEMENT",4143007308:"IFCOCCUPANT",1916936684:"IFCMOVE",977012517:"IFCMOTORCONNECTIONTYPE",3181161470:"IFCMEMBERTYPE",2108223431:"IFCMECHANICALFASTENERTYPE",377706215:"IFCMECHANICALFASTENER",2506943328:"IFCLINEARDIMENSION",1161773419:"IFCLIGHTFIXTURETYPE",1051575348:"IFCLAMPTYPE",3827777499:"IFCLABORRESOURCE",4288270099:"IFCJUNCTIONBOXTYPE",2391368822:"IFCINVENTORY",1806887404:"IFCHUMIDIFIERTYPE",1251058090:"IFCHEATEXCHANGERTYPE",2706460486:"IFCGROUP",3009204131:"IFCGRID",200128114:"IFCGASTERMINALTYPE",814719939:"IFCFURNITURESTANDARD",263784265:"IFCFURNISHINGELEMENT",3009222698:"IFCFLOWTREATMENTDEVICETYPE",2297155007:"IFCFLOWTERMINALTYPE",1339347760:"IFCFLOWSTORAGEDEVICETYPE",1834744321:"IFCFLOWSEGMENTTYPE",1482959167:"IFCFLOWMOVINGDEVICETYPE",3815607619:"IFCFLOWMETERTYPE",3198132628:"IFCFLOWFITTINGTYPE",3907093117:"IFCFLOWCONTROLLERTYPE",1287392070:"IFCFEATUREELEMENTSUBTRACTION",2143335405:"IFCFEATUREELEMENTADDITION",2827207264:"IFCFEATUREELEMENT",2489546625:"IFCFASTENERTYPE",647756555:"IFCFASTENER",3737207727:"IFCFACETEDBREPWITHVOIDS",807026263:"IFCFACETEDBREP",3390157468:"IFCEVAPORATORTYPE",3174744832:"IFCEVAPORATIVECOOLERTYPE",3272907226:"IFCEQUIPMENTSTANDARD",1962604670:"IFCEQUIPMENTELEMENT",2107101300:"IFCENERGYCONVERSIONDEVICETYPE",1704287377:"IFCELLIPSE",2590856083:"IFCELEMENTCOMPONENTTYPE",1623761950:"IFCELEMENTCOMPONENT",4123344466:"IFCELEMENTASSEMBLY",1758889154:"IFCELEMENT",360485395:"IFCELECTRICALBASEPROPERTIES",3849074793:"IFCDISTRIBUTIONFLOWELEMENTTYPE",3256556792:"IFCDISTRIBUTIONELEMENTTYPE",681481545:"IFCDIMENSIONCURVEDIRECTEDCALLOUT",1457835157:"IFCCURTAINWALLTYPE",3295246426:"IFCCREWRESOURCE",1916426348:"IFCCOVERINGTYPE",1419761937:"IFCCOSTSCHEDULE",3895139033:"IFCCOSTITEM",3293443760:"IFCCONTROL",2559216714:"IFCCONSTRUCTIONRESOURCE",2510884976:"IFCCONIC",3732776249:"IFCCOMPOSITECURVE",300633059:"IFCCOLUMNTYPE",2937912522:"IFCCIRCLEHOLLOWPROFILEDEF",3124254112:"IFCBUILDINGSTOREY",1950629157:"IFCBUILDINGELEMENTTYPE",4031249490:"IFCBUILDING",1260505505:"IFCBOUNDEDCURVE",3649129432:"IFCBOOLEANCLIPPINGRESULT",1334484129:"IFCBLOCK",3207858831:"IFCASYMMETRICISHAPEPROFILEDEF",1674181508:"IFCANNOTATION",2296667514:"IFCACTOR",2097647324:"IFCTRANSPORTELEMENTTYPE",3473067441:"IFCTASK",1580310250:"IFCSYSTEMFURNITUREELEMENTTYPE",4124788165:"IFCSURFACEOFREVOLUTION",2809605785:"IFCSURFACEOFLINEAREXTRUSION",2028607225:"IFCSURFACECURVESWEPTAREASOLID",4070609034:"IFCSTRUCTUREDDIMENSIONCALLOUT",2218152070:"IFCSTRUCTURALSURFACEMEMBERVARYING",3979015343:"IFCSTRUCTURALSURFACEMEMBER",3689010777:"IFCSTRUCTURALREACTION",530289379:"IFCSTRUCTURALMEMBER",3136571912:"IFCSTRUCTURALITEM",3544373492:"IFCSTRUCTURALACTIVITY",451544542:"IFCSPHERE",3893378262:"IFCSPATIALSTRUCTUREELEMENTTYPE",2706606064:"IFCSPATIALSTRUCTUREELEMENT",3626867408:"IFCRIGHTCIRCULARCYLINDER",4158566097:"IFCRIGHTCIRCULARCONE",1856042241:"IFCREVOLVEDAREASOLID",2914609552:"IFCRESOURCE",1401173127:"IFCRELVOIDSELEMENT",3451746338:"IFCRELSPACEBOUNDARY",366585022:"IFCRELSERVICESBUILDINGS",4122056220:"IFCRELSEQUENCE",1058617721:"IFCRELSCHEDULESCOSTITEMS",1245217292:"IFCRELREFERENCEDINSPATIALSTRUCTURE",750771296:"IFCRELPROJECTSELEMENT",202636808:"IFCRELOVERRIDESPROPERTIES",2051452291:"IFCRELOCCUPIESSPACES",3268803585:"IFCRELNESTS",4189434867:"IFCRELINTERACTIONREQUIREMENTS",279856033:"IFCRELFLOWCONTROLELEMENTS",3940055652:"IFCRELFILLSELEMENT",781010003:"IFCRELDEFINESBYTYPE",4186316022:"IFCRELDEFINESBYPROPERTIES",693640335:"IFCRELDEFINES",2551354335:"IFCRELDECOMPOSES",2802773753:"IFCRELCOVERSSPACES",886880790:"IFCRELCOVERSBLDGELEMENTS",3242617779:"IFCRELCONTAINEDINSPATIALSTRUCTURE",3678494232:"IFCRELCONNECTSWITHREALIZINGELEMENTS",504942748:"IFCRELCONNECTSWITHECCENTRICITY",1638771189:"IFCRELCONNECTSSTRUCTURALMEMBER",3912681535:"IFCRELCONNECTSSTRUCTURALELEMENT",2127690289:"IFCRELCONNECTSSTRUCTURALACTIVITY",3190031847:"IFCRELCONNECTSPORTS",4201705270:"IFCRELCONNECTSPORTTOELEMENT",3945020480:"IFCRELCONNECTSPATHELEMENTS",1204542856:"IFCRELCONNECTSELEMENTS",826625072:"IFCRELCONNECTS",2851387026:"IFCRELASSOCIATESPROFILEPROPERTIES",2655215786:"IFCRELASSOCIATESMATERIAL",3840914261:"IFCRELASSOCIATESLIBRARY",982818633:"IFCRELASSOCIATESDOCUMENT",2728634034:"IFCRELASSOCIATESCONSTRAINT",919958153:"IFCRELASSOCIATESCLASSIFICATION",4095574036:"IFCRELASSOCIATESAPPROVAL",1327628568:"IFCRELASSOCIATESAPPLIEDVALUE",1865459582:"IFCRELASSOCIATES",205026976:"IFCRELASSIGNSTORESOURCE",3372526763:"IFCRELASSIGNSTOPROJECTORDER",2857406711:"IFCRELASSIGNSTOPRODUCT",4278684876:"IFCRELASSIGNSTOPROCESS",1307041759:"IFCRELASSIGNSTOGROUP",2495723537:"IFCRELASSIGNSTOCONTROL",1683148259:"IFCRELASSIGNSTOACTOR",3939117080:"IFCRELASSIGNS",3454111270:"IFCRECTANGULARTRIMMEDSURFACE",2798486643:"IFCRECTANGULARPYRAMID",2770003689:"IFCRECTANGLEHOLLOWPROFILEDEF",3219374653:"IFCPROXY",1451395588:"IFCPROPERTYSET",4194566429:"IFCPROJECTIONCURVE",103090709:"IFCPROJECT",4208778838:"IFCPRODUCT",2945172077:"IFCPROCESS",220341763:"IFCPLANE",603570806:"IFCPLANARBOX",3566463478:"IFCPERMEABLECOVERINGPROPERTIES",3505215534:"IFCOFFSETCURVE3D",3388369263:"IFCOFFSETCURVE2D",3888040117:"IFCOBJECT",1425443689:"IFCMANIFOLDSOLIDBREP",1281925730:"IFCLINE",572779678:"IFCLSHAPEPROFILEDEF",1484403080:"IFCISHAPEPROFILEDEF",987898635:"IFCGEOMETRICCURVESET",1268542332:"IFCFURNITURETYPE",4238390223:"IFCFURNISHINGELEMENTTYPE",3455213021:"IFCFLUIDFLOWPROPERTIES",315944413:"IFCFILLAREASTYLETILES",4203026998:"IFCFILLAREASTYLETILESYMBOLWITHSTYLE",374418227:"IFCFILLAREASTYLEHATCHING",2047409740:"IFCFACEBASEDSURFACEMODEL",477187591:"IFCEXTRUDEDAREASOLID",80994333:"IFCENERGYPROPERTIES",2835456948:"IFCELLIPSEPROFILEDEF",2777663545:"IFCELEMENTARYSURFACE",339256511:"IFCELEMENTTYPE",1883228015:"IFCELEMENTQUANTITY",1472233963:"IFCEDGELOOP",4006246654:"IFCDRAUGHTINGPREDEFINEDCURVEFONT",445594917:"IFCDRAUGHTINGPREDEFINEDCOLOUR",3073041342:"IFCDRAUGHTINGCALLOUT",526551008:"IFCDOORSTYLE",1714330368:"IFCDOORPANELPROPERTIES",2963535650:"IFCDOORLININGPROPERTIES",32440307:"IFCDIRECTION",4054601972:"IFCDIMENSIONCURVETERMINATOR",606661476:"IFCDIMENSIONCURVE",693772133:"IFCDEFINEDSYMBOL",2827736869:"IFCCURVEBOUNDEDPLANE",2601014836:"IFCCURVE",2147822146:"IFCCSGSOLID",2506170314:"IFCCSGPRIMITIVE3D",194851669:"IFCCRANERAILFSHAPEPROFILEDEF",4133800736:"IFCCRANERAILASHAPEPROFILEDEF",2485617015:"IFCCOMPOSITECURVESEGMENT",2205249479:"IFCCLOSEDSHELL",1383045692:"IFCCIRCLEPROFILEDEF",1416205885:"IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM",3331915920:"IFCCARTESIANTRANSFORMATIONOPERATOR3D",3486308946:"IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM",3749851601:"IFCCARTESIANTRANSFORMATIONOPERATOR2D",59481748:"IFCCARTESIANTRANSFORMATIONOPERATOR",1123145078:"IFCCARTESIANPOINT",2898889636:"IFCCSHAPEPROFILEDEF",2713105998:"IFCBOXEDHALFSPACE",2581212453:"IFCBOUNDINGBOX",4182860854:"IFCBOUNDEDSURFACE",2736907675:"IFCBOOLEANRESULT",2740243338:"IFCAXIS2PLACEMENT3D",3125803723:"IFCAXIS2PLACEMENT2D",4261334040:"IFCAXIS1PLACEMENT",1302238472:"IFCANNOTATIONSURFACE",2265737646:"IFCANNOTATIONFILLAREAOCCURRENCE",669184980:"IFCANNOTATIONFILLAREA",3288037868:"IFCANNOTATIONCURVEOCCURRENCE",2543172580:"IFCZSHAPEPROFILEDEF",1299126871:"IFCWINDOWSTYLE",512836454:"IFCWINDOWPANELPROPERTIES",336235671:"IFCWINDOWLININGPROPERTIES",2759199220:"IFCVERTEXLOOP",1417489154:"IFCVECTOR",427810014:"IFCUSHAPEPROFILEDEF",2347495698:"IFCTYPEPRODUCT",1628702193:"IFCTYPEOBJECT",1345879162:"IFCTWODIRECTIONREPEATFACTOR",2715220739:"IFCTRAPEZIUMPROFILEDEF",3124975700:"IFCTEXTLITERALWITHEXTENT",4282788508:"IFCTEXTLITERAL",3028897424:"IFCTERMINATORSYMBOL",3071757647:"IFCTSHAPEPROFILEDEF",230924584:"IFCSWEPTSURFACE",1260650574:"IFCSWEPTDISKSOLID",2247615214:"IFCSWEPTAREASOLID",1878645084:"IFCSURFACESTYLERENDERING",2513912981:"IFCSURFACE",2233826070:"IFCSUBEDGE",3653947884:"IFCSTRUCTURALSTEELPROFILEPROPERTIES",3843319758:"IFCSTRUCTURALPROFILEPROPERTIES",1190533807:"IFCSTRUCTURALLOADSINGLEFORCEWARPING",1597423693:"IFCSTRUCTURALLOADSINGLEFORCE",1973038258:"IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION",2473145415:"IFCSTRUCTURALLOADSINGLEDISPLACEMENT",2668620305:"IFCSTRUCTURALLOADPLANARFORCE",1595516126:"IFCSTRUCTURALLOADLINEARFORCE",390701378:"IFCSPACETHERMALLOADPROPERTIES",1202362311:"IFCSOUNDVALUE",2485662743:"IFCSOUNDPROPERTIES",723233188:"IFCSOLIDMODEL",2609359061:"IFCSLIPPAGECONNECTIONCONDITION",4124623270:"IFCSHELLBASEDSURFACEMODEL",2411513650:"IFCSERVICELIFEFACTOR",1509187699:"IFCSECTIONEDSPINE",2778083089:"IFCROUNDEDRECTANGLEPROFILEDEF",478536968:"IFCRELATIONSHIP",3765753017:"IFCREINFORCEMENTDEFINITIONPROPERTIES",3413951693:"IFCREGULARTIMESERIES",3615266464:"IFCRECTANGLEPROFILEDEF",110355661:"IFCPROPERTYTABLEVALUE",3650150729:"IFCPROPERTYSINGLEVALUE",3357820518:"IFCPROPERTYSETDEFINITION",941946838:"IFCPROPERTYREFERENCEVALUE",2752243245:"IFCPROPERTYLISTVALUE",4166981789:"IFCPROPERTYENUMERATEDVALUE",1680319473:"IFCPROPERTYDEFINITION",871118103:"IFCPROPERTYBOUNDEDVALUE",673634403:"IFCPRODUCTDEFINITIONSHAPE",179317114:"IFCPREDEFINEDPOINTMARKERSYMBOL",433424934:"IFCPREDEFINEDDIMENSIONSYMBOL",2559016684:"IFCPREDEFINEDCURVEFONT",759155922:"IFCPREDEFINEDCOLOUR",2775532180:"IFCPOLYGONALBOUNDEDHALFSPACE",2924175390:"IFCPOLYLOOP",1423911732:"IFCPOINTONSURFACE",4022376103:"IFCPOINTONCURVE",2067069095:"IFCPOINT",1663979128:"IFCPLANAREXTENT",2004835150:"IFCPLACEMENT",597895409:"IFCPIXELTEXTURE",3021840470:"IFCPHYSICALCOMPLEXQUANTITY",2519244187:"IFCPATH",2529465313:"IFCPARAMETERIZEDPROFILEDEF",1029017970:"IFCORIENTEDEDGE",2665983363:"IFCOPENSHELL",2833995503:"IFCONEDIRECTIONREPEATFACTOR",219451334:"IFCOBJECTDEFINITION",1430189142:"IFCMECHANICALCONCRETEMATERIALPROPERTIES",2022407955:"IFCMATERIALDEFINITIONREPRESENTATION",2347385850:"IFCMAPPEDITEM",1008929658:"IFCLOOP",2624227202:"IFCLOCALPLACEMENT",3422422726:"IFCLIGHTSOURCESPOT",1520743889:"IFCLIGHTSOURCEPOSITIONAL",4266656042:"IFCLIGHTSOURCEGONIOMETRIC",2604431987:"IFCLIGHTSOURCEDIRECTIONAL",125510826:"IFCLIGHTSOURCEAMBIENT",1402838566:"IFCLIGHTSOURCE",3741457305:"IFCIRREGULARTIMESERIES",3905492369:"IFCIMAGETEXTURE",2445078500:"IFCHYGROSCOPICMATERIALPROPERTIES",812098782:"IFCHALFSPACESOLID",178086475:"IFCGRIDPLACEMENT",3590301190:"IFCGEOMETRICSET",4142052618:"IFCGEOMETRICREPRESENTATIONSUBCONTEXT",2453401579:"IFCGEOMETRICREPRESENTATIONITEM",3448662350:"IFCGEOMETRICREPRESENTATIONCONTEXT",1446786286:"IFCGENERALPROFILEPROPERTIES",803998398:"IFCGENERALMATERIALPROPERTIES",3857492461:"IFCFUELPROPERTIES",738692330:"IFCFILLAREASTYLE",4219587988:"IFCFAILURECONNECTIONCONDITION",3008276851:"IFCFACESURFACE",803316827:"IFCFACEOUTERBOUND",1809719519:"IFCFACEBOUND",2556980723:"IFCFACE",1860660968:"IFCEXTENDEDMATERIALPROPERTIES",476780140:"IFCEDGECURVE",3900360178:"IFCEDGE",4170525392:"IFCDRAUGHTINGPREDEFINEDTEXTFONT",3732053477:"IFCDOCUMENTREFERENCE",1694125774:"IFCDIMENSIONPAIR",2273265877:"IFCDIMENSIONCALLOUTRELATIONSHIP",3632507154:"IFCDERIVEDPROFILEDEF",3800577675:"IFCCURVESTYLE",2889183280:"IFCCONVERSIONBASEDUNIT",3050246964:"IFCCONTEXTDEPENDENTUNIT",45288368:"IFCCONNECTIONPOINTECCENTRICITY",1981873012:"IFCCONNECTIONCURVEGEOMETRY",370225590:"IFCCONNECTEDFACESET",1485152156:"IFCCOMPOSITEPROFILEDEF",2542286263:"IFCCOMPLEXPROPERTY",776857604:"IFCCOLOURRGB",647927063:"IFCCLASSIFICATIONREFERENCE",3150382593:"IFCCENTERLINEPROFILEDEF",616511568:"IFCBLOBTEXTURE",2705031697:"IFCARBITRARYPROFILEDEFWITHVOIDS",1310608509:"IFCARBITRARYOPENPROFILEDEF",3798115385:"IFCARBITRARYCLOSEDPROFILEDEF",2297822566:"IFCANNOTATIONTEXTOCCURRENCE",3612888222:"IFCANNOTATIONSYMBOLOCCURRENCE",962685235:"IFCANNOTATIONSURFACEOCCURRENCE",2442683028:"IFCANNOTATIONOCCURRENCE",1065908215:"IFCWATERPROPERTIES",891718957:"IFCVIRTUALGRIDINTERSECTION",1907098498:"IFCVERTEXPOINT",3304826586:"IFCVERTEXBASEDTEXTUREMAP",2799835756:"IFCVERTEX",180925521:"IFCUNITASSIGNMENT",1735638870:"IFCTOPOLOGYREPRESENTATION",1377556343:"IFCTOPOLOGICALREPRESENTATIONITEM",581633288:"IFCTIMESERIESVALUE",1718945513:"IFCTIMESERIESREFERENCERELATIONSHIP",3101149627:"IFCTIMESERIES",3317419933:"IFCTHERMALMATERIALPROPERTIES",1210645708:"IFCTEXTUREVERTEX",2552916305:"IFCTEXTUREMAP",1742049831:"IFCTEXTURECOORDINATEGENERATOR",280115917:"IFCTEXTURECOORDINATE",1484833681:"IFCTEXTSTYLEWITHBOXCHARACTERISTICS",1640371178:"IFCTEXTSTYLETEXTMODEL",2636378356:"IFCTEXTSTYLEFORDEFINEDFONT",1983826977:"IFCTEXTSTYLEFONTMODEL",1447204868:"IFCTEXTSTYLE",912023232:"IFCTELECOMADDRESS",531007025:"IFCTABLEROW",985171141:"IFCTABLE",1290481447:"IFCSYMBOLSTYLE",626085974:"IFCSURFACETEXTURE",1351298697:"IFCSURFACESTYLEWITHTEXTURES",846575682:"IFCSURFACESTYLESHADING",1607154358:"IFCSURFACESTYLEREFRACTION",3303107099:"IFCSURFACESTYLELIGHTING",1300840506:"IFCSURFACESTYLE",3049322572:"IFCSTYLEDREPRESENTATION",3958052878:"IFCSTYLEDITEM",2830218821:"IFCSTYLEMODEL",3408363356:"IFCSTRUCTURALLOADTEMPERATURE",2525727697:"IFCSTRUCTURALLOADSTATIC",2162789131:"IFCSTRUCTURALLOAD",2273995522:"IFCSTRUCTURALCONNECTIONCONDITION",3692461612:"IFCSIMPLEPROPERTY",4240577450:"IFCSHAPEREPRESENTATION",3982875396:"IFCSHAPEMODEL",867548509:"IFCSHAPEASPECT",4165799628:"IFCSECTIONREINFORCEMENTPROPERTIES",2042790032:"IFCSECTIONPROPERTIES",448429030:"IFCSIUNIT",2341007311:"IFCROOT",3679540991:"IFCRIBPLATEPROFILEPROPERTIES",1660063152:"IFCREPRESENTATIONMAP",3008791417:"IFCREPRESENTATIONITEM",3377609919:"IFCREPRESENTATIONCONTEXT",1076942058:"IFCREPRESENTATION",1222501353:"IFCRELAXATION",1580146022:"IFCREINFORCEMENTBARPROPERTIES",2692823254:"IFCREFERENCESVALUEDOCUMENT",825690147:"IFCQUANTITYWEIGHT",2405470396:"IFCQUANTITYVOLUME",3252649465:"IFCQUANTITYTIME",931644368:"IFCQUANTITYLENGTH",2093928680:"IFCQUANTITYCOUNT",2044713172:"IFCQUANTITYAREA",3710013099:"IFCPROPERTYENUMERATION",148025276:"IFCPROPERTYDEPENDENCYRELATIONSHIP",3896028662:"IFCPROPERTYCONSTRAINTRELATIONSHIP",2598011224:"IFCPROPERTY",2802850158:"IFCPROFILEPROPERTIES",3958567839:"IFCPROFILEDEF",2267347899:"IFCPRODUCTSOFCOMBUSTIONPROPERTIES",2095639259:"IFCPRODUCTREPRESENTATION",2417041796:"IFCPRESENTATIONSTYLEASSIGNMENT",3119450353:"IFCPRESENTATIONSTYLE",1304840413:"IFCPRESENTATIONLAYERWITHSTYLE",2022622350:"IFCPRESENTATIONLAYERASSIGNMENT",1775413392:"IFCPREDEFINEDTEXTFONT",3213052703:"IFCPREDEFINEDTERMINATORSYMBOL",990879717:"IFCPREDEFINEDSYMBOL",3727388367:"IFCPREDEFINEDITEM",3355820592:"IFCPOSTALADDRESS",2226359599:"IFCPHYSICALSIMPLEQUANTITY",2483315170:"IFCPHYSICALQUANTITY",101040310:"IFCPERSONANDORGANIZATION",2077209135:"IFCPERSON",1207048766:"IFCOWNERHISTORY",1411181986:"IFCORGANIZATIONRELATIONSHIP",4251960020:"IFCORGANIZATION",1227763645:"IFCOPTICALMATERIALPROPERTIES",2251480897:"IFCOBJECTIVE",3701648758:"IFCOBJECTPLACEMENT",1918398963:"IFCNAMEDUNIT",2706619895:"IFCMONETARYUNIT",3368373690:"IFCMETRIC",677618848:"IFCMECHANICALSTEELMATERIALPROPERTIES",4256014907:"IFCMECHANICALMATERIALPROPERTIES",2597039031:"IFCMEASUREWITHUNIT",3265635763:"IFCMATERIALPROPERTIES",2199411900:"IFCMATERIALLIST",1303795690:"IFCMATERIALLAYERSETUSAGE",3303938423:"IFCMATERIALLAYERSET",248100487:"IFCMATERIALLAYER",1847130766:"IFCMATERIALCLASSIFICATIONRELATIONSHIP",1838606355:"IFCMATERIAL",30780891:"IFCLOCALTIME",1566485204:"IFCLIGHTINTENSITYDISTRIBUTION",4162380809:"IFCLIGHTDISTRIBUTIONDATA",3452421091:"IFCLIBRARYREFERENCE",2655187982:"IFCLIBRARYINFORMATION",3020489413:"IFCIRREGULARTIMESERIESVALUE",852622518:"IFCGRIDAXIS",3548104201:"IFCEXTERNALLYDEFINEDTEXTFONT",3207319532:"IFCEXTERNALLYDEFINEDSYMBOL",1040185647:"IFCEXTERNALLYDEFINEDSURFACESTYLE",2242383968:"IFCEXTERNALLYDEFINEDHATCHSTYLE",3200245327:"IFCEXTERNALREFERENCE",1648886627:"IFCENVIRONMENTALIMPACTVALUE",3796139169:"IFCDRAUGHTINGCALLOUTRELATIONSHIP",770865208:"IFCDOCUMENTINFORMATIONRELATIONSHIP",1154170062:"IFCDOCUMENTINFORMATION",1376555844:"IFCDOCUMENTELECTRONICFORMAT",2949456006:"IFCDIMENSIONALEXPONENTS",1045800335:"IFCDERIVEDUNITELEMENT",1765591967:"IFCDERIVEDUNIT",1072939445:"IFCDATEANDTIME",3510044353:"IFCCURVESTYLEFONTPATTERN",2367409068:"IFCCURVESTYLEFONTANDSCALING",1105321065:"IFCCURVESTYLEFONT",539742890:"IFCCURRENCYRELATIONSHIP",602808272:"IFCCOSTVALUE",1065062679:"IFCCOORDINATEDUNIVERSALTIMEOFFSET",347226245:"IFCCONSTRAINTRELATIONSHIP",613356794:"IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP",1658513725:"IFCCONSTRAINTAGGREGATIONRELATIONSHIP",1959218052:"IFCCONSTRAINT",2732653382:"IFCCONNECTIONSURFACEGEOMETRY",4257277454:"IFCCONNECTIONPORTGEOMETRY",2614616156:"IFCCONNECTIONPOINTGEOMETRY",2859738748:"IFCCONNECTIONGEOMETRY",3264961684:"IFCCOLOURSPECIFICATION",3639012971:"IFCCLASSIFICATIONNOTATIONFACET",938368621:"IFCCLASSIFICATIONNOTATION",1098599126:"IFCCLASSIFICATIONITEMRELATIONSHIP",1767535486:"IFCCLASSIFICATIONITEM",747523909:"IFCCLASSIFICATION",622194075:"IFCCALENDARDATE",2069777674:"IFCBOUNDARYNODECONDITIONWARPING",1387855156:"IFCBOUNDARYNODECONDITION",3367102660:"IFCBOUNDARYFACECONDITION",1560379544:"IFCBOUNDARYEDGECONDITION",4037036970:"IFCBOUNDARYCONDITION",3869604511:"IFCAPPROVALRELATIONSHIP",390851274:"IFCAPPROVALPROPERTYRELATIONSHIP",2080292479:"IFCAPPROVALACTORRELATIONSHIP",130549933:"IFCAPPROVAL",1110488051:"IFCAPPLIEDVALUERELATIONSHIP",411424972:"IFCAPPLIEDVALUE",639542469:"IFCAPPLICATION",618182010:"IFCADDRESS",3630933823:"IFCACTORROLE",599546466:"FILE_DESCRIPTION",1390159747:"FILE_NAME",1109904537:"FILE_SCHEMA"};let Dn=class am{static async getUnits(e){var t;const{IFCUNITASSIGNMENT:i}=ii,n=await e.getAllPropertiesOfType(i);if(!n)return 1;const r=Object.keys(n),o=n[parseInt(r[0],10)];for(const a of o.Units){if(a.value===void 0||a.value===null)continue;const l=await e.getProperties(a.value);if(!l||!l.UnitType||!l.UnitType.value||l.UnitType.value!=="LENGTHUNIT")continue;let h=1,d=1;return l.Name.value==="METRE"&&(d=1),l.Name.value==="FOOT"&&(d=.3048),((t=l.Prefix)==null?void 0:t.value)==="MILLI"&&(h=.001),d*h}return 1}static async findItemByGuid(e,t){var i;const n=e.getAllPropertiesIDs();for(const r of n){const o=await e.getProperties(r);if(o&&((i=o.GlobalId)==null?void 0:i.value)===t)return o}return null}static async getRelationMap(e,t,i){var n;const r=i??(async()=>{}),o={},a=e.getAllPropertiesIDs();for(const l of a){const h=await e.getProperties(l);if(!h)continue;const d=h.type===t,p=Object.keys(h).find(w=>w.startsWith("Relating")),f=Object.keys(h).find(w=>w.startsWith("Related"));if(!(d&&p&&f))continue;const g=await e.getProperties((n=h[p])==null?void 0:n.value),v=h[f];if(!g||!v||!(v&&Array.isArray(v)))continue;const b=v.map(w=>w.value);await r(g.expressID,b),o[g.expressID]=b}return o}static async getQsetQuantities(e,t,i){const n=i??(()=>{}),r=await e.getProperties(t);return!r||r.type!==Jh?null:(r.Quantities??[{}]).map(o=>(o.value&&n(o.value),o.value)).filter(o=>o!==null)}static async getPsetProps(e,t,i){const n=i??(()=>{}),r=await e.getProperties(t);return!r||r.type!==zr?null:(r.HasProperties??[{}]).map(o=>(o.value&&n(o.value),o.value)).filter(o=>o!==null)}static async getPsetRel(e,t){var i;if(!await e.getProperties(t))return null;const n=await e.getAllPropertiesOfType(cl);if(!n)return null;const r=Object.values(n);let o=null;for(const a of r)((i=a.RelatingPropertyDefinition)==null?void 0:i.value)===t&&(o=a.expressID);return o}static async getQsetRel(e,t){return am.getPsetRel(e,t)}static async getEntityName(e,t){var i;const n=await e.getProperties(t);if(!n)return{key:null,name:null};const r=Object.keys(n).find(a=>a.endsWith("Name"))??null,o=r?(i=n[r])==null?void 0:i.value:null;return{key:r,name:o}}static async getQuantityValue(e,t){const i=await e.getProperties(t);if(!i)return{key:null,value:null};const n=Object.keys(i).find(o=>o.endsWith("Value"))??null;let r;return n===null||i[n]===void 0||i[n]===null?r=null:r=i[n].value,{key:n,value:r}}static isRel(e){return om[e].startsWith("IFCREL")}static async attributeExists(e,t,i){const n=await e.getProperties(t);return n?Object.keys(n).includes(i):!1}static async groupEntitiesByType(e,t){var i;const n=new Map;for(const r of t){const o=await e.getProperties(r);if(!o)continue;const a=o.type;n.get(a)||n.set(a,new Set),(i=n.get(a))==null||i.add(r)}return n}};const rE=new Map([[jh,{forRelating:"IsDecomposedBy",forRelated:"Decomposes"}],[Wh,{forRelating:"AssociatedTo",forRelated:"HasAssociations"}],[Xh,{forRelating:"ClassificationForObjects",forRelated:"HasAssociations"}],[Kh,{forRelating:"IsGroupedBy",forRelated:"HasAssignments"}],[cl,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[Qh,{forRelated:"IsTypedBy",forRelating:"Types"}],[bf,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[hl,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}]]),lm=class dh extends Re{constructor(e){super(e),A(this,"onDisposed",new $),A(this,"enabled",!0),A(this,"onRelationsIndexed",new $),A(this,"_relToAttributesMap",rE),A(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements"]),A(this,"_ifcRels",[jh,Wh,Xh,Kh,cl,Qh,bf,hl]),A(this,"relationMaps",{}),A(this,"onFragmentsDisposed",t=>{delete this.relationMaps[t.groupID]}),this.components.add(dh.uuid,this),e.get(rt).onFragmentsDisposed.add(this.onFragmentsDisposed)}setRelationMap(e,t){this.relationMaps[e.uuid]=t,this.onRelationsIndexed.trigger({modelID:e.uuid,relationsMap:t})}async process(e){if(!e.hasProperties)throw new Error("FragmentsGroup properties not found");let t=this.relationMaps[e.uuid];if(t)return t;t=new Map;for(const i of this._ifcRels)await Dn.getRelationMap(e,i,async(n,r)=>{const o=this._relToAttributesMap.get(i);if(!o)return;const{forRelated:a,forRelating:l}=o,h=t.get(n)??new Map,d=this._inverseAttributes.indexOf(l);h.set(d,r),t.set(n,h);for(const p of r){const f=t.get(p)??new Map,g=this._inverseAttributes.indexOf(a),v=f.get(g)??[];v.push(n),f.set(g,v),t.set(p,f)}});return this.setRelationMap(e,t),t}async processFromWebIfc(e,t){const i=new Map;for(const n of this._ifcRels){const r=this._relToAttributesMap.get(n);if(!r)continue;const{forRelated:o,forRelating:a}=r,l=e.GetLineIDsWithType(t,n);for(let h=0;hT.startsWith("Relating")),f=Object.keys(d).find(T=>T.startsWith("Related"));if(!(p&&f))continue;const g=d[p].value,v=d[f].map(T=>T.value),b=i.get(g)??new Map,w=this._inverseAttributes.indexOf(a);b.set(w,v),i.set(g,b);for(const T of v){const S=i.get(T)??new Map,_=this._inverseAttributes.indexOf(o),I=S.get(_)??[];I.push(g),S.set(_,I),i.set(T,S)}}}return this.onRelationsIndexed.trigger({modelID:t.toString(),relationsMap:i}),i}getEntityRelations(e,t,i){const n=this.relationMaps[e.uuid];if(!n)return null;const r=n.get(t),o=this._inverseAttributes.indexOf(i);return!r||o===-1?null:r.get(o)||null}serializeRelations(e){const t={};for(const[i,n]of e.entries()){t[i]||(t[i]={});for(const[r,o]of n.entries())t[i][r]=o}return JSON.stringify(t)}serializeModelRelations(e){const t=this.relationMaps[e.uuid];return t?this.serializeRelations(t):null}serializeAllRelations(){const e={};for(const t in this.relationMaps){const i=this.relationMaps[t],n={};for(const[r,o]of i.entries()){n[r]||(n[r]={});for(const[a,l]of o.entries())n[r][a]=l}e[t]=n}return JSON.stringify(e)}getRelationsMapFromJSON(e){const t=JSON.parse(e),i=new Map;for(const n in t){const r=t[n],o=new Map;for(const a in r)o.set(Number(a),r[a]);i.set(Number(n),o)}return i}dispose(){this.relationMaps={},this.components.get(rt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(dh.uuid),this.onDisposed.reset()}};A(lm,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let gl=lm;class oE{constructor(){A(this,"factor",1),A(this,"complement",1)}apply(e){const t=this.getScaleMatrix().multiply(e);e.copy(t)}setUp(e){var t;this.factor=1;const i=this.getLengthUnits(e);if(!i)return;const n=i==null,r=i.Name===void 0||i.Name===null;n||r||(i.Name.value==="FOOT"?this.factor=.3048:((t=i.Prefix)==null?void 0:t.value)==="MILLI"&&(this.complement=.001))}getLengthUnits(e){try{const t=e.GetLineIDsWithType(0,Dv).get(0),i=e.GetLine(0,t);for(const n of i.Units){if(!n||n.value===null||n.value===void 0)continue;const r=e.GetLine(0,n.value);if(r.UnitType&&r.UnitType.value==="LENGTHUNIT")return r}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const e=this.factor;return new Ee().fromArray([e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1])}}let cm=class{constructor(){A(this,"itemsByFloor",{}),A(this,"_units",new oE)}setUp(e){this._units.setUp(e),this.cleanUp();try{const t=e.GetLineIDsWithType(0,hl),i=new Set,n=e.GetLineIDsWithType(0,Wn);for(let h=0;h{this.getMesh(a,t)});for(const a of this._visitedFragments){const{index:l,fragment:h}=a[1];t.keyFragments.set(l,h.id)}for(const a of t.items){const l=this._fragmentInstances.get(a.id);if(!l)throw new Error("Fragment not found!");const h=[];for(const[d,p]of l)h.push(p);a.add(h)}const o=this.webIfc.GetCoordinationMatrix(0);return t.coordinationMatrix.fromArray(o),t.civilData=this._civil.read(this.webIfc),t}cleanUp(){this.webIfc=null,this.webIfc=new tn,this._visitedFragments.clear(),this._fragmentInstances.clear()}getMesh(e,t){const i=e.geometries.size(),n=e.expressID;for(let r=0;rparseInt(o,10)),n=t[i[0]],r=new Qo(n.expressID);return{ownerHistory:n,ownerHistoryHandle:r}}registerChange(e,...t){this.changeMap[e.uuid]||(this.changeMap[e.uuid]=new Set);for(const i of t)this.changeMap[e.uuid].add(i),this.onDataChanged.trigger({model:e,expressID:i})}async setData(e,...t){for(const i of t){const n=i.expressID;n&&(await e.setProperties(n,i),this.registerChange(e,n))}}async newPset(e,t,i){const n=ws.getIFCSchema(e),{ownerHistoryHandle:r}=await this.getOwnerHistory(e),o=this.newGUID(e),a=new ii[n].IfcLabel(t),l=i?new ii[n].IfcText(i):null,h=new ii[n].IfcPropertySet(o,r,a,l,[]);h.expressID=this.increaseMaxID(e);const d=this.newGUID(e),p=new ii[n].IfcRelDefinesByProperties(d,r,null,null,[],new Qo(h.expressID));return p.expressID=this.increaseMaxID(e),await this.setData(e,h,p),{pset:h,rel:p}}async removePset(e,...t){for(const i of t){const n=await e.getProperties(i);if((n==null?void 0:n.type)!==zr)continue;const r=await Dn.getPsetRel(e,i);if(r&&(await e.setProperties(r,null),this.registerChange(e,r)),n){for(const o of n.HasProperties)await e.setProperties(o.value,null);await e.setProperties(i,null),this.onPsetRemoved.trigger({model:e,psetID:i}),this.registerChange(e,i)}}}async newSingleProperty(e,t,i,n){const r=ws.getIFCSchema(e),o=new ii[r].IfcIdentifier(i),a=new ii[r][t](n),l=new ii[r].IfcPropertySingleValue(o,null,a,null);return l.expressID=this.increaseMaxID(e),await this.setData(e,l),l}newSingleStringProperty(e,t,i,n){return this.newSingleProperty(e,t,i,n)}newSingleNumericProperty(e,t,i,n){return this.newSingleProperty(e,t,i,n)}newSingleBooleanProperty(e,t,i,n){return this.newSingleProperty(e,t,i,n)}async removePsetProp(e,t,i){const n=await e.getProperties(t),r=await e.getProperties(i);!n||!r||n.type===zr&&r&&(n.HasProperties=n.HasProperties.filter(o=>o.value!==i),await e.setProperties(i,null),this.registerChange(e,t,i))}async addElementToPset(e,t,...i){const n=await Dn.getPsetRel(e,t);if(!n)return;const r=await e.getProperties(n);if(r){for(const o of i){const a=new Qo(o);r.RelatedObjects.push(a),this.onElementToPset.trigger({model:e,psetID:t,elementID:o})}this.registerChange(e,t)}}async addPropToPset(e,t,...i){const n=await e.getProperties(t);if(n){for(const r of i){if(n.HasProperties.includes(r))continue;const o=new Qo(r);n.HasProperties.push(o),this.onPropToPset.trigger({model:e,psetID:t,propID:r})}this.registerChange(e,t)}}async saveToIfc(e,t){const i=this.components.get(aE),n=i.webIfc,r=await i.readIfcFile(t),o=this.changeMap[e.uuid]??[];for(const l of o){const h=await e.getProperties(l);if(h)try{n.WriteLine(r,h)}catch{}else try{n.DeleteLine(r,l)}catch{}}const a=n.SaveModel(r);return i.webIfc.CloseModel(r),i.cleanUp(),a}async setAttributeListener(e,t,i){this.attributeListeners[e.uuid]||(this.attributeListeners[e.uuid]={});const n=this.attributeListeners[e.uuid][t]?this.attributeListeners[e.uuid][t][i]:null;if(n)return n;const r=await e.getProperties(t);if(!r)throw new Error(`Entity with expressID ${t} doesn't exists.`);const o=r[i];if(Array.isArray(o)||!o)throw new Error(`Attribute ${i} is array or null, and it can't have a listener.`);const a=o.value;if(a===void 0||a==null)throw new Error(`Attribute ${i} has a badly defined handle.`);const l=new $;return Object.defineProperty(r[i],"value",{get(){return this._value},async set(h){this._value=h,l.trigger(h)}}),r[i].value=a,this.attributeListeners[e.uuid][t]||(this.attributeListeners[e.uuid][t]={}),this.attributeListeners[e.uuid][t][i]=l,l}};A(lE,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");const pm=class fm extends Re{constructor(e){super(e),A(this,"enabled",!0),A(this,"list",{}),A(this,"onDisposed",new $),A(this,"onFragmentsDisposed",t=>{const{groupID:i,fragmentIDs:n}=t;for(const r in this.list){const o=this.list[r],a=Object.keys(o);if(a.includes(i))delete o[i],Object.values(o).length===0&&delete this.list[r];else for(const l of a){const h=o[l];for(const d of n)delete h[d];Object.values(h).length===0&&delete o[l]}}}),e.add(fm.uuid,this),e.get(rt).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(rt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(e){for(const t in this.list){const i=this.list[t];for(const n in i){const r=i[n];delete r[e]}}}find(e){const t=this.components.get(rt);if(!e){const o={};for(const[a,l]of t.list)o[a]=new Set(l.ids);return o}const i=Object.keys(e).length,n={};for(const o in e){const a=e[o];if(!this.list[o]){console.warn(`Classification ${o} does not exist.`);continue}for(const l of a){const h=this.list[o][l];if(h)for(const d in h){n[d]||(n[d]=new Map);for(const p of h[d]){const f=n[d].get(p);f===void 0?n[d].set(p,1):n[d].set(p,f+1)}}}}const r={};for(const o in n){const a=n[o];for(const[l,h]of a){if(h===void 0)throw new Error("Malformed fragments map!");h===i&&(r[o]||(r[o]=new Set),r[o].add(l))}}return r}byModel(e,t){this.list.models||(this.list.models={});const i=this.list.models;i[e]||(i[e]={});const n=i[e];for(const[r,o]of t.data){const a=o[0];for(const l of a){const h=t.keyFragments.get(l);h&&(n[h]||(n[h]=new Set),n[h].add(r))}}}async byPredefinedType(e){var t;this.list.predefinedTypes||(this.list.predefinedTypes={});const i=this.list.predefinedTypes,n=e.getAllPropertiesIDs();for(const r of n){const o=await e.getProperties(r);if(!o)continue;const a=String((t=o.PredefinedType)==null?void 0:t.value).toUpperCase();i[a]||(i[a]={});const l=i[a];for(const[h,d]of e.data){const p=d[0];for(const f of p){const g=e.keyFragments.get(f);if(!g)throw new Error("Fragment ID not found!");l[g]||(l[g]=new Set),l[g].add(o.expressID)}}}}byEntity(e){this.list.entities||(this.list.entities={});for(const[t,i]of e.data){const n=i[1][1],r=om[n];this.saveItem(e,"entities",r,t)}}async byIfcRel(e,t,i){Dn.isRel(t)&&await Dn.getRelationMap(e,t,async(n,r)=>{const{name:o}=await Dn.getEntityName(e,n);for(const a of r)this.saveItem(e,i,o??"NO REL NAME",a)})}async bySpatialStructure(e){var t;const i=this.components.get(gl),n=i.relationMaps[e.uuid];if(!n)throw new Error(`Classifier: model relations of ${e.name||e.uuid} have to exists to group by spatial structure.`);const r="spatialStructures";for(const[o]of n){const a=i.getEntityRelations(e,o,"ContainsElements"),l=await e.getProperties(o);if(!(a&&l))continue;const h=(t=l.Name)==null?void 0:t.value;for(const d of a){this.saveItem(e,r,h,d);const p=i.getEntityRelations(e,Number(d),"IsDecomposedBy");if(p)for(const f of p)this.saveItem(e,r,h,f)}}}setColor(e,t,i=!1){const n=this.components.get(rt);for(const r in e){const o=n.list.get(r);if(!o)continue;const a=e[r];o.setColor(t,a,i)}}resetColor(e){const t=this.components.get(rt);for(const i in e){const n=t.list.get(i);if(!n)continue;const r=e[i];n.resetColor(r)}}saveItem(e,t,i,n){this.list[t]||(this.list[t]={});const r=e.data.get(n);if(r)for(const o of r[0]){const a=e.keyFragments.get(o);if(a){const l=this.list[t];l[i]||(l[i]={}),l[i][a]||(l[i][a]=new Set),l[i][a].add(n)}}}};A(pm,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let cE=pm;const hE=class mm extends Re{constructor(e){super(e),A(this,"enabled",!0),A(this,"height",10),A(this,"groupName","storeys"),A(this,"onDisposed",new $),A(this,"list",new Set),e.add(mm.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(e){if(!this.enabled)return;const t=this.components.get(cE),i=this.components.get(rt),n=e?1:-1;let r=0;const o=t.list[this.groupName],a=new Ee;for(const l in o){a.elements[13]=r*n*this.height;for(const h in o[l]){const d=i.list.get(h),p=l+h,f=this.list.has(p);if(!d||e&&f||!e&&!f)continue;e?this.list.add(p):this.list.delete(p);const g=o[l][h];d.applyTransform(g,a)}r++}}};A(hE,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");const uE=class gm extends Re{constructor(e){super(e),A(this,"enabled",!0),this.components.add(gm.uuid,this)}set(e,t){const i=this.components.get(rt);if(!t){for(const n in i.list){const r=i.list.get(n);r&&(r.setVisibility(e),this.updateCulledVisibility(r))}return}for(const n in t){const r=t[n],o=i.list.get(n);o&&(o.setVisibility(e,r),this.updateCulledVisibility(o))}}isolate(e){this.set(!1),this.set(!0,e)}updateCulledVisibility(e){const t=this.components.get(Z1);for(const[i,n]of t.list){const r=n.colorMeshes.get(e.id);r&&(r.count=e.mesh.count)}}};A(uE,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");class dE extends ru{constructor(){super(...arguments),A(this,"minGeometrySize",10),A(this,"minAssetsSize",1e3)}}let vm=class extends ru{constructor(){super(...arguments),A(this,"propertiesSize",100)}};class pE extends Re{constructor(){super(...arguments),A(this,"onPropertiesStreamed",new $i),A(this,"onProgress",new $i),A(this,"onIndicesStreamed",new $i),A(this,"onDisposed",new $),A(this,"enabled",!0),A(this,"settings",new vm),A(this,"webIfc",new tn)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(e){const t=performance.now();await this.readIfcFile(e),await this.streamAllProperties(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-t} ms!`)}async streamFromCallBack(e){const t=performance.now();await this.streamIfcFile(e),await this.streamAllProperties(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-t} ms!`)}async readIfcFile(e){const{path:t,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(e,this.settings.webIfc)}async streamIfcFile(e){const{path:t,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:e}=this.settings,t=new Set(this.webIfc.GetIfcEntityList(0)),i=[cl,Qh,Wh,hl,Xh,Kh],n=new Map,r=new Set([pl,Zh,qh,dl,Wn]);for(const h of r)t.add(h);let o=.01,a=0;for(const h of t){if(a++,su.has(h))continue;const d=r.has(h),p=this.webIfc.GetLineIDsWithType(0,h),f=p.size();let g=0;for(let b=0;bo&&(o+=.01,o=Math.max(o,v),await this.onProgress.trigger(Math.round(o*100)/100))}const l=[];for(const[h,d]of n)l.push([h,...d]);await this.onIndicesStreamed.trigger(l)}getIndices(e,t,i){const n=e.RelatedObjects||e.RelatedElements;if(!n){console.log(`Related objects not found: ${t}`);return}const r=e.RelatingType||e.RelatingMaterial||e.RelatingStructure||e.RelatingPropertyDefinition||e.RelatingGroup||e.RelatingClassification;if(!r){console.log(`Relating object not found: ${t}`);return}if(!Array.isArray(n)||r.value===void 0)return;const o=r.value;for(const a of n){if(a.value===void 0||a.value===null)continue;const l=a.value;i.has(l)||i.set(l,new Set),i.get(l).add(o)}}cleanUp(){this.webIfc=null,this.webIfc=new tn}}A(pE,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");const fE=class ym extends Re{constructor(e){super(e),A(this,"onGeometryStreamed",new $),A(this,"onAssetStreamed",new $),A(this,"onProgress",new $),A(this,"onIfcLoaded",new $),A(this,"onDisposed",new $),A(this,"settings",new dE),A(this,"enabled",!0),A(this,"webIfc",new tn),A(this,"_spatialTree",new cm),A(this,"_metaData",new um),A(this,"_visitedGeometries",new Map),A(this,"_streamSerializer",new Cf),A(this,"_geometries",new Map),A(this,"_geometryCount",0),A(this,"_civil",new hm),A(this,"_groupSerializer",new Ef),A(this,"_assets",[]),A(this,"_meshesWithHoles",new Set),this.components.add(ym.uuid,this),this.settings.excludedCategories.add(wf)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(e){const t=performance.now();await this.readIfcFile(e),await this.streamAllGeometries(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-t} ms!`)}async streamFromCallBack(e){const t=performance.now();await this.streamIfcFile(e),await this.streamAllGeometries(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-t} ms!`)}async readIfcFile(e){const{path:t,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(e,this.settings.webIfc)}async streamIfcFile(e){const{path:t,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:e,minAssetsSize:t}=this.settings;this._spatialTree.setUp(this.webIfc);const i=this.webIfc.GetIfcEntityList(0),n=[[]],r=new If,{FILE_NAME:o,FILE_DESCRIPTION:a}=ii;r.ifcMetadata={name:this._metaData.get(this.webIfc,o),description:this._metaData.get(this.webIfc,a),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let l=0,h=0;for(const T of i){if(!this.webIfc.IsIfcElement(T)&&T!==Wn||this.settings.excludedCategories.has(T))continue;const S=this.webIfc.GetLineIDsWithType(0,T),_=S.size();console.log(_);for(let I=0;I<_;I++){l>e&&(l=0,h++,n.push([]));const P=S.get(I);n[h].push(P);const M=this._spatialTree.itemsByFloor[P]||0;r.data.set(P,[[],[M,T]]),l++}}this._spatialTree.cleanUp();let d=.01,p=0;for(const T of n){p++,this.webIfc.StreamMeshes(0,T,_=>{this.getMesh(this.webIfc,_,r)}),this._geometryCount>e&&await this.streamGeometries(),this._assets.length>t&&await this.streamAssets();const S=p/n.length;S>d&&(d+=.01,d=Math.max(d,S),this.onProgress.trigger(Math.round(d*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:f,transparent:g}=r.geometryIDs;for(const[T,{index:S,uuid:_}]of this._visitedGeometries)r.keyFragments.set(S,_),(T>1?f:g).set(T,S);const v=r.data.keys();for(const T of v){const[S]=r.data.get(T);S.length||r.data.delete(T)}const b=this.webIfc.GetCoordinationMatrix(0);r.coordinationMatrix.fromArray(b),r.civilData=this._civil.read(this.webIfc);const w=this._groupSerializer.export(r);this.onIfcLoaded.trigger(w),r.dispose(!0)}cleanUp(){this.webIfc=null,this.webIfc=new tn,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(e,t,i){const n=t.geometries.size(),r=t.expressID,o={id:r,geometries:[]};for(let a=0;an&&(n+=.01,n=Math.max(n,f),await this.onProgress.trigger(Math.round(n*100)/100))}const o=await this.components.get(gl).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(o)}cleanUp(){this.webIfc=null,this.webIfc=new tn}}A(mE,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");const Em=class bm extends Re{constructor(e){super(e),A(this,"enabled",!0),e.add(bm.uuid,this)}getFace(e,t,i){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const n=new Map,r=e.geometry.index.array,{plane:o}=this.getFaceData(t,i,e),a=[];for(let p=0;pI.id);if(!g.size){const I=l++;for(const{id:P}of f)h.set(P,I);d.set(I,{edges:new Set(v),indices:new Set([p])});continue}let b=null;const w=new Set,T=new Set(v);for(const[I,P]of g){b===null?b=P:P!==b&&w.add(P),h.delete(I);const{edges:M}=d.get(P);M.delete(I),T.delete(I)}if(b===null)throw new Error("Error computing face!");const S=d.get(b),{indices:_}=S;_.add(p);for(const I of T){h.set(I,b);const{edges:P}=S;P.add(I)}for(const I of w){const P=d.get(I),{edges:M,indices:k}=P,V=d.get(b),{edges:W,indices:j}=V;for(const Q of M)W.add(Q),h.set(Q,b);for(const Q of k)j.add(Q);d.delete(I)}}for(const[p,{indices:f,edges:g}]of d)if(f.has(t)){const v=[];for(const b of g){const w=n.get(b);v.push(w)}return{edges:v,indices:f}}return null}static distanceFromPointToLine(e,t,i,n=!1){const r=new Dt,o=new O;return r.set(t,i),r.closestPointToPoint(e,n,o),o.distanceTo(e)}getFaceData(e,t,i){const n=this.getVerticesAndNormal(i,e,t),{p1:r,p2:o,p3:a,faceNormal:l}=n;this.round(r),this.round(o),this.round(a),this.round(l);const h=[{id:`${r.x}|${r.y}|${r.z}`,value:r},{id:`${o.x}|${o.y}|${o.z}`,value:o},{id:`${a.x}|${a.y}|${a.z}`,value:a}];h.sort((S,_)=>S.id<_.id?-1:S.id>_.id?1:0);const[{id:d,value:p},{id:f,value:g},{id:v,value:b}]=h,w=[{id:`${d}|${f}`,distance:p.distanceTo(g),points:[p,g]},{id:`${f}|${v}`,distance:g.distanceTo(b),points:[g,b]},{id:`${d}|${v}`,distance:p.distanceTo(b),points:[p,b]}],T=new an;return T.setFromNormalAndCoplanarPoint(l,r),T.constant=Math.round(T.constant*10)/10,{plane:T,edges:w}}getVerticesAndNormal(e,t,i){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const n=e.geometry.index.array,r=e.geometry.attributes.position.array,o=e.geometry.attributes.normal.array,a=n[t*3]*3,l=n[t*3+1]*3,h=n[t*3+2]*3,d=new O(r[a],r[a+1],r[a+2]),p=new O(r[l],r[l+1],r[l+2]),f=new O(r[h],r[h+1],r[h+2]),g=new O(o[a],o[a+1],o[a+2]),v=new O(o[l],o[l+1],o[l+2]),b=new O(o[h],o[h+1],o[h+2]),w=(g.x+v.x+b.x)/3,T=(g.y+v.y+b.y)/3,S=(g.z+v.z+b.z)/3,_=new O(w,T,S);if(i!==void 0&&e instanceof Kt){const I=new Ee;e.getMatrixAt(i,I);const P=new Ee;P.extractRotation(I),_.applyMatrix4(P),d.applyMatrix4(I),p.applyMatrix4(I),f.applyMatrix4(I)}return{p1:d,p2:p,p3:f,faceNormal:_}}round(e){e.x=Math.trunc(e.x*1e3)/1e3,e.y=Math.trunc(e.y*1e3)/1e3,e.z=Math.trunc(e.z*1e3)/1e3}};A(Em,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let ja=Em;const Kd=new Ke,ba=new O;class wm extends Nv{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new Ps(e,3)),this.setAttribute("uv",new Ps(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new Qc(t,6,1);return this.setAttribute("instanceStart",new xs(i,3,0)),this.setAttribute("instanceEnd",new xs(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new Qc(t,6,1);return this.setAttribute("instanceColorStart",new xs(i,3,0)),this.setAttribute("instanceColorEnd",new xs(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Uv(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ke);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Kd.setFromBufferAttribute(t),this.boundingBox.union(Kd))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Gn),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let n=0;for(let r=0,o=e.count;r #include #include @@ -455,7 +455,7 @@ var gv=Object.defineProperty;var vv=(s,e,t)=>e in s?gv(s,e,{enumerable:!0,config #include } - `};let ro=class extends wt{constructor(e){super({type:"LineMaterial",uniforms:Gh.clone(Fa.line.uniforms),vertexShader:Fa.line.vertexShader,fragmentShader:Fa.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1))}};const Qd=new O,Zd=new O,pt=new Vs,ft=new Vs,fi=new Vs,zc=new O,Vc=new Ee,mt=new Dt,qd=new O,wa=new Ke,Ia=new Gn,mi=new Vs;let vi,Nn;function Jd(s,e,t){return mi.set(0,0,-e,1).applyMatrix4(s.projectionMatrix),mi.multiplyScalar(1/mi.w),mi.x=Nn/t.width,mi.y=Nn/t.height,mi.applyMatrix4(s.projectionMatrixInverse),mi.multiplyScalar(1/mi.w),Math.abs(Math.max(mi.x,mi.y))}function gE(s,e){const t=s.matrixWorld,i=s.geometry,n=i.attributes.instanceStart,r=i.attributes.instanceEnd,o=Math.min(i.instanceCount,n.count);for(let a=0,l=o;ad&&ft.z>d)continue;if(pt.z>d){const T=pt.z-ft.z,S=(pt.z-d)/T;pt.lerp(ft,S)}else if(ft.z>d){const T=ft.z-pt.z,S=(ft.z-d)/T;ft.lerp(pt,S)}pt.applyMatrix4(i),ft.applyMatrix4(i),pt.multiplyScalar(1/pt.w),ft.multiplyScalar(1/ft.w),pt.x*=n.x/2,pt.y*=n.y/2,ft.x*=n.x/2,ft.y*=n.y/2,mt.start.copy(pt),mt.start.z=0,mt.end.copy(ft),mt.end.z=0;const g=mt.closestPointToPointParameter(zc,!0);mt.at(g,qd);const v=so.lerp(pt.z,ft.z,g),b=v>=-1&&v<=1,w=zc.distanceTo(qd)t.geometry.attributes.position.count&&(t.geometry.dispose(),t.geometry=new Wa),t.geometry.setPositions(o),n&&t.geometry.setColors(a),i.geometry.setFromPoints(l)}newCurve(e,t,i){const n=new Wa,r=new ro({color:t,linewidth:e,vertexColors:i,worldUnits:!1,depthTest:!1}),o=new Im(n,r);return this.scene.add(o),o}newPoints(e,t){const i=new Ne,n=new gt(new Float32Array,3);i.setAttribute("position",n);const r=new ff({size:e,color:t,sizeAttenuation:!1,depthTest:!1}),o=new mf(i,r);return o.frustumCulled=!1,this.scene.add(o),o}};x(Cm,"settings",{colors:{LINE:[213/255,0/255,255/255],CIRCULARARC:[0/255,46,255/255],CLOTHOID:[0/255,255/255,0/255],PARABOLICARC:[0/255,255/255,72/255],CONSTANTGRADIENT:[213/255,0/255,255/255]}});let xm=Cm;class EE extends kn{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Ve(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&t.element.parentNode!==null&&t.element.parentNode.removeChild(t.element)})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const bs=new O,$d=new Ee,ep=new Ee,tp=new O,ip=new O;class bE{constructor(e={}){const t=this;let i,n,r,o;const a={objects:new WeakMap},l=e.element!==void 0?e.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.getSize=function(){return{width:i,height:n}},this.render=function(g,v){g.matrixWorldAutoUpdate===!0&&g.updateMatrixWorld(),v.parent===null&&v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),$d.copy(v.matrixWorldInverse),ep.multiplyMatrices(v.projectionMatrix,$d),h(g,g,v),f(g)},this.setSize=function(g,v){i=g,n=v,r=i/2,o=n/2,l.style.width=g+"px",l.style.height=v+"px"};function h(g,v,b){if(g.isCSS2DObject){bs.setFromMatrixPosition(g.matrixWorld),bs.applyMatrix4(ep);const w=g.visible===!0&&bs.z>=-1&&bs.z<=1&&g.layers.test(b.layers)===!0;if(g.element.style.display=w===!0?"":"none",w===!0){g.onBeforeRender(t,v,b);const S=g.element;S.style.transform="translate("+-100*g.center.x+"%,"+-100*g.center.y+"%)translate("+(bs.x*r+r)+"px,"+(-bs.y*o+o)+"px)",S.parentNode!==l&&l.appendChild(S),g.onAfterRender(t,v,b)}const T={distanceToCameraSquared:d(b,g)};a.objects.set(g,T)}for(let w=0,T=g.children.length;w{if(this.onBeforeUpdate.trigger(this),!this.enabled||!this.currentWorld)return;const n=this.currentWorld.scene.three,r=this.currentWorld.camera.three;n instanceof Xn&&this.three2D.render(n,r)}),this.onDisposed.add(()=>{this.three2D.domElement.remove()}),this.onResize.add(({x:n,y:r})=>{this.three2D.setSize(n,r)}),this.setupHtmlRenderer(),this.resize()}setupHtmlRenderer(){this.three2D.domElement.style.position="absolute",this.three2D.domElement.style.top="0px",this.three2D.domElement.style.pointerEvents="none",this.container&&this.container.appendChild(this.three2D.domElement)}}const Sm=class _m extends Re{constructor(e){super(e),x(this,"onDisposed",new ee),x(this,"enabled",!0),x(this,"threshold",50),x(this,"autoCluster",!0),x(this,"list",new Map),x(this,"_worldEvents",new Map),x(this,"clusterLabels",new Set),x(this,"currentKeys",new Set),x(this,"_color","white"),x(this,"_markerKey",0),x(this,"_clusterKey",0),x(this,"_setupWorlds",new Set),e.add(_m.uuid,this)}get color(){return this._color}set color(e){this._color=e;for(const[t,i]of this.list)for(const[n,r]of i)r.label.three.element.style.color=e}create(e,t,i,n=!1){this.setupEvents(e,!0);const r=this._markerKey.toString(),o=this.getWorldMarkerList(e);if(o.has(r))return;const a=document.createElement("span");a.innerHTML=t,a.style.color=this._color;const l=new _t(e,a);return l.three.position.copy(i),o.set(r,{key:r,label:l,merged:!1,static:n}),this._markerKey++,r}delete(e){for(const[t,i]of this.list){const n=i.get(e);n&&n.label.dispose(),i.delete(e)}}getWorldMarkerList(e){return this.list.has(e.uuid)||this.list.set(e.uuid,new Map),this.list.get(e.uuid)}dispose(e){for(const[t,i]of this.list){const n=[...i.keys()];for(const r of n){const o=i.get(r);e&&o.type!==e||(o.label.dispose(),i.delete(r))}}if(!e){this.list.clear(),this._markerKey=0;for(const t of this.clusterLabels)t.label.dispose();this.clusterLabels.clear(),this._clusterKey=0,this.currentKeys.clear()}this.onDisposed.trigger()}setupEvents(e,t){if(t&&this._setupWorlds.has(e.uuid)||!e.camera.hasCameraControls())return;const i=this.getWorldEvent(e);e.camera.controls.removeEventListener("sleep",i),e.camera.controls.removeEventListener("rest",i),t&&(e.camera.controls.addEventListener("sleep",i),e.camera.controls.addEventListener("rest",i))}getWorldEvent(e){if(!this._worldEvents.has(e.uuid)){const t=()=>{this.cluster(e)};this._worldEvents.set(e.uuid,t)}return this._worldEvents.get(e.uuid)}resetMarkers(){for(const[e,t]of this.list)for(const[i,n]of t)n.merged=!1;for(const e of this.clusterLabels)e.label.dispose();this.clusterLabels.clear(),this._clusterKey=0}removeMergeMarkers(e){const t=this.list.get(e.uuid);if(t){for(const[i,n]of t)n.merged?n.label.dispose():n.label.world.scene.three.add(n.label.three);for(const i of this.clusterLabels)if(i.markerKeys.length===1){for(const[n,r]of this.list){const o=r.get(i.markerKeys[0]);o&&(o.label.world.scene.three.add(o.label.three),o.merged=!1)}i.label.dispose(),this.clusterLabels.delete(i)}}}cluster(e){if(!this.autoCluster)return;this.resetMarkers();const t=this.list.get(e.uuid);if(t){for(const[i,n]of t)if(!n.merged&&!n.static){this.currentKeys.clear();for(const[r,o]of t)o.static||n.key!==o.key&&!o.merged&&this.distance(n.label,o.label)0){this.currentKeys.add(n.key),n.merged=!0;const r=Array.from(this.currentKeys),o=this.getAveragePositionFromLabels(r),a=new _t(n.label.world,this.createClusterElement(this._clusterKey.toString())),{element:l}=a.three;l.textContent=r.length.toString(),a.three.position.copy(o),this.clusterLabels.add({key:this._clusterKey.toString(),markerKeys:r,label:a}),this._clusterKey++}}this.removeMergeMarkers(e)}}getAveragePositionFromLabels(e){const t=e.map(i=>{for(const[n,r]of this.list){const o=r.get(i);if(o)return o.label.three.position}return new O});return t.reduce((i,n)=>i.add(n),new O).divideScalar(t.length)}createClusterElement(e){const t=document.createElement("div");return t.textContent=e,t.style.color="#000000",t.style.background="#FFFFFF",t.style.fontSize="1.2rem",t.style.fontWeight="500",t.style.pointerEvents="auto",t.style.borderRadius="50%",t.style.padding="5px 11px",t.style.textAlign="center",t.style.cursor="pointer",t.addEventListener("pointerdown",()=>{this.navigateToCluster(e)}),t.addEventListener("pointerover",()=>{t.style.background="#BCF124"}),t.addEventListener("pointerout",()=>{t.style.background="#FFFFFF"}),t}getScreenPosition(e){const t=new O;if(!e.world.renderer)throw new Error("Renderer not found!");const i=e.three.position.clone();i.project(e.world.camera.three);const n=e.world.renderer.getSize();return t.x=i.x*n.x/2+n.x/2,t.y=-(i.y*n.y/2)+n.y/2,t}distance(e,t){const i=this.getScreenPosition(e),n=this.getScreenPosition(t),r=i.x-n.x,o=i.y-n.y,a=Math.sqrt(r*r+o*o)*.5;return a===0?this.threshold+1:a}navigateToCluster(e){const t=[],i=Array.from(this.clusterLabels).find(h=>h.key===e);if(!i)return;const n=i.label.world.camera;if(!n.hasCameraControls()){console.warn("Zoom to clusters only supported with Camera Controls!");return}for(const h of i.markerKeys)for(const[d,p]of this.list){const f=p.get(h);if(f){const{x:g,y:v,z:b}=f.label.three.position;t.push(g,v,b)}}i.label.dispose(),this.clusterLabels.delete(i);const r=new Ne,o=new Float32Array(t),a=new gt(o,3);r.setAttribute("position",a);const l=new le(r);l.geometry.computeBoundingSphere(),l.geometry.boundingSphere&&n.controls.fitToSphere(l,!0),r.dispose(),l.clear(),t.length=0}};x(Sm,"uuid","4079eb91-79b0-4ede-bcf2-15b837129236");let An=Sm;var np=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rm(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ou={exports:{}};ou.exports=vl;ou.exports.default=vl;function vl(s,e,t){t=t||2;var i=e&&e.length,n=i?e[0]*t:s.length,r=Pm(s,0,n,t,!0),o=[];if(!r||r.next===r.prev)return o;var a,l,h,d,p,f,g;if(i&&(r=xE(s,e,r,t)),s.length>80*t){a=h=s[0],l=d=s[1];for(var v=t;vh&&(h=p),f>d&&(d=f);g=Math.max(h-a,d-l),g=g!==0?32767/g:0}return Vr(r,o,t,a,l,g,0),o}function Pm(s,e,t,i,n){var r,o;if(n===gh(s,e,t,i)>0)for(r=e;r=e;r-=i)o=sp(r,s[r],s[r+1],o);return o&&yl(o,o.next)&&(Yr(o),o=o.next),o}function Bn(s,e){if(!s)return s;e||(e=s);var t=s,i;do if(i=!1,!t.steiner&&(yl(t,t.next)||$e(t.prev,t,t.next)===0)){if(Yr(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Vr(s,e,t,i,n,r,o){if(s){!o&&r&&PE(s,i,n,r);for(var a=s,l,h;s.prev!==s.next;){if(l=s.prev,h=s.next,r?IE(s,i,n,r):wE(s)){e.push(l.i/t|0),e.push(s.i/t|0),e.push(h.i/t|0),Yr(s),s=h.next,a=h.next;continue}if(s=h,s===a){o?o===1?(s=CE(Bn(s),e,t),Vr(s,e,t,i,n,r,2)):o===2&&TE(s,e,t,i,n,r):Vr(Bn(s),e,t,i,n,r,1);break}}}}function wE(s){var e=s.prev,t=s,i=s.next;if($e(e,t,i)>=0)return!1;for(var n=e.x,r=t.x,o=i.x,a=e.y,l=t.y,h=i.y,d=nr?n>o?n:o:r>o?r:o,g=a>l?a>h?a:h:l>h?l:h,v=i.next;v!==e;){if(v.x>=d&&v.x<=f&&v.y>=p&&v.y<=g&&Ss(n,a,r,l,o,h,v.x,v.y)&&$e(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function IE(s,e,t,i){var n=s.prev,r=s,o=s.next;if($e(n,r,o)>=0)return!1;for(var a=n.x,l=r.x,h=o.x,d=n.y,p=r.y,f=o.y,g=al?a>h?a:h:l>h?l:h,w=d>p?d>f?d:f:p>f?p:f,T=fh(g,v,e,t,i),S=fh(b,w,e,t,i),_=s.prevZ,I=s.nextZ;_&&_.z>=T&&I&&I.z<=S;){if(_.x>=g&&_.x<=b&&_.y>=v&&_.y<=w&&_!==n&&_!==o&&Ss(a,d,l,p,h,f,_.x,_.y)&&$e(_.prev,_,_.next)>=0||(_=_.prevZ,I.x>=g&&I.x<=b&&I.y>=v&&I.y<=w&&I!==n&&I!==o&&Ss(a,d,l,p,h,f,I.x,I.y)&&$e(I.prev,I,I.next)>=0))return!1;I=I.nextZ}for(;_&&_.z>=T;){if(_.x>=g&&_.x<=b&&_.y>=v&&_.y<=w&&_!==n&&_!==o&&Ss(a,d,l,p,h,f,_.x,_.y)&&$e(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;I&&I.z<=S;){if(I.x>=g&&I.x<=b&&I.y>=v&&I.y<=w&&I!==n&&I!==o&&Ss(a,d,l,p,h,f,I.x,I.y)&&$e(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function CE(s,e,t){var i=s;do{var n=i.prev,r=i.next.next;!yl(n,r)&&Om(n,i,i.next,r)&&Hr(n,r)&&Hr(r,n)&&(e.push(n.i/t|0),e.push(i.i/t|0),e.push(r.i/t|0),Yr(i),Yr(i.next),i=s=r),i=i.next}while(i!==s);return Bn(i)}function TE(s,e,t,i,n,r){var o=s;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&ME(o,a)){var l=Fm(o,a);o=Bn(o,o.next),l=Bn(l,l.next),Vr(o,e,t,i,n,r,0),Vr(l,e,t,i,n,r,0);return}a=a.next}o=o.next}while(o!==s)}function xE(s,e,t,i){var n=[],r,o,a,l,h;for(r=0,o=e.length;r=t.next.y&&t.next.y!==t.y){var a=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=i&&a>r&&(r=a,o=t.x=t.x&&t.x>=h&&i!==t.x&&Ss(no.x||t.x===o.x&&RE(o,t)))&&(o=t,p=f)),t=t.next;while(t!==l);return o}function RE(s,e){return $e(s.prev,s,e.prev)<0&&$e(e.next,s,s.next)<0}function PE(s,e,t,i){var n=s;do n.z===0&&(n.z=fh(n.x,n.y,e,t,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==s);n.prevZ.nextZ=null,n.prevZ=null,OE(n)}function OE(s){var e,t,i,n,r,o,a,l,h=1;do{for(t=s,s=null,r=null,o=0;t;){for(o++,i=t,a=0,e=0;e0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(n=t,t=t.nextZ,a--):(n=i,i=i.nextZ,l--),r?r.nextZ=n:s=n,n.prevZ=r,r=n;t=i}r.nextZ=null,h*=2}while(o>1);return s}function fh(s,e,t,i,n){return s=(s-t)*n|0,e=(e-i)*n|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function FE(s){var e=s,t=s;do(e.x=(s-o)*(r-a)&&(s-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(r-a)>=(n-o)*(i-a)}function ME(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!LE(s,e)&&(Hr(s,e)&&Hr(e,s)&&DE(s,e)&&($e(s.prev,s,e.prev)||$e(s,e.prev,e))||yl(s,e)&&$e(s.prev,s,s.next)>0&&$e(e.prev,e,e.next)>0)}function $e(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function yl(s,e){return s.x===e.x&&s.y===e.y}function Om(s,e,t,i){var n=Ta($e(s,e,t)),r=Ta($e(s,e,i)),o=Ta($e(t,i,s)),a=Ta($e(t,i,e));return!!(n!==r&&o!==a||n===0&&Ca(s,t,e)||r===0&&Ca(s,i,e)||o===0&&Ca(t,s,i)||a===0&&Ca(t,e,i))}function Ca(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function Ta(s){return s>0?1:s<0?-1:0}function LE(s,e){var t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&Om(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function Hr(s,e){return $e(s.prev,s,s.next)<0?$e(s,e,s.next)>=0&&$e(s,s.prev,e)>=0:$e(s,e,s.prev)<0||$e(s,s.next,e)<0}function DE(s,e){var t=s,i=!1,n=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&n<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==s);return i}function Fm(s,e){var t=new mh(s.i,s.x,s.y),i=new mh(e.i,e.x,e.y),n=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=n,n.prev=t,i.next=t,t.prev=i,r.next=i,i.prev=r,i}function sp(s,e,t,i){var n=new mh(s,e,t);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function Yr(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function mh(s,e,t){this.i=s,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}vl.deviation=function(s,e,t,i){var n=e&&e.length,r=n?e[0]*t:s.length,o=Math.abs(gh(s,0,r,t));if(n)for(var a=0,l=e.length;a0&&(i+=s[n-1].length,t.holes.push(i))}return t};var NE=ou.exports;const UE=Rm(NE),kE={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` + `};let ro=class extends wt{constructor(e){super({type:"LineMaterial",uniforms:Gh.clone(Fa.line.uniforms),vertexShader:Fa.line.vertexShader,fragmentShader:Fa.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1))}};const Qd=new O,Zd=new O,pt=new Vs,ft=new Vs,fi=new Vs,zc=new O,Vc=new Ee,mt=new Dt,qd=new O,wa=new Ke,Ia=new Gn,mi=new Vs;let vi,Nn;function Jd(s,e,t){return mi.set(0,0,-e,1).applyMatrix4(s.projectionMatrix),mi.multiplyScalar(1/mi.w),mi.x=Nn/t.width,mi.y=Nn/t.height,mi.applyMatrix4(s.projectionMatrixInverse),mi.multiplyScalar(1/mi.w),Math.abs(Math.max(mi.x,mi.y))}function gE(s,e){const t=s.matrixWorld,i=s.geometry,n=i.attributes.instanceStart,r=i.attributes.instanceEnd,o=Math.min(i.instanceCount,n.count);for(let a=0,l=o;ad&&ft.z>d)continue;if(pt.z>d){const T=pt.z-ft.z,S=(pt.z-d)/T;pt.lerp(ft,S)}else if(ft.z>d){const T=ft.z-pt.z,S=(ft.z-d)/T;ft.lerp(pt,S)}pt.applyMatrix4(i),ft.applyMatrix4(i),pt.multiplyScalar(1/pt.w),ft.multiplyScalar(1/ft.w),pt.x*=n.x/2,pt.y*=n.y/2,ft.x*=n.x/2,ft.y*=n.y/2,mt.start.copy(pt),mt.start.z=0,mt.end.copy(ft),mt.end.z=0;const g=mt.closestPointToPointParameter(zc,!0);mt.at(g,qd);const v=so.lerp(pt.z,ft.z,g),b=v>=-1&&v<=1,w=zc.distanceTo(qd)t.geometry.attributes.position.count&&(t.geometry.dispose(),t.geometry=new Wa),t.geometry.setPositions(o),n&&t.geometry.setColors(a),i.geometry.setFromPoints(l)}newCurve(e,t,i){const n=new Wa,r=new ro({color:t,linewidth:e,vertexColors:i,worldUnits:!1,depthTest:!1}),o=new Im(n,r);return this.scene.add(o),o}newPoints(e,t){const i=new Ne,n=new gt(new Float32Array,3);i.setAttribute("position",n);const r=new ff({size:e,color:t,sizeAttenuation:!1,depthTest:!1}),o=new mf(i,r);return o.frustumCulled=!1,this.scene.add(o),o}};x(Cm,"settings",{colors:{LINE:[213/255,0/255,255/255],CIRCULARARC:[0/255,46,255/255],CLOTHOID:[0/255,255/255,0/255],PARABOLICARC:[0/255,255/255,72/255],CONSTANTGRADIENT:[213/255,0/255,255/255]}});let xm=Cm;class EE extends kn{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Ve(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&t.element.parentNode!==null&&t.element.parentNode.removeChild(t.element)})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const bs=new O,$d=new Ee,ep=new Ee,tp=new O,ip=new O;class bE{constructor(e={}){const t=this;let i,n,r,o;const a={objects:new WeakMap},l=e.element!==void 0?e.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.getSize=function(){return{width:i,height:n}},this.render=function(g,v){g.matrixWorldAutoUpdate===!0&&g.updateMatrixWorld(),v.parent===null&&v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),$d.copy(v.matrixWorldInverse),ep.multiplyMatrices(v.projectionMatrix,$d),h(g,g,v),f(g)},this.setSize=function(g,v){i=g,n=v,r=i/2,o=n/2,l.style.width=g+"px",l.style.height=v+"px"};function h(g,v,b){if(g.isCSS2DObject){bs.setFromMatrixPosition(g.matrixWorld),bs.applyMatrix4(ep);const w=g.visible===!0&&bs.z>=-1&&bs.z<=1&&g.layers.test(b.layers)===!0;if(g.element.style.display=w===!0?"":"none",w===!0){g.onBeforeRender(t,v,b);const S=g.element;S.style.transform="translate("+-100*g.center.x+"%,"+-100*g.center.y+"%)translate("+(bs.x*r+r)+"px,"+(-bs.y*o+o)+"px)",S.parentNode!==l&&l.appendChild(S),g.onAfterRender(t,v,b)}const T={distanceToCameraSquared:d(b,g)};a.objects.set(g,T)}for(let w=0,T=g.children.length;w{if(this.onBeforeUpdate.trigger(this),!this.enabled||!this.currentWorld)return;const n=this.currentWorld.scene.three,r=this.currentWorld.camera.three;n instanceof Xn&&this.three2D.render(n,r)}),this.onDisposed.add(()=>{this.three2D.domElement.remove()}),this.onResize.add(({x:n,y:r})=>{this.three2D.setSize(n,r)}),this.setupHtmlRenderer(),this.resize()}setupHtmlRenderer(){this.three2D.domElement.style.position="absolute",this.three2D.domElement.style.top="0px",this.three2D.domElement.style.pointerEvents="none",this.container&&this.container.appendChild(this.three2D.domElement)}}const Sm=class _m extends Re{constructor(e){super(e),x(this,"onDisposed",new $),x(this,"enabled",!0),x(this,"threshold",50),x(this,"autoCluster",!0),x(this,"list",new Map),x(this,"_worldEvents",new Map),x(this,"clusterLabels",new Set),x(this,"currentKeys",new Set),x(this,"_color","white"),x(this,"_markerKey",0),x(this,"_clusterKey",0),x(this,"_setupWorlds",new Set),e.add(_m.uuid,this)}get color(){return this._color}set color(e){this._color=e;for(const[t,i]of this.list)for(const[n,r]of i)r.label.three.element.style.color=e}create(e,t,i,n=!1){this.setupEvents(e,!0);const r=this._markerKey.toString(),o=this.getWorldMarkerList(e);if(o.has(r))return;const a=document.createElement("span");a.innerHTML=t,a.style.color=this._color;const l=new _t(e,a);return l.three.position.copy(i),o.set(r,{key:r,label:l,merged:!1,static:n}),this._markerKey++,r}delete(e){for(const[t,i]of this.list){const n=i.get(e);n&&n.label.dispose(),i.delete(e)}}getWorldMarkerList(e){return this.list.has(e.uuid)||this.list.set(e.uuid,new Map),this.list.get(e.uuid)}dispose(e){for(const[t,i]of this.list){const n=[...i.keys()];for(const r of n){const o=i.get(r);e&&o.type!==e||(o.label.dispose(),i.delete(r))}}if(!e){this.list.clear(),this._markerKey=0;for(const t of this.clusterLabels)t.label.dispose();this.clusterLabels.clear(),this._clusterKey=0,this.currentKeys.clear()}this.onDisposed.trigger()}setupEvents(e,t){if(t&&this._setupWorlds.has(e.uuid)||!e.camera.hasCameraControls())return;const i=this.getWorldEvent(e);e.camera.controls.removeEventListener("sleep",i),e.camera.controls.removeEventListener("rest",i),t&&(e.camera.controls.addEventListener("sleep",i),e.camera.controls.addEventListener("rest",i))}getWorldEvent(e){if(!this._worldEvents.has(e.uuid)){const t=()=>{this.cluster(e)};this._worldEvents.set(e.uuid,t)}return this._worldEvents.get(e.uuid)}resetMarkers(){for(const[e,t]of this.list)for(const[i,n]of t)n.merged=!1;for(const e of this.clusterLabels)e.label.dispose();this.clusterLabels.clear(),this._clusterKey=0}removeMergeMarkers(e){const t=this.list.get(e.uuid);if(t){for(const[i,n]of t)n.merged?n.label.dispose():n.label.world.scene.three.add(n.label.three);for(const i of this.clusterLabels)if(i.markerKeys.length===1){for(const[n,r]of this.list){const o=r.get(i.markerKeys[0]);o&&(o.label.world.scene.three.add(o.label.three),o.merged=!1)}i.label.dispose(),this.clusterLabels.delete(i)}}}cluster(e){if(!this.autoCluster)return;this.resetMarkers();const t=this.list.get(e.uuid);if(t){for(const[i,n]of t)if(!n.merged&&!n.static){this.currentKeys.clear();for(const[r,o]of t)o.static||n.key!==o.key&&!o.merged&&this.distance(n.label,o.label)0){this.currentKeys.add(n.key),n.merged=!0;const r=Array.from(this.currentKeys),o=this.getAveragePositionFromLabels(r),a=new _t(n.label.world,this.createClusterElement(this._clusterKey.toString())),{element:l}=a.three;l.textContent=r.length.toString(),a.three.position.copy(o),this.clusterLabels.add({key:this._clusterKey.toString(),markerKeys:r,label:a}),this._clusterKey++}}this.removeMergeMarkers(e)}}getAveragePositionFromLabels(e){const t=e.map(i=>{for(const[n,r]of this.list){const o=r.get(i);if(o)return o.label.three.position}return new O});return t.reduce((i,n)=>i.add(n),new O).divideScalar(t.length)}createClusterElement(e){const t=document.createElement("div");return t.textContent=e,t.style.color="#000000",t.style.background="#FFFFFF",t.style.fontSize="1.2rem",t.style.fontWeight="500",t.style.pointerEvents="auto",t.style.borderRadius="50%",t.style.padding="5px 11px",t.style.textAlign="center",t.style.cursor="pointer",t.addEventListener("pointerdown",()=>{this.navigateToCluster(e)}),t.addEventListener("pointerover",()=>{t.style.background="#BCF124"}),t.addEventListener("pointerout",()=>{t.style.background="#FFFFFF"}),t}getScreenPosition(e){const t=new O;if(!e.world.renderer)throw new Error("Renderer not found!");const i=e.three.position.clone();i.project(e.world.camera.three);const n=e.world.renderer.getSize();return t.x=i.x*n.x/2+n.x/2,t.y=-(i.y*n.y/2)+n.y/2,t}distance(e,t){const i=this.getScreenPosition(e),n=this.getScreenPosition(t),r=i.x-n.x,o=i.y-n.y,a=Math.sqrt(r*r+o*o)*.5;return a===0?this.threshold+1:a}navigateToCluster(e){const t=[],i=Array.from(this.clusterLabels).find(h=>h.key===e);if(!i)return;const n=i.label.world.camera;if(!n.hasCameraControls()){console.warn("Zoom to clusters only supported with Camera Controls!");return}for(const h of i.markerKeys)for(const[d,p]of this.list){const f=p.get(h);if(f){const{x:g,y:v,z:b}=f.label.three.position;t.push(g,v,b)}}i.label.dispose(),this.clusterLabels.delete(i);const r=new Ne,o=new Float32Array(t),a=new gt(o,3);r.setAttribute("position",a);const l=new le(r);l.geometry.computeBoundingSphere(),l.geometry.boundingSphere&&n.controls.fitToSphere(l,!0),r.dispose(),l.clear(),t.length=0}};x(Sm,"uuid","4079eb91-79b0-4ede-bcf2-15b837129236");let An=Sm;var np=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rm(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ou={exports:{}};ou.exports=vl;ou.exports.default=vl;function vl(s,e,t){t=t||2;var i=e&&e.length,n=i?e[0]*t:s.length,r=Pm(s,0,n,t,!0),o=[];if(!r||r.next===r.prev)return o;var a,l,h,d,p,f,g;if(i&&(r=xE(s,e,r,t)),s.length>80*t){a=h=s[0],l=d=s[1];for(var v=t;vh&&(h=p),f>d&&(d=f);g=Math.max(h-a,d-l),g=g!==0?32767/g:0}return Vr(r,o,t,a,l,g,0),o}function Pm(s,e,t,i,n){var r,o;if(n===gh(s,e,t,i)>0)for(r=e;r=e;r-=i)o=sp(r,s[r],s[r+1],o);return o&&yl(o,o.next)&&(Yr(o),o=o.next),o}function Bn(s,e){if(!s)return s;e||(e=s);var t=s,i;do if(i=!1,!t.steiner&&(yl(t,t.next)||$e(t.prev,t,t.next)===0)){if(Yr(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Vr(s,e,t,i,n,r,o){if(s){!o&&r&&PE(s,i,n,r);for(var a=s,l,h;s.prev!==s.next;){if(l=s.prev,h=s.next,r?IE(s,i,n,r):wE(s)){e.push(l.i/t|0),e.push(s.i/t|0),e.push(h.i/t|0),Yr(s),s=h.next,a=h.next;continue}if(s=h,s===a){o?o===1?(s=CE(Bn(s),e,t),Vr(s,e,t,i,n,r,2)):o===2&&TE(s,e,t,i,n,r):Vr(Bn(s),e,t,i,n,r,1);break}}}}function wE(s){var e=s.prev,t=s,i=s.next;if($e(e,t,i)>=0)return!1;for(var n=e.x,r=t.x,o=i.x,a=e.y,l=t.y,h=i.y,d=nr?n>o?n:o:r>o?r:o,g=a>l?a>h?a:h:l>h?l:h,v=i.next;v!==e;){if(v.x>=d&&v.x<=f&&v.y>=p&&v.y<=g&&Ss(n,a,r,l,o,h,v.x,v.y)&&$e(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function IE(s,e,t,i){var n=s.prev,r=s,o=s.next;if($e(n,r,o)>=0)return!1;for(var a=n.x,l=r.x,h=o.x,d=n.y,p=r.y,f=o.y,g=al?a>h?a:h:l>h?l:h,w=d>p?d>f?d:f:p>f?p:f,T=fh(g,v,e,t,i),S=fh(b,w,e,t,i),_=s.prevZ,I=s.nextZ;_&&_.z>=T&&I&&I.z<=S;){if(_.x>=g&&_.x<=b&&_.y>=v&&_.y<=w&&_!==n&&_!==o&&Ss(a,d,l,p,h,f,_.x,_.y)&&$e(_.prev,_,_.next)>=0||(_=_.prevZ,I.x>=g&&I.x<=b&&I.y>=v&&I.y<=w&&I!==n&&I!==o&&Ss(a,d,l,p,h,f,I.x,I.y)&&$e(I.prev,I,I.next)>=0))return!1;I=I.nextZ}for(;_&&_.z>=T;){if(_.x>=g&&_.x<=b&&_.y>=v&&_.y<=w&&_!==n&&_!==o&&Ss(a,d,l,p,h,f,_.x,_.y)&&$e(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;I&&I.z<=S;){if(I.x>=g&&I.x<=b&&I.y>=v&&I.y<=w&&I!==n&&I!==o&&Ss(a,d,l,p,h,f,I.x,I.y)&&$e(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function CE(s,e,t){var i=s;do{var n=i.prev,r=i.next.next;!yl(n,r)&&Om(n,i,i.next,r)&&Hr(n,r)&&Hr(r,n)&&(e.push(n.i/t|0),e.push(i.i/t|0),e.push(r.i/t|0),Yr(i),Yr(i.next),i=s=r),i=i.next}while(i!==s);return Bn(i)}function TE(s,e,t,i,n,r){var o=s;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&ME(o,a)){var l=Fm(o,a);o=Bn(o,o.next),l=Bn(l,l.next),Vr(o,e,t,i,n,r,0),Vr(l,e,t,i,n,r,0);return}a=a.next}o=o.next}while(o!==s)}function xE(s,e,t,i){var n=[],r,o,a,l,h;for(r=0,o=e.length;r=t.next.y&&t.next.y!==t.y){var a=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=i&&a>r&&(r=a,o=t.x=t.x&&t.x>=h&&i!==t.x&&Ss(no.x||t.x===o.x&&RE(o,t)))&&(o=t,p=f)),t=t.next;while(t!==l);return o}function RE(s,e){return $e(s.prev,s,e.prev)<0&&$e(e.next,s,s.next)<0}function PE(s,e,t,i){var n=s;do n.z===0&&(n.z=fh(n.x,n.y,e,t,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==s);n.prevZ.nextZ=null,n.prevZ=null,OE(n)}function OE(s){var e,t,i,n,r,o,a,l,h=1;do{for(t=s,s=null,r=null,o=0;t;){for(o++,i=t,a=0,e=0;e0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(n=t,t=t.nextZ,a--):(n=i,i=i.nextZ,l--),r?r.nextZ=n:s=n,n.prevZ=r,r=n;t=i}r.nextZ=null,h*=2}while(o>1);return s}function fh(s,e,t,i,n){return s=(s-t)*n|0,e=(e-i)*n|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function FE(s){var e=s,t=s;do(e.x=(s-o)*(r-a)&&(s-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(r-a)>=(n-o)*(i-a)}function ME(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!LE(s,e)&&(Hr(s,e)&&Hr(e,s)&&DE(s,e)&&($e(s.prev,s,e.prev)||$e(s,e.prev,e))||yl(s,e)&&$e(s.prev,s,s.next)>0&&$e(e.prev,e,e.next)>0)}function $e(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function yl(s,e){return s.x===e.x&&s.y===e.y}function Om(s,e,t,i){var n=Ta($e(s,e,t)),r=Ta($e(s,e,i)),o=Ta($e(t,i,s)),a=Ta($e(t,i,e));return!!(n!==r&&o!==a||n===0&&Ca(s,t,e)||r===0&&Ca(s,i,e)||o===0&&Ca(t,s,i)||a===0&&Ca(t,e,i))}function Ca(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function Ta(s){return s>0?1:s<0?-1:0}function LE(s,e){var t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&Om(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function Hr(s,e){return $e(s.prev,s,s.next)<0?$e(s,e,s.next)>=0&&$e(s,s.prev,e)>=0:$e(s,e,s.prev)<0||$e(s,s.next,e)<0}function DE(s,e){var t=s,i=!1,n=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&n<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==s);return i}function Fm(s,e){var t=new mh(s.i,s.x,s.y),i=new mh(e.i,e.x,e.y),n=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=n,n.prev=t,i.next=t,t.prev=i,r.next=i,i.prev=r,i}function sp(s,e,t,i){var n=new mh(s,e,t);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function Yr(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function mh(s,e,t){this.i=s,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}vl.deviation=function(s,e,t,i){var n=e&&e.length,r=n?e[0]*t:s.length,o=Math.abs(gh(s,0,r,t));if(n)for(var a=0,l=e.length;a0&&(i+=s[n-1].length,t.holes.push(i))}return t};var NE=ou.exports;const UE=Rm(NE),kE={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; @@ -1396,7 +1396,7 @@ void main() { gl_FragColor = corrected; } - `}createOutlinePostProcessMaterial(){return new wt({uniforms:{opacity:{value:this._opacity},debugVisualize:{value:0},sceneColorBuffer:{value:null},tolerance:{value:this._tolerance},planeBuffer:{value:null},glossBuffer:{value:null},outlineBuffer:{value:null},glossEnabled:{value:1},minGloss:{value:this._minGloss},maxGloss:{value:this._maxGloss},outlineEnabled:{value:0},glossExponent:{value:this._glossExponent},width:{value:1},lineColor:{value:new Rt(this._lineColor)},screenSize:{value:new Vs(this.resolution.x,this.resolution.y,1/this.resolution.x,1/this.resolution.y)}},vertexShader:this.vertexShader,fragmentShader:this.fragmentShader})}newRenderTarget(){const e=new Ri(this.resolution.x,this.resolution.y);return e.texture.colorSpace="srgb-linear",e.texture.format=Af,e.texture.type=$h,e.texture.minFilter=Ai,e.texture.magFilter=Ai,e.texture.generateMipmaps=!1,e.stencilBuffer=!1,e}}class ib{constructor(e,t,i){if(x(this,"overrideClippingPlanes",!1),x(this,"composer"),x(this,"_enabled",!1),x(this,"_initialized",!1),x(this,"_n8ao"),x(this,"_customEffects"),x(this,"_basePass"),x(this,"_gammaPass"),x(this,"_depthTexture"),x(this,"_settings",{gamma:!0,custom:!0,ao:!1}),x(this,"_renderer"),x(this,"_components"),x(this,"_world"),x(this,"_renderTarget"),!i.renderer)throw new Error("The given world must have a renderer!");this._components=e,this._renderer=t,this._world=i,this._renderTarget=new Ri(window.innerWidth,window.innerHeight),this._renderTarget.texture.colorSpace="srgb-linear",this.composer=new YE(t,this._renderTarget),this.composer.setSize(window.innerWidth,window.innerHeight)}get basePass(){if(!this._basePass)throw new Error("Custom effects not initialized!");return this._basePass}get gammaPass(){if(!this._gammaPass)throw new Error("Custom effects not initialized!");return this._gammaPass}get customEffects(){if(!this._customEffects)throw new Error("Custom effects not initialized!");return this._customEffects}get n8ao(){if(!this._n8ao)throw new Error("Custom effects not initialized!");return this._n8ao}get enabled(){return this._enabled}set enabled(e){this._initialized||this.initialize(),this._enabled=e}get settings(){return{...this._settings}}dispose(){var e,t,i,n;this._renderTarget.dispose(),(e=this._depthTexture)==null||e.dispose(),(t=this._customEffects)==null||t.dispose(),(i=this._gammaPass)==null||i.dispose(),(n=this._n8ao)==null||n.dispose()}setPasses(e){let t=!1;for(const i in e){const n=i;if(this.settings[n]!==e[n]){t=!0;break}}if(t){for(const i in e){const n=i;this._settings[n]!==void 0&&(this._settings[n]=e[n])}this.updatePasses()}}setSize(e,t){this._initialized&&(this.composer.setSize(e,t),this.basePass.setSize(e,t),this.n8ao.setSize(e,t),this.customEffects.setSize(e,t),this.gammaPass.setSize(e,t))}update(){this._enabled&&this.composer.render()}updateCamera(){const e=this._world.camera.three;this._n8ao&&(this._n8ao.camera=e),this._customEffects&&(this._customEffects.renderCamera=e),this._basePass&&(this._basePass.camera=e)}initialize(){if(!this._world.renderer)throw new Error("The given world must have a renderer!");const e=this._world.scene.three,t=this._world.camera.three;if(!(e instanceof Xn))throw new Error("The given scene must have a THREE.Scene as core!");this._world.camera instanceof nE&&this._world.camera.projection.onChanged.add(()=>{this.updateCamera()});const i=this._world.renderer;this.overrideClippingPlanes||(this._renderer.clippingPlanes=i.clippingPlanes),this._renderer.outputColorSpace="srgb",this._renderer.toneMapping=Bv,this.newBasePass(e,t),this.newSaoPass(e,t),this.newGammaPass(),this.newCustomPass(e,t),this._initialized=!0,this.updatePasses()}updateProjection(e){this.composer.passes.forEach(t=>{t.camera=e}),this.update()}updatePasses(){for(const e of this.composer.passes)this.composer.removePass(e);this._basePass&&this.composer.addPass(this.basePass),this._settings.gamma&&this.composer.addPass(this.gammaPass),this._settings.ao&&this.composer.addPass(this.n8ao),this._settings.custom&&this.composer.addPass(this.customEffects)}newCustomPass(e,t){this._customEffects=new tb(new Ve(window.innerWidth,window.innerHeight),this._components,this._world,e,t)}newGammaPass(){this._gammaPass=new Lm(JE)}newSaoPass(e,t){if(!this._world.renderer)throw new Error("The given world must have a renderer!");const{width:i,height:n}=this._world.renderer.getSize();this._n8ao=new qE(e,t,i,n);const{configuration:r}=this._n8ao;r.aoSamples=16,r.denoiseSamples=1,r.denoiseRadius=13,r.aoRadius=1,r.distanceFalloff=4,r.aoRadius=1,r.intensity=4,r.halfRes=!0,r.color=new Rt().setHex(13421772,"srgb-linear")}newBasePass(e,t){this._basePass=new GE(e,t)}}let vh=class extends Am{constructor(e,t,i){super(e,t,i),x(this,"_postproduction"),this.onResize.add(n=>this.resizePostproduction(n)),this.onWorldChanged.add(()=>{this.currentWorld&&(this._postproduction&&this._postproduction.dispose(),this._postproduction=new ib(e,this.three,this.currentWorld),this.setPostproductionSize())})}get postproduction(){if(!this._postproduction)throw new Error("Renderer not initialized yet with a world!");return this._postproduction}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger();const e=this.currentWorld.scene.three,t=this.currentWorld.camera.three;this.postproduction.enabled?this.postproduction.composer.render():this.three.render(e,t),e instanceof Xn&&this.three2D.render(e,t),this.onAfterUpdate.trigger()}dispose(){super.dispose(),this.postproduction.dispose()}resizePostproduction(e){this.postproduction&&this.setPostproductionSize(e)}setPostproductionSize(e){if(!this.container)return;const t=e?e.x:this.container.clientWidth,i=e?e.y:this.container.clientHeight;this.postproduction.setSize(t,i)}};class nb{constructor(e,t,i,n){x(this,"mesh",new le(new Ne)),x(this,"world"),x(this,"styleName"),x(this,"_precission",1e4),x(this,"_tempVector",new O),x(this,"_plane"),x(this,"_geometry"),x(this,"_plane2DCoordinateSystem",new Ee),x(this,"_planeAxis"),this.world=e,this.mesh.material=n,this.mesh.frustumCulled=!1,this._plane=t;const{x:r,y:o,z:a}=t.normal;Math.abs(r)===1?this._planeAxis="x":Math.abs(o)===1?this._planeAxis="y":Math.abs(a)===1&&(this._planeAxis="z"),this._geometry=i,this.mesh.geometry.attributes.position=i.attributes.position;const l=t.normal.clone().multiplyScalar(.01);this.mesh.position.copy(l),this.visible=!0}get visible(){return this.mesh.parent!==null}set visible(e){const t=this.getStyle();e?(this.world.scene.three.add(this.mesh),t&&t.meshes.add(this.mesh)):(this.mesh.removeFromParent(),t&&t.meshes.delete(this.mesh))}set geometry(e){this._geometry=e,this.mesh.geometry.attributes.position=e.attributes.position}dispose(){const e=this.getStyle();e&&e.meshes.delete(this.mesh),this.mesh.geometry.dispose(),this.mesh.removeFromParent(),this.mesh.geometry=null,this.mesh=null,this._plane=null,this._geometry=null}update(e){const t=this._geometry.attributes.position.array;if(!t)return;this.updatePlane2DCoordinateSystem();const i=[];let n=0;for(let r=0;rthis._localPlane.intersectsBox(n),intersectsTriangle:n=>{let r=0;if(this._tempLine.start.copy(n.a),this._tempLine.end.copy(n.b),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const o=this._tempVector.applyMatrix4(e.matrixWorld);t.setXYZ(i,o.x,o.y,o.z),r++,i++}if(this._tempLine.start.copy(n.b),this._tempLine.end.copy(n.c),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const o=this._tempVector.applyMatrix4(e.matrixWorld);t.setXYZ(i,o.x,o.y,o.z),r++,i++}if(this._tempLine.start.copy(n.c),this._tempLine.end.copy(n.a),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const o=this._tempVector.applyMatrix4(e.matrixWorld);t.setXYZ(i,o.x,o.y,o.z),r++,i++}r!==2&&(i-=r)}}),i}updateDeletedEdges(e){const t=Object.keys(this._edges);for(const i of t)e[i]===void 0&&(this.disposeEdge(i),this.disposeOutline(i))}disposeOutline(e){if(!this.world.renderer)return;const t=this.world.renderer;if(t instanceof vh){const i=t.postproduction.customEffects.outlinedMeshes;delete i[e]}}disposeEdge(e){const t=this.components.get(Fi),i=this._edges[e];i.fill&&i.fill.dispose(),t.destroy(i.mesh,!1),delete this._edges[e]}}let Gr=class extends Kf{constructor(e,t,i,n,r,o=5,a=!0){super(e,t,i,n,r,o,a),x(this,"edges"),x(this,"edgesMaxUpdateRate",50),x(this,"_visible",!0),x(this,"_edgesVisible",!0),x(this,"updateFill",()=>{this.edges.fillNeedsUpdate=!0,this.edges.update(),this.edges.visible=this._visible}),this.edges=new sb(e,t,this.three),this.toggleControls(!0),this.edges.visible=!0,this.onDraggingEnded.add(()=>{this.updateFill()}),this.onDraggingStarted.add(()=>this.edges.visible=!1)}get visible(){return this._visible}set visible(e){super.visible=e,this.toggleControls(e)}set enabled(e){this._enabled=e,this.world.renderer&&this.world.renderer.setPlane(e,this.three)}get enabled(){return super.enabled}dispose(){super.dispose(),this.edges.dispose()}};class rb{constructor(){x(this,"onDisposed",new ee),x(this,"enabled",!0),x(this,"list",{}),x(this,"_defaultLineMaterial",new Di({color:0,linewidth:.001})),x(this,"onAfterUpdate",new ee),x(this,"onBeforeUpdate",new ee)}update(e){this.onBeforeUpdate.trigger(this.list),this.onAfterUpdate.trigger(this.list)}create(e,t,i,n,r,o){if(!i.renderer)throw new Error("The given world doesn't have a renderer!");n||(n=this._defaultLineMaterial);for(const h of t)h.geometry.boundsTree||h.geometry.computeBoundsTree();const a=i.renderer;n.clippingPlanes=a.clippingPlanes;const l={name:e,lineMaterial:n,meshes:t,fillMaterial:r,outlineMaterial:o,fragments:{}};return this.list[e]=l,l}dispose(){const e=Object.keys(this.list);for(const t of e)this.deleteStyle(t);this.list={},this.onDisposed.trigger(),this.onDisposed.reset()}deleteStyle(e,t=!0){var i,n;const r=this.list[e];r&&(r.meshes.clear(),t&&(r.lineMaterial.dispose(),(i=r.fillMaterial)==null||i.dispose(),(n=r.outlineMaterial)==null||n.dispose())),delete this.list[e]}}const Um=class km extends Re{constructor(e){super(e),x(this,"onDisposed",new ee),x(this,"enabled",!0),x(this,"styles"),x(this,"fillsNeedUpdate",!1),x(this,"_visible",!0),this.components.list.set(km.uuid,this),this.styles=new rb}get visible(){return this._visible}set visible(e){this._visible=e;const t=this.components.get(Ga);for(const i of t.list)i instanceof Gr&&(i.edges.visible=e)}dispose(){this.styles.dispose(),this.onDisposed.trigger()}async update(e=!1){if(!this.enabled)return;const t=this.components.get(Ga);for(const i of t.list)i instanceof Gr&&(e||this.fillsNeedUpdate?i.updateFill():i.update());this.fillsNeedUpdate=!1}};x(Um,"uuid","24dfc306-a3c4-410f-8071-babc4afa5e4d");let Aa=Um;const ob={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:` + `}createOutlinePostProcessMaterial(){return new wt({uniforms:{opacity:{value:this._opacity},debugVisualize:{value:0},sceneColorBuffer:{value:null},tolerance:{value:this._tolerance},planeBuffer:{value:null},glossBuffer:{value:null},outlineBuffer:{value:null},glossEnabled:{value:1},minGloss:{value:this._minGloss},maxGloss:{value:this._maxGloss},outlineEnabled:{value:0},glossExponent:{value:this._glossExponent},width:{value:1},lineColor:{value:new Rt(this._lineColor)},screenSize:{value:new Vs(this.resolution.x,this.resolution.y,1/this.resolution.x,1/this.resolution.y)}},vertexShader:this.vertexShader,fragmentShader:this.fragmentShader})}newRenderTarget(){const e=new Ri(this.resolution.x,this.resolution.y);return e.texture.colorSpace="srgb-linear",e.texture.format=Af,e.texture.type=$h,e.texture.minFilter=Ai,e.texture.magFilter=Ai,e.texture.generateMipmaps=!1,e.stencilBuffer=!1,e}}class ib{constructor(e,t,i){if(x(this,"overrideClippingPlanes",!1),x(this,"composer"),x(this,"_enabled",!1),x(this,"_initialized",!1),x(this,"_n8ao"),x(this,"_customEffects"),x(this,"_basePass"),x(this,"_gammaPass"),x(this,"_depthTexture"),x(this,"_settings",{gamma:!0,custom:!0,ao:!1}),x(this,"_renderer"),x(this,"_components"),x(this,"_world"),x(this,"_renderTarget"),!i.renderer)throw new Error("The given world must have a renderer!");this._components=e,this._renderer=t,this._world=i,this._renderTarget=new Ri(window.innerWidth,window.innerHeight),this._renderTarget.texture.colorSpace="srgb-linear",this.composer=new YE(t,this._renderTarget),this.composer.setSize(window.innerWidth,window.innerHeight)}get basePass(){if(!this._basePass)throw new Error("Custom effects not initialized!");return this._basePass}get gammaPass(){if(!this._gammaPass)throw new Error("Custom effects not initialized!");return this._gammaPass}get customEffects(){if(!this._customEffects)throw new Error("Custom effects not initialized!");return this._customEffects}get n8ao(){if(!this._n8ao)throw new Error("Custom effects not initialized!");return this._n8ao}get enabled(){return this._enabled}set enabled(e){this._initialized||this.initialize(),this._enabled=e}get settings(){return{...this._settings}}dispose(){var e,t,i,n;this._renderTarget.dispose(),(e=this._depthTexture)==null||e.dispose(),(t=this._customEffects)==null||t.dispose(),(i=this._gammaPass)==null||i.dispose(),(n=this._n8ao)==null||n.dispose()}setPasses(e){let t=!1;for(const i in e){const n=i;if(this.settings[n]!==e[n]){t=!0;break}}if(t){for(const i in e){const n=i;this._settings[n]!==void 0&&(this._settings[n]=e[n])}this.updatePasses()}}setSize(e,t){this._initialized&&(this.composer.setSize(e,t),this.basePass.setSize(e,t),this.n8ao.setSize(e,t),this.customEffects.setSize(e,t),this.gammaPass.setSize(e,t))}update(){this._enabled&&this.composer.render()}updateCamera(){const e=this._world.camera.three;this._n8ao&&(this._n8ao.camera=e),this._customEffects&&(this._customEffects.renderCamera=e),this._basePass&&(this._basePass.camera=e)}initialize(){if(!this._world.renderer)throw new Error("The given world must have a renderer!");const e=this._world.scene.three,t=this._world.camera.three;if(!(e instanceof Xn))throw new Error("The given scene must have a THREE.Scene as core!");this._world.camera instanceof nE&&this._world.camera.projection.onChanged.add(()=>{this.updateCamera()});const i=this._world.renderer;this.overrideClippingPlanes||(this._renderer.clippingPlanes=i.clippingPlanes),this._renderer.outputColorSpace="srgb",this._renderer.toneMapping=Bv,this.newBasePass(e,t),this.newSaoPass(e,t),this.newGammaPass(),this.newCustomPass(e,t),this._initialized=!0,this.updatePasses()}updateProjection(e){this.composer.passes.forEach(t=>{t.camera=e}),this.update()}updatePasses(){for(const e of this.composer.passes)this.composer.removePass(e);this._basePass&&this.composer.addPass(this.basePass),this._settings.gamma&&this.composer.addPass(this.gammaPass),this._settings.ao&&this.composer.addPass(this.n8ao),this._settings.custom&&this.composer.addPass(this.customEffects)}newCustomPass(e,t){this._customEffects=new tb(new Ve(window.innerWidth,window.innerHeight),this._components,this._world,e,t)}newGammaPass(){this._gammaPass=new Lm(JE)}newSaoPass(e,t){if(!this._world.renderer)throw new Error("The given world must have a renderer!");const{width:i,height:n}=this._world.renderer.getSize();this._n8ao=new qE(e,t,i,n);const{configuration:r}=this._n8ao;r.aoSamples=16,r.denoiseSamples=1,r.denoiseRadius=13,r.aoRadius=1,r.distanceFalloff=4,r.aoRadius=1,r.intensity=4,r.halfRes=!0,r.color=new Rt().setHex(13421772,"srgb-linear")}newBasePass(e,t){this._basePass=new GE(e,t)}}let vh=class extends Am{constructor(e,t,i){super(e,t,i),x(this,"_postproduction"),this.onResize.add(n=>this.resizePostproduction(n)),this.onWorldChanged.add(()=>{this.currentWorld&&(this._postproduction&&this._postproduction.dispose(),this._postproduction=new ib(e,this.three,this.currentWorld),this.setPostproductionSize())})}get postproduction(){if(!this._postproduction)throw new Error("Renderer not initialized yet with a world!");return this._postproduction}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger();const e=this.currentWorld.scene.three,t=this.currentWorld.camera.three;this.postproduction.enabled?this.postproduction.composer.render():this.three.render(e,t),e instanceof Xn&&this.three2D.render(e,t),this.onAfterUpdate.trigger()}dispose(){super.dispose(),this.postproduction.dispose()}resizePostproduction(e){this.postproduction&&this.setPostproductionSize(e)}setPostproductionSize(e){if(!this.container)return;const t=e?e.x:this.container.clientWidth,i=e?e.y:this.container.clientHeight;this.postproduction.setSize(t,i)}};class nb{constructor(e,t,i,n){x(this,"mesh",new le(new Ne)),x(this,"world"),x(this,"styleName"),x(this,"_precission",1e4),x(this,"_tempVector",new O),x(this,"_plane"),x(this,"_geometry"),x(this,"_plane2DCoordinateSystem",new Ee),x(this,"_planeAxis"),this.world=e,this.mesh.material=n,this.mesh.frustumCulled=!1,this._plane=t;const{x:r,y:o,z:a}=t.normal;Math.abs(r)===1?this._planeAxis="x":Math.abs(o)===1?this._planeAxis="y":Math.abs(a)===1&&(this._planeAxis="z"),this._geometry=i,this.mesh.geometry.attributes.position=i.attributes.position;const l=t.normal.clone().multiplyScalar(.01);this.mesh.position.copy(l),this.visible=!0}get visible(){return this.mesh.parent!==null}set visible(e){const t=this.getStyle();e?(this.world.scene.three.add(this.mesh),t&&t.meshes.add(this.mesh)):(this.mesh.removeFromParent(),t&&t.meshes.delete(this.mesh))}set geometry(e){this._geometry=e,this.mesh.geometry.attributes.position=e.attributes.position}dispose(){const e=this.getStyle();e&&e.meshes.delete(this.mesh),this.mesh.geometry.dispose(),this.mesh.removeFromParent(),this.mesh.geometry=null,this.mesh=null,this._plane=null,this._geometry=null}update(e){const t=this._geometry.attributes.position.array;if(!t)return;this.updatePlane2DCoordinateSystem();const i=[];let n=0;for(let r=0;rthis._localPlane.intersectsBox(n),intersectsTriangle:n=>{let r=0;if(this._tempLine.start.copy(n.a),this._tempLine.end.copy(n.b),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const o=this._tempVector.applyMatrix4(e.matrixWorld);t.setXYZ(i,o.x,o.y,o.z),r++,i++}if(this._tempLine.start.copy(n.b),this._tempLine.end.copy(n.c),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const o=this._tempVector.applyMatrix4(e.matrixWorld);t.setXYZ(i,o.x,o.y,o.z),r++,i++}if(this._tempLine.start.copy(n.c),this._tempLine.end.copy(n.a),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const o=this._tempVector.applyMatrix4(e.matrixWorld);t.setXYZ(i,o.x,o.y,o.z),r++,i++}r!==2&&(i-=r)}}),i}updateDeletedEdges(e){const t=Object.keys(this._edges);for(const i of t)e[i]===void 0&&(this.disposeEdge(i),this.disposeOutline(i))}disposeOutline(e){if(!this.world.renderer)return;const t=this.world.renderer;if(t instanceof vh){const i=t.postproduction.customEffects.outlinedMeshes;delete i[e]}}disposeEdge(e){const t=this.components.get(Fi),i=this._edges[e];i.fill&&i.fill.dispose(),t.destroy(i.mesh,!1),delete this._edges[e]}}let Gr=class extends Kf{constructor(e,t,i,n,r,o=5,a=!0){super(e,t,i,n,r,o,a),x(this,"edges"),x(this,"edgesMaxUpdateRate",50),x(this,"_visible",!0),x(this,"_edgesVisible",!0),x(this,"updateFill",()=>{this.edges.fillNeedsUpdate=!0,this.edges.update(),this.edges.visible=this._visible}),this.edges=new sb(e,t,this.three),this.toggleControls(!0),this.edges.visible=!0,this.onDraggingEnded.add(()=>{this.updateFill()}),this.onDraggingStarted.add(()=>this.edges.visible=!1)}get visible(){return this._visible}set visible(e){super.visible=e,this.toggleControls(e)}set enabled(e){this._enabled=e,this.world.renderer&&this.world.renderer.setPlane(e,this.three)}get enabled(){return super.enabled}dispose(){super.dispose(),this.edges.dispose()}};class rb{constructor(){x(this,"onDisposed",new $),x(this,"enabled",!0),x(this,"list",{}),x(this,"_defaultLineMaterial",new Di({color:0,linewidth:.001})),x(this,"onAfterUpdate",new $),x(this,"onBeforeUpdate",new $)}update(e){this.onBeforeUpdate.trigger(this.list),this.onAfterUpdate.trigger(this.list)}create(e,t,i,n,r,o){if(!i.renderer)throw new Error("The given world doesn't have a renderer!");n||(n=this._defaultLineMaterial);for(const h of t)h.geometry.boundsTree||h.geometry.computeBoundsTree();const a=i.renderer;n.clippingPlanes=a.clippingPlanes;const l={name:e,lineMaterial:n,meshes:t,fillMaterial:r,outlineMaterial:o,fragments:{}};return this.list[e]=l,l}dispose(){const e=Object.keys(this.list);for(const t of e)this.deleteStyle(t);this.list={},this.onDisposed.trigger(),this.onDisposed.reset()}deleteStyle(e,t=!0){var i,n;const r=this.list[e];r&&(r.meshes.clear(),t&&(r.lineMaterial.dispose(),(i=r.fillMaterial)==null||i.dispose(),(n=r.outlineMaterial)==null||n.dispose())),delete this.list[e]}}const Um=class km extends Re{constructor(e){super(e),x(this,"onDisposed",new $),x(this,"enabled",!0),x(this,"styles"),x(this,"fillsNeedUpdate",!1),x(this,"_visible",!0),this.components.list.set(km.uuid,this),this.styles=new rb}get visible(){return this._visible}set visible(e){this._visible=e;const t=this.components.get(Ga);for(const i of t.list)i instanceof Gr&&(i.edges.visible=e)}dispose(){this.styles.dispose(),this.onDisposed.trigger()}async update(e=!1){if(!this.enabled)return;const t=this.components.get(Ga);for(const i of t.list)i instanceof Gr&&(e||this.fillsNeedUpdate?i.updateFill():i.update());this.fillsNeedUpdate=!1}};x(Um,"uuid","24dfc306-a3c4-410f-8071-babc4afa5e4d");let Aa=Um;const ob={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:` varying vec2 vUv; @@ -1460,12 +1460,12 @@ void main() { gl_FragColor = sum; - }`},lb=class Is extends Re{constructor(e){super(e),x(this,"onDisposed",new ee),x(this,"enabled",!0),x(this,"cameraHeight",10),x(this,"darkness",1.2),x(this,"opacity",1),x(this,"resolution",512),x(this,"amount",3.5),x(this,"planeColor",16777215),x(this,"shadowOffset",0),x(this,"shadowExtraScaleFactor",1.5),x(this,"list",{}),x(this,"tempMaterial",new Xt({visible:!1})),x(this,"depthMaterial",new Tf),this.components.add(Is.uuid,this),this.initializeDepthMaterial()}dispose(){for(const e in this.list)this.deleteShadow(e);this.tempMaterial.dispose(),this.depthMaterial.dispose(),this.components=null,this.onDisposed.trigger(Is.uuid),this.onDisposed.reset()}create(e,t,i){if(this.list[t])throw new Error(`There is already a shadow with ID ${t}`);const{size:n,center:r,min:o}=this.getSizeCenterMin(e),a=this.createShadow(t,n,i);return this.initializeShadow(a,r,o),this.createPlanes(a,n),this.bakeShadow(e,a),a.root}deleteShadow(e){const t=this.components.get(Fi),i=this.list[e];if(delete this.list[e],!i)throw new Error(`No shadow with ID ${e} was found.`);t.destroy(i.root),t.destroy(i.blurPlane),i.rt.dispose(),i.rtBlur.dispose()}createPlanes(e,t){const i=new ul(t.x,t.z).rotateX(Math.PI/2);this.createBasePlane(e,i),Is.createBlurPlane(e,i)}initializeShadow(e,t,i){this.initializeRoot(e,t,i),Is.initializeRenderTargets(e),Is.initializeCamera(e)}bakeShadow(e,t){const i=t.world.scene.three;if(!(i instanceof Xn))throw new Error("The core of the scene of the world must be a scene!");if(!t.world.renderer)throw new Error("The given world must have a renderer!");const n=t.world.renderer.three,r=e.map(h=>!!h.parent);for(let h=0;h!e.includes(h)&&h!==t.root);for(let h=o.length-1;h>=0;h--)i.remove(o[h]);const a=i.background;i.background=null,i.overrideMaterial=this.depthMaterial;const l=[];for(const h of e)l.push(h.visible),h.visible=!0;n.setRenderTarget(t.rt),n.render(i,t.camera),i.overrideMaterial=null,this.blurShadow(t,this.amount),this.blurShadow(t,this.amount*.4),n.setRenderTarget(null),i.background=a;for(let h=0;h=0;h--)i.add(o[h]);for(let h=0;h{i.uniforms.darkness=this.depthMaterial.userData.darkness,i.fragmentShader=` + }`},lb=class Is extends Re{constructor(e){super(e),x(this,"onDisposed",new $),x(this,"enabled",!0),x(this,"cameraHeight",10),x(this,"darkness",1.2),x(this,"opacity",1),x(this,"resolution",512),x(this,"amount",3.5),x(this,"planeColor",16777215),x(this,"shadowOffset",0),x(this,"shadowExtraScaleFactor",1.5),x(this,"list",{}),x(this,"tempMaterial",new Xt({visible:!1})),x(this,"depthMaterial",new Tf),this.components.add(Is.uuid,this),this.initializeDepthMaterial()}dispose(){for(const e in this.list)this.deleteShadow(e);this.tempMaterial.dispose(),this.depthMaterial.dispose(),this.components=null,this.onDisposed.trigger(Is.uuid),this.onDisposed.reset()}create(e,t,i){if(this.list[t])throw new Error(`There is already a shadow with ID ${t}`);const{size:n,center:r,min:o}=this.getSizeCenterMin(e),a=this.createShadow(t,n,i);return this.initializeShadow(a,r,o),this.createPlanes(a,n),this.bakeShadow(e,a),a.root}deleteShadow(e){const t=this.components.get(Fi),i=this.list[e];if(delete this.list[e],!i)throw new Error(`No shadow with ID ${e} was found.`);t.destroy(i.root),t.destroy(i.blurPlane),i.rt.dispose(),i.rtBlur.dispose()}createPlanes(e,t){const i=new ul(t.x,t.z).rotateX(Math.PI/2);this.createBasePlane(e,i),Is.createBlurPlane(e,i)}initializeShadow(e,t,i){this.initializeRoot(e,t,i),Is.initializeRenderTargets(e),Is.initializeCamera(e)}bakeShadow(e,t){const i=t.world.scene.three;if(!(i instanceof Xn))throw new Error("The core of the scene of the world must be a scene!");if(!t.world.renderer)throw new Error("The given world must have a renderer!");const n=t.world.renderer.three,r=e.map(h=>!!h.parent);for(let h=0;h!e.includes(h)&&h!==t.root);for(let h=o.length-1;h>=0;h--)i.remove(o[h]);const a=i.background;i.background=null,i.overrideMaterial=this.depthMaterial;const l=[];for(const h of e)l.push(h.visible),h.visible=!0;n.setRenderTarget(t.rt),n.render(i,t.camera),i.overrideMaterial=null,this.blurShadow(t,this.amount),this.blurShadow(t,this.amount*.4),n.setRenderTarget(null),i.background=a;for(let h=0;h=0;h--)i.add(o[h]);for(let h=0;h{i.uniforms.darkness=this.depthMaterial.userData.darkness,i.fragmentShader=` uniform float darkness; ${i.fragmentShader.replace(e,t)} - `}}createShadow(e,t,i){return this.list[e]={root:new Os,world:i,rt:new Ri(this.resolution,this.resolution),rtBlur:new Ri(this.resolution,this.resolution),blurPlane:new le,camera:this.createCamera(t)},this.list[e]}createCamera(e){return new jn(-e.x/2,e.x/2,e.z/2,-e.z/2,0,this.cameraHeight)}getSizeCenterMin(e){const t=e[0].parent,i=new Os;i.children=e;const n=new Ke().setFromObject(i);t==null||t.add(...e);const r=new O;n.getSize(r),r.x*=this.shadowExtraScaleFactor,r.z*=this.shadowExtraScaleFactor;const o=new O;n.getCenter(o);const a=n.min;return{size:r,center:o,min:a}}blurShadow(e,t){if(!e.world.renderer)throw new Error("The given world must have a renderer!");const i=new wt(ob);i.depthTest=!1;const n=new wt(ab);n.depthTest=!1,e.blurPlane.visible=!0,e.blurPlane.material=i,e.blurPlane.material.uniforms.tDiffuse.value=e.rt.texture,i.uniforms.h.value=t*1/256;const r=e.world.renderer.three;r.setRenderTarget(e.rtBlur),r.render(e.blurPlane,e.camera),e.blurPlane.material=n,e.blurPlane.material.uniforms.tDiffuse.value=e.rtBlur.texture,n.uniforms.v.value=t*1/256,r.setRenderTarget(e.rt),r.render(e.blurPlane,e.camera),e.blurPlane.visible=!1}};x(lb,"uuid","f833a09a-a3ab-4c58-b03e-da5298c7a1b6");const cb=["Station","Radius","Length","InitialKP","FinalKP","KP","Slope","Height","InitialKPV","FinalKPV"],Bm=class zm extends Re{constructor(e){super(e),x(this,"enabled",!0),x(this,"world",null),x(this,"_list",new Map),x(this,"_markerKey",0),x(this,"type","horizontal"),x(this,"divisionLength",100),e.add(zm.uuid,this)}addKPStation(e,t,i){const n=this.components.get(An),r=document.createElement("div"),o=document.createElement("div");r.appendChild(o),o.innerHTML=t,o.style.color=n.color,o.style.borderBottom="1px dotted white",o.style.width="160px",o.style.textAlign="left";const a=new _t(e,r),l=new O;l.x=i.geometry.attributes.position.getX(i.geometry.attributes.position.count-1),l.y=i.geometry.attributes.position.getY(i.geometry.attributes.position.count-1),l.z=i.geometry.attributes.position.getZ(i.geometry.attributes.position.count-1);const h=new O;h.x=i.geometry.attributes.position.getX(i.geometry.attributes.position.count-2),h.y=i.geometry.attributes.position.getY(i.geometry.attributes.position.count-2),h.z=i.geometry.attributes.position.getZ(i.geometry.attributes.position.count-2);const d=new O;d.x=(l.x+h.x)/2,d.y=(l.y+h.y)/2,d.z=(l.z+h.z)/2,a.three.position.copy(d);const p=new O;p.subVectors(l,h).normalize();const f=new Vt;f.setFromUnitVectors(new O(0,1,0),p);const g=new gf().setFromQuaternion(f).z,v=so.radToDeg(g);o.style.transform=`rotate(${-v-90}deg) translate(-35%, -50%)`;const b=this._markerKey.toString();n.setupEvents(e,!0),n.getWorldMarkerList(e).set(b,{label:a,key:b,merged:!1,static:!1}),this._markerKey++,this.save(b,"KP")}addVerticalMarker(e,t,i,n,r){const o=this.components.get(An),a=document.createElement("span");a.innerHTML=t,a.style.color=o.color;const l=new _t(e,a,r);if(n==="Height"){const d=document.createElement("span");d.innerHTML=t,d.style.color=o.color;const{position:p}=i.geometry.attributes,f=(p.array.length/3-1)*3,g=p.array.slice(f,f+3);l.three.position.set(g[0],g[1]+10,g[2])}else if(n==="InitialKPV"){const{position:d}=i.geometry.attributes,p=d.getX(0),f=d.getY(0),g=d.getZ(0);l.three.position.set(p-20,f,g)}else if(n==="FinalKPV"){const{position:d}=i.geometry.attributes,p=d.getX(i.geometry.attributes.position.count-1),f=d.getY(i.geometry.attributes.position.count-1),g=d.getZ(i.geometry.attributes.position.count-1);l.three.position.set(p+20,f,g)}else if(n==="Slope"){a.style.color="grey";const{position:d}=i.geometry.attributes,p=new O;p.x=d.getX(0),p.y=d.getY(0),p.z=d.getZ(0);const f=new O;f.x=d.getX(d.count-1),f.y=d.getY(d.count-1),f.z=d.getZ(d.count-1);const g=new O;g.addVectors(p,f).multiplyScalar(.5),l.three.position.set(g.x,g.y-10,g.z)}const h=this._markerKey.toString();return o.setupEvents(e,!0),o.getWorldMarkerList(e).set(h,{label:l,key:h,type:n,merged:!1,static:!1}),this._markerKey++,this.save(h,n),l}addCivilMarker(e,t,i,n){const r=this.components.get(An),o=document.createElement("span");o.innerHTML=t,o.style.color=r.color;const a=new _t(e,o);if(n==="InitialKP"){const h=i.geometry.attributes.position.getX(0),d=i.geometry.attributes.position.getY(0),p=i.geometry.attributes.position.getZ(0);a.three.position.set(h+2,d+2,p)}else if(n==="FinalKP"){const h=i.geometry.attributes.position.getX(i.geometry.attributes.position.count-1),d=i.geometry.attributes.position.getY(i.geometry.attributes.position.count-1),p=i.geometry.attributes.position.getZ(i.geometry.attributes.position.count-1);a.three.position.set(h+2,d-2,p)}else if(n==="Length"){const h=new O;h.x=i.geometry.attributes.position.getX(0),h.y=i.geometry.attributes.position.getY(0),h.z=i.geometry.attributes.position.getZ(0);const d=new O;d.x=i.geometry.attributes.position.getX(i.geometry.attributes.position.count-1),d.y=i.geometry.attributes.position.getY(i.geometry.attributes.position.count-1),d.z=i.geometry.attributes.position.getZ(i.geometry.attributes.position.count-1);const p=h.distanceTo(d);a.three.element.innerText=p.toFixed(2);const f=d.clone().add(h).divideScalar(2);a.three.position.copy(f)}const l=this._markerKey.toString();return r.setupEvents(e,!0),r.getWorldMarkerList(e).set(l,{label:a,key:l,type:n,merged:!1,static:!1}),this._markerKey++,this.save(l,n),a}showKPStations(e){if(!this.world)throw new Error("A world is needed for this component to work!");if(this.type==="horizontal"){const t=this.generateStartAndEndKP(e);for(const[,n]of t)this.addKPStation(this.world,n.value,n.normal);const i=this.generateConstantKP(e);for(const[,n]of i)this.addKPStation(this.world,n.value,n.normal)}}showCurveLength(e,t){if(!this.world)throw new Error("A world is needed for this component to work!");const i=this.components.get(An),n=e.length,r=`${t.toFixed(2)} m`,o=Math.round(n/2),a=e[o],l=i.create(this.world,r,a,!0);l!==void 0&&this.save(l,"Radius")}showLineLength(e,t){if(!this.world)throw new Error("A world is needed for this component to work!");const i=this.components.get(An),n=new O;n.x=e.geometry.getAttribute("position").getX(0),n.y=e.geometry.getAttribute("position").getY(0),n.z=e.geometry.getAttribute("position").getZ(0);const r=new O;r.x=e.geometry.getAttribute("position").getX(1),r.y=e.geometry.getAttribute("position").getY(1),r.z=e.geometry.getAttribute("position").getZ(1);const o=`${t.toFixed(2)} m`,a=new O;a.addVectors(n,r).multiplyScalar(.5);const l=i.create(this.world,o,a,!0);l!==void 0&&this.save(l,"Radius")}showCurveRadius(e,t){if(!this.world)throw new Error("A world is needed for this component to work!");const i=this.components.get(An),n=new O;n.x=e.geometry.getAttribute("position").getX(0),n.y=e.geometry.getAttribute("position").getY(0),n.z=e.geometry.getAttribute("position").getZ(0);const r=new O;r.x=e.geometry.getAttribute("position").getX(1),r.y=e.geometry.getAttribute("position").getY(1),r.z=e.geometry.getAttribute("position").getZ(1);const o=`R = ${t.toFixed(2)} m`,a=new O;a.addVectors(n,r).multiplyScalar(.5);const l=i.create(this.world,o,a,!0);l!==void 0&&this.save(l,"Radius")}deleteByType(e=cb){const t=this.components.get(An);for(const i of e){const n=this._list.get(i);if(n){for(const r of n)t.delete(r);this._list.delete(i)}}}generateStartAndEndKP(e){const{alignment:t}=e.curve,i=new Map;for(const n of t.horizontal){const r=n.getLength();if(i.size>0){const o=n.index-1,a=i.get(o).distance+r,l=n.mesh.geometry.getAttribute("position"),h=l.count-1,d=new O;d.x=l.getX(h),d.y=l.getY(h),d.z=l.getZ(h);const p=this.createNormalLine(n.mesh);i.set(n.index,{value:this.getShortendKPValue(a),distance:a,point:d,normal:p})}else{const o=n.mesh.geometry.getAttribute("position"),a=o.count-1,l=new O;l.x=o.getX(a),l.y=o.getY(a),l.z=o.getZ(a);const h=this.createNormalLine(n.mesh);i.set(n.index,{value:this.getShortendKPValue(r),distance:r,point:l,normal:h})}}return i}createNormalLine(e){const t=e.geometry.attributes.position.count-1,i=t-1,n=new O;n.x=e.geometry.attributes.position.getX(t),n.y=e.geometry.attributes.position.getY(t),n.z=e.geometry.attributes.position.getZ(t);const r=new O;r.x=e.geometry.attributes.position.getX(i),r.y=e.geometry.attributes.position.getY(i),r.z=e.geometry.attributes.position.getZ(i);const o=new O().subVectors(n,r).clone().applyAxisAngle(new O(0,0,1),Math.PI*.5).normalize(),a=new Ne().setFromPoints([o.clone().setLength(10).add(n),o.clone().setLength(-10).add(n)]);return new st(a)}generateConstantKP(e){const{alignment:t}=e.curve,i=new Map,n=t.getLength("horizontal"),r=Math.floor(n/this.divisionLength);for(let o=0;o1e3&&parseInt(i,10)<1e4){const[o,...a]=i;return`${o}+${a.join("")}.${r}`}if(parseInt(i,10)>1e4){const[o,a,...l]=i;return`${o}${a}+${l.join("")}.${r}`}return`0+${i.padStart(3,"0")}.${r}`}save(e,t){this._list.has(t)||this._list.set(t,new Set),this._list.get(t).add(e)}};x(Bm,"uuid","0af12c32-81ee-4100-a030-e9ae546f6170");let Lr=Bm;class Vm extends Re{constructor(e){super(e),x(this,"enabled",!0),x(this,"_highlighter"),x(this,"onHighlight",new ee),x(this,"onMarkerChange",new ee),x(this,"mouseMarkers"),x(this,"onMarkerHidden",new ee),x(this,"_curves",[]),x(this,"_previousAlignment",null),x(this,"_world",null),x(this,"updateLinesResolution",t=>{var i;(i=this._highlighter)==null||i.setResolution(t)}),x(this,"onMouseMove",t=>{var i,n,r;if(!this._world)throw new Error("No world was given for this navigator!");if(!this._world.renderer)return;const o=this._world.renderer.three.domElement.parentElement,a=this._world.camera.three,l=(i=this._highlighter)==null?void 0:i.castRay(t,a,o,this._curves);if(l){const{object:h}=l;(n=this._highlighter)==null||n.hover(h),this.updateMarker(l,"hover");return}this.mouseMarkers&&(this.mouseMarkers.hover.visible=!1),(r=this._highlighter)==null||r.unHover(),this.onMarkerHidden.trigger({type:"hover"})}),x(this,"onClick",t=>{var i,n;if(!this._world)throw new Error("No world was given for this navigator!");if(!this._world.renderer)return;const r=this._world.renderer.three.domElement.parentElement,o=this._world.camera.three,a=(i=this._highlighter)==null?void 0:i.castRay(t,o,r,this._curves);if(a){const l=a,h=l.object;if((n=this._highlighter)==null||n.select(h),this.updateMarker(l,"select"),this._world.camera.hasCameraControls()&&(h.geometry.boundingBox||h.geometry.computeBoundingBox(),h.geometry.boundingBox)){const d=this.getScaledBox(h.geometry.boundingBox,2);this._world.camera.controls.fitToBox(d,!0)}this.onHighlight.trigger({mesh:h,point:l.point}),this._previousAlignment!==h.curve.alignment&&(this.components.get(Lr).showKPStations(h),this._previousAlignment=h.curve.alignment)}}),x(this,"onControlsUpdated",()=>{if(!this._world)throw new Error("No world was given for this navigator!");if(!(this._world.camera.three instanceof jn)||!this._highlighter)return;const{zoom:t,left:i,right:n,top:r,bottom:o}=this._world.camera.three,a=i-n,l=r-o,h=Math.max(a,l)/t,d=40,{caster:p}=this._highlighter;p.params.Line.threshold=h/d})}get highlighter(){if(!this._highlighter)throw new Error("Highlighter not initialized. You must set a world first!");return this._highlighter}get world(){return this._world}set world(e){var t,i,n;if(e===this._world||(this._world&&this.setupEvents(!1),this._world=e,(t=this._highlighter)==null||t.dispose(),(i=this.mouseMarkers)==null||i.hover.dispose(),(n=this.mouseMarkers)==null||n.select.dispose(),!e))return;const r=e.scene.three;this._highlighter=new xm(r,this.view),this.mouseMarkers={select:this.newMouseMarker("#ffffff",e),hover:this.newMouseMarker("#575757",e)},this.setupEvents(!0)}async draw(e,t){if(!e.civilData)throw new Error("The provided model doesn't have civil data!");if(!this._world)throw new Error("No world was given for this navigator!");const{alignments:i}=e.civilData,n=t||i.values(),r=this._world.scene.three,o=new Ke;o.makeEmpty(),o.min.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),o.max.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(const l of n){if(!l)throw new Error("Alignment not found!");for(const h of l[this.view])if(r.add(h.mesh),this._curves.push(h.mesh),!o.isEmpty())o.expandByObject(h.mesh);else{h.mesh.geometry.computeBoundingBox();const d=h.mesh.geometry.boundingBox;d instanceof Ke&&o.copy(d).applyMatrix4(h.mesh.matrixWorld)}}const a=this.getScaledBox(o,1.2);this._world.camera.hasCameraControls()&&await this._world.camera.controls.fitToBox(a,!1)}async dispose(){var e;(e=this._highlighter)==null||e.dispose(),this.clear(),this.onHighlight.reset(),this._curves=[]}clear(){var e,t;(e=this._highlighter)==null||e.unSelect(),(t=this._highlighter)==null||t.unHover();for(const i of this._curves)i.removeFromParent();this._curves=[]}setMarker(e,t,i){if(!this._curves.length)return;const n=e.getCurveAt(t,this.view),r=e.getPointAt(t,this.view),{index:o}=n.curve.getSegmentAt(n.percentage);this.setMouseMarker(r,n.curve.mesh,o,i)}setDefSegments(e){const t=[],i=[],n=(r,o)=>{const a=o[1]-r[1],l=o[0]-r[0];return a/l};for(let r=0;r=0;f--)if(o[f*3]!==void 0&&o[f*3+1]!==void 0){h=o[f*3],d=o[f*3+1];break}const p=(n([a,l],[h,d])*100).toFixed(2);i.push({slope:p})}for(const r of e)for(let o=0;on.clone().add(i))}showLineInfo(e,t){const i=this.components.get(Lr);i.world=this._world,i.deleteByType(["Length","Radius"]);const n=e.geometry.attributes.position.array,r=this.calculateParallelCurve(n,n.length/3,t),o=new Ne().setFromPoints(r),a=new st(o,this.markupMaterial);i.showLineLength(a,e.curve.getLength()),this._scene.add(a),this.markupLines.push(a);const{startDimensionPoints:l,endDimensionPoints:h}=this.calculateDimensionLines(e,a),d=this.offsetDimensionLine(l,t*.1),p=this.offsetDimensionLine(h,t*.1),f=new Ne().setFromPoints(d),g=new Ne().setFromPoints(p),v=new st(f,this.markupMaterial);this._scene.add(v),this.markupLines.push(v);const b=new st(g,this.markupMaterial);this._scene.add(b),this.markupLines.push(b)}showClothoidInfo(e,t){const i=this.components.get(Lr);i.world=this._world,i.deleteByType(["Length","Radius"]);const n=e.geometry.attributes.position.array,r=this.calculateParallelCurve(n,n.length/3,t),o=new Ne().setFromPoints(r);i.showCurveLength(r,e.curve.getLength());const a=new st(o,this.markupMaterial);this._scene.add(a),this.markupLines.push(a);const{startDimensionPoints:l,endDimensionPoints:h}=this.calculateDimensionLines(e,a),d=this.offsetDimensionLine(l,t*.1),p=this.offsetDimensionLine(h,t*.1),f=new Ne().setFromPoints(d),g=new Ne().setFromPoints(p),v=new st(f,this.markupMaterial);this._scene.add(v),this.markupLines.push(v);const b=new st(g,this.markupMaterial);this._scene.add(b),this.markupLines.push(b)}showCircularArcInfo(e,t){const i=this.components.get(Lr);i.world=this._world,i.deleteByType(["Length","Radius"]);const n=e.curve.data.RADIUS,r=e.geometry.attributes.position.array,o=e.geometry.attributes.position.count,a=[],l=new O(r[0],r[1],r[2]),h=(o-1)*3,d=new O(r[h],r[h+1],r[h+2]),p=o/2*3,f=new O(r[p],r[p+1],r[p+2]),g=d.clone().sub(l).normalize(),v=new O(-g.y,g.x,0);v.multiplyScalar(n);const b=f.clone().add(v);a.push(f),a.push(b);const w=new Ne().setFromPoints(a),T=new st(w,this.markupMaterial);i.showCurveRadius(T,Math.abs(n)),this._scene.add(T),this.markupLines.push(T);const S=[];for(let ne=0;ne{!this._highlighter||!this.planHighlighter||this.planHighlighter.showCurveInfo(t)})}get world(){return super.world}set world(e){var t;super.world=e,e&&((t=this.planHighlighter)==null||t.dispose(),this.planHighlighter=new hb(this.components,e.scene.three,e))}};x(ub,"uuid","3096dea0-5bc2-41c7-abce-9089b6c9431b");const db=class Ym extends Vm{constructor(e){super(e),x(this,"view","vertical"),x(this,"enabled",!0),this.components.add(Ym.uuid,this)}get world(){return super.world}set world(e){this.world!==e&&(super.world=e,this._highlighter&&this._highlighter.onSelect.add(t=>{if(!this.world)throw new Error("A world is needed to work with this component!");const i=this.components.get(Lr);i.deleteByType(["Slope","Height","InitialKPV","FinalKPV"]);const{alignment:n}=t.curve,r=[];for(const h of n.vertical){const d=h.mesh.geometry.attributes.position.array;r.push(d)}const{defSegments:o,slope:a}=this.setDefSegments(r),l=this.world.scene.three;for(let h=0;h{var i;(i=this.highlighter)==null||i.setResolution(t)}),x(this,"onClick",t=>{if(!this.enabled||!this._highlighter)return;if(!this.world)throw new Error("No world found!");if(!this.world.renderer)return;const i=this.world.renderer.three.domElement,n=this.world.camera.three,r=this._highlighter.castRay(t,n,i,this._curves);if(r){const o=r.object;this._highlighter.select(o),this.updateMarker(r,"select");const{point:a,index:l}=r;l!==void 0&&this.onHighlight.trigger({curve:o,point:a,index:l});return}this._highlighter.unSelect(),this.mouseMarkers&&(this.mouseMarkers.hover.visible=!1),this.onMarkerHidden.trigger({type:"hover"})}),x(this,"onMouseMove",async t=>{if(!this.enabled||!this._highlighter)return;if(!this.world)throw new Error("No world found!");if(!this.world.renderer)return;const i=this.world.renderer.three.domElement,n=this.world.camera.three,r=this._highlighter.castRay(t,n,i,this._curves);if(r){this._highlighter.hover(r.object),this.updateMarker(r,"hover");return}this._highlighter.unHover()}),this.components.add(Gm.uuid,this)}get world(){return this._world}set world(e){var t,i,n;if(e===this._world||(this._world&&this.setupEvents(!1),this._world=e,(t=this._highlighter)==null||t.dispose(),(i=this.mouseMarkers)==null||i.hover.dispose(),(n=this.mouseMarkers)==null||n.select.dispose(),!e))return;const r=e.scene.three;this._highlighter=new xm(r,"absolute"),this.mouseMarkers={select:this.newMouseMarker("#ffffff",e),hover:this.newMouseMarker("#575757",e)},this.setupEvents(!0)}get highlighter(){if(!this._highlighter)throw new Error("Navigator not initialized!");return this._highlighter}draw(e){if(!e.civilData)throw new Error("Model must have civil data!");if(!this.world)throw new Error("A world must be given before drawing an alignment!");const t=this.world.scene.three;for(const[i,n]of e.civilData.alignments)for(const{mesh:r}of n.absolute)t.add(r),this._curves.push(r)}newMouseMarker(e,t){const i=t.scene.three,n=document.createElement("div");n.style.backgroundColor=e,n.style.width="1rem",n.style.height="1rem",n.style.borderRadius="1rem";const r=new _t(t,n,i);return r.visible=!1,r}setMarker(e,t,i){if(!this.mouseMarkers)throw new Error("No mouse markers found! Initialize the world before using this.");const n=e.getPointAt(t,"absolute");this.mouseMarkers[i].visible=!0,this.mouseMarkers[i].three.position.copy(n)}hideMarker(e){if(!this.mouseMarkers)throw new Error("No mouse markers found! Initialize the world before using this.");const t=this.mouseMarkers[e].three;t.visible=!1}setupEvents(e){var t,i;if(!this.world)throw new Error("No world found!");if(!this.world.renderer)return;const n=this.world.renderer.three.domElement;(t=this.world.renderer)==null||t.onResize.remove(this.updateLinesResolution),n.removeEventListener("click",this.onClick),n.removeEventListener("mousemove",this.onMouseMove),e&&(n.addEventListener("click",this.onClick),n.addEventListener("mousemove",this.onMouseMove),(i=this.world.renderer)==null||i.onResize.add(this.updateLinesResolution))}updateMarker(e,t){if(!this.mouseMarkers)return;const{point:i,object:n}=e,r=n,o=r.curve,a=r.curve.alignment,l=a.getPercentageAt(i,"absolute");this.mouseMarkers[t].visible=!0,this.mouseMarkers[t].three.position.copy(i),l!==null&&this.onMarkerChange.trigger({alignment:a,percentage:l,type:t,curve:o})}};x(pb,"uuid","0a59c09e-2b49-474a-9320-99f51f40f182");const fb=class jm extends Re{constructor(e){super(e),x(this,"world",null),x(this,"enabled",!0),x(this,"plane"),x(this,"_world3D",null),this.components.add(jm.uuid,this)}get world3D(){return this._world3D}set world3D(e){var t;if(this._world3D=e,(t=this.plane)==null||t.dispose(),!e)return;const i=this.components.get(Ga),n=i.Type;i.Type=Gr,this.plane=i.createFromNormalAndCoplanarPoint(e,new O(1,0,0),new O),i.Type=n,this.plane.visible=!1,this.plane.enabled=!1}async set(e,t){if(!this.world||!this.plane)throw new Error("You must set a world before using this component");this.plane.enabled=!0;const i=e.curve.getPercentageAt(t);if(i===null)return;const{startPoint:n,endPoint:r}=e.curve.getSegmentAt(i);if(e.geometry.index===null)throw new Error("Geometry must be indexed!");const o=new O;o.subVectors(r,n),o.normalize(),this.plane.setFromNormalAndCoplanarPoint(o,t),this.plane.edges.update();const a=this.plane.helper.matrix.clone();a.invert();const l=this.world.scene.three,h=this.plane.edges.get();for(const d in h){const{mesh:p}=h[d];p.position.set(0,0,0),p.rotation.set(0,0,0),p.updateMatrix(),p.applyMatrix4(a),p.parent!==l&&l.add(p)}this.plane.enabled=!1}};x(fb,"uuid","96b2c87e-d90b-4639-8257-8f01136fe324");function zn(){const s=document.createElement("div");return s.style.backgroundColor="black",s.style.color="white",s.style.padding="8px",s.style.borderRadius="8px",s.style.fontFamily="sans-serif",s}const yh=class Eh{constructor(e,t,i){x(this,"label"),x(this,"boundingBox",new le),x(this,"world"),x(this,"components"),x(this,"_length"),x(this,"_visible",!0),x(this,"_start"),x(this,"_end"),x(this,"_root",new Os),x(this,"_endpoints",[]),x(this,"_line"),this.components=e,this.world=t,this._start=i.start,this._end=i.end,this._length=this.getLength(),this._line=this.createLine(i),this.newEndpointElement(i.endpointElement),this.newEndpointElement(i.endpointElement.cloneNode(!0)),this.label=this.newText(),this._root.renderOrder=2,this.world.scene.three.add(this._root)}get visible(){return this._visible}set visible(e){this._visible=e,this.label.visible=e,this._endpoints[0].visible=e,this._endpoints[1].visible=e;const[t,i]=this._endpoints,n=t.three,r=i.three,o=this.label.three;e?(this.world.scene.three.add(this._root),this._root.add(o,n,r)):(o.removeFromParent(),n.removeFromParent(),r.removeFromParent(),this._root.removeFromParent())}get endPoint(){return this._end}set endPoint(e){this._end=e;const t=this._line.geometry.attributes.position;t.setXYZ(1,e.x,e.y,e.z),t.needsUpdate=!0,this._endpoints[1].three.position.copy(e),this.updateLabel()}get startPoint(){return this._start}set startPoint(e){this._start=e;const t=this._line.geometry.attributes.position;t.setXYZ(0,e.x,e.y,e.z),t.needsUpdate=!0,this._endpoints[0].three.position.copy(e),this.updateLabel()}get _center(){let e=this._end.clone().sub(this._start);const t=e.length()*.5;return e=e.normalize().multiplyScalar(t),this._start.clone().add(e)}dispose(){const e=this.components.get(Fi);this.visible=!1,e.destroy(this._root),e.destroy(this._line);for(const t of this._endpoints)t.dispose();this._endpoints.length=0,this.label.dispose(),this.boundingBox&&e.destroy(this.boundingBox),this.components=null}createBoundingBox(){this.boundingBox.geometry=new ut(1,1,this._length),this.boundingBox.position.copy(this._center),this.boundingBox.lookAt(this._end),this.boundingBox.visible=!1,this._root.add(this.boundingBox)}toggleLabel(){this.label.toggleVisibility()}newEndpointElement(e){const t=this._endpoints.length===0?this._start:this._end,i=new _t(this.world,e);i.three.position.copy(t),this._endpoints.push(i),this._root.add(i.three)}updateLabel(){this._length=this.getLength(),this.label.three.element.textContent=this.getTextContent(),this.label.three.position.copy(this._center),this._line.computeLineDistances()}createLine(e){const t=new Ne;t.setFromPoints([e.start,e.end]);const i=new st(t,e.lineMaterial);return this._root.add(i),i}newText(){const e=zn();e.textContent=this.getTextContent();const t=new _t(this.world,e);return t.three.position.copy(this._center),this._root.add(t.three),t}getTextContent(){return`${this._length/Eh.scale} ${Eh.units}`}getLength(){return parseFloat(this._start.distanceTo(this._end).toFixed(2))}};x(yh,"scale",1),x(yh,"units","m");let au=yh;class mb{constructor(e,t,i){x(this,"enabled",!0),x(this,"visible",!0),x(this,"points",[]),x(this,"workingPlane",null),x(this,"labelMarker"),x(this,"world"),x(this,"components"),x(this,"onDisposed",new ee),x(this,"_rotationMatrix",null),x(this,"_dimensionLines",[]),x(this,"_defaultLineMaterial",new Di({color:"red"})),x(this,"onAreaComputed",new ee),x(this,"onWorkingPlaneComputed",new ee),x(this,"onPointAdded",new ee),x(this,"onPointRemoved",new ee),this.world=t,this.components=e;const n=zn();this.labelMarker=new _t(t,n),this.labelMarker.visible=!1,this.onPointAdded.add(r=>{this.points.length===3&&!this._dimensionLines[2]&&(this.addDimensionLine(r,this.points[0]),this.labelMarker.visible=!0)}),i==null||i.forEach(r=>this.setPoint(r))}setPoint(e,t){let i;if(t?i=t:i=this.points.length===0?0:this.points.length,i===0){this.points[0]=e;return}if(i<0||i>this.points.length)return;const n=this.points.length>i;this.points[i]=e,this.onPointAdded.trigger(e),n||this.addDimensionLine(this.points[i-1],e);const{previousLine:r,nextLine:o}=this.getLinesBetweenIndex(i);r&&(r.endPoint=e),o&&(o.startPoint=e)}removePoint(e){if(this.points.length===3)return;this.points.splice(e,1);const{previousLine:t,nextLine:i}=this.getLinesBetweenIndex(e);i&&(t.endPoint=i.endPoint),i==null||i.dispose(),this._dimensionLines.splice(e,1),this.onPointRemoved.trigger()}toggleLabel(){this.labelMarker.toggleVisibility()}addDimensionLine(e,t){const i=document.createElement("div");i.className="w-2 h-2 bg-red-600 rounded-full";const n=new au(this.components,this.world,{start:e,end:t,lineMaterial:this._defaultLineMaterial,endpointElement:i});return n.toggleLabel(),this._dimensionLines.length>1?this._dimensionLines.splice(this._dimensionLines.length-1,0,n):this._dimensionLines.push(n),n}getLinesBetweenIndex(e){const t=e===0?this._dimensionLines.length-1:e-1,i=this._dimensionLines[t],n=this._dimensionLines[e];return{previousLine:i,nextLine:n}}computeWorkingPlane(){this.workingPlane=new an().setFromCoplanarPoints(this.points[0],this.points[1],this.points[2]);const e=new O(0,1,0),t=this.workingPlane.normal.angleTo(e),i=new O().crossVectors(this.workingPlane.normal,e).normalize();this._rotationMatrix=new Ee().makeRotationAxis(i,t),this.onWorkingPlaneComputed.trigger(this.workingPlane)}computeArea(){if(!(this._rotationMatrix&&this.workingPlane))return this.onAreaComputed.trigger(0),0;let e=0,t=0;const i=this._rotationMatrix,n=this.points.map(o=>{const a=o.clone().applyMatrix4(i),l=new Ve(a.x,a.z);return e+=l.x,t+=l.y,l}),r=Math.abs(Rv.area(n));return this.labelMarker.three.element.textContent=`${r.toFixed(2)} m²`,this.labelMarker.three.position.set(e/n.length,-this.workingPlane.constant,t/n.length).applyMatrix4(i.clone().invert()),this.onAreaComputed.trigger(r),r}dispose(){this.onAreaComputed.reset(),this.onWorkingPlaneComputed.reset(),this.onPointAdded.reset(),this.onPointRemoved.reset();for(const e of this._dimensionLines)e.dispose();this.labelMarker.dispose(),this._dimensionLines=[],this.points=[],this._rotationMatrix=null,this.workingPlane=null,this._defaultLineMaterial.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return{points:this.points,workingPlane:this.workingPlane,area:this.computeArea()}}}let lu=class extends x1{constructor(){super(...arguments),x(this,"onDisposed",new ee),x(this,"marker",null)}dispose(){this.marker&&this.marker.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(e){const t=super.get(e);return t?(this.marker||(this.marker=new _t(e)),this.marker.world!==e&&(this.marker.world=e,this.marker.three.removeFromParent(),e.scene.three.add(this.marker.three)),this.marker.visible=!0,this.marker.three.position.copy(t)):this.marker&&(this.marker.visible=!1),t}};const gb=class bh extends Re{constructor(e){super(e),x(this,"onDisposed",new ee),x(this,"list",[]),x(this,"world"),x(this,"_enabled",!1),x(this,"_vertexPicker"),x(this,"_currentAreaElement",null),x(this,"_clickCount",0),x(this,"create",()=>{if(!this.enabled)return;if(!this.world)throw new Error("World not defined for the area measurement!");const t=this._vertexPicker.get(this.world);if(t){if(!this._currentAreaElement){const i=new mb(this.components,this.world);i.onPointAdded.add(()=>{this._clickCount===3&&!i.workingPlane&&(i.computeWorkingPlane(),this._vertexPicker.workingPlane=i.workingPlane)}),i.onPointRemoved.add(()=>this._clickCount--),this._currentAreaElement=i}this._currentAreaElement.setPoint(t,this._clickCount),this._currentAreaElement.computeArea(),this._clickCount++}}),x(this,"onMouseMove",()=>{if(!this.world){console.log("No world given for the area measurement!");return}const t=this._vertexPicker.get(this.world);t&&this._currentAreaElement&&(this._currentAreaElement.setPoint(t,this._clickCount),this._currentAreaElement.computeArea())}),x(this,"onKeydown",t=>{this.enabled&&(t.key==="z"&&t.ctrlKey&&this._currentAreaElement&&this._currentAreaElement.removePoint(this._clickCount-1),t.key==="Enter"&&this._currentAreaElement&&this.endCreation(),t.key==="Escape"&&(this._clickCount===0&&!this._currentAreaElement?this.enabled=!1:this.cancelCreation()))}),this.components.add(bh.uuid,this),this._vertexPicker=new lu(e)}set enabled(e){this._enabled=e,this._vertexPicker.enabled=e,this.setupEvents(e),e||this.cancelCreation()}get enabled(){return this._enabled}set workingPlane(e){this._vertexPicker.workingPlane=e}get workingPlane(){return this._vertexPicker.workingPlane}dispose(){this.setupEvents(!1),this._vertexPicker.dispose(),this._currentAreaElement&&this._currentAreaElement.dispose();for(const e of this.list)e.dispose();this.components=null,this.onDisposed.trigger(bh.uuid),this.onDisposed.reset()}delete(){}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}endCreation(){this._currentAreaElement&&(this.list.push(this._currentAreaElement),this._currentAreaElement.removePoint(this._clickCount),this._currentAreaElement.computeWorkingPlane(),this._currentAreaElement.computeArea(),this._currentAreaElement=null),this._vertexPicker.workingPlane=null,this._clickCount=0}cancelCreation(){this._currentAreaElement&&(this._currentAreaElement.dispose(),this._currentAreaElement=null),this._vertexPicker.workingPlane=null,this._clickCount=0}setupEvents(e){if(!this.world)throw new Error("The area measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the area measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;e?(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown)):(t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown))}};x(gb,"uuid","c453a99e-f054-4781-9060-33df617db4a5");class vb{constructor(e,t){x(this,"enabled",!0),x(this,"visible",!0),x(this,"points",[]),x(this,"world"),x(this,"onDisposed",new ee),x(this,"_lineMaterial",new ro({color:6629591,linewidth:2})),x(this,"_lineGeometry",new Wa),x(this,"_line",new Im(this._lineGeometry,this._lineMaterial)),x(this,"_labelMarker"),x(this,"onAngleComputed",new ee),x(this,"onPointAdded",new ee),this.world=e;const i=zn();this._labelMarker=new _t(e,i),this.labelMarker.visible=!0,this.onPointAdded.add(()=>{this.points.length===1&&e.scene.three.add(this._line),this.points.length===3&&(this.labelMarker.visible=!0)}),this.onAngleComputed.add(n=>{this.labelMarker.three.element.textContent=`${n.toFixed(2)}°`,this.labelMarker.three.position.copy(this.points[1]??new O)}),t==null||t.forEach(n=>this.setPoint(n))}set lineMaterial(e){this._lineMaterial.dispose(),this._lineMaterial=e,this._line.material=e,this._lineMaterial.resolution.set(window.innerWidth,window.innerHeight)}get lineMaterial(){return this._lineMaterial}set labelMarker(e){this._labelMarker.dispose(),this._labelMarker=e}get labelMarker(){return this._labelMarker}get angle(){return{points:this.points,angle:this.computeAngle()}}setPoint(e,t){let i;if(t?i=t:i=this.points.length===0?0:this.points.length,![0,1,2].includes(i))return;this.points[i]=e,this.onPointAdded.trigger(e);const n=this.points.map(r=>[r.x,r.y,r.z]);this._lineGeometry.setPositions(n.flat())}toggleLabel(){this.labelMarker.toggleVisibility()}computeAngle(){const e=this.points[0],t=this.points[1],i=this.points[2];if(!(e&&t&&i))return 0;const n=new O().subVectors(t,e),r=new O().subVectors(t,i),o=so.radToDeg(n.angleTo(r));return this.onAngleComputed.trigger(o),o}dispose(){this.points=[],this.labelMarker.dispose(),this.onAngleComputed.reset(),this.onPointAdded.reset(),this.labelMarker.dispose(),this._line.removeFromParent(),this._lineMaterial.dispose(),this._lineGeometry.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}}const yb=class wh extends Re{constructor(e){super(e),x(this,"onDisposed",new ee),x(this,"world"),x(this,"list",[]),x(this,"_lineMaterial"),x(this,"_enabled",!1),x(this,"_vertexPicker"),x(this,"_currentAngleElement",null),x(this,"_clickCount",0),x(this,"create",()=>{if(!this.enabled)return;if(!this.world){console.log("No world selected for angle measurement!");return}const t=this._vertexPicker.get(this.world);if(t){if(!this._currentAngleElement){const i=new vb(this.world);i.lineMaterial=this.lineMaterial,this._currentAngleElement=i}this._currentAngleElement.setPoint(t,this._clickCount),this._currentAngleElement.setPoint(t,this._clickCount+1),this._currentAngleElement.setPoint(t,this._clickCount+2),this._currentAngleElement.computeAngle(),this._clickCount++,this._clickCount===3&&this.endCreation()}}),x(this,"onMouseMove",()=>{if(!this.world){console.log("No world selected for angle measurement!");return}const t=this._vertexPicker.get(this.world);t&&this._currentAngleElement&&(this._currentAngleElement.setPoint(t,this._clickCount),this._currentAngleElement.computeAngle())}),x(this,"onKeyDown",t=>{this.enabled&&(t.key==="z"&&t.ctrlKey&&this._currentAngleElement,t.key==="Escape"&&(this._clickCount===0&&!this._currentAngleElement?this.enabled=!1:this.cancelCreation()))}),this.components.add(wh.uuid,this),this._vertexPicker=new lu(e),this._lineMaterial=new ro({color:6629591,linewidth:2})}set lineMaterial(e){this._lineMaterial.dispose(),this._lineMaterial=e,this._lineMaterial.resolution.set(window.innerWidth,window.innerHeight)}get lineMaterial(){return this._lineMaterial}set enabled(e){this._enabled=e,this.setupEvents(e),this._vertexPicker.enabled=e,e||this.cancelCreation()}get enabled(){return this._enabled}set workingPlane(e){this._vertexPicker.workingPlane=e}get workingPlane(){return this._vertexPicker.workingPlane}dispose(){this.setupEvents(!1),this._lineMaterial.dispose(),this._vertexPicker.dispose();for(const e of this.list)e.dispose();this._currentAngleElement&&this._currentAngleElement.dispose(),this.components=null,this.onDisposed.trigger(wh.uuid),this.onDisposed.reset()}delete(){}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}endCreation(){this._currentAngleElement&&(this.list.push(this._currentAngleElement),this._currentAngleElement.computeAngle(),this._currentAngleElement=null),this._clickCount=0}cancelCreation(){this._currentAngleElement&&(this._currentAngleElement.dispose(),this._currentAngleElement=null),this._clickCount=0}setupEvents(e){if(!this.world)throw new Error("No world selected for angle measurement!");if(!this.world.renderer)throw new Error("The given world doesn't have a renderer!");const t=this.world.renderer.three.domElement.parentElement;e?(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeyDown)):(t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeyDown))}};x(yb,"uuid","622fb2c9-528c-4b0a-8a0e-6a1375f0a3aa");const Wm=class Ih extends Re{constructor(e){super(e),x(this,"onDisposed",new ee),x(this,"onBeforeUpdate",new ee),x(this,"onAfterUpdate",new ee),x(this,"snapDistance",.25),x(this,"_vertexPicker"),x(this,"_lineMaterial",new Di({color:"#DC2626",linewidth:2,depthTest:!1})),x(this,"list",[]),x(this,"world"),x(this,"_visible",!0),x(this,"_enabled",!1),x(this,"_temp",{isDragging:!1,start:new O,end:new O,dimension:void 0}),x(this,"create",t=>{const i=t instanceof kn?t:void 0;if(this._enabled){if(!this._temp.isDragging){this.drawStart(i);return}this.endCreation()}}),x(this,"onMouseMove",()=>{this.world&&this._vertexPicker.get(this.world)}),this.components.add(Ih.uuid,this),this._vertexPicker=new lu(e,{previewElement:zn(),snapDistance:this.snapDistance})}get enabled(){return this._enabled}set enabled(e){e||this.cancelCreation(),this._enabled=e,this._vertexPicker.enabled=e,this.setupEvents(e)}get visible(){return this._visible}set visible(e){this._visible=e;for(const t of this.list)t.visible=e}get color(){return this._lineMaterial.color}set color(e){this._lineMaterial.color=e}dispose(){this.setupEvents(!1),this.enabled=!1;for(const e of this.list)e.dispose();this._lineMaterial.dispose(),this.list=[],this._vertexPicker.dispose(),this.onDisposed.trigger(Ih.uuid),this.onDisposed.reset()}async update(e){this._enabled&&this._temp.isDragging&&this.drawInProcess()}createOnPoints(e,t){const i=this.drawDimension();i.startPoint=e,i.endPoint=t,i.createBoundingBox(),this.list.push(i)}delete(){if(!this.world)throw new Error("World is needed for Length Measurement!");if(!this._enabled||this.list.length===0)return;const e=this.getBoundingBoxes(),t=this.components.get(ni).get(this.world).castRay(e);if(!t)return;const i=this.list.find(n=>n.boundingBox===t.object);if(i){const n=this.list.indexOf(i);this.list.splice(n,1),i.dispose()}}async deleteMeasurement(e){if(e){const t=this.list.indexOf(e);this.list.splice(t,1),e.dispose()}}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}cancelCreation(){var e;this._temp.dimension&&(this._temp.isDragging=!1,(e=this._temp.dimension)==null||e.dispose(),this._temp.dimension=void 0)}drawStart(e){if(!this.world)throw new Error("The length measurement needs a world to work!");const t=e?[e]:void 0,i=this.components.get(ni).get(this.world).castRay(t),n=this._vertexPicker.get(this.world);i&&n&&(this._temp.isDragging=!0,this._temp.start=e?i.point:n)}drawInProcess(){if(!this.world)throw new Error("The length measurement needs a world to work!");if(!this.components.get(ni).get(this.world).castRay())return;const e=this._vertexPicker.get(this.world);e&&(this._temp.end=e,this._temp.dimension||(this._temp.dimension=this.drawDimension()),this._temp.dimension.endPoint=this._temp.end)}endCreation(){this._temp.dimension&&(this._temp.dimension.createBoundingBox(),this.list.push(this._temp.dimension),this._temp.dimension=void 0,this._temp.isDragging=!1)}drawDimension(){if(!this.world)throw new Error("The length measurement needs a world to work!");return new au(this.components,this.world,{start:this._temp.start,end:this._temp.end,lineMaterial:this._lineMaterial,endpointElement:zn()})}getBoundingBoxes(){return this.list.map(e=>e.boundingBox).filter(e=>e!==void 0)}setupEvents(e){if(!this.world)throw new Error("The length measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the length measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;t&&(t.removeEventListener("click",this.create),e&&t.addEventListener("mousemove",this.onMouseMove))}};x(Wm,"uuid","2f9bcacf-18a9-4be6-a293-e898eae64ea1");let _r=Wm;const Eb=class Xm extends Re{constructor(e){super(e),x(this,"label",null),x(this,"world"),x(this,"onVolumeFound",new ee),x(this,"_enabled",!1),x(this,"onDisposed",new ee),x(this,"create",()=>{if(!this.enabled)return;if(!this.world)throw new Error("World is needed for Volume Measurement!");const t=this.components.get(ni).get(this.world).castRay();if(!t||!t.object)return;const{object:i}=t;if(i instanceof le){const n=this.getVolumeOfMesh(i);this.onVolumeFound.trigger(n)}}),x(this,"onMouseMove",()=>{}),x(this,"onKeydown",t=>{}),this.components.add(Xm.uuid,this)}set enabled(e){this._enabled=e,this.setupEvents(e),e||this.cancelCreation()}get enabled(){return this._enabled}async dispose(){var e;this.setupEvents(!1),(e=this.label)==null||e.dispose(),this.onDisposed.trigger(),this.onDisposed.reset(),this.components=null}delete(){}async deleteAll(){}endCreation(){}cancelCreation(){}get(){}getVolumeFromFragments(e){const t=this.components.get(rt),i=new Ee,n=[];for(const r in e){const o=t.list.get(r);if(!o)continue;const a=e[r];let l=0;for(const p of a){const f=o.getInstancesIDs(p);f&&(l+=f.size)}const h=new Kt(o.mesh.geometry,void 0,l);let d=0;for(const p of a){const f=o.getInstancesIDs(p);if(f)for(const g of f)o.mesh.getMatrixAt(g,i),h.setMatrixAt(d++,i)}n.push(h)}return this.getVolumeFromMeshes(n)}getVolumeFromMeshes(e){if(!this.world)throw new Error("World is needed for Volume Measurement!");this.label||(this.label=this.newLabel(),this.label.three.removeFromParent());let t=0;for(const l of e)t+=this.getVolumeOfMesh(l);const i=this.world.scene.three,n=this.label.three;i.add(n);const r=this.components.get(tm);for(const l of e)l.geometry.computeBoundingSphere(),r.addMesh(l);const o=r.getSphere();r.reset(),n.position.copy(o.center);const a=Math.trunc(t*100)/100;return n.element.textContent=a.toString(),t}newLabel(){if(!this.world)throw new Error("World is needed for Volume Measurement!");const e=zn();return new _t(this.world,e)}setupEvents(e){if(!this.world)throw new Error("The volume measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the volume measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;e?(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown)):(t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown))}getVolumeOfMesh(e){let t=0;const i=new O,n=new O,r=new O,{index:o}=e.geometry,a=e.geometry.attributes.position.array;if(!o)return console.warn("Geometry must be indexed to compute its volume!"),0;const l=[];if(e instanceof Kt)for(let d=0;d{if(!this.world)throw new Error("No world given to the face measurement!");if(!this.enabled||!this._currentSelelection)return;const t=this.world.scene.three,i=new Ne,n=new le(i,this.selectionMaterial);i.setAttribute("position",this.preview.geometry.attributes.position),t.add(n),i.computeBoundingSphere();const{area:r,perimeter:o}=this._currentSelelection,a=this.newLabel(i,r);n.add(a.three),this.selection.push({area:r,perimeter:o,mesh:n,label:a})}),x(this,"onMouseMove",()=>{if(!this.world)throw new Error("The face measurement needs a world to work!");if(!this.enabled){this.unselect();return}const t=this.components.get(ni).get(this.world).castRay();if(!t||!t.object||t.faceIndex===void 0){this.unselect();return}const{object:i,faceIndex:n}=t;i instanceof le||i instanceof Kt?this.updateSelection(i,n,t.instanceId):this.unselect()}),x(this,"onKeydown",t=>{}),this.components.add(Km.uuid,this),this.preview.frustumCulled=!1}set enabled(e){if(!this.world)throw new Error("No world given for the Face measurement!");this._enabled=e,this.setupEvents(e),e?this.world.scene.three.add(this.preview):(this.preview.removeFromParent(),this.cancelCreation()),this.setVisibility(e)}get enabled(){return this._enabled}dispose(){this.setupEvents(!1),this.deleteAll(),this.preview.removeFromParent(),this.preview.material.dispose(),this.preview.geometry.dispose(),this.selectionMaterial.dispose(),this.onDisposed.trigger(),this.onDisposed.reset(),this.components=null}delete(){if(!this.world)throw new Error("No world given to the face measurement!");const e=this.selection.map(r=>r.mesh),t=this.components.get(ni).get(this.world).castRay(e);if(!t||!t.object)return;const i=this.selection.find(r=>r.mesh===t.object);if(!i)return;i.mesh.removeFromParent(),i.mesh.geometry.dispose(),i.label.dispose();const n=this.selection.indexOf(i);this.selection.splice(n,1)}deleteAll(){for(const e of this.selection)e.mesh.removeFromParent(),e.mesh.geometry.dispose(),e.label.dispose();this.selection=[]}endCreation(){}cancelCreation(){}get(){const e=[];for(const t of this.selection){const i=t.mesh.geometry,{area:n,perimeter:r}=t,o=i.attributes.position.array;e.push({position:o,area:n,perimeter:r})}return e}set(e){if(!this.world)throw new Error("No world given to the face measurement!");const t=this.world.scene.three;for(const i of e){const n=new Ne,r=new le(n,this.selectionMaterial);t.add(r);const o=new gt(i.position,3);n.setAttribute("position",o),n.computeBoundingSphere();const{area:a,perimeter:l}=i,h=this.newLabel(n,a);r.add(h.three),this.selection.push({area:a,perimeter:l,mesh:r,label:h})}}setupEvents(e){if(!this.world)throw new Error("The face measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the face measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown),e&&(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown))}setVisibility(e){if(!this.world)throw new Error("The face measurement needs a world to work!");const t=this.world.scene.three;for(const i of this.selection){const n=i.label.three;e?(t.add(i.mesh),i.mesh.add(n)):(i.mesh.removeFromParent(),n.removeFromParent())}}unselect(){this.preview.removeFromParent(),this._currentSelelection=null}updateSelection(e,t,i){if(!this.world)throw new Error("The face measurement needs a world to work!");this.world.scene.three.add(this.preview);const n=this.components.get(ja).getFace(e,t,i);if(n===null)return;const r=this.regenerateHighlight(e,n.indices,i);let o=0;for(const{distance:a}of n.edges)o+=a;this._currentSelelection={perimeter:o,area:r}}newLabel(e,t){if(!e.boundingSphere)throw new Error("Error computing area geometry");if(!this.world)throw new Error("The face measurement needs a world to work!");const{center:i}=e.boundingSphere,n=zn(),r=Math.trunc(t*100)/100;n.textContent=r.toString();const o=new _t(this.world,n);return o.three.position.copy(i),o}regenerateHighlight(e,t,i){const n=[],r=[];let o=0,a=0;const l=new On,h=this.components.get(ja);for(const f of t){const{p1:g,p2:v,p3:b}=h.getVerticesAndNormal(e,f,i);n.push(g.x,g.y,g.z),n.push(v.x,v.y,v.z),n.push(b.x,b.y,b.z),l.set(g,v,b),a+=l.getArea(),r.push(o,o+1,o+2),o+=3}const d=new Float32Array(n),p=new gt(d,3);return this.preview.geometry.setAttribute("position",p),this.preview.geometry.setIndex(r),a}};x(bb,"uuid","30279548-1309-44f6-aa97-ce26eed73522");const wb=class Qm extends Re{constructor(e){super(e),x(this,"preview"),x(this,"tolerance",.3),x(this,"world"),x(this,"onDisposed",new ee),x(this,"_enabled",!1),x(this,"_lineMaterial",new Di({color:"#DC2626",linewidth:2,depthTest:!1,transparent:!0})),x(this,"create",async()=>{if(!this.preview||!this.enabled||!this.preview.visible)return;const t=this.components.get(_r);t.world=this.world;const i=this.preview.startPoint.clone(),n=this.preview.endPoint.clone();t.createOnPoints(i,n)}),x(this,"onMouseMove",()=>{if(!this.preview)return;if(!this.world)throw new Error("The edge measurement needs a world to work!");if(!this.enabled){this.preview.visible=!1;return}const t=this.components.get(ni).get(this.world).castRay();if(!t||!t.object){this.preview.visible=!1;return}const{object:i,faceIndex:n,point:r}=t;if(n===void 0){this.preview.visible=!1;return}i instanceof le||i instanceof Kt?this.updateSelection(i,r,n,t.instanceId):this.preview.visible=!1}),x(this,"onKeydown",t=>{}),this.components.add(Qm.uuid,this)}set enabled(e){if(this._enabled=e,this.setupEvents(e),e){if(!this.world)throw new Error("The edge measurement needs a world to work!");if(!this.preview){const t=document.createElement("div");t.className="w-2 h-2 bg-red-600 rounded-full",this.preview=new au(this.components,this.world,{start:new O,end:new O,lineMaterial:this._lineMaterial,endpointElement:t}),this.preview.visible=!1}}else this.cancelCreation()}get enabled(){return this._enabled}dispose(){this.preview&&this.preview.dispose(),this._lineMaterial.dispose(),this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset(),this.components=null}delete(){if(!this.enabled)return;const e=this.components.get(_r),t=e.enabled;e.enabled=!0,e.delete(),e.enabled=t}deleteAll(){this.components.get(_r).deleteAll()}endCreation(){}cancelCreation(){}get(){const e=this.components.get(_r).list,t=[];for(const i of e){const n=i.startPoint,r=i.endPoint,o=[n.x,n.y,n.z,r.x,r.y,r.z];t.push(o)}return t}set(e){const t=this.components.get(_r);t.world=this.world;for(const i of e){const[n,r,o,a,l,h]=i,d=new O(n,r,o),p=new O(a,l,h);t.createOnPoints(d,p)}}setupEvents(e){if(!this.world)throw new Error("The edge measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the edge measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;e?(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown)):(t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown))}updateSelection(e,t,i,n){if(!this.preview||!e.geometry.index)return;const r=this.components.get(ja).getFace(e,i,n);if(!r)return;const{edges:o}=r;let a=Number.MAX_VALUE,l=[];for(const p of o){const[f,g]=p.points,v=ja.distanceFromPointToLine(t,f,g,!0);v{const o=r.data.colors,a={},l={},h={},d={},p=performance.now();let f=!1;const g=new Set(this._foundGeometries);for(const[v,b]of o){const w=this._geometries.get(v);if(!w)continue;const T=b>this.threshold,{exists:S}=w;if(!T&&!S)continue;const _=this._indexModelID.get(w.modelIndex);g.delete(v),T&&S?(w.time=p,d[_]||(d[_]=new Set),d[_].add(w.geometryID),this._foundGeometries.add(v),f=!0):T&&!S?(a[_]||(a[_]=new Map),w.time=p,w.exists=!0,a[_].has(b)||a[_].set(b,new Set),a[_].get(b).add(w.geometryID),this._foundGeometries.add(v),f=!0):!T&&S&&(this.handleLostGeometries(p,v,w,l,h),f=!0)}f&&await this.onViewUpdated.trigger({toLoad:a,toRemove:l,toHide:h,toShow:d}),this._isWorkerBusy=!1}),this.updateInterval=500,this._geometry=new ut(1,1,1),this._geometry.groups=[],this._geometry.deleteAttribute("uv");const n=this._geometry.attributes.position.array;for(let r=0;rparseInt(f,10)),p=[];for(const f of i.ids){const g=i.get(f);if(!g.colors)throw new Error("Malformed fragments!");for(const v of g.colors)v.setRGB(l/255,h/255,d/255,"srgb");p.push(g)}a.fragment.add(p),Si.enabled=n,this.needsUpdate=!0}removeFragment(e,t){const i=this._modelIDIndex.get(e),n=this.codes.get(i).get(t),r=this._geometries.get(n);if(r.hidden||this.setGeometryVisibility(r,!0,!1),r.fragment){const{fragment:o}=r;o.dispose(!1),r.fragment=void 0}}setModelTransformation(e,t){const i=this._modelIDIndex.get(e);if(i===void 0)throw new Error("Model not found!");const n=this.boxes.get(i);n&&(n.mesh.position.set(0,0,0),n.mesh.rotation.set(0,0,0),n.mesh.scale.set(1,1,1),n.mesh.applyMatrix4(t));const r=this._geometriesGroups.get(i);r&&(r.position.set(0,0,0),r.rotation.set(0,0,0),r.scale.set(1,1,1),r.applyMatrix4(t))}setVisibility(e,t,i){const n=this._modelIDIndex.get(t);if(n!==void 0)for(const[r,o]of i){const a=this.codes.get(n);if(a===void 0)throw new Error("Map not found!");const l=a.get(r),h=this._geometries.get(l);if(h===void 0)throw new Error("Geometry not found!");h.hidden=!e,this.setGeometryVisibility(h,e,!0,o)}}setGeometryVisibility(e,t,i,n){const{modelIndex:r,geometryID:o,assetIDs:a}=e,l=this.boxes.get(r);if(l===void 0)throw new Error("Model not found!");const h=n||a;if(i&&e.fragment)e.fragment.setVisibility(t,h);else{const d=new Set;for(const p of h){const f=this.getInstanceID(p,o);d.add(f)}l.setVisibility(t,d)}}handleLostGeometries(e,t,i,n,r){const o=this._indexModelID.get(i.modelIndex),a=e-i.time;a>this.maxLostTime?(n[o]||(n[o]=new Set),i.exists=!1,n[o].add(i.geometryID),this._foundGeometries.delete(t)):a>this.maxHiddenTime&&(r[o]||(r[o]=new Set),r[o].add(i.geometryID))}createModelIndex(e){if(this._modelIDIndex.has(e))throw new Error("Can't load the same model twice!");const t=this._nextModelID;return this._nextModelID++,this._modelIDIndex.set(e,t),this._indexModelID.set(t,e),t}getInstanceID(e,t){const i=10**(Math.log(t)*Math.LOG10E+1|0);return e+t/i}}var Zm={exports:{}};(function(s,e){(function(t,i){s.exports=i()})(np,function(){var t=function(c,u){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,y){m.__proto__=y}||function(m,y){for(var E in y)Object.prototype.hasOwnProperty.call(y,E)&&(m[E]=y[E])})(c,u)},i=function(){return(i=Object.assign||function(c){for(var u,m=1,y=arguments.length;m"u"||r.Promise||(r.Promise=Promise);var h=Object.getPrototypeOf,d={}.hasOwnProperty;function p(c,u){return d.call(c,u)}function f(c,u){typeof u=="function"&&(u=u(h(c))),(typeof Reflect>"u"?o:Reflect.ownKeys)(u).forEach(function(m){v(c,m,u[m])})}var g=Object.defineProperty;function v(c,u,m,y){g(c,u,l(m&&p(m,"get")&&typeof m.get=="function"?{get:m.get,set:m.set,configurable:!0}:{value:m,configurable:!0,writable:!0},y))}function b(c){return{from:function(u){return c.prototype=Object.create(u.prototype),v(c.prototype,"constructor",c),{extend:f.bind(null,c.prototype)}}}}var w=Object.getOwnPropertyDescriptor,T=[].slice;function S(c,u,m){return T.call(c,u,m)}function _(c,u){return u(c)}function I(c){if(!c)throw new Error("Assertion Failed")}function P(c){r.setImmediate?setImmediate(c):setTimeout(c,0)}function M(c,u){if(typeof u=="string"&&p(c,u))return c[u];if(!u)return c;if(typeof u!="string"){for(var m=[],y=0,E=u.length;y0){const o=n.index-1,a=i.get(o).distance+r,l=n.mesh.geometry.getAttribute("position"),h=l.count-1,d=new O;d.x=l.getX(h),d.y=l.getY(h),d.z=l.getZ(h);const p=this.createNormalLine(n.mesh);i.set(n.index,{value:this.getShortendKPValue(a),distance:a,point:d,normal:p})}else{const o=n.mesh.geometry.getAttribute("position"),a=o.count-1,l=new O;l.x=o.getX(a),l.y=o.getY(a),l.z=o.getZ(a);const h=this.createNormalLine(n.mesh);i.set(n.index,{value:this.getShortendKPValue(r),distance:r,point:l,normal:h})}}return i}createNormalLine(e){const t=e.geometry.attributes.position.count-1,i=t-1,n=new O;n.x=e.geometry.attributes.position.getX(t),n.y=e.geometry.attributes.position.getY(t),n.z=e.geometry.attributes.position.getZ(t);const r=new O;r.x=e.geometry.attributes.position.getX(i),r.y=e.geometry.attributes.position.getY(i),r.z=e.geometry.attributes.position.getZ(i);const o=new O().subVectors(n,r).clone().applyAxisAngle(new O(0,0,1),Math.PI*.5).normalize(),a=new Ne().setFromPoints([o.clone().setLength(10).add(n),o.clone().setLength(-10).add(n)]);return new st(a)}generateConstantKP(e){const{alignment:t}=e.curve,i=new Map,n=t.getLength("horizontal"),r=Math.floor(n/this.divisionLength);for(let o=0;o1e3&&parseInt(i,10)<1e4){const[o,...a]=i;return`${o}+${a.join("")}.${r}`}if(parseInt(i,10)>1e4){const[o,a,...l]=i;return`${o}${a}+${l.join("")}.${r}`}return`0+${i.padStart(3,"0")}.${r}`}save(e,t){this._list.has(t)||this._list.set(t,new Set),this._list.get(t).add(e)}};x(Bm,"uuid","0af12c32-81ee-4100-a030-e9ae546f6170");let Lr=Bm;class Vm extends Re{constructor(e){super(e),x(this,"enabled",!0),x(this,"_highlighter"),x(this,"onHighlight",new $),x(this,"onMarkerChange",new $),x(this,"mouseMarkers"),x(this,"onMarkerHidden",new $),x(this,"_curves",[]),x(this,"_previousAlignment",null),x(this,"_world",null),x(this,"updateLinesResolution",t=>{var i;(i=this._highlighter)==null||i.setResolution(t)}),x(this,"onMouseMove",t=>{var i,n,r;if(!this._world)throw new Error("No world was given for this navigator!");if(!this._world.renderer)return;const o=this._world.renderer.three.domElement.parentElement,a=this._world.camera.three,l=(i=this._highlighter)==null?void 0:i.castRay(t,a,o,this._curves);if(l){const{object:h}=l;(n=this._highlighter)==null||n.hover(h),this.updateMarker(l,"hover");return}this.mouseMarkers&&(this.mouseMarkers.hover.visible=!1),(r=this._highlighter)==null||r.unHover(),this.onMarkerHidden.trigger({type:"hover"})}),x(this,"onClick",t=>{var i,n;if(!this._world)throw new Error("No world was given for this navigator!");if(!this._world.renderer)return;const r=this._world.renderer.three.domElement.parentElement,o=this._world.camera.three,a=(i=this._highlighter)==null?void 0:i.castRay(t,o,r,this._curves);if(a){const l=a,h=l.object;if((n=this._highlighter)==null||n.select(h),this.updateMarker(l,"select"),this._world.camera.hasCameraControls()&&(h.geometry.boundingBox||h.geometry.computeBoundingBox(),h.geometry.boundingBox)){const d=this.getScaledBox(h.geometry.boundingBox,2);this._world.camera.controls.fitToBox(d,!0)}this.onHighlight.trigger({mesh:h,point:l.point}),this._previousAlignment!==h.curve.alignment&&(this.components.get(Lr).showKPStations(h),this._previousAlignment=h.curve.alignment)}}),x(this,"onControlsUpdated",()=>{if(!this._world)throw new Error("No world was given for this navigator!");if(!(this._world.camera.three instanceof jn)||!this._highlighter)return;const{zoom:t,left:i,right:n,top:r,bottom:o}=this._world.camera.three,a=i-n,l=r-o,h=Math.max(a,l)/t,d=40,{caster:p}=this._highlighter;p.params.Line.threshold=h/d})}get highlighter(){if(!this._highlighter)throw new Error("Highlighter not initialized. You must set a world first!");return this._highlighter}get world(){return this._world}set world(e){var t,i,n;if(e===this._world||(this._world&&this.setupEvents(!1),this._world=e,(t=this._highlighter)==null||t.dispose(),(i=this.mouseMarkers)==null||i.hover.dispose(),(n=this.mouseMarkers)==null||n.select.dispose(),!e))return;const r=e.scene.three;this._highlighter=new xm(r,this.view),this.mouseMarkers={select:this.newMouseMarker("#ffffff",e),hover:this.newMouseMarker("#575757",e)},this.setupEvents(!0)}async draw(e,t){if(!e.civilData)throw new Error("The provided model doesn't have civil data!");if(!this._world)throw new Error("No world was given for this navigator!");const{alignments:i}=e.civilData,n=t||i.values(),r=this._world.scene.three,o=new Ke;o.makeEmpty(),o.min.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),o.max.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(const l of n){if(!l)throw new Error("Alignment not found!");for(const h of l[this.view])if(r.add(h.mesh),this._curves.push(h.mesh),!o.isEmpty())o.expandByObject(h.mesh);else{h.mesh.geometry.computeBoundingBox();const d=h.mesh.geometry.boundingBox;d instanceof Ke&&o.copy(d).applyMatrix4(h.mesh.matrixWorld)}}const a=this.getScaledBox(o,1.2);this._world.camera.hasCameraControls()&&await this._world.camera.controls.fitToBox(a,!1)}async dispose(){var e;(e=this._highlighter)==null||e.dispose(),this.clear(),this.onHighlight.reset(),this._curves=[]}clear(){var e,t;(e=this._highlighter)==null||e.unSelect(),(t=this._highlighter)==null||t.unHover();for(const i of this._curves)i.removeFromParent();this._curves=[]}setMarker(e,t,i){if(!this._curves.length)return;const n=e.getCurveAt(t,this.view),r=e.getPointAt(t,this.view),{index:o}=n.curve.getSegmentAt(n.percentage);this.setMouseMarker(r,n.curve.mesh,o,i)}setDefSegments(e){const t=[],i=[],n=(r,o)=>{const a=o[1]-r[1],l=o[0]-r[0];return a/l};for(let r=0;r=0;f--)if(o[f*3]!==void 0&&o[f*3+1]!==void 0){h=o[f*3],d=o[f*3+1];break}const p=(n([a,l],[h,d])*100).toFixed(2);i.push({slope:p})}for(const r of e)for(let o=0;on.clone().add(i))}showLineInfo(e,t){const i=this.components.get(Lr);i.world=this._world,i.deleteByType(["Length","Radius"]);const n=e.geometry.attributes.position.array,r=this.calculateParallelCurve(n,n.length/3,t),o=new Ne().setFromPoints(r),a=new st(o,this.markupMaterial);i.showLineLength(a,e.curve.getLength()),this._scene.add(a),this.markupLines.push(a);const{startDimensionPoints:l,endDimensionPoints:h}=this.calculateDimensionLines(e,a),d=this.offsetDimensionLine(l,t*.1),p=this.offsetDimensionLine(h,t*.1),f=new Ne().setFromPoints(d),g=new Ne().setFromPoints(p),v=new st(f,this.markupMaterial);this._scene.add(v),this.markupLines.push(v);const b=new st(g,this.markupMaterial);this._scene.add(b),this.markupLines.push(b)}showClothoidInfo(e,t){const i=this.components.get(Lr);i.world=this._world,i.deleteByType(["Length","Radius"]);const n=e.geometry.attributes.position.array,r=this.calculateParallelCurve(n,n.length/3,t),o=new Ne().setFromPoints(r);i.showCurveLength(r,e.curve.getLength());const a=new st(o,this.markupMaterial);this._scene.add(a),this.markupLines.push(a);const{startDimensionPoints:l,endDimensionPoints:h}=this.calculateDimensionLines(e,a),d=this.offsetDimensionLine(l,t*.1),p=this.offsetDimensionLine(h,t*.1),f=new Ne().setFromPoints(d),g=new Ne().setFromPoints(p),v=new st(f,this.markupMaterial);this._scene.add(v),this.markupLines.push(v);const b=new st(g,this.markupMaterial);this._scene.add(b),this.markupLines.push(b)}showCircularArcInfo(e,t){const i=this.components.get(Lr);i.world=this._world,i.deleteByType(["Length","Radius"]);const n=e.curve.data.RADIUS,r=e.geometry.attributes.position.array,o=e.geometry.attributes.position.count,a=[],l=new O(r[0],r[1],r[2]),h=(o-1)*3,d=new O(r[h],r[h+1],r[h+2]),p=o/2*3,f=new O(r[p],r[p+1],r[p+2]),g=d.clone().sub(l).normalize(),v=new O(-g.y,g.x,0);v.multiplyScalar(n);const b=f.clone().add(v);a.push(f),a.push(b);const w=new Ne().setFromPoints(a),T=new st(w,this.markupMaterial);i.showCurveRadius(T,Math.abs(n)),this._scene.add(T),this.markupLines.push(T);const S=[];for(let ne=0;ne{!this._highlighter||!this.planHighlighter||this.planHighlighter.showCurveInfo(t)})}get world(){return super.world}set world(e){var t;super.world=e,e&&((t=this.planHighlighter)==null||t.dispose(),this.planHighlighter=new hb(this.components,e.scene.three,e))}};x(ub,"uuid","3096dea0-5bc2-41c7-abce-9089b6c9431b");const db=class Ym extends Vm{constructor(e){super(e),x(this,"view","vertical"),x(this,"enabled",!0),this.components.add(Ym.uuid,this)}get world(){return super.world}set world(e){this.world!==e&&(super.world=e,this._highlighter&&this._highlighter.onSelect.add(t=>{if(!this.world)throw new Error("A world is needed to work with this component!");const i=this.components.get(Lr);i.deleteByType(["Slope","Height","InitialKPV","FinalKPV"]);const{alignment:n}=t.curve,r=[];for(const h of n.vertical){const d=h.mesh.geometry.attributes.position.array;r.push(d)}const{defSegments:o,slope:a}=this.setDefSegments(r),l=this.world.scene.three;for(let h=0;h{var i;(i=this.highlighter)==null||i.setResolution(t)}),x(this,"onClick",t=>{if(!this.enabled||!this._highlighter)return;if(!this.world)throw new Error("No world found!");if(!this.world.renderer)return;const i=this.world.renderer.three.domElement,n=this.world.camera.three,r=this._highlighter.castRay(t,n,i,this._curves);if(r){const o=r.object;this._highlighter.select(o),this.updateMarker(r,"select");const{point:a,index:l}=r;l!==void 0&&this.onHighlight.trigger({curve:o,point:a,index:l});return}this._highlighter.unSelect(),this.mouseMarkers&&(this.mouseMarkers.hover.visible=!1),this.onMarkerHidden.trigger({type:"hover"})}),x(this,"onMouseMove",async t=>{if(!this.enabled||!this._highlighter)return;if(!this.world)throw new Error("No world found!");if(!this.world.renderer)return;const i=this.world.renderer.three.domElement,n=this.world.camera.three,r=this._highlighter.castRay(t,n,i,this._curves);if(r){this._highlighter.hover(r.object),this.updateMarker(r,"hover");return}this._highlighter.unHover()}),this.components.add(Gm.uuid,this)}get world(){return this._world}set world(e){var t,i,n;if(e===this._world||(this._world&&this.setupEvents(!1),this._world=e,(t=this._highlighter)==null||t.dispose(),(i=this.mouseMarkers)==null||i.hover.dispose(),(n=this.mouseMarkers)==null||n.select.dispose(),!e))return;const r=e.scene.three;this._highlighter=new xm(r,"absolute"),this.mouseMarkers={select:this.newMouseMarker("#ffffff",e),hover:this.newMouseMarker("#575757",e)},this.setupEvents(!0)}get highlighter(){if(!this._highlighter)throw new Error("Navigator not initialized!");return this._highlighter}draw(e){if(!e.civilData)throw new Error("Model must have civil data!");if(!this.world)throw new Error("A world must be given before drawing an alignment!");const t=this.world.scene.three;for(const[i,n]of e.civilData.alignments)for(const{mesh:r}of n.absolute)t.add(r),this._curves.push(r)}newMouseMarker(e,t){const i=t.scene.three,n=document.createElement("div");n.style.backgroundColor=e,n.style.width="1rem",n.style.height="1rem",n.style.borderRadius="1rem";const r=new _t(t,n,i);return r.visible=!1,r}setMarker(e,t,i){if(!this.mouseMarkers)throw new Error("No mouse markers found! Initialize the world before using this.");const n=e.getPointAt(t,"absolute");this.mouseMarkers[i].visible=!0,this.mouseMarkers[i].three.position.copy(n)}hideMarker(e){if(!this.mouseMarkers)throw new Error("No mouse markers found! Initialize the world before using this.");const t=this.mouseMarkers[e].three;t.visible=!1}setupEvents(e){var t,i;if(!this.world)throw new Error("No world found!");if(!this.world.renderer)return;const n=this.world.renderer.three.domElement;(t=this.world.renderer)==null||t.onResize.remove(this.updateLinesResolution),n.removeEventListener("click",this.onClick),n.removeEventListener("mousemove",this.onMouseMove),e&&(n.addEventListener("click",this.onClick),n.addEventListener("mousemove",this.onMouseMove),(i=this.world.renderer)==null||i.onResize.add(this.updateLinesResolution))}updateMarker(e,t){if(!this.mouseMarkers)return;const{point:i,object:n}=e,r=n,o=r.curve,a=r.curve.alignment,l=a.getPercentageAt(i,"absolute");this.mouseMarkers[t].visible=!0,this.mouseMarkers[t].three.position.copy(i),l!==null&&this.onMarkerChange.trigger({alignment:a,percentage:l,type:t,curve:o})}};x(pb,"uuid","0a59c09e-2b49-474a-9320-99f51f40f182");const fb=class jm extends Re{constructor(e){super(e),x(this,"world",null),x(this,"enabled",!0),x(this,"plane"),x(this,"_world3D",null),this.components.add(jm.uuid,this)}get world3D(){return this._world3D}set world3D(e){var t;if(this._world3D=e,(t=this.plane)==null||t.dispose(),!e)return;const i=this.components.get(Ga),n=i.Type;i.Type=Gr,this.plane=i.createFromNormalAndCoplanarPoint(e,new O(1,0,0),new O),i.Type=n,this.plane.visible=!1,this.plane.enabled=!1}async set(e,t){if(!this.world||!this.plane)throw new Error("You must set a world before using this component");this.plane.enabled=!0;const i=e.curve.getPercentageAt(t);if(i===null)return;const{startPoint:n,endPoint:r}=e.curve.getSegmentAt(i);if(e.geometry.index===null)throw new Error("Geometry must be indexed!");const o=new O;o.subVectors(r,n),o.normalize(),this.plane.setFromNormalAndCoplanarPoint(o,t),this.plane.edges.update();const a=this.plane.helper.matrix.clone();a.invert();const l=this.world.scene.three,h=this.plane.edges.get();for(const d in h){const{mesh:p}=h[d];p.position.set(0,0,0),p.rotation.set(0,0,0),p.updateMatrix(),p.applyMatrix4(a),p.parent!==l&&l.add(p)}this.plane.enabled=!1}};x(fb,"uuid","96b2c87e-d90b-4639-8257-8f01136fe324");function zn(){const s=document.createElement("div");return s.style.backgroundColor="black",s.style.color="white",s.style.padding="8px",s.style.borderRadius="8px",s.style.fontFamily="sans-serif",s}const yh=class Eh{constructor(e,t,i){x(this,"label"),x(this,"boundingBox",new le),x(this,"world"),x(this,"components"),x(this,"_length"),x(this,"_visible",!0),x(this,"_start"),x(this,"_end"),x(this,"_root",new Os),x(this,"_endpoints",[]),x(this,"_line"),this.components=e,this.world=t,this._start=i.start,this._end=i.end,this._length=this.getLength(),this._line=this.createLine(i),this.newEndpointElement(i.endpointElement),this.newEndpointElement(i.endpointElement.cloneNode(!0)),this.label=this.newText(),this._root.renderOrder=2,this.world.scene.three.add(this._root)}get visible(){return this._visible}set visible(e){this._visible=e,this.label.visible=e,this._endpoints[0].visible=e,this._endpoints[1].visible=e;const[t,i]=this._endpoints,n=t.three,r=i.three,o=this.label.three;e?(this.world.scene.three.add(this._root),this._root.add(o,n,r)):(o.removeFromParent(),n.removeFromParent(),r.removeFromParent(),this._root.removeFromParent())}get endPoint(){return this._end}set endPoint(e){this._end=e;const t=this._line.geometry.attributes.position;t.setXYZ(1,e.x,e.y,e.z),t.needsUpdate=!0,this._endpoints[1].three.position.copy(e),this.updateLabel()}get startPoint(){return this._start}set startPoint(e){this._start=e;const t=this._line.geometry.attributes.position;t.setXYZ(0,e.x,e.y,e.z),t.needsUpdate=!0,this._endpoints[0].three.position.copy(e),this.updateLabel()}get _center(){let e=this._end.clone().sub(this._start);const t=e.length()*.5;return e=e.normalize().multiplyScalar(t),this._start.clone().add(e)}dispose(){const e=this.components.get(Fi);this.visible=!1,e.destroy(this._root),e.destroy(this._line);for(const t of this._endpoints)t.dispose();this._endpoints.length=0,this.label.dispose(),this.boundingBox&&e.destroy(this.boundingBox),this.components=null}createBoundingBox(){this.boundingBox.geometry=new ut(1,1,this._length),this.boundingBox.position.copy(this._center),this.boundingBox.lookAt(this._end),this.boundingBox.visible=!1,this._root.add(this.boundingBox)}toggleLabel(){this.label.toggleVisibility()}newEndpointElement(e){const t=this._endpoints.length===0?this._start:this._end,i=new _t(this.world,e);i.three.position.copy(t),this._endpoints.push(i),this._root.add(i.three)}updateLabel(){this._length=this.getLength(),this.label.three.element.textContent=this.getTextContent(),this.label.three.position.copy(this._center),this._line.computeLineDistances()}createLine(e){const t=new Ne;t.setFromPoints([e.start,e.end]);const i=new st(t,e.lineMaterial);return this._root.add(i),i}newText(){const e=zn();e.textContent=this.getTextContent();const t=new _t(this.world,e);return t.three.position.copy(this._center),this._root.add(t.three),t}getTextContent(){return`${this._length/Eh.scale} ${Eh.units}`}getLength(){return parseFloat(this._start.distanceTo(this._end).toFixed(2))}};x(yh,"scale",1),x(yh,"units","m");let au=yh;class mb{constructor(e,t,i){x(this,"enabled",!0),x(this,"visible",!0),x(this,"points",[]),x(this,"workingPlane",null),x(this,"labelMarker"),x(this,"world"),x(this,"components"),x(this,"onDisposed",new $),x(this,"_rotationMatrix",null),x(this,"_dimensionLines",[]),x(this,"_defaultLineMaterial",new Di({color:"red"})),x(this,"onAreaComputed",new $),x(this,"onWorkingPlaneComputed",new $),x(this,"onPointAdded",new $),x(this,"onPointRemoved",new $),this.world=t,this.components=e;const n=zn();this.labelMarker=new _t(t,n),this.labelMarker.visible=!1,this.onPointAdded.add(r=>{this.points.length===3&&!this._dimensionLines[2]&&(this.addDimensionLine(r,this.points[0]),this.labelMarker.visible=!0)}),i==null||i.forEach(r=>this.setPoint(r))}setPoint(e,t){let i;if(t?i=t:i=this.points.length===0?0:this.points.length,i===0){this.points[0]=e;return}if(i<0||i>this.points.length)return;const n=this.points.length>i;this.points[i]=e,this.onPointAdded.trigger(e),n||this.addDimensionLine(this.points[i-1],e);const{previousLine:r,nextLine:o}=this.getLinesBetweenIndex(i);r&&(r.endPoint=e),o&&(o.startPoint=e)}removePoint(e){if(this.points.length===3)return;this.points.splice(e,1);const{previousLine:t,nextLine:i}=this.getLinesBetweenIndex(e);i&&(t.endPoint=i.endPoint),i==null||i.dispose(),this._dimensionLines.splice(e,1),this.onPointRemoved.trigger()}toggleLabel(){this.labelMarker.toggleVisibility()}addDimensionLine(e,t){const i=document.createElement("div");i.className="w-2 h-2 bg-red-600 rounded-full";const n=new au(this.components,this.world,{start:e,end:t,lineMaterial:this._defaultLineMaterial,endpointElement:i});return n.toggleLabel(),this._dimensionLines.length>1?this._dimensionLines.splice(this._dimensionLines.length-1,0,n):this._dimensionLines.push(n),n}getLinesBetweenIndex(e){const t=e===0?this._dimensionLines.length-1:e-1,i=this._dimensionLines[t],n=this._dimensionLines[e];return{previousLine:i,nextLine:n}}computeWorkingPlane(){this.workingPlane=new an().setFromCoplanarPoints(this.points[0],this.points[1],this.points[2]);const e=new O(0,1,0),t=this.workingPlane.normal.angleTo(e),i=new O().crossVectors(this.workingPlane.normal,e).normalize();this._rotationMatrix=new Ee().makeRotationAxis(i,t),this.onWorkingPlaneComputed.trigger(this.workingPlane)}computeArea(){if(!(this._rotationMatrix&&this.workingPlane))return this.onAreaComputed.trigger(0),0;let e=0,t=0;const i=this._rotationMatrix,n=this.points.map(o=>{const a=o.clone().applyMatrix4(i),l=new Ve(a.x,a.z);return e+=l.x,t+=l.y,l}),r=Math.abs(Rv.area(n));return this.labelMarker.three.element.textContent=`${r.toFixed(2)} m²`,this.labelMarker.three.position.set(e/n.length,-this.workingPlane.constant,t/n.length).applyMatrix4(i.clone().invert()),this.onAreaComputed.trigger(r),r}dispose(){this.onAreaComputed.reset(),this.onWorkingPlaneComputed.reset(),this.onPointAdded.reset(),this.onPointRemoved.reset();for(const e of this._dimensionLines)e.dispose();this.labelMarker.dispose(),this._dimensionLines=[],this.points=[],this._rotationMatrix=null,this.workingPlane=null,this._defaultLineMaterial.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return{points:this.points,workingPlane:this.workingPlane,area:this.computeArea()}}}let lu=class extends x1{constructor(){super(...arguments),x(this,"onDisposed",new $),x(this,"marker",null)}dispose(){this.marker&&this.marker.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(e){const t=super.get(e);return t?(this.marker||(this.marker=new _t(e)),this.marker.world!==e&&(this.marker.world=e,this.marker.three.removeFromParent(),e.scene.three.add(this.marker.three)),this.marker.visible=!0,this.marker.three.position.copy(t)):this.marker&&(this.marker.visible=!1),t}};const gb=class bh extends Re{constructor(e){super(e),x(this,"onDisposed",new $),x(this,"list",[]),x(this,"world"),x(this,"_enabled",!1),x(this,"_vertexPicker"),x(this,"_currentAreaElement",null),x(this,"_clickCount",0),x(this,"create",()=>{if(!this.enabled)return;if(!this.world)throw new Error("World not defined for the area measurement!");const t=this._vertexPicker.get(this.world);if(t){if(!this._currentAreaElement){const i=new mb(this.components,this.world);i.onPointAdded.add(()=>{this._clickCount===3&&!i.workingPlane&&(i.computeWorkingPlane(),this._vertexPicker.workingPlane=i.workingPlane)}),i.onPointRemoved.add(()=>this._clickCount--),this._currentAreaElement=i}this._currentAreaElement.setPoint(t,this._clickCount),this._currentAreaElement.computeArea(),this._clickCount++}}),x(this,"onMouseMove",()=>{if(!this.world){console.log("No world given for the area measurement!");return}const t=this._vertexPicker.get(this.world);t&&this._currentAreaElement&&(this._currentAreaElement.setPoint(t,this._clickCount),this._currentAreaElement.computeArea())}),x(this,"onKeydown",t=>{this.enabled&&(t.key==="z"&&t.ctrlKey&&this._currentAreaElement&&this._currentAreaElement.removePoint(this._clickCount-1),t.key==="Enter"&&this._currentAreaElement&&this.endCreation(),t.key==="Escape"&&(this._clickCount===0&&!this._currentAreaElement?this.enabled=!1:this.cancelCreation()))}),this.components.add(bh.uuid,this),this._vertexPicker=new lu(e)}set enabled(e){this._enabled=e,this._vertexPicker.enabled=e,this.setupEvents(e),e||this.cancelCreation()}get enabled(){return this._enabled}set workingPlane(e){this._vertexPicker.workingPlane=e}get workingPlane(){return this._vertexPicker.workingPlane}dispose(){this.setupEvents(!1),this._vertexPicker.dispose(),this._currentAreaElement&&this._currentAreaElement.dispose();for(const e of this.list)e.dispose();this.components=null,this.onDisposed.trigger(bh.uuid),this.onDisposed.reset()}delete(){}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}endCreation(){this._currentAreaElement&&(this.list.push(this._currentAreaElement),this._currentAreaElement.removePoint(this._clickCount),this._currentAreaElement.computeWorkingPlane(),this._currentAreaElement.computeArea(),this._currentAreaElement=null),this._vertexPicker.workingPlane=null,this._clickCount=0}cancelCreation(){this._currentAreaElement&&(this._currentAreaElement.dispose(),this._currentAreaElement=null),this._vertexPicker.workingPlane=null,this._clickCount=0}setupEvents(e){if(!this.world)throw new Error("The area measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the area measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;e?(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown)):(t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown))}};x(gb,"uuid","c453a99e-f054-4781-9060-33df617db4a5");class vb{constructor(e,t){x(this,"enabled",!0),x(this,"visible",!0),x(this,"points",[]),x(this,"world"),x(this,"onDisposed",new $),x(this,"_lineMaterial",new ro({color:6629591,linewidth:2})),x(this,"_lineGeometry",new Wa),x(this,"_line",new Im(this._lineGeometry,this._lineMaterial)),x(this,"_labelMarker"),x(this,"onAngleComputed",new $),x(this,"onPointAdded",new $),this.world=e;const i=zn();this._labelMarker=new _t(e,i),this.labelMarker.visible=!0,this.onPointAdded.add(()=>{this.points.length===1&&e.scene.three.add(this._line),this.points.length===3&&(this.labelMarker.visible=!0)}),this.onAngleComputed.add(n=>{this.labelMarker.three.element.textContent=`${n.toFixed(2)}°`,this.labelMarker.three.position.copy(this.points[1]??new O)}),t==null||t.forEach(n=>this.setPoint(n))}set lineMaterial(e){this._lineMaterial.dispose(),this._lineMaterial=e,this._line.material=e,this._lineMaterial.resolution.set(window.innerWidth,window.innerHeight)}get lineMaterial(){return this._lineMaterial}set labelMarker(e){this._labelMarker.dispose(),this._labelMarker=e}get labelMarker(){return this._labelMarker}get angle(){return{points:this.points,angle:this.computeAngle()}}setPoint(e,t){let i;if(t?i=t:i=this.points.length===0?0:this.points.length,![0,1,2].includes(i))return;this.points[i]=e,this.onPointAdded.trigger(e);const n=this.points.map(r=>[r.x,r.y,r.z]);this._lineGeometry.setPositions(n.flat())}toggleLabel(){this.labelMarker.toggleVisibility()}computeAngle(){const e=this.points[0],t=this.points[1],i=this.points[2];if(!(e&&t&&i))return 0;const n=new O().subVectors(t,e),r=new O().subVectors(t,i),o=so.radToDeg(n.angleTo(r));return this.onAngleComputed.trigger(o),o}dispose(){this.points=[],this.labelMarker.dispose(),this.onAngleComputed.reset(),this.onPointAdded.reset(),this.labelMarker.dispose(),this._line.removeFromParent(),this._lineMaterial.dispose(),this._lineGeometry.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}}const yb=class wh extends Re{constructor(e){super(e),x(this,"onDisposed",new $),x(this,"world"),x(this,"list",[]),x(this,"_lineMaterial"),x(this,"_enabled",!1),x(this,"_vertexPicker"),x(this,"_currentAngleElement",null),x(this,"_clickCount",0),x(this,"create",()=>{if(!this.enabled)return;if(!this.world){console.log("No world selected for angle measurement!");return}const t=this._vertexPicker.get(this.world);if(t){if(!this._currentAngleElement){const i=new vb(this.world);i.lineMaterial=this.lineMaterial,this._currentAngleElement=i}this._currentAngleElement.setPoint(t,this._clickCount),this._currentAngleElement.setPoint(t,this._clickCount+1),this._currentAngleElement.setPoint(t,this._clickCount+2),this._currentAngleElement.computeAngle(),this._clickCount++,this._clickCount===3&&this.endCreation()}}),x(this,"onMouseMove",()=>{if(!this.world){console.log("No world selected for angle measurement!");return}const t=this._vertexPicker.get(this.world);t&&this._currentAngleElement&&(this._currentAngleElement.setPoint(t,this._clickCount),this._currentAngleElement.computeAngle())}),x(this,"onKeyDown",t=>{this.enabled&&(t.key==="z"&&t.ctrlKey&&this._currentAngleElement,t.key==="Escape"&&(this._clickCount===0&&!this._currentAngleElement?this.enabled=!1:this.cancelCreation()))}),this.components.add(wh.uuid,this),this._vertexPicker=new lu(e),this._lineMaterial=new ro({color:6629591,linewidth:2})}set lineMaterial(e){this._lineMaterial.dispose(),this._lineMaterial=e,this._lineMaterial.resolution.set(window.innerWidth,window.innerHeight)}get lineMaterial(){return this._lineMaterial}set enabled(e){this._enabled=e,this.setupEvents(e),this._vertexPicker.enabled=e,e||this.cancelCreation()}get enabled(){return this._enabled}set workingPlane(e){this._vertexPicker.workingPlane=e}get workingPlane(){return this._vertexPicker.workingPlane}dispose(){this.setupEvents(!1),this._lineMaterial.dispose(),this._vertexPicker.dispose();for(const e of this.list)e.dispose();this._currentAngleElement&&this._currentAngleElement.dispose(),this.components=null,this.onDisposed.trigger(wh.uuid),this.onDisposed.reset()}delete(){}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}endCreation(){this._currentAngleElement&&(this.list.push(this._currentAngleElement),this._currentAngleElement.computeAngle(),this._currentAngleElement=null),this._clickCount=0}cancelCreation(){this._currentAngleElement&&(this._currentAngleElement.dispose(),this._currentAngleElement=null),this._clickCount=0}setupEvents(e){if(!this.world)throw new Error("No world selected for angle measurement!");if(!this.world.renderer)throw new Error("The given world doesn't have a renderer!");const t=this.world.renderer.three.domElement.parentElement;e?(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeyDown)):(t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeyDown))}};x(yb,"uuid","622fb2c9-528c-4b0a-8a0e-6a1375f0a3aa");const Wm=class Ih extends Re{constructor(e){super(e),x(this,"onDisposed",new $),x(this,"onBeforeUpdate",new $),x(this,"onAfterUpdate",new $),x(this,"snapDistance",.25),x(this,"_vertexPicker"),x(this,"_lineMaterial",new Di({color:"#DC2626",linewidth:2,depthTest:!1})),x(this,"list",[]),x(this,"world"),x(this,"_visible",!0),x(this,"_enabled",!1),x(this,"_temp",{isDragging:!1,start:new O,end:new O,dimension:void 0}),x(this,"create",t=>{const i=t instanceof kn?t:void 0;if(this._enabled){if(!this._temp.isDragging){this.drawStart(i);return}this.endCreation()}}),x(this,"onMouseMove",()=>{this.world&&this._vertexPicker.get(this.world)}),this.components.add(Ih.uuid,this),this._vertexPicker=new lu(e,{previewElement:zn(),snapDistance:this.snapDistance})}get enabled(){return this._enabled}set enabled(e){e||this.cancelCreation(),this._enabled=e,this._vertexPicker.enabled=e,this.setupEvents(e)}get visible(){return this._visible}set visible(e){this._visible=e;for(const t of this.list)t.visible=e}get color(){return this._lineMaterial.color}set color(e){this._lineMaterial.color=e}dispose(){this.setupEvents(!1),this.enabled=!1;for(const e of this.list)e.dispose();this._lineMaterial.dispose(),this.list=[],this._vertexPicker.dispose(),this.onDisposed.trigger(Ih.uuid),this.onDisposed.reset()}async update(e){this._enabled&&this._temp.isDragging&&this.drawInProcess()}createOnPoints(e,t){const i=this.drawDimension();i.startPoint=e,i.endPoint=t,i.createBoundingBox(),this.list.push(i)}delete(){if(!this.world)throw new Error("World is needed for Length Measurement!");if(!this._enabled||this.list.length===0)return;const e=this.getBoundingBoxes(),t=this.components.get(ni).get(this.world).castRay(e);if(!t)return;const i=this.list.find(n=>n.boundingBox===t.object);if(i){const n=this.list.indexOf(i);this.list.splice(n,1),i.dispose()}}async deleteMeasurement(e){if(e){const t=this.list.indexOf(e);this.list.splice(t,1),e.dispose()}}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}cancelCreation(){var e;this._temp.dimension&&(this._temp.isDragging=!1,(e=this._temp.dimension)==null||e.dispose(),this._temp.dimension=void 0)}drawStart(e){if(!this.world)throw new Error("The length measurement needs a world to work!");const t=e?[e]:void 0,i=this.components.get(ni).get(this.world).castRay(t),n=this._vertexPicker.get(this.world);i&&n&&(this._temp.isDragging=!0,this._temp.start=e?i.point:n)}drawInProcess(){if(!this.world)throw new Error("The length measurement needs a world to work!");if(!this.components.get(ni).get(this.world).castRay())return;const e=this._vertexPicker.get(this.world);e&&(this._temp.end=e,this._temp.dimension||(this._temp.dimension=this.drawDimension()),this._temp.dimension.endPoint=this._temp.end)}endCreation(){this._temp.dimension&&(this._temp.dimension.createBoundingBox(),this.list.push(this._temp.dimension),this._temp.dimension=void 0,this._temp.isDragging=!1)}drawDimension(){if(!this.world)throw new Error("The length measurement needs a world to work!");return new au(this.components,this.world,{start:this._temp.start,end:this._temp.end,lineMaterial:this._lineMaterial,endpointElement:zn()})}getBoundingBoxes(){return this.list.map(e=>e.boundingBox).filter(e=>e!==void 0)}setupEvents(e){if(!this.world)throw new Error("The length measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the length measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;t&&(t.removeEventListener("click",this.create),e&&t.addEventListener("mousemove",this.onMouseMove))}};x(Wm,"uuid","2f9bcacf-18a9-4be6-a293-e898eae64ea1");let _r=Wm;const Eb=class Xm extends Re{constructor(e){super(e),x(this,"label",null),x(this,"world"),x(this,"onVolumeFound",new $),x(this,"_enabled",!1),x(this,"onDisposed",new $),x(this,"create",()=>{if(!this.enabled)return;if(!this.world)throw new Error("World is needed for Volume Measurement!");const t=this.components.get(ni).get(this.world).castRay();if(!t||!t.object)return;const{object:i}=t;if(i instanceof le){const n=this.getVolumeOfMesh(i);this.onVolumeFound.trigger(n)}}),x(this,"onMouseMove",()=>{}),x(this,"onKeydown",t=>{}),this.components.add(Xm.uuid,this)}set enabled(e){this._enabled=e,this.setupEvents(e),e||this.cancelCreation()}get enabled(){return this._enabled}async dispose(){var e;this.setupEvents(!1),(e=this.label)==null||e.dispose(),this.onDisposed.trigger(),this.onDisposed.reset(),this.components=null}delete(){}async deleteAll(){}endCreation(){}cancelCreation(){}get(){}getVolumeFromFragments(e){const t=this.components.get(rt),i=new Ee,n=[];for(const r in e){const o=t.list.get(r);if(!o)continue;const a=e[r];let l=0;for(const p of a){const f=o.getInstancesIDs(p);f&&(l+=f.size)}const h=new Kt(o.mesh.geometry,void 0,l);let d=0;for(const p of a){const f=o.getInstancesIDs(p);if(f)for(const g of f)o.mesh.getMatrixAt(g,i),h.setMatrixAt(d++,i)}n.push(h)}return this.getVolumeFromMeshes(n)}getVolumeFromMeshes(e){if(!this.world)throw new Error("World is needed for Volume Measurement!");this.label||(this.label=this.newLabel(),this.label.three.removeFromParent());let t=0;for(const l of e)t+=this.getVolumeOfMesh(l);const i=this.world.scene.three,n=this.label.three;i.add(n);const r=this.components.get(tm);for(const l of e)l.geometry.computeBoundingSphere(),r.addMesh(l);const o=r.getSphere();r.reset(),n.position.copy(o.center);const a=Math.trunc(t*100)/100;return n.element.textContent=a.toString(),t}newLabel(){if(!this.world)throw new Error("World is needed for Volume Measurement!");const e=zn();return new _t(this.world,e)}setupEvents(e){if(!this.world)throw new Error("The volume measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the volume measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;e?(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown)):(t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown))}getVolumeOfMesh(e){let t=0;const i=new O,n=new O,r=new O,{index:o}=e.geometry,a=e.geometry.attributes.position.array;if(!o)return console.warn("Geometry must be indexed to compute its volume!"),0;const l=[];if(e instanceof Kt)for(let d=0;d{if(!this.world)throw new Error("No world given to the face measurement!");if(!this.enabled||!this._currentSelelection)return;const t=this.world.scene.three,i=new Ne,n=new le(i,this.selectionMaterial);i.setAttribute("position",this.preview.geometry.attributes.position),t.add(n),i.computeBoundingSphere();const{area:r,perimeter:o}=this._currentSelelection,a=this.newLabel(i,r);n.add(a.three),this.selection.push({area:r,perimeter:o,mesh:n,label:a})}),x(this,"onMouseMove",()=>{if(!this.world)throw new Error("The face measurement needs a world to work!");if(!this.enabled){this.unselect();return}const t=this.components.get(ni).get(this.world).castRay();if(!t||!t.object||t.faceIndex===void 0){this.unselect();return}const{object:i,faceIndex:n}=t;i instanceof le||i instanceof Kt?this.updateSelection(i,n,t.instanceId):this.unselect()}),x(this,"onKeydown",t=>{}),this.components.add(Km.uuid,this),this.preview.frustumCulled=!1}set enabled(e){if(!this.world)throw new Error("No world given for the Face measurement!");this._enabled=e,this.setupEvents(e),e?this.world.scene.three.add(this.preview):(this.preview.removeFromParent(),this.cancelCreation()),this.setVisibility(e)}get enabled(){return this._enabled}dispose(){this.setupEvents(!1),this.deleteAll(),this.preview.removeFromParent(),this.preview.material.dispose(),this.preview.geometry.dispose(),this.selectionMaterial.dispose(),this.onDisposed.trigger(),this.onDisposed.reset(),this.components=null}delete(){if(!this.world)throw new Error("No world given to the face measurement!");const e=this.selection.map(r=>r.mesh),t=this.components.get(ni).get(this.world).castRay(e);if(!t||!t.object)return;const i=this.selection.find(r=>r.mesh===t.object);if(!i)return;i.mesh.removeFromParent(),i.mesh.geometry.dispose(),i.label.dispose();const n=this.selection.indexOf(i);this.selection.splice(n,1)}deleteAll(){for(const e of this.selection)e.mesh.removeFromParent(),e.mesh.geometry.dispose(),e.label.dispose();this.selection=[]}endCreation(){}cancelCreation(){}get(){const e=[];for(const t of this.selection){const i=t.mesh.geometry,{area:n,perimeter:r}=t,o=i.attributes.position.array;e.push({position:o,area:n,perimeter:r})}return e}set(e){if(!this.world)throw new Error("No world given to the face measurement!");const t=this.world.scene.three;for(const i of e){const n=new Ne,r=new le(n,this.selectionMaterial);t.add(r);const o=new gt(i.position,3);n.setAttribute("position",o),n.computeBoundingSphere();const{area:a,perimeter:l}=i,h=this.newLabel(n,a);r.add(h.three),this.selection.push({area:a,perimeter:l,mesh:r,label:h})}}setupEvents(e){if(!this.world)throw new Error("The face measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the face measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown),e&&(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown))}setVisibility(e){if(!this.world)throw new Error("The face measurement needs a world to work!");const t=this.world.scene.three;for(const i of this.selection){const n=i.label.three;e?(t.add(i.mesh),i.mesh.add(n)):(i.mesh.removeFromParent(),n.removeFromParent())}}unselect(){this.preview.removeFromParent(),this._currentSelelection=null}updateSelection(e,t,i){if(!this.world)throw new Error("The face measurement needs a world to work!");this.world.scene.three.add(this.preview);const n=this.components.get(ja).getFace(e,t,i);if(n===null)return;const r=this.regenerateHighlight(e,n.indices,i);let o=0;for(const{distance:a}of n.edges)o+=a;this._currentSelelection={perimeter:o,area:r}}newLabel(e,t){if(!e.boundingSphere)throw new Error("Error computing area geometry");if(!this.world)throw new Error("The face measurement needs a world to work!");const{center:i}=e.boundingSphere,n=zn(),r=Math.trunc(t*100)/100;n.textContent=r.toString();const o=new _t(this.world,n);return o.three.position.copy(i),o}regenerateHighlight(e,t,i){const n=[],r=[];let o=0,a=0;const l=new On,h=this.components.get(ja);for(const f of t){const{p1:g,p2:v,p3:b}=h.getVerticesAndNormal(e,f,i);n.push(g.x,g.y,g.z),n.push(v.x,v.y,v.z),n.push(b.x,b.y,b.z),l.set(g,v,b),a+=l.getArea(),r.push(o,o+1,o+2),o+=3}const d=new Float32Array(n),p=new gt(d,3);return this.preview.geometry.setAttribute("position",p),this.preview.geometry.setIndex(r),a}};x(bb,"uuid","30279548-1309-44f6-aa97-ce26eed73522");const wb=class Qm extends Re{constructor(e){super(e),x(this,"preview"),x(this,"tolerance",.3),x(this,"world"),x(this,"onDisposed",new $),x(this,"_enabled",!1),x(this,"_lineMaterial",new Di({color:"#DC2626",linewidth:2,depthTest:!1,transparent:!0})),x(this,"create",async()=>{if(!this.preview||!this.enabled||!this.preview.visible)return;const t=this.components.get(_r);t.world=this.world;const i=this.preview.startPoint.clone(),n=this.preview.endPoint.clone();t.createOnPoints(i,n)}),x(this,"onMouseMove",()=>{if(!this.preview)return;if(!this.world)throw new Error("The edge measurement needs a world to work!");if(!this.enabled){this.preview.visible=!1;return}const t=this.components.get(ni).get(this.world).castRay();if(!t||!t.object){this.preview.visible=!1;return}const{object:i,faceIndex:n,point:r}=t;if(n===void 0){this.preview.visible=!1;return}i instanceof le||i instanceof Kt?this.updateSelection(i,r,n,t.instanceId):this.preview.visible=!1}),x(this,"onKeydown",t=>{}),this.components.add(Qm.uuid,this)}set enabled(e){if(this._enabled=e,this.setupEvents(e),e){if(!this.world)throw new Error("The edge measurement needs a world to work!");if(!this.preview){const t=document.createElement("div");t.className="w-2 h-2 bg-red-600 rounded-full",this.preview=new au(this.components,this.world,{start:new O,end:new O,lineMaterial:this._lineMaterial,endpointElement:t}),this.preview.visible=!1}}else this.cancelCreation()}get enabled(){return this._enabled}dispose(){this.preview&&this.preview.dispose(),this._lineMaterial.dispose(),this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset(),this.components=null}delete(){if(!this.enabled)return;const e=this.components.get(_r),t=e.enabled;e.enabled=!0,e.delete(),e.enabled=t}deleteAll(){this.components.get(_r).deleteAll()}endCreation(){}cancelCreation(){}get(){const e=this.components.get(_r).list,t=[];for(const i of e){const n=i.startPoint,r=i.endPoint,o=[n.x,n.y,n.z,r.x,r.y,r.z];t.push(o)}return t}set(e){const t=this.components.get(_r);t.world=this.world;for(const i of e){const[n,r,o,a,l,h]=i,d=new O(n,r,o),p=new O(a,l,h);t.createOnPoints(d,p)}}setupEvents(e){if(!this.world)throw new Error("The edge measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the edge measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;e?(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown)):(t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown))}updateSelection(e,t,i,n){if(!this.preview||!e.geometry.index)return;const r=this.components.get(ja).getFace(e,i,n);if(!r)return;const{edges:o}=r;let a=Number.MAX_VALUE,l=[];for(const p of o){const[f,g]=p.points,v=ja.distanceFromPointToLine(t,f,g,!0);v{const o=r.data.colors,a={},l={},h={},d={},p=performance.now();let f=!1;const g=new Set(this._foundGeometries);for(const[v,b]of o){const w=this._geometries.get(v);if(!w)continue;const T=b>this.threshold,{exists:S}=w;if(!T&&!S)continue;const _=this._indexModelID.get(w.modelIndex);g.delete(v),T&&S?(w.time=p,d[_]||(d[_]=new Set),d[_].add(w.geometryID),this._foundGeometries.add(v),f=!0):T&&!S?(a[_]||(a[_]=new Map),w.time=p,w.exists=!0,a[_].has(b)||a[_].set(b,new Set),a[_].get(b).add(w.geometryID),this._foundGeometries.add(v),f=!0):!T&&S&&(this.handleLostGeometries(p,v,w,l,h),f=!0)}f&&await this.onViewUpdated.trigger({toLoad:a,toRemove:l,toHide:h,toShow:d}),this._isWorkerBusy=!1}),this.updateInterval=500,this._geometry=new ut(1,1,1),this._geometry.groups=[],this._geometry.deleteAttribute("uv");const n=this._geometry.attributes.position.array;for(let r=0;rparseInt(f,10)),p=[];for(const f of i.ids){const g=i.get(f);if(!g.colors)throw new Error("Malformed fragments!");for(const v of g.colors)v.setRGB(l/255,h/255,d/255,"srgb");p.push(g)}a.fragment.add(p),Si.enabled=n,this.needsUpdate=!0}removeFragment(e,t){const i=this._modelIDIndex.get(e),n=this.codes.get(i).get(t),r=this._geometries.get(n);if(r.hidden||this.setGeometryVisibility(r,!0,!1),r.fragment){const{fragment:o}=r;o.dispose(!1),r.fragment=void 0}}setModelTransformation(e,t){const i=this._modelIDIndex.get(e);if(i===void 0)throw new Error("Model not found!");const n=this.boxes.get(i);n&&(n.mesh.position.set(0,0,0),n.mesh.rotation.set(0,0,0),n.mesh.scale.set(1,1,1),n.mesh.applyMatrix4(t));const r=this._geometriesGroups.get(i);r&&(r.position.set(0,0,0),r.rotation.set(0,0,0),r.scale.set(1,1,1),r.applyMatrix4(t))}setVisibility(e,t,i){const n=this._modelIDIndex.get(t);if(n!==void 0)for(const[r,o]of i){const a=this.codes.get(n);if(a===void 0)throw new Error("Map not found!");const l=a.get(r),h=this._geometries.get(l);if(h===void 0)throw new Error("Geometry not found!");h.hidden=!e,this.setGeometryVisibility(h,e,!0,o)}}setGeometryVisibility(e,t,i,n){const{modelIndex:r,geometryID:o,assetIDs:a}=e,l=this.boxes.get(r);if(l===void 0)throw new Error("Model not found!");const h=n||a;if(i&&e.fragment)e.fragment.setVisibility(t,h);else{const d=new Set;for(const p of h){const f=this.getInstanceID(p,o);d.add(f)}l.setVisibility(t,d)}}handleLostGeometries(e,t,i,n,r){const o=this._indexModelID.get(i.modelIndex),a=e-i.time;a>this.maxLostTime?(n[o]||(n[o]=new Set),i.exists=!1,n[o].add(i.geometryID),this._foundGeometries.delete(t)):a>this.maxHiddenTime&&(r[o]||(r[o]=new Set),r[o].add(i.geometryID))}createModelIndex(e){if(this._modelIDIndex.has(e))throw new Error("Can't load the same model twice!");const t=this._nextModelID;return this._nextModelID++,this._modelIDIndex.set(e,t),this._indexModelID.set(t,e),t}getInstanceID(e,t){const i=10**(Math.log(t)*Math.LOG10E+1|0);return e+t/i}}var Zm={exports:{}};(function(s,e){(function(t,i){s.exports=i()})(np,function(){var t=function(c,u){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,y){m.__proto__=y}||function(m,y){for(var E in y)Object.prototype.hasOwnProperty.call(y,E)&&(m[E]=y[E])})(c,u)},i=function(){return(i=Object.assign||function(c){for(var u,m=1,y=arguments.length;m"u"||r.Promise||(r.Promise=Promise);var h=Object.getPrototypeOf,d={}.hasOwnProperty;function p(c,u){return d.call(c,u)}function f(c,u){typeof u=="function"&&(u=u(h(c))),(typeof Reflect>"u"?o:Reflect.ownKeys)(u).forEach(function(m){v(c,m,u[m])})}var g=Object.defineProperty;function v(c,u,m,y){g(c,u,l(m&&p(m,"get")&&typeof m.get=="function"?{get:m.get,set:m.set,configurable:!0}:{value:m,configurable:!0,writable:!0},y))}function b(c){return{from:function(u){return c.prototype=Object.create(u.prototype),v(c.prototype,"constructor",c),{extend:f.bind(null,c.prototype)}}}}var w=Object.getOwnPropertyDescriptor,T=[].slice;function S(c,u,m){return T.call(c,u,m)}function _(c,u){return u(c)}function I(c){if(!c)throw new Error("Assertion Failed")}function P(c){r.setImmediate?setImmediate(c):setTimeout(c,0)}function M(c,u){if(typeof u=="string"&&p(c,u))return c[u];if(!u)return c;if(typeof u!="string"){for(var m=[],y=0,E=u.length;y"u"?[]:function(){var c=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[c,h(c),c];var u=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[u,h(u),c]}(),tr=wi[0],Bt=wi[1],wi=wi[2],Bt=Bt&&Bt.then,ir=tr&&tr.constructor,Nl=!!wi,nr=function(c,u){sr.push([c,u]),Co&&(queueMicrotask(W0),Co=!1)},Ul=!0,Co=!0,mn=[],To=[],kl=ai,zi={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Le,pgp:!1,env:{},finalize:Le},ye=zi,sr=[],gn=0,xo=[];function de(c){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var u=this._PSD=ye;if(typeof c!="function"){if(c!==er)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&zl(this,this._value))}this._state=null,this._value=null,++u.ref,function m(y,E){try{E(function(C){if(y._state===null){if(C===y)throw new TypeError("A promise cannot be resolved with itself.");var R=y._lib&&$n();C&&typeof C.then=="function"?m(y,function(F,U){C instanceof de?C._then(F,U):C.then(F,U)}):(y._state=!0,y._value=C,Fu(y)),R&&es()}},zl.bind(null,y))}catch(C){zl(y,C)}}(this,c)}var Bl={get:function(){var c=ye,u=Ro;function m(y,E){var C=this,R=!c.global&&(c!==ye||u!==Ro),F=R&&!Hi(),U=new de(function(D,H){Vl(C,new Ou(Lu(y,c,R,F),Lu(E,c,R,F),D,H,c))});return this._consoleTask&&(U._consoleTask=this._consoleTask),U}return m.prototype=er,m},set:function(c){v(this,"then",c&&c.prototype===er?Bl:{get:function(){return c},set:Bl.set})}};function Ou(c,u,m,y,E){this.onFulfilled=typeof c=="function"?c:null,this.onRejected=typeof u=="function"?u:null,this.resolve=m,this.reject=y,this.psd=E}function zl(c,u){var m,y;To.push(u),c._state===null&&(m=c._lib&&$n(),u=kl(u),c._state=!1,c._value=u,y=c,mn.some(function(E){return E._value===y._value})||mn.push(y),Fu(c),m&&es())}function Fu(c){var u=c._listeners;c._listeners=[];for(var m=0,y=u.length;m.",Du="String expected.",is=[],Oo="__dbnames",Gl="readonly",jl="readwrite";function En(c,u){return c?u?function(){return c.apply(this,arguments)&&u.apply(this,arguments)}:c:u}var Nu={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Fo(c){return typeof c!="string"||/\./.test(c)?function(u){return u}:function(u){return u[c]===void 0&&c in u&&delete(u=ne(u))[c],u}}function Uu(){throw fe.Type()}function Fe(c,u){try{var m=ku(c),y=ku(u);if(m!==y)return m==="Array"?1:y==="Array"?-1:m==="binary"?1:y==="binary"?-1:m==="string"?1:y==="string"?-1:m==="Date"?1:y!=="Date"?NaN:-1;switch(m){case"number":case"Date":case"string":return uK+Z&&X(K+Y)})})}return X(0).then(function(){if(0=Y})).length!==0?(H.forEach(function(X){G.push(function(){var K=z,Z=X._cfg.dbschema;zo(L,K,B),zo(L,Z,B),z=L._dbSchema=Z;var q=tc(K,Z);q.add.forEach(function(he){ic(B,he[0],he[1].primKey,he[1].indexes)}),q.change.forEach(function(he){if(he.recreate)throw new fe.Upgrade("Not yet support for changing primary key");var ue=B.objectStore(he.name);he.add.forEach(function(Ie){return ko(ue,Ie)}),he.change.forEach(function(Ie){ue.deleteIndex(Ie.name),ko(ue,Ie)}),he.del.forEach(function(Ie){return ue.deleteIndex(Ie)})});var ie=X._cfg.contentUpgrade;if(ie&&X._cfg.version>Y){No(L,B),N._memoizedTables={};var ce=V(Z);q.del.forEach(function(he){ce[he]=K[he]}),ec(L,[L.Transaction.prototype]),Uo(L,[L.Transaction.prototype],o(ce),ce),N.schema=ce;var se,ae=Pt(ie);return ae&&ts(),q=de.follow(function(){var he;(se=ie(N))&&ae&&(he=Hi.bind(null,null),se.then(he,he))}),se&&typeof se.then=="function"?de.resolve(se):q.then(function(){return se})}}),G.push(function(K){var Z,q,ie=X._cfg.dbschema;Z=ie,q=K,[].slice.call(q.db.objectStoreNames).forEach(function(ce){return Z[ce]==null&&q.db.deleteObjectStore(ce)}),ec(L,[L.Transaction.prototype]),Uo(L,[L.Transaction.prototype],L._storeNames,L._dbSchema),N.schema=L._dbSchema}),G.push(function(K){L.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(L.idbdb.version/10)===X._cfg.version?(L.idbdb.deleteObjectStore("$meta"),delete L._dbSchema.$meta,L._storeNames=L._storeNames.filter(function(Z){return Z!=="$meta"})):K.objectStore("$meta").put(X._cfg.version,"version"))})}),function X(){return G.length?de.resolve(G.shift()(N.idbtrans)).then(X):de.resolve()}().then(function(){Ku(z,B)})):de.resolve();var L,Y,N,B,G,z}).catch(R)):(o(E).forEach(function(H){ic(m,H,E[H].primKey,E[H].indexes)}),No(c,m),void de.follow(function(){return c.on.populate.fire(C)}).catch(R));var U,D})}function rv(c,u){Ku(c._dbSchema,u),u.db.version%10!=0||u.objectStoreNames.contains("$meta")||u.db.createObjectStore("$meta").add(Math.ceil(u.db.version/10-1),"version");var m=Bo(0,c.idbdb,u);zo(c,c._dbSchema,u);for(var y=0,E=tc(m,c._dbSchema).change;yMath.pow(2,62)?0:z.oldVersion,L=z<1,c.idbdb=G.result,C&&rv(c,H),sv(c,z/10,H,N))},N),G.onsuccess=Ze(function(){H=null;var z,X,K,Z,q,ie=c.idbdb=G.result,ce=S(ie.objectStoreNames);if(0"u"?de.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(Y){function N(){return indexedDB.databases().finally(Y)}U=setInterval(N,100),N()}).finally(function(){return clearInterval(U)}):Promise.resolve()).then(F)]).then(function(){return R(),u.onReadyBeingFired=[],de.resolve(rc(function(){return c.on.ready.fire(c.vip)})).then(function Y(){if(0u.limit?Y.length=u.limit:c.length===u.limit&&Y.length=X.limit&&(!X.values||ie.req.values)&&dv(ie.req.query.range,X.query.range)}),!1,K,Z];case"count":return q=Z.find(function(ie){return sd(ie.req.query.range,X.query.range)}),[q,!!q,K,Z]}}(u,m,"query",C),H=D[0],L=D[1],Y=D[2],N=D[3];return H&&L?H.obsSet=C.obsSet:(L=y.query(C).then(function(B){var G=B.result;if(H&&(H.res=G),R){for(var z=0,X=G.length;z{await this.loadFoundGeometries(i),await this.unloadLostGeometries(n),this.setMeshVisibility(r,!0),this.setMeshVisibility(o,!1)})}get culler(){if(!this._culler)throw new Error("You must set a world before using the streamer!");return this._culler}dispose(){var e;this._isDisposing=!0,this.onFragmentsLoaded.reset(),this.onFragmentsDeleted.reset(),this._ramCache.clear(),this.models={},this._geometryInstances={},this._loadedFragments={},this.fragIDData.clear(),this._baseMaterial.dispose(),this._baseMaterialT.dispose(),(e=this._culler)==null||e.dispose(),this.onDisposed.trigger(xh.uuid),this.onDisposed.reset(),this._isDisposing=!1}async load(e,t,i){const{assets:n,geometries:r,globalDataFileId:o}=e,a=this.url+o,l=await(await fetch(a)).arrayBuffer(),h=new Uint8Array(l),d=this.components.get(rt).load(h,{coordinate:t});this.world.scene.three.add(d);const{opaque:p,transparent:f}=d.geometryIDs;for(const[v,b]of p){const w=d.keyFragments.get(b);if(w===void 0)throw new Error("Malformed fragments group!");this.fragIDData.set(w,[d,v,new Set])}for(const[v,b]of f){const w=d.keyFragments.get(b);if(w===void 0)throw new Error("Malformed fragments group!");this.fragIDData.set(w,[d,Math.abs(v),new Set])}this.culler.add(d.uuid,n,r),this.models[d.uuid]={assets:n,geometries:r};const g=new Map;for(const v of n){const b=v.id;for(const{transformation:w,geometryID:T,color:S}of v.geometries){g.has(T)||g.set(T,[]);const _=g.get(T);if(!_)throw new Error("Malformed instances");_.push({id:b,transformation:w,color:S})}}if(this._geometryInstances[d.uuid]=g,i){const v=new Map,b=new Map;for(const I in i.ids){const P=i.ids[I],M=parseInt(I,10);v.set(M,P)}for(const I in i.types){const P=i.types[I],M=parseInt(I,10);b.set(M,P)}const w=o.replace("-global","-properties");d.streamSettings={baseUrl:this.url,baseFileName:w,ids:v,types:b};const{indexesFile:T}=i,S=await(await fetch(this.url+T)).text(),_=this.components.get(gl);_.setRelationMap(d,_.getRelationsMapFromJSON(S))}return this.culler.needsUpdate=!0,d}remove(e){this._isDisposing=!0;const t=this.components.get(rt).groups.get(e);if(t===void 0){console.log("Group to delete not found.");return}delete this.models[e],delete this._geometryInstances[e],delete this._loadedFragments[e];const i=t.keyFragments.values();for(const n of i)this.fragIDData.delete(n);this.culler.remove(e),this._isDisposing=!1}setVisibility(e,t){const i=new Map;for(const n in t){const r=this.fragIDData.get(n);if(r===void 0)throw new Error("Geometry not found!");const[o,a,l]=r,h=o.uuid;i.has(h)||i.set(h,new Map);const d=i.get(h),p=t[n];for(const g of p)e?l.delete(g):l.add(g);d.get(a)||d.set(a,new Set);const f=d.get(a);for(const g of p)f.add(g)}for(const[n,r]of i){this.culler.setVisibility(e,n,r);for(const[o]of r){const a=this._loadedFragments[n];if(!a)continue;const l=a[o];if(l)for(const h of l){const d=t[h.id];d&&h.setVisibility(e,d)}}}this.culler.needsUpdate=!0}async clearCache(){await this._fileCache.delete()}get(){}update(){}async loadFoundGeometries(e){for(const t in e){if(this._isDisposing)return;const i=this.components.get(rt).groups.get(t);if(!i)return;const{geometries:n}=this.models[t],r=new Map,o=new Set;for(const[d,p]of e[t])for(const f of p){o.add(f);const g=n[f];if(!g)throw new Error("Geometry not found");if(g.geometryFile){const v=g.geometryFile,b=r.get(v)||0;r.set(v,b+d)}}const a=Array.from(r).sort((d,p)=>p[1]-d[1]);for(const[d]of a){const p=this.url+d;if(!this._ramCache.has(p)){let v=new Uint8Array;if(this.useCache){const w=await this._fileCache.files.get(p);if(w)v=w.file;else{const T=await(await fetch(p)).arrayBuffer();v=new Uint8Array(T),this._fileCache.files.add({file:v,id:p})}}else{const w=await(await fetch(p)).arrayBuffer();v=new Uint8Array(w)}const b=this.serializer.import(v);this._ramCache.set(p,{data:b,time:performance.now()})}const f=this._ramCache.get(p);if(!f)continue;f.time=performance.now();const g=[];if(f)for(const[v,{position:b,index:w,normal:T}]of f.data){if(this._isDisposing)return;if(!o.has(v)||!this._geometryInstances[t]||!this._geometryInstances[t].has(v))continue;const S=this._geometryInstances[t].get(v);if(!S)throw new Error("Instances not found!");const _=new Ne,I=new gt(b,3),P=new gt(T,3);_.setAttribute("position",I),_.setAttribute("normal",P),_.setIndex(Array.from(w));const M=[],k=[];for(const V of S)V.color[3]===1?k.push(V):M.push(V);this.newFragment(i,v,_,M,!0,g),this.newFragment(i,v,_,k,!1,g)}g.length&&!this._isDisposing&&this.onFragmentsLoaded.trigger(g)}const l=new Set,h=performance.now();for(const[d,{time:p}]of this._ramCache)h-p>this.maxRamTime&&l.add(d);for(const d of l)this._ramCache.delete(d)}}async unloadLostGeometries(e){if(this._isDisposing)return;const t=[],i=this.components.get(rt);for(const n in e){const r=i.groups.get(n);if(!r)throw new Error("Fragment group not found!");if(!this._loadedFragments[n])continue;const o=this._loadedFragments[n],a=e[n];for(const l of a){if(this.culler.removeFragment(r.uuid,l),!o[l])continue;const h=o[l];for(const d of h)r.items.splice(r.items.indexOf(d),1),t.push(d);delete o[l]}}t.length&&this.onFragmentsDeleted.trigger(t);for(const n of t)i.list.delete(n.id),this.world.meshes.delete(n.mesh),n.mesh.material=[],n.dispose(!0)}setMeshVisibility(e,t){for(const i in e)for(const n of e[i]){const r=this._loadedFragments[i];if(!r)continue;const o=r[n];if(o)for(const a of o)a.mesh.visible=t}}newFragment(e,t,i,n,r,o){if(n.length===0||this._isDisposing)return;const a=e.geometryIDs,l=r?a.transparent:a.opaque,h=t*(r?-1:1),d=l.get(h);if(d===void 0)return;const p=e.keyFragments.get(d);if(p===void 0)return;const f=this.components.get(rt);if(f.list.has(p))return;const g=r?this._baseMaterialT:this._baseMaterial,v=new Va(i,g,n.length);v.id=p,v.mesh.uuid=p,v.group=e,e.add(v.mesh),e.items.push(v),f.list.set(v.id,v),this.world.meshes.add(v.mesh),this._loadedFragments[e.uuid]||(this._loadedFragments[e.uuid]={});const b=this._loadedFragments[e.uuid];b[t]||(b[t]=[]),b[t].push(v);const w=new Map;for(let I=0;I{this.selection[this.config.hoverName]={}}),x(this,"onMouseDown",()=>{this.enabled&&(this._mouseState.down=!0)}),x(this,"onMouseUp",async t=>{const i=this.config.world;if(!i)throw new Error("No world found!");if(!i.renderer)throw new Error("This world doesn't have a renderer!");if(this.enabled&&t.target===i.renderer.three.domElement){if(this._mouseState.down=!1,this._mouseState.moved||t.button!==0){this._mouseState.moved=!1;return}if(this._mouseState.moved=!1,this.config.autoHighlightOnClick){const n=this.multiple==="none"?!0:!t[this.multiple];await this.highlight(this.config.selectName,n,this.zoomToSelection)}}}),x(this,"onMouseMove",async()=>{if(!this.enabled)return;if(this._mouseState.moved){this.clear(this.config.hoverName);return}this._mouseState.moved=this._mouseState.down;const t=this.selection[this.config.selectName];await this.highlight(this.config.hoverName,!0,!1,t)}),this.components.add(Ah.uuid,this)}async dispose(){this.setupEvents(!1),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.selection={};for(const e in this.events)this.events[e].onClear.reset(),this.events[e].onHighlight.reset();this.onSetup.reset(),this.events={},this.onDisposed.trigger(Ah.uuid),this.onDisposed.reset()}add(e,t){if(this.selection[e]||this.colors.has(e))throw new Error("A selection with that name already exists!");this.colors.set(e,t),this.selection[e]={},this.events[e]={onHighlight:new ee,onClear:new ee}}async highlight(e,t=!0,i=this.zoomToSelection,n={}){if(!this.enabled)return null;if(!this.config.world)throw new Error("No world found in config!");const r=this.config.world;if(!this.selection[e])throw new Error(`Selection ${e} does not exist.`);const o=this.components.get(rt).meshes,a=this.components.get(ni).get(r).castRay(o);if(!a||!a.face)return this.clear(e),null;const l=a.object,h=l.geometry,d=a.instanceId;if(!h||d===void 0)return null;const p=l.fragment.getItemID(d);if(p===null)throw new Error("Item ID not found!");const f=l.fragment.group;if(!f)throw new Error("Fragment must belong to a FragmentsGroup!");const g=f.getFragmentMap([p]),v={};for(const b in g){const w=g[b],T=n[b];for(const S of w)(!T||!T.has(S))&&(v[b]||(v[b]=new Set),v[b].add(S))}return await this.highlightByID(e,v,t,i),{id:p,fragments:g}}async highlightByID(e,t,i=!0,n=this.zoomToSelection){if(!this.enabled)return;i&&this.clear(e);const r=this.components.get(rt),o=this.colors.get(e);if(!o)throw new Error("Color for selection not found!");for(const a in t){const l=r.list.get(a);if(!l)continue;this.selection[e][a]||(this.selection[e][a]=new Set);const h=t[a];for(const d of h)this.selection[e][a].add(d),l.setColor(o,[d])}this.events[e].onHighlight.trigger(this.selection[e]),n&&await this.zoomSelection(e)}clear(e){const t=e?[e]:Object.keys(this.selection);for(const i of t){const n=this.components.get(rt),r=this.selection[i];for(const o in this.selection[i]){const a=n.list.get(o);if(!a)continue;const l=r[o];l&&(this.backupColor?a.setColor(this.backupColor):a.resetColor(l))}this.events[i].onClear.trigger(null),this.selection[i]={}}}setup(e){this.config={...this.config,...e},this.add(this.config.selectName,this.config.selectionColor),this.add(this.config.hoverName,this.config.hoverColor),this.setupEvents(!0),this.enabled=!0,this.isSetup=!0,this.onSetup.trigger(this)}async zoomSelection(e){if(!this.config.world)throw new Error("No world found in config!");const t=this.config.world;if(!t.camera.hasCameraControls())return;const i=this.components.get(tm),n=this.components.get(rt);i.reset();const r=this.selection[e];if(!Object.keys(r).length)return;for(const b in r){const w=n.list.get(b);if(!w)continue;const T=r[b];i.addMesh(w.mesh,T)}const o=i.getSphere(),a=1/0,l=-1/0,{x:h,y:d,z:p}=o.center,f=o.radius===a||h===a||d===a||p===a,g=o.radius===l||h===l||d===l||p===l,v=o.radius===0;f||g||v||(o.radius*=this.zoomFactor,await t.camera.controls.fitToSphere(o,!0))}setupEvents(e){if(!this.config.world)throw new Error("No world found while setting up events!");if(!this.config.world.renderer)throw new Error("The given world doesn't have a renderer!");const t=this.config.world.renderer.three.domElement,i=this.events[this.config.selectName].onHighlight;i.remove(this.clearHover),t.removeEventListener("mousedown",this.onMouseDown),t.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("mousemove",this.onMouseMove),e&&(i.add(this.clearHover),t.addEventListener("mousedown",this.onMouseDown),t.addEventListener("mouseup",this.onMouseUp),t.addEventListener("mousemove",this.onMouseMove))}};x(Ab,"uuid","cb8a76f2-654a-4b50-80c6-66fd83cafd77");const Sb=class qm extends Re{constructor(e){super(e),x(this,"onDisposed",new ee),x(this,"onNavigated",new ee),x(this,"onExited",new ee),x(this,"enabled",!1),x(this,"currentPlan",null),x(this,"defaultSectionOffset",1.5),x(this,"defaultCameraOffset",30),x(this,"list",[]),x(this,"world"),x(this,"_floorPlanViewCached",!1),x(this,"_previousCamera",new O),x(this,"_previousTarget",new O),x(this,"_previousProjection","Perspective"),this.components.add(qm.uuid,this)}dispose(){this.onExited.reset(),this.onNavigated.reset(),this.list=[],this.onDisposed.trigger(),this.onDisposed.reset()}async generate(e){if(!e.hasProperties)throw new Error("Properties are needed to compute plan views!");const t=await e.getAllPropertiesOfType(dl);if(!t)throw new Error("Floorplans not found!");const i=e.coordinationMatrix.elements[13],n=await Dn.getUnits(e);for(const r of Object.values(t)){const o={value:0};this.getAbsoluteFloorHeight(r.ObjectPlacement,o);const a=o.value*n+i;this.create({name:r.Name.value,id:r.GlobalId.value,normal:new O(0,-1,0),point:new O(0,a,0),ortho:!0,offset:this.defaultSectionOffset})}}create(e){if(!this.world)throw new Error("You must set a world before creating the clipping planes!");if(this.list.find(n=>n.id===e.id)){console.warn(`There's already a plan with the id: ${e.id}`);return}const t=this.createClippingPlane(e),i={...e,plane:t};this.list.push(i)}async goTo(e,t=!1){var i;((i=this.currentPlan)==null?void 0:i.id)!==e&&(this.onNavigated.trigger({id:e}),this.storeCameraPosition(),await this.hidePreviousClippingPlane(),this.updateCurrentPlan(e),await this.activateCurrentPlan(),this.enabled||(await this.moveCameraTo2DPlanPosition(t),this.enabled=!0))}async exitPlanView(e=!1){if(!this.enabled||!this.world)return;this.enabled=!1,this.onExited.trigger(),this.cacheFloorplanView();const t=this.world.camera;t.set("Orbit"),await t.projection.set(this._previousProjection),this.currentPlan&&this.currentPlan.plane&&(this.currentPlan.plane.enabled=!1,this.currentPlan.plane.edges.enabled=!1,this.currentPlan.plane.edges.visible=!1),this.currentPlan=null,await t.controls.setLookAt(this._previousCamera.x,this._previousCamera.y,this._previousCamera.z,this._previousTarget.x,this._previousTarget.y,this._previousTarget.z,e)}storeCameraPosition(){this.enabled?this.cacheFloorplanView():this.store3dCameraPosition()}createClippingPlane(e){if(!this.world)throw new Error("World is needed to create clipping planes!");const{normal:t,point:i}=e,n=i.clone();e.offset&&(n.y+=e.offset);const r=this.components.get(Ga),o=r.Type;r.Type=Gr;const a=r.createFromNormalAndCoplanarPoint(this.world,t,n);return a.edges.update(),a.visible=!1,a.enabled=!1,a.edges.enabled=!1,a.edges.visible=!1,r.Type=o,a}cacheFloorplanView(){if(!this.world)throw new Error("World is needed to create clipping planes!");this._floorPlanViewCached=!0,this.world.camera.controls.saveState()}async moveCameraTo2DPlanPosition(e){if(!this.world)throw new Error("World is needed to create clipping planes!");const t=this.world.camera;this._floorPlanViewCached?await t.controls.reset(e):await t.controls.setLookAt(0,100,0,0,0,0,e)}async activateCurrentPlan(){if(!this.world)throw new Error("World is needed to create clipping planes!");if(!this.currentPlan)throw new Error("Current plan is not defined.");const e=this.world.camera;this.currentPlan.plane&&(this.currentPlan.plane.enabled=!0,this.currentPlan.plane.edges.fillNeedsUpdate=!0,this.currentPlan.plane.edges.visible=!0),e.set("Plan");const t=this.currentPlan.ortho?"Orthographic":"Perspective";await e.projection.set(t)}store3dCameraPosition(){if(!this.world)throw new Error("World is needed to create clipping planes!");const e=this.world.camera;e.three.getWorldPosition(this._previousCamera),e.controls.getTarget(this._previousTarget),this._previousProjection=e.projection.current}updateCurrentPlan(e){const t=this.list.find(i=>i.id===e);if(!t)throw new Error("The specified plan is undefined!");this.currentPlan=t}async hidePreviousClippingPlane(){if(this.currentPlan){const e=this.currentPlan.plane;e&&(e.enabled=!1),this.currentPlan.plane instanceof Gr&&(this.currentPlan.plane.edges.visible=!1)}}getAbsoluteFloorHeight(e,t){const i=e.RelativePlacement.Location.Coordinates;t.value+=i[2].value,e.PlacementRelTo&&this.getAbsoluteFloorHeight(e.PlacementRelTo,t)}};x(Sb,"uuid","a80874aa-1c93-43a4-80f2-df346da086b1");var _b=Object.defineProperty,Rb=(s,e,t)=>e in s?_b(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Sn=(s,e,t)=>(Rb(s,typeof e!="symbol"?e+"":e,t),t);const Fs=Math.min,Pi=Math.max,Xa=Math.round,sn=s=>({x:s,y:s}),Pb={left:"right",right:"left",bottom:"top",top:"bottom"},Ob={start:"end",end:"start"};function ap(s,e,t){return Pi(s,Fs(e,t))}function ao(s,e){return typeof s=="function"?s(e):s}function Mi(s){return s.split("-")[0]}function El(s){return s.split("-")[1]}function Jm(s){return s==="x"?"y":"x"}function $m(s){return s==="y"?"height":"width"}function lo(s){return["top","bottom"].includes(Mi(s))?"y":"x"}function eg(s){return Jm(lo(s))}function Fb(s,e,t){t===void 0&&(t=!1);const i=El(s),n=eg(s),r=$m(n);let o=n==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(o=Ka(o)),[o,Ka(o)]}function Mb(s){const e=Ka(s);return[Sh(s),e,Sh(e)]}function Sh(s){return s.replace(/start|end/g,e=>Ob[e])}function Lb(s,e,t){const i=["left","right"],n=["right","left"],r=["top","bottom"],o=["bottom","top"];switch(s){case"top":case"bottom":return t?e?n:i:e?i:n;case"left":case"right":return e?r:o;default:return[]}}function Db(s,e,t,i){const n=El(s);let r=Lb(Mi(s),t==="start",i);return n&&(r=r.map(o=>o+"-"+n),e&&(r=r.concat(r.map(Sh)))),r}function Ka(s){return s.replace(/left|right|bottom|top/g,e=>Pb[e])}function Nb(s){return{top:0,right:0,bottom:0,left:0,...s}}function tg(s){return typeof s!="number"?Nb(s):{top:s,right:s,bottom:s,left:s}}function Ms(s){const{x:e,y:t,width:i,height:n}=s;return{width:i,height:n,top:t,left:e,right:e+i,bottom:t+n,x:e,y:t}}function lp(s,e,t){let{reference:i,floating:n}=s;const r=lo(e),o=eg(e),a=$m(o),l=Mi(e),h=r==="y",d=i.x+i.width/2-n.width/2,p=i.y+i.height/2-n.height/2,f=i[a]/2-n[a]/2;let g;switch(l){case"top":g={x:d,y:i.y-n.height};break;case"bottom":g={x:d,y:i.y+i.height};break;case"right":g={x:i.x+i.width,y:p};break;case"left":g={x:i.x-n.width,y:p};break;default:g={x:i.x,y:i.y}}switch(El(e)){case"start":g[o]-=f*(t&&h?-1:1);break;case"end":g[o]+=f*(t&&h?-1:1);break}return g}const Ub=async(s,e,t)=>{const{placement:i="bottom",strategy:n="absolute",middleware:r=[],platform:o}=t,a=r.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let h=await o.getElementRects({reference:s,floating:e,strategy:n}),{x:d,y:p}=lp(h,i,l),f=i,g={},v=0;for(let b=0;b$<=0)){var W,j;const $=(((W=r.flip)==null?void 0:W.index)||0)+1,ne=P[$];if(ne)return{data:{index:$,overflows:V},reset:{placement:ne}};let oe=(j=V.filter(ve=>ve.overflows[0]<=0).sort((ve,re)=>ve.overflows[1]-re.overflows[1])[0])==null?void 0:j.placement;if(!oe)switch(g){case"bestFit":{var Q;const ve=(Q=V.map(re=>[re.placement,re.overflows.filter(ge=>ge>0).reduce((ge,me)=>ge+me,0)]).sort((re,ge)=>re[1]-ge[1])[0])==null?void 0:Q[0];ve&&(oe=ve);break}case"initialPlacement":oe=a;break}if(n!==oe)return{reset:{placement:oe}}}return{}}}};function ig(s){const e=Fs(...s.map(r=>r.left)),t=Fs(...s.map(r=>r.top)),i=Pi(...s.map(r=>r.right)),n=Pi(...s.map(r=>r.bottom));return{x:e,y:t,width:i-e,height:n-t}}function Bb(s){const e=s.slice().sort((n,r)=>n.y-r.y),t=[];let i=null;for(let n=0;ni.height/2?t.push([r]):t[t.length-1].push(r),i=r}return t.map(n=>Ms(ig(n)))}const zb=function(s){return s===void 0&&(s={}),{name:"inline",options:s,async fn(e){const{placement:t,elements:i,rects:n,platform:r,strategy:o}=e,{padding:a=2,x:l,y:h}=ao(s,e),d=Array.from(await(r.getClientRects==null?void 0:r.getClientRects(i.reference))||[]),p=Bb(d),f=Ms(ig(d)),g=tg(a);function v(){if(p.length===2&&p[0].left>p[1].right&&l!=null&&h!=null)return p.find(w=>l>w.left-g.left&&lw.top-g.top&&h=2){if(lo(t)==="y"){const j=p[0],Q=p[p.length-1],$=Mi(t)==="top",ne=j.top,oe=Q.bottom,ve=$?j.left:Q.left,re=$?j.right:Q.right,ge=re-ve,me=oe-ne;return{top:ne,bottom:oe,left:ve,right:re,width:ge,height:me,x:ve,y:ne}}const w=Mi(t)==="left",T=Pi(...p.map(j=>j.right)),S=Fs(...p.map(j=>j.left)),_=p.filter(j=>w?j.left===S:j.right===T),I=_[0].top,P=_[_.length-1].bottom,M=S,k=T,V=k-M,W=P-I;return{top:I,bottom:P,left:M,right:k,width:V,height:W,x:M,y:I}}return f}const b=await r.getElementRects({reference:{getBoundingClientRect:v},floating:i.floating,strategy:o});return n.reference.x!==b.reference.x||n.reference.y!==b.reference.y||n.reference.width!==b.reference.width||n.reference.height!==b.reference.height?{reset:{rects:b}}:{}}}};async function Vb(s,e){const{placement:t,platform:i,elements:n}=s,r=await(i.isRTL==null?void 0:i.isRTL(n.floating)),o=Mi(t),a=El(t),l=lo(t)==="y",h=["left","top"].includes(o)?-1:1,d=r&&l?-1:1,p=ao(e,s);let{mainAxis:f,crossAxis:g,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...p};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*d,y:f*h}:{x:f*h,y:g*d}}const ng=function(s){return{name:"offset",options:s,async fn(e){var t,i;const{x:n,y:r,placement:o,middlewareData:a}=e,l=await Vb(e,s);return o===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:n+l.x,y:r+l.y,data:{...l,placement:o}}}}},Hb=function(s){return s===void 0&&(s={}),{name:"shift",options:s,async fn(e){const{x:t,y:i,placement:n}=e,{mainAxis:r=!0,crossAxis:o=!1,limiter:a={fn:w=>{let{x:T,y:S}=w;return{x:T,y:S}}},...l}=ao(s,e),h={x:t,y:i},d=await cu(e,l),p=lo(Mi(n)),f=Jm(p);let g=h[f],v=h[p];if(r){const w=f==="y"?"top":"left",T=f==="y"?"bottom":"right",S=g+d[w],_=g-d[T];g=ap(S,g,_)}if(o){const w=p==="y"?"top":"left",T=p==="y"?"bottom":"right",S=v+d[w],_=v-d[T];v=ap(S,v,_)}const b=a.fn({...e,[f]:g,[p]:v});return{...b,data:{x:b.x-t,y:b.y-i}}}}};function rn(s){return sg(s)?(s.nodeName||"").toLowerCase():"#document"}function Nt(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function ln(s){var e;return(e=(sg(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function sg(s){return s instanceof Node||s instanceof Nt(s).Node}function Li(s){return s instanceof Element||s instanceof Nt(s).Element}function yi(s){return s instanceof HTMLElement||s instanceof Nt(s).HTMLElement}function cp(s){return typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof Nt(s).ShadowRoot}function co(s){const{overflow:e,overflowX:t,overflowY:i,display:n}=Qt(s);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(n)}function Yb(s){return["table","td","th"].includes(rn(s))}function hu(s){const e=uu(),t=Qt(s);return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(t.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(t.contain||"").includes(i))}function Gb(s){let e=Ls(s);for(;yi(e)&&!bl(e);){if(hu(e))return e;e=Ls(e)}return null}function uu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function bl(s){return["html","body","#document"].includes(rn(s))}function Qt(s){return Nt(s).getComputedStyle(s)}function wl(s){return Li(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.pageXOffset,scrollTop:s.pageYOffset}}function Ls(s){if(rn(s)==="html")return s;const e=s.assignedSlot||s.parentNode||cp(s)&&s.host||ln(s);return cp(e)?e.host:e}function rg(s){const e=Ls(s);return bl(e)?s.ownerDocument?s.ownerDocument.body:s.body:yi(e)&&co(e)?e:rg(e)}function _h(s,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const n=rg(s),r=n===((i=s.ownerDocument)==null?void 0:i.body),o=Nt(n);return r?e.concat(o,o.visualViewport||[],co(n)?n:[],o.frameElement&&t?_h(o.frameElement):[]):e.concat(n,_h(n,[],t))}function og(s){const e=Qt(s);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const n=yi(s),r=n?s.offsetWidth:t,o=n?s.offsetHeight:i,a=Xa(t)!==r||Xa(i)!==o;return a&&(t=r,i=o),{width:t,height:i,$:a}}function ag(s){return Li(s)?s:s.contextElement}function _s(s){const e=ag(s);if(!yi(e))return sn(1);const t=e.getBoundingClientRect(),{width:i,height:n,$:r}=og(e);let o=(r?Xa(t.width):t.width)/i,a=(r?Xa(t.height):t.height)/n;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const jb=sn(0);function lg(s){const e=Nt(s);return!uu()||!e.visualViewport?jb:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Wb(s,e,t){return e===void 0&&(e=!1),!t||e&&t!==Nt(s)?!1:e}function jr(s,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const n=s.getBoundingClientRect(),r=ag(s);let o=sn(1);e&&(i?Li(i)&&(o=_s(i)):o=_s(s));const a=Wb(r,t,i)?lg(r):sn(0);let l=(n.left+a.x)/o.x,h=(n.top+a.y)/o.y,d=n.width/o.x,p=n.height/o.y;if(r){const f=Nt(r),g=i&&Li(i)?Nt(i):i;let v=f,b=v.frameElement;for(;b&&i&&g!==v;){const w=_s(b),T=b.getBoundingClientRect(),S=Qt(b),_=T.left+(b.clientLeft+parseFloat(S.paddingLeft))*w.x,I=T.top+(b.clientTop+parseFloat(S.paddingTop))*w.y;l*=w.x,h*=w.y,d*=w.x,p*=w.y,l+=_,h+=I,v=Nt(b),b=v.frameElement}}return Ms({width:d,height:p,x:l,y:h})}const Xb=[":popover-open",":modal"];function cg(s){return Xb.some(e=>{try{return s.matches(e)}catch{return!1}})}function Kb(s){let{elements:e,rect:t,offsetParent:i,strategy:n}=s;const r=n==="fixed",o=ln(i),a=e?cg(e.floating):!1;if(i===o||a&&r)return t;let l={scrollLeft:0,scrollTop:0},h=sn(1);const d=sn(0),p=yi(i);if((p||!p&&!r)&&((rn(i)!=="body"||co(o))&&(l=wl(i)),yi(i))){const f=jr(i);h=_s(i),d.x=f.x+i.clientLeft,d.y=f.y+i.clientTop}return{width:t.width*h.x,height:t.height*h.y,x:t.x*h.x-l.scrollLeft*h.x+d.x,y:t.y*h.y-l.scrollTop*h.y+d.y}}function Qb(s){return Array.from(s.getClientRects())}function hg(s){return jr(ln(s)).left+wl(s).scrollLeft}function Zb(s){const e=ln(s),t=wl(s),i=s.ownerDocument.body,n=Pi(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),r=Pi(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-t.scrollLeft+hg(s);const a=-t.scrollTop;return Qt(i).direction==="rtl"&&(o+=Pi(e.clientWidth,i.clientWidth)-n),{width:n,height:r,x:o,y:a}}function qb(s,e){const t=Nt(s),i=ln(s),n=t.visualViewport;let r=i.clientWidth,o=i.clientHeight,a=0,l=0;if(n){r=n.width,o=n.height;const h=uu();(!h||h&&e==="fixed")&&(a=n.offsetLeft,l=n.offsetTop)}return{width:r,height:o,x:a,y:l}}function Jb(s,e){const t=jr(s,!0,e==="fixed"),i=t.top+s.clientTop,n=t.left+s.clientLeft,r=yi(s)?_s(s):sn(1),o=s.clientWidth*r.x,a=s.clientHeight*r.y,l=n*r.x,h=i*r.y;return{width:o,height:a,x:l,y:h}}function hp(s,e,t){let i;if(e==="viewport")i=qb(s,t);else if(e==="document")i=Zb(ln(s));else if(Li(e))i=Jb(e,t);else{const n=lg(s);i={...e,x:e.x-n.x,y:e.y-n.y}}return Ms(i)}function ug(s,e){const t=Ls(s);return t===e||!Li(t)||bl(t)?!1:Qt(t).position==="fixed"||ug(t,e)}function $b(s,e){const t=e.get(s);if(t)return t;let i=_h(s,[],!1).filter(a=>Li(a)&&rn(a)!=="body"),n=null;const r=Qt(s).position==="fixed";let o=r?Ls(s):s;for(;Li(o)&&!bl(o);){const a=Qt(o),l=hu(o);!l&&a.position==="fixed"&&(n=null),(r?!l&&!n:!l&&a.position==="static"&&n&&["absolute","fixed"].includes(n.position)||co(o)&&!l&&ug(s,o))?i=i.filter(h=>h!==o):n=a,o=Ls(o)}return e.set(s,i),i}function ew(s){let{element:e,boundary:t,rootBoundary:i,strategy:n}=s;const r=[...t==="clippingAncestors"?$b(e,this._c):[].concat(t),i],o=r[0],a=r.reduce((l,h)=>{const d=hp(e,h,n);return l.top=Pi(d.top,l.top),l.right=Fs(d.right,l.right),l.bottom=Fs(d.bottom,l.bottom),l.left=Pi(d.left,l.left),l},hp(e,o,n));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function tw(s){const{width:e,height:t}=og(s);return{width:e,height:t}}function iw(s,e,t){const i=yi(e),n=ln(e),r=t==="fixed",o=jr(s,!0,r,e);let a={scrollLeft:0,scrollTop:0};const l=sn(0);if(i||!i&&!r)if((rn(e)!=="body"||co(n))&&(a=wl(e)),i){const p=jr(e,!0,r,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else n&&(l.x=hg(n));const h=o.left+a.scrollLeft-l.x,d=o.top+a.scrollTop-l.y;return{x:h,y:d,width:o.width,height:o.height}}function up(s,e){return!yi(s)||Qt(s).position==="fixed"?null:e?e(s):s.offsetParent}function dg(s,e){const t=Nt(s);if(!yi(s)||cg(s))return t;let i=up(s,e);for(;i&&Yb(i)&&Qt(i).position==="static";)i=up(i,e);return i&&(rn(i)==="html"||rn(i)==="body"&&Qt(i).position==="static"&&!hu(i))?t:i||Gb(s)||t}const nw=async function(s){const e=this.getOffsetParent||dg,t=this.getDimensions;return{reference:iw(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,...await t(s.floating)}}};function sw(s){return Qt(s).direction==="rtl"}const rw={convertOffsetParentRelativeRectToViewportRelativeRect:Kb,getDocumentElement:ln,getClippingRect:ew,getOffsetParent:dg,getElementRects:nw,getClientRects:Qb,getDimensions:tw,getScale:_s,isElement:Li,isRTL:sw},pg=Hb,fg=kb,mg=zb,gg=(s,e,t)=>{const i=new Map,n={platform:rw,...t},r={...n.platform,_c:i};return Ub(s,e,{...n,platform:r})};/** + `+C:""),this.inner=C||null):typeof E=="object"&&(this.message="".concat(E.name," ").concat(E.message),this.inner=E):(this.message=Bi[u]||m,this.inner=null)}return b(y).from(He),c[u]=y,c},{});fe.Syntax=SyntaxError,fe.Type=TypeError,fe.Range=RangeError;var We=tr.reduce(function(c,u){return c[u+"Error"]=fe[u],c},{}),qt=Bt.reduce(function(c,u){return["Syntax","Type","Range"].indexOf(u)===-1&&(c[u+"Error"]=fe[u]),c},{});function Le(){}function ai(c){return c}function Ll(c,u){return c==null||c===ai?u:function(m){return u(c(m))}}function Jt(c,u){return function(){c.apply(this,arguments),u.apply(this,arguments)}}function Js(c,u){return c===Le?u:function(){var m=c.apply(this,arguments);m!==void 0&&(arguments[0]=m);var y=this.onsuccess,E=this.onerror;this.onsuccess=null,this.onerror=null;var C=u.apply(this,arguments);return y&&(this.onsuccess=this.onsuccess?Jt(y,this.onsuccess):y),E&&(this.onerror=this.onerror?Jt(E,this.onerror):E),C!==void 0?C:m}}function $s(c,u){return c===Le?u:function(){c.apply(this,arguments);var m=this.onsuccess,y=this.onerror;this.onsuccess=this.onerror=null,u.apply(this,arguments),m&&(this.onsuccess=this.onsuccess?Jt(m,this.onsuccess):m),y&&(this.onerror=this.onerror?Jt(y,this.onerror):y)}}function Y0(c,u){return c===Le?u:function(m){var y=c.apply(this,arguments);l(m,y);var E=this.onsuccess,C=this.onerror;return this.onsuccess=null,this.onerror=null,m=u.apply(this,arguments),E&&(this.onsuccess=this.onsuccess?Jt(E,this.onsuccess):E),C&&(this.onerror=this.onerror?Jt(C,this.onerror):C),y===void 0?m===void 0?void 0:m:l(y,m)}}function G0(c,u){return c===Le?u:function(){return u.apply(this,arguments)!==!1&&c.apply(this,arguments)}}function Dl(c,u){return c===Le?u:function(){var m=c.apply(this,arguments);if(m&&typeof m.then=="function"){for(var y=this,E=arguments.length,C=new Array(E);E--;)C[E]=arguments[E];return m.then(function(){return u.apply(y,C)})}return u.apply(this,arguments)}}qt.ModifyError=je,qt.DexieError=At,qt.BulkError=ke;var li=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Ru(c){li=c}var er={},Pu=100,wi=typeof Promise>"u"?[]:function(){var c=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[c,h(c),c];var u=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[u,h(u),c]}(),tr=wi[0],Bt=wi[1],wi=wi[2],Bt=Bt&&Bt.then,ir=tr&&tr.constructor,Nl=!!wi,nr=function(c,u){sr.push([c,u]),Co&&(queueMicrotask(W0),Co=!1)},Ul=!0,Co=!0,mn=[],To=[],kl=ai,zi={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Le,pgp:!1,env:{},finalize:Le},ye=zi,sr=[],gn=0,xo=[];function de(c){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var u=this._PSD=ye;if(typeof c!="function"){if(c!==er)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&zl(this,this._value))}this._state=null,this._value=null,++u.ref,function m(y,E){try{E(function(C){if(y._state===null){if(C===y)throw new TypeError("A promise cannot be resolved with itself.");var R=y._lib&&$n();C&&typeof C.then=="function"?m(y,function(F,U){C instanceof de?C._then(F,U):C.then(F,U)}):(y._state=!0,y._value=C,Fu(y)),R&&es()}},zl.bind(null,y))}catch(C){zl(y,C)}}(this,c)}var Bl={get:function(){var c=ye,u=Ro;function m(y,E){var C=this,R=!c.global&&(c!==ye||u!==Ro),F=R&&!Hi(),U=new de(function(D,H){Vl(C,new Ou(Lu(y,c,R,F),Lu(E,c,R,F),D,H,c))});return this._consoleTask&&(U._consoleTask=this._consoleTask),U}return m.prototype=er,m},set:function(c){v(this,"then",c&&c.prototype===er?Bl:{get:function(){return c},set:Bl.set})}};function Ou(c,u,m,y,E){this.onFulfilled=typeof c=="function"?c:null,this.onRejected=typeof u=="function"?u:null,this.resolve=m,this.reject=y,this.psd=E}function zl(c,u){var m,y;To.push(u),c._state===null&&(m=c._lib&&$n(),u=kl(u),c._state=!1,c._value=u,y=c,mn.some(function(E){return E._value===y._value})||mn.push(y),Fu(c),m&&es())}function Fu(c){var u=c._listeners;c._listeners=[];for(var m=0,y=u.length;m.",Du="String expected.",is=[],Oo="__dbnames",Gl="readonly",jl="readwrite";function En(c,u){return c?u?function(){return c.apply(this,arguments)&&u.apply(this,arguments)}:c:u}var Nu={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Fo(c){return typeof c!="string"||/\./.test(c)?function(u){return u}:function(u){return u[c]===void 0&&c in u&&delete(u=ne(u))[c],u}}function Uu(){throw fe.Type()}function Fe(c,u){try{var m=ku(c),y=ku(u);if(m!==y)return m==="Array"?1:y==="Array"?-1:m==="binary"?1:y==="binary"?-1:m==="string"?1:y==="string"?-1:m==="Date"?1:y!=="Date"?NaN:-1;switch(m){case"number":case"Date":case"string":return uK+Z&&X(K+Y)})})}return X(0).then(function(){if(0=Y})).length!==0?(H.forEach(function(X){G.push(function(){var K=z,Z=X._cfg.dbschema;zo(L,K,B),zo(L,Z,B),z=L._dbSchema=Z;var q=tc(K,Z);q.add.forEach(function(he){ic(B,he[0],he[1].primKey,he[1].indexes)}),q.change.forEach(function(he){if(he.recreate)throw new fe.Upgrade("Not yet support for changing primary key");var ue=B.objectStore(he.name);he.add.forEach(function(Ie){return ko(ue,Ie)}),he.change.forEach(function(Ie){ue.deleteIndex(Ie.name),ko(ue,Ie)}),he.del.forEach(function(Ie){return ue.deleteIndex(Ie)})});var ie=X._cfg.contentUpgrade;if(ie&&X._cfg.version>Y){No(L,B),N._memoizedTables={};var ce=V(Z);q.del.forEach(function(he){ce[he]=K[he]}),ec(L,[L.Transaction.prototype]),Uo(L,[L.Transaction.prototype],o(ce),ce),N.schema=ce;var se,ae=Pt(ie);return ae&&ts(),q=de.follow(function(){var he;(se=ie(N))&&ae&&(he=Hi.bind(null,null),se.then(he,he))}),se&&typeof se.then=="function"?de.resolve(se):q.then(function(){return se})}}),G.push(function(K){var Z,q,ie=X._cfg.dbschema;Z=ie,q=K,[].slice.call(q.db.objectStoreNames).forEach(function(ce){return Z[ce]==null&&q.db.deleteObjectStore(ce)}),ec(L,[L.Transaction.prototype]),Uo(L,[L.Transaction.prototype],L._storeNames,L._dbSchema),N.schema=L._dbSchema}),G.push(function(K){L.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(L.idbdb.version/10)===X._cfg.version?(L.idbdb.deleteObjectStore("$meta"),delete L._dbSchema.$meta,L._storeNames=L._storeNames.filter(function(Z){return Z!=="$meta"})):K.objectStore("$meta").put(X._cfg.version,"version"))})}),function X(){return G.length?de.resolve(G.shift()(N.idbtrans)).then(X):de.resolve()}().then(function(){Ku(z,B)})):de.resolve();var L,Y,N,B,G,z}).catch(R)):(o(E).forEach(function(H){ic(m,H,E[H].primKey,E[H].indexes)}),No(c,m),void de.follow(function(){return c.on.populate.fire(C)}).catch(R));var U,D})}function rv(c,u){Ku(c._dbSchema,u),u.db.version%10!=0||u.objectStoreNames.contains("$meta")||u.db.createObjectStore("$meta").add(Math.ceil(u.db.version/10-1),"version");var m=Bo(0,c.idbdb,u);zo(c,c._dbSchema,u);for(var y=0,E=tc(m,c._dbSchema).change;yMath.pow(2,62)?0:z.oldVersion,L=z<1,c.idbdb=G.result,C&&rv(c,H),sv(c,z/10,H,N))},N),G.onsuccess=Ze(function(){H=null;var z,X,K,Z,q,ie=c.idbdb=G.result,ce=S(ie.objectStoreNames);if(0"u"?de.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(Y){function N(){return indexedDB.databases().finally(Y)}U=setInterval(N,100),N()}).finally(function(){return clearInterval(U)}):Promise.resolve()).then(F)]).then(function(){return R(),u.onReadyBeingFired=[],de.resolve(rc(function(){return c.on.ready.fire(c.vip)})).then(function Y(){if(0u.limit?Y.length=u.limit:c.length===u.limit&&Y.length=X.limit&&(!X.values||ie.req.values)&&dv(ie.req.query.range,X.query.range)}),!1,K,Z];case"count":return q=Z.find(function(ie){return sd(ie.req.query.range,X.query.range)}),[q,!!q,K,Z]}}(u,m,"query",C),H=D[0],L=D[1],Y=D[2],N=D[3];return H&&L?H.obsSet=C.obsSet:(L=y.query(C).then(function(B){var G=B.result;if(H&&(H.res=G),R){for(var z=0,X=G.length;z{await this.loadFoundGeometries(i),await this.unloadLostGeometries(n),this.setMeshVisibility(r,!0),this.setMeshVisibility(o,!1)})}get culler(){if(!this._culler)throw new Error("You must set a world before using the streamer!");return this._culler}dispose(){var e;this._isDisposing=!0,this.onFragmentsLoaded.reset(),this.onFragmentsDeleted.reset(),this._ramCache.clear(),this.models={},this._geometryInstances={},this._loadedFragments={},this.fragIDData.clear(),this._baseMaterial.dispose(),this._baseMaterialT.dispose(),(e=this._culler)==null||e.dispose(),this.onDisposed.trigger(xh.uuid),this.onDisposed.reset(),this._isDisposing=!1}async load(e,t,i){const{assets:n,geometries:r,globalDataFileId:o}=e,a=this.url+o,l=await(await fetch(a)).arrayBuffer(),h=new Uint8Array(l),d=this.components.get(rt).load(h,{coordinate:t});this.world.scene.three.add(d);const{opaque:p,transparent:f}=d.geometryIDs;for(const[v,b]of p){const w=d.keyFragments.get(b);if(w===void 0)throw new Error("Malformed fragments group!");this.fragIDData.set(w,[d,v,new Set])}for(const[v,b]of f){const w=d.keyFragments.get(b);if(w===void 0)throw new Error("Malformed fragments group!");this.fragIDData.set(w,[d,Math.abs(v),new Set])}this.culler.add(d.uuid,n,r),this.models[d.uuid]={assets:n,geometries:r};const g=new Map;for(const v of n){const b=v.id;for(const{transformation:w,geometryID:T,color:S}of v.geometries){g.has(T)||g.set(T,[]);const _=g.get(T);if(!_)throw new Error("Malformed instances");_.push({id:b,transformation:w,color:S})}}if(this._geometryInstances[d.uuid]=g,i){const v=new Map,b=new Map;for(const I in i.ids){const P=i.ids[I],M=parseInt(I,10);v.set(M,P)}for(const I in i.types){const P=i.types[I],M=parseInt(I,10);b.set(M,P)}const w=o.replace("-global","-properties");d.streamSettings={baseUrl:this.url,baseFileName:w,ids:v,types:b};const{indexesFile:T}=i,S=await(await fetch(this.url+T)).text(),_=this.components.get(gl);_.setRelationMap(d,_.getRelationsMapFromJSON(S))}return this.culler.needsUpdate=!0,d}remove(e){this._isDisposing=!0;const t=this.components.get(rt).groups.get(e);if(t===void 0){console.log("Group to delete not found.");return}delete this.models[e],delete this._geometryInstances[e],delete this._loadedFragments[e];const i=t.keyFragments.values();for(const n of i)this.fragIDData.delete(n);this.culler.remove(e),this._isDisposing=!1}setVisibility(e,t){const i=new Map;for(const n in t){const r=this.fragIDData.get(n);if(r===void 0)throw new Error("Geometry not found!");const[o,a,l]=r,h=o.uuid;i.has(h)||i.set(h,new Map);const d=i.get(h),p=t[n];for(const g of p)e?l.delete(g):l.add(g);d.get(a)||d.set(a,new Set);const f=d.get(a);for(const g of p)f.add(g)}for(const[n,r]of i){this.culler.setVisibility(e,n,r);for(const[o]of r){const a=this._loadedFragments[n];if(!a)continue;const l=a[o];if(l)for(const h of l){const d=t[h.id];d&&h.setVisibility(e,d)}}}this.culler.needsUpdate=!0}async clearCache(){await this._fileCache.delete()}get(){}update(){}async loadFoundGeometries(e){for(const t in e){if(this._isDisposing)return;const i=this.components.get(rt).groups.get(t);if(!i)return;const{geometries:n}=this.models[t],r=new Map,o=new Set;for(const[d,p]of e[t])for(const f of p){o.add(f);const g=n[f];if(!g)throw new Error("Geometry not found");if(g.geometryFile){const v=g.geometryFile,b=r.get(v)||0;r.set(v,b+d)}}const a=Array.from(r).sort((d,p)=>p[1]-d[1]);for(const[d]of a){const p=this.url+d;if(!this._ramCache.has(p)){let v=new Uint8Array;if(this.useCache){const w=await this._fileCache.files.get(p);if(w)v=w.file;else{const T=await(await fetch(p)).arrayBuffer();v=new Uint8Array(T),this._fileCache.files.add({file:v,id:p})}}else{const w=await(await fetch(p)).arrayBuffer();v=new Uint8Array(w)}const b=this.serializer.import(v);this._ramCache.set(p,{data:b,time:performance.now()})}const f=this._ramCache.get(p);if(!f)continue;f.time=performance.now();const g=[];if(f)for(const[v,{position:b,index:w,normal:T}]of f.data){if(this._isDisposing)return;if(!o.has(v)||!this._geometryInstances[t]||!this._geometryInstances[t].has(v))continue;const S=this._geometryInstances[t].get(v);if(!S)throw new Error("Instances not found!");const _=new Ne,I=new gt(b,3),P=new gt(T,3);_.setAttribute("position",I),_.setAttribute("normal",P),_.setIndex(Array.from(w));const M=[],k=[];for(const V of S)V.color[3]===1?k.push(V):M.push(V);this.newFragment(i,v,_,M,!0,g),this.newFragment(i,v,_,k,!1,g)}g.length&&!this._isDisposing&&this.onFragmentsLoaded.trigger(g)}const l=new Set,h=performance.now();for(const[d,{time:p}]of this._ramCache)h-p>this.maxRamTime&&l.add(d);for(const d of l)this._ramCache.delete(d)}}async unloadLostGeometries(e){if(this._isDisposing)return;const t=[],i=this.components.get(rt);for(const n in e){const r=i.groups.get(n);if(!r)throw new Error("Fragment group not found!");if(!this._loadedFragments[n])continue;const o=this._loadedFragments[n],a=e[n];for(const l of a){if(this.culler.removeFragment(r.uuid,l),!o[l])continue;const h=o[l];for(const d of h)r.items.splice(r.items.indexOf(d),1),t.push(d);delete o[l]}}t.length&&this.onFragmentsDeleted.trigger(t);for(const n of t)i.list.delete(n.id),this.world.meshes.delete(n.mesh),n.mesh.material=[],n.dispose(!0)}setMeshVisibility(e,t){for(const i in e)for(const n of e[i]){const r=this._loadedFragments[i];if(!r)continue;const o=r[n];if(o)for(const a of o)a.mesh.visible=t}}newFragment(e,t,i,n,r,o){if(n.length===0||this._isDisposing)return;const a=e.geometryIDs,l=r?a.transparent:a.opaque,h=t*(r?-1:1),d=l.get(h);if(d===void 0)return;const p=e.keyFragments.get(d);if(p===void 0)return;const f=this.components.get(rt);if(f.list.has(p))return;const g=r?this._baseMaterialT:this._baseMaterial,v=new Va(i,g,n.length);v.id=p,v.mesh.uuid=p,v.group=e,e.add(v.mesh),e.items.push(v),f.list.set(v.id,v),this.world.meshes.add(v.mesh),this._loadedFragments[e.uuid]||(this._loadedFragments[e.uuid]={});const b=this._loadedFragments[e.uuid];b[t]||(b[t]=[]),b[t].push(v);const w=new Map;for(let I=0;I{this.selection[this.config.hoverName]={}}),x(this,"onMouseDown",()=>{this.enabled&&(this._mouseState.down=!0)}),x(this,"onMouseUp",async t=>{const i=this.config.world;if(!i)throw new Error("No world found!");if(!i.renderer)throw new Error("This world doesn't have a renderer!");if(this.enabled&&t.target===i.renderer.three.domElement){if(this._mouseState.down=!1,this._mouseState.moved||t.button!==0){this._mouseState.moved=!1;return}if(this._mouseState.moved=!1,this.config.autoHighlightOnClick){const n=this.multiple==="none"?!0:!t[this.multiple];await this.highlight(this.config.selectName,n,this.zoomToSelection)}}}),x(this,"onMouseMove",async()=>{if(!this.enabled)return;if(this._mouseState.moved){this.clear(this.config.hoverName);return}this._mouseState.moved=this._mouseState.down;const t=this.selection[this.config.selectName];await this.highlight(this.config.hoverName,!0,!1,t)}),this.components.add(Ah.uuid,this)}async dispose(){this.setupEvents(!1),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.selection={};for(const e in this.events)this.events[e].onClear.reset(),this.events[e].onHighlight.reset();this.onSetup.reset(),this.events={},this.onDisposed.trigger(Ah.uuid),this.onDisposed.reset()}add(e,t){if(this.selection[e]||this.colors.has(e))throw new Error("A selection with that name already exists!");this.colors.set(e,t),this.selection[e]={},this.events[e]={onHighlight:new $,onClear:new $}}async highlight(e,t=!0,i=this.zoomToSelection,n={}){if(!this.enabled)return null;if(!this.config.world)throw new Error("No world found in config!");const r=this.config.world;if(!this.selection[e])throw new Error(`Selection ${e} does not exist.`);const o=this.components.get(rt).meshes,a=this.components.get(ni).get(r).castRay(o);if(!a||!a.face)return this.clear(e),null;const l=a.object,h=l.geometry,d=a.instanceId;if(!h||d===void 0)return null;const p=l.fragment.getItemID(d);if(p===null)throw new Error("Item ID not found!");const f=l.fragment.group;if(!f)throw new Error("Fragment must belong to a FragmentsGroup!");const g=f.getFragmentMap([p]),v={};for(const b in g){const w=g[b],T=n[b];for(const S of w)(!T||!T.has(S))&&(v[b]||(v[b]=new Set),v[b].add(S))}return await this.highlightByID(e,v,t,i),{id:p,fragments:g}}async highlightByID(e,t,i=!0,n=this.zoomToSelection){if(!this.enabled)return;i&&this.clear(e);const r=this.components.get(rt),o=this.colors.get(e);if(!o)throw new Error("Color for selection not found!");for(const a in t){const l=r.list.get(a);if(!l)continue;this.selection[e][a]||(this.selection[e][a]=new Set);const h=t[a];for(const d of h)this.selection[e][a].add(d),l.setColor(o,[d])}this.events[e].onHighlight.trigger(this.selection[e]),n&&await this.zoomSelection(e)}clear(e){const t=e?[e]:Object.keys(this.selection);for(const i of t){const n=this.components.get(rt),r=this.selection[i];for(const o in this.selection[i]){const a=n.list.get(o);if(!a)continue;const l=r[o];l&&(this.backupColor?a.setColor(this.backupColor):a.resetColor(l))}this.events[i].onClear.trigger(null),this.selection[i]={}}}setup(e){this.config={...this.config,...e},this.add(this.config.selectName,this.config.selectionColor),this.add(this.config.hoverName,this.config.hoverColor),this.setupEvents(!0),this.enabled=!0,this.isSetup=!0,this.onSetup.trigger(this)}async zoomSelection(e){if(!this.config.world)throw new Error("No world found in config!");const t=this.config.world;if(!t.camera.hasCameraControls())return;const i=this.components.get(tm),n=this.components.get(rt);i.reset();const r=this.selection[e];if(!Object.keys(r).length)return;for(const b in r){const w=n.list.get(b);if(!w)continue;const T=r[b];i.addMesh(w.mesh,T)}const o=i.getSphere(),a=1/0,l=-1/0,{x:h,y:d,z:p}=o.center,f=o.radius===a||h===a||d===a||p===a,g=o.radius===l||h===l||d===l||p===l,v=o.radius===0;f||g||v||(o.radius*=this.zoomFactor,await t.camera.controls.fitToSphere(o,!0))}setupEvents(e){if(!this.config.world)throw new Error("No world found while setting up events!");if(!this.config.world.renderer)throw new Error("The given world doesn't have a renderer!");const t=this.config.world.renderer.three.domElement,i=this.events[this.config.selectName].onHighlight;i.remove(this.clearHover),t.removeEventListener("mousedown",this.onMouseDown),t.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("mousemove",this.onMouseMove),e&&(i.add(this.clearHover),t.addEventListener("mousedown",this.onMouseDown),t.addEventListener("mouseup",this.onMouseUp),t.addEventListener("mousemove",this.onMouseMove))}};x(Ab,"uuid","cb8a76f2-654a-4b50-80c6-66fd83cafd77");const Sb=class qm extends Re{constructor(e){super(e),x(this,"onDisposed",new $),x(this,"onNavigated",new $),x(this,"onExited",new $),x(this,"enabled",!1),x(this,"currentPlan",null),x(this,"defaultSectionOffset",1.5),x(this,"defaultCameraOffset",30),x(this,"list",[]),x(this,"world"),x(this,"_floorPlanViewCached",!1),x(this,"_previousCamera",new O),x(this,"_previousTarget",new O),x(this,"_previousProjection","Perspective"),this.components.add(qm.uuid,this)}dispose(){this.onExited.reset(),this.onNavigated.reset(),this.list=[],this.onDisposed.trigger(),this.onDisposed.reset()}async generate(e){if(!e.hasProperties)throw new Error("Properties are needed to compute plan views!");const t=await e.getAllPropertiesOfType(dl);if(!t)throw new Error("Floorplans not found!");const i=e.coordinationMatrix.elements[13],n=await Dn.getUnits(e);for(const r of Object.values(t)){const o={value:0};this.getAbsoluteFloorHeight(r.ObjectPlacement,o);const a=o.value*n+i;this.create({name:r.Name.value,id:r.GlobalId.value,normal:new O(0,-1,0),point:new O(0,a,0),ortho:!0,offset:this.defaultSectionOffset})}}create(e){if(!this.world)throw new Error("You must set a world before creating the clipping planes!");if(this.list.find(n=>n.id===e.id)){console.warn(`There's already a plan with the id: ${e.id}`);return}const t=this.createClippingPlane(e),i={...e,plane:t};this.list.push(i)}async goTo(e,t=!1){var i;((i=this.currentPlan)==null?void 0:i.id)!==e&&(this.onNavigated.trigger({id:e}),this.storeCameraPosition(),await this.hidePreviousClippingPlane(),this.updateCurrentPlan(e),await this.activateCurrentPlan(),this.enabled||(await this.moveCameraTo2DPlanPosition(t),this.enabled=!0))}async exitPlanView(e=!1){if(!this.enabled||!this.world)return;this.enabled=!1,this.onExited.trigger(),this.cacheFloorplanView();const t=this.world.camera;t.set("Orbit"),await t.projection.set(this._previousProjection),this.currentPlan&&this.currentPlan.plane&&(this.currentPlan.plane.enabled=!1,this.currentPlan.plane.edges.enabled=!1,this.currentPlan.plane.edges.visible=!1),this.currentPlan=null,await t.controls.setLookAt(this._previousCamera.x,this._previousCamera.y,this._previousCamera.z,this._previousTarget.x,this._previousTarget.y,this._previousTarget.z,e)}storeCameraPosition(){this.enabled?this.cacheFloorplanView():this.store3dCameraPosition()}createClippingPlane(e){if(!this.world)throw new Error("World is needed to create clipping planes!");const{normal:t,point:i}=e,n=i.clone();e.offset&&(n.y+=e.offset);const r=this.components.get(Ga),o=r.Type;r.Type=Gr;const a=r.createFromNormalAndCoplanarPoint(this.world,t,n);return a.edges.update(),a.visible=!1,a.enabled=!1,a.edges.enabled=!1,a.edges.visible=!1,r.Type=o,a}cacheFloorplanView(){if(!this.world)throw new Error("World is needed to create clipping planes!");this._floorPlanViewCached=!0,this.world.camera.controls.saveState()}async moveCameraTo2DPlanPosition(e){if(!this.world)throw new Error("World is needed to create clipping planes!");const t=this.world.camera;this._floorPlanViewCached?await t.controls.reset(e):await t.controls.setLookAt(0,100,0,0,0,0,e)}async activateCurrentPlan(){if(!this.world)throw new Error("World is needed to create clipping planes!");if(!this.currentPlan)throw new Error("Current plan is not defined.");const e=this.world.camera;this.currentPlan.plane&&(this.currentPlan.plane.enabled=!0,this.currentPlan.plane.edges.fillNeedsUpdate=!0,this.currentPlan.plane.edges.visible=!0),e.set("Plan");const t=this.currentPlan.ortho?"Orthographic":"Perspective";await e.projection.set(t)}store3dCameraPosition(){if(!this.world)throw new Error("World is needed to create clipping planes!");const e=this.world.camera;e.three.getWorldPosition(this._previousCamera),e.controls.getTarget(this._previousTarget),this._previousProjection=e.projection.current}updateCurrentPlan(e){const t=this.list.find(i=>i.id===e);if(!t)throw new Error("The specified plan is undefined!");this.currentPlan=t}async hidePreviousClippingPlane(){if(this.currentPlan){const e=this.currentPlan.plane;e&&(e.enabled=!1),this.currentPlan.plane instanceof Gr&&(this.currentPlan.plane.edges.visible=!1)}}getAbsoluteFloorHeight(e,t){const i=e.RelativePlacement.Location.Coordinates;t.value+=i[2].value,e.PlacementRelTo&&this.getAbsoluteFloorHeight(e.PlacementRelTo,t)}};x(Sb,"uuid","a80874aa-1c93-43a4-80f2-df346da086b1");var _b=Object.defineProperty,Rb=(s,e,t)=>e in s?_b(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Sn=(s,e,t)=>(Rb(s,typeof e!="symbol"?e+"":e,t),t);const Fs=Math.min,Pi=Math.max,Xa=Math.round,sn=s=>({x:s,y:s}),Pb={left:"right",right:"left",bottom:"top",top:"bottom"},Ob={start:"end",end:"start"};function ap(s,e,t){return Pi(s,Fs(e,t))}function ao(s,e){return typeof s=="function"?s(e):s}function Mi(s){return s.split("-")[0]}function El(s){return s.split("-")[1]}function Jm(s){return s==="x"?"y":"x"}function $m(s){return s==="y"?"height":"width"}function lo(s){return["top","bottom"].includes(Mi(s))?"y":"x"}function eg(s){return Jm(lo(s))}function Fb(s,e,t){t===void 0&&(t=!1);const i=El(s),n=eg(s),r=$m(n);let o=n==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(o=Ka(o)),[o,Ka(o)]}function Mb(s){const e=Ka(s);return[Sh(s),e,Sh(e)]}function Sh(s){return s.replace(/start|end/g,e=>Ob[e])}function Lb(s,e,t){const i=["left","right"],n=["right","left"],r=["top","bottom"],o=["bottom","top"];switch(s){case"top":case"bottom":return t?e?n:i:e?i:n;case"left":case"right":return e?r:o;default:return[]}}function Db(s,e,t,i){const n=El(s);let r=Lb(Mi(s),t==="start",i);return n&&(r=r.map(o=>o+"-"+n),e&&(r=r.concat(r.map(Sh)))),r}function Ka(s){return s.replace(/left|right|bottom|top/g,e=>Pb[e])}function Nb(s){return{top:0,right:0,bottom:0,left:0,...s}}function tg(s){return typeof s!="number"?Nb(s):{top:s,right:s,bottom:s,left:s}}function Ms(s){const{x:e,y:t,width:i,height:n}=s;return{width:i,height:n,top:t,left:e,right:e+i,bottom:t+n,x:e,y:t}}function lp(s,e,t){let{reference:i,floating:n}=s;const r=lo(e),o=eg(e),a=$m(o),l=Mi(e),h=r==="y",d=i.x+i.width/2-n.width/2,p=i.y+i.height/2-n.height/2,f=i[a]/2-n[a]/2;let g;switch(l){case"top":g={x:d,y:i.y-n.height};break;case"bottom":g={x:d,y:i.y+i.height};break;case"right":g={x:i.x+i.width,y:p};break;case"left":g={x:i.x-n.width,y:p};break;default:g={x:i.x,y:i.y}}switch(El(e)){case"start":g[o]-=f*(t&&h?-1:1);break;case"end":g[o]+=f*(t&&h?-1:1);break}return g}const Ub=async(s,e,t)=>{const{placement:i="bottom",strategy:n="absolute",middleware:r=[],platform:o}=t,a=r.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let h=await o.getElementRects({reference:s,floating:e,strategy:n}),{x:d,y:p}=lp(h,i,l),f=i,g={},v=0;for(let b=0;bee<=0)){var W,j;const ee=(((W=r.flip)==null?void 0:W.index)||0)+1,ne=P[ee];if(ne)return{data:{index:ee,overflows:V},reset:{placement:ne}};let oe=(j=V.filter(ve=>ve.overflows[0]<=0).sort((ve,re)=>ve.overflows[1]-re.overflows[1])[0])==null?void 0:j.placement;if(!oe)switch(g){case"bestFit":{var Q;const ve=(Q=V.map(re=>[re.placement,re.overflows.filter(ge=>ge>0).reduce((ge,me)=>ge+me,0)]).sort((re,ge)=>re[1]-ge[1])[0])==null?void 0:Q[0];ve&&(oe=ve);break}case"initialPlacement":oe=a;break}if(n!==oe)return{reset:{placement:oe}}}return{}}}};function ig(s){const e=Fs(...s.map(r=>r.left)),t=Fs(...s.map(r=>r.top)),i=Pi(...s.map(r=>r.right)),n=Pi(...s.map(r=>r.bottom));return{x:e,y:t,width:i-e,height:n-t}}function Bb(s){const e=s.slice().sort((n,r)=>n.y-r.y),t=[];let i=null;for(let n=0;ni.height/2?t.push([r]):t[t.length-1].push(r),i=r}return t.map(n=>Ms(ig(n)))}const zb=function(s){return s===void 0&&(s={}),{name:"inline",options:s,async fn(e){const{placement:t,elements:i,rects:n,platform:r,strategy:o}=e,{padding:a=2,x:l,y:h}=ao(s,e),d=Array.from(await(r.getClientRects==null?void 0:r.getClientRects(i.reference))||[]),p=Bb(d),f=Ms(ig(d)),g=tg(a);function v(){if(p.length===2&&p[0].left>p[1].right&&l!=null&&h!=null)return p.find(w=>l>w.left-g.left&&lw.top-g.top&&h=2){if(lo(t)==="y"){const j=p[0],Q=p[p.length-1],ee=Mi(t)==="top",ne=j.top,oe=Q.bottom,ve=ee?j.left:Q.left,re=ee?j.right:Q.right,ge=re-ve,me=oe-ne;return{top:ne,bottom:oe,left:ve,right:re,width:ge,height:me,x:ve,y:ne}}const w=Mi(t)==="left",T=Pi(...p.map(j=>j.right)),S=Fs(...p.map(j=>j.left)),_=p.filter(j=>w?j.left===S:j.right===T),I=_[0].top,P=_[_.length-1].bottom,M=S,k=T,V=k-M,W=P-I;return{top:I,bottom:P,left:M,right:k,width:V,height:W,x:M,y:I}}return f}const b=await r.getElementRects({reference:{getBoundingClientRect:v},floating:i.floating,strategy:o});return n.reference.x!==b.reference.x||n.reference.y!==b.reference.y||n.reference.width!==b.reference.width||n.reference.height!==b.reference.height?{reset:{rects:b}}:{}}}};async function Vb(s,e){const{placement:t,platform:i,elements:n}=s,r=await(i.isRTL==null?void 0:i.isRTL(n.floating)),o=Mi(t),a=El(t),l=lo(t)==="y",h=["left","top"].includes(o)?-1:1,d=r&&l?-1:1,p=ao(e,s);let{mainAxis:f,crossAxis:g,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...p};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*d,y:f*h}:{x:f*h,y:g*d}}const ng=function(s){return{name:"offset",options:s,async fn(e){var t,i;const{x:n,y:r,placement:o,middlewareData:a}=e,l=await Vb(e,s);return o===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:n+l.x,y:r+l.y,data:{...l,placement:o}}}}},Hb=function(s){return s===void 0&&(s={}),{name:"shift",options:s,async fn(e){const{x:t,y:i,placement:n}=e,{mainAxis:r=!0,crossAxis:o=!1,limiter:a={fn:w=>{let{x:T,y:S}=w;return{x:T,y:S}}},...l}=ao(s,e),h={x:t,y:i},d=await cu(e,l),p=lo(Mi(n)),f=Jm(p);let g=h[f],v=h[p];if(r){const w=f==="y"?"top":"left",T=f==="y"?"bottom":"right",S=g+d[w],_=g-d[T];g=ap(S,g,_)}if(o){const w=p==="y"?"top":"left",T=p==="y"?"bottom":"right",S=v+d[w],_=v-d[T];v=ap(S,v,_)}const b=a.fn({...e,[f]:g,[p]:v});return{...b,data:{x:b.x-t,y:b.y-i}}}}};function rn(s){return sg(s)?(s.nodeName||"").toLowerCase():"#document"}function Nt(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function ln(s){var e;return(e=(sg(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function sg(s){return s instanceof Node||s instanceof Nt(s).Node}function Li(s){return s instanceof Element||s instanceof Nt(s).Element}function yi(s){return s instanceof HTMLElement||s instanceof Nt(s).HTMLElement}function cp(s){return typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof Nt(s).ShadowRoot}function co(s){const{overflow:e,overflowX:t,overflowY:i,display:n}=Qt(s);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(n)}function Yb(s){return["table","td","th"].includes(rn(s))}function hu(s){const e=uu(),t=Qt(s);return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(t.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(t.contain||"").includes(i))}function Gb(s){let e=Ls(s);for(;yi(e)&&!bl(e);){if(hu(e))return e;e=Ls(e)}return null}function uu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function bl(s){return["html","body","#document"].includes(rn(s))}function Qt(s){return Nt(s).getComputedStyle(s)}function wl(s){return Li(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.pageXOffset,scrollTop:s.pageYOffset}}function Ls(s){if(rn(s)==="html")return s;const e=s.assignedSlot||s.parentNode||cp(s)&&s.host||ln(s);return cp(e)?e.host:e}function rg(s){const e=Ls(s);return bl(e)?s.ownerDocument?s.ownerDocument.body:s.body:yi(e)&&co(e)?e:rg(e)}function _h(s,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const n=rg(s),r=n===((i=s.ownerDocument)==null?void 0:i.body),o=Nt(n);return r?e.concat(o,o.visualViewport||[],co(n)?n:[],o.frameElement&&t?_h(o.frameElement):[]):e.concat(n,_h(n,[],t))}function og(s){const e=Qt(s);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const n=yi(s),r=n?s.offsetWidth:t,o=n?s.offsetHeight:i,a=Xa(t)!==r||Xa(i)!==o;return a&&(t=r,i=o),{width:t,height:i,$:a}}function ag(s){return Li(s)?s:s.contextElement}function _s(s){const e=ag(s);if(!yi(e))return sn(1);const t=e.getBoundingClientRect(),{width:i,height:n,$:r}=og(e);let o=(r?Xa(t.width):t.width)/i,a=(r?Xa(t.height):t.height)/n;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const jb=sn(0);function lg(s){const e=Nt(s);return!uu()||!e.visualViewport?jb:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Wb(s,e,t){return e===void 0&&(e=!1),!t||e&&t!==Nt(s)?!1:e}function jr(s,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const n=s.getBoundingClientRect(),r=ag(s);let o=sn(1);e&&(i?Li(i)&&(o=_s(i)):o=_s(s));const a=Wb(r,t,i)?lg(r):sn(0);let l=(n.left+a.x)/o.x,h=(n.top+a.y)/o.y,d=n.width/o.x,p=n.height/o.y;if(r){const f=Nt(r),g=i&&Li(i)?Nt(i):i;let v=f,b=v.frameElement;for(;b&&i&&g!==v;){const w=_s(b),T=b.getBoundingClientRect(),S=Qt(b),_=T.left+(b.clientLeft+parseFloat(S.paddingLeft))*w.x,I=T.top+(b.clientTop+parseFloat(S.paddingTop))*w.y;l*=w.x,h*=w.y,d*=w.x,p*=w.y,l+=_,h+=I,v=Nt(b),b=v.frameElement}}return Ms({width:d,height:p,x:l,y:h})}const Xb=[":popover-open",":modal"];function cg(s){return Xb.some(e=>{try{return s.matches(e)}catch{return!1}})}function Kb(s){let{elements:e,rect:t,offsetParent:i,strategy:n}=s;const r=n==="fixed",o=ln(i),a=e?cg(e.floating):!1;if(i===o||a&&r)return t;let l={scrollLeft:0,scrollTop:0},h=sn(1);const d=sn(0),p=yi(i);if((p||!p&&!r)&&((rn(i)!=="body"||co(o))&&(l=wl(i)),yi(i))){const f=jr(i);h=_s(i),d.x=f.x+i.clientLeft,d.y=f.y+i.clientTop}return{width:t.width*h.x,height:t.height*h.y,x:t.x*h.x-l.scrollLeft*h.x+d.x,y:t.y*h.y-l.scrollTop*h.y+d.y}}function Qb(s){return Array.from(s.getClientRects())}function hg(s){return jr(ln(s)).left+wl(s).scrollLeft}function Zb(s){const e=ln(s),t=wl(s),i=s.ownerDocument.body,n=Pi(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),r=Pi(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-t.scrollLeft+hg(s);const a=-t.scrollTop;return Qt(i).direction==="rtl"&&(o+=Pi(e.clientWidth,i.clientWidth)-n),{width:n,height:r,x:o,y:a}}function qb(s,e){const t=Nt(s),i=ln(s),n=t.visualViewport;let r=i.clientWidth,o=i.clientHeight,a=0,l=0;if(n){r=n.width,o=n.height;const h=uu();(!h||h&&e==="fixed")&&(a=n.offsetLeft,l=n.offsetTop)}return{width:r,height:o,x:a,y:l}}function Jb(s,e){const t=jr(s,!0,e==="fixed"),i=t.top+s.clientTop,n=t.left+s.clientLeft,r=yi(s)?_s(s):sn(1),o=s.clientWidth*r.x,a=s.clientHeight*r.y,l=n*r.x,h=i*r.y;return{width:o,height:a,x:l,y:h}}function hp(s,e,t){let i;if(e==="viewport")i=qb(s,t);else if(e==="document")i=Zb(ln(s));else if(Li(e))i=Jb(e,t);else{const n=lg(s);i={...e,x:e.x-n.x,y:e.y-n.y}}return Ms(i)}function ug(s,e){const t=Ls(s);return t===e||!Li(t)||bl(t)?!1:Qt(t).position==="fixed"||ug(t,e)}function $b(s,e){const t=e.get(s);if(t)return t;let i=_h(s,[],!1).filter(a=>Li(a)&&rn(a)!=="body"),n=null;const r=Qt(s).position==="fixed";let o=r?Ls(s):s;for(;Li(o)&&!bl(o);){const a=Qt(o),l=hu(o);!l&&a.position==="fixed"&&(n=null),(r?!l&&!n:!l&&a.position==="static"&&n&&["absolute","fixed"].includes(n.position)||co(o)&&!l&&ug(s,o))?i=i.filter(h=>h!==o):n=a,o=Ls(o)}return e.set(s,i),i}function ew(s){let{element:e,boundary:t,rootBoundary:i,strategy:n}=s;const r=[...t==="clippingAncestors"?$b(e,this._c):[].concat(t),i],o=r[0],a=r.reduce((l,h)=>{const d=hp(e,h,n);return l.top=Pi(d.top,l.top),l.right=Fs(d.right,l.right),l.bottom=Fs(d.bottom,l.bottom),l.left=Pi(d.left,l.left),l},hp(e,o,n));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function tw(s){const{width:e,height:t}=og(s);return{width:e,height:t}}function iw(s,e,t){const i=yi(e),n=ln(e),r=t==="fixed",o=jr(s,!0,r,e);let a={scrollLeft:0,scrollTop:0};const l=sn(0);if(i||!i&&!r)if((rn(e)!=="body"||co(n))&&(a=wl(e)),i){const p=jr(e,!0,r,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else n&&(l.x=hg(n));const h=o.left+a.scrollLeft-l.x,d=o.top+a.scrollTop-l.y;return{x:h,y:d,width:o.width,height:o.height}}function up(s,e){return!yi(s)||Qt(s).position==="fixed"?null:e?e(s):s.offsetParent}function dg(s,e){const t=Nt(s);if(!yi(s)||cg(s))return t;let i=up(s,e);for(;i&&Yb(i)&&Qt(i).position==="static";)i=up(i,e);return i&&(rn(i)==="html"||rn(i)==="body"&&Qt(i).position==="static"&&!hu(i))?t:i||Gb(s)||t}const nw=async function(s){const e=this.getOffsetParent||dg,t=this.getDimensions;return{reference:iw(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,...await t(s.floating)}}};function sw(s){return Qt(s).direction==="rtl"}const rw={convertOffsetParentRelativeRectToViewportRelativeRect:Kb,getDocumentElement:ln,getClippingRect:ew,getOffsetParent:dg,getElementRects:nw,getClientRects:Qb,getDimensions:tw,getScale:_s,isElement:Li,isRTL:sw},pg=Hb,fg=kb,mg=zb,gg=(s,e,t)=>{const i=new Map,n={platform:rw,...t},r={...n.platform,_c:i};return Ub(s,e,{...n,platform:r})};/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause @@ -3084,7 +3084,7 @@ void main() { * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */function ET(s){return oi({...s,state:!0,attribute:!1})}class bT extends kn{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Ve(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&t.element.parentNode!==null&&t.element.parentNode.removeChild(t.element)})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}new O;new Ee;new Ee;new O;new O;class wT{constructor(e,t){this._group=new Os,this._frustum=new Zv,this._frustumMat=new Ee,this._regenerateDelay=200,this._regenerateCounter=0,this.material=new Di({color:"#2e3338"}),this.numbers=new Os,this.maxRegenerateRetrys=4,this.gridsFactor=5,this._scaleX=1,this._scaleY=1,this._camera=e,this._container=t;const i=this.newGrid(-1),n=this.newGrid(-2);this.grids={main:i,secondary:n},this._group.add(n,i,this.numbers)}set scaleX(e){this._scaleX=e,this.regenerate()}get scaleX(){return this._scaleX}set scaleY(e){this._scaleY=e,this.regenerate()}get scaleY(){return this._scaleY}get(){return this._group}dispose(){const{main:e,secondary:t}=this.grids;e.removeFromParent(),t.removeFromParent(),e.geometry.dispose(),e.material.dispose(),t.geometry.dispose(),t.material.dispose()}regenerate(){if(!this.isGridReady()){if(this._regenerateCounter++,this._regenerateCounter>this.maxRegenerateRetrys)throw new Error("Grid could not be regenerated");setTimeout(()=>this.regenerate,this._regenerateDelay);return}this._regenerateCounter=0,this._camera.updateMatrix(),this._camera.updateMatrixWorld();const e=this._frustumMat.multiplyMatrices(this._camera.projectionMatrix,this._camera.matrixWorldInverse);this._frustum.setFromProjectionMatrix(e);const{planes:t}=this._frustum,i=t[0].constant*-t[0].normal.x,n=t[1].constant*-t[1].normal.x,r=t[2].constant*-t[2].normal.y,o=t[3].constant*-t[3].normal.y,a=Math.abs(i-n),l=Math.abs(o-r),{clientWidth:h,clientHeight:d}=this._container,p=Math.max(h,d),f=Math.max(a,l)/p,g=Math.ceil(Math.log10(a/this.scaleX)),v=Math.ceil(Math.log10(l/this.scaleY)),b=10**(g-2)*this.scaleX,w=10**(v-2)*this.scaleY,T=b*this.gridsFactor,S=w*this.gridsFactor,_=Math.ceil(l/S),I=Math.ceil(a/T),P=Math.ceil(l/w),M=Math.ceil(a/b),k=b*Math.ceil(n/b),V=w*Math.ceil(r/w),W=T*Math.ceil(n/T),j=S*Math.ceil(r/S),Q=[...this.numbers.children];for(const je of Q)je.removeFromParent();this.numbers.children=[];const $=[],ne=9*f,oe=1e4,ve=Math.round(Math.abs(W/this.scaleX)*oe)/oe,re=(I-1)*T,ge=Math.round(Math.abs((W+re)/this.scaleX)*oe)/oe,me=Math.max(ve,ge).toString().length*ne;let we=Math.ceil(me/T)*T;for(let je=0;je.01)continue;const fe=this.newNumber(It),We=12*f;fe.position.set(ke,r+We,0)}for(let je=0;je<_;je++){const ke=j+je*S;$.push(n,ke,0,i,ke,0);const It=this.newNumber(ke/this.scaleY);let He=12;It.element.textContent&&(He+=4*It.element.textContent.length);const fe=He*f;It.position.set(n+fe,ke,0)}const Ge=[];for(let je=0;je{for(var n=CT(e,t),r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=o(e,t,n)||n);return n&&IT(e,t,n),n};const V0=class extends Rs{constructor(){super(...arguments),this._grid=null,this._world=null,this.resize=()=>{this._world&&this._grid&&this._grid.regenerate()}}set gridColor(e){if(this._gridColor=e,!(e&&this._grid))return;const t=Number(e.replace("#","0x"));Number.isNaN(t)||this._grid.material.color.setHex(t)}get gridColor(){return this._gridColor}set gridScaleX(e){this._gridScaleX=e,e&&this._grid&&(this._grid.scaleX=e)}get gridScaleX(){return this._gridScaleX}set gridScaleY(e){this._gridScaleY=e,e&&this._grid&&(this._grid.scaleY=e)}get gridScaleY(){return this._gridScaleY}set components(e){this.dispose();const t=e.get(Ev).create();this._world=t,t.scene=new bv(e),t.scene.setup(),t.renderer=new Am(e,this);const i=new wv(e);t.camera=i;const n=new wT(i.threeOrtho,this);this._grid=n,t.scene.three.add(n.get()),i.controls.addEventListener("update",()=>n.regenerate()),setTimeout(async()=>{t.camera.updateAspect(),i.set("Plan"),await i.controls.setLookAt(0,0,100,0,0,0),await i.projection.set("Orthographic"),i.controls.dollySpeed=3,i.controls.draggingSmoothTime=.085,i.controls.maxZoom=1e3,i.controls.zoom(4)})}get world(){return this._world}dispose(){var e;(e=this.world)==null||e.dispose(),this._world=null,this._grid=null}connectedCallback(){super.connectedCallback(),new ResizeObserver(this.resize).observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.dispose()}render(){return B0``}};V0.styles=L0` + */function ET(s){return oi({...s,state:!0,attribute:!1})}class bT extends kn{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Ve(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&t.element.parentNode!==null&&t.element.parentNode.removeChild(t.element)})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}new O;new Ee;new Ee;new O;new O;class wT{constructor(e,t){this._group=new Os,this._frustum=new Zv,this._frustumMat=new Ee,this._regenerateDelay=200,this._regenerateCounter=0,this.material=new Di({color:"#2e3338"}),this.numbers=new Os,this.maxRegenerateRetrys=4,this.gridsFactor=5,this._scaleX=1,this._scaleY=1,this._camera=e,this._container=t;const i=this.newGrid(-1),n=this.newGrid(-2);this.grids={main:i,secondary:n},this._group.add(n,i,this.numbers)}set scaleX(e){this._scaleX=e,this.regenerate()}get scaleX(){return this._scaleX}set scaleY(e){this._scaleY=e,this.regenerate()}get scaleY(){return this._scaleY}get(){return this._group}dispose(){const{main:e,secondary:t}=this.grids;e.removeFromParent(),t.removeFromParent(),e.geometry.dispose(),e.material.dispose(),t.geometry.dispose(),t.material.dispose()}regenerate(){if(!this.isGridReady()){if(this._regenerateCounter++,this._regenerateCounter>this.maxRegenerateRetrys)throw new Error("Grid could not be regenerated");setTimeout(()=>this.regenerate,this._regenerateDelay);return}this._regenerateCounter=0,this._camera.updateMatrix(),this._camera.updateMatrixWorld();const e=this._frustumMat.multiplyMatrices(this._camera.projectionMatrix,this._camera.matrixWorldInverse);this._frustum.setFromProjectionMatrix(e);const{planes:t}=this._frustum,i=t[0].constant*-t[0].normal.x,n=t[1].constant*-t[1].normal.x,r=t[2].constant*-t[2].normal.y,o=t[3].constant*-t[3].normal.y,a=Math.abs(i-n),l=Math.abs(o-r),{clientWidth:h,clientHeight:d}=this._container,p=Math.max(h,d),f=Math.max(a,l)/p,g=Math.ceil(Math.log10(a/this.scaleX)),v=Math.ceil(Math.log10(l/this.scaleY)),b=10**(g-2)*this.scaleX,w=10**(v-2)*this.scaleY,T=b*this.gridsFactor,S=w*this.gridsFactor,_=Math.ceil(l/S),I=Math.ceil(a/T),P=Math.ceil(l/w),M=Math.ceil(a/b),k=b*Math.ceil(n/b),V=w*Math.ceil(r/w),W=T*Math.ceil(n/T),j=S*Math.ceil(r/S),Q=[...this.numbers.children];for(const je of Q)je.removeFromParent();this.numbers.children=[];const ee=[],ne=9*f,oe=1e4,ve=Math.round(Math.abs(W/this.scaleX)*oe)/oe,re=(I-1)*T,ge=Math.round(Math.abs((W+re)/this.scaleX)*oe)/oe,me=Math.max(ve,ge).toString().length*ne;let we=Math.ceil(me/T)*T;for(let je=0;je.01)continue;const fe=this.newNumber(It),We=12*f;fe.position.set(ke,r+We,0)}for(let je=0;je<_;je++){const ke=j+je*S;ee.push(n,ke,0,i,ke,0);const It=this.newNumber(ke/this.scaleY);let He=12;It.element.textContent&&(He+=4*It.element.textContent.length);const fe=He*f;It.position.set(n+fe,ke,0)}const Ge=[];for(let je=0;je{for(var n=CT(e,t),r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=o(e,t,n)||n);return n&&IT(e,t,n),n};const V0=class extends Rs{constructor(){super(...arguments),this._grid=null,this._world=null,this.resize=()=>{this._world&&this._grid&&this._grid.regenerate()}}set gridColor(e){if(this._gridColor=e,!(e&&this._grid))return;const t=Number(e.replace("#","0x"));Number.isNaN(t)||this._grid.material.color.setHex(t)}get gridColor(){return this._gridColor}set gridScaleX(e){this._gridScaleX=e,e&&this._grid&&(this._grid.scaleX=e)}get gridScaleX(){return this._gridScaleX}set gridScaleY(e){this._gridScaleY=e,e&&this._grid&&(this._grid.scaleY=e)}get gridScaleY(){return this._gridScaleY}set components(e){this.dispose();const t=e.get(Ev).create();this._world=t,t.scene=new bv(e),t.scene.setup(),t.renderer=new Am(e,this);const i=new wv(e);t.camera=i;const n=new wT(i.threeOrtho,this);this._grid=n,t.scene.three.add(n.get()),i.controls.addEventListener("update",()=>n.regenerate()),setTimeout(async()=>{t.camera.updateAspect(),i.set("Plan"),await i.controls.setLookAt(0,0,100,0,0,0),await i.projection.set("Orthographic"),i.controls.dollySpeed=3,i.controls.draggingSmoothTime=.085,i.controls.maxZoom=1e3,i.controls.zoom(4)})}get world(){return this._world}dispose(){var e;(e=this.world)==null||e.dispose(),this._world=null,this._grid=null}connectedCallback(){super.connectedCallback(),new ResizeObserver(this.resize).observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.dispose()}render(){return B0``}};V0.styles=L0` :host { position: relative; display: flex; diff --git a/examples/assets/index-WVnKWA4H.js b/examples/assets/index-B1Q8f4gg.js similarity index 97% rename from examples/assets/index-WVnKWA4H.js rename to examples/assets/index-B1Q8f4gg.js index bc2b5dd18..40af74adf 100644 --- a/examples/assets/index-WVnKWA4H.js +++ b/examples/assets/index-B1Q8f4gg.js @@ -1 +1 @@ -var _=Object.defineProperty;var w=(u,c,e)=>c in u?_(u,c,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[c]=e;var l=(u,c,e)=>(w(u,typeof c!="symbol"?c+"":c,e),e);import{V as f,c as L,e as K,M as E}from"./web-ifc-api-BC8YMRiS.js";import{J as S,U as F}from"./index-b4ozRbQy.js";import{M as g}from"./mark-Cj_PmUva.js";const d=class d extends S{constructor(e){super(e);l(this,"onDisposed",new F);l(this,"enabled",!0);l(this,"threshold",50);l(this,"autoCluster",!0);l(this,"list",new Map);l(this,"_worldEvents",new Map);l(this,"clusterLabels",new Set);l(this,"currentKeys",new Set);l(this,"_color","white");l(this,"_markerKey",0);l(this,"_clusterKey",0);l(this,"_setupWorlds",new Set);e.add(d.uuid,this)}get color(){return this._color}set color(e){this._color=e;for(const[t,r]of this.list)for(const[s,n]of r)n.label.three.element.style.color=e}create(e,t,r,s=!1){this.setupEvents(e,!0);const n=this._markerKey.toString(),o=this.getWorldMarkerList(e);if(o.has(n))return;const i=document.createElement("span");i.innerHTML=t,i.style.color=this._color;const a=new g(e,i);return a.three.position.copy(r),o.set(n,{key:n,label:a,merged:!1,static:s}),this._markerKey++,n}delete(e){for(const[t,r]of this.list){const s=r.get(e);s&&s.label.dispose(),r.delete(e)}}getWorldMarkerList(e){return this.list.has(e.uuid)||this.list.set(e.uuid,new Map),this.list.get(e.uuid)}dispose(e){for(const[t,r]of this.list){const s=[...r.keys()];for(const n of s){const o=r.get(n);e&&o.type!==e||(o.label.dispose(),r.delete(n))}}if(!e){this.list.clear(),this._markerKey=0;for(const t of this.clusterLabels)t.label.dispose();this.clusterLabels.clear(),this._clusterKey=0,this.currentKeys.clear()}this.onDisposed.trigger()}setupEvents(e,t){if(t&&this._setupWorlds.has(e.uuid)||!e.camera.hasCameraControls())return;const r=this.getWorldEvent(e);e.camera.controls.removeEventListener("sleep",r),e.camera.controls.removeEventListener("rest",r),t&&(e.camera.controls.addEventListener("sleep",r),e.camera.controls.addEventListener("rest",r))}getWorldEvent(e){if(!this._worldEvents.has(e.uuid)){const t=()=>{this.cluster(e)};this._worldEvents.set(e.uuid,t)}return this._worldEvents.get(e.uuid)}resetMarkers(){for(const[e,t]of this.list)for(const[r,s]of t)s.merged=!1;for(const e of this.clusterLabels)e.label.dispose();this.clusterLabels.clear(),this._clusterKey=0}removeMergeMarkers(e){const t=this.list.get(e.uuid);if(t){for(const[r,s]of t)s.merged?s.label.dispose():s.label.world.scene.three.add(s.label.three);for(const r of this.clusterLabels)if(r.markerKeys.length===1){for(const[s,n]of this.list){const o=n.get(r.markerKeys[0]);if(!o)continue;o.label.world.scene.three.add(o.label.three),o.merged=!1}r.label.dispose(),this.clusterLabels.delete(r)}}}cluster(e){if(!this.autoCluster)return;this.resetMarkers();const t=this.list.get(e.uuid);if(t){for(const[r,s]of t)if(!s.merged&&!s.static){this.currentKeys.clear();for(const[n,o]of t)o.static||s.key!==o.key&&!o.merged&&this.distance(s.label,o.label)0){this.currentKeys.add(s.key),s.merged=!0;const n=Array.from(this.currentKeys),o=this.getAveragePositionFromLabels(n),i=new g(s.label.world,this.createClusterElement(this._clusterKey.toString())),{element:a}=i.three;a.textContent=n.length.toString(),i.three.position.copy(o),this.clusterLabels.add({key:this._clusterKey.toString(),markerKeys:n,label:i}),this._clusterKey++}}this.removeMergeMarkers(e)}}getAveragePositionFromLabels(e){const t=e.map(r=>{for(const[s,n]of this.list){const o=n.get(r);if(o)return o.label.three.position}return new f});return t.reduce((r,s)=>r.add(s),new f).divideScalar(t.length)}createClusterElement(e){const t=document.createElement("div");return t.textContent=e,t.style.color="#000000",t.style.background="#FFFFFF",t.style.fontSize="1.2rem",t.style.fontWeight="500",t.style.pointerEvents="auto",t.style.borderRadius="50%",t.style.padding="5px 11px",t.style.textAlign="center",t.style.cursor="pointer",t.addEventListener("pointerdown",()=>{this.navigateToCluster(e)}),t.addEventListener("pointerover",()=>{t.style.background="#BCF124"}),t.addEventListener("pointerout",()=>{t.style.background="#FFFFFF"}),t}getScreenPosition(e){const t=new f;if(!e.world.renderer)throw new Error("Renderer not found!");const r=e.three.position.clone();r.project(e.world.camera.three);const s=e.world.renderer.getSize();return t.x=r.x*s.x/2+s.x/2,t.y=-(r.y*s.y/2)+s.y/2,t}distance(e,t){const r=this.getScreenPosition(e),s=this.getScreenPosition(t),n=r.x-s.x,o=r.y-s.y,i=Math.sqrt(n*n+o*o)*.5;return i===0?this.threshold+1:i}navigateToCluster(e){const t=[],r=Array.from(this.clusterLabels).find(h=>h.key===e);if(!r)return;const s=r.label.world.camera;if(!s.hasCameraControls()){console.warn("Zoom to clusters only supported with Camera Controls!");return}for(const h of r.markerKeys)for(const[x,p]of this.list){const m=p.get(h);if(m){const{x:k,y:b,z:v}=m.label.three.position;t.push(k,b,v)}}r.label.dispose(),this.clusterLabels.delete(r);const n=new L,o=new Float32Array(t),i=new K(o,3);n.setAttribute("position",i);const a=new E(n);a.geometry.computeBoundingSphere(),a.geometry.boundingSphere&&s.controls.fitToSphere(a,!0),n.dispose(),a.clear(),t.length=0}};l(d,"uuid","4079eb91-79b0-4ede-bcf2-15b837129236");let y=d;export{y as M}; +var _=Object.defineProperty;var w=(u,c,e)=>c in u?_(u,c,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[c]=e;var l=(u,c,e)=>(w(u,typeof c!="symbol"?c+"":c,e),e);import{V as f,c as L,e as K,M as E}from"./web-ifc-api-BC8YMRiS.js";import{J as S,D as F}from"./index-C-JPXu_n.js";import{M as g}from"./mark-Dwn_ERVH.js";const d=class d extends S{constructor(e){super(e);l(this,"onDisposed",new F);l(this,"enabled",!0);l(this,"threshold",50);l(this,"autoCluster",!0);l(this,"list",new Map);l(this,"_worldEvents",new Map);l(this,"clusterLabels",new Set);l(this,"currentKeys",new Set);l(this,"_color","white");l(this,"_markerKey",0);l(this,"_clusterKey",0);l(this,"_setupWorlds",new Set);e.add(d.uuid,this)}get color(){return this._color}set color(e){this._color=e;for(const[t,r]of this.list)for(const[s,n]of r)n.label.three.element.style.color=e}create(e,t,r,s=!1){this.setupEvents(e,!0);const n=this._markerKey.toString(),o=this.getWorldMarkerList(e);if(o.has(n))return;const i=document.createElement("span");i.innerHTML=t,i.style.color=this._color;const a=new g(e,i);return a.three.position.copy(r),o.set(n,{key:n,label:a,merged:!1,static:s}),this._markerKey++,n}delete(e){for(const[t,r]of this.list){const s=r.get(e);s&&s.label.dispose(),r.delete(e)}}getWorldMarkerList(e){return this.list.has(e.uuid)||this.list.set(e.uuid,new Map),this.list.get(e.uuid)}dispose(e){for(const[t,r]of this.list){const s=[...r.keys()];for(const n of s){const o=r.get(n);e&&o.type!==e||(o.label.dispose(),r.delete(n))}}if(!e){this.list.clear(),this._markerKey=0;for(const t of this.clusterLabels)t.label.dispose();this.clusterLabels.clear(),this._clusterKey=0,this.currentKeys.clear()}this.onDisposed.trigger()}setupEvents(e,t){if(t&&this._setupWorlds.has(e.uuid)||!e.camera.hasCameraControls())return;const r=this.getWorldEvent(e);e.camera.controls.removeEventListener("sleep",r),e.camera.controls.removeEventListener("rest",r),t&&(e.camera.controls.addEventListener("sleep",r),e.camera.controls.addEventListener("rest",r))}getWorldEvent(e){if(!this._worldEvents.has(e.uuid)){const t=()=>{this.cluster(e)};this._worldEvents.set(e.uuid,t)}return this._worldEvents.get(e.uuid)}resetMarkers(){for(const[e,t]of this.list)for(const[r,s]of t)s.merged=!1;for(const e of this.clusterLabels)e.label.dispose();this.clusterLabels.clear(),this._clusterKey=0}removeMergeMarkers(e){const t=this.list.get(e.uuid);if(t){for(const[r,s]of t)s.merged?s.label.dispose():s.label.world.scene.three.add(s.label.three);for(const r of this.clusterLabels)if(r.markerKeys.length===1){for(const[s,n]of this.list){const o=n.get(r.markerKeys[0]);if(!o)continue;o.label.world.scene.three.add(o.label.three),o.merged=!1}r.label.dispose(),this.clusterLabels.delete(r)}}}cluster(e){if(!this.autoCluster)return;this.resetMarkers();const t=this.list.get(e.uuid);if(t){for(const[r,s]of t)if(!s.merged&&!s.static){this.currentKeys.clear();for(const[n,o]of t)o.static||s.key!==o.key&&!o.merged&&this.distance(s.label,o.label)0){this.currentKeys.add(s.key),s.merged=!0;const n=Array.from(this.currentKeys),o=this.getAveragePositionFromLabels(n),i=new g(s.label.world,this.createClusterElement(this._clusterKey.toString())),{element:a}=i.three;a.textContent=n.length.toString(),i.three.position.copy(o),this.clusterLabels.add({key:this._clusterKey.toString(),markerKeys:n,label:i}),this._clusterKey++}}this.removeMergeMarkers(e)}}getAveragePositionFromLabels(e){const t=e.map(r=>{for(const[s,n]of this.list){const o=n.get(r);if(o)return o.label.three.position}return new f});return t.reduce((r,s)=>r.add(s),new f).divideScalar(t.length)}createClusterElement(e){const t=document.createElement("div");return t.textContent=e,t.style.color="#000000",t.style.background="#FFFFFF",t.style.fontSize="1.2rem",t.style.fontWeight="500",t.style.pointerEvents="auto",t.style.borderRadius="50%",t.style.padding="5px 11px",t.style.textAlign="center",t.style.cursor="pointer",t.addEventListener("pointerdown",()=>{this.navigateToCluster(e)}),t.addEventListener("pointerover",()=>{t.style.background="#BCF124"}),t.addEventListener("pointerout",()=>{t.style.background="#FFFFFF"}),t}getScreenPosition(e){const t=new f;if(!e.world.renderer)throw new Error("Renderer not found!");const r=e.three.position.clone();r.project(e.world.camera.three);const s=e.world.renderer.getSize();return t.x=r.x*s.x/2+s.x/2,t.y=-(r.y*s.y/2)+s.y/2,t}distance(e,t){const r=this.getScreenPosition(e),s=this.getScreenPosition(t),n=r.x-s.x,o=r.y-s.y,i=Math.sqrt(n*n+o*o)*.5;return i===0?this.threshold+1:i}navigateToCluster(e){const t=[],r=Array.from(this.clusterLabels).find(h=>h.key===e);if(!r)return;const s=r.label.world.camera;if(!s.hasCameraControls()){console.warn("Zoom to clusters only supported with Camera Controls!");return}for(const h of r.markerKeys)for(const[x,p]of this.list){const m=p.get(h);if(m){const{x:k,y:b,z:v}=m.label.three.position;t.push(k,b,v)}}r.label.dispose(),this.clusterLabels.delete(r);const n=new L,o=new Float32Array(t),i=new K(o,3);n.setAttribute("position",i);const a=new E(n);a.geometry.computeBoundingSphere(),a.geometry.boundingSphere&&s.controls.fitToSphere(a,!0),n.dispose(),a.clear(),t.length=0}};l(d,"uuid","4079eb91-79b0-4ede-bcf2-15b837129236");let y=d;export{y as M}; diff --git a/examples/assets/index-DvHc-rVc.js b/examples/assets/index-BPt-VIyQ.js similarity index 91% rename from examples/assets/index-DvHc-rVc.js rename to examples/assets/index-BPt-VIyQ.js index a2fd43ac2..e84f07928 100644 --- a/examples/assets/index-DvHc-rVc.js +++ b/examples/assets/index-BPt-VIyQ.js @@ -1 +1 @@ -var l=Object.defineProperty;var m=(e,s,t)=>s in e?l(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var r=(e,s,t)=>(m(e,typeof s!="symbol"?s+"":s,t),t);import{aj as S,ak as F,al as L,i as T,ab as h}from"./web-ifc-api-BC8YMRiS.js";import{G as E}from"./ifc-geometry-types-C3SKrzrZ.js";import{C as D}from"./index-BraZXcLv.js";const o=class o extends D{constructor(t){super(t);r(this,"enabled",!0);t.add(o.uuid,this)}async export(t,i,f=!1,I=!0){const n={},c=new Set(t.GetIfcEntityList(i)),p=new Set([S,F,L,T,h]);for(const a of p)c.add(a);for(const a of c){if(E.has(a))continue;const C=p.has(a)&&I,y=t.GetLineIDsWithType(i,a);for(const G of y){const u=t.GetLine(0,G,C,f);n[u.expressID]=u}}return n}};r(o,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let d=o;export{d as I}; +var l=Object.defineProperty;var m=(e,s,t)=>s in e?l(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var r=(e,s,t)=>(m(e,typeof s!="symbol"?s+"":s,t),t);import{aj as S,ak as F,al as L,i as T,ab as h}from"./web-ifc-api-BC8YMRiS.js";import{G as E}from"./ifc-geometry-types-C3SKrzrZ.js";import{C as D}from"./index-BZiAUaTo.js";const o=class o extends D{constructor(t){super(t);r(this,"enabled",!0);t.add(o.uuid,this)}async export(t,i,f=!1,I=!0){const n={},c=new Set(t.GetIfcEntityList(i)),p=new Set([S,F,L,T,h]);for(const a of p)c.add(a);for(const a of c){if(E.has(a))continue;const C=p.has(a)&&I,y=t.GetLineIDsWithType(i,a);for(const G of y){const u=t.GetLine(0,G,C,f);n[u.expressID]=u}}return n}};r(o,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let d=o;export{d as I}; diff --git a/examples/assets/index-BraZXcLv.js b/examples/assets/index-BZiAUaTo.js similarity index 82% rename from examples/assets/index-BraZXcLv.js rename to examples/assets/index-BZiAUaTo.js index 805c414fc..50204eebb 100644 --- a/examples/assets/index-BraZXcLv.js +++ b/examples/assets/index-BZiAUaTo.js @@ -1,13 +1,13 @@ -var qs=Object.defineProperty;var $s=(n,e,t)=>e in n?qs(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var U=(n,e,t)=>($s(n,typeof e!="symbol"?e+"":e,t),t);import{e as Rs,V as S,f as ht,P as Is,r as lt,T as Gt,y as Hs,a as ut,p as st,aO as Ks,Z as ks,ar as rs,M as Je,as as Gs,u as Qs,c as as,C as Ee,n as js,a_ as Js,a$ as ti,ah as cs,o as ei,at as si,au as ii,v as ni,Q as oi,av as ri,z as ai,h as ci,m as li,q as hi}from"./web-ifc-api-BC8YMRiS.js";const Vs=0,ui=1,di=2,ls=2,Ue=1.25,hs=1,we=6*4+4+4,be=65535,fi=Math.pow(2,-24),De=Symbol("SKIP_GENERATION");function pi(n){return n.index?n.index.count:n.attributes.position.count}function Bt(n){return pi(n)/3}function mi(n,e=ArrayBuffer){return n>65535?new Uint32Array(new e(4*n)):new Uint16Array(new e(2*n))}function _i(n,e){if(!n.index){const t=n.attributes.position.count,s=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=mi(t,s);n.setIndex(new Rs(i,1));for(let r=0;ra-c);for(let a=0;ar.offset-o.offset),s=t[t.length-1];s.count=Math.min(e-s.offset,s.count);let i=0;return t.forEach(({count:r})=>i+=r),e!==i}function N(n,e,t){return t.min.x=e[n],t.min.y=e[n+1],t.min.z=e[n+2],t.max.x=e[n+3],t.max.y=e[n+4],t.max.z=e[n+5],t}function gi(n){n[0]=n[1]=n[2]=1/0,n[3]=n[4]=n[5]=-1/0}function us(n){let e=-1,t=-1/0;for(let s=0;s<3;s++){const i=n[s+3]-n[s];i>t&&(t=i,e=s)}return e}function ds(n,e){e.set(n)}function fs(n,e,t){let s,i;for(let r=0;r<3;r++){const o=r+3;s=n[r],i=e[r],t[r]=si?s:i}}function ee(n,e,t){for(let s=0;s<3;s++){const i=e[n+2*s],r=e[n+2*s+1],o=i-r,a=i+r;ot[s+3]&&(t[s+3]=a)}}function Ht(n){const e=n[3]-n[0],t=n[4]-n[1],s=n[5]-n[2];return 2*(e*t+t*s+s*e)}function Le(n,e,t,s,i=null){let r=1/0,o=1/0,a=1/0,c=-1/0,f=-1/0,d=-1/0,u=1/0,l=1/0,p=1/0,y=-1/0,O=-1/0,T=-1/0;const _=i!==null;for(let g=e*6,E=(e+t)*6;gc&&(c=x),_&&hy&&(y=h);const C=n[g+2],v=n[g+3],b=C-v,D=C+v;bf&&(f=D),_&&CO&&(O=C);const P=n[g+4],L=n[g+5],M=P-L,R=P+L;Md&&(d=R),_&&PT&&(T=P)}s[0]=r,s[1]=o,s[2]=a,s[3]=c,s[4]=f,s[5]=d,_&&(i[0]=u,i[1]=l,i[2]=p,i[3]=y,i[4]=O,i[5]=T)}function Ti(n,e,t,s){let i=1/0,r=1/0,o=1/0,a=-1/0,c=-1/0,f=-1/0;for(let d=e*6,u=(e+t)*6;da&&(a=l);const p=n[d+2];pc&&(c=p);const y=n[d+4];yf&&(f=y)}s[0]=i,s[1]=r,s[2]=o,s[3]=a,s[4]=c,s[5]=f}function Ei(n,e){gi(e);const t=n.attributes.position,s=n.index?n.index.array:null,i=Bt(n),r=new Float32Array(i*6),o=t.normalized,a=t.array,c=t.offset||0;let f=3;t.isInterleavedBufferAttribute&&(f=t.data.stride);const d=["getX","getY","getZ"];for(let u=0;uw&&(w=E),h>w&&(w=h);const x=(w-m)/2,C=_*2;r[p+C+0]=m+x,r[p+C+1]=x+(Math.abs(m)+x)*fi,me[_+3]&&(e[_+3]=w)}}return r}const ct=32,wi=(n,e)=>n.candidate-e.candidate,ft=new Array(ct).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),se=new Float32Array(6);function xi(n,e,t,s,i,r){let o=-1,a=0;if(r===Vs)o=us(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(r===ui)o=us(n),o!==-1&&(a=Oi(t,s,i,o));else if(r===di){const c=Ht(n);let f=Ue*i;const d=s*6,u=(s+i)*6;for(let l=0;l<3;l++){const p=e[l],T=(e[l+3]-p)/ct;if(i=x.candidate?ee(h,t,x.rightCacheBounds):(ee(h,t,x.leftCacheBounds),x.count++)}}for(let h=0;h=ct&&(w=ct-1);const x=ft[w];x.count++,ee(E,t,x.bounds)}const _=ft[ct-1];ds(_.bounds,_.rightCacheBounds);for(let E=ct-2;E>=0;E--){const h=ft[E],m=ft[E+1];fs(h.bounds,m.rightCacheBounds,h.rightCacheBounds)}let g=0;for(let E=0;E=c;)a--;if(o=c;)a--;if(o2**16,i=s?4:2,r=e?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),o=s?new Uint32Array(r):new Uint16Array(r);for(let a=0,c=o.length;a=i&&(u=!0,r&&(console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),w<=o||C>=i)return g(m+w),h.offset=m,h.count=w,h;const v=xi(h.boundingData,x,y,m,w,a);if(v.axis===-1)return g(m+w),h.offset=m,h.count=w,h;const b=O(d,s,y,m,w,v);if(b===m||b===m+w)g(m+w),h.offset=m,h.count=w;else{h.splitAxis=v.axis;const D=new ie,P=m,L=b-m;h.left=D,D.boundingData=new Float32Array(6),Le(y,P,L,D.boundingData,p),E(D,P,L,p,C+1);const M=new ie,R=b,Z=w-L;h.right=M,M.boundingData=new Float32Array(6),Le(y,R,Z,M.boundingData,p),E(M,R,Z,p,C+1)}return h}}function Pi(n,e){const t=n.geometry;e.indirect&&(n._indirectBuffer=vi(t,e.useSharedArrayBuffer),yi(t)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),n._indirectBuffer||_i(t,e);const s=bi(n,e);let i,r,o;const a=[],c=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return r[p+6]=h/4,h=d(h,g),r[p+7]=E,h}}}class dt{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let s=1/0,i=-1/0;for(let r=0,o=e.length;ri?c:i}this.min=s,this.max=i}setFromPoints(e,t){let s=1/0,i=-1/0;for(let r=0,o=t.length;ri?c:i}this.min=s,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}dt.prototype.setFromBox=function(){const n=new S;return function(t,s){const i=s.min,r=s.max;let o=1/0,a=-1/0;for(let c=0;c<=1;c++)for(let f=0;f<=1;f++)for(let d=0;d<=1;d++){n.x=i.x*c+r.x*(1-c),n.y=i.y*f+r.y*(1-f),n.z=i.z*d+r.z*(1-d);const u=t.dot(n);o=Math.min(u,o),a=Math.max(u,a)}this.min=o,this.max=a}}();const Ui=function(){const n=new S,e=new S,t=new S;return function(i,r,o){const a=i.start,c=n,f=r.start,d=e;t.subVectors(a,f),n.subVectors(i.end,i.start),e.subVectors(r.end,r.start);const u=t.dot(d),l=d.dot(c),p=d.dot(d),y=t.dot(c),T=c.dot(c)*p-l*l;let _,g;T!==0?_=(u*l-y*p)/T:_=0,g=(u+_*l)/p,o.x=_,o.y=g}}(),ts=function(){const n=new ht,e=new S,t=new S;return function(i,r,o,a){Ui(i,r,n);let c=n.x,f=n.y;if(c>=0&&c<=1&&f>=0&&f<=1){i.at(c,o),r.at(f,a);return}else if(c>=0&&c<=1){f<0?r.at(0,a):r.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(f>=0&&f<=1){c<0?i.at(0,o):i.at(1,o),r.closestPointToPoint(o,!0,a);return}else{let d;c<0?d=i.start:d=i.end;let u;f<0?u=r.start:u=r.end;const l=e,p=t;if(i.closestPointToPoint(u,!0,e),r.closestPointToPoint(d,!0,t),l.distanceToSquared(u)<=p.distanceToSquared(d)){o.copy(l),a.copy(u);return}else{o.copy(d),a.copy(p);return}}}}(),Di=function(){const n=new S,e=new S,t=new Is,s=new lt;return function(r,o){const{radius:a,center:c}=r,{a:f,b:d,c:u}=o;if(s.start=f,s.end=d,s.closestPointToPoint(c,!0,n).distanceTo(c)<=a||(s.start=f,s.end=u,s.closestPointToPoint(c,!0,n).distanceTo(c)<=a)||(s.start=d,s.end=u,s.closestPointToPoint(c,!0,n).distanceTo(c)<=a))return!0;const O=o.getPlane(t);if(Math.abs(O.distanceToPoint(c))<=a){const _=O.projectPoint(c,e);if(o.containsPoint(_))return!0}return!1}}(),Li=1e-15;function Se(n){return Math.abs(n)new S),this.satBounds=new Array(4).fill().map(()=>new dt),this.points=[this.a,this.b,this.c],this.sphere=new Hs,this.plane=new Is,this.needsUpdate=!0}intersectsSphere(e){return Di(e,this)}update(){const e=this.a,t=this.b,s=this.c,i=this.points,r=this.satAxes,o=this.satBounds,a=r[0],c=o[0];this.getNormal(a),c.setFromPoints(a,i);const f=r[1],d=o[1];f.subVectors(e,t),d.setFromPoints(f,i);const u=r[2],l=o[2];u.subVectors(t,s),l.setFromPoints(u,i);const p=r[3],y=o[3];p.subVectors(s,e),y.setFromPoints(p,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}ot.prototype.closestPointToSegment=function(){const n=new S,e=new S,t=new lt;return function(i,r=null,o=null){const{start:a,end:c}=i,f=this.points;let d,u=1/0;for(let l=0;l<3;l++){const p=(l+1)%3;t.start.copy(f[l]),t.end.copy(f[p]),ts(t,i,n,e),d=n.distanceToSquared(e),d=2){(h===1?_.start:_.end).copy(p),E=2;break}if(E++,E===2&&h===-1)break}}return E}return function(T,_=null,g=!1){this.needsUpdate&&this.update(),T.isExtendedTriangle?T.needsUpdate&&T.update():(n.copy(T),n.update(),T=n);const E=this.plane,h=T.plane;if(Math.abs(E.normal.dot(h.normal))>1-1e-10){const m=this.satBounds,w=this.satAxes;t[0]=T.a,t[1]=T.b,t[2]=T.c;for(let v=0;v<4;v++){const b=m[v],D=w[v];if(s.setFromPoints(D,t),b.isSeparated(s))return!1}const x=T.satBounds,C=T.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let v=0;v<4;v++){const b=x[v],D=C[v];if(s.setFromPoints(D,e),b.isSeparated(s))return!1}for(let v=0;v<4;v++){const b=w[v];for(let D=0;D<4;D++){const P=C[D];if(r.crossVectors(b,P),s.setFromPoints(r,e),i.setFromPoints(r,t),s.isSeparated(i))return!1}}return _&&(g||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),_.start.set(0,0,0),_.end.set(0,0,0)),!0}else{const m=y(this,h,u);if(m===1&&T.containsPoint(u.end))return _&&(_.start.copy(u.end),_.end.copy(u.end)),!0;if(m!==2)return!1;const w=y(T,E,l);if(w===1&&this.containsPoint(l.end))return _&&(_.start.copy(l.end),_.end.copy(l.end)),!0;if(w!==2)return!1;if(u.delta(a),l.delta(c),a.dot(c)<0){let L=l.start;l.start=l.end,l.end=L}const x=u.start.dot(a),C=u.end.dot(a),v=l.start.dot(a),b=l.end.dot(a),D=C0?_.start.copy(u.start):_.start.copy(l.start),f.subVectors(u.end,l.end),f.dot(a)<0?_.end.copy(u.end):_.end.copy(l.end)),!0)}}}();ot.prototype.distanceToPoint=function(){const n=new S;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();ot.prototype.distanceToTriangle=function(){const n=new S,e=new S,t=["a","b","c"],s=new lt,i=new lt;return function(o,a=null,c=null){const f=a||c?s:null;if(this.intersectsTriangle(o,f))return(a||c)&&(a&&f.getCenter(a),c&&f.getCenter(c)),0;let d=1/0;for(let u=0;u<3;u++){let l;const p=t[u],y=o[p];this.closestPointToPoint(y,n),l=y.distanceToSquared(n),lnew S),this.satAxes=new Array(3).fill().map(()=>new S),this.satBounds=new Array(3).fill().map(()=>new dt),this.alignedSatBounds=new Array(3).fill().map(()=>new dt),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),s&&this.matrix.copy(s)}set(e,t,s){this.min.copy(e),this.max.copy(t),this.matrix.copy(s),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}q.prototype.update=function(){return function(){const e=this.matrix,t=this.min,s=this.max,i=this.points;for(let f=0;f<=1;f++)for(let d=0;d<=1;d++)for(let u=0;u<=1;u++){const l=1*f|2*d|4*u,p=i[l];p.x=f?s.x:t.x,p.y=d?s.y:t.y,p.z=u?s.z:t.z,p.applyMatrix4(e)}const r=this.satBounds,o=this.satAxes,a=i[0];for(let f=0;f<3;f++){const d=o[f],u=r[f],l=1<new lt),t=new Array(12).fill().map(()=>new lt),s=new S,i=new S;return function(o,a=0,c=null,f=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(c||f)&&(o.getCenter(i),this.closestPointToPoint(i,s),o.closestPointToPoint(s,i),c&&c.copy(s),f&&f.copy(i)),0;const d=a*a,u=o.min,l=o.max,p=this.points;let y=1/0;for(let T=0;T<8;T++){const _=p[T];i.copy(_).clamp(u,l);const g=_.distanceToSquared(i);if(gnew ot)}}const j=new Si;function K(n,e){return e[n+15]===65535}function G(n,e){return e[n+6]}function J(n,e){return e[n+14]}function tt(n){return n+8}function et(n,e){return e[n+6]}function Zs(n,e){return e[n+7]}class Mi{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=s=>{t&&e.push(t),t=s,this.float32Array=new Float32Array(s),this.uint16Array=new Uint16Array(s),this.uint32Array=new Uint32Array(s)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const V=new Mi;let _t,zt;const Et=[],ne=new es(()=>new st);function zi(n,e,t,s,i,r){_t=ne.getPrimitive(),zt=ne.getPrimitive(),Et.push(_t,zt),V.setBuffer(n._roots[e]);const o=We(0,n.geometry,t,s,i,r);V.clearBuffer(),ne.releasePrimitive(_t),ne.releasePrimitive(zt),Et.pop(),Et.pop();const a=Et.length;return a>0&&(zt=Et[a-1],_t=Et[a-2]),o}function We(n,e,t,s,i=null,r=0,o=0){const{float32Array:a,uint16Array:c,uint32Array:f}=V;let d=n*2;if(K(d,c)){const l=G(n,f),p=J(d,c);return N(n,a,_t),s(l,p,!1,o,r+n,_t)}else{let b=function(P){const{uint16Array:L,uint32Array:M}=V;let R=P*2;for(;!K(R,L);)P=tt(P),R=P*2;return G(P,M)},D=function(P){const{uint16Array:L,uint32Array:M}=V;let R=P*2;for(;!K(R,L);)P=et(P,M),R=P*2;return G(P,M)+J(R,L)};const l=tt(n),p=et(n,f);let y=l,O=p,T,_,g,E;if(i&&(g=_t,E=zt,N(y,a,g),N(O,a,E),T=i(g),_=i(E),_(kt.copy(e).clamp(d.min,d.max),kt.distanceToSquared(e)),intersectsBounds:(d,u,l)=>l{d.closestPointToPoint(e,kt);const l=e.distanceToSquared(kt);return l0&&f.normal.multiplyScalar(-1));const d={a:r,b:o,c:a,normal:new S,materialIndex:0};Gt.getNormal(wt,xt,Ot,d.normal),f.face=d,f.faceIndex=r}return f}function Pe(n,e,t,s,i){const r=s*3;let o=r+0,a=r+1,c=r+2;const f=n.index;n.index&&(o=f.getX(o),a=f.getX(a),c=f.getX(c));const{position:d,normal:u,uv:l,uv1:p}=n.attributes,y=Ri(t,d,u,l,p,o,a,c,e);return y?(y.faceIndex=s,i&&i.push(y),y):null}function W(n,e,t,s){const i=n.a,r=n.b,o=n.c;let a=e,c=e+1,f=e+2;t&&(a=t.getX(a),c=t.getX(c),f=t.getX(f)),i.x=s.getX(a),i.y=s.getY(a),i.z=s.getZ(a),r.x=s.getX(c),r.y=s.getY(c),r.z=s.getZ(c),o.x=s.getX(f),o.y=s.getY(f),o.z=s.getZ(f)}function Ii(n,e,t,s,i,r){const{geometry:o,_indirectBuffer:a}=n;for(let c=s,f=s+i;cw&&(w=P),Lx&&(x=L),MC&&(C=M)}return c[l+0]!==E||c[l+1]!==h||c[l+2]!==m||c[l+3]!==w||c[l+4]!==x||c[l+5]!==C?(c[l+0]=E,c[l+1]=h,c[l+2]=m,c[l+3]=w,c[l+4]=x,c[l+5]=C,!0):!1}else{const _=l+8,g=o[l+6],E=_+p,h=g+p;let m=y,w=!1,x=!1;e?m||(w=e.has(E),x=e.has(h),m=!w&&!x):(w=!0,x=!0);const C=m||w,v=m||x;let b=!1;C&&(b=u(_,p,m));let D=!1;v&&(D=u(g,p,m));const P=b||D;if(P)for(let L=0;L<3;L++){const M=_+L,R=g+L,Z=c[M],Ft=c[M+3],Rt=c[R],It=c[R+3];c[l+L]=ZIt?Ft:It}return P}}}const ys=new st;function yt(n,e,t,s){return N(n,e,ys),t.intersectBox(ys,s)}function Yi(n,e,t,s,i,r){const{geometry:o,_indirectBuffer:a}=n;for(let c=s,f=s+i;c=0;let p,y;l?(p=tt(n),y=et(n,o)):(p=et(n,o),y=tt(n));const T=yt(p,i,s,Ts)?$e(p,e,t,s):null;if(T){const E=T.point[d];if(l?E<=i[y+f]:E>=i[y+f+3])return T}const g=yt(y,i,s,Ts)?$e(y,e,t,s):null;return T&&g?T.distance<=g.distance?T:g:T||g||null}}const le=new st,At=new ot,Ct=new ot,Vt=new ut,Es=new q,he=new q;function $i(n,e,t,s){V.setBuffer(n._roots[e]);const i=Ke(0,n,t,s);return V.clearBuffer(),i}function Ke(n,e,t,s,i=null){const{float32Array:r,uint16Array:o,uint32Array:a}=V;let c=n*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Es.set(t.boundingBox.min,t.boundingBox.max,s),i=Es),K(c,o)){const d=e.geometry,u=d.index,l=d.attributes.position,p=t.index,y=t.attributes.position,O=G(n,a),T=J(c,o);if(Vt.copy(s).invert(),t.boundsTree)return N(n,r,he),he.matrix.copy(Vt),he.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:g=>he.intersectsBox(g),intersectsTriangle:g=>{g.a.applyMatrix4(s),g.b.applyMatrix4(s),g.c.applyMatrix4(s),g.needsUpdate=!0;for(let E=O*3,h=(T+O)*3;Eze.distanceToBox(m),intersectsBounds:(m,w,x)=>x{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:C=>Yt.distanceToBox(C),intersectsBounds:(C,v,b)=>b{for(let b=C,D=C+v;bw&&(w=M),Rx&&(x=R),ZC&&(C=Z)}}return c[l+0]!==E||c[l+1]!==h||c[l+2]!==m||c[l+3]!==w||c[l+4]!==x||c[l+5]!==C?(c[l+0]=E,c[l+1]=h,c[l+2]=m,c[l+3]=w,c[l+4]=x,c[l+5]=C,!0):!1}else{const _=l+8,g=o[l+6],E=_+p,h=g+p;let m=y,w=!1,x=!1;e?m||(w=e.has(E),x=e.has(h),m=!w&&!x):(w=!0,x=!0);const C=m||w,v=m||x;let b=!1;C&&(b=u(_,p,m));let D=!1;v&&(D=u(g,p,m));const P=b||D;if(P)for(let L=0;L<3;L++){const M=_+L,R=g+L,Z=c[M],Ft=c[M+3],Rt=c[R],It=c[R+3];c[l+L]=ZIt?Ft:It}return P}}}const ws=new S;function en(n,e,t,s,i){V.setBuffer(n._roots[e]),Ge(0,n,t,s,i),V.clearBuffer()}function Ge(n,e,t,s,i){const{float32Array:r,uint16Array:o,uint32Array:a}=V,c=n*2;if(K(c,o)){const d=G(n,a),u=J(c,o);Yi(e,t,s,d,u,i)}else{const d=tt(n);yt(d,r,s,ws)&&Ge(d,e,t,s,i);const u=et(n,a);yt(u,r,s,ws)&&Ge(u,e,t,s,i)}}const xs=new S,sn=["x","y","z"];function nn(n,e,t,s){V.setBuffer(n._roots[e]);const i=Qe(0,n,t,s);return V.clearBuffer(),i}function Qe(n,e,t,s){const{float32Array:i,uint16Array:r,uint32Array:o}=V;let a=n*2;if(K(a,r)){const f=G(n,o),d=J(a,r);return Ni(e,t,s,f,d)}else{const f=Zs(n,o),d=sn[f],l=s.direction[d]>=0;let p,y;l?(p=tt(n),y=et(n,o)):(p=et(n,o),y=tt(n));const T=yt(p,i,s,xs)?Qe(p,e,t,s):null;if(T){const E=T.point[d];if(l?E<=i[y+f]:E>=i[y+f+3])return T}const g=yt(y,i,s,xs)?Qe(y,e,t,s):null;return T&&g?T.distance<=g.distance?T:g:T||g||null}}const de=new st,vt=new ot,bt=new ot,Nt=new ut,Os=new q,fe=new q;function on(n,e,t,s){V.setBuffer(n._roots[e]);const i=je(0,n,t,s);return V.clearBuffer(),i}function je(n,e,t,s,i=null){const{float32Array:r,uint16Array:o,uint32Array:a}=V;let c=n*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Os.set(t.boundingBox.min,t.boundingBox.max,s),i=Os),K(c,o)){const d=e.geometry,u=d.index,l=d.attributes.position,p=t.index,y=t.attributes.position,O=G(n,a),T=J(c,o);if(Nt.copy(s).invert(),t.boundsTree)return N(n,r,fe),fe.matrix.copy(Nt),fe.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:g=>fe.intersectsBox(g),intersectsTriangle:g=>{g.a.applyMatrix4(s),g.b.applyMatrix4(s),g.c.applyMatrix4(s),g.needsUpdate=!0;for(let E=O,h=T+O;EBe.distanceToBox(m),intersectsBounds:(m,w,x)=>x{if(e.boundsTree){const x=e.boundsTree;return x.shapecast({boundsTraverseOrder:C=>Zt.distanceToBox(C),intersectsBounds:(C,v,b)=>b{for(let b=C,D=C+v;bnew st),Pt=new st,Ut=new st,Fe=new st,Re=new st;let Ie=!1;function dn(n,e,t,s){if(Ie)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");Ie=!0;const i=n._roots,r=e._roots;let o,a=0,c=0;const f=new ut().copy(t).invert();for(let d=0,u=i.length;dc.slice()),index:o.array.slice(),indirectBuffer:r?r.slice():null}:a={roots:i,index:o.array,indirectBuffer:r},a}static deserialize(e,t,s={}){s={setIndex:!0,indirect:!!e.indirectBuffer,...s};const{index:i,roots:r,indirectBuffer:o}=e,a=new ss(t,{...s,[De]:!0});if(a._roots=r,a._indirectBuffer=o||null,s.setIndex){const c=t.getIndex();if(c===null){const f=new Rs(e.index,1,!1);t.setIndex(f)}else c.array!==i&&(c.array.set(i),c.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:Vs,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[De]:!1},t),t.useSharedArrayBuffer&&!un())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[De]||(Pi(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new st)));const{_indirectBuffer:s}=this;this.resolveTriangleIndex=t.indirect?i=>s[i]:i=>i}refit(e=null){return(this.indirect?tn:Vi)(this,e)}traverse(e,t=0){const s=this._roots[t],i=new Uint32Array(s),r=new Uint16Array(s);o(0);function o(a,c=0){const f=a*2,d=r[f+15]===be;if(d){const u=i[a+6],l=r[f+14];e(c,d,new Float32Array(s,a*4,6),u,l)}else{const u=a+we/4,l=i[a+6],p=i[a+7];e(c,d,new Float32Array(s,a*4,6),p)||(o(u,c+1),o(l,c+1))}}}raycast(e,t=rs){const s=this._roots,i=this.geometry,r=[],o=t.isMaterial,a=Array.isArray(t),c=i.groups,f=o?t.side:t,d=this.indirect?en:Xi;for(let u=0,l=s.length;uu(l,p,y,O,T)?!0:s(l,p,this,a,y,O,t)}else o||(a?o=(u,l,p,y)=>s(u,l,this,a,p,y,t):o=(u,l,p)=>p);let c=!1,f=0;const d=this._roots;for(let u=0,l=d.length;u{const O=this.resolveTriangleIndex(y);W(o,O*3,a,c)}:y=>{W(o,y*3,a,c)},d=j.getPrimitive(),u=e.geometry.index,l=e.geometry.attributes.position,p=e.indirect?y=>{const O=e.resolveTriangleIndex(y);W(d,O*3,u,l)}:y=>{W(d,y*3,u,l)};if(r){const y=(O,T,_,g,E,h,m,w)=>{for(let x=_,C=_+g;xme.intersectsBox(s),intersectsTriangle:s=>me.intersectsTriangle(s)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,s={},i={},r=0,o=1/0){return(this.indirect?hn:Ji)(this,e,t,s,i,r,o)}closestPointToPoint(e,t={},s=0,i=1/0){return Bi(this,e,t,s,i)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(s=>{N(0,new Float32Array(s),As),e.union(As)}),e}}function Cs(n,e,t){return n===null||(n.point.applyMatrix4(e.matrixWorld),n.distance=n.point.distanceTo(t.ray.origin),n.object=e,n.distancet.far)?null:n}const He=new Gs,vs=new ut,fn=Je.prototype.raycast;function pn(n,e){if(this.geometry.boundsTree){if(this.material===void 0)return;vs.copy(this.matrixWorld).invert(),He.copy(n.ray).applyMatrix4(vs);const t=this.geometry.boundsTree;if(n.firstHitOnly===!0){const s=Cs(t.raycastFirst(He,this.material),this,n);s&&e.push(s)}else{const s=t.raycast(He,this.material);for(let i=0,r=s.length;i{const t=this.handlers.slice(0);for(const s of t)s(e)});U(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}}class is{constructor(e){U(this,"isDisposeable",()=>"dispose"in this&&"onDisposed"in this);U(this,"isResizeable",()=>"resize"in this&&"getSize"in this);U(this,"isUpdateable",()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this);U(this,"isHideable",()=>"visible"in this);U(this,"isConfigurable",()=>"setup"in this&&"config"in this&&"onSetup"in this);this.components=e}}class ns extends is{}class os extends is{constructor(t){super(t);U(this,"worlds",new Map);U(this,"onWorldChanged",new Y);U(this,"currentWorld",null);this.onWorldChanged.add(({world:s,action:i})=>{i==="removed"&&this.worlds.delete(s.uuid)})}}class yn extends os{constructor(){super(...arguments);U(this,"hasCameraControls",()=>"controls"in this)}}class gn extends os{constructor(){super(...arguments);U(this,"onAfterUpdate",new Y);U(this,"onBeforeUpdate",new Y);U(this,"onDisposed",new Y);U(this,"onResize",new Y);U(this,"onClippingPlanesUpdated",new Y);U(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(t,s,i){s.isLocal=i;const r=this.clippingPlanes.indexOf(s);t&&r===-1?this.clippingPlanes.push(s):!t&&r>-1&&this.clippingPlanes.splice(r,1),this.three.clippingPlanes=this.clippingPlanes.filter(o=>!o.isLocal)}}const jt=class jt extends ns{constructor(t){super(t);U(this,"_disposedComponents",new Set);U(this,"enabled",!0);t.add(jt.uuid,this)}get(){return this._disposedComponents}destroy(t,s=!0,i=!0){t.removeFromParent();const r=t;r.dispose&&r.dispose(),this.disposeGeometryAndMaterials(t,s),i&&r.children&&r.children.length&&this.disposeChildren(r),t.children.length=0}disposeGeometry(t){const s=t;s.boundsTree&&s.disposeBoundsTree(),t.dispose()}disposeGeometryAndMaterials(t,s){const i=t;i.geometry&&this.disposeGeometry(i.geometry),s&&i.material&&jt.disposeMaterial(i),i.material=[],i.geometry=null}disposeChildren(t){for(const s of t.children)this.destroy(s)}static disposeMaterial(t){if(t.material)if(Array.isArray(t.material))for(const s of t.material)s.dispose();else t.material.dispose()}};U(jt,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let Jt=jt;class Tn extends os{constructor(t){super(t);U(this,"onDisposed",new Y)}dispose(){const t=this.components.get(Jt);for(const s of this.three.children){const i=s;i.geometry&&t.destroy(i)}this.three.children=[],this.onDisposed.trigger(),this.onDisposed.reset()}}const X=class X{static create(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return`${X._lut[e&255]+X._lut[e>>8&255]+X._lut[e>>16&255]+X._lut[e>>24&255]}-${X._lut[t&255]}${X._lut[t>>8&255]}-${X._lut[t>>16&15|64]}${X._lut[t>>24&255]}-${X._lut[s&63|128]}${X._lut[s>>8&255]}-${X._lut[s>>16&255]}${X._lut[s>>24&255]}${X._lut[i&255]}${X._lut[i>>8&255]}${X._lut[i>>16&255]}${X._lut[i>>24&255]}`.toLowerCase()}static validate(e){if(!X._pattern.test(e))throw new Error(`${e} is not a valid UUID v4. +var Ks=Object.defineProperty;var Qs=(n,e,t)=>e in n?Ks(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var U=(n,e,t)=>(Qs(n,typeof e!="symbol"?e+"":e,t),t);import{e as Hs,V as S,f as ht,P as ks,r as lt,T as Qt,y as Vs,a as ut,p as st,aO as Gs,Z as Ys,ar as as,M as ts,as as js,u as Js,c as cs,C as Ee,n as ti,a_ as ei,a$ as si,ah as ls,o as ii,at as ni,au as oi,v as ri,Q as ai,av as ci,z as li,h as hi,m as ui,q as di}from"./web-ifc-api-BC8YMRiS.js";const Ns=0,fi=1,pi=2,hs=2,De=1.25,us=1,we=6*4+4+4,Pe=65535,mi=Math.pow(2,-24),Le=Symbol("SKIP_GENERATION");function _i(n){return n.index?n.index.count:n.attributes.position.count}function Bt(n){return _i(n)/3}function yi(n,e=ArrayBuffer){return n>65535?new Uint32Array(new e(4*n)):new Uint16Array(new e(2*n))}function gi(n,e){if(!n.index){const t=n.attributes.position.count,s=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=yi(t,s);n.setIndex(new Hs(i,1));for(let r=0;ra-c);for(let a=0;ar.offset-o.offset),s=t[t.length-1];s.count=Math.min(e-s.offset,s.count);let i=0;return t.forEach(({count:r})=>i+=r),e!==i}function N(n,e,t){return t.min.x=e[n],t.min.y=e[n+1],t.min.z=e[n+2],t.max.x=e[n+3],t.max.y=e[n+4],t.max.z=e[n+5],t}function Ei(n){n[0]=n[1]=n[2]=1/0,n[3]=n[4]=n[5]=-1/0}function ds(n){let e=-1,t=-1/0;for(let s=0;s<3;s++){const i=n[s+3]-n[s];i>t&&(t=i,e=s)}return e}function fs(n,e){e.set(n)}function ps(n,e,t){let s,i;for(let r=0;r<3;r++){const o=r+3;s=n[r],i=e[r],t[r]=si?s:i}}function ee(n,e,t){for(let s=0;s<3;s++){const i=e[n+2*s],r=e[n+2*s+1],o=i-r,a=i+r;ot[s+3]&&(t[s+3]=a)}}function Ht(n){const e=n[3]-n[0],t=n[4]-n[1],s=n[5]-n[2];return 2*(e*t+t*s+s*e)}function Se(n,e,t,s,i=null){let r=1/0,o=1/0,a=1/0,c=-1/0,f=-1/0,d=-1/0,u=1/0,l=1/0,p=1/0,y=-1/0,O=-1/0,T=-1/0;const _=i!==null;for(let g=e*6,E=(e+t)*6;gc&&(c=x),_&&hy&&(y=h);const C=n[g+2],v=n[g+3],b=C-v,D=C+v;bf&&(f=D),_&&CO&&(O=C);const P=n[g+4],L=n[g+5],M=P-L,R=P+L;Md&&(d=R),_&&PT&&(T=P)}s[0]=r,s[1]=o,s[2]=a,s[3]=c,s[4]=f,s[5]=d,_&&(i[0]=u,i[1]=l,i[2]=p,i[3]=y,i[4]=O,i[5]=T)}function wi(n,e,t,s){let i=1/0,r=1/0,o=1/0,a=-1/0,c=-1/0,f=-1/0;for(let d=e*6,u=(e+t)*6;da&&(a=l);const p=n[d+2];pc&&(c=p);const y=n[d+4];yf&&(f=y)}s[0]=i,s[1]=r,s[2]=o,s[3]=a,s[4]=c,s[5]=f}function xi(n,e){Ei(e);const t=n.attributes.position,s=n.index?n.index.array:null,i=Bt(n),r=new Float32Array(i*6),o=t.normalized,a=t.array,c=t.offset||0;let f=3;t.isInterleavedBufferAttribute&&(f=t.data.stride);const d=["getX","getY","getZ"];for(let u=0;uw&&(w=E),h>w&&(w=h);const x=(w-m)/2,C=_*2;r[p+C+0]=m+x,r[p+C+1]=x+(Math.abs(m)+x)*mi,me[_+3]&&(e[_+3]=w)}}return r}const ct=32,Oi=(n,e)=>n.candidate-e.candidate,ft=new Array(ct).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),se=new Float32Array(6);function Ai(n,e,t,s,i,r){let o=-1,a=0;if(r===Ns)o=ds(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(r===fi)o=ds(n),o!==-1&&(a=Ci(t,s,i,o));else if(r===pi){const c=Ht(n);let f=De*i;const d=s*6,u=(s+i)*6;for(let l=0;l<3;l++){const p=e[l],T=(e[l+3]-p)/ct;if(i=x.candidate?ee(h,t,x.rightCacheBounds):(ee(h,t,x.leftCacheBounds),x.count++)}}for(let h=0;h=ct&&(w=ct-1);const x=ft[w];x.count++,ee(E,t,x.bounds)}const _=ft[ct-1];fs(_.bounds,_.rightCacheBounds);for(let E=ct-2;E>=0;E--){const h=ft[E],m=ft[E+1];ps(h.bounds,m.rightCacheBounds,h.rightCacheBounds)}let g=0;for(let E=0;E=c;)a--;if(o=c;)a--;if(o2**16,i=s?4:2,r=e?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),o=s?new Uint32Array(r):new Uint16Array(r);for(let a=0,c=o.length;a=i&&(u=!0,r&&(console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),w<=o||C>=i)return g(m+w),h.offset=m,h.count=w,h;const v=Ai(h.boundingData,x,y,m,w,a);if(v.axis===-1)return g(m+w),h.offset=m,h.count=w,h;const b=O(d,s,y,m,w,v);if(b===m||b===m+w)g(m+w),h.offset=m,h.count=w;else{h.splitAxis=v.axis;const D=new ie,P=m,L=b-m;h.left=D,D.boundingData=new Float32Array(6),Se(y,P,L,D.boundingData,p),E(D,P,L,p,C+1);const M=new ie,R=b,Z=w-L;h.right=M,M.boundingData=new Float32Array(6),Se(y,R,Z,M.boundingData,p),E(M,R,Z,p,C+1)}return h}}function Di(n,e){const t=n.geometry;e.indirect&&(n._indirectBuffer=Pi(t,e.useSharedArrayBuffer),Ti(t)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),n._indirectBuffer||gi(t,e);const s=Ui(n,e);let i,r,o;const a=[],c=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let u=0;uMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return r[p+6]=h/4,h=d(h,g),r[p+7]=E,h}}}class dt{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let s=1/0,i=-1/0;for(let r=0,o=e.length;ri?c:i}this.min=s,this.max=i}setFromPoints(e,t){let s=1/0,i=-1/0;for(let r=0,o=t.length;ri?c:i}this.min=s,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}dt.prototype.setFromBox=function(){const n=new S;return function(t,s){const i=s.min,r=s.max;let o=1/0,a=-1/0;for(let c=0;c<=1;c++)for(let f=0;f<=1;f++)for(let d=0;d<=1;d++){n.x=i.x*c+r.x*(1-c),n.y=i.y*f+r.y*(1-f),n.z=i.z*d+r.z*(1-d);const u=t.dot(n);o=Math.min(u,o),a=Math.max(u,a)}this.min=o,this.max=a}}();const Li=function(){const n=new S,e=new S,t=new S;return function(i,r,o){const a=i.start,c=n,f=r.start,d=e;t.subVectors(a,f),n.subVectors(i.end,i.start),e.subVectors(r.end,r.start);const u=t.dot(d),l=d.dot(c),p=d.dot(d),y=t.dot(c),T=c.dot(c)*p-l*l;let _,g;T!==0?_=(u*l-y*p)/T:_=0,g=(u+_*l)/p,o.x=_,o.y=g}}(),es=function(){const n=new ht,e=new S,t=new S;return function(i,r,o,a){Li(i,r,n);let c=n.x,f=n.y;if(c>=0&&c<=1&&f>=0&&f<=1){i.at(c,o),r.at(f,a);return}else if(c>=0&&c<=1){f<0?r.at(0,a):r.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(f>=0&&f<=1){c<0?i.at(0,o):i.at(1,o),r.closestPointToPoint(o,!0,a);return}else{let d;c<0?d=i.start:d=i.end;let u;f<0?u=r.start:u=r.end;const l=e,p=t;if(i.closestPointToPoint(u,!0,e),r.closestPointToPoint(d,!0,t),l.distanceToSquared(u)<=p.distanceToSquared(d)){o.copy(l),a.copy(u);return}else{o.copy(d),a.copy(p);return}}}}(),Si=function(){const n=new S,e=new S,t=new ks,s=new lt;return function(r,o){const{radius:a,center:c}=r,{a:f,b:d,c:u}=o;if(s.start=f,s.end=d,s.closestPointToPoint(c,!0,n).distanceTo(c)<=a||(s.start=f,s.end=u,s.closestPointToPoint(c,!0,n).distanceTo(c)<=a)||(s.start=d,s.end=u,s.closestPointToPoint(c,!0,n).distanceTo(c)<=a))return!0;const O=o.getPlane(t);if(Math.abs(O.distanceToPoint(c))<=a){const _=O.projectPoint(c,e);if(o.containsPoint(_))return!0}return!1}}(),Mi=1e-15;function Me(n){return Math.abs(n)new S),this.satBounds=new Array(4).fill().map(()=>new dt),this.points=[this.a,this.b,this.c],this.sphere=new Vs,this.plane=new ks,this.needsUpdate=!0}intersectsSphere(e){return Si(e,this)}update(){const e=this.a,t=this.b,s=this.c,i=this.points,r=this.satAxes,o=this.satBounds,a=r[0],c=o[0];this.getNormal(a),c.setFromPoints(a,i);const f=r[1],d=o[1];f.subVectors(e,t),d.setFromPoints(f,i);const u=r[2],l=o[2];u.subVectors(t,s),l.setFromPoints(u,i);const p=r[3],y=o[3];p.subVectors(s,e),y.setFromPoints(p,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}ot.prototype.closestPointToSegment=function(){const n=new S,e=new S,t=new lt;return function(i,r=null,o=null){const{start:a,end:c}=i,f=this.points;let d,u=1/0;for(let l=0;l<3;l++){const p=(l+1)%3;t.start.copy(f[l]),t.end.copy(f[p]),es(t,i,n,e),d=n.distanceToSquared(e),d=2){(h===1?_.start:_.end).copy(p),E=2;break}if(E++,E===2&&h===-1)break}}return E}return function(T,_=null,g=!1){this.needsUpdate&&this.update(),T.isExtendedTriangle?T.needsUpdate&&T.update():(n.copy(T),n.update(),T=n);const E=this.plane,h=T.plane;if(Math.abs(E.normal.dot(h.normal))>1-1e-10){const m=this.satBounds,w=this.satAxes;t[0]=T.a,t[1]=T.b,t[2]=T.c;for(let v=0;v<4;v++){const b=m[v],D=w[v];if(s.setFromPoints(D,t),b.isSeparated(s))return!1}const x=T.satBounds,C=T.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let v=0;v<4;v++){const b=x[v],D=C[v];if(s.setFromPoints(D,e),b.isSeparated(s))return!1}for(let v=0;v<4;v++){const b=w[v];for(let D=0;D<4;D++){const P=C[D];if(r.crossVectors(b,P),s.setFromPoints(r,e),i.setFromPoints(r,t),s.isSeparated(i))return!1}}return _&&(g||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),_.start.set(0,0,0),_.end.set(0,0,0)),!0}else{const m=y(this,h,u);if(m===1&&T.containsPoint(u.end))return _&&(_.start.copy(u.end),_.end.copy(u.end)),!0;if(m!==2)return!1;const w=y(T,E,l);if(w===1&&this.containsPoint(l.end))return _&&(_.start.copy(l.end),_.end.copy(l.end)),!0;if(w!==2)return!1;if(u.delta(a),l.delta(c),a.dot(c)<0){let L=l.start;l.start=l.end,l.end=L}const x=u.start.dot(a),C=u.end.dot(a),v=l.start.dot(a),b=l.end.dot(a),D=C0?_.start.copy(u.start):_.start.copy(l.start),f.subVectors(u.end,l.end),f.dot(a)<0?_.end.copy(u.end):_.end.copy(l.end)),!0)}}}();ot.prototype.distanceToPoint=function(){const n=new S;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();ot.prototype.distanceToTriangle=function(){const n=new S,e=new S,t=["a","b","c"],s=new lt,i=new lt;return function(o,a=null,c=null){const f=a||c?s:null;if(this.intersectsTriangle(o,f))return(a||c)&&(a&&f.getCenter(a),c&&f.getCenter(c)),0;let d=1/0;for(let u=0;u<3;u++){let l;const p=t[u],y=o[p];this.closestPointToPoint(y,n),l=y.distanceToSquared(n),lnew S),this.satAxes=new Array(3).fill().map(()=>new S),this.satBounds=new Array(3).fill().map(()=>new dt),this.alignedSatBounds=new Array(3).fill().map(()=>new dt),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),s&&this.matrix.copy(s)}set(e,t,s){this.min.copy(e),this.max.copy(t),this.matrix.copy(s),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}q.prototype.update=function(){return function(){const e=this.matrix,t=this.min,s=this.max,i=this.points;for(let f=0;f<=1;f++)for(let d=0;d<=1;d++)for(let u=0;u<=1;u++){const l=1*f|2*d|4*u,p=i[l];p.x=f?s.x:t.x,p.y=d?s.y:t.y,p.z=u?s.z:t.z,p.applyMatrix4(e)}const r=this.satBounds,o=this.satAxes,a=i[0];for(let f=0;f<3;f++){const d=o[f],u=r[f],l=1<new lt),t=new Array(12).fill().map(()=>new lt),s=new S,i=new S;return function(o,a=0,c=null,f=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(c||f)&&(o.getCenter(i),this.closestPointToPoint(i,s),o.closestPointToPoint(s,i),c&&c.copy(s),f&&f.copy(i)),0;const d=a*a,u=o.min,l=o.max,p=this.points;let y=1/0;for(let T=0;T<8;T++){const _=p[T];i.copy(_).clamp(u,l);const g=_.distanceToSquared(i);if(gnew ot)}}const j=new zi;function K(n,e){return e[n+15]===65535}function Q(n,e){return e[n+6]}function J(n,e){return e[n+14]}function tt(n){return n+8}function et(n,e){return e[n+6]}function Ws(n,e){return e[n+7]}class Bi{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=s=>{t&&e.push(t),t=s,this.float32Array=new Float32Array(s),this.uint16Array=new Uint16Array(s),this.uint32Array=new Uint32Array(s)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const V=new Bi;let _t,zt;const Et=[],ne=new ss(()=>new st);function Fi(n,e,t,s,i,r){_t=ne.getPrimitive(),zt=ne.getPrimitive(),Et.push(_t,zt),V.setBuffer(n._roots[e]);const o=qe(0,n.geometry,t,s,i,r);V.clearBuffer(),ne.releasePrimitive(_t),ne.releasePrimitive(zt),Et.pop(),Et.pop();const a=Et.length;return a>0&&(zt=Et[a-1],_t=Et[a-2]),o}function qe(n,e,t,s,i=null,r=0,o=0){const{float32Array:a,uint16Array:c,uint32Array:f}=V;let d=n*2;if(K(d,c)){const l=Q(n,f),p=J(d,c);return N(n,a,_t),s(l,p,!1,o,r+n,_t)}else{let b=function(P){const{uint16Array:L,uint32Array:M}=V;let R=P*2;for(;!K(R,L);)P=tt(P),R=P*2;return Q(P,M)},D=function(P){const{uint16Array:L,uint32Array:M}=V;let R=P*2;for(;!K(R,L);)P=et(P,M),R=P*2;return Q(P,M)+J(R,L)};const l=tt(n),p=et(n,f);let y=l,O=p,T,_,g,E;if(i&&(g=_t,E=zt,N(y,a,g),N(O,a,E),T=i(g),_=i(E),_(kt.copy(e).clamp(d.min,d.max),kt.distanceToSquared(e)),intersectsBounds:(d,u,l)=>l{d.closestPointToPoint(e,kt);const l=e.distanceToSquared(kt);return l0&&f.normal.multiplyScalar(-1));const d={a:r,b:o,c:a,normal:new S,materialIndex:0};Qt.getNormal(wt,xt,Ot,d.normal),f.face=d,f.faceIndex=r}return f}function Ue(n,e,t,s,i){const r=s*3;let o=r+0,a=r+1,c=r+2;const f=n.index;n.index&&(o=f.getX(o),a=f.getX(a),c=f.getX(c));const{position:d,normal:u,uv:l,uv1:p}=n.attributes,y=Hi(t,d,u,l,p,o,a,c,e);return y?(y.faceIndex=s,i&&i.push(y),y):null}function W(n,e,t,s){const i=n.a,r=n.b,o=n.c;let a=e,c=e+1,f=e+2;t&&(a=t.getX(a),c=t.getX(c),f=t.getX(f)),i.x=s.getX(a),i.y=s.getY(a),i.z=s.getZ(a),r.x=s.getX(c),r.y=s.getY(c),r.z=s.getZ(c),o.x=s.getX(f),o.y=s.getY(f),o.z=s.getZ(f)}function ki(n,e,t,s,i,r){const{geometry:o,_indirectBuffer:a}=n;for(let c=s,f=s+i;cw&&(w=P),Lx&&(x=L),MC&&(C=M)}return c[l+0]!==E||c[l+1]!==h||c[l+2]!==m||c[l+3]!==w||c[l+4]!==x||c[l+5]!==C?(c[l+0]=E,c[l+1]=h,c[l+2]=m,c[l+3]=w,c[l+4]=x,c[l+5]=C,!0):!1}else{const _=l+8,g=o[l+6],E=_+p,h=g+p;let m=y,w=!1,x=!1;e?m||(w=e.has(E),x=e.has(h),m=!w&&!x):(w=!0,x=!0);const C=m||w,v=m||x;let b=!1;C&&(b=u(_,p,m));let D=!1;v&&(D=u(g,p,m));const P=b||D;if(P)for(let L=0;L<3;L++){const M=_+L,R=g+L,Z=c[M],Ft=c[M+3],Rt=c[R],It=c[R+3];c[l+L]=ZIt?Ft:It}return P}}}const gs=new st;function yt(n,e,t,s){return N(n,e,gs),t.intersectBox(gs,s)}function Zi(n,e,t,s,i,r){const{geometry:o,_indirectBuffer:a}=n;for(let c=s,f=s+i;c=0;let p,y;l?(p=tt(n),y=et(n,o)):(p=et(n,o),y=tt(n));const T=yt(p,i,s,Es)?Ke(p,e,t,s):null;if(T){const E=T.point[d];if(l?E<=i[y+f]:E>=i[y+f+3])return T}const g=yt(y,i,s,Es)?Ke(y,e,t,s):null;return T&&g?T.distance<=g.distance?T:g:T||g||null}}const le=new st,At=new ot,Ct=new ot,Vt=new ut,ws=new q,he=new q;function Qi(n,e,t,s){V.setBuffer(n._roots[e]);const i=Qe(0,n,t,s);return V.clearBuffer(),i}function Qe(n,e,t,s,i=null){const{float32Array:r,uint16Array:o,uint32Array:a}=V;let c=n*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),ws.set(t.boundingBox.min,t.boundingBox.max,s),i=ws),K(c,o)){const d=e.geometry,u=d.index,l=d.attributes.position,p=t.index,y=t.attributes.position,O=Q(n,a),T=J(c,o);if(Vt.copy(s).invert(),t.boundsTree)return N(n,r,he),he.matrix.copy(Vt),he.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:g=>he.intersectsBox(g),intersectsTriangle:g=>{g.a.applyMatrix4(s),g.b.applyMatrix4(s),g.c.applyMatrix4(s),g.needsUpdate=!0;for(let E=O*3,h=(T+O)*3;EBe.distanceToBox(m),intersectsBounds:(m,w,x)=>x{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:C=>Yt.distanceToBox(C),intersectsBounds:(C,v,b)=>b{for(let b=C,D=C+v;bw&&(w=M),Rx&&(x=R),ZC&&(C=Z)}}return c[l+0]!==E||c[l+1]!==h||c[l+2]!==m||c[l+3]!==w||c[l+4]!==x||c[l+5]!==C?(c[l+0]=E,c[l+1]=h,c[l+2]=m,c[l+3]=w,c[l+4]=x,c[l+5]=C,!0):!1}else{const _=l+8,g=o[l+6],E=_+p,h=g+p;let m=y,w=!1,x=!1;e?m||(w=e.has(E),x=e.has(h),m=!w&&!x):(w=!0,x=!0);const C=m||w,v=m||x;let b=!1;C&&(b=u(_,p,m));let D=!1;v&&(D=u(g,p,m));const P=b||D;if(P)for(let L=0;L<3;L++){const M=_+L,R=g+L,Z=c[M],Ft=c[M+3],Rt=c[R],It=c[R+3];c[l+L]=ZIt?Ft:It}return P}}}const xs=new S;function nn(n,e,t,s,i){V.setBuffer(n._roots[e]),Ge(0,n,t,s,i),V.clearBuffer()}function Ge(n,e,t,s,i){const{float32Array:r,uint16Array:o,uint32Array:a}=V,c=n*2;if(K(c,o)){const d=Q(n,a),u=J(c,o);Zi(e,t,s,d,u,i)}else{const d=tt(n);yt(d,r,s,xs)&&Ge(d,e,t,s,i);const u=et(n,a);yt(u,r,s,xs)&&Ge(u,e,t,s,i)}}const Os=new S,on=["x","y","z"];function rn(n,e,t,s){V.setBuffer(n._roots[e]);const i=je(0,n,t,s);return V.clearBuffer(),i}function je(n,e,t,s){const{float32Array:i,uint16Array:r,uint32Array:o}=V;let a=n*2;if(K(a,r)){const f=Q(n,o),d=J(a,r);return Xi(e,t,s,f,d)}else{const f=Ws(n,o),d=on[f],l=s.direction[d]>=0;let p,y;l?(p=tt(n),y=et(n,o)):(p=et(n,o),y=tt(n));const T=yt(p,i,s,Os)?je(p,e,t,s):null;if(T){const E=T.point[d];if(l?E<=i[y+f]:E>=i[y+f+3])return T}const g=yt(y,i,s,Os)?je(y,e,t,s):null;return T&&g?T.distance<=g.distance?T:g:T||g||null}}const de=new st,vt=new ot,bt=new ot,Nt=new ut,As=new q,fe=new q;function an(n,e,t,s){V.setBuffer(n._roots[e]);const i=Je(0,n,t,s);return V.clearBuffer(),i}function Je(n,e,t,s,i=null){const{float32Array:r,uint16Array:o,uint32Array:a}=V;let c=n*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),As.set(t.boundingBox.min,t.boundingBox.max,s),i=As),K(c,o)){const d=e.geometry,u=d.index,l=d.attributes.position,p=t.index,y=t.attributes.position,O=Q(n,a),T=J(c,o);if(Nt.copy(s).invert(),t.boundsTree)return N(n,r,fe),fe.matrix.copy(Nt),fe.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:g=>fe.intersectsBox(g),intersectsTriangle:g=>{g.a.applyMatrix4(s),g.b.applyMatrix4(s),g.c.applyMatrix4(s),g.needsUpdate=!0;for(let E=O,h=T+O;EFe.distanceToBox(m),intersectsBounds:(m,w,x)=>x{if(e.boundsTree){const x=e.boundsTree;return x.shapecast({boundsTraverseOrder:C=>Zt.distanceToBox(C),intersectsBounds:(C,v,b)=>b{for(let b=C,D=C+v;bnew st),Pt=new st,Ut=new st,Re=new st,Ie=new st;let He=!1;function pn(n,e,t,s){if(He)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");He=!0;const i=n._roots,r=e._roots;let o,a=0,c=0;const f=new ut().copy(t).invert();for(let d=0,u=i.length;dc.slice()),index:o.array.slice(),indirectBuffer:r?r.slice():null}:a={roots:i,index:o.array,indirectBuffer:r},a}static deserialize(e,t,s={}){s={setIndex:!0,indirect:!!e.indirectBuffer,...s};const{index:i,roots:r,indirectBuffer:o}=e,a=new is(t,{...s,[Le]:!0});if(a._roots=r,a._indirectBuffer=o||null,s.setIndex){const c=t.getIndex();if(c===null){const f=new Hs(e.index,1,!1);t.setIndex(f)}else c.array!==i&&(c.array.set(i),c.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:Ns,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[Le]:!1},t),t.useSharedArrayBuffer&&!fn())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[Le]||(Di(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new st)));const{_indirectBuffer:s}=this;this.resolveTriangleIndex=t.indirect?i=>s[i]:i=>i}refit(e=null){return(this.indirect?sn:Ni)(this,e)}traverse(e,t=0){const s=this._roots[t],i=new Uint32Array(s),r=new Uint16Array(s);o(0);function o(a,c=0){const f=a*2,d=r[f+15]===Pe;if(d){const u=i[a+6],l=r[f+14];e(c,d,new Float32Array(s,a*4,6),u,l)}else{const u=a+we/4,l=i[a+6],p=i[a+7];e(c,d,new Float32Array(s,a*4,6),p)||(o(u,c+1),o(l,c+1))}}}raycast(e,t=as){const s=this._roots,i=this.geometry,r=[],o=t.isMaterial,a=Array.isArray(t),c=i.groups,f=o?t.side:t,d=this.indirect?nn:qi;for(let u=0,l=s.length;uu(l,p,y,O,T)?!0:s(l,p,this,a,y,O,t)}else o||(a?o=(u,l,p,y)=>s(u,l,this,a,p,y,t):o=(u,l,p)=>p);let c=!1,f=0;const d=this._roots;for(let u=0,l=d.length;u{const O=this.resolveTriangleIndex(y);W(o,O*3,a,c)}:y=>{W(o,y*3,a,c)},d=j.getPrimitive(),u=e.geometry.index,l=e.geometry.attributes.position,p=e.indirect?y=>{const O=e.resolveTriangleIndex(y);W(d,O*3,u,l)}:y=>{W(d,y*3,u,l)};if(r){const y=(O,T,_,g,E,h,m,w)=>{for(let x=_,C=_+g;xme.intersectsBox(s),intersectsTriangle:s=>me.intersectsTriangle(s)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,s={},i={},r=0,o=1/0){return(this.indirect?dn:en)(this,e,t,s,i,r,o)}closestPointToPoint(e,t={},s=0,i=1/0){return Ri(this,e,t,s,i)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(s=>{N(0,new Float32Array(s),Cs),e.union(Cs)}),e}}function vs(n,e,t){return n===null||(n.point.applyMatrix4(e.matrixWorld),n.distance=n.point.distanceTo(t.ray.origin),n.object=e,n.distancet.far)?null:n}const ke=new js,bs=new ut,mn=ts.prototype.raycast;function _n(n,e){if(this.geometry.boundsTree){if(this.material===void 0)return;bs.copy(this.matrixWorld).invert(),ke.copy(n.ray).applyMatrix4(bs);const t=this.geometry.boundsTree;if(n.firstHitOnly===!0){const s=vs(t.raycastFirst(ke,this.material),this,n);s&&e.push(s)}else{const s=t.raycast(ke,this.material);for(let i=0,r=s.length;i{const t=this.handlers.slice(0);for(const s of t)s(e)});U(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}}class ns{constructor(e){U(this,"isDisposeable",()=>"dispose"in this&&"onDisposed"in this);U(this,"isResizeable",()=>"resize"in this&&"getSize"in this);U(this,"isUpdateable",()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this);U(this,"isHideable",()=>"visible"in this);U(this,"isConfigurable",()=>"setup"in this&&"config"in this&&"onSetup"in this);this.components=e}}class os extends ns{}class rs extends ns{constructor(t){super(t);U(this,"worlds",new Map);U(this,"onWorldChanged",new Y);U(this,"currentWorld",null);this.onWorldChanged.add(({world:s,action:i})=>{i==="removed"&&this.worlds.delete(s.uuid)})}}class Tn extends rs{constructor(){super(...arguments);U(this,"hasCameraControls",()=>"controls"in this)}}class En extends rs{constructor(){super(...arguments);U(this,"onAfterUpdate",new Y);U(this,"onBeforeUpdate",new Y);U(this,"onDisposed",new Y);U(this,"onResize",new Y);U(this,"onClippingPlanesUpdated",new Y);U(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(t,s,i){s.isLocal=i;const r=this.clippingPlanes.indexOf(s);t&&r===-1?this.clippingPlanes.push(s):!t&&r>-1&&this.clippingPlanes.splice(r,1),this.three.clippingPlanes=this.clippingPlanes.filter(o=>!o.isLocal)}}const jt=class jt extends os{constructor(t){super(t);U(this,"_disposedComponents",new Set);U(this,"enabled",!0);t.add(jt.uuid,this)}get(){return this._disposedComponents}destroy(t,s=!0,i=!0){t.removeFromParent();const r=t;r.dispose&&r.dispose(),this.disposeGeometryAndMaterials(t,s),i&&r.children&&r.children.length&&this.disposeChildren(r),t.children.length=0}disposeGeometry(t){const s=t;s.boundsTree&&s.disposeBoundsTree(),t.dispose()}disposeGeometryAndMaterials(t,s){const i=t;i.geometry&&this.disposeGeometry(i.geometry),s&&i.material&&jt.disposeMaterial(i),i.material=[],i.geometry=null}disposeChildren(t){for(const s of t.children)this.destroy(s)}static disposeMaterial(t){if(t.material)if(Array.isArray(t.material))for(const s of t.material)s.dispose();else t.material.dispose()}};U(jt,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let Jt=jt;class wn extends rs{constructor(t){super(t);U(this,"onDisposed",new Y)}dispose(){const t=this.components.get(Jt);for(const s of this.three.children){const i=s;i.geometry&&t.destroy(i)}this.three.children=[],this.onDisposed.trigger(),this.onDisposed.reset()}}const X=class X{static create(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return`${X._lut[e&255]+X._lut[e>>8&255]+X._lut[e>>16&255]+X._lut[e>>24&255]}-${X._lut[t&255]}${X._lut[t>>8&255]}-${X._lut[t>>16&15|64]}${X._lut[t>>24&255]}-${X._lut[s&63|128]}${X._lut[s>>8&255]}-${X._lut[s>>16&255]}${X._lut[s>>24&255]}${X._lut[i&255]}${X._lut[i>>8&255]}${X._lut[i>>16&255]}${X._lut[i>>24&255]}`.toLowerCase()}static validate(e){if(!X._pattern.test(e))throw new Error(`${e} is not a valid UUID v4. - If you're the tool creator, you can take one from https://www.uuidgenerator.net/. -- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};U(X,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),U(X,"_lut",["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]);let Oe=X;const Ce=class Ce{constructor(){U(this,"onDisposed",new Y);U(this,"list",new Map);U(this,"enabled",!1);U(this,"_clock");U(this,"update",()=>{if(!this.enabled)return;const e=this._clock.getDelta();for(const[t,s]of this.list)s.enabled&&s.isUpdateable()&&s.update(e);requestAnimationFrame(this.update)});this._clock=new Qs,Ce.setupBVH()}add(e,t){if(this.list.has(e))throw new Error("You're trying to add a component that already exists in the components intance. Use Components.get() instead.");Oe.validate(e),this.list.set(e,t)}get(e){const t=e.uuid;if(!this.list.has(t)){const s=new e(this);return this.list.has(t)||this.add(t,s),s}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){as.prototype.computeBoundsTree=mn,as.prototype.disposeBoundsTree=_n,Je.prototype.raycast=pn}};U(Ce,"release","1.4.21");let bs=Ce;class En extends is{constructor(t){super(t);U(this,"meshes",new Set);U(this,"onAfterUpdate",new Y);U(this,"onBeforeUpdate",new Y);U(this,"isDisposing",!1);U(this,"enabled",!0);U(this,"uuid",Oe.create());U(this,"name");U(this,"onDisposed",new Y);U(this,"_scene");U(this,"_camera");U(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(t){this._scene=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(t){this._camera=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(t){this._renderer=t,t&&(t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"}))}update(t){this.enabled&&(!this._scene||!this._camera||(this.scene.currentWorld=this,this.camera.currentWorld=this,this.renderer&&(this.renderer.currentWorld=this),this.onBeforeUpdate.trigger(),this.scene.isUpdateable()&&this.scene.update(t),this.camera.isUpdateable()&&this.camera.update(t),this.renderer&&this.renderer.update(t),this.onAfterUpdate.trigger()))}dispose(t=!0){if(this.enabled=!1,this.isDisposing=!0,this.scene.onWorldChanged.trigger({world:this,action:"removed"}),this.camera.onWorldChanged.trigger({world:this,action:"removed"}),this.renderer&&this.renderer.onWorldChanged.trigger({world:this,action:"removed"}),t){const s=this.components.get(Jt);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const i of this.meshes)s.destroy(i);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.onDisposed.trigger()}}class Un extends Tn{constructor(t){super(t);U(this,"isSetup",!1);U(this,"three");U(this,"onSetup",new Y);U(this,"config",{directionalLight:{color:new Ee("white"),intensity:1.5,position:new S(5,10,3)},ambientLight:{color:new Ee("white"),intensity:1}});this.three=new js,this.three.background=new Ee(2107698)}setup(t){this.config={...this.config,...t};const s=new Js(this.config.directionalLight.color,this.config.directionalLight.intensity);s.position.copy(this.config.directionalLight.position);const i=new ti(this.config.ambientLight.color,this.config.ambientLight.intensity);this.three.add(s,i),this.isSetup=!0,this.onSetup.trigger(this)}}class Dn extends gn{constructor(t,s,i){super(t);U(this,"enabled",!0);U(this,"container");U(this,"three");U(this,"_canvas");U(this,"_parameters");U(this,"_resizeObserver",null);U(this,"onContainerUpdated",new Y);U(this,"_resizing",!1);U(this,"resize",t=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const s=t?t.x:this.container.clientWidth,i=t?t.y:this.container.clientHeight;this.three.setSize(s,i),this.onResize.trigger(new ht(s,i)),this._resizing=!1});U(this,"resizeEvent",()=>{this.resize()});U(this,"onContextLost",t=>{t.preventDefault(),this.enabled=!1});U(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new cs({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0});this.container=s,this._parameters=i,this.three=new cs({antialias:!0,alpha:!0,...i}),this.three.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.setupRenderer(),this.setupEvents(!0),this.resize(),this._canvas=this.three.domElement;const r=this.three.getContext(),{canvas:o}=r;o.addEventListener("webglcontextlost",this.onContextLost,!1),o.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const t=this.currentWorld.scene.three,s=this.currentWorld.camera.three;this.three.render(t,s),this.onAfterUpdate.trigger(this)}dispose(){this.enabled=!1,this.setupEvents(!1),this.three.domElement.remove(),this.three.dispose(),this.onResize.reset(),this.onAfterUpdate.reset(),this.onBeforeUpdate.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}getSize(){return new ht(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(t){const s=this.three.domElement.parentElement;if(!s)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),t&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(s),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}}/*! +- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};U(X,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),U(X,"_lut",["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]);let Oe=X;const Ce=class Ce{constructor(){U(this,"onDisposed",new Y);U(this,"list",new Map);U(this,"enabled",!1);U(this,"_clock");U(this,"update",()=>{if(!this.enabled)return;const e=this._clock.getDelta();for(const[t,s]of this.list)s.enabled&&s.isUpdateable()&&s.update(e);requestAnimationFrame(this.update)});this._clock=new Js,Ce.setupBVH()}add(e,t){if(this.list.has(e))throw new Error("You're trying to add a component that already exists in the components intance. Use Components.get() instead.");Oe.validate(e),this.list.set(e,t)}get(e){const t=e.uuid;if(!this.list.has(t)){const s=new e(this);return this.list.has(t)||this.add(t,s),s}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){cs.prototype.computeBoundsTree=yn,cs.prototype.disposeBoundsTree=gn,ts.prototype.raycast=_n}};U(Ce,"release","1.4.21");let Ps=Ce;class xn extends ns{constructor(t){super(t);U(this,"meshes",new Set);U(this,"onAfterUpdate",new Y);U(this,"onBeforeUpdate",new Y);U(this,"isDisposing",!1);U(this,"enabled",!0);U(this,"uuid",Oe.create());U(this,"name");U(this,"onDisposed",new Y);U(this,"_scene");U(this,"_camera");U(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(t){this._scene=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(t){this._camera=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(t){this._renderer=t,t&&(t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"}))}update(t){this.enabled&&(!this._scene||!this._camera||(this.scene.currentWorld=this,this.camera.currentWorld=this,this.renderer&&(this.renderer.currentWorld=this),this.onBeforeUpdate.trigger(),this.scene.isUpdateable()&&this.scene.update(t),this.camera.isUpdateable()&&this.camera.update(t),this.renderer&&this.renderer.update(t),this.onAfterUpdate.trigger()))}dispose(t=!0){if(this.enabled=!1,this.isDisposing=!0,this.scene.onWorldChanged.trigger({world:this,action:"removed"}),this.camera.onWorldChanged.trigger({world:this,action:"removed"}),this.renderer&&this.renderer.onWorldChanged.trigger({world:this,action:"removed"}),t){const s=this.components.get(Jt);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const i of this.meshes)s.destroy(i);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.onDisposed.trigger()}}class Dn extends wn{constructor(t){super(t);U(this,"isSetup",!1);U(this,"three");U(this,"onSetup",new Y);U(this,"config",{directionalLight:{color:new Ee("white"),intensity:1.5,position:new S(5,10,3)},ambientLight:{color:new Ee("white"),intensity:1}});this.three=new ti,this.three.background=new Ee(2107698)}setup(t){this.config={...this.config,...t};const s=new ei(this.config.directionalLight.color,this.config.directionalLight.intensity);s.position.copy(this.config.directionalLight.position);const i=new si(this.config.ambientLight.color,this.config.ambientLight.intensity);this.three.add(s,i),this.isSetup=!0,this.onSetup.trigger(this)}}class Ln extends En{constructor(t,s,i){super(t);U(this,"enabled",!0);U(this,"container");U(this,"three");U(this,"_canvas");U(this,"_parameters");U(this,"_resizeObserver",null);U(this,"onContainerUpdated",new Y);U(this,"_resizing",!1);U(this,"resize",t=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const s=t?t.x:this.container.clientWidth,i=t?t.y:this.container.clientHeight;this.three.setSize(s,i),this.onResize.trigger(new ht(s,i)),this._resizing=!1});U(this,"resizeEvent",()=>{this.resize()});U(this,"onContextLost",t=>{t.preventDefault(),this.enabled=!1});U(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new ls({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0});this.container=s,this._parameters=i,this.three=new ls({antialias:!0,alpha:!0,...i}),this.three.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.setupRenderer(),this.setupEvents(!0),this.resize(),this._canvas=this.three.domElement;const r=this.three.getContext(),{canvas:o}=r;o.addEventListener("webglcontextlost",this.onContextLost,!1),o.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const t=this.currentWorld.scene.three,s=this.currentWorld.camera.three;this.three.render(t,s),this.onAfterUpdate.trigger(this)}dispose(){this.enabled=!1,this.setupEvents(!1),this.three.domElement.remove(),this.three.dispose(),this.onResize.reset(),this.onAfterUpdate.reset(),this.onBeforeUpdate.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}getSize(){return new ht(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(t){const s=this.three.domElement.parentElement;if(!s)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),t&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(s),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}}/*! * camera-controls * https://github.com/yomotsu/camera-controls * (c) 2017 @yomotsu * Released under the MIT License. - */const B={LEFT:1,RIGHT:2,MIDDLE:4},A=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),Dt={NONE:0,IN:1,OUT:-1};function gt(n){return n.isPerspectiveCamera}function pt(n){return n.isOrthographicCamera}const Lt=Math.PI*2,Ps=Math.PI/2,Xs=1e-5,Xt=Math.PI/180;function nt(n,e,t){return Math.max(e,Math.min(t,n))}function k(n,e=Xs){return Math.abs(n)0==p>d&&(p=d,t.value=(p-d)/r),p}function Ds(n,e,t,s,i=1/0,r,o){s=Math.max(1e-4,s);const a=2/s,c=a*r,f=1/(1+c+.48*c*c+.235*c*c*c);let d=e.x,u=e.y,l=e.z,p=n.x-d,y=n.y-u,O=n.z-l;const T=d,_=u,g=l,E=i*s,h=E*E,m=p*p+y*y+O*O;if(m>h){const R=Math.sqrt(m);p=p/R*E,y=y/R*E,O=O/R*E}d=n.x-p,u=n.y-y,l=n.z-O;const w=(t.x+a*p)*r,x=(t.y+a*y)*r,C=(t.z+a*O)*r;t.x=(t.x-a*w)*f,t.y=(t.y-a*x)*f,t.z=(t.z-a*C)*f,o.x=d+(p+w)*f,o.y=u+(y+x)*f,o.z=l+(O+C)*f;const v=T-n.x,b=_-n.y,D=g-n.z,P=o.x-T,L=o.y-_,M=o.z-g;return v*P+b*L+D*M>0&&(o.x=T,o.y=_,o.z=g,t.x=(o.x-T)/r,t.y=(o.y-_)/r,t.z=(o.z-g)/r),o}function ke(n,e){e.set(0,0),n.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=n.length,e.y/=n.length}function Ve(n,e){return pt(n)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class wn{constructor(){this._listeners={}}addEventListener(e,t){const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){const s=this._listeners;return s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const s=this._listeners[e.type];if(s!==void 0){e.target=this;const i=s.slice(0);for(let r=0,o=i.length;r{},this._enabled=!0,this._state=A.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Dt.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new z.Vector3,this._focalOffsetVelocity=new z.Vector3,this._zoomVelocity={value:0},this._truckInternal=(h,m,w)=>{let x,C;if(gt(this._camera)){const v=F.copy(this._camera.position).sub(this._target),b=this._camera.getEffectiveFOV()*Xt,D=v.length()*Math.tan(b*.5);x=this.truckSpeed*h*D/this._elementRect.height,C=this.truckSpeed*m*D/this._elementRect.height}else if(pt(this._camera)){const v=this._camera;x=h*(v.right-v.left)/v.zoom/this._elementRect.width,C=m*(v.top-v.bottom)/v.zoom/this._elementRect.height}else return;this.verticalDragToForward?(w?this.setFocalOffset(this._focalOffsetEnd.x+x,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(x,0,!0),this.forward(-C,!0)):w?this.setFocalOffset(this._focalOffsetEnd.x+x,this._focalOffsetEnd.y+C,this._focalOffsetEnd.z,!0):this.truck(x,C,!0)},this._rotateInternal=(h,m)=>{const w=Lt*this.azimuthRotateSpeed*h/this._elementRect.height,x=Lt*this.polarRotateSpeed*m/this._elementRect.height;this.rotate(w,x,!0)},this._dollyInternal=(h,m,w)=>{const x=Math.pow(.95,-h*this.dollySpeed),C=this._sphericalEnd.radius,v=this._sphericalEnd.radius*x,b=nt(v,this.minDistance,this.maxDistance),D=b-v;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(v,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(D,!0),this._dollyToNoClamp(b,!0)):this._dollyToNoClamp(b,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?v:b)-C,this._dollyControlCoord.set(m,w)),this._lastDollyDirection=Math.sign(-h)},this._zoomInternal=(h,m,w)=>{const x=Math.pow(.95,h*this.dollySpeed),C=this._zoom,v=this._zoom*x;this.zoomTo(v,!0),this.dollyToCursor&&(this._changedZoom+=v-C,this._dollyControlCoord.set(m,w))},typeof z>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new z.Quaternion().setFromUnitVectors(this._camera.up,ge),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=A.NONE,this._target=new z.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new z.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new z.Spherical().setFromVector3(F.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new z.Vector3,new z.Vector3,new z.Vector3,new z.Vector3],this._updateNearPlaneCorners(),this._boundary=new z.Box3(new z.Vector3(-1/0,-1/0,-1/0),new z.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new z.Vector2,this.mouseButtons={left:A.ROTATE,middle:A.DOLLY,right:A.TRUCK,wheel:gt(this._camera)?A.DOLLY:pt(this._camera)?A.ZOOM:A.NONE},this.touches={one:A.TOUCH_ROTATE,two:gt(this._camera)?A.TOUCH_DOLLY_TRUCK:pt(this._camera)?A.TOUCH_ZOOM_TRUCK:A.NONE,three:A.TOUCH_TRUCK};const s=new z.Vector2,i=new z.Vector2,r=new z.Vector2,o=h=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const x=this._domElement.getBoundingClientRect(),C=h.clientX/x.width,v=h.clientY/x.height;if(Cthis._interactiveArea.right||vthis._interactiveArea.bottom)return}const m=h.pointerType!=="mouse"?null:(h.buttons&B.LEFT)===B.LEFT?B.LEFT:(h.buttons&B.MIDDLE)===B.MIDDLE?B.MIDDLE:(h.buttons&B.RIGHT)===B.RIGHT?B.RIGHT:null;if(m!==null){const x=this._findPointerByMouseButton(m);x&&this._disposePointer(x)}if((h.buttons&B.LEFT)===B.LEFT&&this._lockedPointer)return;const w={pointerId:h.pointerId,clientX:h.clientX,clientY:h.clientY,deltaX:0,deltaY:0,mouseButton:m};this._activePointers.push(w),this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.addEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),this._isDragging=!0,O(h)},a=h=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const x=this._domElement.getBoundingClientRect(),C=h.clientX/x.width,v=h.clientY/x.height;if(Cthis._interactiveArea.right||vthis._interactiveArea.bottom)return}const m=(h.buttons&B.LEFT)===B.LEFT?B.LEFT:(h.buttons&B.MIDDLE)===B.MIDDLE?B.MIDDLE:(h.buttons&B.RIGHT)===B.RIGHT?B.RIGHT:null;if(m!==null){const x=this._findPointerByMouseButton(m);x&&this._disposePointer(x)}const w={pointerId:1,clientX:h.clientX,clientY:h.clientY,deltaX:0,deltaY:0,mouseButton:(h.buttons&B.LEFT)===B.LEFT?B.LEFT:(h.buttons&B.MIDDLE)===B.LEFT?B.MIDDLE:(h.buttons&B.RIGHT)===B.LEFT?B.RIGHT:null};this._activePointers.push(w),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("mouseup",u),this._domElement.ownerDocument.addEventListener("mousemove",f),this._domElement.ownerDocument.addEventListener("mouseup",u),this._isDragging=!0,O(h)},c=h=>{h.cancelable&&h.preventDefault();const m=h.pointerId,w=this._lockedPointer||this._findPointerById(m);if(w){if(w.clientX=h.clientX,w.clientY=h.clientY,w.deltaX=h.movementX,w.deltaY=h.movementY,this._state=0,h.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(h.buttons&B.LEFT)===B.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(h.buttons&B.MIDDLE)===B.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(h.buttons&B.RIGHT)===B.RIGHT&&(this._state=this._state|this.mouseButtons.right);T()}},f=h=>{const m=this._lockedPointer||this._findPointerById(1);m&&(m.clientX=h.clientX,m.clientY=h.clientY,m.deltaX=h.movementX,m.deltaY=h.movementY,this._state=0,(this._lockedPointer||(h.buttons&B.LEFT)===B.LEFT)&&(this._state=this._state|this.mouseButtons.left),(h.buttons&B.MIDDLE)===B.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(h.buttons&B.RIGHT)===B.RIGHT&&(this._state=this._state|this.mouseButtons.right),T())},d=h=>{const m=this._findPointerById(h.pointerId);if(!(m&&m===this._lockedPointer)){if(m&&this._disposePointer(m),h.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=A.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=A.NONE;_()}},u=()=>{const h=this._findPointerById(1);h&&h===this._lockedPointer||(h&&this._disposePointer(h),this._state=A.NONE,_())};let l=-1;const p=h=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===A.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const v=this._domElement.getBoundingClientRect(),b=h.clientX/v.width,D=h.clientY/v.height;if(bthis._interactiveArea.right||Dthis._interactiveArea.bottom)return}if(h.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===A.ROTATE||this.mouseButtons.wheel===A.TRUCK){const v=performance.now();l-v<1e3&&this._getClientRect(this._elementRect),l=v}const m=On?-1:-3,w=h.deltaMode===1?h.deltaY/m:h.deltaY/(m*10),x=this.dollyToCursor?(h.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,C=this.dollyToCursor?(h.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case A.ROTATE:{this._rotateInternal(h.deltaX,h.deltaY),this._isUserControllingRotate=!0;break}case A.TRUCK:{this._truckInternal(h.deltaX,h.deltaY,!1),this._isUserControllingTruck=!0;break}case A.OFFSET:{this._truckInternal(h.deltaX,h.deltaY,!0),this._isUserControllingOffset=!0;break}case A.DOLLY:{this._dollyInternal(-w,x,C),this._isUserControllingDolly=!0;break}case A.ZOOM:{this._zoomInternal(-w,x,C),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},y=h=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===te.ACTION.NONE){const m=h instanceof PointerEvent?h.pointerId:(h instanceof MouseEvent,0),w=this._findPointerById(m);w&&this._disposePointer(w),this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("mouseup",u);return}h.preventDefault()}},O=h=>{if(!this._enabled)return;if(ke(this._activePointers,$),this._getClientRect(this._elementRect),s.copy($),i.copy($),this._activePointers.length>=2){const w=$.x-this._activePointers[1].clientX,x=$.y-this._activePointers[1].clientY,C=Math.sqrt(w*w+x*x);r.set(0,C);const v=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,b=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(v,b)}if(this._state=0,!h)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in h&&h.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(h.buttons&B.LEFT)===B.LEFT&&(this._state=this._state|this.mouseButtons.left),(h.buttons&B.MIDDLE)===B.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(h.buttons&B.RIGHT)===B.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&A.ROTATE)===A.ROTATE||(this._state&A.TOUCH_ROTATE)===A.TOUCH_ROTATE||(this._state&A.TOUCH_DOLLY_ROTATE)===A.TOUCH_DOLLY_ROTATE||(this._state&A.TOUCH_ZOOM_ROTATE)===A.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&A.TRUCK)===A.TRUCK||(this._state&A.TOUCH_TRUCK)===A.TOUCH_TRUCK||(this._state&A.TOUCH_DOLLY_TRUCK)===A.TOUCH_DOLLY_TRUCK||(this._state&A.TOUCH_ZOOM_TRUCK)===A.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&A.DOLLY)===A.DOLLY||(this._state&A.TOUCH_DOLLY)===A.TOUCH_DOLLY||(this._state&A.TOUCH_DOLLY_TRUCK)===A.TOUCH_DOLLY_TRUCK||(this._state&A.TOUCH_DOLLY_OFFSET)===A.TOUCH_DOLLY_OFFSET||(this._state&A.TOUCH_DOLLY_ROTATE)===A.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&A.ZOOM)===A.ZOOM||(this._state&A.TOUCH_ZOOM)===A.TOUCH_ZOOM||(this._state&A.TOUCH_ZOOM_TRUCK)===A.TOUCH_ZOOM_TRUCK||(this._state&A.TOUCH_ZOOM_OFFSET)===A.TOUCH_ZOOM_OFFSET||(this._state&A.TOUCH_ZOOM_ROTATE)===A.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&A.OFFSET)===A.OFFSET||(this._state&A.TOUCH_OFFSET)===A.TOUCH_OFFSET||(this._state&A.TOUCH_DOLLY_OFFSET)===A.TOUCH_DOLLY_OFFSET||(this._state&A.TOUCH_ZOOM_OFFSET)===A.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},T=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,ke(this._activePointers,$);const m=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,w=m?-m.deltaX:i.x-$.x,x=m?-m.deltaY:i.y-$.y;if(i.copy($),((this._state&A.ROTATE)===A.ROTATE||(this._state&A.TOUCH_ROTATE)===A.TOUCH_ROTATE||(this._state&A.TOUCH_DOLLY_ROTATE)===A.TOUCH_DOLLY_ROTATE||(this._state&A.TOUCH_ZOOM_ROTATE)===A.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(w,x),this._isUserControllingRotate=!0),(this._state&A.DOLLY)===A.DOLLY||(this._state&A.ZOOM)===A.ZOOM){const C=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,v=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0,b=this.dollyDragInverted?-1:1;(this._state&A.DOLLY)===A.DOLLY?(this._dollyInternal(b*x*ye,C,v),this._isUserControllingDolly=!0):(this._zoomInternal(b*x*ye,C,v),this._isUserControllingZoom=!0)}if((this._state&A.TOUCH_DOLLY)===A.TOUCH_DOLLY||(this._state&A.TOUCH_ZOOM)===A.TOUCH_ZOOM||(this._state&A.TOUCH_DOLLY_TRUCK)===A.TOUCH_DOLLY_TRUCK||(this._state&A.TOUCH_ZOOM_TRUCK)===A.TOUCH_ZOOM_TRUCK||(this._state&A.TOUCH_DOLLY_OFFSET)===A.TOUCH_DOLLY_OFFSET||(this._state&A.TOUCH_ZOOM_OFFSET)===A.TOUCH_ZOOM_OFFSET||(this._state&A.TOUCH_DOLLY_ROTATE)===A.TOUCH_DOLLY_ROTATE||(this._state&A.TOUCH_ZOOM_ROTATE)===A.TOUCH_ZOOM_ROTATE){const C=$.x-this._activePointers[1].clientX,v=$.y-this._activePointers[1].clientY,b=Math.sqrt(C*C+v*v),D=r.y-b;r.set(0,b);const P=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,L=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&A.TOUCH_DOLLY)===A.TOUCH_DOLLY||(this._state&A.TOUCH_DOLLY_ROTATE)===A.TOUCH_DOLLY_ROTATE||(this._state&A.TOUCH_DOLLY_TRUCK)===A.TOUCH_DOLLY_TRUCK||(this._state&A.TOUCH_DOLLY_OFFSET)===A.TOUCH_DOLLY_OFFSET?(this._dollyInternal(D*ye,P,L),this._isUserControllingDolly=!0):(this._zoomInternal(D*ye,P,L),this._isUserControllingZoom=!0)}((this._state&A.TRUCK)===A.TRUCK||(this._state&A.TOUCH_TRUCK)===A.TOUCH_TRUCK||(this._state&A.TOUCH_DOLLY_TRUCK)===A.TOUCH_DOLLY_TRUCK||(this._state&A.TOUCH_ZOOM_TRUCK)===A.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(w,x,!1),this._isUserControllingTruck=!0),((this._state&A.OFFSET)===A.OFFSET||(this._state&A.TOUCH_OFFSET)===A.TOUCH_OFFSET||(this._state&A.TOUCH_DOLLY_OFFSET)===A.TOUCH_DOLLY_OFFSET||(this._state&A.TOUCH_ZOOM_OFFSET)===A.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(w,x,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},_=()=>{ke(this._activePointers,$),i.copy($),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",u),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",g),this._domElement.ownerDocument.addEventListener("pointerlockerror",E),this._domElement.ownerDocument.addEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),O())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",g),this._domElement.ownerDocument.removeEventListener("pointerlockerror",E))};const g=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},E=()=>{this.unlockPointer()};this._addAllEventListeners=h=>{this._domElement=h,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),An&&this._domElement.addEventListener("mousedown",a),this._domElement.addEventListener("pointercancel",d),this._domElement.addEventListener("wheel",p,{passive:!1}),this._domElement.addEventListener("contextmenu",y)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("mousedown",a),this._domElement.removeEventListener("pointercancel",d),this._domElement.removeEventListener("wheel",p,{passive:!1}),this._domElement.removeEventListener("contextmenu",y),this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",u),this._domElement.ownerDocument.removeEventListener("pointerlockchange",g),this._domElement.ownerDocument.removeEventListener("pointerlockerror",E))},this.cancel=()=>{this._state!==A.NONE&&(this._state=A.NONE,this._activePointers.length=0,_())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=nt(e.width,0,1),this._interactiveArea.height=nt(e.height,0,1),this._interactiveArea.x=nt(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=nt(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,s=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,s)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,s=!1){this._isUserControllingRotate=!1;const i=nt(e,this.minAzimuthAngle,this.maxAzimuthAngle),r=nt(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=r,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,s||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!s||H(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&H(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Dt.NONE,this._changedDolly=0,this._dollyToNoClamp(nt(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const s=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const o=this._collisionTest(),a=H(o,this._spherical.radius);if(!(s>e)&&a)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,o)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const r=!t||H(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(r)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection($t).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const s=!t||H(this._target.x,this._targetEnd.x,this.restThreshold)&&H(this._target.y,this._targetEnd.y,this.restThreshold)&&H(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=nt(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const s=!t||H(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(s)}pan(e,t,s=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,s)}truck(e,t,s=!1){this._camera.updateMatrix(),rt.setFromMatrixColumn(this._camera.matrix,0),at.setFromMatrixColumn(this._camera.matrix,1),rt.multiplyScalar(e),at.multiplyScalar(-t);const i=F.copy(rt).add(at),r=I.copy(this._targetEnd).add(i);return this.moveTo(r.x,r.y,r.z,s)}forward(e,t=!1){F.setFromMatrixColumn(this._camera.matrix,0),F.crossVectors(this._camera.up,F),F.multiplyScalar(e);const s=I.copy(this._targetEnd).add(F);return this.moveTo(s.x,s.y,s.z,t)}elevate(e,t=!1){return F.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+F.x,this._targetEnd.y+F.y,this._targetEnd.z+F.z,t)}moveTo(e,t,s,i=!1){this._isUserControllingTruck=!1;const r=F.set(e,t,s).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,r,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const o=!i||H(this._target.x,this._targetEnd.x,this.restThreshold)&&H(this._target.y,this._targetEnd.y,this.restThreshold)&&H(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,s,i=!1){const a=F.set(e,t,s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(a.x,a.y,a.z,i)}fitToBox(e,t,{cover:s=!1,paddingLeft:i=0,paddingRight:r=0,paddingBottom:o=0,paddingTop:a=0}={}){const c=[],f=e.isBox3?Mt.copy(e):Mt.setFromObject(e);f.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const d=Us(this._sphericalEnd.theta,Ps),u=Us(this._sphericalEnd.phi,Ps);c.push(this.rotateTo(d,u,t));const l=F.setFromSpherical(this._sphericalEnd).normalize(),p=Bs.setFromUnitVectors(l,Ye),y=H(Math.abs(l.y),1);y&&p.multiply(Ze.setFromAxisAngle(ge,d)),p.multiply(this._yAxisUpSpaceInverse);const O=zs.makeEmpty();I.copy(f.min).applyQuaternion(p),O.expandByPoint(I),I.copy(f.min).setX(f.max.x).applyQuaternion(p),O.expandByPoint(I),I.copy(f.min).setY(f.max.y).applyQuaternion(p),O.expandByPoint(I),I.copy(f.max).setZ(f.min.z).applyQuaternion(p),O.expandByPoint(I),I.copy(f.min).setZ(f.max.z).applyQuaternion(p),O.expandByPoint(I),I.copy(f.max).setY(f.min.y).applyQuaternion(p),O.expandByPoint(I),I.copy(f.max).setX(f.min.x).applyQuaternion(p),O.expandByPoint(I),I.copy(f.max).applyQuaternion(p),O.expandByPoint(I),O.min.x-=i,O.min.y-=o,O.max.x+=r,O.max.y+=a,p.setFromUnitVectors(Ye,l),y&&p.premultiply(Ze.invert()),p.premultiply(this._yAxisUpSpace);const T=O.getSize(F),_=O.getCenter(I).applyQuaternion(p);if(gt(this._camera)){const g=this.getDistanceToFitBox(T.x,T.y,T.z,s);c.push(this.moveTo(_.x,_.y,_.z,t)),c.push(this.dollyTo(g,t)),c.push(this.setFocalOffset(0,0,0,t))}else if(pt(this._camera)){const g=this._camera,E=g.right-g.left,h=g.top-g.bottom,m=s?Math.max(E/T.x,h/T.y):Math.min(E/T.x,h/T.y);c.push(this.moveTo(_.x,_.y,_.z,t)),c.push(this.zoomTo(m,t)),c.push(this.setFocalOffset(0,0,0,t))}return Promise.all(c)}fitToSphere(e,t){const s=[],r=e instanceof z.Sphere?Ne.copy(e):te.createBoundingSphere(e,Ne);if(s.push(this.moveTo(r.center.x,r.center.y,r.center.z,t)),gt(this._camera)){const o=this.getDistanceToFitSphere(r.radius);s.push(this.dollyTo(o,t))}else if(pt(this._camera)){const o=this._camera.right-this._camera.left,a=this._camera.top-this._camera.bottom,c=2*r.radius,f=Math.min(o/c,a/c);s.push(this.zoomTo(f,t))}return s.push(this.setFocalOffset(0,0,0,t)),Promise.all(s)}setLookAt(e,t,s,i,r,o,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Dt.NONE,this._changedDolly=0;const c=I.set(i,r,o),f=F.set(e,t,s);this._targetEnd.copy(c),this._sphericalEnd.setFromVector3(f.sub(c).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const d=!a||H(this._target.x,this._targetEnd.x,this.restThreshold)&&H(this._target.y,this._targetEnd.y,this.restThreshold)&&H(this._target.z,this._targetEnd.z,this.restThreshold)&&H(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&H(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&H(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(d)}lerpLookAt(e,t,s,i,r,o,a,c,f,d,u,l,p,y=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Dt.NONE,this._changedDolly=0;const O=F.set(i,r,o),T=I.set(e,t,s);Q.setFromVector3(T.sub(O).applyQuaternion(this._yAxisUpSpace));const _=St.set(d,u,l),g=I.set(a,c,f);Kt.setFromVector3(g.sub(_).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(O.lerp(_,p));const E=Kt.theta-Q.theta,h=Kt.phi-Q.phi,m=Kt.radius-Q.radius;this._sphericalEnd.set(Q.radius+m*p,Q.phi+h*p,Q.theta+E*p),this.normalizeRotations(),this._needsUpdate=!0,y||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const w=!y||H(this._target.x,this._targetEnd.x,this.restThreshold)&&H(this._target.y,this._targetEnd.y,this.restThreshold)&&H(this._target.z,this._targetEnd.z,this.restThreshold)&&H(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&H(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&H(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(w)}setPosition(e,t,s,i=!1){return this.setLookAt(e,t,s,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(e,t,s,i=!1){const r=this.getPosition(F),o=this.setLookAt(r.x,r.y,r.z,e,t,s,i);return this._sphericalEnd.phi=nt(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,s,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,s),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const r=!i||H(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&H(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&H(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}setOrbitPoint(e,t,s){this._camera.updateMatrixWorld(),rt.setFromMatrixColumn(this._camera.matrixWorldInverse,0),at.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Tt.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=F.set(e,t,s),r=i.distanceTo(this._camera.position),o=i.sub(this._camera.position);rt.multiplyScalar(o.x),at.multiplyScalar(o.y),Tt.multiplyScalar(o.z),F.copy(rt).add(at).add(Tt),F.z=F.z+r,this.dollyTo(r,!1),this.setFocalOffset(-F.x,F.y,-F.z,!1),this.moveTo(e,t,s,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,s,i){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new z.Vector4,typeof e=="number"?this._viewport.set(e,t,s,i):this._viewport.copy(e)}getDistanceToFitBox(e,t,s,i=!1){if(Ve(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const r=e/t,o=this._camera.getEffectiveFOV()*Xt,a=this._camera.aspect;return((i?r>a:rt.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,s){const i=t.lengthSq();if(i===0)return e;const r=I.copy(t).add(e),a=this._boundary.clampPoint(r,St).sub(r),c=a.lengthSq();if(c===0)return e.add(t);if(c===i)return e;if(s===0)return e.add(t).add(a);{const f=1+s*c/t.dot(a);return e.add(I.copy(t).multiplyScalar(f)).add(a.multiplyScalar(1-s))}}_updateNearPlaneCorners(){if(gt(this._camera)){const e=this._camera,t=e.near,s=e.getEffectiveFOV()*Xt,i=Math.tan(s*.5)*t,r=i*e.aspect;this._nearPlaneCorners[0].set(-r,-i,0),this._nearPlaneCorners[1].set(r,-i,0),this._nearPlaneCorners[2].set(r,i,0),this._nearPlaneCorners[3].set(-r,i,0)}else if(pt(this._camera)){const e=this._camera,t=1/e.zoom,s=e.left*t,i=e.right*t,r=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(s,r,0),this._nearPlaneCorners[1].set(i,r,0),this._nearPlaneCorners[2].set(i,o,0),this._nearPlaneCorners[3].set(s,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Ve(this._camera,"_collisionTest"))return e;const s=this._getTargetDirection($t);Xe.lookAt(Ls,s,this._camera.up);for(let i=0;i<4;i++){const r=I.copy(this._nearPlaneCorners[i]);r.applyMatrix4(Xe);const o=St.addVectors(this._target,r);Te.set(o,s),Te.far=this._spherical.radius+1;const a=Te.intersectObjects(this.colliderMeshes);a.length!==0&&a[0].distance{const s=()=>{this.removeEventListener("rest",s),t()};this.addEventListener("rest",s)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new z.Sphere){const s=t,i=s.center;Mt.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&Mt.expandByObject(o)}),Mt.getCenter(i);let r=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const a=o,c=a.geometry.clone();c.applyMatrix4(a.matrixWorld);const d=c.attributes.position;for(let u=0,l=d.count;u{var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof ei){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const s=this.currentWorld.renderer.getSize();this.three.aspect=s.width/s.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}});this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:s,world:i})=>{if(s==="added"){const r=this.newCameraControls();this._allControls.set(i.uuid,r)}if(s==="removed"){const r=this._allControls.get(i.uuid);r&&(r.dispose(),this._allControls.delete(i.uuid))}})}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const t=this._allControls.get(this.currentWorld.uuid);if(!t)throw new Error("Controls not found!");return t}get enabled(){return this.currentWorld===null?!1:this.controls.enabled}set enabled(t){this.controls.enabled=t}dispose(){this.setupEvents(!1),this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[t,s]of this._allControls)s.dispose()}update(t){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(t),this.onAfterUpdate.trigger(this))}setupCamera(){const t=window.innerWidth/window.innerHeight,s=new si(60,t,1,1e3);return s.position.set(50,50,50),s.lookAt(new S(0,0,0)),s}newCameraControls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");if(!this.currentWorld.renderer)throw new Error("This camera needs a renderer to work!");te.install({THREE:Ae.getSubsetOfThree()});const{domElement:t}=this.currentWorld.renderer.three,s=new te(this.three,t);return s.smoothTime=.2,s.dollyToCursor=!0,s.infinityDolly=!0,s}setupEvents(t){t?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:ii,Vector2:ht,Vector3:S,Vector4:ni,Quaternion:oi,Matrix4:ut,Spherical:ri,Box3:st,Sphere:Hs,Raycaster:ai,MathUtils:ci}}}const ve=class ve extends ns{constructor(t){super(t);U(this,"onAfterUpdate",new Y);U(this,"onBeforeUpdate",new Y);U(this,"onDisposed",new Y);U(this,"onWorldCreated",new Y);U(this,"onWorldDeleted",new Y);U(this,"list",new Map);U(this,"enabled",!0);t.add(ve.uuid,this)}create(){const t=new En(this.components),s=t.uuid;if(this.list.has(s))throw new Error("There is already a world with this name!");return this.list.set(s,t),this.onWorldCreated.trigger(t),t}delete(t){const s=t.uuid;this.list.delete(t.uuid),t.dispose(),this.onWorldDeleted.trigger(s)}dispose(){this.enabled=!1;for(const[t,s]of this.list)s.dispose();this.list.clear(),this.onDisposed.trigger()}update(t){if(this.enabled)for(const[s,i]of this.list)i.update(t)}};U(ve,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let Fs=ve;class Cn{constructor(e,t,s){U(this,"onDisposed",new Y);U(this,"world");U(this,"components");U(this,"three");U(this,"_fade",3);U(this,"updateZoom",()=>{this.world.camera instanceof Ae&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)});this.world=t;const{color:i,size1:r,size2:o,distance:a}=s;this.components=e;const c=new li(2,2,1,1),f=new hi({side:ks,uniforms:{uSize1:{value:r},uSize2:{value:o},uColor:{value:i},uDistance:{value:a},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:` + */const B={LEFT:1,RIGHT:2,MIDDLE:4},A=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),Dt={NONE:0,IN:1,OUT:-1};function gt(n){return n.isPerspectiveCamera}function pt(n){return n.isOrthographicCamera}const Lt=Math.PI*2,Us=Math.PI/2,qs=1e-5,Xt=Math.PI/180;function nt(n,e,t){return Math.max(e,Math.min(t,n))}function k(n,e=qs){return Math.abs(n)0==p>d&&(p=d,t.value=(p-d)/r),p}function Ls(n,e,t,s,i=1/0,r,o){s=Math.max(1e-4,s);const a=2/s,c=a*r,f=1/(1+c+.48*c*c+.235*c*c*c);let d=e.x,u=e.y,l=e.z,p=n.x-d,y=n.y-u,O=n.z-l;const T=d,_=u,g=l,E=i*s,h=E*E,m=p*p+y*y+O*O;if(m>h){const R=Math.sqrt(m);p=p/R*E,y=y/R*E,O=O/R*E}d=n.x-p,u=n.y-y,l=n.z-O;const w=(t.x+a*p)*r,x=(t.y+a*y)*r,C=(t.z+a*O)*r;t.x=(t.x-a*w)*f,t.y=(t.y-a*x)*f,t.z=(t.z-a*C)*f,o.x=d+(p+w)*f,o.y=u+(y+x)*f,o.z=l+(O+C)*f;const v=T-n.x,b=_-n.y,D=g-n.z,P=o.x-T,L=o.y-_,M=o.z-g;return v*P+b*L+D*M>0&&(o.x=T,o.y=_,o.z=g,t.x=(o.x-T)/r,t.y=(o.y-_)/r,t.z=(o.z-g)/r),o}function Ve(n,e){e.set(0,0),n.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=n.length,e.y/=n.length}function Ye(n,e){return pt(n)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class On{constructor(){this._listeners={}}addEventListener(e,t){const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){const s=this._listeners;return s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const s=this._listeners[e.type];if(s!==void 0){e.target=this;const i=s.slice(0);for(let r=0,o=i.length;r{},this._enabled=!0,this._state=A.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Dt.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new z.Vector3,this._focalOffsetVelocity=new z.Vector3,this._zoomVelocity={value:0},this._truckInternal=(h,m,w)=>{let x,C;if(gt(this._camera)){const v=F.copy(this._camera.position).sub(this._target),b=this._camera.getEffectiveFOV()*Xt,D=v.length()*Math.tan(b*.5);x=this.truckSpeed*h*D/this._elementRect.height,C=this.truckSpeed*m*D/this._elementRect.height}else if(pt(this._camera)){const v=this._camera;x=h*(v.right-v.left)/v.zoom/this._elementRect.width,C=m*(v.top-v.bottom)/v.zoom/this._elementRect.height}else return;this.verticalDragToForward?(w?this.setFocalOffset(this._focalOffsetEnd.x+x,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(x,0,!0),this.forward(-C,!0)):w?this.setFocalOffset(this._focalOffsetEnd.x+x,this._focalOffsetEnd.y+C,this._focalOffsetEnd.z,!0):this.truck(x,C,!0)},this._rotateInternal=(h,m)=>{const w=Lt*this.azimuthRotateSpeed*h/this._elementRect.height,x=Lt*this.polarRotateSpeed*m/this._elementRect.height;this.rotate(w,x,!0)},this._dollyInternal=(h,m,w)=>{const x=Math.pow(.95,-h*this.dollySpeed),C=this._sphericalEnd.radius,v=this._sphericalEnd.radius*x,b=nt(v,this.minDistance,this.maxDistance),D=b-v;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(v,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(D,!0),this._dollyToNoClamp(b,!0)):this._dollyToNoClamp(b,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?v:b)-C,this._dollyControlCoord.set(m,w)),this._lastDollyDirection=Math.sign(-h)},this._zoomInternal=(h,m,w)=>{const x=Math.pow(.95,h*this.dollySpeed),C=this._zoom,v=this._zoom*x;this.zoomTo(v,!0),this.dollyToCursor&&(this._changedZoom+=v-C,this._dollyControlCoord.set(m,w))},typeof z>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new z.Quaternion().setFromUnitVectors(this._camera.up,ge),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=A.NONE,this._target=new z.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new z.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new z.Spherical().setFromVector3(F.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new z.Vector3,new z.Vector3,new z.Vector3,new z.Vector3],this._updateNearPlaneCorners(),this._boundary=new z.Box3(new z.Vector3(-1/0,-1/0,-1/0),new z.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new z.Vector2,this.mouseButtons={left:A.ROTATE,middle:A.DOLLY,right:A.TRUCK,wheel:gt(this._camera)?A.DOLLY:pt(this._camera)?A.ZOOM:A.NONE},this.touches={one:A.TOUCH_ROTATE,two:gt(this._camera)?A.TOUCH_DOLLY_TRUCK:pt(this._camera)?A.TOUCH_ZOOM_TRUCK:A.NONE,three:A.TOUCH_TRUCK};const s=new z.Vector2,i=new z.Vector2,r=new z.Vector2,o=h=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const x=this._domElement.getBoundingClientRect(),C=h.clientX/x.width,v=h.clientY/x.height;if(Cthis._interactiveArea.right||vthis._interactiveArea.bottom)return}const m=h.pointerType!=="mouse"?null:(h.buttons&B.LEFT)===B.LEFT?B.LEFT:(h.buttons&B.MIDDLE)===B.MIDDLE?B.MIDDLE:(h.buttons&B.RIGHT)===B.RIGHT?B.RIGHT:null;if(m!==null){const x=this._findPointerByMouseButton(m);x&&this._disposePointer(x)}if((h.buttons&B.LEFT)===B.LEFT&&this._lockedPointer)return;const w={pointerId:h.pointerId,clientX:h.clientX,clientY:h.clientY,deltaX:0,deltaY:0,mouseButton:m};this._activePointers.push(w),this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.addEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),this._isDragging=!0,O(h)},a=h=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const x=this._domElement.getBoundingClientRect(),C=h.clientX/x.width,v=h.clientY/x.height;if(Cthis._interactiveArea.right||vthis._interactiveArea.bottom)return}const m=(h.buttons&B.LEFT)===B.LEFT?B.LEFT:(h.buttons&B.MIDDLE)===B.MIDDLE?B.MIDDLE:(h.buttons&B.RIGHT)===B.RIGHT?B.RIGHT:null;if(m!==null){const x=this._findPointerByMouseButton(m);x&&this._disposePointer(x)}const w={pointerId:1,clientX:h.clientX,clientY:h.clientY,deltaX:0,deltaY:0,mouseButton:(h.buttons&B.LEFT)===B.LEFT?B.LEFT:(h.buttons&B.MIDDLE)===B.LEFT?B.MIDDLE:(h.buttons&B.RIGHT)===B.LEFT?B.RIGHT:null};this._activePointers.push(w),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("mouseup",u),this._domElement.ownerDocument.addEventListener("mousemove",f),this._domElement.ownerDocument.addEventListener("mouseup",u),this._isDragging=!0,O(h)},c=h=>{h.cancelable&&h.preventDefault();const m=h.pointerId,w=this._lockedPointer||this._findPointerById(m);if(w){if(w.clientX=h.clientX,w.clientY=h.clientY,w.deltaX=h.movementX,w.deltaY=h.movementY,this._state=0,h.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(h.buttons&B.LEFT)===B.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(h.buttons&B.MIDDLE)===B.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(h.buttons&B.RIGHT)===B.RIGHT&&(this._state=this._state|this.mouseButtons.right);T()}},f=h=>{const m=this._lockedPointer||this._findPointerById(1);m&&(m.clientX=h.clientX,m.clientY=h.clientY,m.deltaX=h.movementX,m.deltaY=h.movementY,this._state=0,(this._lockedPointer||(h.buttons&B.LEFT)===B.LEFT)&&(this._state=this._state|this.mouseButtons.left),(h.buttons&B.MIDDLE)===B.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(h.buttons&B.RIGHT)===B.RIGHT&&(this._state=this._state|this.mouseButtons.right),T())},d=h=>{const m=this._findPointerById(h.pointerId);if(!(m&&m===this._lockedPointer)){if(m&&this._disposePointer(m),h.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=A.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=A.NONE;_()}},u=()=>{const h=this._findPointerById(1);h&&h===this._lockedPointer||(h&&this._disposePointer(h),this._state=A.NONE,_())};let l=-1;const p=h=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===A.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const v=this._domElement.getBoundingClientRect(),b=h.clientX/v.width,D=h.clientY/v.height;if(bthis._interactiveArea.right||Dthis._interactiveArea.bottom)return}if(h.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===A.ROTATE||this.mouseButtons.wheel===A.TRUCK){const v=performance.now();l-v<1e3&&this._getClientRect(this._elementRect),l=v}const m=Cn?-1:-3,w=h.deltaMode===1?h.deltaY/m:h.deltaY/(m*10),x=this.dollyToCursor?(h.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,C=this.dollyToCursor?(h.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case A.ROTATE:{this._rotateInternal(h.deltaX,h.deltaY),this._isUserControllingRotate=!0;break}case A.TRUCK:{this._truckInternal(h.deltaX,h.deltaY,!1),this._isUserControllingTruck=!0;break}case A.OFFSET:{this._truckInternal(h.deltaX,h.deltaY,!0),this._isUserControllingOffset=!0;break}case A.DOLLY:{this._dollyInternal(-w,x,C),this._isUserControllingDolly=!0;break}case A.ZOOM:{this._zoomInternal(-w,x,C),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},y=h=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===te.ACTION.NONE){const m=h instanceof PointerEvent?h.pointerId:(h instanceof MouseEvent,0),w=this._findPointerById(m);w&&this._disposePointer(w),this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("mouseup",u);return}h.preventDefault()}},O=h=>{if(!this._enabled)return;if(Ve(this._activePointers,$),this._getClientRect(this._elementRect),s.copy($),i.copy($),this._activePointers.length>=2){const w=$.x-this._activePointers[1].clientX,x=$.y-this._activePointers[1].clientY,C=Math.sqrt(w*w+x*x);r.set(0,C);const v=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,b=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(v,b)}if(this._state=0,!h)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in h&&h.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(h.buttons&B.LEFT)===B.LEFT&&(this._state=this._state|this.mouseButtons.left),(h.buttons&B.MIDDLE)===B.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(h.buttons&B.RIGHT)===B.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&A.ROTATE)===A.ROTATE||(this._state&A.TOUCH_ROTATE)===A.TOUCH_ROTATE||(this._state&A.TOUCH_DOLLY_ROTATE)===A.TOUCH_DOLLY_ROTATE||(this._state&A.TOUCH_ZOOM_ROTATE)===A.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&A.TRUCK)===A.TRUCK||(this._state&A.TOUCH_TRUCK)===A.TOUCH_TRUCK||(this._state&A.TOUCH_DOLLY_TRUCK)===A.TOUCH_DOLLY_TRUCK||(this._state&A.TOUCH_ZOOM_TRUCK)===A.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&A.DOLLY)===A.DOLLY||(this._state&A.TOUCH_DOLLY)===A.TOUCH_DOLLY||(this._state&A.TOUCH_DOLLY_TRUCK)===A.TOUCH_DOLLY_TRUCK||(this._state&A.TOUCH_DOLLY_OFFSET)===A.TOUCH_DOLLY_OFFSET||(this._state&A.TOUCH_DOLLY_ROTATE)===A.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&A.ZOOM)===A.ZOOM||(this._state&A.TOUCH_ZOOM)===A.TOUCH_ZOOM||(this._state&A.TOUCH_ZOOM_TRUCK)===A.TOUCH_ZOOM_TRUCK||(this._state&A.TOUCH_ZOOM_OFFSET)===A.TOUCH_ZOOM_OFFSET||(this._state&A.TOUCH_ZOOM_ROTATE)===A.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&A.OFFSET)===A.OFFSET||(this._state&A.TOUCH_OFFSET)===A.TOUCH_OFFSET||(this._state&A.TOUCH_DOLLY_OFFSET)===A.TOUCH_DOLLY_OFFSET||(this._state&A.TOUCH_ZOOM_OFFSET)===A.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},T=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Ve(this._activePointers,$);const m=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,w=m?-m.deltaX:i.x-$.x,x=m?-m.deltaY:i.y-$.y;if(i.copy($),((this._state&A.ROTATE)===A.ROTATE||(this._state&A.TOUCH_ROTATE)===A.TOUCH_ROTATE||(this._state&A.TOUCH_DOLLY_ROTATE)===A.TOUCH_DOLLY_ROTATE||(this._state&A.TOUCH_ZOOM_ROTATE)===A.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(w,x),this._isUserControllingRotate=!0),(this._state&A.DOLLY)===A.DOLLY||(this._state&A.ZOOM)===A.ZOOM){const C=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,v=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0,b=this.dollyDragInverted?-1:1;(this._state&A.DOLLY)===A.DOLLY?(this._dollyInternal(b*x*ye,C,v),this._isUserControllingDolly=!0):(this._zoomInternal(b*x*ye,C,v),this._isUserControllingZoom=!0)}if((this._state&A.TOUCH_DOLLY)===A.TOUCH_DOLLY||(this._state&A.TOUCH_ZOOM)===A.TOUCH_ZOOM||(this._state&A.TOUCH_DOLLY_TRUCK)===A.TOUCH_DOLLY_TRUCK||(this._state&A.TOUCH_ZOOM_TRUCK)===A.TOUCH_ZOOM_TRUCK||(this._state&A.TOUCH_DOLLY_OFFSET)===A.TOUCH_DOLLY_OFFSET||(this._state&A.TOUCH_ZOOM_OFFSET)===A.TOUCH_ZOOM_OFFSET||(this._state&A.TOUCH_DOLLY_ROTATE)===A.TOUCH_DOLLY_ROTATE||(this._state&A.TOUCH_ZOOM_ROTATE)===A.TOUCH_ZOOM_ROTATE){const C=$.x-this._activePointers[1].clientX,v=$.y-this._activePointers[1].clientY,b=Math.sqrt(C*C+v*v),D=r.y-b;r.set(0,b);const P=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,L=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&A.TOUCH_DOLLY)===A.TOUCH_DOLLY||(this._state&A.TOUCH_DOLLY_ROTATE)===A.TOUCH_DOLLY_ROTATE||(this._state&A.TOUCH_DOLLY_TRUCK)===A.TOUCH_DOLLY_TRUCK||(this._state&A.TOUCH_DOLLY_OFFSET)===A.TOUCH_DOLLY_OFFSET?(this._dollyInternal(D*ye,P,L),this._isUserControllingDolly=!0):(this._zoomInternal(D*ye,P,L),this._isUserControllingZoom=!0)}((this._state&A.TRUCK)===A.TRUCK||(this._state&A.TOUCH_TRUCK)===A.TOUCH_TRUCK||(this._state&A.TOUCH_DOLLY_TRUCK)===A.TOUCH_DOLLY_TRUCK||(this._state&A.TOUCH_ZOOM_TRUCK)===A.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(w,x,!1),this._isUserControllingTruck=!0),((this._state&A.OFFSET)===A.OFFSET||(this._state&A.TOUCH_OFFSET)===A.TOUCH_OFFSET||(this._state&A.TOUCH_DOLLY_OFFSET)===A.TOUCH_DOLLY_OFFSET||(this._state&A.TOUCH_ZOOM_OFFSET)===A.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(w,x,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},_=()=>{Ve(this._activePointers,$),i.copy($),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",u),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",g),this._domElement.ownerDocument.addEventListener("pointerlockerror",E),this._domElement.ownerDocument.addEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),O())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",g),this._domElement.ownerDocument.removeEventListener("pointerlockerror",E))};const g=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},E=()=>{this.unlockPointer()};this._addAllEventListeners=h=>{this._domElement=h,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),vn&&this._domElement.addEventListener("mousedown",a),this._domElement.addEventListener("pointercancel",d),this._domElement.addEventListener("wheel",p,{passive:!1}),this._domElement.addEventListener("contextmenu",y)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("mousedown",a),this._domElement.removeEventListener("pointercancel",d),this._domElement.removeEventListener("wheel",p,{passive:!1}),this._domElement.removeEventListener("contextmenu",y),this._domElement.ownerDocument.removeEventListener("pointermove",c,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",u),this._domElement.ownerDocument.removeEventListener("pointerlockchange",g),this._domElement.ownerDocument.removeEventListener("pointerlockerror",E))},this.cancel=()=>{this._state!==A.NONE&&(this._state=A.NONE,this._activePointers.length=0,_())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=nt(e.width,0,1),this._interactiveArea.height=nt(e.height,0,1),this._interactiveArea.x=nt(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=nt(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,s=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,s)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,s=!1){this._isUserControllingRotate=!1;const i=nt(e,this.minAzimuthAngle,this.maxAzimuthAngle),r=nt(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=r,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,s||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!s||H(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&H(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Dt.NONE,this._changedDolly=0,this._dollyToNoClamp(nt(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const s=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const o=this._collisionTest(),a=H(o,this._spherical.radius);if(!(s>e)&&a)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,o)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const r=!t||H(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(r)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection($t).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const s=!t||H(this._target.x,this._targetEnd.x,this.restThreshold)&&H(this._target.y,this._targetEnd.y,this.restThreshold)&&H(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=nt(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const s=!t||H(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(s)}pan(e,t,s=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,s)}truck(e,t,s=!1){this._camera.updateMatrix(),rt.setFromMatrixColumn(this._camera.matrix,0),at.setFromMatrixColumn(this._camera.matrix,1),rt.multiplyScalar(e),at.multiplyScalar(-t);const i=F.copy(rt).add(at),r=I.copy(this._targetEnd).add(i);return this.moveTo(r.x,r.y,r.z,s)}forward(e,t=!1){F.setFromMatrixColumn(this._camera.matrix,0),F.crossVectors(this._camera.up,F),F.multiplyScalar(e);const s=I.copy(this._targetEnd).add(F);return this.moveTo(s.x,s.y,s.z,t)}elevate(e,t=!1){return F.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+F.x,this._targetEnd.y+F.y,this._targetEnd.z+F.z,t)}moveTo(e,t,s,i=!1){this._isUserControllingTruck=!1;const r=F.set(e,t,s).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,r,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const o=!i||H(this._target.x,this._targetEnd.x,this.restThreshold)&&H(this._target.y,this._targetEnd.y,this.restThreshold)&&H(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,s,i=!1){const a=F.set(e,t,s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(a.x,a.y,a.z,i)}fitToBox(e,t,{cover:s=!1,paddingLeft:i=0,paddingRight:r=0,paddingBottom:o=0,paddingTop:a=0}={}){const c=[],f=e.isBox3?Mt.copy(e):Mt.setFromObject(e);f.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const d=Ds(this._sphericalEnd.theta,Us),u=Ds(this._sphericalEnd.phi,Us);c.push(this.rotateTo(d,u,t));const l=F.setFromSpherical(this._sphericalEnd).normalize(),p=Fs.setFromUnitVectors(l,Ne),y=H(Math.abs(l.y),1);y&&p.multiply(Xe.setFromAxisAngle(ge,d)),p.multiply(this._yAxisUpSpaceInverse);const O=Bs.makeEmpty();I.copy(f.min).applyQuaternion(p),O.expandByPoint(I),I.copy(f.min).setX(f.max.x).applyQuaternion(p),O.expandByPoint(I),I.copy(f.min).setY(f.max.y).applyQuaternion(p),O.expandByPoint(I),I.copy(f.max).setZ(f.min.z).applyQuaternion(p),O.expandByPoint(I),I.copy(f.min).setZ(f.max.z).applyQuaternion(p),O.expandByPoint(I),I.copy(f.max).setY(f.min.y).applyQuaternion(p),O.expandByPoint(I),I.copy(f.max).setX(f.min.x).applyQuaternion(p),O.expandByPoint(I),I.copy(f.max).applyQuaternion(p),O.expandByPoint(I),O.min.x-=i,O.min.y-=o,O.max.x+=r,O.max.y+=a,p.setFromUnitVectors(Ne,l),y&&p.premultiply(Xe.invert()),p.premultiply(this._yAxisUpSpace);const T=O.getSize(F),_=O.getCenter(I).applyQuaternion(p);if(gt(this._camera)){const g=this.getDistanceToFitBox(T.x,T.y,T.z,s);c.push(this.moveTo(_.x,_.y,_.z,t)),c.push(this.dollyTo(g,t)),c.push(this.setFocalOffset(0,0,0,t))}else if(pt(this._camera)){const g=this._camera,E=g.right-g.left,h=g.top-g.bottom,m=s?Math.max(E/T.x,h/T.y):Math.min(E/T.x,h/T.y);c.push(this.moveTo(_.x,_.y,_.z,t)),c.push(this.zoomTo(m,t)),c.push(this.setFocalOffset(0,0,0,t))}return Promise.all(c)}fitToSphere(e,t){const s=[],r=e instanceof z.Sphere?Ze.copy(e):te.createBoundingSphere(e,Ze);if(s.push(this.moveTo(r.center.x,r.center.y,r.center.z,t)),gt(this._camera)){const o=this.getDistanceToFitSphere(r.radius);s.push(this.dollyTo(o,t))}else if(pt(this._camera)){const o=this._camera.right-this._camera.left,a=this._camera.top-this._camera.bottom,c=2*r.radius,f=Math.min(o/c,a/c);s.push(this.zoomTo(f,t))}return s.push(this.setFocalOffset(0,0,0,t)),Promise.all(s)}setLookAt(e,t,s,i,r,o,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Dt.NONE,this._changedDolly=0;const c=I.set(i,r,o),f=F.set(e,t,s);this._targetEnd.copy(c),this._sphericalEnd.setFromVector3(f.sub(c).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const d=!a||H(this._target.x,this._targetEnd.x,this.restThreshold)&&H(this._target.y,this._targetEnd.y,this.restThreshold)&&H(this._target.z,this._targetEnd.z,this.restThreshold)&&H(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&H(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&H(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(d)}lerpLookAt(e,t,s,i,r,o,a,c,f,d,u,l,p,y=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Dt.NONE,this._changedDolly=0;const O=F.set(i,r,o),T=I.set(e,t,s);G.setFromVector3(T.sub(O).applyQuaternion(this._yAxisUpSpace));const _=St.set(d,u,l),g=I.set(a,c,f);Kt.setFromVector3(g.sub(_).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(O.lerp(_,p));const E=Kt.theta-G.theta,h=Kt.phi-G.phi,m=Kt.radius-G.radius;this._sphericalEnd.set(G.radius+m*p,G.phi+h*p,G.theta+E*p),this.normalizeRotations(),this._needsUpdate=!0,y||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const w=!y||H(this._target.x,this._targetEnd.x,this.restThreshold)&&H(this._target.y,this._targetEnd.y,this.restThreshold)&&H(this._target.z,this._targetEnd.z,this.restThreshold)&&H(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&H(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&H(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(w)}setPosition(e,t,s,i=!1){return this.setLookAt(e,t,s,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(e,t,s,i=!1){const r=this.getPosition(F),o=this.setLookAt(r.x,r.y,r.z,e,t,s,i);return this._sphericalEnd.phi=nt(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,s,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,s),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const r=!i||H(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&H(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&H(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}setOrbitPoint(e,t,s){this._camera.updateMatrixWorld(),rt.setFromMatrixColumn(this._camera.matrixWorldInverse,0),at.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Tt.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=F.set(e,t,s),r=i.distanceTo(this._camera.position),o=i.sub(this._camera.position);rt.multiplyScalar(o.x),at.multiplyScalar(o.y),Tt.multiplyScalar(o.z),F.copy(rt).add(at).add(Tt),F.z=F.z+r,this.dollyTo(r,!1),this.setFocalOffset(-F.x,F.y,-F.z,!1),this.moveTo(e,t,s,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,s,i){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new z.Vector4,typeof e=="number"?this._viewport.set(e,t,s,i):this._viewport.copy(e)}getDistanceToFitBox(e,t,s,i=!1){if(Ye(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const r=e/t,o=this._camera.getEffectiveFOV()*Xt,a=this._camera.aspect;return((i?r>a:rt.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,s){const i=t.lengthSq();if(i===0)return e;const r=I.copy(t).add(e),a=this._boundary.clampPoint(r,St).sub(r),c=a.lengthSq();if(c===0)return e.add(t);if(c===i)return e;if(s===0)return e.add(t).add(a);{const f=1+s*c/t.dot(a);return e.add(I.copy(t).multiplyScalar(f)).add(a.multiplyScalar(1-s))}}_updateNearPlaneCorners(){if(gt(this._camera)){const e=this._camera,t=e.near,s=e.getEffectiveFOV()*Xt,i=Math.tan(s*.5)*t,r=i*e.aspect;this._nearPlaneCorners[0].set(-r,-i,0),this._nearPlaneCorners[1].set(r,-i,0),this._nearPlaneCorners[2].set(r,i,0),this._nearPlaneCorners[3].set(-r,i,0)}else if(pt(this._camera)){const e=this._camera,t=1/e.zoom,s=e.left*t,i=e.right*t,r=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(s,r,0),this._nearPlaneCorners[1].set(i,r,0),this._nearPlaneCorners[2].set(i,o,0),this._nearPlaneCorners[3].set(s,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Ye(this._camera,"_collisionTest"))return e;const s=this._getTargetDirection($t);We.lookAt(Ss,s,this._camera.up);for(let i=0;i<4;i++){const r=I.copy(this._nearPlaneCorners[i]);r.applyMatrix4(We);const o=St.addVectors(this._target,r);Te.set(o,s),Te.far=this._spherical.radius+1;const a=Te.intersectObjects(this.colliderMeshes);a.length!==0&&a[0].distance{const s=()=>{this.removeEventListener("rest",s),t()};this.addEventListener("rest",s)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new z.Sphere){const s=t,i=s.center;Mt.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&Mt.expandByObject(o)}),Mt.getCenter(i);let r=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const a=o,c=a.geometry.clone();c.applyMatrix4(a.matrixWorld);const d=c.attributes.position;for(let u=0,l=d.count;u{var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof ii){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const s=this.currentWorld.renderer.getSize();this.three.aspect=s.width/s.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}});this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:s,world:i})=>{if(s==="added"){const r=this.newCameraControls();this._allControls.set(i.uuid,r)}if(s==="removed"){const r=this._allControls.get(i.uuid);r&&(r.dispose(),this._allControls.delete(i.uuid))}})}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const t=this._allControls.get(this.currentWorld.uuid);if(!t)throw new Error("Controls not found!");return t}get enabled(){return this.currentWorld===null?!1:this.controls.enabled}set enabled(t){this.controls.enabled=t}dispose(){this.setupEvents(!1),this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[t,s]of this._allControls)s.dispose()}update(t){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(t),this.onAfterUpdate.trigger(this))}setupCamera(){const t=window.innerWidth/window.innerHeight,s=new ni(60,t,1,1e3);return s.position.set(50,50,50),s.lookAt(new S(0,0,0)),s}newCameraControls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");if(!this.currentWorld.renderer)throw new Error("This camera needs a renderer to work!");te.install({THREE:Ae.getSubsetOfThree()});const{domElement:t}=this.currentWorld.renderer.three,s=new te(this.three,t);return s.smoothTime=.2,s.dollyToCursor=!0,s.infinityDolly=!0,s}setupEvents(t){t?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:oi,Vector2:ht,Vector3:S,Vector4:ri,Quaternion:ai,Matrix4:ut,Spherical:ci,Box3:st,Sphere:Vs,Raycaster:li,MathUtils:hi}}}const ve=class ve extends os{constructor(t){super(t);U(this,"onAfterUpdate",new Y);U(this,"onBeforeUpdate",new Y);U(this,"onDisposed",new Y);U(this,"onWorldCreated",new Y);U(this,"onWorldDeleted",new Y);U(this,"list",new Map);U(this,"enabled",!0);t.add(ve.uuid,this)}create(){const t=new xn(this.components),s=t.uuid;if(this.list.has(s))throw new Error("There is already a world with this name!");return this.list.set(s,t),this.onWorldCreated.trigger(t),t}delete(t){const s=t.uuid;this.list.delete(t.uuid),t.dispose(),this.onWorldDeleted.trigger(s)}dispose(){this.enabled=!1;for(const[t,s]of this.list)s.dispose();this.list.clear(),this.onDisposed.trigger()}update(t){if(this.enabled)for(const[s,i]of this.list)i.update(t)}};U(ve,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let Rs=ve;class bn{constructor(e,t,s){U(this,"onDisposed",new Y);U(this,"world");U(this,"components");U(this,"three");U(this,"_fade",3);U(this,"updateZoom",()=>{this.world.camera instanceof Ae&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)});this.world=t;const{color:i,size1:r,size2:o,distance:a}=s;this.components=e;const c=new ui(2,2,1,1),f=new di({side:Ys,uniforms:{uSize1:{value:r},uSize2:{value:o},uColor:{value:i},uDistance:{value:a},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:` varying vec3 worldPosition; @@ -68,4 +68,4 @@ var qs=Object.defineProperty;var $s=(n,e,t)=>e in n?qs(n,e,{enumerable:!0,config } - `,extensions:{derivatives:!0}});this.three=new Je(c,f),this.three.frustumCulled=!1,t.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(e){e?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(e){this._fade=e?3:0,this.material.uniforms.uFade.value=this._fade}[Symbol.dispose](){throw new Error("Method not implemented.")}dispose(){this.setupEvents(!1),this.components.get(Jt).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(e){if(this.world.isDisposing||!(this.world.camera instanceof Ae))return;const t=this.world.camera.controls;e?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}class vn extends ns{constructor(){super(...arguments);U(this,"list",new Map);U(this,"onDisposed",new Y);U(this,"config",{color:new Ee(12303291),size1:1,size2:10,distance:500});U(this,"enabled",!0)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a grid!");const s=new Cn(this.components,t,this.config);return this.list.set(t.uuid,s),t.onDisposed.add(()=>{this.delete(t)}),s}delete(t){const s=this.list.get(t.uuid);s&&s.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,s]of this.list)s.dispose();this.list.clear(),this.onDisposed.trigger()}}U(vn,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");export{ns as C,Jt as D,Y as E,vn as G,Un as S,Fs as W,bs as a,Dn as b,Ae as c}; + `,extensions:{derivatives:!0}});this.three=new ts(c,f),this.three.frustumCulled=!1,t.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(e){e?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(e){this._fade=e?3:0,this.material.uniforms.uFade.value=this._fade}[Symbol.dispose](){throw new Error("Method not implemented.")}dispose(){this.setupEvents(!1),this.components.get(Jt).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(e){if(this.world.isDisposing||!(this.world.camera instanceof Ae))return;const t=this.world.camera.controls;e?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}const be=class be extends os{constructor(t){super(t);U(this,"list",new Map);U(this,"onDisposed",new Y);U(this,"config",{color:new Ee(12303291),size1:1,size2:10,distance:500});U(this,"enabled",!0);t.add(be.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a grid!");const s=new bn(this.components,t,this.config);return this.list.set(t.uuid,s),t.onDisposed.add(()=>{this.delete(t)}),s}delete(t){const s=this.list.get(t.uuid);s&&s.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,s]of this.list)s.dispose();this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}};U(be,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");let Is=be;export{os as C,Jt as D,Y as E,Is as G,Dn as S,Rs as W,Ps as a,Ln as b,Ae as c}; diff --git a/examples/assets/index-b4ozRbQy.js b/examples/assets/index-C-JPXu_n.js similarity index 51% rename from examples/assets/index-b4ozRbQy.js rename to examples/assets/index-C-JPXu_n.js index 8ae23f1ca..93b4f9558 100644 --- a/examples/assets/index-b4ozRbQy.js +++ b/examples/assets/index-C-JPXu_n.js @@ -2,12 +2,12 @@ import{r as At,p as st,T as pe,z as Ti,E as go,a as X,V as O,f as Ft,P as fe,y a - If you're the tool creator, you can take one from https://www.uuidgenerator.net/. -- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};I(di,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),I(di,"_lut",["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]);let xi=di;class th extends q{constructor(t,e){super(t),I(this,"onVertexFound",new M),I(this,"onVertexLost",new M),I(this,"components"),I(this,"_pickedPoint",null),I(this,"_config"),I(this,"_enabled",!1),I(this,"_workingPlane",null),this.components=t,this.config={snapDistance:.25,showOnlyVertex:!1,...e},this.enabled=!1}set enabled(t){this._enabled=t,t||(this._pickedPoint=null)}get enabled(){return this._enabled}set workingPlane(t){this._workingPlane=t}get workingPlane(){return this._workingPlane}set config(t){this._config={...this._config,...t}}get config(){return this._config}dispose(){this.onVertexFound.reset(),this.onVertexLost.reset(),this.components=null}get(t){if(!this.enabled)return this._pickedPoint;const e=this.components.get(Ei).get(t).castRay();if(!e)return this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const s=this.getClosestVertex(e);return s?!this.workingPlane||Math.abs(this.workingPlane.distanceToPoint(s))<.001?((this._pickedPoint===null||!this._pickedPoint.equals(s))&&(this._pickedPoint=s.clone(),this.onVertexFound.trigger(this._pickedPoint)),this._pickedPoint):(this._pickedPoint=null,this._pickedPoint):(this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint)}getClosestVertex(t){let e=new O,s=!1,i=Number.MAX_SAFE_INTEGER;const n=this.getVertices(t);return n==null||n.forEach(o=>{if(!o)return;const r=t.point.distanceTo(o);r>i||r>this._config.snapDistance||(s=!0,e=o,i=t.point.distanceTo(o))}),s?e:this.config.showOnlyVertex?null:t.point}getVertices(t){const e=t.object;if(!t.face||!e)return null;const s=e.geometry;return[this.getVertex(t.face.a,s),this.getVertex(t.face.b,s),this.getVertex(t.face.c,s)].map(i=>i==null?void 0:i.applyMatrix4(e.matrixWorld))}getVertex(t,e){if(t===void 0)return null;const s=e.attributes.position;return new O(s.getX(t),s.getY(t),s.getZ(t))}}const Gn=class Vn{constructor(){I(this,"onDisposed",new M),I(this,"list",new Map),I(this,"enabled",!1),I(this,"_clock"),I(this,"update",()=>{if(!this.enabled)return;const t=this._clock.getDelta();for(const[e,s]of this.list)s.enabled&&s.isUpdateable()&&s.update(t);requestAnimationFrame(this.update)}),this._clock=new Lo,Vn.setupBVH()}add(t,e){if(this.list.has(t))throw new Error("You're trying to add a component that already exists in the components intance. Use Components.get() instead.");xi.validate(t),this.list.set(t,e)}get(t){const e=t.uuid;if(!this.list.has(e)){const s=new t(this);return this.list.has(e)||this.add(e,s),s}return this.list.get(e)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[t,e]of this.list)e.enabled=!1,e.isDisposeable()&&e.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){ze.prototype.computeBoundsTree=$r,ze.prototype.disposeBoundsTree=Jr,D.prototype.raycast=Kr}};I(Gn,"release","1.4.21");let Ia=Gn;class ua{constructor(t){I(this,"_event"),I(this,"_position",new Ft),I(this,"onDisposed",new M),I(this,"updateMouseInfo",e=>{this._event=e}),this.dom=t,this.setupEvents(!0)}get position(){if(this._event){const t=this.dom.getBoundingClientRect();this._position.x=this.getPositionX(t,this._event),this._position.y=this.getPositionY(t,this._event)}return this._position}dispose(){this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset()}getPositionY(t,e){return-((e.clientY-t.top)/(t.bottom-t.top))*2+1}getPositionX(t,e){return(e.clientX-t.left)/(t.right-t.left)*2-1}setupEvents(t){t?this.dom.addEventListener("mousemove",this.updateMouseInfo):this.dom.removeEventListener("mousemove",this.updateMouseInfo)}}class pa{constructor(t,e){I(this,"enabled",!0),I(this,"components"),I(this,"onDisposed",new M),I(this,"mouse"),I(this,"three",new Ti),I(this,"world");const s=e.renderer;if(!s)throw new Error("A renderer is needed for the raycaster to work!");this.world=e,this.mouse=new ua(s.three.domElement),this.components=t}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(t=Array.from(this.world.meshes)){if(!this.world)throw new Error("A world is needed to cast rays!");const e=this.world.camera.three;return this.three.setFromCamera(this.mouse.position,e),this.intersect(t)}castRayFromVector(t,e,s=Array.from(this.world.meshes)){return this.three.set(t,e),this.intersect(s)}intersect(t=Array.from(this.world.meshes)){const e=this.three.intersectObjects(t),s=this.filterClippingPlanes(e);return s.length>0?s[0]:null}filterClippingPlanes(t){if(!this.world.renderer)throw new Error("Renderer not found!");const e=this.world.renderer.three;if(!e.clippingPlanes)return t;const s=e.clippingPlanes;return t.length<=0||!s||(s==null?void 0:s.length)<=0?t:t.filter(i=>s.every(n=>n.distanceToPoint(i.point)>0))}}const Hn=class kn extends q{constructor(t){super(t),I(this,"enabled",!0),I(this,"list",new Map),I(this,"onDisposed",new M),t.add(kn.uuid,this)}get(t){if(this.list.has(t.uuid))return this.list.get(t.uuid);const e=new pa(this.components,t);return this.list.set(t.uuid,e),t.onDisposed.add(()=>{this.delete(t)}),e}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}};I(Hn,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let Ei=Hn;class Ca extends Ui{constructor(t){super(t),I(this,"meshes",new Set),I(this,"onAfterUpdate",new M),I(this,"onBeforeUpdate",new M),I(this,"enabled",!0),I(this,"uuid",xi.create()),I(this,"onDisposed",new M),I(this,"_scene"),I(this,"_camera"),I(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(t){this._scene=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(t){this._camera=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(t){this._renderer=t,t&&(t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"}))}update(t){this.enabled&&(!this._scene||!this._camera||(this.scene.currentWorld=this,this.camera.currentWorld=this,this.renderer&&(this.renderer.currentWorld=this),this.onBeforeUpdate.trigger(),this.scene.isUpdateable()&&this.scene.update(t),this.camera.isUpdateable()&&this.camera.update(t),this.renderer&&this.renderer.update(t),this.onAfterUpdate.trigger()))}dispose(t=!0){if(this.enabled=!1,this.scene.onWorldChanged.trigger({world:this,action:"removed"}),this.camera.onWorldChanged.trigger({world:this,action:"removed"}),this.renderer&&this.renderer.onWorldChanged.trigger({world:this,action:"removed"}),t){const e=this.components.get(me);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const s of this.meshes)e.destroy(s);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.onDisposed.trigger()}}class eh extends sa{constructor(t){super(t),I(this,"isSetup",!1),I(this,"three"),I(this,"onSetup",new M),I(this,"config",{directionalLight:{color:new qt("white"),intensity:1.5,position:new O(5,10,3)},ambientLight:{color:new qt("white"),intensity:1}}),this.three=new mi,this.three.background=new qt(2107698)}setup(t){this.config={...this.config,...t};const e=new Oo(this.config.directionalLight.color,this.config.directionalLight.intensity);e.position.copy(this.config.directionalLight.position);const s=new _o(this.config.ambientLight.color,this.config.ambientLight.intensity);this.three.add(e,s),this.isSetup=!0,this.onSetup.trigger(this)}}class sh extends ea{constructor(t,e,s){super(t),I(this,"enabled",!0),I(this,"container"),I(this,"three"),I(this,"_canvas"),I(this,"_parameters"),I(this,"_resizeObserver",null),I(this,"onContainerUpdated",new M),I(this,"_resizing",!1),I(this,"resize",o=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const r=o?o.x:this.container.clientWidth,a=o?o.y:this.container.clientHeight;this.three.setSize(r,a),this.onResize.trigger(new Ft(r,a)),this._resizing=!1}),I(this,"resizeEvent",()=>{this.resize()}),I(this,"onContextLost",o=>{o.preventDefault(),this.enabled=!1}),I(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new As({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0}),this.container=e,this._parameters=s,this.three=new As({antialias:!0,alpha:!0,...s}),this.three.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.setupRenderer(),this.setupEvents(!0),this.resize(),this._canvas=this.three.domElement;const i=this.three.getContext(),{canvas:n}=i;n.addEventListener("webglcontextlost",this.onContextLost,!1),n.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const t=this.currentWorld.scene.three,e=this.currentWorld.camera.three;this.three.render(t,e),this.onAfterUpdate.trigger(this)}dispose(){this.enabled=!1,this.setupEvents(!1),this.three.domElement.remove(),this.three.dispose(),this.onResize.reset(),this.onAfterUpdate.reset(),this.onBeforeUpdate.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}getSize(){return new Ft(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(t){const e=this.three.domElement.parentElement;if(!e)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),t&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(e),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}}/*! +- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};I(di,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),I(di,"_lut",["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]);let xi=di;class th extends q{constructor(t,e){super(t),I(this,"onVertexFound",new M),I(this,"onVertexLost",new M),I(this,"components"),I(this,"_pickedPoint",null),I(this,"_config"),I(this,"_enabled",!1),I(this,"_workingPlane",null),this.components=t,this.config={snapDistance:.25,showOnlyVertex:!1,...e},this.enabled=!1}set enabled(t){this._enabled=t,t||(this._pickedPoint=null)}get enabled(){return this._enabled}set workingPlane(t){this._workingPlane=t}get workingPlane(){return this._workingPlane}set config(t){this._config={...this._config,...t}}get config(){return this._config}dispose(){this.onVertexFound.reset(),this.onVertexLost.reset(),this.components=null}get(t){if(!this.enabled)return this._pickedPoint;const e=this.components.get(Ei).get(t).castRay();if(!e)return this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const s=this.getClosestVertex(e);return s?!this.workingPlane||Math.abs(this.workingPlane.distanceToPoint(s))<.001?((this._pickedPoint===null||!this._pickedPoint.equals(s))&&(this._pickedPoint=s.clone(),this.onVertexFound.trigger(this._pickedPoint)),this._pickedPoint):(this._pickedPoint=null,this._pickedPoint):(this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint)}getClosestVertex(t){let e=new O,s=!1,i=Number.MAX_SAFE_INTEGER;const n=this.getVertices(t);return n==null||n.forEach(o=>{if(!o)return;const r=t.point.distanceTo(o);r>i||r>this._config.snapDistance||(s=!0,e=o,i=t.point.distanceTo(o))}),s?e:this.config.showOnlyVertex?null:t.point}getVertices(t){const e=t.object;if(!t.face||!e)return null;const s=e.geometry;return[this.getVertex(t.face.a,s),this.getVertex(t.face.b,s),this.getVertex(t.face.c,s)].map(i=>i==null?void 0:i.applyMatrix4(e.matrixWorld))}getVertex(t,e){if(t===void 0)return null;const s=e.attributes.position;return new O(s.getX(t),s.getY(t),s.getZ(t))}}const Gn=class Vn{constructor(){I(this,"onDisposed",new M),I(this,"list",new Map),I(this,"enabled",!1),I(this,"_clock"),I(this,"update",()=>{if(!this.enabled)return;const t=this._clock.getDelta();for(const[e,s]of this.list)s.enabled&&s.isUpdateable()&&s.update(t);requestAnimationFrame(this.update)}),this._clock=new Lo,Vn.setupBVH()}add(t,e){if(this.list.has(t))throw new Error("You're trying to add a component that already exists in the components intance. Use Components.get() instead.");xi.validate(t),this.list.set(t,e)}get(t){const e=t.uuid;if(!this.list.has(e)){const s=new t(this);return this.list.has(e)||this.add(e,s),s}return this.list.get(e)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[t,e]of this.list)e.enabled=!1,e.isDisposeable()&&e.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){ze.prototype.computeBoundsTree=$r,ze.prototype.disposeBoundsTree=Jr,D.prototype.raycast=Kr}};I(Gn,"release","1.4.21");let Ia=Gn;class ua{constructor(t){I(this,"_event"),I(this,"_position",new Ft),I(this,"onDisposed",new M),I(this,"updateMouseInfo",e=>{this._event=e}),this.dom=t,this.setupEvents(!0)}get position(){if(this._event){const t=this.dom.getBoundingClientRect();this._position.x=this.getPositionX(t,this._event),this._position.y=this.getPositionY(t,this._event)}return this._position}dispose(){this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset()}getPositionY(t,e){return-((e.clientY-t.top)/(t.bottom-t.top))*2+1}getPositionX(t,e){return(e.clientX-t.left)/(t.right-t.left)*2-1}setupEvents(t){t?this.dom.addEventListener("mousemove",this.updateMouseInfo):this.dom.removeEventListener("mousemove",this.updateMouseInfo)}}class pa{constructor(t,e){I(this,"enabled",!0),I(this,"components"),I(this,"onDisposed",new M),I(this,"mouse"),I(this,"three",new Ti),I(this,"world");const s=e.renderer;if(!s)throw new Error("A renderer is needed for the raycaster to work!");this.world=e,this.mouse=new ua(s.three.domElement),this.components=t}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(t=Array.from(this.world.meshes)){if(!this.world)throw new Error("A world is needed to cast rays!");const e=this.world.camera.three;return this.three.setFromCamera(this.mouse.position,e),this.intersect(t)}castRayFromVector(t,e,s=Array.from(this.world.meshes)){return this.three.set(t,e),this.intersect(s)}intersect(t=Array.from(this.world.meshes)){const e=this.three.intersectObjects(t),s=this.filterClippingPlanes(e);return s.length>0?s[0]:null}filterClippingPlanes(t){if(!this.world.renderer)throw new Error("Renderer not found!");const e=this.world.renderer.three;if(!e.clippingPlanes)return t;const s=e.clippingPlanes;return t.length<=0||!s||(s==null?void 0:s.length)<=0?t:t.filter(i=>s.every(n=>n.distanceToPoint(i.point)>0))}}const Hn=class kn extends q{constructor(t){super(t),I(this,"enabled",!0),I(this,"list",new Map),I(this,"onDisposed",new M),t.add(kn.uuid,this)}get(t){if(this.list.has(t.uuid))return this.list.get(t.uuid);const e=new pa(this.components,t);return this.list.set(t.uuid,e),t.onDisposed.add(()=>{this.delete(t)}),e}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}};I(Hn,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let Ei=Hn;class Ca extends Ui{constructor(t){super(t),I(this,"meshes",new Set),I(this,"onAfterUpdate",new M),I(this,"onBeforeUpdate",new M),I(this,"isDisposing",!1),I(this,"enabled",!0),I(this,"uuid",xi.create()),I(this,"name"),I(this,"onDisposed",new M),I(this,"_scene"),I(this,"_camera"),I(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(t){this._scene=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(t){this._camera=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(t){this._renderer=t,t&&(t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"}))}update(t){this.enabled&&(!this._scene||!this._camera||(this.scene.currentWorld=this,this.camera.currentWorld=this,this.renderer&&(this.renderer.currentWorld=this),this.onBeforeUpdate.trigger(),this.scene.isUpdateable()&&this.scene.update(t),this.camera.isUpdateable()&&this.camera.update(t),this.renderer&&this.renderer.update(t),this.onAfterUpdate.trigger()))}dispose(t=!0){if(this.enabled=!1,this.isDisposing=!0,this.scene.onWorldChanged.trigger({world:this,action:"removed"}),this.camera.onWorldChanged.trigger({world:this,action:"removed"}),this.renderer&&this.renderer.onWorldChanged.trigger({world:this,action:"removed"}),t){const e=this.components.get(me);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const s of this.meshes)e.destroy(s);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.onDisposed.trigger()}}class eh extends sa{constructor(t){super(t),I(this,"isSetup",!1),I(this,"three"),I(this,"onSetup",new M),I(this,"config",{directionalLight:{color:new qt("white"),intensity:1.5,position:new O(5,10,3)},ambientLight:{color:new qt("white"),intensity:1}}),this.three=new mi,this.three.background=new qt(2107698)}setup(t){this.config={...this.config,...t};const e=new Oo(this.config.directionalLight.color,this.config.directionalLight.intensity);e.position.copy(this.config.directionalLight.position);const s=new _o(this.config.ambientLight.color,this.config.ambientLight.intensity);this.three.add(e,s),this.isSetup=!0,this.onSetup.trigger(this)}}class sh extends ea{constructor(t,e,s){super(t),I(this,"enabled",!0),I(this,"container"),I(this,"three"),I(this,"_canvas"),I(this,"_parameters"),I(this,"_resizeObserver",null),I(this,"onContainerUpdated",new M),I(this,"_resizing",!1),I(this,"resize",o=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const r=o?o.x:this.container.clientWidth,a=o?o.y:this.container.clientHeight;this.three.setSize(r,a),this.onResize.trigger(new Ft(r,a)),this._resizing=!1}),I(this,"resizeEvent",()=>{this.resize()}),I(this,"onContextLost",o=>{o.preventDefault(),this.enabled=!1}),I(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new As({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0}),this.container=e,this._parameters=s,this.three=new As({antialias:!0,alpha:!0,...s}),this.three.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.setupRenderer(),this.setupEvents(!0),this.resize(),this._canvas=this.three.domElement;const i=this.three.getContext(),{canvas:n}=i;n.addEventListener("webglcontextlost",this.onContextLost,!1),n.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const t=this.currentWorld.scene.three,e=this.currentWorld.camera.three;this.three.render(t,e),this.onAfterUpdate.trigger(this)}dispose(){this.enabled=!1,this.setupEvents(!1),this.three.domElement.remove(),this.three.dispose(),this.onResize.reset(),this.onAfterUpdate.reset(),this.onBeforeUpdate.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}getSize(){return new Ft(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(t){const e=this.three.domElement.parentElement;if(!e)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),t&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(e),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}}/*! * camera-controls * https://github.com/yomotsu/camera-controls * (c) 2017 @yomotsu * Released under the MIT License. - */const v={LEFT:1,RIGHT:2,MIDDLE:4},N=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),le={NONE:0,IN:1,OUT:-1};function Wt(h){return h.isPerspectiveCamera}function bt(h){return h.isOrthographicCamera}const de=Math.PI*2,pn=Math.PI/2,Wn=1e-5,Le=Math.PI/180;function Tt(h,t,e){return Math.max(t,Math.min(e,h))}function W(h,t=Wn){return Math.abs(h)0==u>d&&(u=d,e.value=(u-d)/n),u}function Tn(h,t,e,s,i=1/0,n,o){s=Math.max(1e-4,s);const r=2/s,a=r*n,c=1/(1+a+.48*a*a+.235*a*a*a);let d=t.x,E=t.y,l=t.z,u=h.x-d,T=h.y-E,C=h.z-l;const f=d,m=E,R=l,F=i*s,p=F*F,A=u*u+T*T+C*C;if(A>p){const Y=Math.sqrt(A);u=u/Y*F,T=T/Y*F,C=C/Y*F}d=h.x-u,E=h.y-T,l=h.z-C;const g=(e.x+r*u)*n,_=(e.y+r*T)*n,S=(e.z+r*C)*n;e.x=(e.x-r*g)*c,e.y=(e.y-r*_)*c,e.z=(e.z-r*S)*c,o.x=d+(u+g)*c,o.y=E+(T+_)*c,o.z=l+(C+S)*c;const w=f-h.x,y=m-h.y,L=R-h.z,P=o.x-f,U=o.y-m,x=o.z-R;return w*P+y*U+L*x>0&&(o.x=f,o.y=m,o.z=R,e.x=(o.x-f)/n,e.y=(o.y-m)/n,e.z=(o.z-R)/n),o}function Xs(h,t){t.set(0,0),h.forEach(e=>{t.x+=e.clientX,t.y+=e.clientY}),t.x/=h.length,t.y/=h.length}function Zs(h,t){return bt(h)?(console.warn(`${t} is not supported in OrthographicCamera`),!0):!1}class Ta{constructor(){this._listeners={}}addEventListener(t,e){const s=this._listeners;s[t]===void 0&&(s[t]=[]),s[t].indexOf(e)===-1&&s[t].push(e)}hasEventListener(t,e){const s=this._listeners;return s[t]!==void 0&&s[t].indexOf(e)!==-1}removeEventListener(t,e){const s=this._listeners[t];if(s!==void 0){const i=s.indexOf(e);i!==-1&&s.splice(i,1)}}removeAllEventListeners(t){if(!t){this._listeners={};return}Array.isArray(this._listeners[t])&&(this._listeners[t].length=0)}dispatchEvent(t){const e=this._listeners[t.type];if(e!==void 0){t.target=this;const s=e.slice(0);for(let i=0,n=s.length;i{},this._enabled=!0,this._state=N.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=le.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new b.Vector3,this._focalOffsetVelocity=new b.Vector3,this._zoomVelocity={value:0},this._truckInternal=(p,A,g)=>{let _,S;if(Wt(this._camera)){const w=B.copy(this._camera.position).sub(this._target),y=this._camera.getEffectiveFOV()*Le,L=w.length()*Math.tan(y*.5);_=this.truckSpeed*p*L/this._elementRect.height,S=this.truckSpeed*A*L/this._elementRect.height}else if(bt(this._camera)){const w=this._camera;_=p*(w.right-w.left)/w.zoom/this._elementRect.width,S=A*(w.top-w.bottom)/w.zoom/this._elementRect.height}else return;this.verticalDragToForward?(g?this.setFocalOffset(this._focalOffsetEnd.x+_,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(_,0,!0),this.forward(-S,!0)):g?this.setFocalOffset(this._focalOffsetEnd.x+_,this._focalOffsetEnd.y+S,this._focalOffsetEnd.z,!0):this.truck(_,S,!0)},this._rotateInternal=(p,A)=>{const g=de*this.azimuthRotateSpeed*p/this._elementRect.height,_=de*this.polarRotateSpeed*A/this._elementRect.height;this.rotate(g,_,!0)},this._dollyInternal=(p,A,g)=>{const _=Math.pow(.95,-p*this.dollySpeed),S=this._sphericalEnd.radius,w=this._sphericalEnd.radius*_,y=Tt(w,this.minDistance,this.maxDistance),L=y-w;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(w,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(L,!0),this._dollyToNoClamp(y,!0)):this._dollyToNoClamp(y,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?w:y)-S,this._dollyControlCoord.set(A,g)),this._lastDollyDirection=Math.sign(-p)},this._zoomInternal=(p,A,g)=>{const _=Math.pow(.95,p*this.dollySpeed),S=this._zoom,w=this._zoom*_;this.zoomTo(w,!0),this.dollyToCursor&&(this._changedZoom+=w-S,this._dollyControlCoord.set(A,g))},typeof b>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=t,this._yAxisUpSpace=new b.Quaternion().setFromUnitVectors(this._camera.up,Is),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=N.NONE,this._target=new b.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new b.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new b.Spherical().setFromVector3(B.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new b.Vector3,new b.Vector3,new b.Vector3,new b.Vector3],this._updateNearPlaneCorners(),this._boundary=new b.Box3(new b.Vector3(-1/0,-1/0,-1/0),new b.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new b.Vector2,this.mouseButtons={left:N.ROTATE,middle:N.DOLLY,right:N.TRUCK,wheel:Wt(this._camera)?N.DOLLY:bt(this._camera)?N.ZOOM:N.NONE},this.touches={one:N.TOUCH_ROTATE,two:Wt(this._camera)?N.TOUCH_DOLLY_TRUCK:bt(this._camera)?N.TOUCH_ZOOM_TRUCK:N.NONE,three:N.TOUCH_TRUCK};const s=new b.Vector2,i=new b.Vector2,n=new b.Vector2,o=p=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const _=this._domElement.getBoundingClientRect(),S=p.clientX/_.width,w=p.clientY/_.height;if(Sthis._interactiveArea.right||wthis._interactiveArea.bottom)return}const A=p.pointerType!=="mouse"?null:(p.buttons&v.LEFT)===v.LEFT?v.LEFT:(p.buttons&v.MIDDLE)===v.MIDDLE?v.MIDDLE:(p.buttons&v.RIGHT)===v.RIGHT?v.RIGHT:null;if(A!==null){const _=this._findPointerByMouseButton(A);_&&this._disposePointer(_)}if((p.buttons&v.LEFT)===v.LEFT&&this._lockedPointer)return;const g={pointerId:p.pointerId,clientX:p.clientX,clientY:p.clientY,deltaX:0,deltaY:0,mouseButton:A};this._activePointers.push(g),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),this._isDragging=!0,C(p)},r=p=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const _=this._domElement.getBoundingClientRect(),S=p.clientX/_.width,w=p.clientY/_.height;if(Sthis._interactiveArea.right||wthis._interactiveArea.bottom)return}const A=(p.buttons&v.LEFT)===v.LEFT?v.LEFT:(p.buttons&v.MIDDLE)===v.MIDDLE?v.MIDDLE:(p.buttons&v.RIGHT)===v.RIGHT?v.RIGHT:null;if(A!==null){const _=this._findPointerByMouseButton(A);_&&this._disposePointer(_)}const g={pointerId:1,clientX:p.clientX,clientY:p.clientY,deltaX:0,deltaY:0,mouseButton:(p.buttons&v.LEFT)===v.LEFT?v.LEFT:(p.buttons&v.MIDDLE)===v.LEFT?v.MIDDLE:(p.buttons&v.RIGHT)===v.LEFT?v.RIGHT:null};this._activePointers.push(g),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",E),this._domElement.ownerDocument.addEventListener("mousemove",c),this._domElement.ownerDocument.addEventListener("mouseup",E),this._isDragging=!0,C(p)},a=p=>{p.cancelable&&p.preventDefault();const A=p.pointerId,g=this._lockedPointer||this._findPointerById(A);if(g){if(g.clientX=p.clientX,g.clientY=p.clientY,g.deltaX=p.movementX,g.deltaY=p.movementY,this._state=0,p.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(p.buttons&v.LEFT)===v.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(p.buttons&v.MIDDLE)===v.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(p.buttons&v.RIGHT)===v.RIGHT&&(this._state=this._state|this.mouseButtons.right);f()}},c=p=>{const A=this._lockedPointer||this._findPointerById(1);A&&(A.clientX=p.clientX,A.clientY=p.clientY,A.deltaX=p.movementX,A.deltaY=p.movementY,this._state=0,(this._lockedPointer||(p.buttons&v.LEFT)===v.LEFT)&&(this._state=this._state|this.mouseButtons.left),(p.buttons&v.MIDDLE)===v.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(p.buttons&v.RIGHT)===v.RIGHT&&(this._state=this._state|this.mouseButtons.right),f())},d=p=>{const A=this._findPointerById(p.pointerId);if(!(A&&A===this._lockedPointer)){if(A&&this._disposePointer(A),p.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=N.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=N.NONE;m()}},E=()=>{const p=this._findPointerById(1);p&&p===this._lockedPointer||(p&&this._disposePointer(p),this._state=N.NONE,m())};let l=-1;const u=p=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===N.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const w=this._domElement.getBoundingClientRect(),y=p.clientX/w.width,L=p.clientY/w.height;if(ythis._interactiveArea.right||Lthis._interactiveArea.bottom)return}if(p.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===N.ROTATE||this.mouseButtons.wheel===N.TRUCK){const w=performance.now();l-w<1e3&&this._getClientRect(this._elementRect),l=w}const A=fa?-1:-3,g=p.deltaMode===1?p.deltaY/A:p.deltaY/(A*10),_=this.dollyToCursor?(p.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,S=this.dollyToCursor?(p.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case N.ROTATE:{this._rotateInternal(p.deltaX,p.deltaY),this._isUserControllingRotate=!0;break}case N.TRUCK:{this._truckInternal(p.deltaX,p.deltaY,!1),this._isUserControllingTruck=!0;break}case N.OFFSET:{this._truckInternal(p.deltaX,p.deltaY,!0),this._isUserControllingOffset=!0;break}case N.DOLLY:{this._dollyInternal(-g,_,S),this._isUserControllingDolly=!0;break}case N.ZOOM:{this._zoomInternal(-g,_,S),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},T=p=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===ot.ACTION.NONE){const A=p instanceof PointerEvent?p.pointerId:0,g=this._findPointerById(A);g&&this._disposePointer(g),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",E);return}p.preventDefault()}},C=p=>{if(this._enabled){if(Xs(this._activePointers,ht),this._getClientRect(this._elementRect),s.copy(ht),i.copy(ht),this._activePointers.length>=2){const A=ht.x-this._activePointers[1].clientX,g=ht.y-this._activePointers[1].clientY,_=Math.sqrt(A*A+g*g);n.set(0,_);const S=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,w=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(S,w)}if(this._state=0,!p)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in p&&p.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(p.buttons&v.LEFT)===v.LEFT&&(this._state=this._state|this.mouseButtons.left),(p.buttons&v.MIDDLE)===v.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(p.buttons&v.RIGHT)===v.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&N.ROTATE)===N.ROTATE||(this._state&N.TOUCH_ROTATE)===N.TOUCH_ROTATE||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE||(this._state&N.TOUCH_ZOOM_ROTATE)===N.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&N.TRUCK)===N.TRUCK||(this._state&N.TOUCH_TRUCK)===N.TOUCH_TRUCK||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_ZOOM_TRUCK)===N.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&N.DOLLY)===N.DOLLY||(this._state&N.TOUCH_DOLLY)===N.TOUCH_DOLLY||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&N.ZOOM)===N.ZOOM||(this._state&N.TOUCH_ZOOM)===N.TOUCH_ZOOM||(this._state&N.TOUCH_ZOOM_TRUCK)===N.TOUCH_ZOOM_TRUCK||(this._state&N.TOUCH_ZOOM_OFFSET)===N.TOUCH_ZOOM_OFFSET||(this._state&N.TOUCH_ZOOM_ROTATE)===N.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&N.OFFSET)===N.OFFSET||(this._state&N.TOUCH_OFFSET)===N.TOUCH_OFFSET||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET||(this._state&N.TOUCH_ZOOM_OFFSET)===N.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})}},f=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Xs(this._activePointers,ht);const p=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,A=p?-p.deltaX:i.x-ht.x,g=p?-p.deltaY:i.y-ht.y;if(i.copy(ht),((this._state&N.ROTATE)===N.ROTATE||(this._state&N.TOUCH_ROTATE)===N.TOUCH_ROTATE||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE||(this._state&N.TOUCH_ZOOM_ROTATE)===N.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(A,g),this._isUserControllingRotate=!0),(this._state&N.DOLLY)===N.DOLLY||(this._state&N.ZOOM)===N.ZOOM){const _=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,S=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0,w=this.dollyDragInverted?-1:1;(this._state&N.DOLLY)===N.DOLLY?(this._dollyInternal(w*g*Es,_,S),this._isUserControllingDolly=!0):(this._zoomInternal(w*g*Es,_,S),this._isUserControllingZoom=!0)}if((this._state&N.TOUCH_DOLLY)===N.TOUCH_DOLLY||(this._state&N.TOUCH_ZOOM)===N.TOUCH_ZOOM||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_ZOOM_TRUCK)===N.TOUCH_ZOOM_TRUCK||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET||(this._state&N.TOUCH_ZOOM_OFFSET)===N.TOUCH_ZOOM_OFFSET||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE||(this._state&N.TOUCH_ZOOM_ROTATE)===N.TOUCH_ZOOM_ROTATE){const _=ht.x-this._activePointers[1].clientX,S=ht.y-this._activePointers[1].clientY,w=Math.sqrt(_*_+S*S),y=n.y-w;n.set(0,w);const L=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,P=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&N.TOUCH_DOLLY)===N.TOUCH_DOLLY||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET?(this._dollyInternal(y*Es,L,P),this._isUserControllingDolly=!0):(this._zoomInternal(y*Es,L,P),this._isUserControllingZoom=!0)}((this._state&N.TRUCK)===N.TRUCK||(this._state&N.TOUCH_TRUCK)===N.TOUCH_TRUCK||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_ZOOM_TRUCK)===N.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(A,g,!1),this._isUserControllingTruck=!0),((this._state&N.OFFSET)===N.OFFSET||(this._state&N.TOUCH_OFFSET)===N.TOUCH_OFFSET||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET||(this._state&N.TOUCH_ZOOM_OFFSET)===N.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(A,g,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},m=()=>{Xs(this._activePointers,ht),i.copy(ht),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",E),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",R),this._domElement.ownerDocument.addEventListener("pointerlockerror",F),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),C())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",R),this._domElement.ownerDocument.removeEventListener("pointerlockerror",F))};const R=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},F=()=>{this.unlockPointer()};this._addAllEventListeners=p=>{this._domElement=p,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),Ra&&this._domElement.addEventListener("mousedown",r),this._domElement.addEventListener("pointercancel",d),this._domElement.addEventListener("wheel",u,{passive:!1}),this._domElement.addEventListener("contextmenu",T)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("mousedown",r),this._domElement.removeEventListener("pointercancel",d),this._domElement.removeEventListener("wheel",u,{passive:!1}),this._domElement.removeEventListener("contextmenu",T),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",E),this._domElement.ownerDocument.removeEventListener("pointerlockchange",R),this._domElement.ownerDocument.removeEventListener("pointerlockerror",F))},this.cancel=()=>{this._state!==N.NONE&&(this._state=N.NONE,this._activePointers.length=0,m())},e&&this.connect(e),this.update(0)}get camera(){return this._camera}set camera(t){this._camera=t,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(t){this._enabled=t,this._domElement&&(t?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(t){this._spherical.radius===t&&this._sphericalEnd.radius===t||(this._spherical.radius=t,this._sphericalEnd.radius=t,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(t){this._spherical.theta===t&&this._sphericalEnd.theta===t||(this._spherical.theta=t,this._sphericalEnd.theta=t,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(t){this._spherical.phi===t&&this._sphericalEnd.phi===t||(this._spherical.phi=t,this._sphericalEnd.phi=t,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(t){this._boundaryEnclosesCamera=t,this._needsUpdate=!0}set interactiveArea(t){this._interactiveArea.width=Tt(t.width,0,1),this._interactiveArea.height=Tt(t.height,0,1),this._interactiveArea.x=Tt(t.x,0,1-this._interactiveArea.width),this._interactiveArea.y=Tt(t.y,0,1-this._interactiveArea.height)}addEventListener(t,e){super.addEventListener(t,e)}removeEventListener(t,e){super.removeEventListener(t,e)}rotate(t,e,s=!1){return this.rotateTo(this._sphericalEnd.theta+t,this._sphericalEnd.phi+e,s)}rotateAzimuthTo(t,e=!1){return this.rotateTo(t,this._sphericalEnd.phi,e)}rotatePolarTo(t,e=!1){return this.rotateTo(this._sphericalEnd.theta,t,e)}rotateTo(t,e,s=!1){this._isUserControllingRotate=!1;const i=Tt(t,this.minAzimuthAngle,this.maxAzimuthAngle),n=Tt(e,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=n,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,s||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!s||V(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&V(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(t,e=!1){return this.dollyTo(this._sphericalEnd.radius-t,e)}dollyTo(t,e=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=le.NONE,this._changedDolly=0,this._dollyToNoClamp(Tt(t,this.minDistance,this.maxDistance),e)}_dollyToNoClamp(t,e=!1){const s=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const n=this._collisionTest(),o=V(n,this._spherical.radius);if(!(s>t)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(t,n)}else this._sphericalEnd.radius=t;this._needsUpdate=!0,e||(this._spherical.radius=this._sphericalEnd.radius);const i=!e||V(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(i)}dollyInFixed(t,e=!1){this._targetEnd.add(this._getCameraDirection(Ue).multiplyScalar(t)),e||this._target.copy(this._targetEnd);const s=!e||V(this._target.x,this._targetEnd.x,this.restThreshold)&&V(this._target.y,this._targetEnd.y,this.restThreshold)&&V(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}zoom(t,e=!1){return this.zoomTo(this._zoomEnd+t,e)}zoomTo(t,e=!1){this._isUserControllingZoom=!1,this._zoomEnd=Tt(t,this.minZoom,this.maxZoom),this._needsUpdate=!0,e||(this._zoom=this._zoomEnd);const s=!e||V(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(s)}pan(t,e,s=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(t,e,s)}truck(t,e,s=!1){this._camera.updateMatrix(),Ot.setFromMatrixColumn(this._camera.matrix,0),_t.setFromMatrixColumn(this._camera.matrix,1),Ot.multiplyScalar(t),_t.multiplyScalar(-e);const i=B.copy(Ot).add(_t),n=G.copy(this._targetEnd).add(i);return this.moveTo(n.x,n.y,n.z,s)}forward(t,e=!1){B.setFromMatrixColumn(this._camera.matrix,0),B.crossVectors(this._camera.up,B),B.multiplyScalar(t);const s=G.copy(this._targetEnd).add(B);return this.moveTo(s.x,s.y,s.z,e)}elevate(t,e=!1){return B.copy(this._camera.up).multiplyScalar(t),this.moveTo(this._targetEnd.x+B.x,this._targetEnd.y+B.y,this._targetEnd.z+B.z,e)}moveTo(t,e,s,i=!1){this._isUserControllingTruck=!1;const n=B.set(t,e,s).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,n,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const o=!i||V(this._target.x,this._targetEnd.x,this.restThreshold)&&V(this._target.y,this._targetEnd.y,this.restThreshold)&&V(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(t,e,s,i=!1){const n=B.set(t,e,s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(n.x,n.y,n.z,i)}fitToBox(t,e,{cover:s=!1,paddingLeft:i=0,paddingRight:n=0,paddingBottom:o=0,paddingTop:r=0}={}){const a=[],c=t.isBox3?Ie.copy(t):Ie.setFromObject(t);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const d=Cn(this._sphericalEnd.theta,pn),E=Cn(this._sphericalEnd.phi,pn);a.push(this.rotateTo(d,E,e));const l=B.setFromSpherical(this._sphericalEnd).normalize(),u=Fn.setFromUnitVectors(l,Qs),T=V(Math.abs(l.y),1);T&&u.multiply(qs.setFromAxisAngle(Is,d)),u.multiply(this._yAxisUpSpaceInverse);const C=An.makeEmpty();G.copy(c.min).applyQuaternion(u),C.expandByPoint(G),G.copy(c.min).setX(c.max.x).applyQuaternion(u),C.expandByPoint(G),G.copy(c.min).setY(c.max.y).applyQuaternion(u),C.expandByPoint(G),G.copy(c.max).setZ(c.min.z).applyQuaternion(u),C.expandByPoint(G),G.copy(c.min).setZ(c.max.z).applyQuaternion(u),C.expandByPoint(G),G.copy(c.max).setY(c.min.y).applyQuaternion(u),C.expandByPoint(G),G.copy(c.max).setX(c.min.x).applyQuaternion(u),C.expandByPoint(G),G.copy(c.max).applyQuaternion(u),C.expandByPoint(G),C.min.x-=i,C.min.y-=o,C.max.x+=n,C.max.y+=r,u.setFromUnitVectors(Qs,l),T&&u.premultiply(qs.invert()),u.premultiply(this._yAxisUpSpace);const f=C.getSize(B),m=C.getCenter(G).applyQuaternion(u);if(Wt(this._camera)){const R=this.getDistanceToFitBox(f.x,f.y,f.z,s);a.push(this.moveTo(m.x,m.y,m.z,e)),a.push(this.dollyTo(R,e)),a.push(this.setFocalOffset(0,0,0,e))}else if(bt(this._camera)){const R=this._camera,F=R.right-R.left,p=R.top-R.bottom,A=s?Math.max(F/f.x,p/f.y):Math.min(F/f.x,p/f.y);a.push(this.moveTo(m.x,m.y,m.z,e)),a.push(this.zoomTo(A,e)),a.push(this.setFocalOffset(0,0,0,e))}return Promise.all(a)}fitToSphere(t,e){const s=[],i=t instanceof b.Sphere?js.copy(t):ot.createBoundingSphere(t,js);if(s.push(this.moveTo(i.center.x,i.center.y,i.center.z,e)),Wt(this._camera)){const n=this.getDistanceToFitSphere(i.radius);s.push(this.dollyTo(n,e))}else if(bt(this._camera)){const n=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,r=2*i.radius,a=Math.min(n/r,o/r);s.push(this.zoomTo(a,e))}return s.push(this.setFocalOffset(0,0,0,e)),Promise.all(s)}setLookAt(t,e,s,i,n,o,r=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=le.NONE,this._changedDolly=0;const a=G.set(i,n,o),c=B.set(t,e,s);this._targetEnd.copy(a),this._sphericalEnd.setFromVector3(c.sub(a).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,r||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const d=!r||V(this._target.x,this._targetEnd.x,this.restThreshold)&&V(this._target.y,this._targetEnd.y,this.restThreshold)&&V(this._target.z,this._targetEnd.z,this.restThreshold)&&V(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&V(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&V(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(d)}lerpLookAt(t,e,s,i,n,o,r,a,c,d,E,l,u,T=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=le.NONE,this._changedDolly=0;const C=B.set(i,n,o),f=G.set(t,e,s);dt.setFromVector3(f.sub(C).applyQuaternion(this._yAxisUpSpace));const m=Ee.set(d,E,l),R=G.set(r,a,c);De.setFromVector3(R.sub(m).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(C.lerp(m,u));const F=De.theta-dt.theta,p=De.phi-dt.phi,A=De.radius-dt.radius;this._sphericalEnd.set(dt.radius+A*u,dt.phi+p*u,dt.theta+F*u),this.normalizeRotations(),this._needsUpdate=!0,T||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const g=!T||V(this._target.x,this._targetEnd.x,this.restThreshold)&&V(this._target.y,this._targetEnd.y,this.restThreshold)&&V(this._target.z,this._targetEnd.z,this.restThreshold)&&V(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&V(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&V(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(g)}setPosition(t,e,s,i=!1){return this.setLookAt(t,e,s,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(t,e,s,i=!1){const n=this.getPosition(B),o=this.setLookAt(n.x,n.y,n.z,t,e,s,i);return this._sphericalEnd.phi=Tt(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(t,e,s,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(t,e,s),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const n=!i||V(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&V(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&V(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}setOrbitPoint(t,e,s){this._camera.updateMatrixWorld(),Ot.setFromMatrixColumn(this._camera.matrixWorldInverse,0),_t.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Xt.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=B.set(t,e,s),n=i.distanceTo(this._camera.position),o=i.sub(this._camera.position);Ot.multiplyScalar(o.x),_t.multiplyScalar(o.y),Xt.multiplyScalar(o.z),B.copy(Ot).add(_t).add(Xt),B.z=B.z+n,this.dollyTo(n,!1),this.setFocalOffset(-B.x,B.y,-B.z,!1),this.moveTo(t,e,s,!1)}setBoundary(t){if(!t){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(t),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(t,e,s,i){if(t===null){this._viewport=null;return}this._viewport=this._viewport||new b.Vector4,typeof t=="number"?this._viewport.set(t,e,s,i):this._viewport.copy(t)}getDistanceToFitBox(t,e,s,i=!1){if(Zs(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const n=t/e,o=this._camera.getEffectiveFOV()*Le,r=this._camera.aspect;return((i?n>r:ne.pointerId===t)}_findPointerByMouseButton(t){return this._activePointers.find(e=>e.mouseButton===t)}_disposePointer(t){this._activePointers.splice(this._activePointers.indexOf(t),1)}_encloseToBoundary(t,e,s){const i=e.lengthSq();if(i===0)return t;const n=G.copy(e).add(t),o=this._boundary.clampPoint(n,Ee).sub(n),r=o.lengthSq();if(r===0)return t.add(e);if(r===i)return t;if(s===0)return t.add(e).add(o);{const a=1+s*r/e.dot(o);return t.add(G.copy(e).multiplyScalar(a)).add(o.multiplyScalar(1-s))}}_updateNearPlaneCorners(){if(Wt(this._camera)){const t=this._camera,e=t.near,s=t.getEffectiveFOV()*Le,i=Math.tan(s*.5)*e,n=i*t.aspect;this._nearPlaneCorners[0].set(-n,-i,0),this._nearPlaneCorners[1].set(n,-i,0),this._nearPlaneCorners[2].set(n,i,0),this._nearPlaneCorners[3].set(-n,i,0)}else if(bt(this._camera)){const t=this._camera,e=1/t.zoom,s=t.left*e,i=t.right*e,n=t.top*e,o=t.bottom*e;this._nearPlaneCorners[0].set(s,n,0),this._nearPlaneCorners[1].set(i,n,0),this._nearPlaneCorners[2].set(i,o,0),this._nearPlaneCorners[3].set(s,o,0)}}_collisionTest(){let t=1/0;if(!(this.colliderMeshes.length>=1)||Zs(this._camera,"_collisionTest"))return t;const e=this._getTargetDirection(Ue);Ks.lookAt(mn,e,this._camera.up);for(let s=0;s<4;s++){const i=G.copy(this._nearPlaneCorners[s]);i.applyMatrix4(Ks);const n=Ee.addVectors(this._target,i);us.set(n,e),us.far=this._spherical.radius+1;const o=us.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance{const s=()=>{this.removeEventListener("rest",s),e()};this.addEventListener("rest",s)}))}_addAllEventListeners(t){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(t){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(t){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(t,e=new b.Sphere){const s=e,i=s.center;Ie.makeEmpty(),t.traverseVisible(o=>{o.isMesh&&Ie.expandByObject(o)}),Ie.getCenter(i);let n=0;return t.traverseVisible(o=>{if(!o.isMesh)return;const r=o,a=r.geometry.clone();a.applyMatrix4(r.matrixWorld);const c=a.attributes.position;for(let d=0,E=c.count;d{var e;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof fi){this.onAspectUpdated.trigger();return}if((e=this.currentWorld.renderer)!=null&&e.isResizeable()){const s=this.currentWorld.renderer.getSize();this.three.aspect=s.width/s.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}}),this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:e,world:s})=>{if(e==="added"){const i=this.newCameraControls();this._allControls.set(s.uuid,i)}if(e==="removed"){const i=this._allControls.get(s.uuid);i&&(i.dispose(),this._allControls.delete(s.uuid))}})}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const t=this._allControls.get(this.currentWorld.uuid);if(!t)throw new Error("Controls not found!");return t}get enabled(){return this.currentWorld===null?!1:this.controls.enabled}set enabled(t){this.controls.enabled=t}dispose(){this.setupEvents(!1),this.enabled=!1,this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[t,e]of this._allControls)e.dispose()}update(t){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(t),this.onAfterUpdate.trigger(this))}setupCamera(){const t=window.innerWidth/window.innerHeight,e=new So(60,t,1,1e3);return e.position.set(50,50,50),e.lookAt(new O(0,0,0)),e}newCameraControls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");if(!this.currentWorld.renderer)throw new Error("This camera needs a renderer to work!");ot.install({THREE:He.getSubsetOfThree()});const{domElement:t}=this.currentWorld.renderer.three,e=new ot(this.three,t);return e.smoothTime=.2,e.dollyToCursor=!0,e.infinityDolly=!0,e}setupEvents(t){t?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:No,Vector2:Ft,Vector3:O,Vector4:wo,Quaternion:Rt,Matrix4:X,Spherical:yo,Box3:st,Sphere:Os,Raycaster:Ti,MathUtils:Ln}}}const Zn=class Qn extends q{constructor(t){super(t),I(this,"onAfterUpdate",new M),I(this,"onBeforeUpdate",new M),I(this,"onDisposed",new M),I(this,"list",new Map),I(this,"enabled",!0),t.add(Qn.uuid,this)}create(){const t=new Ca(this.components),e=t.uuid;if(this.list.has(e))throw new Error("There is already a world with this name!");return this.list.set(e,t),t}delete(t){this.list.delete(t.uuid),t.dispose()}dispose(){this.enabled=!1;for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}update(t){if(this.enabled)for(const[e,s]of this.list)s.update(t)}};I(Zn,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let Aa=Zn;class Fa{constructor(t,e,s){I(this,"onDisposed",new M),I(this,"world"),I(this,"components"),I(this,"three"),I(this,"_fade",3),I(this,"updateZoom",()=>{this.world.camera instanceof He&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)}),this.world=e;const{color:i,size1:n,size2:o,distance:r}=s;this.components=t;const a=new Ri(2,2,1,1),c=new Po({side:ke,uniforms:{uSize1:{value:n},uSize2:{value:o},uColor:{value:i},uDistance:{value:r},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:` + */const v={LEFT:1,RIGHT:2,MIDDLE:4},N=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),le={NONE:0,IN:1,OUT:-1};function Wt(h){return h.isPerspectiveCamera}function bt(h){return h.isOrthographicCamera}const de=Math.PI*2,pn=Math.PI/2,Wn=1e-5,Le=Math.PI/180;function Tt(h,t,e){return Math.max(t,Math.min(e,h))}function W(h,t=Wn){return Math.abs(h)0==u>d&&(u=d,e.value=(u-d)/n),u}function Tn(h,t,e,s,i=1/0,n,o){s=Math.max(1e-4,s);const r=2/s,a=r*n,c=1/(1+a+.48*a*a+.235*a*a*a);let d=t.x,E=t.y,l=t.z,u=h.x-d,T=h.y-E,C=h.z-l;const f=d,m=E,R=l,F=i*s,p=F*F,A=u*u+T*T+C*C;if(A>p){const Y=Math.sqrt(A);u=u/Y*F,T=T/Y*F,C=C/Y*F}d=h.x-u,E=h.y-T,l=h.z-C;const g=(e.x+r*u)*n,_=(e.y+r*T)*n,S=(e.z+r*C)*n;e.x=(e.x-r*g)*c,e.y=(e.y-r*_)*c,e.z=(e.z-r*S)*c,o.x=d+(u+g)*c,o.y=E+(T+_)*c,o.z=l+(C+S)*c;const w=f-h.x,y=m-h.y,L=R-h.z,P=o.x-f,U=o.y-m,x=o.z-R;return w*P+y*U+L*x>0&&(o.x=f,o.y=m,o.z=R,e.x=(o.x-f)/n,e.y=(o.y-m)/n,e.z=(o.z-R)/n),o}function Xs(h,t){t.set(0,0),h.forEach(e=>{t.x+=e.clientX,t.y+=e.clientY}),t.x/=h.length,t.y/=h.length}function Zs(h,t){return bt(h)?(console.warn(`${t} is not supported in OrthographicCamera`),!0):!1}class Ta{constructor(){this._listeners={}}addEventListener(t,e){const s=this._listeners;s[t]===void 0&&(s[t]=[]),s[t].indexOf(e)===-1&&s[t].push(e)}hasEventListener(t,e){const s=this._listeners;return s[t]!==void 0&&s[t].indexOf(e)!==-1}removeEventListener(t,e){const s=this._listeners[t];if(s!==void 0){const i=s.indexOf(e);i!==-1&&s.splice(i,1)}}removeAllEventListeners(t){if(!t){this._listeners={};return}Array.isArray(this._listeners[t])&&(this._listeners[t].length=0)}dispatchEvent(t){const e=this._listeners[t.type];if(e!==void 0){t.target=this;const s=e.slice(0);for(let i=0,n=s.length;i{},this._enabled=!0,this._state=N.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=le.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new b.Vector3,this._focalOffsetVelocity=new b.Vector3,this._zoomVelocity={value:0},this._truckInternal=(p,A,g)=>{let _,S;if(Wt(this._camera)){const w=B.copy(this._camera.position).sub(this._target),y=this._camera.getEffectiveFOV()*Le,L=w.length()*Math.tan(y*.5);_=this.truckSpeed*p*L/this._elementRect.height,S=this.truckSpeed*A*L/this._elementRect.height}else if(bt(this._camera)){const w=this._camera;_=p*(w.right-w.left)/w.zoom/this._elementRect.width,S=A*(w.top-w.bottom)/w.zoom/this._elementRect.height}else return;this.verticalDragToForward?(g?this.setFocalOffset(this._focalOffsetEnd.x+_,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(_,0,!0),this.forward(-S,!0)):g?this.setFocalOffset(this._focalOffsetEnd.x+_,this._focalOffsetEnd.y+S,this._focalOffsetEnd.z,!0):this.truck(_,S,!0)},this._rotateInternal=(p,A)=>{const g=de*this.azimuthRotateSpeed*p/this._elementRect.height,_=de*this.polarRotateSpeed*A/this._elementRect.height;this.rotate(g,_,!0)},this._dollyInternal=(p,A,g)=>{const _=Math.pow(.95,-p*this.dollySpeed),S=this._sphericalEnd.radius,w=this._sphericalEnd.radius*_,y=Tt(w,this.minDistance,this.maxDistance),L=y-w;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(w,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(L,!0),this._dollyToNoClamp(y,!0)):this._dollyToNoClamp(y,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?w:y)-S,this._dollyControlCoord.set(A,g)),this._lastDollyDirection=Math.sign(-p)},this._zoomInternal=(p,A,g)=>{const _=Math.pow(.95,p*this.dollySpeed),S=this._zoom,w=this._zoom*_;this.zoomTo(w,!0),this.dollyToCursor&&(this._changedZoom+=w-S,this._dollyControlCoord.set(A,g))},typeof b>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=t,this._yAxisUpSpace=new b.Quaternion().setFromUnitVectors(this._camera.up,Is),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=N.NONE,this._target=new b.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new b.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new b.Spherical().setFromVector3(B.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new b.Vector3,new b.Vector3,new b.Vector3,new b.Vector3],this._updateNearPlaneCorners(),this._boundary=new b.Box3(new b.Vector3(-1/0,-1/0,-1/0),new b.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new b.Vector2,this.mouseButtons={left:N.ROTATE,middle:N.DOLLY,right:N.TRUCK,wheel:Wt(this._camera)?N.DOLLY:bt(this._camera)?N.ZOOM:N.NONE},this.touches={one:N.TOUCH_ROTATE,two:Wt(this._camera)?N.TOUCH_DOLLY_TRUCK:bt(this._camera)?N.TOUCH_ZOOM_TRUCK:N.NONE,three:N.TOUCH_TRUCK};const s=new b.Vector2,i=new b.Vector2,n=new b.Vector2,o=p=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const _=this._domElement.getBoundingClientRect(),S=p.clientX/_.width,w=p.clientY/_.height;if(Sthis._interactiveArea.right||wthis._interactiveArea.bottom)return}const A=p.pointerType!=="mouse"?null:(p.buttons&v.LEFT)===v.LEFT?v.LEFT:(p.buttons&v.MIDDLE)===v.MIDDLE?v.MIDDLE:(p.buttons&v.RIGHT)===v.RIGHT?v.RIGHT:null;if(A!==null){const _=this._findPointerByMouseButton(A);_&&this._disposePointer(_)}if((p.buttons&v.LEFT)===v.LEFT&&this._lockedPointer)return;const g={pointerId:p.pointerId,clientX:p.clientX,clientY:p.clientY,deltaX:0,deltaY:0,mouseButton:A};this._activePointers.push(g),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),this._isDragging=!0,C(p)},r=p=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const _=this._domElement.getBoundingClientRect(),S=p.clientX/_.width,w=p.clientY/_.height;if(Sthis._interactiveArea.right||wthis._interactiveArea.bottom)return}const A=(p.buttons&v.LEFT)===v.LEFT?v.LEFT:(p.buttons&v.MIDDLE)===v.MIDDLE?v.MIDDLE:(p.buttons&v.RIGHT)===v.RIGHT?v.RIGHT:null;if(A!==null){const _=this._findPointerByMouseButton(A);_&&this._disposePointer(_)}const g={pointerId:1,clientX:p.clientX,clientY:p.clientY,deltaX:0,deltaY:0,mouseButton:(p.buttons&v.LEFT)===v.LEFT?v.LEFT:(p.buttons&v.MIDDLE)===v.LEFT?v.MIDDLE:(p.buttons&v.RIGHT)===v.LEFT?v.RIGHT:null};this._activePointers.push(g),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",E),this._domElement.ownerDocument.addEventListener("mousemove",c),this._domElement.ownerDocument.addEventListener("mouseup",E),this._isDragging=!0,C(p)},a=p=>{p.cancelable&&p.preventDefault();const A=p.pointerId,g=this._lockedPointer||this._findPointerById(A);if(g){if(g.clientX=p.clientX,g.clientY=p.clientY,g.deltaX=p.movementX,g.deltaY=p.movementY,this._state=0,p.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(p.buttons&v.LEFT)===v.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(p.buttons&v.MIDDLE)===v.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(p.buttons&v.RIGHT)===v.RIGHT&&(this._state=this._state|this.mouseButtons.right);f()}},c=p=>{const A=this._lockedPointer||this._findPointerById(1);A&&(A.clientX=p.clientX,A.clientY=p.clientY,A.deltaX=p.movementX,A.deltaY=p.movementY,this._state=0,(this._lockedPointer||(p.buttons&v.LEFT)===v.LEFT)&&(this._state=this._state|this.mouseButtons.left),(p.buttons&v.MIDDLE)===v.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(p.buttons&v.RIGHT)===v.RIGHT&&(this._state=this._state|this.mouseButtons.right),f())},d=p=>{const A=this._findPointerById(p.pointerId);if(!(A&&A===this._lockedPointer)){if(A&&this._disposePointer(A),p.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=N.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=N.NONE;m()}},E=()=>{const p=this._findPointerById(1);p&&p===this._lockedPointer||(p&&this._disposePointer(p),this._state=N.NONE,m())};let l=-1;const u=p=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===N.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const w=this._domElement.getBoundingClientRect(),y=p.clientX/w.width,L=p.clientY/w.height;if(ythis._interactiveArea.right||Lthis._interactiveArea.bottom)return}if(p.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===N.ROTATE||this.mouseButtons.wheel===N.TRUCK){const w=performance.now();l-w<1e3&&this._getClientRect(this._elementRect),l=w}const A=fa?-1:-3,g=p.deltaMode===1?p.deltaY/A:p.deltaY/(A*10),_=this.dollyToCursor?(p.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,S=this.dollyToCursor?(p.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case N.ROTATE:{this._rotateInternal(p.deltaX,p.deltaY),this._isUserControllingRotate=!0;break}case N.TRUCK:{this._truckInternal(p.deltaX,p.deltaY,!1),this._isUserControllingTruck=!0;break}case N.OFFSET:{this._truckInternal(p.deltaX,p.deltaY,!0),this._isUserControllingOffset=!0;break}case N.DOLLY:{this._dollyInternal(-g,_,S),this._isUserControllingDolly=!0;break}case N.ZOOM:{this._zoomInternal(-g,_,S),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},T=p=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===ot.ACTION.NONE){const A=p instanceof PointerEvent?p.pointerId:0,g=this._findPointerById(A);g&&this._disposePointer(g),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",E);return}p.preventDefault()}},C=p=>{if(this._enabled){if(Xs(this._activePointers,ht),this._getClientRect(this._elementRect),s.copy(ht),i.copy(ht),this._activePointers.length>=2){const A=ht.x-this._activePointers[1].clientX,g=ht.y-this._activePointers[1].clientY,_=Math.sqrt(A*A+g*g);n.set(0,_);const S=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,w=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(S,w)}if(this._state=0,!p)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in p&&p.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(p.buttons&v.LEFT)===v.LEFT&&(this._state=this._state|this.mouseButtons.left),(p.buttons&v.MIDDLE)===v.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(p.buttons&v.RIGHT)===v.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&N.ROTATE)===N.ROTATE||(this._state&N.TOUCH_ROTATE)===N.TOUCH_ROTATE||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE||(this._state&N.TOUCH_ZOOM_ROTATE)===N.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&N.TRUCK)===N.TRUCK||(this._state&N.TOUCH_TRUCK)===N.TOUCH_TRUCK||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_ZOOM_TRUCK)===N.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&N.DOLLY)===N.DOLLY||(this._state&N.TOUCH_DOLLY)===N.TOUCH_DOLLY||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&N.ZOOM)===N.ZOOM||(this._state&N.TOUCH_ZOOM)===N.TOUCH_ZOOM||(this._state&N.TOUCH_ZOOM_TRUCK)===N.TOUCH_ZOOM_TRUCK||(this._state&N.TOUCH_ZOOM_OFFSET)===N.TOUCH_ZOOM_OFFSET||(this._state&N.TOUCH_ZOOM_ROTATE)===N.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&N.OFFSET)===N.OFFSET||(this._state&N.TOUCH_OFFSET)===N.TOUCH_OFFSET||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET||(this._state&N.TOUCH_ZOOM_OFFSET)===N.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})}},f=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Xs(this._activePointers,ht);const p=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,A=p?-p.deltaX:i.x-ht.x,g=p?-p.deltaY:i.y-ht.y;if(i.copy(ht),((this._state&N.ROTATE)===N.ROTATE||(this._state&N.TOUCH_ROTATE)===N.TOUCH_ROTATE||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE||(this._state&N.TOUCH_ZOOM_ROTATE)===N.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(A,g),this._isUserControllingRotate=!0),(this._state&N.DOLLY)===N.DOLLY||(this._state&N.ZOOM)===N.ZOOM){const _=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,S=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0,w=this.dollyDragInverted?-1:1;(this._state&N.DOLLY)===N.DOLLY?(this._dollyInternal(w*g*Es,_,S),this._isUserControllingDolly=!0):(this._zoomInternal(w*g*Es,_,S),this._isUserControllingZoom=!0)}if((this._state&N.TOUCH_DOLLY)===N.TOUCH_DOLLY||(this._state&N.TOUCH_ZOOM)===N.TOUCH_ZOOM||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_ZOOM_TRUCK)===N.TOUCH_ZOOM_TRUCK||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET||(this._state&N.TOUCH_ZOOM_OFFSET)===N.TOUCH_ZOOM_OFFSET||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE||(this._state&N.TOUCH_ZOOM_ROTATE)===N.TOUCH_ZOOM_ROTATE){const _=ht.x-this._activePointers[1].clientX,S=ht.y-this._activePointers[1].clientY,w=Math.sqrt(_*_+S*S),y=n.y-w;n.set(0,w);const L=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,P=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&N.TOUCH_DOLLY)===N.TOUCH_DOLLY||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET?(this._dollyInternal(y*Es,L,P),this._isUserControllingDolly=!0):(this._zoomInternal(y*Es,L,P),this._isUserControllingZoom=!0)}((this._state&N.TRUCK)===N.TRUCK||(this._state&N.TOUCH_TRUCK)===N.TOUCH_TRUCK||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_ZOOM_TRUCK)===N.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(A,g,!1),this._isUserControllingTruck=!0),((this._state&N.OFFSET)===N.OFFSET||(this._state&N.TOUCH_OFFSET)===N.TOUCH_OFFSET||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET||(this._state&N.TOUCH_ZOOM_OFFSET)===N.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(A,g,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},m=()=>{Xs(this._activePointers,ht),i.copy(ht),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",E),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",R),this._domElement.ownerDocument.addEventListener("pointerlockerror",F),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),C())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",R),this._domElement.ownerDocument.removeEventListener("pointerlockerror",F))};const R=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},F=()=>{this.unlockPointer()};this._addAllEventListeners=p=>{this._domElement=p,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),Ra&&this._domElement.addEventListener("mousedown",r),this._domElement.addEventListener("pointercancel",d),this._domElement.addEventListener("wheel",u,{passive:!1}),this._domElement.addEventListener("contextmenu",T)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("mousedown",r),this._domElement.removeEventListener("pointercancel",d),this._domElement.removeEventListener("wheel",u,{passive:!1}),this._domElement.removeEventListener("contextmenu",T),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",E),this._domElement.ownerDocument.removeEventListener("pointerlockchange",R),this._domElement.ownerDocument.removeEventListener("pointerlockerror",F))},this.cancel=()=>{this._state!==N.NONE&&(this._state=N.NONE,this._activePointers.length=0,m())},e&&this.connect(e),this.update(0)}get camera(){return this._camera}set camera(t){this._camera=t,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(t){this._enabled=t,this._domElement&&(t?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(t){this._spherical.radius===t&&this._sphericalEnd.radius===t||(this._spherical.radius=t,this._sphericalEnd.radius=t,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(t){this._spherical.theta===t&&this._sphericalEnd.theta===t||(this._spherical.theta=t,this._sphericalEnd.theta=t,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(t){this._spherical.phi===t&&this._sphericalEnd.phi===t||(this._spherical.phi=t,this._sphericalEnd.phi=t,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(t){this._boundaryEnclosesCamera=t,this._needsUpdate=!0}set interactiveArea(t){this._interactiveArea.width=Tt(t.width,0,1),this._interactiveArea.height=Tt(t.height,0,1),this._interactiveArea.x=Tt(t.x,0,1-this._interactiveArea.width),this._interactiveArea.y=Tt(t.y,0,1-this._interactiveArea.height)}addEventListener(t,e){super.addEventListener(t,e)}removeEventListener(t,e){super.removeEventListener(t,e)}rotate(t,e,s=!1){return this.rotateTo(this._sphericalEnd.theta+t,this._sphericalEnd.phi+e,s)}rotateAzimuthTo(t,e=!1){return this.rotateTo(t,this._sphericalEnd.phi,e)}rotatePolarTo(t,e=!1){return this.rotateTo(this._sphericalEnd.theta,t,e)}rotateTo(t,e,s=!1){this._isUserControllingRotate=!1;const i=Tt(t,this.minAzimuthAngle,this.maxAzimuthAngle),n=Tt(e,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=n,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,s||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!s||V(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&V(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(t,e=!1){return this.dollyTo(this._sphericalEnd.radius-t,e)}dollyTo(t,e=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=le.NONE,this._changedDolly=0,this._dollyToNoClamp(Tt(t,this.minDistance,this.maxDistance),e)}_dollyToNoClamp(t,e=!1){const s=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const n=this._collisionTest(),o=V(n,this._spherical.radius);if(!(s>t)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(t,n)}else this._sphericalEnd.radius=t;this._needsUpdate=!0,e||(this._spherical.radius=this._sphericalEnd.radius);const i=!e||V(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(i)}dollyInFixed(t,e=!1){this._targetEnd.add(this._getCameraDirection(Ue).multiplyScalar(t)),e||this._target.copy(this._targetEnd);const s=!e||V(this._target.x,this._targetEnd.x,this.restThreshold)&&V(this._target.y,this._targetEnd.y,this.restThreshold)&&V(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}zoom(t,e=!1){return this.zoomTo(this._zoomEnd+t,e)}zoomTo(t,e=!1){this._isUserControllingZoom=!1,this._zoomEnd=Tt(t,this.minZoom,this.maxZoom),this._needsUpdate=!0,e||(this._zoom=this._zoomEnd);const s=!e||V(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(s)}pan(t,e,s=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(t,e,s)}truck(t,e,s=!1){this._camera.updateMatrix(),Ot.setFromMatrixColumn(this._camera.matrix,0),_t.setFromMatrixColumn(this._camera.matrix,1),Ot.multiplyScalar(t),_t.multiplyScalar(-e);const i=B.copy(Ot).add(_t),n=G.copy(this._targetEnd).add(i);return this.moveTo(n.x,n.y,n.z,s)}forward(t,e=!1){B.setFromMatrixColumn(this._camera.matrix,0),B.crossVectors(this._camera.up,B),B.multiplyScalar(t);const s=G.copy(this._targetEnd).add(B);return this.moveTo(s.x,s.y,s.z,e)}elevate(t,e=!1){return B.copy(this._camera.up).multiplyScalar(t),this.moveTo(this._targetEnd.x+B.x,this._targetEnd.y+B.y,this._targetEnd.z+B.z,e)}moveTo(t,e,s,i=!1){this._isUserControllingTruck=!1;const n=B.set(t,e,s).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,n,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const o=!i||V(this._target.x,this._targetEnd.x,this.restThreshold)&&V(this._target.y,this._targetEnd.y,this.restThreshold)&&V(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(t,e,s,i=!1){const n=B.set(t,e,s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(n.x,n.y,n.z,i)}fitToBox(t,e,{cover:s=!1,paddingLeft:i=0,paddingRight:n=0,paddingBottom:o=0,paddingTop:r=0}={}){const a=[],c=t.isBox3?Ie.copy(t):Ie.setFromObject(t);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const d=Cn(this._sphericalEnd.theta,pn),E=Cn(this._sphericalEnd.phi,pn);a.push(this.rotateTo(d,E,e));const l=B.setFromSpherical(this._sphericalEnd).normalize(),u=Fn.setFromUnitVectors(l,Qs),T=V(Math.abs(l.y),1);T&&u.multiply(qs.setFromAxisAngle(Is,d)),u.multiply(this._yAxisUpSpaceInverse);const C=An.makeEmpty();G.copy(c.min).applyQuaternion(u),C.expandByPoint(G),G.copy(c.min).setX(c.max.x).applyQuaternion(u),C.expandByPoint(G),G.copy(c.min).setY(c.max.y).applyQuaternion(u),C.expandByPoint(G),G.copy(c.max).setZ(c.min.z).applyQuaternion(u),C.expandByPoint(G),G.copy(c.min).setZ(c.max.z).applyQuaternion(u),C.expandByPoint(G),G.copy(c.max).setY(c.min.y).applyQuaternion(u),C.expandByPoint(G),G.copy(c.max).setX(c.min.x).applyQuaternion(u),C.expandByPoint(G),G.copy(c.max).applyQuaternion(u),C.expandByPoint(G),C.min.x-=i,C.min.y-=o,C.max.x+=n,C.max.y+=r,u.setFromUnitVectors(Qs,l),T&&u.premultiply(qs.invert()),u.premultiply(this._yAxisUpSpace);const f=C.getSize(B),m=C.getCenter(G).applyQuaternion(u);if(Wt(this._camera)){const R=this.getDistanceToFitBox(f.x,f.y,f.z,s);a.push(this.moveTo(m.x,m.y,m.z,e)),a.push(this.dollyTo(R,e)),a.push(this.setFocalOffset(0,0,0,e))}else if(bt(this._camera)){const R=this._camera,F=R.right-R.left,p=R.top-R.bottom,A=s?Math.max(F/f.x,p/f.y):Math.min(F/f.x,p/f.y);a.push(this.moveTo(m.x,m.y,m.z,e)),a.push(this.zoomTo(A,e)),a.push(this.setFocalOffset(0,0,0,e))}return Promise.all(a)}fitToSphere(t,e){const s=[],i=t instanceof b.Sphere?js.copy(t):ot.createBoundingSphere(t,js);if(s.push(this.moveTo(i.center.x,i.center.y,i.center.z,e)),Wt(this._camera)){const n=this.getDistanceToFitSphere(i.radius);s.push(this.dollyTo(n,e))}else if(bt(this._camera)){const n=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,r=2*i.radius,a=Math.min(n/r,o/r);s.push(this.zoomTo(a,e))}return s.push(this.setFocalOffset(0,0,0,e)),Promise.all(s)}setLookAt(t,e,s,i,n,o,r=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=le.NONE,this._changedDolly=0;const a=G.set(i,n,o),c=B.set(t,e,s);this._targetEnd.copy(a),this._sphericalEnd.setFromVector3(c.sub(a).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,r||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const d=!r||V(this._target.x,this._targetEnd.x,this.restThreshold)&&V(this._target.y,this._targetEnd.y,this.restThreshold)&&V(this._target.z,this._targetEnd.z,this.restThreshold)&&V(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&V(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&V(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(d)}lerpLookAt(t,e,s,i,n,o,r,a,c,d,E,l,u,T=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=le.NONE,this._changedDolly=0;const C=B.set(i,n,o),f=G.set(t,e,s);dt.setFromVector3(f.sub(C).applyQuaternion(this._yAxisUpSpace));const m=Ee.set(d,E,l),R=G.set(r,a,c);De.setFromVector3(R.sub(m).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(C.lerp(m,u));const F=De.theta-dt.theta,p=De.phi-dt.phi,A=De.radius-dt.radius;this._sphericalEnd.set(dt.radius+A*u,dt.phi+p*u,dt.theta+F*u),this.normalizeRotations(),this._needsUpdate=!0,T||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const g=!T||V(this._target.x,this._targetEnd.x,this.restThreshold)&&V(this._target.y,this._targetEnd.y,this.restThreshold)&&V(this._target.z,this._targetEnd.z,this.restThreshold)&&V(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&V(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&V(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(g)}setPosition(t,e,s,i=!1){return this.setLookAt(t,e,s,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(t,e,s,i=!1){const n=this.getPosition(B),o=this.setLookAt(n.x,n.y,n.z,t,e,s,i);return this._sphericalEnd.phi=Tt(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(t,e,s,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(t,e,s),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const n=!i||V(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&V(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&V(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}setOrbitPoint(t,e,s){this._camera.updateMatrixWorld(),Ot.setFromMatrixColumn(this._camera.matrixWorldInverse,0),_t.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Xt.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=B.set(t,e,s),n=i.distanceTo(this._camera.position),o=i.sub(this._camera.position);Ot.multiplyScalar(o.x),_t.multiplyScalar(o.y),Xt.multiplyScalar(o.z),B.copy(Ot).add(_t).add(Xt),B.z=B.z+n,this.dollyTo(n,!1),this.setFocalOffset(-B.x,B.y,-B.z,!1),this.moveTo(t,e,s,!1)}setBoundary(t){if(!t){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(t),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(t,e,s,i){if(t===null){this._viewport=null;return}this._viewport=this._viewport||new b.Vector4,typeof t=="number"?this._viewport.set(t,e,s,i):this._viewport.copy(t)}getDistanceToFitBox(t,e,s,i=!1){if(Zs(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const n=t/e,o=this._camera.getEffectiveFOV()*Le,r=this._camera.aspect;return((i?n>r:ne.pointerId===t)}_findPointerByMouseButton(t){return this._activePointers.find(e=>e.mouseButton===t)}_disposePointer(t){this._activePointers.splice(this._activePointers.indexOf(t),1)}_encloseToBoundary(t,e,s){const i=e.lengthSq();if(i===0)return t;const n=G.copy(e).add(t),o=this._boundary.clampPoint(n,Ee).sub(n),r=o.lengthSq();if(r===0)return t.add(e);if(r===i)return t;if(s===0)return t.add(e).add(o);{const a=1+s*r/e.dot(o);return t.add(G.copy(e).multiplyScalar(a)).add(o.multiplyScalar(1-s))}}_updateNearPlaneCorners(){if(Wt(this._camera)){const t=this._camera,e=t.near,s=t.getEffectiveFOV()*Le,i=Math.tan(s*.5)*e,n=i*t.aspect;this._nearPlaneCorners[0].set(-n,-i,0),this._nearPlaneCorners[1].set(n,-i,0),this._nearPlaneCorners[2].set(n,i,0),this._nearPlaneCorners[3].set(-n,i,0)}else if(bt(this._camera)){const t=this._camera,e=1/t.zoom,s=t.left*e,i=t.right*e,n=t.top*e,o=t.bottom*e;this._nearPlaneCorners[0].set(s,n,0),this._nearPlaneCorners[1].set(i,n,0),this._nearPlaneCorners[2].set(i,o,0),this._nearPlaneCorners[3].set(s,o,0)}}_collisionTest(){let t=1/0;if(!(this.colliderMeshes.length>=1)||Zs(this._camera,"_collisionTest"))return t;const e=this._getTargetDirection(Ue);Ks.lookAt(mn,e,this._camera.up);for(let s=0;s<4;s++){const i=G.copy(this._nearPlaneCorners[s]);i.applyMatrix4(Ks);const n=Ee.addVectors(this._target,i);us.set(n,e),us.far=this._spherical.radius+1;const o=us.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance{const s=()=>{this.removeEventListener("rest",s),e()};this.addEventListener("rest",s)}))}_addAllEventListeners(t){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(t){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(t){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(t,e=new b.Sphere){const s=e,i=s.center;Ie.makeEmpty(),t.traverseVisible(o=>{o.isMesh&&Ie.expandByObject(o)}),Ie.getCenter(i);let n=0;return t.traverseVisible(o=>{if(!o.isMesh)return;const r=o,a=r.geometry.clone();a.applyMatrix4(r.matrixWorld);const c=a.attributes.position;for(let d=0,E=c.count;d{var e;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof fi){this.onAspectUpdated.trigger();return}if((e=this.currentWorld.renderer)!=null&&e.isResizeable()){const s=this.currentWorld.renderer.getSize();this.three.aspect=s.width/s.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}}),this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:e,world:s})=>{if(e==="added"){const i=this.newCameraControls();this._allControls.set(s.uuid,i)}if(e==="removed"){const i=this._allControls.get(s.uuid);i&&(i.dispose(),this._allControls.delete(s.uuid))}})}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const t=this._allControls.get(this.currentWorld.uuid);if(!t)throw new Error("Controls not found!");return t}get enabled(){return this.currentWorld===null?!1:this.controls.enabled}set enabled(t){this.controls.enabled=t}dispose(){this.setupEvents(!1),this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[t,e]of this._allControls)e.dispose()}update(t){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(t),this.onAfterUpdate.trigger(this))}setupCamera(){const t=window.innerWidth/window.innerHeight,e=new So(60,t,1,1e3);return e.position.set(50,50,50),e.lookAt(new O(0,0,0)),e}newCameraControls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");if(!this.currentWorld.renderer)throw new Error("This camera needs a renderer to work!");ot.install({THREE:He.getSubsetOfThree()});const{domElement:t}=this.currentWorld.renderer.three,e=new ot(this.three,t);return e.smoothTime=.2,e.dollyToCursor=!0,e.infinityDolly=!0,e}setupEvents(t){t?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:No,Vector2:Ft,Vector3:O,Vector4:wo,Quaternion:Rt,Matrix4:X,Spherical:yo,Box3:st,Sphere:Os,Raycaster:Ti,MathUtils:Ln}}}const Zn=class Qn extends q{constructor(t){super(t),I(this,"onAfterUpdate",new M),I(this,"onBeforeUpdate",new M),I(this,"onDisposed",new M),I(this,"onWorldCreated",new M),I(this,"onWorldDeleted",new M),I(this,"list",new Map),I(this,"enabled",!0),t.add(Qn.uuid,this)}create(){const t=new Ca(this.components),e=t.uuid;if(this.list.has(e))throw new Error("There is already a world with this name!");return this.list.set(e,t),this.onWorldCreated.trigger(t),t}delete(t){const e=t.uuid;this.list.delete(t.uuid),t.dispose(),this.onWorldDeleted.trigger(e)}dispose(){this.enabled=!1;for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}update(t){if(this.enabled)for(const[e,s]of this.list)s.update(t)}};I(Zn,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let Aa=Zn;class Fa{constructor(t,e,s){I(this,"onDisposed",new M),I(this,"world"),I(this,"components"),I(this,"three"),I(this,"_fade",3),I(this,"updateZoom",()=>{this.world.camera instanceof He&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)}),this.world=e;const{color:i,size1:n,size2:o,distance:r}=s;this.components=t;const a=new Ri(2,2,1,1),c=new Po({side:ke,uniforms:{uSize1:{value:n},uSize2:{value:o},uColor:{value:i},uDistance:{value:r},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:` varying vec3 worldPosition; @@ -68,7 +68,7 @@ import{r as At,p as st,T as pe,z as Ti,E as go,a as X,V as O,f as Ft,P as fe,y a } - `,extensions:{derivatives:!0}});this.three=new D(a,c),this.three.frustumCulled=!1,e.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(t){t?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(t){this._fade=t?3:0,this.material.uniforms.uFade.value=this._fade}[Symbol.dispose](){throw new Error("Method not implemented.")}dispose(){this.setupEvents(!1),this.components.get(me).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(t){if(!(this.world.camera instanceof He))return;const e=this.world.camera.controls;t?e.addEventListener("update",this.updateZoom):e.removeEventListener("update",this.updateZoom)}}class ga extends q{constructor(){super(...arguments),I(this,"list",new Map),I(this,"onDisposed",new M),I(this,"config",{color:new qt(12303291),size1:1,size2:10,distance:500}),I(this,"enabled",!0)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a grid!");const e=new Fa(this.components,t,this.config);return this.list.set(t.uuid,e),t.onDisposed.add(()=>{this.delete(t)}),e}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}}I(ga,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");const Zt=new Ti,nt=new O,xt=new O,Q=new Rt,gn={X:new O(1,0,0),Y:new O(0,1,0),Z:new O(0,0,1)},$s={type:"change"},On={type:"mouseDown"},_n={type:"mouseUp",mode:null},Sn={type:"objectChange"};class Oa extends Fs{constructor(t,e){super(),e===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.isTransformControls=!0,this.visible=!1,this.domElement=e,this.domElement.style.touchAction="none";const s=new La;this._gizmo=s,this.add(s);const i=new Pa;this._plane=i,this.add(i);const n=this;function o(R,F){let p=F;Object.defineProperty(n,R,{get:function(){return p!==void 0?p:F},set:function(A){p!==A&&(p=A,i[R]=A,s[R]=A,n.dispatchEvent({type:R+"-changed",value:A}),n.dispatchEvent($s))}}),n[R]=F,i[R]=F,s[R]=F}o("camera",t),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const r=new O,a=new O,c=new Rt,d=new Rt,E=new O,l=new Rt,u=new O,T=new O,C=new O,f=0,m=new O;o("worldPosition",r),o("worldPositionStart",a),o("worldQuaternion",c),o("worldQuaternionStart",d),o("cameraPosition",E),o("cameraQuaternion",l),o("pointStart",u),o("pointEnd",T),o("rotationAxis",C),o("rotationAngle",f),o("eye",m),this._offset=new O,this._startNorm=new O,this._endNorm=new O,this._cameraScale=new O,this._parentPosition=new O,this._parentQuaternion=new Rt,this._parentQuaternionInv=new Rt,this._parentScale=new O,this._worldScaleStart=new O,this._worldQuaternionInv=new Rt,this._worldScale=new O,this._positionStart=new O,this._quaternionStart=new Rt,this._scaleStart=new O,this._getPointer=_a.bind(this),this._onPointerDown=Na.bind(this),this._onPointerHover=Sa.bind(this),this._onPointerMove=wa.bind(this),this._onPointerUp=ya.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(t){if(this.object===void 0||this.dragging===!0)return;Zt.setFromCamera(t,this.camera);const e=Js(this._gizmo.picker[this.mode],Zt);e?this.axis=e.object.name:this.axis=null}pointerDown(t){if(!(this.object===void 0||this.dragging===!0||t.button!==0)&&this.axis!==null){Zt.setFromCamera(t,this.camera);const e=Js(this._plane,Zt,!0);e&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,On.mode=this.mode,this.dispatchEvent(On)}}pointerMove(t){const e=this.axis,s=this.mode,i=this.object;let n=this.space;if(s==="scale"?n="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(n="world"),i===void 0||e===null||this.dragging===!1||t.button!==-1)return;Zt.setFromCamera(t,this.camera);const o=Js(this._plane,Zt,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),s==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),n==="local"&&e!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),e.indexOf("X")===-1&&(this._offset.x=0),e.indexOf("Y")===-1&&(this._offset.y=0),e.indexOf("Z")===-1&&(this._offset.z=0),n==="local"&&e!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(n==="local"&&(i.position.applyQuaternion(Q.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),n==="world"&&(i.parent&&i.position.add(nt.setFromMatrixPosition(i.parent.matrixWorld)),e.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(nt.setFromMatrixPosition(i.parent.matrixWorld))));else if(s==="scale"){if(e.search("XYZ")!==-1){let r=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(r*=-1),xt.set(r,r,r)}else nt.copy(this.pointStart),xt.copy(this.pointEnd),nt.applyQuaternion(this._worldQuaternionInv),xt.applyQuaternion(this._worldQuaternionInv),xt.divide(nt),e.search("X")===-1&&(xt.x=1),e.search("Y")===-1&&(xt.y=1),e.search("Z")===-1&&(xt.z=1);i.scale.copy(this._scaleStart).multiply(xt),this.scaleSnap&&(e.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(s==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const r=20/this.worldPosition.distanceTo(nt.setFromMatrixPosition(this.camera.matrixWorld));let a=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(nt.copy(this.rotationAxis).cross(this.eye))*r):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(gn[e]),nt.copy(gn[e]),n==="local"&&nt.applyQuaternion(this.worldQuaternion),nt.cross(this.eye),nt.length()===0?a=!0:this.rotationAngle=this._offset.dot(nt.normalize())*r),(e==="E"||a)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),n==="local"&&e!=="E"&&e!=="XYZE"?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(Q.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(Q.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent($s),this.dispatchEvent(Sn)}}pointerUp(t){t.button===0&&(this.dragging&&this.axis!==null&&(_n.mode=this.mode,this.dispatchEvent(_n)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(t){t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()})}attach(t){return this.object=t,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent($s),this.dispatchEvent(Sn),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Zt}getMode(){return this.mode}setMode(t){this.mode=t}setTranslationSnap(t){this.translationSnap=t}setRotationSnap(t){this.rotationSnap=t}setScaleSnap(t){this.scaleSnap=t}setSize(t){this.size=t}setSpace(t){this.space=t}}function _a(h){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:h.button};{const t=this.domElement.getBoundingClientRect();return{x:(h.clientX-t.left)/t.width*2-1,y:-(h.clientY-t.top)/t.height*2+1,button:h.button}}}function Sa(h){if(this.enabled)switch(h.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(h));break}}function Na(h){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(h.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(h)),this.pointerDown(this._getPointer(h)))}function wa(h){this.enabled&&this.pointerMove(this._getPointer(h))}function ya(h){this.enabled&&(this.domElement.releasePointerCapture(h.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(h)))}function Js(h,t,e){const s=t.intersectObject(h,!0);for(let i=0;i.9&&(n.visible=!1)),this.axis==="Y"&&(Q.setFromEuler(ps.set(0,0,Math.PI/2)),n.quaternion.copy(e).multiply(Q),Math.abs(k.copy(Qt).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Z"&&(Q.setFromEuler(ps.set(0,Math.PI/2,0)),n.quaternion.copy(e).multiply(Q),Math.abs(k.copy(Be).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="XYZE"&&(Q.setFromEuler(ps.set(0,Math.PI/2,0)),k.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(wn.lookAt(Nn,k,Qt)),n.quaternion.multiply(Q),n.visible=this.dragging),this.axis==="E"&&(n.visible=!1)):n.name==="START"?(n.position.copy(this.worldPositionStart),n.visible=this.dragging):n.name==="END"?(n.position.copy(this.worldPosition),n.visible=this.dragging):n.name==="DELTA"?(n.position.copy(this.worldPositionStart),n.quaternion.copy(this.worldQuaternionStart),nt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),nt.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(nt),n.visible=this.dragging):(n.quaternion.copy(e),this.dragging?n.position.copy(this.worldPositionStart):n.position.copy(this.worldPosition),this.axis&&(n.visible=this.axis.search(n.name)!==-1));continue}n.quaternion.copy(e),this.mode==="translate"||this.mode==="scale"?(n.name==="X"&&Math.abs(k.copy(ve).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Y"&&Math.abs(k.copy(Qt).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Z"&&Math.abs(k.copy(Be).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XY"&&Math.abs(k.copy(Be).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="YZ"&&Math.abs(k.copy(ve).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XZ"&&Math.abs(k.copy(Qt).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)):this.mode==="rotate"&&(Cs.copy(e),k.copy(this.eye).applyQuaternion(Q.copy(e).invert()),n.name.search("E")!==-1&&n.quaternion.setFromRotationMatrix(wn.lookAt(this.eye,Nn,Qt)),n.name==="X"&&(Q.setFromAxisAngle(ve,Math.atan2(-k.y,k.z)),Q.multiplyQuaternions(Cs,Q),n.quaternion.copy(Q)),n.name==="Y"&&(Q.setFromAxisAngle(Qt,Math.atan2(k.x,k.z)),Q.multiplyQuaternions(Cs,Q),n.quaternion.copy(Q)),n.name==="Z"&&(Q.setFromAxisAngle(Be,Math.atan2(k.y,k.x)),Q.multiplyQuaternions(Cs,Q),n.quaternion.copy(Q))),n.visible=n.visible&&(n.name.indexOf("X")===-1||this.showX),n.visible=n.visible&&(n.name.indexOf("Y")===-1||this.showY),n.visible=n.visible&&(n.name.indexOf("Z")===-1||this.showZ),n.visible=n.visible&&(n.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),n.material._color=n.material._color||n.material.color.clone(),n.material._opacity=n.material._opacity||n.material.opacity,n.material.color.copy(n.material._color),n.material.opacity=n.material._opacity,this.enabled&&this.axis&&(n.name===this.axis||this.axis.split("").some(function(r){return n.name===r}))&&(n.material.color.setHex(16776960),n.material.opacity=1)}super.updateMatrixWorld(t)}}class Pa extends D{constructor(){super(new Ri(1e5,1e5,2,2),new Te({visible:!1,wireframe:!0,side:ke,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(t){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),Ts.copy(ve).applyQuaternion(e==="local"?this.worldQuaternion:Rs),xe.copy(Qt).applyQuaternion(e==="local"?this.worldQuaternion:Rs),be.copy(Be).applyQuaternion(e==="local"?this.worldQuaternion:Rs),k.copy(xe),this.mode){case"translate":case"scale":switch(this.axis){case"X":k.copy(this.eye).cross(Ts),St.copy(Ts).cross(k);break;case"Y":k.copy(this.eye).cross(xe),St.copy(xe).cross(k);break;case"Z":k.copy(this.eye).cross(be),St.copy(be).cross(k);break;case"XY":St.copy(be);break;case"YZ":St.copy(Ts);break;case"XZ":k.copy(be),St.copy(xe);break;case"XYZ":case"E":St.set(0,0,0);break}break;case"rotate":default:St.set(0,0,0)}St.length()===0?this.quaternion.copy(this.cameraQuaternion):(yn.lookAt(nt.set(0,0,0),St,k),this.quaternion.setFromRotationMatrix(yn)),super.updateMatrixWorld(t)}}class bi{constructor(t,e,s,i,n,o=5,r=!0){if(I(this,"onDraggingStarted",new M),I(this,"onDraggingEnded",new M),I(this,"onDisposed",new M),I(this,"normal"),I(this,"origin"),I(this,"three",new fe),I(this,"_helper"),I(this,"_visible",!0),I(this,"_enabled",!0),I(this,"components"),I(this,"world"),I(this,"_controlsActive",!1),I(this,"_arrowBoundBox",new D),I(this,"_planeMesh"),I(this,"_controls"),I(this,"_hiddenMaterial",new Te({visible:!1})),I(this,"update",()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)}),I(this,"changeDrag",a=>{this._visible=!a.value,this.preventCameraMovement(),this.notifyDraggingChanged(a)}),this.components=t,this.world=e,!e.renderer)throw new Error("The given world must have a renderer!");this.normal=i,this.origin=s,e.renderer.setPlane(!0,this.three),this._planeMesh=bi.newPlaneMesh(o,n),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(i,s),r&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(t){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=t,this.world.renderer.setPlane(t,this.three)}get visible(){return this._visible}set visible(t){this._visible=t,this._controls.visible=t,this._helper.visible=t,this.toggleControls(t)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(t){this._planeMesh.material=t}get size(){return this._planeMesh.scale.x}set size(t){this._planeMesh.scale.set(t,t,t)}get helper(){return this._helper}setFromNormalAndCoplanarPoint(t,e){this.reset(),this.normal.equals(t)||(this.normal.copy(t),this._helper.lookAt(t)),this.origin.copy(e),this._helper.position.copy(e),this._helper.updateMatrix(),this.update()}dispose(){this._enabled=!1,this.onDraggingStarted.reset(),this.onDraggingEnded.reset(),this._helper.removeFromParent(),this.world.renderer&&this.world.renderer.setPlane(!1,this.three),this._arrowBoundBox.removeFromParent(),this._arrowBoundBox.geometry.dispose(),this._planeMesh.geometry.dispose(),this._controls.removeFromParent(),this._controls.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}reset(){const t=new O(1,0,0),e=new O;this.normal.equals(t)||(this.normal.copy(t),this._helper.lookAt(t)),this.origin.copy(e),this._helper.position.copy(e),this._helper.updateMatrix()}toggleControls(t){if(t){if(this._controlsActive)return;this._controls.addEventListener("change",this.update),this._controls.addEventListener("dragging-changed",this.changeDrag)}else this._controls.removeEventListener("change",this.update),this._controls.removeEventListener("dragging-changed",this.changeDrag);this._controlsActive=t}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const t=this.world.camera.three,e=this.world.renderer.three.domElement,s=new Oa(t,e);return this.initializeControls(s),this.world.scene.three.add(s),s}initializeControls(t){t.attach(this._helper),t.showX=!1,t.showY=!1,t.setSpace("local"),this.createArrowBoundingBox(),t.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new rt(.18,.18,1.2),this._arrowBoundBox.material=this._hiddenMaterial,this._arrowBoundBox.rotateX(Math.PI/2),this._arrowBoundBox.updateMatrix(),this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix)}notifyDraggingChanged(t){t.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const t=new Fs;return t.lookAt(this.normal),t.position.copy(this.origin),this._planeMesh.position.z+=.01,t.add(this._planeMesh),this.world.scene.three.add(t),t}static newPlaneMesh(t,e){const s=new Ri(1),i=new D(s,e);return i.scale.set(t,t,t),i}}const jn=class Ii extends q{constructor(t){super(t),I(this,"onAfterCreate",new M),I(this,"onAfterDelete",new M),I(this,"onBeforeDrag",new M),I(this,"onAfterDrag",new M),I(this,"onBeforeCreate",new M),I(this,"onBeforeCancel",new M),I(this,"onAfterCancel",new M),I(this,"onBeforeDelete",new M),I(this,"onDisposed",new M),I(this,"orthogonalY",!1),I(this,"toleranceOrthogonalY",.7),I(this,"Type",bi),I(this,"list",[]),I(this,"_material",new Te({color:12255487,side:ke,transparent:!0,opacity:.2})),I(this,"_size",5),I(this,"_enabled",!1),I(this,"_visible",!0),I(this,"_onStartDragging",()=>{this.onBeforeDrag.trigger()}),I(this,"_onEndDragging",()=>{this.onAfterDrag.trigger()}),this.components.add(Ii.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const e of this.list)e.enabled=t;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(t){this._visible=t;for(const e of this.list)e.visible=t}get material(){return this._material}set material(t){this._material=t;for(const e of this.list)e.planeMaterial=t}get size(){return this._size}set size(t){this._size=t;for(const e of this.list)e.size=t}dispose(){this._enabled=!1;for(const t of this.list)t.dispose();this.list.length=0,this._material.dispose(),this.onBeforeCreate.reset(),this.onBeforeCancel.reset(),this.onBeforeDelete.reset(),this.onBeforeDrag.reset(),this.onAfterCreate.reset(),this.onAfterCancel.reset(),this.onAfterDelete.reset(),this.onAfterDrag.reset(),this.onDisposed.trigger(Ii.uuid),this.onDisposed.reset()}create(t){if(!this.enabled)return;const e=this.components.get(Ei).get(t).castRay();e&&this.createPlaneFromIntersection(t,e)}createFromNormalAndCoplanarPoint(t,e,s){const i=this.newPlane(t,s,e);return this.updateMaterialsAndPlanes(),i}delete(t,e){this.enabled&&(e||(e=this.pickPlane(t)),e&&this.deletePlane(e))}deleteAll(){for(;this.list.length>0;){const t=this.list[0];this.delete(t.world,t)}}deletePlane(t){const e=this.list.indexOf(t);if(e!==-1){if(this.list.splice(e,1),!t.world.renderer)throw new Error("Renderer not found for this plane's world!");t.world.renderer.setPlane(!1,t.three),t.dispose(),this.updateMaterialsAndPlanes(),this.onAfterDelete.trigger(t)}}pickPlane(t){const e=this.components.get(Ei).get(t),s=this.getAllPlaneMeshes(),i=e.castRay(s);if(i){const n=i.object;return this.list.find(o=>o.meshes.includes(n))}}getAllPlaneMeshes(){const t=[];for(const e of this.list)t.push(...e.meshes);return t}createPlaneFromIntersection(t,e){var s;if(!t.renderer)throw new Error("The given world must have a renderer!");const i=e.point.distanceTo(new O(0,0,0)),n=(s=e.face)==null?void 0:s.normal;if(!i||!n)return;const o=this.getWorldNormal(e,n),r=this.newPlane(t,e.point,o.negate());r.visible=this._visible,r.size=this._size,t.renderer.setPlane(!0,r.three),this.updateMaterialsAndPlanes()}getWorldNormal(t,e){const s=t.object;let i=t.object.matrixWorld.clone();if(s instanceof Ge&&t.instanceId!==void 0){const r=new X;s.getMatrixAt(t.instanceId,r),i=r.multiply(i)}const n=new jt().getNormalMatrix(i),o=e.clone().applyMatrix3(n).normalize();return this.normalizePlaneDirectionY(o),o}normalizePlaneDirectionY(t){this.orthogonalY&&(t.y>this.toleranceOrthogonalY&&(t.x=0,t.y=1,t.z=0),t.y<-this.toleranceOrthogonalY&&(t.x=0,t.y=-1,t.z=0))}newPlane(t,e,s){const i=new this.Type(this.components,t,e,s,this._material);return i.onDraggingStarted.add(this._onStartDragging),i.onDraggingEnded.add(this._onEndDragging),this.list.push(i),this.onAfterCreate.trigger(i),i}updateMaterialsAndPlanes(){const t=this.components.get(Aa);for(const[e,s]of t.list){if(!s.renderer)continue;s.renderer.updateClippingPlanes();const{clippingPlanes:i}=s.renderer;for(const n of s.meshes)if(Array.isArray(n.material))for(const o of n.material)o.clippingPlanes=i;else n.material.clippingPlanes=i}}};I(jn,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let ih=jn;function Ma(h,t,e,s){return new Promise((i,n)=>{function o(){const r=h.clientWaitSync(t,e,0);if(r===h.WAIT_FAILED){n();return}if(r===h.TIMEOUT_EXPIRED){setTimeout(o,s);return}i()}o()})}async function Ua(h,t,e,s,i,n,o){const r=h.fenceSync(h.SYNC_GPU_COMMANDS_COMPLETE,0);h.flush(),await Ma(h,r,0,10),h.deleteSync(r),h.bindBuffer(t,e),h.getBufferSubData(t,s,i,n,o),h.bindBuffer(t,null)}async function Da(h,t,e,s,i,n,o,r){const a=h.createBuffer();return h.bindBuffer(h.PIXEL_PACK_BUFFER,a),h.bufferData(h.PIXEL_PACK_BUFFER,r.byteLength,h.STREAM_READ),h.readPixels(t,e,s,i,n,o,0),h.bindBuffer(h.PIXEL_PACK_BUFFER,null),await Ua(h,h.PIXEL_PACK_BUFFER,a,0,r),h.deleteBuffer(a),r}class xa{constructor(t,e,s){if(I(this,"onDisposed",new M),I(this,"onViewUpdated",new Kt),I(this,"enabled",!0),I(this,"needsUpdate",!1),I(this,"renderDebugFrame",!1),I(this,"components"),I(this,"world"),I(this,"renderer"),I(this,"autoUpdate",!0),I(this,"updateInterval",1e3),I(this,"worker"),I(this,"scene",new mi),I(this,"_width",512),I(this,"_height",512),I(this,"_availableColor",1),I(this,"renderTarget"),I(this,"bufferSize"),I(this,"_buffer"),I(this,"_isWorkerBusy",!1),I(this,"updateVisibility",async o=>{if(!this.enabled||!this.needsUpdate&&!o||this._isWorkerBusy)return;this._isWorkerBusy=!0;const r=this.world.camera.three;r.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,r);const a=this.renderer.getContext();await Da(a,0,0,this._width,this._height,a.RGBA,a.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,r),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1}),!e.renderer)throw new Error("The given world must have a renderer!");this.components=t,this.applySettings(s),this.world=e,this.renderer=new As,this.renderTarget=new Bo(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=e.renderer.clippingPlanes;const i=` + `,extensions:{derivatives:!0}});this.three=new D(a,c),this.three.frustumCulled=!1,e.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(t){t?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(t){this._fade=t?3:0,this.material.uniforms.uFade.value=this._fade}[Symbol.dispose](){throw new Error("Method not implemented.")}dispose(){this.setupEvents(!1),this.components.get(me).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(t){if(this.world.isDisposing||!(this.world.camera instanceof He))return;const e=this.world.camera.controls;t?e.addEventListener("update",this.updateZoom):e.removeEventListener("update",this.updateZoom)}}class ga extends q{constructor(){super(...arguments),I(this,"list",new Map),I(this,"onDisposed",new M),I(this,"config",{color:new qt(12303291),size1:1,size2:10,distance:500}),I(this,"enabled",!0)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a grid!");const e=new Fa(this.components,t,this.config);return this.list.set(t.uuid,e),t.onDisposed.add(()=>{this.delete(t)}),e}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}}I(ga,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");const Zt=new Ti,nt=new O,xt=new O,Q=new Rt,gn={X:new O(1,0,0),Y:new O(0,1,0),Z:new O(0,0,1)},$s={type:"change"},On={type:"mouseDown"},_n={type:"mouseUp",mode:null},Sn={type:"objectChange"};class Oa extends Fs{constructor(t,e){super(),e===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.isTransformControls=!0,this.visible=!1,this.domElement=e,this.domElement.style.touchAction="none";const s=new La;this._gizmo=s,this.add(s);const i=new Pa;this._plane=i,this.add(i);const n=this;function o(R,F){let p=F;Object.defineProperty(n,R,{get:function(){return p!==void 0?p:F},set:function(A){p!==A&&(p=A,i[R]=A,s[R]=A,n.dispatchEvent({type:R+"-changed",value:A}),n.dispatchEvent($s))}}),n[R]=F,i[R]=F,s[R]=F}o("camera",t),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const r=new O,a=new O,c=new Rt,d=new Rt,E=new O,l=new Rt,u=new O,T=new O,C=new O,f=0,m=new O;o("worldPosition",r),o("worldPositionStart",a),o("worldQuaternion",c),o("worldQuaternionStart",d),o("cameraPosition",E),o("cameraQuaternion",l),o("pointStart",u),o("pointEnd",T),o("rotationAxis",C),o("rotationAngle",f),o("eye",m),this._offset=new O,this._startNorm=new O,this._endNorm=new O,this._cameraScale=new O,this._parentPosition=new O,this._parentQuaternion=new Rt,this._parentQuaternionInv=new Rt,this._parentScale=new O,this._worldScaleStart=new O,this._worldQuaternionInv=new Rt,this._worldScale=new O,this._positionStart=new O,this._quaternionStart=new Rt,this._scaleStart=new O,this._getPointer=_a.bind(this),this._onPointerDown=Na.bind(this),this._onPointerHover=Sa.bind(this),this._onPointerMove=wa.bind(this),this._onPointerUp=ya.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(t){if(this.object===void 0||this.dragging===!0)return;Zt.setFromCamera(t,this.camera);const e=Js(this._gizmo.picker[this.mode],Zt);e?this.axis=e.object.name:this.axis=null}pointerDown(t){if(!(this.object===void 0||this.dragging===!0||t.button!==0)&&this.axis!==null){Zt.setFromCamera(t,this.camera);const e=Js(this._plane,Zt,!0);e&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,On.mode=this.mode,this.dispatchEvent(On)}}pointerMove(t){const e=this.axis,s=this.mode,i=this.object;let n=this.space;if(s==="scale"?n="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(n="world"),i===void 0||e===null||this.dragging===!1||t.button!==-1)return;Zt.setFromCamera(t,this.camera);const o=Js(this._plane,Zt,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),s==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),n==="local"&&e!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),e.indexOf("X")===-1&&(this._offset.x=0),e.indexOf("Y")===-1&&(this._offset.y=0),e.indexOf("Z")===-1&&(this._offset.z=0),n==="local"&&e!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(n==="local"&&(i.position.applyQuaternion(Q.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),n==="world"&&(i.parent&&i.position.add(nt.setFromMatrixPosition(i.parent.matrixWorld)),e.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(nt.setFromMatrixPosition(i.parent.matrixWorld))));else if(s==="scale"){if(e.search("XYZ")!==-1){let r=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(r*=-1),xt.set(r,r,r)}else nt.copy(this.pointStart),xt.copy(this.pointEnd),nt.applyQuaternion(this._worldQuaternionInv),xt.applyQuaternion(this._worldQuaternionInv),xt.divide(nt),e.search("X")===-1&&(xt.x=1),e.search("Y")===-1&&(xt.y=1),e.search("Z")===-1&&(xt.z=1);i.scale.copy(this._scaleStart).multiply(xt),this.scaleSnap&&(e.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(s==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const r=20/this.worldPosition.distanceTo(nt.setFromMatrixPosition(this.camera.matrixWorld));let a=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(nt.copy(this.rotationAxis).cross(this.eye))*r):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(gn[e]),nt.copy(gn[e]),n==="local"&&nt.applyQuaternion(this.worldQuaternion),nt.cross(this.eye),nt.length()===0?a=!0:this.rotationAngle=this._offset.dot(nt.normalize())*r),(e==="E"||a)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),n==="local"&&e!=="E"&&e!=="XYZE"?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(Q.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(Q.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent($s),this.dispatchEvent(Sn)}}pointerUp(t){t.button===0&&(this.dragging&&this.axis!==null&&(_n.mode=this.mode,this.dispatchEvent(_n)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(t){t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()})}attach(t){return this.object=t,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent($s),this.dispatchEvent(Sn),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Zt}getMode(){return this.mode}setMode(t){this.mode=t}setTranslationSnap(t){this.translationSnap=t}setRotationSnap(t){this.rotationSnap=t}setScaleSnap(t){this.scaleSnap=t}setSize(t){this.size=t}setSpace(t){this.space=t}}function _a(h){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:h.button};{const t=this.domElement.getBoundingClientRect();return{x:(h.clientX-t.left)/t.width*2-1,y:-(h.clientY-t.top)/t.height*2+1,button:h.button}}}function Sa(h){if(this.enabled)switch(h.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(h));break}}function Na(h){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(h.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(h)),this.pointerDown(this._getPointer(h)))}function wa(h){this.enabled&&this.pointerMove(this._getPointer(h))}function ya(h){this.enabled&&(this.domElement.releasePointerCapture(h.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(h)))}function Js(h,t,e){const s=t.intersectObject(h,!0);for(let i=0;i.9&&(n.visible=!1)),this.axis==="Y"&&(Q.setFromEuler(ps.set(0,0,Math.PI/2)),n.quaternion.copy(e).multiply(Q),Math.abs(k.copy(Qt).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Z"&&(Q.setFromEuler(ps.set(0,Math.PI/2,0)),n.quaternion.copy(e).multiply(Q),Math.abs(k.copy(Be).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="XYZE"&&(Q.setFromEuler(ps.set(0,Math.PI/2,0)),k.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(wn.lookAt(Nn,k,Qt)),n.quaternion.multiply(Q),n.visible=this.dragging),this.axis==="E"&&(n.visible=!1)):n.name==="START"?(n.position.copy(this.worldPositionStart),n.visible=this.dragging):n.name==="END"?(n.position.copy(this.worldPosition),n.visible=this.dragging):n.name==="DELTA"?(n.position.copy(this.worldPositionStart),n.quaternion.copy(this.worldQuaternionStart),nt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),nt.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(nt),n.visible=this.dragging):(n.quaternion.copy(e),this.dragging?n.position.copy(this.worldPositionStart):n.position.copy(this.worldPosition),this.axis&&(n.visible=this.axis.search(n.name)!==-1));continue}n.quaternion.copy(e),this.mode==="translate"||this.mode==="scale"?(n.name==="X"&&Math.abs(k.copy(ve).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Y"&&Math.abs(k.copy(Qt).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Z"&&Math.abs(k.copy(Be).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XY"&&Math.abs(k.copy(Be).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="YZ"&&Math.abs(k.copy(ve).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XZ"&&Math.abs(k.copy(Qt).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)):this.mode==="rotate"&&(Cs.copy(e),k.copy(this.eye).applyQuaternion(Q.copy(e).invert()),n.name.search("E")!==-1&&n.quaternion.setFromRotationMatrix(wn.lookAt(this.eye,Nn,Qt)),n.name==="X"&&(Q.setFromAxisAngle(ve,Math.atan2(-k.y,k.z)),Q.multiplyQuaternions(Cs,Q),n.quaternion.copy(Q)),n.name==="Y"&&(Q.setFromAxisAngle(Qt,Math.atan2(k.x,k.z)),Q.multiplyQuaternions(Cs,Q),n.quaternion.copy(Q)),n.name==="Z"&&(Q.setFromAxisAngle(Be,Math.atan2(k.y,k.x)),Q.multiplyQuaternions(Cs,Q),n.quaternion.copy(Q))),n.visible=n.visible&&(n.name.indexOf("X")===-1||this.showX),n.visible=n.visible&&(n.name.indexOf("Y")===-1||this.showY),n.visible=n.visible&&(n.name.indexOf("Z")===-1||this.showZ),n.visible=n.visible&&(n.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),n.material._color=n.material._color||n.material.color.clone(),n.material._opacity=n.material._opacity||n.material.opacity,n.material.color.copy(n.material._color),n.material.opacity=n.material._opacity,this.enabled&&this.axis&&(n.name===this.axis||this.axis.split("").some(function(r){return n.name===r}))&&(n.material.color.setHex(16776960),n.material.opacity=1)}super.updateMatrixWorld(t)}}class Pa extends D{constructor(){super(new Ri(1e5,1e5,2,2),new Te({visible:!1,wireframe:!0,side:ke,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(t){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),Ts.copy(ve).applyQuaternion(e==="local"?this.worldQuaternion:Rs),xe.copy(Qt).applyQuaternion(e==="local"?this.worldQuaternion:Rs),be.copy(Be).applyQuaternion(e==="local"?this.worldQuaternion:Rs),k.copy(xe),this.mode){case"translate":case"scale":switch(this.axis){case"X":k.copy(this.eye).cross(Ts),St.copy(Ts).cross(k);break;case"Y":k.copy(this.eye).cross(xe),St.copy(xe).cross(k);break;case"Z":k.copy(this.eye).cross(be),St.copy(be).cross(k);break;case"XY":St.copy(be);break;case"YZ":St.copy(Ts);break;case"XZ":k.copy(be),St.copy(xe);break;case"XYZ":case"E":St.set(0,0,0);break}break;case"rotate":default:St.set(0,0,0)}St.length()===0?this.quaternion.copy(this.cameraQuaternion):(yn.lookAt(nt.set(0,0,0),St,k),this.quaternion.setFromRotationMatrix(yn)),super.updateMatrixWorld(t)}}class bi{constructor(t,e,s,i,n,o=5,r=!0){if(I(this,"onDraggingStarted",new M),I(this,"onDraggingEnded",new M),I(this,"onDisposed",new M),I(this,"normal"),I(this,"origin"),I(this,"three",new fe),I(this,"_helper"),I(this,"_visible",!0),I(this,"_enabled",!0),I(this,"components"),I(this,"world"),I(this,"_controlsActive",!1),I(this,"_arrowBoundBox",new D),I(this,"_planeMesh"),I(this,"_controls"),I(this,"_hiddenMaterial",new Te({visible:!1})),I(this,"update",()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)}),I(this,"changeDrag",a=>{this._visible=!a.value,this.preventCameraMovement(),this.notifyDraggingChanged(a)}),this.components=t,this.world=e,!e.renderer)throw new Error("The given world must have a renderer!");this.normal=i,this.origin=s,e.renderer.setPlane(!0,this.three),this._planeMesh=bi.newPlaneMesh(o,n),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(i,s),r&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(t){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=t,this.world.renderer.setPlane(t,this.three)}get visible(){return this._visible}set visible(t){this._visible=t,this._controls.visible=t,this._helper.visible=t,this.toggleControls(t)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(t){this._planeMesh.material=t}get size(){return this._planeMesh.scale.x}set size(t){this._planeMesh.scale.set(t,t,t)}get helper(){return this._helper}setFromNormalAndCoplanarPoint(t,e){this.reset(),this.normal.equals(t)||(this.normal.copy(t),this._helper.lookAt(t)),this.origin.copy(e),this._helper.position.copy(e),this._helper.updateMatrix(),this.update()}dispose(){this._enabled=!1,this.onDraggingStarted.reset(),this.onDraggingEnded.reset(),this._helper.removeFromParent(),this.world.renderer&&this.world.renderer.setPlane(!1,this.three),this._arrowBoundBox.removeFromParent(),this._arrowBoundBox.geometry.dispose(),this._planeMesh.geometry.dispose(),this._controls.removeFromParent(),this._controls.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}reset(){const t=new O(1,0,0),e=new O;this.normal.equals(t)||(this.normal.copy(t),this._helper.lookAt(t)),this.origin.copy(e),this._helper.position.copy(e),this._helper.updateMatrix()}toggleControls(t){if(t){if(this._controlsActive)return;this._controls.addEventListener("change",this.update),this._controls.addEventListener("dragging-changed",this.changeDrag)}else this._controls.removeEventListener("change",this.update),this._controls.removeEventListener("dragging-changed",this.changeDrag);this._controlsActive=t}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const t=this.world.camera.three,e=this.world.renderer.three.domElement,s=new Oa(t,e);return this.initializeControls(s),this.world.scene.three.add(s),s}initializeControls(t){t.attach(this._helper),t.showX=!1,t.showY=!1,t.setSpace("local"),this.createArrowBoundingBox(),t.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new rt(.18,.18,1.2),this._arrowBoundBox.material=this._hiddenMaterial,this._arrowBoundBox.rotateX(Math.PI/2),this._arrowBoundBox.updateMatrix(),this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix)}notifyDraggingChanged(t){t.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const t=new Fs;return t.lookAt(this.normal),t.position.copy(this.origin),this._planeMesh.position.z+=.01,t.add(this._planeMesh),this.world.scene.three.add(t),t}static newPlaneMesh(t,e){const s=new Ri(1),i=new D(s,e);return i.scale.set(t,t,t),i}}const jn=class Ii extends q{constructor(t){super(t),I(this,"onAfterCreate",new M),I(this,"onAfterDelete",new M),I(this,"onBeforeDrag",new M),I(this,"onAfterDrag",new M),I(this,"onBeforeCreate",new M),I(this,"onBeforeCancel",new M),I(this,"onAfterCancel",new M),I(this,"onBeforeDelete",new M),I(this,"onDisposed",new M),I(this,"orthogonalY",!1),I(this,"toleranceOrthogonalY",.7),I(this,"Type",bi),I(this,"list",[]),I(this,"_material",new Te({color:12255487,side:ke,transparent:!0,opacity:.2})),I(this,"_size",5),I(this,"_enabled",!1),I(this,"_visible",!0),I(this,"_onStartDragging",()=>{this.onBeforeDrag.trigger()}),I(this,"_onEndDragging",()=>{this.onAfterDrag.trigger()}),this.components.add(Ii.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const e of this.list)e.enabled=t;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(t){this._visible=t;for(const e of this.list)e.visible=t}get material(){return this._material}set material(t){this._material=t;for(const e of this.list)e.planeMaterial=t}get size(){return this._size}set size(t){this._size=t;for(const e of this.list)e.size=t}dispose(){this._enabled=!1;for(const t of this.list)t.dispose();this.list.length=0,this._material.dispose(),this.onBeforeCreate.reset(),this.onBeforeCancel.reset(),this.onBeforeDelete.reset(),this.onBeforeDrag.reset(),this.onAfterCreate.reset(),this.onAfterCancel.reset(),this.onAfterDelete.reset(),this.onAfterDrag.reset(),this.onDisposed.trigger(Ii.uuid),this.onDisposed.reset()}create(t){if(!this.enabled)return;const e=this.components.get(Ei).get(t).castRay();e&&this.createPlaneFromIntersection(t,e)}createFromNormalAndCoplanarPoint(t,e,s){const i=this.newPlane(t,s,e);return this.updateMaterialsAndPlanes(),i}delete(t,e){this.enabled&&(e||(e=this.pickPlane(t)),e&&this.deletePlane(e))}deleteAll(){for(;this.list.length>0;){const t=this.list[0];this.delete(t.world,t)}}deletePlane(t){const e=this.list.indexOf(t);if(e!==-1){if(this.list.splice(e,1),!t.world.renderer)throw new Error("Renderer not found for this plane's world!");t.world.renderer.setPlane(!1,t.three),t.dispose(),this.updateMaterialsAndPlanes(),this.onAfterDelete.trigger(t)}}pickPlane(t){const e=this.components.get(Ei).get(t),s=this.getAllPlaneMeshes(),i=e.castRay(s);if(i){const n=i.object;return this.list.find(o=>o.meshes.includes(n))}}getAllPlaneMeshes(){const t=[];for(const e of this.list)t.push(...e.meshes);return t}createPlaneFromIntersection(t,e){var s;if(!t.renderer)throw new Error("The given world must have a renderer!");const i=e.point.distanceTo(new O(0,0,0)),n=(s=e.face)==null?void 0:s.normal;if(!i||!n)return;const o=this.getWorldNormal(e,n),r=this.newPlane(t,e.point,o.negate());r.visible=this._visible,r.size=this._size,t.renderer.setPlane(!0,r.three),this.updateMaterialsAndPlanes()}getWorldNormal(t,e){const s=t.object;let i=t.object.matrixWorld.clone();if(s instanceof Ge&&t.instanceId!==void 0){const r=new X;s.getMatrixAt(t.instanceId,r),i=r.multiply(i)}const n=new jt().getNormalMatrix(i),o=e.clone().applyMatrix3(n).normalize();return this.normalizePlaneDirectionY(o),o}normalizePlaneDirectionY(t){this.orthogonalY&&(t.y>this.toleranceOrthogonalY&&(t.x=0,t.y=1,t.z=0),t.y<-this.toleranceOrthogonalY&&(t.x=0,t.y=-1,t.z=0))}newPlane(t,e,s){const i=new this.Type(this.components,t,e,s,this._material);return i.onDraggingStarted.add(this._onStartDragging),i.onDraggingEnded.add(this._onEndDragging),this.list.push(i),this.onAfterCreate.trigger(i),i}updateMaterialsAndPlanes(){const t=this.components.get(Aa);for(const[e,s]of t.list){if(!s.renderer)continue;s.renderer.updateClippingPlanes();const{clippingPlanes:i}=s.renderer;for(const n of s.meshes)if(Array.isArray(n.material))for(const o of n.material)o.clippingPlanes=i;else n.material.clippingPlanes=i}}};I(jn,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let ih=jn;function Ma(h,t,e,s){return new Promise((i,n)=>{function o(){const r=h.clientWaitSync(t,e,0);if(r===h.WAIT_FAILED){n();return}if(r===h.TIMEOUT_EXPIRED){setTimeout(o,s);return}i()}o()})}async function Ua(h,t,e,s,i,n,o){const r=h.fenceSync(h.SYNC_GPU_COMMANDS_COMPLETE,0);h.flush(),await Ma(h,r,0,10),h.deleteSync(r),h.bindBuffer(t,e),h.getBufferSubData(t,s,i,n,o),h.bindBuffer(t,null)}async function Da(h,t,e,s,i,n,o,r){const a=h.createBuffer();return h.bindBuffer(h.PIXEL_PACK_BUFFER,a),h.bufferData(h.PIXEL_PACK_BUFFER,r.byteLength,h.STREAM_READ),h.readPixels(t,e,s,i,n,o,0),h.bindBuffer(h.PIXEL_PACK_BUFFER,null),await Ua(h,h.PIXEL_PACK_BUFFER,a,0,r),h.deleteBuffer(a),r}class xa{constructor(t,e,s){if(I(this,"onDisposed",new M),I(this,"onViewUpdated",new Kt),I(this,"enabled",!0),I(this,"needsUpdate",!1),I(this,"renderDebugFrame",!1),I(this,"components"),I(this,"world"),I(this,"renderer"),I(this,"autoUpdate",!0),I(this,"updateInterval",1e3),I(this,"worker"),I(this,"scene",new mi),I(this,"_width",512),I(this,"_height",512),I(this,"_availableColor",1),I(this,"renderTarget"),I(this,"bufferSize"),I(this,"_buffer"),I(this,"_isWorkerBusy",!1),I(this,"updateVisibility",async o=>{if(!this.enabled||!this.needsUpdate&&!o||this._isWorkerBusy)return;this._isWorkerBusy=!0;const r=this.world.camera.three;r.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,r);const a=this.renderer.getContext();await Da(a,0,0,this._width,this._height,a.RGBA,a.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,r),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1}),!e.renderer)throw new Error("The given world must have a renderer!");this.components=t,this.applySettings(s),this.world=e,this.renderer=new As,this.renderTarget=new Bo(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=e.renderer.clippingPlanes;const i=` addEventListener("message", (event) => { const { buffer } = event.data; const colors = new Map(); @@ -85,4 +85,4 @@ import{r as At,p as st,T as pe,z as Ti,E as go,a as X,V as O,f as Ft,P as fe,y a } postMessage({ colors }); }); - `,n=new Blob([i],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n))}dispose(){this.enabled=!1;for(const t of this.scene.children)t.removeFromParent();this.onViewUpdated.reset(),this.worker.terminate(),this.renderer.dispose(),this.renderTarget.dispose(),this._buffer=null,this.onDisposed.reset()}getAvailableColor(){let t=BigInt(this._availableColor.toString());const e=[];do e.unshift(Number(t%256n)),t/=256n;while(t);for(;e.length!==3;)e.unshift(0);const[s,i,n]=e,o=`${s}-${i}-${n}`;return{r:s,g:i,b:n,code:o}}increaseColor(){if(this._availableColor===256*256*256){console.warn("Color can't be increased over 256 x 256 x 256!");return}this._availableColor++}decreaseColor(){if(this._availableColor===1){console.warn("Color can't be decreased under 0!");return}this._availableColor--}applySettings(t){t&&(t.updateInterval!==void 0&&(this.updateInterval=t.updateInterval),t.height!==void 0&&(this._height=t.height),t.width!==void 0&&(this._width=t.width),t.autoUpdate!==void 0&&(this.autoUpdate=t.autoUpdate))}}class ba extends xa{constructor(t,e,s){super(t,e,s),I(this,"threshold",100),I(this,"onViewUpdated",new M),I(this,"colorMeshes",new Map),I(this,"isProcessing",!1),I(this,"_colorCodeMeshMap",new Map),I(this,"_meshIDColorCodeMap",new Map),I(this,"_currentVisibleMeshes",new Set),I(this,"_recentlyHiddenMeshes",new Set),I(this,"_intervalID",null),I(this,"_transparentMat",new Te({transparent:!0,opacity:0})),I(this,"handleWorkerMessage",async i=>{if(this.isProcessing)return;const n=i.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[o,r]of n){if(r{this.isProcessing||await this.updateVisibility()},this.updateInterval),this.onViewUpdated.add(({seen:i,unseen:n})=>{for(const o of i)o.visible=!0;for(const o of n)o.visible=!1})}dispose(){super.dispose(),this._intervalID!==null&&(window.clearInterval(this._intervalID),this._intervalID=null),this._currentVisibleMeshes.clear(),this._recentlyHiddenMeshes.clear(),this._meshIDColorCodeMap.clear(),this._transparentMat.dispose(),this._colorCodeMeshMap.clear();const t=this.components.get(me);for(const e in this.colorMeshes){const s=this.colorMeshes.get(e);s&&t.destroy(s,!0)}this.colorMeshes.clear()}add(t){if(!this.enabled)return;if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const e=t instanceof Ge,{geometry:s,material:i}=t,{colorMaterial:n,code:o}=this.getAvailableMaterial();let r;if(Array.isArray(i)){let d=!0;const E=[];for(const l of i)un.isTransparent(l)?E.push(this._transparentMat):(d=!1,E.push(n));if(d){n.dispose(),this.isProcessing=!1;return}r=E}else if(un.isTransparent(i)){n.dispose(),this.isProcessing=!1;return}else r=n;this._colorCodeMeshMap.set(o,t),this._meshIDColorCodeMap.set(t.uuid,o);const a=e?t.count:1,c=new Ge(s,r,a);e?c.instanceMatrix=t.instanceMatrix:c.setMatrixAt(0,new X),t.visible=!1,c.applyMatrix4(t.matrix),c.updateMatrix(),this.scene.add(c),this.colorMeshes.set(t.uuid,c),this.increaseColor(),this.isProcessing=!1}remove(t){if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const e=this.components.get(me);this._currentVisibleMeshes.delete(t),this._recentlyHiddenMeshes.delete(t);const s=this.colorMeshes.get(t.uuid),i=this._meshIDColorCodeMap.get(t.uuid);if(!s||!i){this.isProcessing=!1,console.log(t.visible);return}this._colorCodeMeshMap.delete(i),this._meshIDColorCodeMap.delete(t.uuid),this.colorMeshes.delete(t.uuid),s.geometry=void 0,s.material=[],e.destroy(s,!0),this._recentlyHiddenMeshes.delete(t),this._currentVisibleMeshes.delete(t),this.isProcessing=!1}getAvailableMaterial(){const{r:t,g:e,b:s,code:i}=this.getAvailableColor(),n=Ms.enabled;Ms.enabled=!1;const o=new qt(`rgb(${t}, ${e}, ${s})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const r=this.world.renderer.clippingPlanes,a=new Te({color:o,clippingPlanes:r,side:ke});return Ms.enabled=n,{colorMaterial:a,code:i}}}const qn=class ui extends q{constructor(t){super(t),I(this,"_enabled",!0),I(this,"list",new Map),I(this,"onDisposed",new M),t.add(ui.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const[e,s]of this.list)s.enabled=t}create(t,e){if(this.list.has(t.uuid))return this.list.get(t.uuid);const s=new ba(this.components,t,e);return this.list.set(t.uuid,s),s}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(ui.uuid),this.onDisposed.reset();for(const[t,e]of this.list)e.dispose();this.list.clear()}};I(qn,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let va=qn;class Ba{constructor(t){if(I(this,"onDisposed",new M),I(this,"onAfterUpdate",new M),I(this,"onBeforeUpdate",new M),I(this,"onResize",new M),I(this,"frontOffset",0),I(this,"overrideMaterial",new Yo),I(this,"backgroundColor",new qt(395274)),I(this,"renderer"),I(this,"enabled",!0),I(this,"world"),I(this,"_lockRotation",!0),I(this,"_camera"),I(this,"_plane"),I(this,"_size",new Ft(320,160)),I(this,"_tempVector1",new O),I(this,"_tempVector2",new O),I(this,"_tempTarget",new O),I(this,"down",new O(0,-1,0)),I(this,"updatePlanes",()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const i=[],n=this.world.renderer.three;for(const o of n.clippingPlanes)i.push(o);i.push(this._plane),this.renderer.clippingPlanes=i}),this.world=t,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new As,this.renderer.setSize(this._size.x,this._size.y);const e=1,s=this._size.x/this._size.y;this._camera=new fi(e*s/-2,e*s/2,e/2,e/-2),this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes),this._camera.position.set(0,200,0),this._camera.zoom=.1,this._camera.rotation.x=-Math.PI/2,this._plane=new fe(this.down,200),this.updatePlanes()}get lockRotation(){return this._lockRotation}set lockRotation(t){this._lockRotation=t,t&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(t){this._camera.zoom=t,this._camera.updateProjectionMatrix()}dispose(){this.enabled=!1,this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.onResize.reset(),this.overrideMaterial.dispose(),this.renderer.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return this._camera}update(){if(!this.enabled)return;this.onBeforeUpdate.trigger();const t=this.world.scene.three,e=this.world.camera;if(!e.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(t instanceof mi))throw new Error("The given world must have a THREE.Scene as a root!");const s=e.controls;if(s.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,this.frontOffset!==0&&(s.getTarget(this._tempVector2),this._tempVector2.sub(this._tempVector1),this._tempVector2.normalize().multiplyScalar(this.frontOffset),this._camera.position.x+=this._tempVector2.x,this._camera.position.z+=this._tempVector2.z),!this._lockRotation){s.getTarget(this._tempTarget);const n=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=n+Math.PI}this._plane.set(this.down,this._tempVector1.y);const i=t.background;t.background=this.backgroundColor,this.renderer.render(t,this._camera),t.background=i,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(t=this._size){this._size.copy(t),this.renderer.setSize(t.x,t.y);const e=t.x/t.y,s=1;this._camera.left=s*e/-2,this._camera.right=s*e/2,this._camera.top=s/2,this._camera.bottom=-s/2,this._camera.updateProjectionMatrix(),this.onResize.trigger(t)}}const Kn=class $n extends q{constructor(t){super(t),I(this,"onAfterUpdate",new M),I(this,"onBeforeUpdate",new M),I(this,"onDisposed",new M),I(this,"enabled",!0),I(this,"list",new Map),this.components.add($n.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a minimap!");const e=new Ba(t);return this.list.set(t.uuid,e),e}delete(t){const e=this.list.get(t);e&&e.dispose(),this.list.delete(t)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[t,e]of this.list)e.update()}};I(Kn,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let nh=Kn;class Ya{constructor(t){I(this,"enabled",!1),I(this,"id","FirstPerson"),this.camera=t}set(t){if(this.enabled=t,t){if(this.camera.projection.current!=="Perspective"){this.camera.set("Orbit");return}this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const t=this.camera.controls,e=new O;t.distance--,t.getPosition(e),t.minDistance=1,t.maxDistance=1,t.distance=1,t.moveTo(e.x,e.y,e.z),t.truckSpeed=50,t.mouseButtons.wheel=ot.ACTION.DOLLY,t.touches.two=ot.ACTION.TOUCH_ZOOM_TRUCK}}class za{constructor(t){I(this,"enabled",!0),I(this,"id","Orbit"),this.camera=t,this.activateOrbitControls()}set(t){this.enabled=t,t&&this.activateOrbitControls()}activateOrbitControls(){const t=this.camera.controls;t.minDistance=1,t.maxDistance=300;const e=new O;t.getPosition(e);const s=e.length();t.distance=s,t.truckSpeed=2;const{rotation:i}=this.camera.three,n=new O(0,0,-1).applyEuler(i),o=e.addScaledVector(n,s);t.moveTo(o.x,o.y,o.z)}}class Ga{constructor(t){I(this,"enabled",!1),I(this,"id","Plan"),I(this,"mouseAction1"),I(this,"mouseAction2"),I(this,"mouseInitialized",!1),I(this,"defaultAzimuthSpeed"),I(this,"defaultPolarSpeed"),this.camera=t,this.defaultAzimuthSpeed=t.controls.azimuthRotateSpeed,this.defaultPolarSpeed=t.controls.polarRotateSpeed}set(t){this.enabled=t;const e=this.camera.controls;e.azimuthRotateSpeed=t?0:this.defaultAzimuthSpeed,e.polarRotateSpeed=t?0:this.defaultPolarSpeed,this.mouseInitialized||(this.mouseAction1=e.touches.one,this.mouseAction2=e.touches.two,this.mouseInitialized=!0),t?(e.mouseButtons.left=ot.ACTION.TRUCK,e.touches.one=ot.ACTION.TOUCH_TRUCK,e.touches.two=ot.ACTION.TOUCH_ZOOM):(e.mouseButtons.left=ot.ACTION.ROTATE,e.touches.one=this.mouseAction1,e.touches.two=this.mouseAction2)}}class Va{constructor(t){I(this,"onChanged",new M),I(this,"current","Perspective"),I(this,"camera"),I(this,"_component"),I(this,"_previousDistance",-1),I(this,"matchOrthoDistanceEnabled",!1),this._component=t,this.camera=t.three}async set(t){this.current!==t&&(t==="Orthographic"?this.setOrthoCamera():await this.setPerspectiveCamera(),this.onChanged.trigger(this.camera))}async toggle(){const t=this.current==="Perspective"?"Orthographic":"Perspective";await this.set(t)}setOrthoCamera(){if(this._component.mode===null||this._component.mode.id==="FirstPerson")return;this._previousDistance=this._component.controls.distance,this._component.controls.distance=200;const t=this.getPerspectiveDims();if(!t)return;const{width:e,height:s}=t;this.setupOrthoCamera(s,e),this.camera=this._component.threeOrtho,this.current="Orthographic"}getPerspectiveDims(){const t=this._component.currentWorld;if(!t||!t.renderer)return null;const e=new O;this._component.threePersp.getWorldDirection(e);const s=new O;this._component.controls.getTarget(s);const i=s.clone().sub(this._component.threePersp.position).dot(e),n=t.renderer.getSize(),o=n.x/n.y,r=this._component.threePersp,a=i*2*Math.atan(r.fov*(Math.PI/180)/2);return{width:a*o,height:a}}setupOrthoCamera(t,e){this._component.controls.mouseButtons.wheel=ot.ACTION.ZOOM,this._component.controls.mouseButtons.middle=ot.ACTION.ZOOM;const s=this._component.threePersp,i=this._component.threeOrtho;i.zoom=1,i.left=e/-2,i.right=e/2,i.top=t/2,i.bottom=t/-2,i.updateProjectionMatrix(),i.position.copy(s.position),i.quaternion.copy(s.quaternion),this._component.controls.camera=i}getDistance(){const t=this._component.threePersp,e=this._component.threeOrtho;return(e.top-e.bottom)/e.zoom/(2*Math.atan(t.fov*(Math.PI/180)/2))}async setPerspectiveCamera(){this._component.controls.mouseButtons.wheel=ot.ACTION.DOLLY,this._component.controls.mouseButtons.middle=ot.ACTION.DOLLY;const t=this._component.threePersp,e=this._component.threeOrtho;t.position.copy(e.position),t.quaternion.copy(e.quaternion),this._component.controls.mouseButtons.wheel=ot.ACTION.DOLLY,this.matchOrthoDistanceEnabled?this._component.controls.distance=this.getDistance():this._component.controls.distance=this._previousDistance,await this._component.controls.zoomTo(1),t.updateProjectionMatrix(),this._component.controls.camera=t,this.camera=t,this.current="Perspective"}}class oh extends He{constructor(t){super(t),I(this,"_mode",null),I(this,"projection"),I(this,"threeOrtho"),I(this,"threePersp"),I(this,"_userInputButtons",{}),I(this,"_frustumSize",50),I(this,"_navigationModes",new Map),I(this,"previousSize",null),this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new Va(this),this.onAspectUpdated.add(()=>{this.setOrthoPerspCameraAspect()}),this.projection.onChanged.add(e=>{this.three=e,this.updateAspect()}),this.onWorldChanged.add(()=>{this._navigationModes.clear(),this._navigationModes.set("Orbit",new za(this)),this._navigationModes.set("FirstPerson",new Ya(this)),this._navigationModes.set("Plan",new Ga(this)),this._mode=this._navigationModes.get("Orbit"),this.mode.set(!0,{preventTargetAdjustment:!0}),this.currentWorld&&this.currentWorld.renderer&&(this.previousSize=this.currentWorld.renderer.getSize().clone())})}get mode(){if(!this._mode)throw new Error("Mode not found, camera not initialized");return this._mode}dispose(){super.dispose(),this.threeOrtho.removeFromParent()}set(t){if(this.mode!==null&&this.mode.id!==t){if(this.mode.set(!1),!this._navigationModes.has(t))throw new Error("The specified mode does not exist!");this._mode=this._navigationModes.get(t),this.mode.set(!0)}}async fit(t,e=1.5){if(!this.enabled)return;const s=Number.MAX_VALUE,i=Number.MIN_VALUE,n=new O(s,s,s),o=new O(i,i,i);for(const l of t){const u=new st().setFromObject(l);u.min.xo.x&&(o.x=u.max.x),u.max.y>o.y&&(o.y=u.max.y),u.max.z>o.z&&(o.z=u.max.z)}const r=new st(n,o),a=new O;r.getSize(a);const c=new O;r.getCenter(c);const d=Math.max(a.x,a.y,a.z)*e,E=new Os(c,d);await this.controls.fitToSphere(E,!0)}setUserInput(t){t?this.enableUserInput():this.disableUserInput()}disableUserInput(){this._userInputButtons.left=this.controls.mouseButtons.left,this._userInputButtons.right=this.controls.mouseButtons.right,this._userInputButtons.middle=this.controls.mouseButtons.middle,this._userInputButtons.wheel=this.controls.mouseButtons.wheel,this.controls.mouseButtons.left=0,this.controls.mouseButtons.right=0,this.controls.mouseButtons.middle=0,this.controls.mouseButtons.wheel=0}enableUserInput(){Object.keys(this._userInputButtons).length!==0&&(this.controls.mouseButtons.left=this._userInputButtons.left,this.controls.mouseButtons.right=this._userInputButtons.right,this.controls.mouseButtons.middle=this._userInputButtons.middle,this.controls.mouseButtons.wheel=this._userInputButtons.wheel)}newOrthoCamera(){const t=window.innerWidth/window.innerHeight;return new fi(this._frustumSize*t/-2,this._frustumSize*t/2,this._frustumSize/2,this._frustumSize/-2,.1,1e3)}setOrthoPerspCameraAspect(){if(!this.currentWorld||!this.currentWorld.renderer||!this.previousSize)return;const t=this.currentWorld.renderer.getSize(),e=this.threeOrtho.top,s=this.threeOrtho.right,i=t.y/this.previousSize.y,n=t.x/this.previousSize.x,o=e*i,r=s*n;this.threeOrtho.left=-r,this.threeOrtho.right=r,this.threeOrtho.top=o,this.threeOrtho.bottom=-o,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(t)}}const Jn=class Lt extends q{constructor(t){super(t),I(this,"enabled",!0),I(this,"onDisposed",new M),I(this,"_absoluteMin"),I(this,"_absoluteMax"),I(this,"_meshes",[]),this.components.add(Lt.uuid,this),this._absoluteMin=Lt.newBound(!0),this._absoluteMax=Lt.newBound(!1)}static getDimensions(t){const{min:e,max:s}=t,i=Math.abs(s.x-e.x),n=Math.abs(s.y-e.y),o=Math.abs(s.z-e.z),r=new O;return r.subVectors(s,e).divideScalar(2).add(e),{width:i,height:n,depth:o,center:r}}static newBound(t){const e=t?1:-1;return new O(e*Number.MAX_VALUE,e*Number.MAX_VALUE,e*Number.MAX_VALUE)}static getBounds(t,e,s){const i=s||this.newBound(!1),n=e||this.newBound(!0);for(const o of t)o.xi.x&&(i.x=o.x),o.y>i.y&&(i.y=o.y),o.z>i.z&&(i.z=o.z);return new st(e,s)}dispose(){const t=this.components.get(me);for(const e of this._meshes)t.destroy(e);this._meshes=[],this.onDisposed.trigger(Lt.uuid),this.onDisposed.reset()}get(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone();return new st(t,e)}getSphere(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone(),s=Math.abs((e.x-t.x)/2),i=Math.abs((e.y-t.y)/2),n=Math.abs((e.z-t.z)/2),o=new O(t.x+s,t.y+i,t.z+n),r=o.distanceTo(t);return new Os(o,r)}getMesh(){const t=new st(this._absoluteMin,this._absoluteMax),e=Lt.getDimensions(t),{width:s,height:i,depth:n,center:o}=e,r=new it(s,i,n),a=new D(r);return this._meshes.push(a),a.position.copy(o),a}reset(){this._absoluteMin=Lt.newBound(!0),this._absoluteMax=Lt.newBound(!1)}add(t){for(const e of t.items)this.addMesh(e.mesh)}addMesh(t,e){if(!t.geometry.index)return;const s=Lt.getFragmentBounds(t);t.updateMatrixWorld();const i=t.matrixWorld,n=new X,o=t instanceof Ge,r=new Set;if(e&&t instanceof Mo)for(const a of e){const c=t.fragment.getInstancesIDs(a);if(c)for(const d of c)r.add(d)}else r.add(0);for(const a of r){const c=s.min.clone(),d=s.max.clone();o&&(t.getMatrixAt(a,n),c.applyMatrix4(n),d.applyMatrix4(n)),c.applyMatrix4(i),d.applyMatrix4(i),c.xthis._absoluteMax.x&&(this._absoluteMax.x=c.x),c.y>this._absoluteMax.y&&(this._absoluteMax.y=c.y),c.z>this._absoluteMax.z&&(this._absoluteMax.z=c.z),d.x>this._absoluteMax.x&&(this._absoluteMax.x=d.x),d.y>this._absoluteMax.y&&(this._absoluteMax.y=d.y),d.z>this._absoluteMax.z&&(this._absoluteMax.z=d.z),d.xo.x&&(o.x=d),E>o.y&&(o.y=E),l>o.z&&(o.z=l)}return new st(n,o)}};I(Jn,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let rh=Jn;const vi=new Set([1123145078,574549367,1675464909,2059837836,3798115385,32440307,3125803723,3207858831,2740243338,2624227202,4240577450,3615266464,3724593414,220341763,477187591,1878645084,1300840506,3303107099,1607154358,1878645084,846575682,1351298697,2417041796,3049322572,3331915920,1416205885,776857604,3285139300,3958052878,2827736869,2732653382,673634403,3448662350,4142052618,2924175390,803316827,2556980723,1809719519,2205249479,807026263,3737207727,1660063152,2347385850,3940055652,2705031697,3732776249,2485617015,2611217952,1704287377,2937912522,2770003689,1281925730,1484403080,3448662350,4142052618,3800577675,4006246654,3590301190,1383045692,2775532180,2047409740,370225590,3593883385,2665983363,4124623270,812098782,3649129432,987898635,1105321065,3510044353,1635779807,2603310189,3406155212,1310608509,4261334040,2736907675,3649129432,1136057603,1260505505,4182860854,2713105998,2898889636,59481748,3749851601,3486308946,3150382593,1062206242,3264961684,15328376,1485152156,370225590,1981873012,2859738748,45288368,2614616156,2732653382,775493141,2147822146,2601014836,2629017746,1186437898,2367409068,1213902940,3632507154,3900360178,476780140,1472233963,2804161546,3008276851,738692330,374418227,315944413,3905492369,3570813810,2571569899,178912537,2294589976,1437953363,2133299955,572779678,3092502836,388784114,2624227202,1425443689,3057273783,2347385850,1682466193,2519244187,2839578677,3958567839,2513912981,2830218821,427810014]),to=class eo extends q{constructor(t){super(t),I(this,"enabled",!0),t.add(eo.uuid,this)}async export(t,e,s=!1,i=!0){const n={},o=new Set(t.GetIfcEntityList(e)),r=new Set([Si,Ni,wi,yi,$t]);for(const a of r)o.add(a);for(const a of o){if(vi.has(a))continue;const c=r.has(a)&&i,d=t.GetLineIDsWithType(e,a);for(const E of d){const l=t.GetLine(0,E,c,s);n[l.expressID]=l}}return n}};I(to,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let Ha=to;const so=class io extends q{constructor(t){super(t),I(this,"onDisposed",new M),I(this,"onFragmentsLoaded",new M),I(this,"onFragmentsDisposed",new M),I(this,"list",new Map),I(this,"groups",new Map),I(this,"enabled",!0),I(this,"baseCoordinationModel",""),I(this,"_loader",new Pn),this.components.add(io.uuid,this)}get meshes(){const t=[];for(const[e,s]of this.list)t.push(s.mesh);return t}dispose(){for(const[t,e]of this.groups)e.dispose(!0);this.baseCoordinationModel="",this.groups.clear(),this.list.clear(),this.onFragmentsLoaded.reset(),this.onFragmentsDisposed.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}disposeGroup(t){const{uuid:e}=t,s=[];for(const i of t.items)s.push(i.id),this.list.delete(i.id);t.dispose(!0),this.groups.delete(t.uuid),this.onFragmentsDisposed.trigger({groupID:e,fragmentIDs:s})}load(t,e){const s={coordinate:!0,...e},{coordinate:i,properties:n,relationsMap:o}=s,r=this._loader.import(t);for(const a of r.items)a.group=r,this.list.set(a.id,a);return i&&this.coordinate([r]),this.groups.set(r.uuid,r),n&&r.setLocalProperties(n),o&&this.components.get(Bi).setRelationMap(r,o),this.onFragmentsLoaded.trigger(r),r}export(t){return this._loader.export(t)}coordinate(t=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const s=t.pop();if(!s)return;this.baseCoordinationModel=s.uuid}if(!t.length)return;const e=this.groups.get(this.baseCoordinationModel);if(!e){console.log("No base model found for coordination!");return}for(const s of t)s!==e&&(s.position.set(0,0,0),s.rotation.set(0,0,0),s.scale.set(1,1,1),s.updateMatrix(),s.applyMatrix4(s.coordinationMatrix.clone().invert()),s.applyMatrix4(e.coordinationMatrix))}};I(so,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let wt=so;const no={950732822:"IFCURIREFERENCE",4075327185:"IFCTIME",1209108979:"IFCTEMPERATURERATEOFCHANGEMEASURE",3457685358:"IFCSOUNDPRESSURELEVELMEASURE",4157543285:"IFCSOUNDPOWERLEVELMEASURE",2798247006:"IFCPROPERTYSETDEFINITIONSET",1790229001:"IFCPOSITIVEINTEGER",525895558:"IFCNONNEGATIVELENGTHMEASURE",1774176899:"IFCLINEINDEX",1275358634:"IFCLANGUAGEID",2541165894:"IFCDURATION",3701338814:"IFCDAYINWEEKNUMBER",2195413836:"IFCDATETIME",937566702:"IFCDATE",1683019596:"IFCCARDINALPOINTREFERENCE",2314439260:"IFCBINARY",1500781891:"IFCAREADENSITYMEASURE",3683503648:"IFCARCINDEX",4065007721:"IFCYEARNUMBER",1718600412:"IFCWARPINGMOMENTMEASURE",51269191:"IFCWARPINGCONSTANTMEASURE",2593997549:"IFCVOLUMETRICFLOWRATEMEASURE",3458127941:"IFCVOLUMEMEASURE",3345633955:"IFCVAPORPERMEABILITYMEASURE",1278329552:"IFCTORQUEMEASURE",2591213694:"IFCTIMESTAMP",2726807636:"IFCTIMEMEASURE",743184107:"IFCTHERMODYNAMICTEMPERATUREMEASURE",2016195849:"IFCTHERMALTRANSMITTANCEMEASURE",857959152:"IFCTHERMALRESISTANCEMEASURE",2281867870:"IFCTHERMALEXPANSIONCOEFFICIENTMEASURE",2645777649:"IFCTHERMALCONDUCTIVITYMEASURE",232962298:"IFCTHERMALADMITTANCEMEASURE",296282323:"IFCTEXTTRANSFORMATION",603696268:"IFCTEXTFONTNAME",3490877962:"IFCTEXTDECORATION",1460886941:"IFCTEXTALIGNMENT",2801250643:"IFCTEXT",58845555:"IFCTEMPERATUREGRADIENTMEASURE",361837227:"IFCSPECULARROUGHNESS",2757832317:"IFCSPECULAREXPONENT",3477203348:"IFCSPECIFICHEATCAPACITYMEASURE",993287707:"IFCSOUNDPRESSUREMEASURE",846465480:"IFCSOUNDPOWERMEASURE",3471399674:"IFCSOLIDANGLEMEASURE",408310005:"IFCSHEARMODULUSMEASURE",2190458107:"IFCSECTIONALAREAINTEGRALMEASURE",3467162246:"IFCSECTIONMODULUSMEASURE",2766185779:"IFCSECONDINMINUTE",3211557302:"IFCROTATIONALSTIFFNESSMEASURE",1755127002:"IFCROTATIONALMASSMEASURE",2133746277:"IFCROTATIONALFREQUENCYMEASURE",200335297:"IFCREAL",96294661:"IFCRATIOMEASURE",3972513137:"IFCRADIOACTIVITYMEASURE",3665567075:"IFCPRESSUREMEASURE",2169031380:"IFCPRESENTABLETEXT",1364037233:"IFCPOWERMEASURE",1245737093:"IFCPOSITIVERATIOMEASURE",3054510233:"IFCPOSITIVEPLANEANGLEMEASURE",2815919920:"IFCPOSITIVELENGTHMEASURE",4042175685:"IFCPLANEANGLEMEASURE",2642773653:"IFCPLANARFORCEMEASURE",2260317790:"IFCPARAMETERVALUE",929793134:"IFCPHMEASURE",2395907400:"IFCNUMERICMEASURE",2095195183:"IFCNORMALISEDRATIOMEASURE",765770214:"IFCMONTHINYEARNUMBER",2615040989:"IFCMONETARYMEASURE",3114022597:"IFCMOMENTOFINERTIAMEASURE",1648970520:"IFCMOLECULARWEIGHTMEASURE",3177669450:"IFCMOISTUREDIFFUSIVITYMEASURE",1753493141:"IFCMODULUSOFSUBGRADEREACTIONMEASURE",1052454078:"IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE",2173214787:"IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE",3341486342:"IFCMODULUSOFELASTICITYMEASURE",102610177:"IFCMINUTEINHOUR",3531705166:"IFCMASSPERLENGTHMEASURE",3124614049:"IFCMASSMEASURE",4017473158:"IFCMASSFLOWRATEMEASURE",1477762836:"IFCMASSDENSITYMEASURE",2486716878:"IFCMAGNETICFLUXMEASURE",286949696:"IFCMAGNETICFLUXDENSITYMEASURE",151039812:"IFCLUMINOUSINTENSITYMEASURE",2755797622:"IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE",2095003142:"IFCLUMINOUSFLUXMEASURE",503418787:"IFCLOGICAL",3086160713:"IFCLINEARVELOCITYMEASURE",1307019551:"IFCLINEARSTIFFNESSMEASURE",2128979029:"IFCLINEARMOMENTMEASURE",191860431:"IFCLINEARFORCEMEASURE",1243674935:"IFCLENGTHMEASURE",3258342251:"IFCLABEL",2054016361:"IFCKINEMATICVISCOSITYMEASURE",3192672207:"IFCISOTHERMALMOISTURECAPACITYMEASURE",3686016028:"IFCIONCONCENTRATIONMEASURE",3809634241:"IFCINTEGERCOUNTRATEMEASURE",1939436016:"IFCINTEGER",2679005408:"IFCINDUCTANCEMEASURE",3358199106:"IFCILLUMINANCEMEASURE",983778844:"IFCIDENTIFIER",2589826445:"IFCHOURINDAY",1158859006:"IFCHEATINGVALUEMEASURE",3113092358:"IFCHEATFLUXDENSITYMEASURE",3064340077:"IFCGLOBALLYUNIQUEID",3044325142:"IFCFREQUENCYMEASURE",1361398929:"IFCFORCEMEASURE",2590844177:"IFCFONTWEIGHT",2715512545:"IFCFONTVARIANT",1102727119:"IFCFONTSTYLE",2078135608:"IFCENERGYMEASURE",2506197118:"IFCELECTRICVOLTAGEMEASURE",2951915441:"IFCELECTRICRESISTANCEMEASURE",3790457270:"IFCELECTRICCURRENTMEASURE",2093906313:"IFCELECTRICCONDUCTANCEMEASURE",3818826038:"IFCELECTRICCHARGEMEASURE",1827137117:"IFCELECTRICCAPACITANCEMEASURE",69416015:"IFCDYNAMICVISCOSITYMEASURE",524656162:"IFCDOSEEQUIVALENTMEASURE",4134073009:"IFCDIMENSIONCOUNT",1514641115:"IFCDESCRIPTIVEMEASURE",300323983:"IFCDAYLIGHTSAVINGHOUR",86635668:"IFCDAYINMONTHNUMBER",94842927:"IFCCURVATUREMEASURE",1778710042:"IFCCOUNTMEASURE",3238673880:"IFCCONTEXTDEPENDENTMEASURE",3812528620:"IFCCOMPOUNDPLANEANGLEMEASURE",2991860651:"IFCCOMPLEXNUMBER",1867003952:"IFCBOXALIGNMENT",2735952531:"IFCBOOLEAN",2650437152:"IFCAREAMEASURE",632304761:"IFCANGULARVELOCITYMEASURE",360377573:"IFCAMOUNTOFSUBSTANCEMEASURE",4182062534:"IFCACCELERATIONMEASURE",3699917729:"IFCABSORBEDDOSEMEASURE",1971632696:"IFCGEOSLICE",2680139844:"IFCGEOMODEL",24726584:"IFCELECTRICFLOWTREATMENTDEVICE",3693000487:"IFCDISTRIBUTIONBOARD",3460952963:"IFCCONVEYORSEGMENT",3999819293:"IFCCAISSONFOUNDATION",3314249567:"IFCBOREHOLE",4196446775:"IFCBEARING",325726236:"IFCALIGNMENT",3425753595:"IFCTRACKELEMENT",991950508:"IFCSIGNAL",3798194928:"IFCREINFORCEDSOIL",3290496277:"IFCRAIL",1383356374:"IFCPAVEMENT",2182337498:"IFCNAVIGATIONELEMENT",234836483:"IFCMOORINGDEVICE",2078563270:"IFCMOBILETELECOMMUNICATIONSAPPLIANCE",1638804497:"IFCLIQUIDTERMINAL",1154579445:"IFCLINEARPOSITIONINGELEMENT",2696325953:"IFCKERB",2713699986:"IFCGEOTECHNICALASSEMBLY",2142170206:"IFCELECTRICFLOWTREATMENTDEVICETYPE",3376911765:"IFCEARTHWORKSFILL",1077100507:"IFCEARTHWORKSELEMENT",3071239417:"IFCEARTHWORKSCUT",479945903:"IFCDISTRIBUTIONBOARDTYPE",3426335179:"IFCDEEPFOUNDATION",1502416096:"IFCCOURSE",2940368186:"IFCCONVEYORSEGMENTTYPE",3203706013:"IFCCAISSONFOUNDATIONTYPE",3862327254:"IFCBUILTSYSTEM",1876633798:"IFCBUILTELEMENT",963979645:"IFCBRIDGEPART",644574406:"IFCBRIDGE",3649138523:"IFCBEARINGTYPE",1662888072:"IFCALIGNMENTVERTICAL",317615605:"IFCALIGNMENTSEGMENT",1545765605:"IFCALIGNMENTHORIZONTAL",4266260250:"IFCALIGNMENTCANT",3956297820:"IFCVIBRATIONDAMPERTYPE",1530820697:"IFCVIBRATIONDAMPER",840318589:"IFCVEHICLE",1953115116:"IFCTRANSPORTATIONDEVICE",618700268:"IFCTRACKELEMENTTYPE",2281632017:"IFCTENDONCONDUITTYPE",3663046924:"IFCTENDONCONDUIT",42703149:"IFCSINESPIRAL",1894708472:"IFCSIGNALTYPE",3599934289:"IFCSIGNTYPE",33720170:"IFCSIGN",1027922057:"IFCSEVENTHORDERPOLYNOMIALSPIRAL",544395925:"IFCSEGMENTEDREFERENCECURVE",3649235739:"IFCSECONDORDERPOLYNOMIALSPIRAL",550521510:"IFCROADPART",146592293:"IFCROAD",3818125796:"IFCRELADHERESTOELEMENT",4021432810:"IFCREFERENT",1891881377:"IFCRAILWAYPART",3992365140:"IFCRAILWAY",1763565496:"IFCRAILTYPE",1946335990:"IFCPOSITIONINGELEMENT",514975943:"IFCPAVEMENTTYPE",506776471:"IFCNAVIGATIONELEMENTTYPE",710110818:"IFCMOORINGDEVICETYPE",1950438474:"IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE",976884017:"IFCMARINEPART",525669439:"IFCMARINEFACILITY",1770583370:"IFCLIQUIDTERMINALTYPE",2176059722:"IFCLINEARELEMENT",679976338:"IFCKERBTYPE",3948183225:"IFCIMPACTPROTECTIONDEVICETYPE",2568555532:"IFCIMPACTPROTECTIONDEVICE",2898700619:"IFCGRADIENTCURVE",1594536857:"IFCGEOTECHNICALSTRATUM",4230923436:"IFCGEOTECHNICALELEMENT",4228831410:"IFCFACILITYPARTCOMMON",1310830890:"IFCFACILITYPART",24185140:"IFCFACILITY",4234616927:"IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID",1306400036:"IFCDEEPFOUNDATIONTYPE",4189326743:"IFCCOURSETYPE",2000195564:"IFCCOSINESPIRAL",3497074424:"IFCCLOTHOID",1626504194:"IFCBUILTELEMENTTYPE",3651464721:"IFCVEHICLETYPE",1229763772:"IFCTRIANGULATEDIRREGULARNETWORK",3665877780:"IFCTRANSPORTATIONDEVICETYPE",782932809:"IFCTHIRDORDERPOLYNOMIALSPIRAL",2735484536:"IFCSPIRAL",1356537516:"IFCSECTIONEDSURFACE",1290935644:"IFCSECTIONEDSOLIDHORIZONTAL",1862484736:"IFCSECTIONEDSOLID",1441486842:"IFCRELPOSITIONS",1033248425:"IFCRELASSOCIATESPROFILEDEF",3381221214:"IFCPOLYNOMIALCURVE",2485787929:"IFCOFFSETCURVEBYDISTANCES",590820931:"IFCOFFSETCURVE",3465909080:"IFCINDEXEDPOLYGONALTEXTUREMAP",593015953:"IFCDIRECTRIXCURVESWEPTAREASOLID",4212018352:"IFCCURVESEGMENT",3425423356:"IFCAXIS2PLACEMENTLINEAR",823603102:"IFCSEGMENT",2165702409:"IFCPOINTBYDISTANCEEXPRESSION",182550632:"IFCOPENCROSSPROFILEDEF",388784114:"IFCLINEARPLACEMENT",536804194:"IFCALIGNMENTHORIZONTALSEGMENT",3752311538:"IFCALIGNMENTCANTSEGMENT",1010789467:"IFCTEXTURECOORDINATEINDICESWITHVOIDS",222769930:"IFCTEXTURECOORDINATEINDICES",2691318326:"IFCQUANTITYNUMBER",3633395639:"IFCALIGNMENTVERTICALSEGMENT",2879124712:"IFCALIGNMENTPARAMETERSEGMENT",25142252:"IFCCONTROLLER",3087945054:"IFCALARM",4288193352:"IFCACTUATOR",630975310:"IFCUNITARYCONTROLELEMENT",4086658281:"IFCSENSOR",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",182646315:"IFCFLOWINSTRUMENT",1426591983:"IFCFIRESUPPRESSIONTERMINAL",819412036:"IFCFILTER",3415622556:"IFCFAN",1003880860:"IFCELECTRICTIMECONTROL",402227799:"IFCELECTRICMOTOR",264262732:"IFCELECTRICGENERATOR",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",862014818:"IFCELECTRICDISTRIBUTIONBOARD",1904799276:"IFCELECTRICAPPLIANCE",1360408905:"IFCDUCTSILENCER",3518393246:"IFCDUCTSEGMENT",342316401:"IFCDUCTFITTING",562808652:"IFCDISTRIBUTIONCIRCUIT",4074379575:"IFCDAMPER",3640358203:"IFCCOOLINGTOWER",4136498852:"IFCCOOLEDBEAM",2272882330:"IFCCONDENSER",3571504051:"IFCCOMPRESSOR",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",639361253:"IFCCOIL",3902619387:"IFCCHILLER",4217484030:"IFCCABLESEGMENT",1051757585:"IFCCABLEFITTING",3758799889:"IFCCABLECARRIERSEGMENT",635142910:"IFCCABLECARRIERFITTING",2938176219:"IFCBURNER",32344328:"IFCBOILER",2906023776:"IFCBEAMSTANDARDCASE",277319702:"IFCAUDIOVISUALAPPLIANCE",2056796094:"IFCAIRTOAIRHEATRECOVERY",177149247:"IFCAIRTERMINALBOX",1634111441:"IFCAIRTERMINAL",486154966:"IFCWINDOWSTANDARDCASE",4237592921:"IFCWASTETERMINAL",4156078855:"IFCWALLELEMENTEDCASE",4207607924:"IFCVALVE",4292641817:"IFCUNITARYEQUIPMENT",3179687236:"IFCUNITARYCONTROLELEMENTTYPE",3026737570:"IFCTUBEBUNDLE",3825984169:"IFCTRANSFORMER",812556717:"IFCTANK",1162798199:"IFCSWITCHINGDEVICE",385403989:"IFCSTRUCTURALLOADCASE",1404847402:"IFCSTACKTERMINAL",1999602285:"IFCSPACEHEATER",3420628829:"IFCSOLARDEVICE",3027962421:"IFCSLABSTANDARDCASE",3127900445:"IFCSLABELEMENTEDCASE",1329646415:"IFCSHADINGDEVICE",3053780830:"IFCSANITARYTERMINAL",2572171363:"IFCREINFORCINGBARTYPE",1232101972:"IFCRATIONALBSPLINECURVEWITHKNOTS",90941305:"IFCPUMP",655969474:"IFCPROTECTIVEDEVICETRIPPINGUNITTYPE",738039164:"IFCPROTECTIVEDEVICE",1156407060:"IFCPLATESTANDARDCASE",3612865200:"IFCPIPESEGMENT",310824031:"IFCPIPEFITTING",3694346114:"IFCOUTLET",144952367:"IFCOUTERBOUNDARYCURVE",2474470126:"IFCMOTORCONNECTION",1911478936:"IFCMEMBERSTANDARDCASE",1437502449:"IFCMEDICALDEVICE",629592764:"IFCLIGHTFIXTURE",76236018:"IFCLAMP",2176052936:"IFCJUNCTIONBOX",4175244083:"IFCINTERCEPTOR",2068733104:"IFCHUMIDIFIER",3319311131:"IFCHEATEXCHANGER",2188021234:"IFCFLOWMETER",1209101575:"IFCEXTERNALSPATIALELEMENT",484807127:"IFCEVAPORATOR",3747195512:"IFCEVAPORATIVECOOLER",2814081492:"IFCENGINE",2417008758:"IFCELECTRICDISTRIBUTIONBOARDTYPE",3242481149:"IFCDOORSTANDARDCASE",3205830791:"IFCDISTRIBUTIONSYSTEM",400855858:"IFCCOMMUNICATIONSAPPLIANCETYPE",905975707:"IFCCOLUMNSTANDARDCASE",1677625105:"IFCCIVILELEMENT",3296154744:"IFCCHIMNEY",2674252688:"IFCCABLEFITTINGTYPE",2188180465:"IFCBURNERTYPE",1177604601:"IFCBUILDINGSYSTEM",39481116:"IFCBUILDINGELEMENTPARTTYPE",1136057603:"IFCBOUNDARYCURVE",2461110595:"IFCBSPLINECURVEWITHKNOTS",1532957894:"IFCAUDIOVISUALAPPLIANCETYPE",4088093105:"IFCWORKCALENDAR",4009809668:"IFCWINDOWTYPE",926996030:"IFCVOIDINGFEATURE",2391383451:"IFCVIBRATIONISOLATOR",2415094496:"IFCTENDONTYPE",3081323446:"IFCTENDONANCHORTYPE",413509423:"IFCSYSTEMFURNITUREELEMENT",3101698114:"IFCSURFACEFEATURE",3657597509:"IFCSTRUCTURALSURFACEACTION",2757150158:"IFCSTRUCTURALCURVEREACTION",1004757350:"IFCSTRUCTURALCURVEACTION",338393293:"IFCSTAIRTYPE",1072016465:"IFCSOLARDEVICETYPE",4074543187:"IFCSHADINGDEVICETYPE",2157484638:"IFCSEAMCURVE",2781568857:"IFCROOFTYPE",2310774935:"IFCREINFORCINGMESHTYPE",964333572:"IFCREINFORCINGELEMENTTYPE",683857671:"IFCRATIONALBSPLINESURFACEWITHKNOTS",1469900589:"IFCRAMPTYPE",2839578677:"IFCPOLYGONALFACESET",1158309216:"IFCPILETYPE",3079942009:"IFCOPENINGSTANDARDCASE",1114901282:"IFCMEDICALDEVICETYPE",3113134337:"IFCINTERSECTIONCURVE",3946677679:"IFCINTERCEPTORTYPE",2571569899:"IFCINDEXEDPOLYCURVE",3493046030:"IFCGEOGRAPHICELEMENT",1509553395:"IFCFURNITURE",1893162501:"IFCFOOTINGTYPE",2853485674:"IFCEXTERNALSPATIALSTRUCTUREELEMENT",4148101412:"IFCEVENT",132023988:"IFCENGINETYPE",2397081782:"IFCELEMENTASSEMBLYTYPE",2323601079:"IFCDOORTYPE",1213902940:"IFCCYLINDRICALSURFACE",1525564444:"IFCCONSTRUCTIONPRODUCTRESOURCETYPE",4105962743:"IFCCONSTRUCTIONMATERIALRESOURCETYPE",2185764099:"IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE",15328376:"IFCCOMPOSITECURVEONSURFACE",3875453745:"IFCCOMPLEXPROPERTYTEMPLATE",3893394355:"IFCCIVILELEMENTTYPE",2197970202:"IFCCHIMNEYTYPE",167062518:"IFCBSPLINESURFACEWITHKNOTS",2887950389:"IFCBSPLINESURFACE",2603310189:"IFCADVANCEDBREPWITHVOIDS",1635779807:"IFCADVANCEDBREP",2916149573:"IFCTRIANGULATEDFACESET",1935646853:"IFCTOROIDALSURFACE",2387106220:"IFCTESSELLATEDFACESET",3206491090:"IFCTASKTYPE",699246055:"IFCSURFACECURVE",4095615324:"IFCSUBCONTRACTRESOURCETYPE",603775116:"IFCSTRUCTURALSURFACEREACTION",4015995234:"IFCSPHERICALSURFACE",2481509218:"IFCSPATIALZONETYPE",463610769:"IFCSPATIALZONE",710998568:"IFCSPATIALELEMENTTYPE",1412071761:"IFCSPATIALELEMENT",3663146110:"IFCSIMPLEPROPERTYTEMPLATE",3243963512:"IFCREVOLVEDAREASOLIDTAPERED",816062949:"IFCREPARAMETRISEDCOMPOSITECURVESEGMENT",1521410863:"IFCRELSPACEBOUNDARY2NDLEVEL",3523091289:"IFCRELSPACEBOUNDARY1STLEVEL",427948657:"IFCRELINTERFERESELEMENTS",307848117:"IFCRELDEFINESBYTEMPLATE",1462361463:"IFCRELDEFINESBYOBJECT",2565941209:"IFCRELDECLARES",1027710054:"IFCRELASSIGNSTOGROUPBYFACTOR",3521284610:"IFCPROPERTYTEMPLATE",492091185:"IFCPROPERTYSETTEMPLATE",653396225:"IFCPROJECTLIBRARY",569719735:"IFCPROCEDURETYPE",3967405729:"IFCPREDEFINEDPROPERTYSET",1682466193:"IFCPCURVE",428585644:"IFCLABORRESOURCETYPE",2294589976:"IFCINDEXEDPOLYGONALFACEWITHVOIDS",178912537:"IFCINDEXEDPOLYGONALFACE",4095422895:"IFCGEOGRAPHICELEMENTTYPE",2652556860:"IFCFIXEDREFERENCESWEPTAREASOLID",2804161546:"IFCEXTRUDEDAREASOLIDTAPERED",4024345920:"IFCEVENTTYPE",2629017746:"IFCCURVEBOUNDEDSURFACE",1815067380:"IFCCREWRESOURCETYPE",3419103109:"IFCCONTEXT",2574617495:"IFCCONSTRUCTIONRESOURCETYPE",2059837836:"IFCCARTESIANPOINTLIST3D",1675464909:"IFCCARTESIANPOINTLIST2D",574549367:"IFCCARTESIANPOINTLIST",3406155212:"IFCADVANCEDFACE",3698973494:"IFCTYPERESOURCE",3736923433:"IFCTYPEPROCESS",901063453:"IFCTESSELLATEDITEM",1096409881:"IFCSWEPTDISKSOLIDPOLYGONAL",1042787934:"IFCRESOURCETIME",1608871552:"IFCRESOURCECONSTRAINTRELATIONSHIP",2943643501:"IFCRESOURCEAPPROVALRELATIONSHIP",2090586900:"IFCQUANTITYSET",1482703590:"IFCPROPERTYTEMPLATEDEFINITION",3778827333:"IFCPREDEFINEDPROPERTIES",2998442950:"IFCMIRROREDPROFILEDEF",853536259:"IFCMATERIALRELATIONSHIP",3404854881:"IFCMATERIALPROFILESETUSAGETAPERING",3079605661:"IFCMATERIALPROFILESETUSAGE",2852063980:"IFCMATERIALCONSTITUENTSET",3708119e3:"IFCMATERIALCONSTITUENT",1585845231:"IFCLAGTIME",2133299955:"IFCINDEXEDTRIANGLETEXTUREMAP",1437953363:"IFCINDEXEDTEXTUREMAP",3570813810:"IFCINDEXEDCOLOURMAP",1437805879:"IFCEXTERNALREFERENCERELATIONSHIP",297599258:"IFCEXTENDEDPROPERTIES",211053100:"IFCEVENTTIME",2713554722:"IFCCONVERSIONBASEDUNITWITHOFFSET",3285139300:"IFCCOLOURRGBLIST",1236880293:"IFCWORKTIME",1199560280:"IFCTIMEPERIOD",3611470254:"IFCTEXTUREVERTEXLIST",2771591690:"IFCTASKTIMERECURRING",1549132990:"IFCTASKTIME",2043862942:"IFCTABLECOLUMN",2934153892:"IFCSURFACEREINFORCEMENTAREA",609421318:"IFCSTRUCTURALLOADORRESULT",3478079324:"IFCSTRUCTURALLOADCONFIGURATION",1054537805:"IFCSCHEDULINGTIME",2439245199:"IFCRESOURCELEVELRELATIONSHIP",2433181523:"IFCREFERENCE",3915482550:"IFCRECURRENCEPATTERN",986844984:"IFCPROPERTYABSTRACTION",3843373140:"IFCPROJECTEDCRS",677532197:"IFCPRESENTATIONITEM",1507914824:"IFCMATERIALUSAGEDEFINITION",552965576:"IFCMATERIALPROFILEWITHOFFSETS",164193824:"IFCMATERIALPROFILESET",2235152071:"IFCMATERIALPROFILE",1847252529:"IFCMATERIALLAYERWITHOFFSETS",760658860:"IFCMATERIALDEFINITION",3057273783:"IFCMAPCONVERSION",4294318154:"IFCEXTERNALINFORMATION",1466758467:"IFCCOORDINATEREFERENCESYSTEM",1785450214:"IFCCOORDINATEOPERATION",775493141:"IFCCONNECTIONVOLUMEGEOMETRY",979691226:"IFCREINFORCINGBAR",3700593921:"IFCELECTRICDISTRIBUTIONPOINT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",578613899:"IFCCONTROLLERTYPE",2454782716:"IFCCHAMFEREDGEFEATURE",753842376:"IFCBEAM",3001207471:"IFCALARMTYPE",2874132201:"IFCACTUATORTYPE",3304561284:"IFCWINDOW",3512223829:"IFCWALLSTANDARDCASE",2391406946:"IFCWALL",3313531582:"IFCVIBRATIONISOLATORTYPE",2347447852:"IFCTENDONANCHOR",3824725483:"IFCTENDON",2515109513:"IFCSTRUCTURALANALYSISMODEL",4252922144:"IFCSTAIRFLIGHT",331165859:"IFCSTAIR",1529196076:"IFCSLAB",1783015770:"IFCSENSORTYPE",1376911519:"IFCROUNDEDEDGEFEATURE",2016517767:"IFCROOF",2320036040:"IFCREINFORCINGMESH",3027567501:"IFCREINFORCINGELEMENT",3055160366:"IFCRATIONALBEZIERCURVE",3283111854:"IFCRAMPFLIGHT",3024970846:"IFCRAMP",2262370178:"IFCRAILING",3171933400:"IFCPLATE",1687234759:"IFCPILE",1073191201:"IFCMEMBER",900683007:"IFCFOOTING",3508470533:"IFCFLOWTREATMENTDEVICE",2223149337:"IFCFLOWTERMINAL",707683696:"IFCFLOWSTORAGEDEVICE",987401354:"IFCFLOWSEGMENT",3132237377:"IFCFLOWMOVINGDEVICE",4037862832:"IFCFLOWINSTRUMENTTYPE",4278956645:"IFCFLOWFITTING",2058353004:"IFCFLOWCONTROLLER",4222183408:"IFCFIRESUPPRESSIONTERMINALTYPE",1810631287:"IFCFILTERTYPE",346874300:"IFCFANTYPE",1658829314:"IFCENERGYCONVERSIONDEVICE",857184966:"IFCELECTRICALELEMENT",1634875225:"IFCELECTRICALCIRCUIT",712377611:"IFCELECTRICTIMECONTROLTYPE",1217240411:"IFCELECTRICMOTORTYPE",1365060375:"IFCELECTRICHEATERTYPE",1534661035:"IFCELECTRICGENERATORTYPE",3277789161:"IFCELECTRICFLOWSTORAGEDEVICETYPE",663422040:"IFCELECTRICAPPLIANCETYPE",855621170:"IFCEDGEFEATURE",2030761528:"IFCDUCTSILENCERTYPE",3760055223:"IFCDUCTSEGMENTTYPE",869906466:"IFCDUCTFITTINGTYPE",395920057:"IFCDOOR",3041715199:"IFCDISTRIBUTIONPORT",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",1945004755:"IFCDISTRIBUTIONELEMENT",2063403501:"IFCDISTRIBUTIONCONTROLELEMENTTYPE",1599208980:"IFCDISTRIBUTIONCHAMBERELEMENTTYPE",2635815018:"IFCDISCRETEACCESSORYTYPE",1335981549:"IFCDISCRETEACCESSORY",4147604152:"IFCDIAMETERDIMENSION",3961806047:"IFCDAMPERTYPE",3495092785:"IFCCURTAINWALL",1973544240:"IFCCOVERING",2954562838:"IFCCOOLINGTOWERTYPE",335055490:"IFCCOOLEDBEAMTYPE",488727124:"IFCCONSTRUCTIONPRODUCTRESOURCE",1060000209:"IFCCONSTRUCTIONMATERIALRESOURCE",3898045240:"IFCCONSTRUCTIONEQUIPMENTRESOURCE",1163958913:"IFCCONDITIONCRITERION",2188551683:"IFCCONDITION",2816379211:"IFCCONDENSERTYPE",3850581409:"IFCCOMPRESSORTYPE",843113511:"IFCCOLUMN",2301859152:"IFCCOILTYPE",2611217952:"IFCCIRCLE",2951183804:"IFCCHILLERTYPE",1285652485:"IFCCABLESEGMENTTYPE",3293546465:"IFCCABLECARRIERSEGMENTTYPE",395041908:"IFCCABLECARRIERFITTINGTYPE",1909888760:"IFCBUILDINGELEMENTPROXYTYPE",1095909175:"IFCBUILDINGELEMENTPROXY",2979338954:"IFCBUILDINGELEMENTPART",52481810:"IFCBUILDINGELEMENTCOMPONENT",3299480353:"IFCBUILDINGELEMENT",231477066:"IFCBOILERTYPE",1916977116:"IFCBEZIERCURVE",819618141:"IFCBEAMTYPE",1967976161:"IFCBSPLINECURVE",3460190687:"IFCASSET",2470393545:"IFCANGULARDIMENSION",1871374353:"IFCAIRTOAIRHEATRECOVERYTYPE",3352864051:"IFCAIRTERMINALTYPE",1411407467:"IFCAIRTERMINALBOXTYPE",3821786052:"IFCACTIONREQUEST",1213861670:"IFC2DCOMPOSITECURVE",1033361043:"IFCZONE",3342526732:"IFCWORKSCHEDULE",4218914973:"IFCWORKPLAN",1028945134:"IFCWORKCONTROL",1133259667:"IFCWASTETERMINALTYPE",1898987631:"IFCWALLTYPE",2769231204:"IFCVIRTUALELEMENT",728799441:"IFCVALVETYPE",1911125066:"IFCUNITARYEQUIPMENTTYPE",1600972822:"IFCTUBEBUNDLETYPE",3593883385:"IFCTRIMMEDCURVE",1620046519:"IFCTRANSPORTELEMENT",1692211062:"IFCTRANSFORMERTYPE",1637806684:"IFCTIMESERIESSCHEDULE",5716631:"IFCTANKTYPE",2254336722:"IFCSYSTEM",2315554128:"IFCSWITCHINGDEVICETYPE",148013059:"IFCSUBCONTRACTRESOURCE",1975003073:"IFCSTRUCTURALSURFACECONNECTION",2986769608:"IFCSTRUCTURALRESULTGROUP",1235345126:"IFCSTRUCTURALPOINTREACTION",734778138:"IFCSTRUCTURALPOINTCONNECTION",2082059205:"IFCSTRUCTURALPOINTACTION",3987759626:"IFCSTRUCTURALPLANARACTIONVARYING",1621171031:"IFCSTRUCTURALPLANARACTION",1252848954:"IFCSTRUCTURALLOADGROUP",1721250024:"IFCSTRUCTURALLINEARACTIONVARYING",1807405624:"IFCSTRUCTURALLINEARACTION",2445595289:"IFCSTRUCTURALCURVEMEMBERVARYING",214636428:"IFCSTRUCTURALCURVEMEMBER",4243806635:"IFCSTRUCTURALCURVECONNECTION",1179482911:"IFCSTRUCTURALCONNECTION",682877961:"IFCSTRUCTURALACTION",1039846685:"IFCSTAIRFLIGHTTYPE",3112655638:"IFCSTACKTERMINALTYPE",3812236995:"IFCSPACETYPE",652456506:"IFCSPACEPROGRAM",1305183839:"IFCSPACEHEATERTYPE",3856911033:"IFCSPACE",2533589738:"IFCSLABTYPE",4097777520:"IFCSITE",4105383287:"IFCSERVICELIFE",3517283431:"IFCSCHEDULETIMECONTROL",1768891740:"IFCSANITARYTERMINALTYPE",2863920197:"IFCRELASSIGNSTASKS",160246688:"IFCRELAGGREGATES",2324767716:"IFCRAMPFLIGHTTYPE",2893384427:"IFCRAILINGTYPE",3248260540:"IFCRADIUSDIMENSION",2250791053:"IFCPUMPTYPE",1842657554:"IFCPROTECTIVEDEVICETYPE",3651124850:"IFCPROJECTIONELEMENT",3642467123:"IFCPROJECTORDERRECORD",2904328755:"IFCPROJECTORDER",2744685151:"IFCPROCEDURE",3740093272:"IFCPORT",3724593414:"IFCPOLYLINE",4017108033:"IFCPLATETYPE",4231323485:"IFCPIPESEGMENTTYPE",804291784:"IFCPIPEFITTINGTYPE",3327091369:"IFCPERMIT",2382730787:"IFCPERFORMANCEHISTORY",2837617999:"IFCOUTLETTYPE",3425660407:"IFCORDERACTION",3588315303:"IFCOPENINGELEMENT",4143007308:"IFCOCCUPANT",1916936684:"IFCMOVE",977012517:"IFCMOTORCONNECTIONTYPE",3181161470:"IFCMEMBERTYPE",2108223431:"IFCMECHANICALFASTENERTYPE",377706215:"IFCMECHANICALFASTENER",2506943328:"IFCLINEARDIMENSION",1161773419:"IFCLIGHTFIXTURETYPE",1051575348:"IFCLAMPTYPE",3827777499:"IFCLABORRESOURCE",4288270099:"IFCJUNCTIONBOXTYPE",2391368822:"IFCINVENTORY",1806887404:"IFCHUMIDIFIERTYPE",1251058090:"IFCHEATEXCHANGERTYPE",2706460486:"IFCGROUP",3009204131:"IFCGRID",200128114:"IFCGASTERMINALTYPE",814719939:"IFCFURNITURESTANDARD",263784265:"IFCFURNISHINGELEMENT",3009222698:"IFCFLOWTREATMENTDEVICETYPE",2297155007:"IFCFLOWTERMINALTYPE",1339347760:"IFCFLOWSTORAGEDEVICETYPE",1834744321:"IFCFLOWSEGMENTTYPE",1482959167:"IFCFLOWMOVINGDEVICETYPE",3815607619:"IFCFLOWMETERTYPE",3198132628:"IFCFLOWFITTINGTYPE",3907093117:"IFCFLOWCONTROLLERTYPE",1287392070:"IFCFEATUREELEMENTSUBTRACTION",2143335405:"IFCFEATUREELEMENTADDITION",2827207264:"IFCFEATUREELEMENT",2489546625:"IFCFASTENERTYPE",647756555:"IFCFASTENER",3737207727:"IFCFACETEDBREPWITHVOIDS",807026263:"IFCFACETEDBREP",3390157468:"IFCEVAPORATORTYPE",3174744832:"IFCEVAPORATIVECOOLERTYPE",3272907226:"IFCEQUIPMENTSTANDARD",1962604670:"IFCEQUIPMENTELEMENT",2107101300:"IFCENERGYCONVERSIONDEVICETYPE",1704287377:"IFCELLIPSE",2590856083:"IFCELEMENTCOMPONENTTYPE",1623761950:"IFCELEMENTCOMPONENT",4123344466:"IFCELEMENTASSEMBLY",1758889154:"IFCELEMENT",360485395:"IFCELECTRICALBASEPROPERTIES",3849074793:"IFCDISTRIBUTIONFLOWELEMENTTYPE",3256556792:"IFCDISTRIBUTIONELEMENTTYPE",681481545:"IFCDIMENSIONCURVEDIRECTEDCALLOUT",1457835157:"IFCCURTAINWALLTYPE",3295246426:"IFCCREWRESOURCE",1916426348:"IFCCOVERINGTYPE",1419761937:"IFCCOSTSCHEDULE",3895139033:"IFCCOSTITEM",3293443760:"IFCCONTROL",2559216714:"IFCCONSTRUCTIONRESOURCE",2510884976:"IFCCONIC",3732776249:"IFCCOMPOSITECURVE",300633059:"IFCCOLUMNTYPE",2937912522:"IFCCIRCLEHOLLOWPROFILEDEF",3124254112:"IFCBUILDINGSTOREY",1950629157:"IFCBUILDINGELEMENTTYPE",4031249490:"IFCBUILDING",1260505505:"IFCBOUNDEDCURVE",3649129432:"IFCBOOLEANCLIPPINGRESULT",1334484129:"IFCBLOCK",3207858831:"IFCASYMMETRICISHAPEPROFILEDEF",1674181508:"IFCANNOTATION",2296667514:"IFCACTOR",2097647324:"IFCTRANSPORTELEMENTTYPE",3473067441:"IFCTASK",1580310250:"IFCSYSTEMFURNITUREELEMENTTYPE",4124788165:"IFCSURFACEOFREVOLUTION",2809605785:"IFCSURFACEOFLINEAREXTRUSION",2028607225:"IFCSURFACECURVESWEPTAREASOLID",4070609034:"IFCSTRUCTUREDDIMENSIONCALLOUT",2218152070:"IFCSTRUCTURALSURFACEMEMBERVARYING",3979015343:"IFCSTRUCTURALSURFACEMEMBER",3689010777:"IFCSTRUCTURALREACTION",530289379:"IFCSTRUCTURALMEMBER",3136571912:"IFCSTRUCTURALITEM",3544373492:"IFCSTRUCTURALACTIVITY",451544542:"IFCSPHERE",3893378262:"IFCSPATIALSTRUCTUREELEMENTTYPE",2706606064:"IFCSPATIALSTRUCTUREELEMENT",3626867408:"IFCRIGHTCIRCULARCYLINDER",4158566097:"IFCRIGHTCIRCULARCONE",1856042241:"IFCREVOLVEDAREASOLID",2914609552:"IFCRESOURCE",1401173127:"IFCRELVOIDSELEMENT",3451746338:"IFCRELSPACEBOUNDARY",366585022:"IFCRELSERVICESBUILDINGS",4122056220:"IFCRELSEQUENCE",1058617721:"IFCRELSCHEDULESCOSTITEMS",1245217292:"IFCRELREFERENCEDINSPATIALSTRUCTURE",750771296:"IFCRELPROJECTSELEMENT",202636808:"IFCRELOVERRIDESPROPERTIES",2051452291:"IFCRELOCCUPIESSPACES",3268803585:"IFCRELNESTS",4189434867:"IFCRELINTERACTIONREQUIREMENTS",279856033:"IFCRELFLOWCONTROLELEMENTS",3940055652:"IFCRELFILLSELEMENT",781010003:"IFCRELDEFINESBYTYPE",4186316022:"IFCRELDEFINESBYPROPERTIES",693640335:"IFCRELDEFINES",2551354335:"IFCRELDECOMPOSES",2802773753:"IFCRELCOVERSSPACES",886880790:"IFCRELCOVERSBLDGELEMENTS",3242617779:"IFCRELCONTAINEDINSPATIALSTRUCTURE",3678494232:"IFCRELCONNECTSWITHREALIZINGELEMENTS",504942748:"IFCRELCONNECTSWITHECCENTRICITY",1638771189:"IFCRELCONNECTSSTRUCTURALMEMBER",3912681535:"IFCRELCONNECTSSTRUCTURALELEMENT",2127690289:"IFCRELCONNECTSSTRUCTURALACTIVITY",3190031847:"IFCRELCONNECTSPORTS",4201705270:"IFCRELCONNECTSPORTTOELEMENT",3945020480:"IFCRELCONNECTSPATHELEMENTS",1204542856:"IFCRELCONNECTSELEMENTS",826625072:"IFCRELCONNECTS",2851387026:"IFCRELASSOCIATESPROFILEPROPERTIES",2655215786:"IFCRELASSOCIATESMATERIAL",3840914261:"IFCRELASSOCIATESLIBRARY",982818633:"IFCRELASSOCIATESDOCUMENT",2728634034:"IFCRELASSOCIATESCONSTRAINT",919958153:"IFCRELASSOCIATESCLASSIFICATION",4095574036:"IFCRELASSOCIATESAPPROVAL",1327628568:"IFCRELASSOCIATESAPPLIEDVALUE",1865459582:"IFCRELASSOCIATES",205026976:"IFCRELASSIGNSTORESOURCE",3372526763:"IFCRELASSIGNSTOPROJECTORDER",2857406711:"IFCRELASSIGNSTOPRODUCT",4278684876:"IFCRELASSIGNSTOPROCESS",1307041759:"IFCRELASSIGNSTOGROUP",2495723537:"IFCRELASSIGNSTOCONTROL",1683148259:"IFCRELASSIGNSTOACTOR",3939117080:"IFCRELASSIGNS",3454111270:"IFCRECTANGULARTRIMMEDSURFACE",2798486643:"IFCRECTANGULARPYRAMID",2770003689:"IFCRECTANGLEHOLLOWPROFILEDEF",3219374653:"IFCPROXY",1451395588:"IFCPROPERTYSET",4194566429:"IFCPROJECTIONCURVE",103090709:"IFCPROJECT",4208778838:"IFCPRODUCT",2945172077:"IFCPROCESS",220341763:"IFCPLANE",603570806:"IFCPLANARBOX",3566463478:"IFCPERMEABLECOVERINGPROPERTIES",3505215534:"IFCOFFSETCURVE3D",3388369263:"IFCOFFSETCURVE2D",3888040117:"IFCOBJECT",1425443689:"IFCMANIFOLDSOLIDBREP",1281925730:"IFCLINE",572779678:"IFCLSHAPEPROFILEDEF",1484403080:"IFCISHAPEPROFILEDEF",987898635:"IFCGEOMETRICCURVESET",1268542332:"IFCFURNITURETYPE",4238390223:"IFCFURNISHINGELEMENTTYPE",3455213021:"IFCFLUIDFLOWPROPERTIES",315944413:"IFCFILLAREASTYLETILES",4203026998:"IFCFILLAREASTYLETILESYMBOLWITHSTYLE",374418227:"IFCFILLAREASTYLEHATCHING",2047409740:"IFCFACEBASEDSURFACEMODEL",477187591:"IFCEXTRUDEDAREASOLID",80994333:"IFCENERGYPROPERTIES",2835456948:"IFCELLIPSEPROFILEDEF",2777663545:"IFCELEMENTARYSURFACE",339256511:"IFCELEMENTTYPE",1883228015:"IFCELEMENTQUANTITY",1472233963:"IFCEDGELOOP",4006246654:"IFCDRAUGHTINGPREDEFINEDCURVEFONT",445594917:"IFCDRAUGHTINGPREDEFINEDCOLOUR",3073041342:"IFCDRAUGHTINGCALLOUT",526551008:"IFCDOORSTYLE",1714330368:"IFCDOORPANELPROPERTIES",2963535650:"IFCDOORLININGPROPERTIES",32440307:"IFCDIRECTION",4054601972:"IFCDIMENSIONCURVETERMINATOR",606661476:"IFCDIMENSIONCURVE",693772133:"IFCDEFINEDSYMBOL",2827736869:"IFCCURVEBOUNDEDPLANE",2601014836:"IFCCURVE",2147822146:"IFCCSGSOLID",2506170314:"IFCCSGPRIMITIVE3D",194851669:"IFCCRANERAILFSHAPEPROFILEDEF",4133800736:"IFCCRANERAILASHAPEPROFILEDEF",2485617015:"IFCCOMPOSITECURVESEGMENT",2205249479:"IFCCLOSEDSHELL",1383045692:"IFCCIRCLEPROFILEDEF",1416205885:"IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM",3331915920:"IFCCARTESIANTRANSFORMATIONOPERATOR3D",3486308946:"IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM",3749851601:"IFCCARTESIANTRANSFORMATIONOPERATOR2D",59481748:"IFCCARTESIANTRANSFORMATIONOPERATOR",1123145078:"IFCCARTESIANPOINT",2898889636:"IFCCSHAPEPROFILEDEF",2713105998:"IFCBOXEDHALFSPACE",2581212453:"IFCBOUNDINGBOX",4182860854:"IFCBOUNDEDSURFACE",2736907675:"IFCBOOLEANRESULT",2740243338:"IFCAXIS2PLACEMENT3D",3125803723:"IFCAXIS2PLACEMENT2D",4261334040:"IFCAXIS1PLACEMENT",1302238472:"IFCANNOTATIONSURFACE",2265737646:"IFCANNOTATIONFILLAREAOCCURRENCE",669184980:"IFCANNOTATIONFILLAREA",3288037868:"IFCANNOTATIONCURVEOCCURRENCE",2543172580:"IFCZSHAPEPROFILEDEF",1299126871:"IFCWINDOWSTYLE",512836454:"IFCWINDOWPANELPROPERTIES",336235671:"IFCWINDOWLININGPROPERTIES",2759199220:"IFCVERTEXLOOP",1417489154:"IFCVECTOR",427810014:"IFCUSHAPEPROFILEDEF",2347495698:"IFCTYPEPRODUCT",1628702193:"IFCTYPEOBJECT",1345879162:"IFCTWODIRECTIONREPEATFACTOR",2715220739:"IFCTRAPEZIUMPROFILEDEF",3124975700:"IFCTEXTLITERALWITHEXTENT",4282788508:"IFCTEXTLITERAL",3028897424:"IFCTERMINATORSYMBOL",3071757647:"IFCTSHAPEPROFILEDEF",230924584:"IFCSWEPTSURFACE",1260650574:"IFCSWEPTDISKSOLID",2247615214:"IFCSWEPTAREASOLID",1878645084:"IFCSURFACESTYLERENDERING",2513912981:"IFCSURFACE",2233826070:"IFCSUBEDGE",3653947884:"IFCSTRUCTURALSTEELPROFILEPROPERTIES",3843319758:"IFCSTRUCTURALPROFILEPROPERTIES",1190533807:"IFCSTRUCTURALLOADSINGLEFORCEWARPING",1597423693:"IFCSTRUCTURALLOADSINGLEFORCE",1973038258:"IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION",2473145415:"IFCSTRUCTURALLOADSINGLEDISPLACEMENT",2668620305:"IFCSTRUCTURALLOADPLANARFORCE",1595516126:"IFCSTRUCTURALLOADLINEARFORCE",390701378:"IFCSPACETHERMALLOADPROPERTIES",1202362311:"IFCSOUNDVALUE",2485662743:"IFCSOUNDPROPERTIES",723233188:"IFCSOLIDMODEL",2609359061:"IFCSLIPPAGECONNECTIONCONDITION",4124623270:"IFCSHELLBASEDSURFACEMODEL",2411513650:"IFCSERVICELIFEFACTOR",1509187699:"IFCSECTIONEDSPINE",2778083089:"IFCROUNDEDRECTANGLEPROFILEDEF",478536968:"IFCRELATIONSHIP",3765753017:"IFCREINFORCEMENTDEFINITIONPROPERTIES",3413951693:"IFCREGULARTIMESERIES",3615266464:"IFCRECTANGLEPROFILEDEF",110355661:"IFCPROPERTYTABLEVALUE",3650150729:"IFCPROPERTYSINGLEVALUE",3357820518:"IFCPROPERTYSETDEFINITION",941946838:"IFCPROPERTYREFERENCEVALUE",2752243245:"IFCPROPERTYLISTVALUE",4166981789:"IFCPROPERTYENUMERATEDVALUE",1680319473:"IFCPROPERTYDEFINITION",871118103:"IFCPROPERTYBOUNDEDVALUE",673634403:"IFCPRODUCTDEFINITIONSHAPE",179317114:"IFCPREDEFINEDPOINTMARKERSYMBOL",433424934:"IFCPREDEFINEDDIMENSIONSYMBOL",2559016684:"IFCPREDEFINEDCURVEFONT",759155922:"IFCPREDEFINEDCOLOUR",2775532180:"IFCPOLYGONALBOUNDEDHALFSPACE",2924175390:"IFCPOLYLOOP",1423911732:"IFCPOINTONSURFACE",4022376103:"IFCPOINTONCURVE",2067069095:"IFCPOINT",1663979128:"IFCPLANAREXTENT",2004835150:"IFCPLACEMENT",597895409:"IFCPIXELTEXTURE",3021840470:"IFCPHYSICALCOMPLEXQUANTITY",2519244187:"IFCPATH",2529465313:"IFCPARAMETERIZEDPROFILEDEF",1029017970:"IFCORIENTEDEDGE",2665983363:"IFCOPENSHELL",2833995503:"IFCONEDIRECTIONREPEATFACTOR",219451334:"IFCOBJECTDEFINITION",1430189142:"IFCMECHANICALCONCRETEMATERIALPROPERTIES",2022407955:"IFCMATERIALDEFINITIONREPRESENTATION",2347385850:"IFCMAPPEDITEM",1008929658:"IFCLOOP",2624227202:"IFCLOCALPLACEMENT",3422422726:"IFCLIGHTSOURCESPOT",1520743889:"IFCLIGHTSOURCEPOSITIONAL",4266656042:"IFCLIGHTSOURCEGONIOMETRIC",2604431987:"IFCLIGHTSOURCEDIRECTIONAL",125510826:"IFCLIGHTSOURCEAMBIENT",1402838566:"IFCLIGHTSOURCE",3741457305:"IFCIRREGULARTIMESERIES",3905492369:"IFCIMAGETEXTURE",2445078500:"IFCHYGROSCOPICMATERIALPROPERTIES",812098782:"IFCHALFSPACESOLID",178086475:"IFCGRIDPLACEMENT",3590301190:"IFCGEOMETRICSET",4142052618:"IFCGEOMETRICREPRESENTATIONSUBCONTEXT",2453401579:"IFCGEOMETRICREPRESENTATIONITEM",3448662350:"IFCGEOMETRICREPRESENTATIONCONTEXT",1446786286:"IFCGENERALPROFILEPROPERTIES",803998398:"IFCGENERALMATERIALPROPERTIES",3857492461:"IFCFUELPROPERTIES",738692330:"IFCFILLAREASTYLE",4219587988:"IFCFAILURECONNECTIONCONDITION",3008276851:"IFCFACESURFACE",803316827:"IFCFACEOUTERBOUND",1809719519:"IFCFACEBOUND",2556980723:"IFCFACE",1860660968:"IFCEXTENDEDMATERIALPROPERTIES",476780140:"IFCEDGECURVE",3900360178:"IFCEDGE",4170525392:"IFCDRAUGHTINGPREDEFINEDTEXTFONT",3732053477:"IFCDOCUMENTREFERENCE",1694125774:"IFCDIMENSIONPAIR",2273265877:"IFCDIMENSIONCALLOUTRELATIONSHIP",3632507154:"IFCDERIVEDPROFILEDEF",3800577675:"IFCCURVESTYLE",2889183280:"IFCCONVERSIONBASEDUNIT",3050246964:"IFCCONTEXTDEPENDENTUNIT",45288368:"IFCCONNECTIONPOINTECCENTRICITY",1981873012:"IFCCONNECTIONCURVEGEOMETRY",370225590:"IFCCONNECTEDFACESET",1485152156:"IFCCOMPOSITEPROFILEDEF",2542286263:"IFCCOMPLEXPROPERTY",776857604:"IFCCOLOURRGB",647927063:"IFCCLASSIFICATIONREFERENCE",3150382593:"IFCCENTERLINEPROFILEDEF",616511568:"IFCBLOBTEXTURE",2705031697:"IFCARBITRARYPROFILEDEFWITHVOIDS",1310608509:"IFCARBITRARYOPENPROFILEDEF",3798115385:"IFCARBITRARYCLOSEDPROFILEDEF",2297822566:"IFCANNOTATIONTEXTOCCURRENCE",3612888222:"IFCANNOTATIONSYMBOLOCCURRENCE",962685235:"IFCANNOTATIONSURFACEOCCURRENCE",2442683028:"IFCANNOTATIONOCCURRENCE",1065908215:"IFCWATERPROPERTIES",891718957:"IFCVIRTUALGRIDINTERSECTION",1907098498:"IFCVERTEXPOINT",3304826586:"IFCVERTEXBASEDTEXTUREMAP",2799835756:"IFCVERTEX",180925521:"IFCUNITASSIGNMENT",1735638870:"IFCTOPOLOGYREPRESENTATION",1377556343:"IFCTOPOLOGICALREPRESENTATIONITEM",581633288:"IFCTIMESERIESVALUE",1718945513:"IFCTIMESERIESREFERENCERELATIONSHIP",3101149627:"IFCTIMESERIES",3317419933:"IFCTHERMALMATERIALPROPERTIES",1210645708:"IFCTEXTUREVERTEX",2552916305:"IFCTEXTUREMAP",1742049831:"IFCTEXTURECOORDINATEGENERATOR",280115917:"IFCTEXTURECOORDINATE",1484833681:"IFCTEXTSTYLEWITHBOXCHARACTERISTICS",1640371178:"IFCTEXTSTYLETEXTMODEL",2636378356:"IFCTEXTSTYLEFORDEFINEDFONT",1983826977:"IFCTEXTSTYLEFONTMODEL",1447204868:"IFCTEXTSTYLE",912023232:"IFCTELECOMADDRESS",531007025:"IFCTABLEROW",985171141:"IFCTABLE",1290481447:"IFCSYMBOLSTYLE",626085974:"IFCSURFACETEXTURE",1351298697:"IFCSURFACESTYLEWITHTEXTURES",846575682:"IFCSURFACESTYLESHADING",1607154358:"IFCSURFACESTYLEREFRACTION",3303107099:"IFCSURFACESTYLELIGHTING",1300840506:"IFCSURFACESTYLE",3049322572:"IFCSTYLEDREPRESENTATION",3958052878:"IFCSTYLEDITEM",2830218821:"IFCSTYLEMODEL",3408363356:"IFCSTRUCTURALLOADTEMPERATURE",2525727697:"IFCSTRUCTURALLOADSTATIC",2162789131:"IFCSTRUCTURALLOAD",2273995522:"IFCSTRUCTURALCONNECTIONCONDITION",3692461612:"IFCSIMPLEPROPERTY",4240577450:"IFCSHAPEREPRESENTATION",3982875396:"IFCSHAPEMODEL",867548509:"IFCSHAPEASPECT",4165799628:"IFCSECTIONREINFORCEMENTPROPERTIES",2042790032:"IFCSECTIONPROPERTIES",448429030:"IFCSIUNIT",2341007311:"IFCROOT",3679540991:"IFCRIBPLATEPROFILEPROPERTIES",1660063152:"IFCREPRESENTATIONMAP",3008791417:"IFCREPRESENTATIONITEM",3377609919:"IFCREPRESENTATIONCONTEXT",1076942058:"IFCREPRESENTATION",1222501353:"IFCRELAXATION",1580146022:"IFCREINFORCEMENTBARPROPERTIES",2692823254:"IFCREFERENCESVALUEDOCUMENT",825690147:"IFCQUANTITYWEIGHT",2405470396:"IFCQUANTITYVOLUME",3252649465:"IFCQUANTITYTIME",931644368:"IFCQUANTITYLENGTH",2093928680:"IFCQUANTITYCOUNT",2044713172:"IFCQUANTITYAREA",3710013099:"IFCPROPERTYENUMERATION",148025276:"IFCPROPERTYDEPENDENCYRELATIONSHIP",3896028662:"IFCPROPERTYCONSTRAINTRELATIONSHIP",2598011224:"IFCPROPERTY",2802850158:"IFCPROFILEPROPERTIES",3958567839:"IFCPROFILEDEF",2267347899:"IFCPRODUCTSOFCOMBUSTIONPROPERTIES",2095639259:"IFCPRODUCTREPRESENTATION",2417041796:"IFCPRESENTATIONSTYLEASSIGNMENT",3119450353:"IFCPRESENTATIONSTYLE",1304840413:"IFCPRESENTATIONLAYERWITHSTYLE",2022622350:"IFCPRESENTATIONLAYERASSIGNMENT",1775413392:"IFCPREDEFINEDTEXTFONT",3213052703:"IFCPREDEFINEDTERMINATORSYMBOL",990879717:"IFCPREDEFINEDSYMBOL",3727388367:"IFCPREDEFINEDITEM",3355820592:"IFCPOSTALADDRESS",2226359599:"IFCPHYSICALSIMPLEQUANTITY",2483315170:"IFCPHYSICALQUANTITY",101040310:"IFCPERSONANDORGANIZATION",2077209135:"IFCPERSON",1207048766:"IFCOWNERHISTORY",1411181986:"IFCORGANIZATIONRELATIONSHIP",4251960020:"IFCORGANIZATION",1227763645:"IFCOPTICALMATERIALPROPERTIES",2251480897:"IFCOBJECTIVE",3701648758:"IFCOBJECTPLACEMENT",1918398963:"IFCNAMEDUNIT",2706619895:"IFCMONETARYUNIT",3368373690:"IFCMETRIC",677618848:"IFCMECHANICALSTEELMATERIALPROPERTIES",4256014907:"IFCMECHANICALMATERIALPROPERTIES",2597039031:"IFCMEASUREWITHUNIT",3265635763:"IFCMATERIALPROPERTIES",2199411900:"IFCMATERIALLIST",1303795690:"IFCMATERIALLAYERSETUSAGE",3303938423:"IFCMATERIALLAYERSET",248100487:"IFCMATERIALLAYER",1847130766:"IFCMATERIALCLASSIFICATIONRELATIONSHIP",1838606355:"IFCMATERIAL",30780891:"IFCLOCALTIME",1566485204:"IFCLIGHTINTENSITYDISTRIBUTION",4162380809:"IFCLIGHTDISTRIBUTIONDATA",3452421091:"IFCLIBRARYREFERENCE",2655187982:"IFCLIBRARYINFORMATION",3020489413:"IFCIRREGULARTIMESERIESVALUE",852622518:"IFCGRIDAXIS",3548104201:"IFCEXTERNALLYDEFINEDTEXTFONT",3207319532:"IFCEXTERNALLYDEFINEDSYMBOL",1040185647:"IFCEXTERNALLYDEFINEDSURFACESTYLE",2242383968:"IFCEXTERNALLYDEFINEDHATCHSTYLE",3200245327:"IFCEXTERNALREFERENCE",1648886627:"IFCENVIRONMENTALIMPACTVALUE",3796139169:"IFCDRAUGHTINGCALLOUTRELATIONSHIP",770865208:"IFCDOCUMENTINFORMATIONRELATIONSHIP",1154170062:"IFCDOCUMENTINFORMATION",1376555844:"IFCDOCUMENTELECTRONICFORMAT",2949456006:"IFCDIMENSIONALEXPONENTS",1045800335:"IFCDERIVEDUNITELEMENT",1765591967:"IFCDERIVEDUNIT",1072939445:"IFCDATEANDTIME",3510044353:"IFCCURVESTYLEFONTPATTERN",2367409068:"IFCCURVESTYLEFONTANDSCALING",1105321065:"IFCCURVESTYLEFONT",539742890:"IFCCURRENCYRELATIONSHIP",602808272:"IFCCOSTVALUE",1065062679:"IFCCOORDINATEDUNIVERSALTIMEOFFSET",347226245:"IFCCONSTRAINTRELATIONSHIP",613356794:"IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP",1658513725:"IFCCONSTRAINTAGGREGATIONRELATIONSHIP",1959218052:"IFCCONSTRAINT",2732653382:"IFCCONNECTIONSURFACEGEOMETRY",4257277454:"IFCCONNECTIONPORTGEOMETRY",2614616156:"IFCCONNECTIONPOINTGEOMETRY",2859738748:"IFCCONNECTIONGEOMETRY",3264961684:"IFCCOLOURSPECIFICATION",3639012971:"IFCCLASSIFICATIONNOTATIONFACET",938368621:"IFCCLASSIFICATIONNOTATION",1098599126:"IFCCLASSIFICATIONITEMRELATIONSHIP",1767535486:"IFCCLASSIFICATIONITEM",747523909:"IFCCLASSIFICATION",622194075:"IFCCALENDARDATE",2069777674:"IFCBOUNDARYNODECONDITIONWARPING",1387855156:"IFCBOUNDARYNODECONDITION",3367102660:"IFCBOUNDARYFACECONDITION",1560379544:"IFCBOUNDARYEDGECONDITION",4037036970:"IFCBOUNDARYCONDITION",3869604511:"IFCAPPROVALRELATIONSHIP",390851274:"IFCAPPROVALPROPERTYRELATIONSHIP",2080292479:"IFCAPPROVALACTORRELATIONSHIP",130549933:"IFCAPPROVAL",1110488051:"IFCAPPLIEDVALUERELATIONSHIP",411424972:"IFCAPPLIEDVALUE",639542469:"IFCAPPLICATION",618182010:"IFCADDRESS",3630933823:"IFCACTORROLE",599546466:"FILE_DESCRIPTION",1390159747:"FILE_NAME",1109904537:"FILE_SCHEMA"};class Yt{static async getUnits(t){var e;const{IFCUNITASSIGNMENT:s}=ft,i=await t.getAllPropertiesOfType(s);if(!i)return 1;const n=Object.keys(i),o=i[parseInt(n[0],10)];for(const r of o.Units){if(r.value===void 0||r.value===null)continue;const a=await t.getProperties(r.value);if(!a||!a.UnitType||!a.UnitType.value||a.UnitType.value!=="LENGTHUNIT")continue;let c=1,d=1;return a.Name.value==="METRE"&&(d=1),a.Name.value==="FOOT"&&(d=.3048),((e=a.Prefix)==null?void 0:e.value)==="MILLI"&&(c=.001),d*c}return 1}static async findItemByGuid(t,e){var s;const i=t.getAllPropertiesIDs();for(const n of i){const o=await t.getProperties(n);if(o&&((s=o.GlobalId)==null?void 0:s.value)===e)return o}return null}static async getRelationMap(t,e,s){var i;const n=s??(async()=>{}),o={},r=t.getAllPropertiesIDs();for(const a of r){const c=await t.getProperties(a);if(!c)continue;const d=c.type===e,E=Object.keys(c).find(f=>f.startsWith("Relating")),l=Object.keys(c).find(f=>f.startsWith("Related"));if(!(d&&E&&l))continue;const u=await t.getProperties((i=c[E])==null?void 0:i.value),T=c[l];if(!u||!T||!(T&&Array.isArray(T)))continue;const C=T.map(f=>f.value);await n(u.expressID,C),o[u.expressID]=C}return o}static async getQsetQuantities(t,e,s){const i=s??(()=>{}),n=await t.getProperties(e);return!n||n.type!==Uo?null:(n.Quantities??[{}]).map(o=>(o.value&&i(o.value),o.value)).filter(o=>o!==null)}static async getPsetProps(t,e,s){const i=s??(()=>{}),n=await t.getProperties(e);return!n||n.type!==ti?null:(n.HasProperties??[{}]).map(o=>(o.value&&i(o.value),o.value)).filter(o=>o!==null)}static async getPsetRel(t,e){var s;if(!await t.getProperties(e))return null;const i=await t.getAllPropertiesOfType(_s);if(!i)return null;const n=Object.values(i);let o=null;for(const r of n)((s=r.RelatingPropertyDefinition)==null?void 0:s.value)===e&&(o=r.expressID);return o}static async getQsetRel(t,e){return Yt.getPsetRel(t,e)}static async getEntityName(t,e){var s;const i=await t.getProperties(e);if(!i)return{key:null,name:null};const n=Object.keys(i).find(r=>r.endsWith("Name"))??null,o=n?(s=i[n])==null?void 0:s.value:null;return{key:n,name:o}}static async getQuantityValue(t,e){const s=await t.getProperties(e);if(!s)return{key:null,value:null};const i=Object.keys(s).find(o=>o.endsWith("Value"))??null;let n;return i===null||s[i]===void 0||s[i]===null?n=null:n=s[i].value,{key:i,value:n}}static isRel(t){return no[t].startsWith("IFCREL")}static async attributeExists(t,e,s){const i=await t.getProperties(e);return i?Object.keys(i).includes(s):!1}static async groupEntitiesByType(t,e){var s;const i=new Map;for(const n of e){const o=await t.getProperties(n);if(!o)continue;const r=o.type;i.get(r)||i.set(r,new Set),(s=i.get(r))==null||s.add(n)}return i}}const ka=new Map([[Ai,{forRelating:"IsDecomposedBy",forRelated:"Decomposes"}],[Fi,{forRelating:"AssociatedTo",forRelated:"HasAssociations"}],[gi,{forRelating:"ClassificationForObjects",forRelated:"HasAssociations"}],[Oi,{forRelating:"IsGroupedBy",forRelated:"HasAssignments"}],[_s,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[_i,{forRelated:"IsTypedBy",forRelating:"Types"}],[Mn,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[Ss,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}]]),oo=class pi extends q{constructor(t){super(t),I(this,"onDisposed",new M),I(this,"enabled",!0),I(this,"onRelationsIndexed",new M),I(this,"_relToAttributesMap",ka),I(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements"]),I(this,"_ifcRels",[Ai,Fi,gi,Oi,_s,_i,Mn,Ss]),I(this,"relationMaps",{}),I(this,"onFragmentsDisposed",e=>{delete this.relationMaps[e.groupID]}),this.components.add(pi.uuid,this),t.get(wt).onFragmentsDisposed.add(this.onFragmentsDisposed)}setRelationMap(t,e){this.relationMaps[t.uuid]=e,this.onRelationsIndexed.trigger({modelID:t.uuid,relationsMap:e})}async process(t){if(!t.hasProperties)throw new Error("FragmentsGroup properties not found");let e=this.relationMaps[t.uuid];if(e)return e;e=new Map;for(const s of this._ifcRels)await Yt.getRelationMap(t,s,async(i,n)=>{const o=this._relToAttributesMap.get(s);if(!o)return;const{forRelated:r,forRelating:a}=o,c=e.get(i)??new Map,d=this._inverseAttributes.indexOf(a);c.set(d,n),e.set(i,c);for(const E of n){const l=e.get(E)??new Map,u=this._inverseAttributes.indexOf(r),T=l.get(u)??[];T.push(i),l.set(u,T),e.set(E,l)}});return this.setRelationMap(t,e),e}async processFromWebIfc(t,e){const s=new Map;for(const i of this._ifcRels){const n=this._relToAttributesMap.get(i);if(!n)continue;const{forRelated:o,forRelating:r}=n,a=t.GetLineIDsWithType(e,i);for(let c=0;cm.startsWith("Relating")),l=Object.keys(d).find(m=>m.startsWith("Related"));if(!(E&&l))continue;const u=d[E].value,T=d[l].map(m=>m.value),C=s.get(u)??new Map,f=this._inverseAttributes.indexOf(r);C.set(f,T),s.set(u,C);for(const m of T){const R=s.get(m)??new Map,F=this._inverseAttributes.indexOf(o),p=R.get(F)??[];p.push(u),R.set(F,p),s.set(m,R)}}}return this.onRelationsIndexed.trigger({modelID:e.toString(),relationsMap:s}),s}getEntityRelations(t,e,s){const i=this.relationMaps[t.uuid];if(!i)return null;const n=i.get(e),o=this._inverseAttributes.indexOf(s);return!n||o===-1?null:n.get(o)||null}serializeRelations(t){const e={};for(const[s,i]of t.entries()){e[s]||(e[s]={});for(const[n,o]of i.entries())e[s][n]=o}return JSON.stringify(e)}serializeModelRelations(t){const e=this.relationMaps[t.uuid];return e?this.serializeRelations(e):null}serializeAllRelations(){const t={};for(const e in this.relationMaps){const s=this.relationMaps[e],i={};for(const[n,o]of s.entries()){i[n]||(i[n]={});for(const[r,a]of o.entries())i[n][r]=a}t[e]=i}return JSON.stringify(t)}getRelationsMapFromJSON(t){const e=JSON.parse(t),s=new Map;for(const i in e){const n=e[i],o=new Map;for(const r in n)o.set(Number(r),n[r]);s.set(Number(i),o)}return s}dispose(){this.relationMaps={},this.components.get(wt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(pi.uuid),this.onDisposed.reset()}};I(oo,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let Bi=oo;class Wa{constructor(){I(this,"factor",1),I(this,"complement",1)}apply(t){const e=this.getScaleMatrix().multiply(t);t.copy(e)}setUp(t){var e;this.factor=1;const s=this.getLengthUnits(t);if(!s)return;const i=s==null,n=s.Name===void 0||s.Name===null;i||n||(s.Name.value==="FOOT"?this.factor=.3048:((e=s.Prefix)==null?void 0:e.value)==="MILLI"&&(this.complement=.001))}getLengthUnits(t){try{const e=t.GetLineIDsWithType(0,Wo).get(0),s=t.GetLine(0,e);for(const i of s.Units){if(!i||i.value===null||i.value===void 0)continue;const n=t.GetLine(0,i.value);if(n.UnitType&&n.UnitType.value==="LENGTHUNIT")return n}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const t=this.factor;return new X().fromArray([t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1])}}class ro{constructor(){I(this,"itemsByFloor",{}),I(this,"_units",new Wa)}setUp(t){this._units.setUp(t),this.cleanUp();try{const e=t.GetLineIDsWithType(0,Ss),s=new Set,i=t.GetLineIDsWithType(0,$t);for(let c=0;c{this.getMesh(r,e)});for(const r of this._visitedFragments){const{index:a,fragment:c}=r[1];e.keyFragments.set(a,c.id)}for(const r of e.items){const a=this._fragmentInstances.get(r.id);if(!a)throw new Error("Fragment not found!");const c=[];for(const[d,E]of a)c.push(E);r.add(c)}const o=this.webIfc.GetCoordinationMatrix(0);return e.coordinationMatrix.fromArray(o),e.civilData=this._civil.read(this.webIfc),e}cleanUp(){this.webIfc=null,this.webIfc=new zt,this._visitedFragments.clear(),this._fragmentInstances.clear()}getMesh(t,e){const s=t.geometries.size(),i=t.expressID;for(let n=0;nparseInt(o,10)),i=e[s[0]],n=new Ze(i.expressID);return{ownerHistory:i,ownerHistoryHandle:n}}registerChange(t,...e){this.changeMap[t.uuid]||(this.changeMap[t.uuid]=new Set);for(const s of e)this.changeMap[t.uuid].add(s),this.onDataChanged.trigger({model:t,expressID:s})}async setData(t,...e){for(const s of e){const i=s.expressID;i&&(await t.setProperties(i,s),this.registerChange(t,i))}}async newPset(t,e,s){const i=ue.getIFCSchema(t),{ownerHistoryHandle:n}=await this.getOwnerHistory(t),o=this.newGUID(t),r=new ft[i].IfcLabel(e),a=s?new ft[i].IfcText(s):null,c=new ft[i].IfcPropertySet(o,n,r,a,[]);c.expressID=this.increaseMaxID(t);const d=this.newGUID(t),E=new ft[i].IfcRelDefinesByProperties(d,n,null,null,[],new Ze(c.expressID));return E.expressID=this.increaseMaxID(t),await this.setData(t,c,E),{pset:c,rel:E}}async removePset(t,...e){for(const s of e){const i=await t.getProperties(s);if((i==null?void 0:i.type)!==ti)continue;const n=await Yt.getPsetRel(t,s);if(n&&(await t.setProperties(n,null),this.registerChange(t,n)),i){for(const o of i.HasProperties)await t.setProperties(o.value,null);await t.setProperties(s,null),this.onPsetRemoved.trigger({model:t,psetID:s}),this.registerChange(t,s)}}}async newSingleProperty(t,e,s,i){const n=ue.getIFCSchema(t),o=new ft[n].IfcIdentifier(s),r=new ft[n][e](i),a=new ft[n].IfcPropertySingleValue(o,null,r,null);return a.expressID=this.increaseMaxID(t),await this.setData(t,a),a}newSingleStringProperty(t,e,s,i){return this.newSingleProperty(t,e,s,i)}newSingleNumericProperty(t,e,s,i){return this.newSingleProperty(t,e,s,i)}newSingleBooleanProperty(t,e,s,i){return this.newSingleProperty(t,e,s,i)}async removePsetProp(t,e,s){const i=await t.getProperties(e),n=await t.getProperties(s);!i||!n||i.type===ti&&n&&(i.HasProperties=i.HasProperties.filter(o=>o.value!==s),await t.setProperties(s,null),this.registerChange(t,e,s))}async addElementToPset(t,e,...s){const i=await Yt.getPsetRel(t,e);if(!i)return;const n=await t.getProperties(i);if(n){for(const o of s){const r=new Ze(o);n.RelatedObjects.push(r),this.onElementToPset.trigger({model:t,psetID:e,elementID:o})}this.registerChange(t,e)}}async addPropToPset(t,e,...s){const i=await t.getProperties(e);if(i){for(const n of s){if(i.HasProperties.includes(n))continue;const o=new Ze(n);i.HasProperties.push(o),this.onPropToPset.trigger({model:t,psetID:e,propID:n})}this.registerChange(t,e)}}async saveToIfc(t,e){const s=this.components.get(Xa),i=s.webIfc,n=await s.readIfcFile(e),o=this.changeMap[t.uuid]??[];for(const a of o){const c=await t.getProperties(a);if(c)try{i.WriteLine(n,c)}catch{}else try{i.DeleteLine(n,a)}catch{}}const r=i.SaveModel(n);return s.webIfc.CloseModel(n),s.cleanUp(),r}async setAttributeListener(t,e,s){this.attributeListeners[t.uuid]||(this.attributeListeners[t.uuid]={});const i=this.attributeListeners[t.uuid][e]?this.attributeListeners[t.uuid][e][s]:null;if(i)return i;const n=await t.getProperties(e);if(!n)throw new Error(`Entity with expressID ${e} doesn't exists.`);const o=n[s];if(Array.isArray(o)||!o)throw new Error(`Attribute ${s} is array or null, and it can't have a listener.`);const r=o.value;if(r===void 0||r==null)throw new Error(`Attribute ${s} has a badly defined handle.`);const a=new M;return Object.defineProperty(n[s],"value",{get(){return this._value},async set(c){this._value=c,a.trigger(c)}}),n[s].value=r,this.attributeListeners[t.uuid][e]||(this.attributeListeners[t.uuid][e]={}),this.attributeListeners[t.uuid][e][s]=a,a}};I(Za,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");const lo=class Eo extends q{constructor(t){super(t),I(this,"enabled",!0),I(this,"list",{}),I(this,"onDisposed",new M),I(this,"onFragmentsDisposed",e=>{const{groupID:s,fragmentIDs:i}=e;for(const n in this.list){const o=this.list[n],r=Object.keys(o);if(r.includes(s))delete o[s],Object.values(o).length===0&&delete this.list[n];else for(const a of r){const c=o[a];for(const d of i)delete c[d];Object.values(c).length===0&&delete o[a]}}}),t.add(Eo.uuid,this),t.get(wt).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(wt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(t){for(const e in this.list){const s=this.list[e];for(const i in s){const n=s[i];delete n[t]}}}find(t){const e=this.components.get(wt);if(!t){const o={};for(const[r,a]of e.list)o[r]=new Set(a.ids);return o}const s=Object.keys(t).length,i={};for(const o in t){const r=t[o];if(!this.list[o]){console.warn(`Classification ${o} does not exist.`);continue}for(const a of r){const c=this.list[o][a];if(c)for(const d in c){i[d]||(i[d]=new Map);for(const E of c[d]){const l=i[d].get(E);l===void 0?i[d].set(E,1):i[d].set(E,l+1)}}}}const n={};for(const o in i){const r=i[o];for(const[a,c]of r){if(c===void 0)throw new Error("Malformed fragments map!");c===s&&(n[o]||(n[o]=new Set),n[o].add(a))}}return n}byModel(t,e){this.list.models||(this.list.models={});const s=this.list.models;s[t]||(s[t]={});const i=s[t];for(const[n,o]of e.data){const r=o[0];for(const a of r){const c=e.keyFragments.get(a);c&&(i[c]||(i[c]=new Set),i[c].add(n))}}}async byPredefinedType(t){var e;this.list.predefinedTypes||(this.list.predefinedTypes={});const s=this.list.predefinedTypes,i=t.getAllPropertiesIDs();for(const n of i){const o=await t.getProperties(n);if(!o)continue;const r=String((e=o.PredefinedType)==null?void 0:e.value).toUpperCase();s[r]||(s[r]={});const a=s[r];for(const[c,d]of t.data){const E=d[0];for(const l of E){const u=t.keyFragments.get(l);if(!u)throw new Error("Fragment ID not found!");a[u]||(a[u]=new Set),a[u].add(o.expressID)}}}}byEntity(t){this.list.entities||(this.list.entities={});for(const[e,s]of t.data){const i=s[1][1],n=no[i];this.saveItem(t,"entities",n,e)}}async byIfcRel(t,e,s){Yt.isRel(e)&&await Yt.getRelationMap(t,e,async(i,n)=>{const{name:o}=await Yt.getEntityName(t,i);for(const r of n)this.saveItem(t,s,o??"NO REL NAME",r)})}async bySpatialStructure(t){var e;const s=this.components.get(Bi),i=s.relationMaps[t.uuid];if(!i)throw new Error(`Classifier: model relations of ${t.name||t.uuid} have to exists to group by spatial structure.`);const n="spatialStructures";for(const[o]of i){const r=s.getEntityRelations(t,o,"ContainsElements"),a=await t.getProperties(o);if(!(r&&a))continue;const c=(e=a.Name)==null?void 0:e.value;for(const d of r){this.saveItem(t,n,c,d);const E=s.getEntityRelations(t,Number(d),"IsDecomposedBy");if(E)for(const l of E)this.saveItem(t,n,c,l)}}}setColor(t,e,s=!1){const i=this.components.get(wt);for(const n in t){const o=i.list.get(n);if(!o)continue;const r=t[n];o.setColor(e,r,s)}}resetColor(t){const e=this.components.get(wt);for(const s in t){const i=e.list.get(s);if(!i)continue;const n=t[s];i.resetColor(n)}}saveItem(t,e,s,i){this.list[e]||(this.list[e]={});const n=t.data.get(i);if(n)for(const o of n[0]){const r=t.keyFragments.get(o);if(r){const a=this.list[e];a[s]||(a[s]={}),a[s][r]||(a[s][r]=new Set),a[s][r].add(i)}}}};I(lo,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let Qa=lo;const Io=class uo extends q{constructor(t){super(t),I(this,"enabled",!0),I(this,"height",10),I(this,"groupName","storeys"),I(this,"onDisposed",new M),I(this,"list",new Set),t.add(uo.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(t){if(!this.enabled)return;const e=this.components.get(Qa),s=this.components.get(wt),i=t?1:-1;let n=0;const o=e.list[this.groupName],r=new X;for(const a in o){r.elements[13]=n*i*this.height;for(const c in o[a]){const d=s.list.get(c),E=a+c,l=this.list.has(E);if(!d||t&&l||!t&&!l)continue;t?this.list.add(E):this.list.delete(E);const u=o[a][c];d.applyTransform(u,r)}n++}}};I(Io,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let ah=Io;const po=class Co extends q{constructor(t){super(t),I(this,"enabled",!0),this.components.add(Co.uuid,this)}set(t,e){const s=this.components.get(wt);if(!e){for(const i in s.list){const n=s.list.get(i);n&&(n.setVisibility(t),this.updateCulledVisibility(n))}return}for(const i in e){const n=e[i],o=s.list.get(i);o&&(o.setVisibility(t,n),this.updateCulledVisibility(o))}}isolate(t){this.set(!1),this.set(!0,t)}updateCulledVisibility(t){const e=this.components.get(va);for(const[s,i]of e.list){const n=i.colorMeshes.get(t.id);n&&(n.count=t.mesh.count)}}};I(po,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let hh=po;class ja extends Yi{constructor(){super(...arguments),I(this,"minGeometrySize",10),I(this,"minAssetsSize",1e3)}}class To extends Yi{constructor(){super(...arguments),I(this,"propertiesSize",100)}}class qa extends q{constructor(){super(...arguments),I(this,"onPropertiesStreamed",new Kt),I(this,"onProgress",new Kt),I(this,"onIndicesStreamed",new Kt),I(this,"onDisposed",new M),I(this,"enabled",!0),I(this,"settings",new To),I(this,"webIfc",new zt)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(t){const e=performance.now();await this.readIfcFile(t),await this.streamAllProperties(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-e} ms!`)}async streamFromCallBack(t){const e=performance.now();await this.streamIfcFile(t),await this.streamAllProperties(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-e} ms!`)}async readIfcFile(t){const{path:e,absolute:s,logLevel:i}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),i&&this.webIfc.SetLogLevel(i),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:s,logLevel:i}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),i&&this.webIfc.SetLogLevel(i),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:t}=this.settings,e=new Set(this.webIfc.GetIfcEntityList(0)),s=[_s,_i,Fi,Ss,gi,Oi],i=new Map,n=new Set([Si,Ni,wi,yi,$t]);for(const c of n)e.add(c);let o=.01,r=0;for(const c of e){if(r++,vi.has(c))continue;const d=n.has(c),E=this.webIfc.GetLineIDsWithType(0,c),l=E.size();let u=0;for(let C=0;Co&&(o+=.01,o=Math.max(o,T),await this.onProgress.trigger(Math.round(o*100)/100))}const a=[];for(const[c,d]of i)a.push([c,...d]);await this.onIndicesStreamed.trigger(a)}getIndices(t,e,s){const i=t.RelatedObjects||t.RelatedElements;if(!i){console.log(`Related objects not found: ${e}`);return}const n=t.RelatingType||t.RelatingMaterial||t.RelatingStructure||t.RelatingPropertyDefinition||t.RelatingGroup||t.RelatingClassification;if(!n){console.log(`Relating object not found: ${e}`);return}if(!Array.isArray(i)||n.value===void 0)return;const o=n.value;for(const r of i){if(r.value===void 0||r.value===null)continue;const a=r.value;s.has(a)||s.set(a,new Set),s.get(a).add(o)}}cleanUp(){this.webIfc=null,this.webIfc=new zt}}I(qa,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");const Ka=class mo extends q{constructor(t){super(t),I(this,"onGeometryStreamed",new M),I(this,"onAssetStreamed",new M),I(this,"onProgress",new M),I(this,"onIfcLoaded",new M),I(this,"onDisposed",new M),I(this,"settings",new ja),I(this,"enabled",!0),I(this,"webIfc",new zt),I(this,"_spatialTree",new ro),I(this,"_metaData",new ho),I(this,"_visitedGeometries",new Map),I(this,"_streamSerializer",new bo),I(this,"_geometries",new Map),I(this,"_geometryCount",0),I(this,"_civil",new ao),I(this,"_groupSerializer",new Pn),I(this,"_assets",[]),I(this,"_meshesWithHoles",new Set),this.components.add(mo.uuid,this),this.settings.excludedCategories.add(Un)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(t){const e=performance.now();await this.readIfcFile(t),await this.streamAllGeometries(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-e} ms!`)}async streamFromCallBack(t){const e=performance.now();await this.streamIfcFile(t),await this.streamAllGeometries(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-e} ms!`)}async readIfcFile(t){const{path:e,absolute:s,logLevel:i}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),i&&this.webIfc.SetLogLevel(i),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:s,logLevel:i}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),i&&this.webIfc.SetLogLevel(i),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:t,minAssetsSize:e}=this.settings;this._spatialTree.setUp(this.webIfc);const s=this.webIfc.GetIfcEntityList(0),i=[[]],n=new Dn,{FILE_NAME:o,FILE_DESCRIPTION:r}=ft;n.ifcMetadata={name:this._metaData.get(this.webIfc,o),description:this._metaData.get(this.webIfc,r),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let a=0,c=0;for(const m of s){if(!this.webIfc.IsIfcElement(m)&&m!==$t||this.settings.excludedCategories.has(m))continue;const R=this.webIfc.GetLineIDsWithType(0,m),F=R.size();console.log(F);for(let p=0;pt&&(a=0,c++,i.push([]));const A=R.get(p);i[c].push(A);const g=this._spatialTree.itemsByFloor[A]||0;n.data.set(A,[[],[g,m]]),a++}}this._spatialTree.cleanUp();let d=.01,E=0;for(const m of i){E++,this.webIfc.StreamMeshes(0,m,F=>{this.getMesh(this.webIfc,F,n)}),this._geometryCount>t&&await this.streamGeometries(),this._assets.length>e&&await this.streamAssets();const R=E/i.length;R>d&&(d+=.01,d=Math.max(d,R),this.onProgress.trigger(Math.round(d*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:l,transparent:u}=n.geometryIDs;for(const[m,{index:R,uuid:F}]of this._visitedGeometries)n.keyFragments.set(R,F),(m>1?l:u).set(m,R);const T=n.data.keys();for(const m of T){const[R]=n.data.get(m);R.length||n.data.delete(m)}const C=this.webIfc.GetCoordinationMatrix(0);n.coordinationMatrix.fromArray(C),n.civilData=this._civil.read(this.webIfc);const f=this._groupSerializer.export(n);this.onIfcLoaded.trigger(f),n.dispose(!0)}cleanUp(){this.webIfc=null,this.webIfc=new zt,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(t,e,s){const i=e.geometries.size(),n=e.expressID,o={id:n,geometries:[]};for(let r=0;ri&&(i+=.01,i=Math.max(i,l),await this.onProgress.trigger(Math.round(i*100)/100))}const o=await this.components.get(Bi).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(o)}cleanUp(){this.webIfc=null,this.webIfc=new zt}}I($a,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");const fo=class Ro extends q{constructor(t){super(t),I(this,"enabled",!0),t.add(Ro.uuid,this)}getFace(t,e,s){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const i=new Map,n=t.geometry.index.array,{plane:o}=this.getFaceData(e,s,t),r=[];for(let E=0;Ep.id);if(!u.size){const p=a++;for(const{id:A}of l)c.set(A,p);d.set(p,{edges:new Set(T),indices:new Set([E])});continue}let C=null;const f=new Set,m=new Set(T);for(const[p,A]of u){C===null?C=A:A!==C&&f.add(A),c.delete(p);const{edges:g}=d.get(A);g.delete(p),m.delete(p)}if(C===null)throw new Error("Error computing face!");const R=d.get(C),{indices:F}=R;F.add(E);for(const p of m){c.set(p,C);const{edges:A}=R;A.add(p)}for(const p of f){const A=d.get(p),{edges:g,indices:_}=A,S=d.get(C),{edges:w,indices:y}=S;for(const L of g)w.add(L),c.set(L,C);for(const L of _)y.add(L);d.delete(p)}}for(const[E,{indices:l,edges:u}]of d)if(l.has(e)){const T=[];for(const C of u){const f=i.get(C);T.push(f)}return{edges:T,indices:l}}return null}static distanceFromPointToLine(t,e,s,i=!1){const n=new At,o=new O;return n.set(e,s),n.closestPointToPoint(t,i,o),o.distanceTo(t)}getFaceData(t,e,s){const i=this.getVerticesAndNormal(s,t,e),{p1:n,p2:o,p3:r,faceNormal:a}=i;this.round(n),this.round(o),this.round(r),this.round(a);const c=[{id:`${n.x}|${n.y}|${n.z}`,value:n},{id:`${o.x}|${o.y}|${o.z}`,value:o},{id:`${r.x}|${r.y}|${r.z}`,value:r}];c.sort((R,F)=>R.idF.id?1:0);const[{id:d,value:E},{id:l,value:u},{id:T,value:C}]=c,f=[{id:`${d}|${l}`,distance:E.distanceTo(u),points:[E,u]},{id:`${l}|${T}`,distance:u.distanceTo(C),points:[u,C]},{id:`${d}|${T}`,distance:E.distanceTo(C),points:[E,C]}],m=new fe;return m.setFromNormalAndCoplanarPoint(a,n),m.constant=Math.round(m.constant*10)/10,{plane:m,edges:f}}getVerticesAndNormal(t,e,s){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const i=t.geometry.index.array,n=t.geometry.attributes.position.array,o=t.geometry.attributes.normal.array,r=i[e*3]*3,a=i[e*3+1]*3,c=i[e*3+2]*3,d=new O(n[r],n[r+1],n[r+2]),E=new O(n[a],n[a+1],n[a+2]),l=new O(n[c],n[c+1],n[c+2]),u=new O(o[r],o[r+1],o[r+2]),T=new O(o[a],o[a+1],o[a+2]),C=new O(o[c],o[c+1],o[c+2]),f=(u.x+T.x+C.x)/3,m=(u.y+T.y+C.y)/3,R=(u.z+T.z+C.z)/3,F=new O(f,m,R);if(s!==void 0&&t instanceof Ge){const p=new X;t.getMatrixAt(s,p);const A=new X;A.extractRotation(p),F.applyMatrix4(A),d.applyMatrix4(p),E.applyMatrix4(p),l.applyMatrix4(p)}return{p1:d,p2:E,p3:l,faceNormal:F}}round(t){t.x=Math.trunc(t.x*1e3)/1e3,t.y=Math.trunc(t.y*1e3)/1e3,t.z=Math.trunc(t.z*1e3)/1e3}};I(fo,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let ch=fo;export{rh as A,va as C,Yt as G,Ei as H,q as J,Kt as K,ga as N,ah as O,Qa as R,M as U,Bi as W,xa as Y,ch as _,me as a,bi as b,Xa as c,no as d,th as e,Ia as f,hh as g,nh as h,sh as i,He as k,ih as m,oh as n,Aa as p,eh as s,wt as u}; + `,n=new Blob([i],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n))}dispose(){this.enabled=!1;for(const t of this.scene.children)t.removeFromParent();this.onViewUpdated.reset(),this.worker.terminate(),this.renderer.dispose(),this.renderTarget.dispose(),this._buffer=null,this.onDisposed.reset()}getAvailableColor(){let t=BigInt(this._availableColor.toString());const e=[];do e.unshift(Number(t%256n)),t/=256n;while(t);for(;e.length!==3;)e.unshift(0);const[s,i,n]=e,o=`${s}-${i}-${n}`;return{r:s,g:i,b:n,code:o}}increaseColor(){if(this._availableColor===256*256*256){console.warn("Color can't be increased over 256 x 256 x 256!");return}this._availableColor++}decreaseColor(){if(this._availableColor===1){console.warn("Color can't be decreased under 0!");return}this._availableColor--}applySettings(t){t&&(t.updateInterval!==void 0&&(this.updateInterval=t.updateInterval),t.height!==void 0&&(this._height=t.height),t.width!==void 0&&(this._width=t.width),t.autoUpdate!==void 0&&(this.autoUpdate=t.autoUpdate))}}class ba extends xa{constructor(t,e,s){super(t,e,s),I(this,"threshold",100),I(this,"onViewUpdated",new M),I(this,"colorMeshes",new Map),I(this,"isProcessing",!1),I(this,"_colorCodeMeshMap",new Map),I(this,"_meshIDColorCodeMap",new Map),I(this,"_currentVisibleMeshes",new Set),I(this,"_recentlyHiddenMeshes",new Set),I(this,"_intervalID",null),I(this,"_transparentMat",new Te({transparent:!0,opacity:0})),I(this,"handleWorkerMessage",async i=>{if(this.isProcessing)return;const n=i.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[o,r]of n){if(r{this.isProcessing||await this.updateVisibility()},this.updateInterval),this.onViewUpdated.add(({seen:i,unseen:n})=>{for(const o of i)o.visible=!0;for(const o of n)o.visible=!1})}dispose(){super.dispose(),this._intervalID!==null&&(window.clearInterval(this._intervalID),this._intervalID=null),this._currentVisibleMeshes.clear(),this._recentlyHiddenMeshes.clear(),this._meshIDColorCodeMap.clear(),this._transparentMat.dispose(),this._colorCodeMeshMap.clear();const t=this.components.get(me);for(const e in this.colorMeshes){const s=this.colorMeshes.get(e);s&&t.destroy(s,!0)}this.colorMeshes.clear()}add(t){if(!this.enabled)return;if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const e=t instanceof Ge,{geometry:s,material:i}=t,{colorMaterial:n,code:o}=this.getAvailableMaterial();let r;if(Array.isArray(i)){let d=!0;const E=[];for(const l of i)un.isTransparent(l)?E.push(this._transparentMat):(d=!1,E.push(n));if(d){n.dispose(),this.isProcessing=!1;return}r=E}else if(un.isTransparent(i)){n.dispose(),this.isProcessing=!1;return}else r=n;this._colorCodeMeshMap.set(o,t),this._meshIDColorCodeMap.set(t.uuid,o);const a=e?t.count:1,c=new Ge(s,r,a);e?c.instanceMatrix=t.instanceMatrix:c.setMatrixAt(0,new X),t.visible=!1,c.applyMatrix4(t.matrix),c.updateMatrix(),this.scene.add(c),this.colorMeshes.set(t.uuid,c),this.increaseColor(),this.isProcessing=!1}remove(t){if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const e=this.components.get(me);this._currentVisibleMeshes.delete(t),this._recentlyHiddenMeshes.delete(t);const s=this.colorMeshes.get(t.uuid),i=this._meshIDColorCodeMap.get(t.uuid);if(!s||!i){this.isProcessing=!1,console.log(t.visible);return}this._colorCodeMeshMap.delete(i),this._meshIDColorCodeMap.delete(t.uuid),this.colorMeshes.delete(t.uuid),s.geometry=void 0,s.material=[],e.destroy(s,!0),this._recentlyHiddenMeshes.delete(t),this._currentVisibleMeshes.delete(t),this.isProcessing=!1}getAvailableMaterial(){const{r:t,g:e,b:s,code:i}=this.getAvailableColor(),n=Ms.enabled;Ms.enabled=!1;const o=new qt(`rgb(${t}, ${e}, ${s})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const r=this.world.renderer.clippingPlanes,a=new Te({color:o,clippingPlanes:r,side:ke});return Ms.enabled=n,{colorMaterial:a,code:i}}}const qn=class ui extends q{constructor(t){super(t),I(this,"_enabled",!0),I(this,"list",new Map),I(this,"onDisposed",new M),t.add(ui.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const[e,s]of this.list)s.enabled=t}create(t,e){if(this.list.has(t.uuid))return this.list.get(t.uuid);const s=new ba(this.components,t,e);return this.list.set(t.uuid,s),s}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(ui.uuid),this.onDisposed.reset();for(const[t,e]of this.list)e.dispose();this.list.clear()}};I(qn,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let va=qn;class Ba{constructor(t){if(I(this,"onDisposed",new M),I(this,"onAfterUpdate",new M),I(this,"onBeforeUpdate",new M),I(this,"onResize",new M),I(this,"frontOffset",0),I(this,"overrideMaterial",new Yo),I(this,"backgroundColor",new qt(395274)),I(this,"renderer"),I(this,"enabled",!0),I(this,"world"),I(this,"_lockRotation",!0),I(this,"_camera"),I(this,"_plane"),I(this,"_size",new Ft(320,160)),I(this,"_tempVector1",new O),I(this,"_tempVector2",new O),I(this,"_tempTarget",new O),I(this,"down",new O(0,-1,0)),I(this,"updatePlanes",()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const i=[],n=this.world.renderer.three;for(const o of n.clippingPlanes)i.push(o);i.push(this._plane),this.renderer.clippingPlanes=i}),this.world=t,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new As,this.renderer.setSize(this._size.x,this._size.y);const e=1,s=this._size.x/this._size.y;this._camera=new fi(e*s/-2,e*s/2,e/2,e/-2),this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes),this._camera.position.set(0,200,0),this._camera.zoom=.1,this._camera.rotation.x=-Math.PI/2,this._plane=new fe(this.down,200),this.updatePlanes()}get lockRotation(){return this._lockRotation}set lockRotation(t){this._lockRotation=t,t&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(t){this._camera.zoom=t,this._camera.updateProjectionMatrix()}dispose(){this.enabled=!1,this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.onResize.reset(),this.overrideMaterial.dispose(),this.renderer.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return this._camera}update(){if(!this.enabled)return;this.onBeforeUpdate.trigger();const t=this.world.scene.three,e=this.world.camera;if(!e.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(t instanceof mi))throw new Error("The given world must have a THREE.Scene as a root!");const s=e.controls;if(s.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,this.frontOffset!==0&&(s.getTarget(this._tempVector2),this._tempVector2.sub(this._tempVector1),this._tempVector2.normalize().multiplyScalar(this.frontOffset),this._camera.position.x+=this._tempVector2.x,this._camera.position.z+=this._tempVector2.z),!this._lockRotation){s.getTarget(this._tempTarget);const n=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=n+Math.PI}this._plane.set(this.down,this._tempVector1.y);const i=t.background;t.background=this.backgroundColor,this.renderer.render(t,this._camera),t.background=i,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(t=this._size){this._size.copy(t),this.renderer.setSize(t.x,t.y);const e=t.x/t.y,s=1;this._camera.left=s*e/-2,this._camera.right=s*e/2,this._camera.top=s/2,this._camera.bottom=-s/2,this._camera.updateProjectionMatrix(),this.onResize.trigger(t)}}const Kn=class $n extends q{constructor(t){super(t),I(this,"onAfterUpdate",new M),I(this,"onBeforeUpdate",new M),I(this,"onDisposed",new M),I(this,"enabled",!0),I(this,"list",new Map),this.components.add($n.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a minimap!");const e=new Ba(t);return this.list.set(t.uuid,e),e}delete(t){const e=this.list.get(t);e&&e.dispose(),this.list.delete(t)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[t,e]of this.list)e.update()}};I(Kn,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let nh=Kn;class Ya{constructor(t){I(this,"enabled",!1),I(this,"id","FirstPerson"),this.camera=t}set(t){if(this.enabled=t,t){if(this.camera.projection.current!=="Perspective"){this.camera.set("Orbit");return}this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const t=this.camera.controls,e=new O;t.distance--,t.getPosition(e),t.minDistance=1,t.maxDistance=1,t.distance=1,t.moveTo(e.x,e.y,e.z),t.truckSpeed=50,t.mouseButtons.wheel=ot.ACTION.DOLLY,t.touches.two=ot.ACTION.TOUCH_ZOOM_TRUCK}}class za{constructor(t){I(this,"enabled",!0),I(this,"id","Orbit"),this.camera=t,this.activateOrbitControls()}set(t){this.enabled=t,t&&this.activateOrbitControls()}activateOrbitControls(){const t=this.camera.controls;t.minDistance=1,t.maxDistance=300;const e=new O;t.getPosition(e);const s=e.length();t.distance=s,t.truckSpeed=2;const{rotation:i}=this.camera.three,n=new O(0,0,-1).applyEuler(i),o=e.addScaledVector(n,s);t.moveTo(o.x,o.y,o.z)}}class Ga{constructor(t){I(this,"enabled",!1),I(this,"id","Plan"),I(this,"mouseAction1"),I(this,"mouseAction2"),I(this,"mouseInitialized",!1),I(this,"defaultAzimuthSpeed"),I(this,"defaultPolarSpeed"),this.camera=t,this.defaultAzimuthSpeed=t.controls.azimuthRotateSpeed,this.defaultPolarSpeed=t.controls.polarRotateSpeed}set(t){this.enabled=t;const e=this.camera.controls;e.azimuthRotateSpeed=t?0:this.defaultAzimuthSpeed,e.polarRotateSpeed=t?0:this.defaultPolarSpeed,this.mouseInitialized||(this.mouseAction1=e.touches.one,this.mouseAction2=e.touches.two,this.mouseInitialized=!0),t?(e.mouseButtons.left=ot.ACTION.TRUCK,e.touches.one=ot.ACTION.TOUCH_TRUCK,e.touches.two=ot.ACTION.TOUCH_ZOOM):(e.mouseButtons.left=ot.ACTION.ROTATE,e.touches.one=this.mouseAction1,e.touches.two=this.mouseAction2)}}class Va{constructor(t){I(this,"onChanged",new M),I(this,"current","Perspective"),I(this,"camera"),I(this,"_component"),I(this,"_previousDistance",-1),I(this,"matchOrthoDistanceEnabled",!1),this._component=t,this.camera=t.three}async set(t){this.current!==t&&(t==="Orthographic"?this.setOrthoCamera():await this.setPerspectiveCamera(),this.onChanged.trigger(this.camera))}async toggle(){const t=this.current==="Perspective"?"Orthographic":"Perspective";await this.set(t)}setOrthoCamera(){if(this._component.mode===null||this._component.mode.id==="FirstPerson")return;this._previousDistance=this._component.controls.distance,this._component.controls.distance=200;const t=this.getPerspectiveDims();if(!t)return;const{width:e,height:s}=t;this.setupOrthoCamera(s,e),this.camera=this._component.threeOrtho,this.current="Orthographic"}getPerspectiveDims(){const t=this._component.currentWorld;if(!t||!t.renderer)return null;const e=new O;this._component.threePersp.getWorldDirection(e);const s=new O;this._component.controls.getTarget(s);const i=s.clone().sub(this._component.threePersp.position).dot(e),n=t.renderer.getSize(),o=n.x/n.y,r=this._component.threePersp,a=i*2*Math.atan(r.fov*(Math.PI/180)/2);return{width:a*o,height:a}}setupOrthoCamera(t,e){this._component.controls.mouseButtons.wheel=ot.ACTION.ZOOM,this._component.controls.mouseButtons.middle=ot.ACTION.ZOOM;const s=this._component.threePersp,i=this._component.threeOrtho;i.zoom=1,i.left=e/-2,i.right=e/2,i.top=t/2,i.bottom=t/-2,i.updateProjectionMatrix(),i.position.copy(s.position),i.quaternion.copy(s.quaternion),this._component.controls.camera=i}getDistance(){const t=this._component.threePersp,e=this._component.threeOrtho;return(e.top-e.bottom)/e.zoom/(2*Math.atan(t.fov*(Math.PI/180)/2))}async setPerspectiveCamera(){this._component.controls.mouseButtons.wheel=ot.ACTION.DOLLY,this._component.controls.mouseButtons.middle=ot.ACTION.DOLLY;const t=this._component.threePersp,e=this._component.threeOrtho;t.position.copy(e.position),t.quaternion.copy(e.quaternion),this._component.controls.mouseButtons.wheel=ot.ACTION.DOLLY,this.matchOrthoDistanceEnabled?this._component.controls.distance=this.getDistance():this._component.controls.distance=this._previousDistance,await this._component.controls.zoomTo(1),t.updateProjectionMatrix(),this._component.controls.camera=t,this.camera=t,this.current="Perspective"}}class oh extends He{constructor(t){super(t),I(this,"_mode",null),I(this,"projection"),I(this,"threeOrtho"),I(this,"threePersp"),I(this,"_userInputButtons",{}),I(this,"_frustumSize",50),I(this,"_navigationModes",new Map),I(this,"previousSize",null),this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new Va(this),this.onAspectUpdated.add(()=>{this.setOrthoPerspCameraAspect()}),this.projection.onChanged.add(e=>{this.three=e,this.updateAspect()}),this.onWorldChanged.add(({action:e})=>{e==="added"&&(this._navigationModes.clear(),this._navigationModes.set("Orbit",new za(this)),this._navigationModes.set("FirstPerson",new Ya(this)),this._navigationModes.set("Plan",new Ga(this)),this._mode=this._navigationModes.get("Orbit"),this.mode.set(!0,{preventTargetAdjustment:!0}),this.currentWorld&&this.currentWorld.renderer&&(this.previousSize=this.currentWorld.renderer.getSize().clone()))})}get mode(){if(!this._mode)throw new Error("Mode not found, camera not initialized");return this._mode}dispose(){super.dispose(),this.threeOrtho.removeFromParent()}set(t){if(this.mode!==null&&this.mode.id!==t){if(this.mode.set(!1),!this._navigationModes.has(t))throw new Error("The specified mode does not exist!");this._mode=this._navigationModes.get(t),this.mode.set(!0)}}async fit(t,e=1.5){if(!this.enabled)return;const s=Number.MAX_VALUE,i=Number.MIN_VALUE,n=new O(s,s,s),o=new O(i,i,i);for(const l of t){const u=new st().setFromObject(l);u.min.xo.x&&(o.x=u.max.x),u.max.y>o.y&&(o.y=u.max.y),u.max.z>o.z&&(o.z=u.max.z)}const r=new st(n,o),a=new O;r.getSize(a);const c=new O;r.getCenter(c);const d=Math.max(a.x,a.y,a.z)*e,E=new Os(c,d);await this.controls.fitToSphere(E,!0)}setUserInput(t){t?this.enableUserInput():this.disableUserInput()}disableUserInput(){this._userInputButtons.left=this.controls.mouseButtons.left,this._userInputButtons.right=this.controls.mouseButtons.right,this._userInputButtons.middle=this.controls.mouseButtons.middle,this._userInputButtons.wheel=this.controls.mouseButtons.wheel,this.controls.mouseButtons.left=0,this.controls.mouseButtons.right=0,this.controls.mouseButtons.middle=0,this.controls.mouseButtons.wheel=0}enableUserInput(){Object.keys(this._userInputButtons).length!==0&&(this.controls.mouseButtons.left=this._userInputButtons.left,this.controls.mouseButtons.right=this._userInputButtons.right,this.controls.mouseButtons.middle=this._userInputButtons.middle,this.controls.mouseButtons.wheel=this._userInputButtons.wheel)}newOrthoCamera(){const t=window.innerWidth/window.innerHeight;return new fi(this._frustumSize*t/-2,this._frustumSize*t/2,this._frustumSize/2,this._frustumSize/-2,.1,1e3)}setOrthoPerspCameraAspect(){if(!this.currentWorld||!this.currentWorld.renderer||!this.previousSize)return;const t=this.currentWorld.renderer.getSize(),e=this.threeOrtho.top,s=this.threeOrtho.right,i=t.y/this.previousSize.y,n=t.x/this.previousSize.x,o=e*i,r=s*n;this.threeOrtho.left=-r,this.threeOrtho.right=r,this.threeOrtho.top=o,this.threeOrtho.bottom=-o,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(t)}}const Jn=class Lt extends q{constructor(t){super(t),I(this,"enabled",!0),I(this,"onDisposed",new M),I(this,"_absoluteMin"),I(this,"_absoluteMax"),I(this,"_meshes",[]),this.components.add(Lt.uuid,this),this._absoluteMin=Lt.newBound(!0),this._absoluteMax=Lt.newBound(!1)}static getDimensions(t){const{min:e,max:s}=t,i=Math.abs(s.x-e.x),n=Math.abs(s.y-e.y),o=Math.abs(s.z-e.z),r=new O;return r.subVectors(s,e).divideScalar(2).add(e),{width:i,height:n,depth:o,center:r}}static newBound(t){const e=t?1:-1;return new O(e*Number.MAX_VALUE,e*Number.MAX_VALUE,e*Number.MAX_VALUE)}static getBounds(t,e,s){const i=s||this.newBound(!1),n=e||this.newBound(!0);for(const o of t)o.xi.x&&(i.x=o.x),o.y>i.y&&(i.y=o.y),o.z>i.z&&(i.z=o.z);return new st(e,s)}dispose(){const t=this.components.get(me);for(const e of this._meshes)t.destroy(e);this._meshes=[],this.onDisposed.trigger(Lt.uuid),this.onDisposed.reset()}get(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone();return new st(t,e)}getSphere(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone(),s=Math.abs((e.x-t.x)/2),i=Math.abs((e.y-t.y)/2),n=Math.abs((e.z-t.z)/2),o=new O(t.x+s,t.y+i,t.z+n),r=o.distanceTo(t);return new Os(o,r)}getMesh(){const t=new st(this._absoluteMin,this._absoluteMax),e=Lt.getDimensions(t),{width:s,height:i,depth:n,center:o}=e,r=new it(s,i,n),a=new D(r);return this._meshes.push(a),a.position.copy(o),a}reset(){this._absoluteMin=Lt.newBound(!0),this._absoluteMax=Lt.newBound(!1)}add(t){for(const e of t.items)this.addMesh(e.mesh)}addMesh(t,e){if(!t.geometry.index)return;const s=Lt.getFragmentBounds(t);t.updateMatrixWorld();const i=t.matrixWorld,n=new X,o=t instanceof Ge,r=new Set;if(e&&t instanceof Mo)for(const a of e){const c=t.fragment.getInstancesIDs(a);if(c)for(const d of c)r.add(d)}else r.add(0);for(const a of r){const c=s.min.clone(),d=s.max.clone();o&&(t.getMatrixAt(a,n),c.applyMatrix4(n),d.applyMatrix4(n)),c.applyMatrix4(i),d.applyMatrix4(i),c.xthis._absoluteMax.x&&(this._absoluteMax.x=c.x),c.y>this._absoluteMax.y&&(this._absoluteMax.y=c.y),c.z>this._absoluteMax.z&&(this._absoluteMax.z=c.z),d.x>this._absoluteMax.x&&(this._absoluteMax.x=d.x),d.y>this._absoluteMax.y&&(this._absoluteMax.y=d.y),d.z>this._absoluteMax.z&&(this._absoluteMax.z=d.z),d.xo.x&&(o.x=d),E>o.y&&(o.y=E),l>o.z&&(o.z=l)}return new st(n,o)}};I(Jn,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let rh=Jn;const vi=new Set([1123145078,574549367,1675464909,2059837836,3798115385,32440307,3125803723,3207858831,2740243338,2624227202,4240577450,3615266464,3724593414,220341763,477187591,1878645084,1300840506,3303107099,1607154358,1878645084,846575682,1351298697,2417041796,3049322572,3331915920,1416205885,776857604,3285139300,3958052878,2827736869,2732653382,673634403,3448662350,4142052618,2924175390,803316827,2556980723,1809719519,2205249479,807026263,3737207727,1660063152,2347385850,3940055652,2705031697,3732776249,2485617015,2611217952,1704287377,2937912522,2770003689,1281925730,1484403080,3448662350,4142052618,3800577675,4006246654,3590301190,1383045692,2775532180,2047409740,370225590,3593883385,2665983363,4124623270,812098782,3649129432,987898635,1105321065,3510044353,1635779807,2603310189,3406155212,1310608509,4261334040,2736907675,3649129432,1136057603,1260505505,4182860854,2713105998,2898889636,59481748,3749851601,3486308946,3150382593,1062206242,3264961684,15328376,1485152156,370225590,1981873012,2859738748,45288368,2614616156,2732653382,775493141,2147822146,2601014836,2629017746,1186437898,2367409068,1213902940,3632507154,3900360178,476780140,1472233963,2804161546,3008276851,738692330,374418227,315944413,3905492369,3570813810,2571569899,178912537,2294589976,1437953363,2133299955,572779678,3092502836,388784114,2624227202,1425443689,3057273783,2347385850,1682466193,2519244187,2839578677,3958567839,2513912981,2830218821,427810014]),to=class eo extends q{constructor(t){super(t),I(this,"enabled",!0),t.add(eo.uuid,this)}async export(t,e,s=!1,i=!0){const n={},o=new Set(t.GetIfcEntityList(e)),r=new Set([Si,Ni,wi,yi,$t]);for(const a of r)o.add(a);for(const a of o){if(vi.has(a))continue;const c=r.has(a)&&i,d=t.GetLineIDsWithType(e,a);for(const E of d){const l=t.GetLine(0,E,c,s);n[l.expressID]=l}}return n}};I(to,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let Ha=to;const so=class io extends q{constructor(t){super(t),I(this,"onDisposed",new M),I(this,"onFragmentsLoaded",new M),I(this,"onFragmentsDisposed",new M),I(this,"list",new Map),I(this,"groups",new Map),I(this,"enabled",!0),I(this,"baseCoordinationModel",""),I(this,"_loader",new Pn),this.components.add(io.uuid,this)}get meshes(){const t=[];for(const[e,s]of this.list)t.push(s.mesh);return t}dispose(){for(const[t,e]of this.groups)e.dispose(!0);this.baseCoordinationModel="",this.groups.clear(),this.list.clear(),this.onFragmentsLoaded.reset(),this.onFragmentsDisposed.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}disposeGroup(t){const{uuid:e}=t,s=[];for(const i of t.items)s.push(i.id),this.list.delete(i.id);t.dispose(!0),this.groups.delete(t.uuid),this.onFragmentsDisposed.trigger({groupID:e,fragmentIDs:s})}load(t,e){const s={coordinate:!0,...e},{coordinate:i,properties:n,relationsMap:o}=s,r=this._loader.import(t);for(const a of r.items)a.group=r,this.list.set(a.id,a);return i&&this.coordinate([r]),this.groups.set(r.uuid,r),n&&r.setLocalProperties(n),o&&this.components.get(Bi).setRelationMap(r,o),this.onFragmentsLoaded.trigger(r),r}export(t){return this._loader.export(t)}coordinate(t=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const s=t.pop();if(!s)return;this.baseCoordinationModel=s.uuid}if(!t.length)return;const e=this.groups.get(this.baseCoordinationModel);if(!e){console.log("No base model found for coordination!");return}for(const s of t)s!==e&&(s.position.set(0,0,0),s.rotation.set(0,0,0),s.scale.set(1,1,1),s.updateMatrix(),s.applyMatrix4(s.coordinationMatrix.clone().invert()),s.applyMatrix4(e.coordinationMatrix))}};I(so,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let wt=so;const no={950732822:"IFCURIREFERENCE",4075327185:"IFCTIME",1209108979:"IFCTEMPERATURERATEOFCHANGEMEASURE",3457685358:"IFCSOUNDPRESSURELEVELMEASURE",4157543285:"IFCSOUNDPOWERLEVELMEASURE",2798247006:"IFCPROPERTYSETDEFINITIONSET",1790229001:"IFCPOSITIVEINTEGER",525895558:"IFCNONNEGATIVELENGTHMEASURE",1774176899:"IFCLINEINDEX",1275358634:"IFCLANGUAGEID",2541165894:"IFCDURATION",3701338814:"IFCDAYINWEEKNUMBER",2195413836:"IFCDATETIME",937566702:"IFCDATE",1683019596:"IFCCARDINALPOINTREFERENCE",2314439260:"IFCBINARY",1500781891:"IFCAREADENSITYMEASURE",3683503648:"IFCARCINDEX",4065007721:"IFCYEARNUMBER",1718600412:"IFCWARPINGMOMENTMEASURE",51269191:"IFCWARPINGCONSTANTMEASURE",2593997549:"IFCVOLUMETRICFLOWRATEMEASURE",3458127941:"IFCVOLUMEMEASURE",3345633955:"IFCVAPORPERMEABILITYMEASURE",1278329552:"IFCTORQUEMEASURE",2591213694:"IFCTIMESTAMP",2726807636:"IFCTIMEMEASURE",743184107:"IFCTHERMODYNAMICTEMPERATUREMEASURE",2016195849:"IFCTHERMALTRANSMITTANCEMEASURE",857959152:"IFCTHERMALRESISTANCEMEASURE",2281867870:"IFCTHERMALEXPANSIONCOEFFICIENTMEASURE",2645777649:"IFCTHERMALCONDUCTIVITYMEASURE",232962298:"IFCTHERMALADMITTANCEMEASURE",296282323:"IFCTEXTTRANSFORMATION",603696268:"IFCTEXTFONTNAME",3490877962:"IFCTEXTDECORATION",1460886941:"IFCTEXTALIGNMENT",2801250643:"IFCTEXT",58845555:"IFCTEMPERATUREGRADIENTMEASURE",361837227:"IFCSPECULARROUGHNESS",2757832317:"IFCSPECULAREXPONENT",3477203348:"IFCSPECIFICHEATCAPACITYMEASURE",993287707:"IFCSOUNDPRESSUREMEASURE",846465480:"IFCSOUNDPOWERMEASURE",3471399674:"IFCSOLIDANGLEMEASURE",408310005:"IFCSHEARMODULUSMEASURE",2190458107:"IFCSECTIONALAREAINTEGRALMEASURE",3467162246:"IFCSECTIONMODULUSMEASURE",2766185779:"IFCSECONDINMINUTE",3211557302:"IFCROTATIONALSTIFFNESSMEASURE",1755127002:"IFCROTATIONALMASSMEASURE",2133746277:"IFCROTATIONALFREQUENCYMEASURE",200335297:"IFCREAL",96294661:"IFCRATIOMEASURE",3972513137:"IFCRADIOACTIVITYMEASURE",3665567075:"IFCPRESSUREMEASURE",2169031380:"IFCPRESENTABLETEXT",1364037233:"IFCPOWERMEASURE",1245737093:"IFCPOSITIVERATIOMEASURE",3054510233:"IFCPOSITIVEPLANEANGLEMEASURE",2815919920:"IFCPOSITIVELENGTHMEASURE",4042175685:"IFCPLANEANGLEMEASURE",2642773653:"IFCPLANARFORCEMEASURE",2260317790:"IFCPARAMETERVALUE",929793134:"IFCPHMEASURE",2395907400:"IFCNUMERICMEASURE",2095195183:"IFCNORMALISEDRATIOMEASURE",765770214:"IFCMONTHINYEARNUMBER",2615040989:"IFCMONETARYMEASURE",3114022597:"IFCMOMENTOFINERTIAMEASURE",1648970520:"IFCMOLECULARWEIGHTMEASURE",3177669450:"IFCMOISTUREDIFFUSIVITYMEASURE",1753493141:"IFCMODULUSOFSUBGRADEREACTIONMEASURE",1052454078:"IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE",2173214787:"IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE",3341486342:"IFCMODULUSOFELASTICITYMEASURE",102610177:"IFCMINUTEINHOUR",3531705166:"IFCMASSPERLENGTHMEASURE",3124614049:"IFCMASSMEASURE",4017473158:"IFCMASSFLOWRATEMEASURE",1477762836:"IFCMASSDENSITYMEASURE",2486716878:"IFCMAGNETICFLUXMEASURE",286949696:"IFCMAGNETICFLUXDENSITYMEASURE",151039812:"IFCLUMINOUSINTENSITYMEASURE",2755797622:"IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE",2095003142:"IFCLUMINOUSFLUXMEASURE",503418787:"IFCLOGICAL",3086160713:"IFCLINEARVELOCITYMEASURE",1307019551:"IFCLINEARSTIFFNESSMEASURE",2128979029:"IFCLINEARMOMENTMEASURE",191860431:"IFCLINEARFORCEMEASURE",1243674935:"IFCLENGTHMEASURE",3258342251:"IFCLABEL",2054016361:"IFCKINEMATICVISCOSITYMEASURE",3192672207:"IFCISOTHERMALMOISTURECAPACITYMEASURE",3686016028:"IFCIONCONCENTRATIONMEASURE",3809634241:"IFCINTEGERCOUNTRATEMEASURE",1939436016:"IFCINTEGER",2679005408:"IFCINDUCTANCEMEASURE",3358199106:"IFCILLUMINANCEMEASURE",983778844:"IFCIDENTIFIER",2589826445:"IFCHOURINDAY",1158859006:"IFCHEATINGVALUEMEASURE",3113092358:"IFCHEATFLUXDENSITYMEASURE",3064340077:"IFCGLOBALLYUNIQUEID",3044325142:"IFCFREQUENCYMEASURE",1361398929:"IFCFORCEMEASURE",2590844177:"IFCFONTWEIGHT",2715512545:"IFCFONTVARIANT",1102727119:"IFCFONTSTYLE",2078135608:"IFCENERGYMEASURE",2506197118:"IFCELECTRICVOLTAGEMEASURE",2951915441:"IFCELECTRICRESISTANCEMEASURE",3790457270:"IFCELECTRICCURRENTMEASURE",2093906313:"IFCELECTRICCONDUCTANCEMEASURE",3818826038:"IFCELECTRICCHARGEMEASURE",1827137117:"IFCELECTRICCAPACITANCEMEASURE",69416015:"IFCDYNAMICVISCOSITYMEASURE",524656162:"IFCDOSEEQUIVALENTMEASURE",4134073009:"IFCDIMENSIONCOUNT",1514641115:"IFCDESCRIPTIVEMEASURE",300323983:"IFCDAYLIGHTSAVINGHOUR",86635668:"IFCDAYINMONTHNUMBER",94842927:"IFCCURVATUREMEASURE",1778710042:"IFCCOUNTMEASURE",3238673880:"IFCCONTEXTDEPENDENTMEASURE",3812528620:"IFCCOMPOUNDPLANEANGLEMEASURE",2991860651:"IFCCOMPLEXNUMBER",1867003952:"IFCBOXALIGNMENT",2735952531:"IFCBOOLEAN",2650437152:"IFCAREAMEASURE",632304761:"IFCANGULARVELOCITYMEASURE",360377573:"IFCAMOUNTOFSUBSTANCEMEASURE",4182062534:"IFCACCELERATIONMEASURE",3699917729:"IFCABSORBEDDOSEMEASURE",1971632696:"IFCGEOSLICE",2680139844:"IFCGEOMODEL",24726584:"IFCELECTRICFLOWTREATMENTDEVICE",3693000487:"IFCDISTRIBUTIONBOARD",3460952963:"IFCCONVEYORSEGMENT",3999819293:"IFCCAISSONFOUNDATION",3314249567:"IFCBOREHOLE",4196446775:"IFCBEARING",325726236:"IFCALIGNMENT",3425753595:"IFCTRACKELEMENT",991950508:"IFCSIGNAL",3798194928:"IFCREINFORCEDSOIL",3290496277:"IFCRAIL",1383356374:"IFCPAVEMENT",2182337498:"IFCNAVIGATIONELEMENT",234836483:"IFCMOORINGDEVICE",2078563270:"IFCMOBILETELECOMMUNICATIONSAPPLIANCE",1638804497:"IFCLIQUIDTERMINAL",1154579445:"IFCLINEARPOSITIONINGELEMENT",2696325953:"IFCKERB",2713699986:"IFCGEOTECHNICALASSEMBLY",2142170206:"IFCELECTRICFLOWTREATMENTDEVICETYPE",3376911765:"IFCEARTHWORKSFILL",1077100507:"IFCEARTHWORKSELEMENT",3071239417:"IFCEARTHWORKSCUT",479945903:"IFCDISTRIBUTIONBOARDTYPE",3426335179:"IFCDEEPFOUNDATION",1502416096:"IFCCOURSE",2940368186:"IFCCONVEYORSEGMENTTYPE",3203706013:"IFCCAISSONFOUNDATIONTYPE",3862327254:"IFCBUILTSYSTEM",1876633798:"IFCBUILTELEMENT",963979645:"IFCBRIDGEPART",644574406:"IFCBRIDGE",3649138523:"IFCBEARINGTYPE",1662888072:"IFCALIGNMENTVERTICAL",317615605:"IFCALIGNMENTSEGMENT",1545765605:"IFCALIGNMENTHORIZONTAL",4266260250:"IFCALIGNMENTCANT",3956297820:"IFCVIBRATIONDAMPERTYPE",1530820697:"IFCVIBRATIONDAMPER",840318589:"IFCVEHICLE",1953115116:"IFCTRANSPORTATIONDEVICE",618700268:"IFCTRACKELEMENTTYPE",2281632017:"IFCTENDONCONDUITTYPE",3663046924:"IFCTENDONCONDUIT",42703149:"IFCSINESPIRAL",1894708472:"IFCSIGNALTYPE",3599934289:"IFCSIGNTYPE",33720170:"IFCSIGN",1027922057:"IFCSEVENTHORDERPOLYNOMIALSPIRAL",544395925:"IFCSEGMENTEDREFERENCECURVE",3649235739:"IFCSECONDORDERPOLYNOMIALSPIRAL",550521510:"IFCROADPART",146592293:"IFCROAD",3818125796:"IFCRELADHERESTOELEMENT",4021432810:"IFCREFERENT",1891881377:"IFCRAILWAYPART",3992365140:"IFCRAILWAY",1763565496:"IFCRAILTYPE",1946335990:"IFCPOSITIONINGELEMENT",514975943:"IFCPAVEMENTTYPE",506776471:"IFCNAVIGATIONELEMENTTYPE",710110818:"IFCMOORINGDEVICETYPE",1950438474:"IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE",976884017:"IFCMARINEPART",525669439:"IFCMARINEFACILITY",1770583370:"IFCLIQUIDTERMINALTYPE",2176059722:"IFCLINEARELEMENT",679976338:"IFCKERBTYPE",3948183225:"IFCIMPACTPROTECTIONDEVICETYPE",2568555532:"IFCIMPACTPROTECTIONDEVICE",2898700619:"IFCGRADIENTCURVE",1594536857:"IFCGEOTECHNICALSTRATUM",4230923436:"IFCGEOTECHNICALELEMENT",4228831410:"IFCFACILITYPARTCOMMON",1310830890:"IFCFACILITYPART",24185140:"IFCFACILITY",4234616927:"IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID",1306400036:"IFCDEEPFOUNDATIONTYPE",4189326743:"IFCCOURSETYPE",2000195564:"IFCCOSINESPIRAL",3497074424:"IFCCLOTHOID",1626504194:"IFCBUILTELEMENTTYPE",3651464721:"IFCVEHICLETYPE",1229763772:"IFCTRIANGULATEDIRREGULARNETWORK",3665877780:"IFCTRANSPORTATIONDEVICETYPE",782932809:"IFCTHIRDORDERPOLYNOMIALSPIRAL",2735484536:"IFCSPIRAL",1356537516:"IFCSECTIONEDSURFACE",1290935644:"IFCSECTIONEDSOLIDHORIZONTAL",1862484736:"IFCSECTIONEDSOLID",1441486842:"IFCRELPOSITIONS",1033248425:"IFCRELASSOCIATESPROFILEDEF",3381221214:"IFCPOLYNOMIALCURVE",2485787929:"IFCOFFSETCURVEBYDISTANCES",590820931:"IFCOFFSETCURVE",3465909080:"IFCINDEXEDPOLYGONALTEXTUREMAP",593015953:"IFCDIRECTRIXCURVESWEPTAREASOLID",4212018352:"IFCCURVESEGMENT",3425423356:"IFCAXIS2PLACEMENTLINEAR",823603102:"IFCSEGMENT",2165702409:"IFCPOINTBYDISTANCEEXPRESSION",182550632:"IFCOPENCROSSPROFILEDEF",388784114:"IFCLINEARPLACEMENT",536804194:"IFCALIGNMENTHORIZONTALSEGMENT",3752311538:"IFCALIGNMENTCANTSEGMENT",1010789467:"IFCTEXTURECOORDINATEINDICESWITHVOIDS",222769930:"IFCTEXTURECOORDINATEINDICES",2691318326:"IFCQUANTITYNUMBER",3633395639:"IFCALIGNMENTVERTICALSEGMENT",2879124712:"IFCALIGNMENTPARAMETERSEGMENT",25142252:"IFCCONTROLLER",3087945054:"IFCALARM",4288193352:"IFCACTUATOR",630975310:"IFCUNITARYCONTROLELEMENT",4086658281:"IFCSENSOR",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",182646315:"IFCFLOWINSTRUMENT",1426591983:"IFCFIRESUPPRESSIONTERMINAL",819412036:"IFCFILTER",3415622556:"IFCFAN",1003880860:"IFCELECTRICTIMECONTROL",402227799:"IFCELECTRICMOTOR",264262732:"IFCELECTRICGENERATOR",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",862014818:"IFCELECTRICDISTRIBUTIONBOARD",1904799276:"IFCELECTRICAPPLIANCE",1360408905:"IFCDUCTSILENCER",3518393246:"IFCDUCTSEGMENT",342316401:"IFCDUCTFITTING",562808652:"IFCDISTRIBUTIONCIRCUIT",4074379575:"IFCDAMPER",3640358203:"IFCCOOLINGTOWER",4136498852:"IFCCOOLEDBEAM",2272882330:"IFCCONDENSER",3571504051:"IFCCOMPRESSOR",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",639361253:"IFCCOIL",3902619387:"IFCCHILLER",4217484030:"IFCCABLESEGMENT",1051757585:"IFCCABLEFITTING",3758799889:"IFCCABLECARRIERSEGMENT",635142910:"IFCCABLECARRIERFITTING",2938176219:"IFCBURNER",32344328:"IFCBOILER",2906023776:"IFCBEAMSTANDARDCASE",277319702:"IFCAUDIOVISUALAPPLIANCE",2056796094:"IFCAIRTOAIRHEATRECOVERY",177149247:"IFCAIRTERMINALBOX",1634111441:"IFCAIRTERMINAL",486154966:"IFCWINDOWSTANDARDCASE",4237592921:"IFCWASTETERMINAL",4156078855:"IFCWALLELEMENTEDCASE",4207607924:"IFCVALVE",4292641817:"IFCUNITARYEQUIPMENT",3179687236:"IFCUNITARYCONTROLELEMENTTYPE",3026737570:"IFCTUBEBUNDLE",3825984169:"IFCTRANSFORMER",812556717:"IFCTANK",1162798199:"IFCSWITCHINGDEVICE",385403989:"IFCSTRUCTURALLOADCASE",1404847402:"IFCSTACKTERMINAL",1999602285:"IFCSPACEHEATER",3420628829:"IFCSOLARDEVICE",3027962421:"IFCSLABSTANDARDCASE",3127900445:"IFCSLABELEMENTEDCASE",1329646415:"IFCSHADINGDEVICE",3053780830:"IFCSANITARYTERMINAL",2572171363:"IFCREINFORCINGBARTYPE",1232101972:"IFCRATIONALBSPLINECURVEWITHKNOTS",90941305:"IFCPUMP",655969474:"IFCPROTECTIVEDEVICETRIPPINGUNITTYPE",738039164:"IFCPROTECTIVEDEVICE",1156407060:"IFCPLATESTANDARDCASE",3612865200:"IFCPIPESEGMENT",310824031:"IFCPIPEFITTING",3694346114:"IFCOUTLET",144952367:"IFCOUTERBOUNDARYCURVE",2474470126:"IFCMOTORCONNECTION",1911478936:"IFCMEMBERSTANDARDCASE",1437502449:"IFCMEDICALDEVICE",629592764:"IFCLIGHTFIXTURE",76236018:"IFCLAMP",2176052936:"IFCJUNCTIONBOX",4175244083:"IFCINTERCEPTOR",2068733104:"IFCHUMIDIFIER",3319311131:"IFCHEATEXCHANGER",2188021234:"IFCFLOWMETER",1209101575:"IFCEXTERNALSPATIALELEMENT",484807127:"IFCEVAPORATOR",3747195512:"IFCEVAPORATIVECOOLER",2814081492:"IFCENGINE",2417008758:"IFCELECTRICDISTRIBUTIONBOARDTYPE",3242481149:"IFCDOORSTANDARDCASE",3205830791:"IFCDISTRIBUTIONSYSTEM",400855858:"IFCCOMMUNICATIONSAPPLIANCETYPE",905975707:"IFCCOLUMNSTANDARDCASE",1677625105:"IFCCIVILELEMENT",3296154744:"IFCCHIMNEY",2674252688:"IFCCABLEFITTINGTYPE",2188180465:"IFCBURNERTYPE",1177604601:"IFCBUILDINGSYSTEM",39481116:"IFCBUILDINGELEMENTPARTTYPE",1136057603:"IFCBOUNDARYCURVE",2461110595:"IFCBSPLINECURVEWITHKNOTS",1532957894:"IFCAUDIOVISUALAPPLIANCETYPE",4088093105:"IFCWORKCALENDAR",4009809668:"IFCWINDOWTYPE",926996030:"IFCVOIDINGFEATURE",2391383451:"IFCVIBRATIONISOLATOR",2415094496:"IFCTENDONTYPE",3081323446:"IFCTENDONANCHORTYPE",413509423:"IFCSYSTEMFURNITUREELEMENT",3101698114:"IFCSURFACEFEATURE",3657597509:"IFCSTRUCTURALSURFACEACTION",2757150158:"IFCSTRUCTURALCURVEREACTION",1004757350:"IFCSTRUCTURALCURVEACTION",338393293:"IFCSTAIRTYPE",1072016465:"IFCSOLARDEVICETYPE",4074543187:"IFCSHADINGDEVICETYPE",2157484638:"IFCSEAMCURVE",2781568857:"IFCROOFTYPE",2310774935:"IFCREINFORCINGMESHTYPE",964333572:"IFCREINFORCINGELEMENTTYPE",683857671:"IFCRATIONALBSPLINESURFACEWITHKNOTS",1469900589:"IFCRAMPTYPE",2839578677:"IFCPOLYGONALFACESET",1158309216:"IFCPILETYPE",3079942009:"IFCOPENINGSTANDARDCASE",1114901282:"IFCMEDICALDEVICETYPE",3113134337:"IFCINTERSECTIONCURVE",3946677679:"IFCINTERCEPTORTYPE",2571569899:"IFCINDEXEDPOLYCURVE",3493046030:"IFCGEOGRAPHICELEMENT",1509553395:"IFCFURNITURE",1893162501:"IFCFOOTINGTYPE",2853485674:"IFCEXTERNALSPATIALSTRUCTUREELEMENT",4148101412:"IFCEVENT",132023988:"IFCENGINETYPE",2397081782:"IFCELEMENTASSEMBLYTYPE",2323601079:"IFCDOORTYPE",1213902940:"IFCCYLINDRICALSURFACE",1525564444:"IFCCONSTRUCTIONPRODUCTRESOURCETYPE",4105962743:"IFCCONSTRUCTIONMATERIALRESOURCETYPE",2185764099:"IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE",15328376:"IFCCOMPOSITECURVEONSURFACE",3875453745:"IFCCOMPLEXPROPERTYTEMPLATE",3893394355:"IFCCIVILELEMENTTYPE",2197970202:"IFCCHIMNEYTYPE",167062518:"IFCBSPLINESURFACEWITHKNOTS",2887950389:"IFCBSPLINESURFACE",2603310189:"IFCADVANCEDBREPWITHVOIDS",1635779807:"IFCADVANCEDBREP",2916149573:"IFCTRIANGULATEDFACESET",1935646853:"IFCTOROIDALSURFACE",2387106220:"IFCTESSELLATEDFACESET",3206491090:"IFCTASKTYPE",699246055:"IFCSURFACECURVE",4095615324:"IFCSUBCONTRACTRESOURCETYPE",603775116:"IFCSTRUCTURALSURFACEREACTION",4015995234:"IFCSPHERICALSURFACE",2481509218:"IFCSPATIALZONETYPE",463610769:"IFCSPATIALZONE",710998568:"IFCSPATIALELEMENTTYPE",1412071761:"IFCSPATIALELEMENT",3663146110:"IFCSIMPLEPROPERTYTEMPLATE",3243963512:"IFCREVOLVEDAREASOLIDTAPERED",816062949:"IFCREPARAMETRISEDCOMPOSITECURVESEGMENT",1521410863:"IFCRELSPACEBOUNDARY2NDLEVEL",3523091289:"IFCRELSPACEBOUNDARY1STLEVEL",427948657:"IFCRELINTERFERESELEMENTS",307848117:"IFCRELDEFINESBYTEMPLATE",1462361463:"IFCRELDEFINESBYOBJECT",2565941209:"IFCRELDECLARES",1027710054:"IFCRELASSIGNSTOGROUPBYFACTOR",3521284610:"IFCPROPERTYTEMPLATE",492091185:"IFCPROPERTYSETTEMPLATE",653396225:"IFCPROJECTLIBRARY",569719735:"IFCPROCEDURETYPE",3967405729:"IFCPREDEFINEDPROPERTYSET",1682466193:"IFCPCURVE",428585644:"IFCLABORRESOURCETYPE",2294589976:"IFCINDEXEDPOLYGONALFACEWITHVOIDS",178912537:"IFCINDEXEDPOLYGONALFACE",4095422895:"IFCGEOGRAPHICELEMENTTYPE",2652556860:"IFCFIXEDREFERENCESWEPTAREASOLID",2804161546:"IFCEXTRUDEDAREASOLIDTAPERED",4024345920:"IFCEVENTTYPE",2629017746:"IFCCURVEBOUNDEDSURFACE",1815067380:"IFCCREWRESOURCETYPE",3419103109:"IFCCONTEXT",2574617495:"IFCCONSTRUCTIONRESOURCETYPE",2059837836:"IFCCARTESIANPOINTLIST3D",1675464909:"IFCCARTESIANPOINTLIST2D",574549367:"IFCCARTESIANPOINTLIST",3406155212:"IFCADVANCEDFACE",3698973494:"IFCTYPERESOURCE",3736923433:"IFCTYPEPROCESS",901063453:"IFCTESSELLATEDITEM",1096409881:"IFCSWEPTDISKSOLIDPOLYGONAL",1042787934:"IFCRESOURCETIME",1608871552:"IFCRESOURCECONSTRAINTRELATIONSHIP",2943643501:"IFCRESOURCEAPPROVALRELATIONSHIP",2090586900:"IFCQUANTITYSET",1482703590:"IFCPROPERTYTEMPLATEDEFINITION",3778827333:"IFCPREDEFINEDPROPERTIES",2998442950:"IFCMIRROREDPROFILEDEF",853536259:"IFCMATERIALRELATIONSHIP",3404854881:"IFCMATERIALPROFILESETUSAGETAPERING",3079605661:"IFCMATERIALPROFILESETUSAGE",2852063980:"IFCMATERIALCONSTITUENTSET",3708119e3:"IFCMATERIALCONSTITUENT",1585845231:"IFCLAGTIME",2133299955:"IFCINDEXEDTRIANGLETEXTUREMAP",1437953363:"IFCINDEXEDTEXTUREMAP",3570813810:"IFCINDEXEDCOLOURMAP",1437805879:"IFCEXTERNALREFERENCERELATIONSHIP",297599258:"IFCEXTENDEDPROPERTIES",211053100:"IFCEVENTTIME",2713554722:"IFCCONVERSIONBASEDUNITWITHOFFSET",3285139300:"IFCCOLOURRGBLIST",1236880293:"IFCWORKTIME",1199560280:"IFCTIMEPERIOD",3611470254:"IFCTEXTUREVERTEXLIST",2771591690:"IFCTASKTIMERECURRING",1549132990:"IFCTASKTIME",2043862942:"IFCTABLECOLUMN",2934153892:"IFCSURFACEREINFORCEMENTAREA",609421318:"IFCSTRUCTURALLOADORRESULT",3478079324:"IFCSTRUCTURALLOADCONFIGURATION",1054537805:"IFCSCHEDULINGTIME",2439245199:"IFCRESOURCELEVELRELATIONSHIP",2433181523:"IFCREFERENCE",3915482550:"IFCRECURRENCEPATTERN",986844984:"IFCPROPERTYABSTRACTION",3843373140:"IFCPROJECTEDCRS",677532197:"IFCPRESENTATIONITEM",1507914824:"IFCMATERIALUSAGEDEFINITION",552965576:"IFCMATERIALPROFILEWITHOFFSETS",164193824:"IFCMATERIALPROFILESET",2235152071:"IFCMATERIALPROFILE",1847252529:"IFCMATERIALLAYERWITHOFFSETS",760658860:"IFCMATERIALDEFINITION",3057273783:"IFCMAPCONVERSION",4294318154:"IFCEXTERNALINFORMATION",1466758467:"IFCCOORDINATEREFERENCESYSTEM",1785450214:"IFCCOORDINATEOPERATION",775493141:"IFCCONNECTIONVOLUMEGEOMETRY",979691226:"IFCREINFORCINGBAR",3700593921:"IFCELECTRICDISTRIBUTIONPOINT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",578613899:"IFCCONTROLLERTYPE",2454782716:"IFCCHAMFEREDGEFEATURE",753842376:"IFCBEAM",3001207471:"IFCALARMTYPE",2874132201:"IFCACTUATORTYPE",3304561284:"IFCWINDOW",3512223829:"IFCWALLSTANDARDCASE",2391406946:"IFCWALL",3313531582:"IFCVIBRATIONISOLATORTYPE",2347447852:"IFCTENDONANCHOR",3824725483:"IFCTENDON",2515109513:"IFCSTRUCTURALANALYSISMODEL",4252922144:"IFCSTAIRFLIGHT",331165859:"IFCSTAIR",1529196076:"IFCSLAB",1783015770:"IFCSENSORTYPE",1376911519:"IFCROUNDEDEDGEFEATURE",2016517767:"IFCROOF",2320036040:"IFCREINFORCINGMESH",3027567501:"IFCREINFORCINGELEMENT",3055160366:"IFCRATIONALBEZIERCURVE",3283111854:"IFCRAMPFLIGHT",3024970846:"IFCRAMP",2262370178:"IFCRAILING",3171933400:"IFCPLATE",1687234759:"IFCPILE",1073191201:"IFCMEMBER",900683007:"IFCFOOTING",3508470533:"IFCFLOWTREATMENTDEVICE",2223149337:"IFCFLOWTERMINAL",707683696:"IFCFLOWSTORAGEDEVICE",987401354:"IFCFLOWSEGMENT",3132237377:"IFCFLOWMOVINGDEVICE",4037862832:"IFCFLOWINSTRUMENTTYPE",4278956645:"IFCFLOWFITTING",2058353004:"IFCFLOWCONTROLLER",4222183408:"IFCFIRESUPPRESSIONTERMINALTYPE",1810631287:"IFCFILTERTYPE",346874300:"IFCFANTYPE",1658829314:"IFCENERGYCONVERSIONDEVICE",857184966:"IFCELECTRICALELEMENT",1634875225:"IFCELECTRICALCIRCUIT",712377611:"IFCELECTRICTIMECONTROLTYPE",1217240411:"IFCELECTRICMOTORTYPE",1365060375:"IFCELECTRICHEATERTYPE",1534661035:"IFCELECTRICGENERATORTYPE",3277789161:"IFCELECTRICFLOWSTORAGEDEVICETYPE",663422040:"IFCELECTRICAPPLIANCETYPE",855621170:"IFCEDGEFEATURE",2030761528:"IFCDUCTSILENCERTYPE",3760055223:"IFCDUCTSEGMENTTYPE",869906466:"IFCDUCTFITTINGTYPE",395920057:"IFCDOOR",3041715199:"IFCDISTRIBUTIONPORT",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",1945004755:"IFCDISTRIBUTIONELEMENT",2063403501:"IFCDISTRIBUTIONCONTROLELEMENTTYPE",1599208980:"IFCDISTRIBUTIONCHAMBERELEMENTTYPE",2635815018:"IFCDISCRETEACCESSORYTYPE",1335981549:"IFCDISCRETEACCESSORY",4147604152:"IFCDIAMETERDIMENSION",3961806047:"IFCDAMPERTYPE",3495092785:"IFCCURTAINWALL",1973544240:"IFCCOVERING",2954562838:"IFCCOOLINGTOWERTYPE",335055490:"IFCCOOLEDBEAMTYPE",488727124:"IFCCONSTRUCTIONPRODUCTRESOURCE",1060000209:"IFCCONSTRUCTIONMATERIALRESOURCE",3898045240:"IFCCONSTRUCTIONEQUIPMENTRESOURCE",1163958913:"IFCCONDITIONCRITERION",2188551683:"IFCCONDITION",2816379211:"IFCCONDENSERTYPE",3850581409:"IFCCOMPRESSORTYPE",843113511:"IFCCOLUMN",2301859152:"IFCCOILTYPE",2611217952:"IFCCIRCLE",2951183804:"IFCCHILLERTYPE",1285652485:"IFCCABLESEGMENTTYPE",3293546465:"IFCCABLECARRIERSEGMENTTYPE",395041908:"IFCCABLECARRIERFITTINGTYPE",1909888760:"IFCBUILDINGELEMENTPROXYTYPE",1095909175:"IFCBUILDINGELEMENTPROXY",2979338954:"IFCBUILDINGELEMENTPART",52481810:"IFCBUILDINGELEMENTCOMPONENT",3299480353:"IFCBUILDINGELEMENT",231477066:"IFCBOILERTYPE",1916977116:"IFCBEZIERCURVE",819618141:"IFCBEAMTYPE",1967976161:"IFCBSPLINECURVE",3460190687:"IFCASSET",2470393545:"IFCANGULARDIMENSION",1871374353:"IFCAIRTOAIRHEATRECOVERYTYPE",3352864051:"IFCAIRTERMINALTYPE",1411407467:"IFCAIRTERMINALBOXTYPE",3821786052:"IFCACTIONREQUEST",1213861670:"IFC2DCOMPOSITECURVE",1033361043:"IFCZONE",3342526732:"IFCWORKSCHEDULE",4218914973:"IFCWORKPLAN",1028945134:"IFCWORKCONTROL",1133259667:"IFCWASTETERMINALTYPE",1898987631:"IFCWALLTYPE",2769231204:"IFCVIRTUALELEMENT",728799441:"IFCVALVETYPE",1911125066:"IFCUNITARYEQUIPMENTTYPE",1600972822:"IFCTUBEBUNDLETYPE",3593883385:"IFCTRIMMEDCURVE",1620046519:"IFCTRANSPORTELEMENT",1692211062:"IFCTRANSFORMERTYPE",1637806684:"IFCTIMESERIESSCHEDULE",5716631:"IFCTANKTYPE",2254336722:"IFCSYSTEM",2315554128:"IFCSWITCHINGDEVICETYPE",148013059:"IFCSUBCONTRACTRESOURCE",1975003073:"IFCSTRUCTURALSURFACECONNECTION",2986769608:"IFCSTRUCTURALRESULTGROUP",1235345126:"IFCSTRUCTURALPOINTREACTION",734778138:"IFCSTRUCTURALPOINTCONNECTION",2082059205:"IFCSTRUCTURALPOINTACTION",3987759626:"IFCSTRUCTURALPLANARACTIONVARYING",1621171031:"IFCSTRUCTURALPLANARACTION",1252848954:"IFCSTRUCTURALLOADGROUP",1721250024:"IFCSTRUCTURALLINEARACTIONVARYING",1807405624:"IFCSTRUCTURALLINEARACTION",2445595289:"IFCSTRUCTURALCURVEMEMBERVARYING",214636428:"IFCSTRUCTURALCURVEMEMBER",4243806635:"IFCSTRUCTURALCURVECONNECTION",1179482911:"IFCSTRUCTURALCONNECTION",682877961:"IFCSTRUCTURALACTION",1039846685:"IFCSTAIRFLIGHTTYPE",3112655638:"IFCSTACKTERMINALTYPE",3812236995:"IFCSPACETYPE",652456506:"IFCSPACEPROGRAM",1305183839:"IFCSPACEHEATERTYPE",3856911033:"IFCSPACE",2533589738:"IFCSLABTYPE",4097777520:"IFCSITE",4105383287:"IFCSERVICELIFE",3517283431:"IFCSCHEDULETIMECONTROL",1768891740:"IFCSANITARYTERMINALTYPE",2863920197:"IFCRELASSIGNSTASKS",160246688:"IFCRELAGGREGATES",2324767716:"IFCRAMPFLIGHTTYPE",2893384427:"IFCRAILINGTYPE",3248260540:"IFCRADIUSDIMENSION",2250791053:"IFCPUMPTYPE",1842657554:"IFCPROTECTIVEDEVICETYPE",3651124850:"IFCPROJECTIONELEMENT",3642467123:"IFCPROJECTORDERRECORD",2904328755:"IFCPROJECTORDER",2744685151:"IFCPROCEDURE",3740093272:"IFCPORT",3724593414:"IFCPOLYLINE",4017108033:"IFCPLATETYPE",4231323485:"IFCPIPESEGMENTTYPE",804291784:"IFCPIPEFITTINGTYPE",3327091369:"IFCPERMIT",2382730787:"IFCPERFORMANCEHISTORY",2837617999:"IFCOUTLETTYPE",3425660407:"IFCORDERACTION",3588315303:"IFCOPENINGELEMENT",4143007308:"IFCOCCUPANT",1916936684:"IFCMOVE",977012517:"IFCMOTORCONNECTIONTYPE",3181161470:"IFCMEMBERTYPE",2108223431:"IFCMECHANICALFASTENERTYPE",377706215:"IFCMECHANICALFASTENER",2506943328:"IFCLINEARDIMENSION",1161773419:"IFCLIGHTFIXTURETYPE",1051575348:"IFCLAMPTYPE",3827777499:"IFCLABORRESOURCE",4288270099:"IFCJUNCTIONBOXTYPE",2391368822:"IFCINVENTORY",1806887404:"IFCHUMIDIFIERTYPE",1251058090:"IFCHEATEXCHANGERTYPE",2706460486:"IFCGROUP",3009204131:"IFCGRID",200128114:"IFCGASTERMINALTYPE",814719939:"IFCFURNITURESTANDARD",263784265:"IFCFURNISHINGELEMENT",3009222698:"IFCFLOWTREATMENTDEVICETYPE",2297155007:"IFCFLOWTERMINALTYPE",1339347760:"IFCFLOWSTORAGEDEVICETYPE",1834744321:"IFCFLOWSEGMENTTYPE",1482959167:"IFCFLOWMOVINGDEVICETYPE",3815607619:"IFCFLOWMETERTYPE",3198132628:"IFCFLOWFITTINGTYPE",3907093117:"IFCFLOWCONTROLLERTYPE",1287392070:"IFCFEATUREELEMENTSUBTRACTION",2143335405:"IFCFEATUREELEMENTADDITION",2827207264:"IFCFEATUREELEMENT",2489546625:"IFCFASTENERTYPE",647756555:"IFCFASTENER",3737207727:"IFCFACETEDBREPWITHVOIDS",807026263:"IFCFACETEDBREP",3390157468:"IFCEVAPORATORTYPE",3174744832:"IFCEVAPORATIVECOOLERTYPE",3272907226:"IFCEQUIPMENTSTANDARD",1962604670:"IFCEQUIPMENTELEMENT",2107101300:"IFCENERGYCONVERSIONDEVICETYPE",1704287377:"IFCELLIPSE",2590856083:"IFCELEMENTCOMPONENTTYPE",1623761950:"IFCELEMENTCOMPONENT",4123344466:"IFCELEMENTASSEMBLY",1758889154:"IFCELEMENT",360485395:"IFCELECTRICALBASEPROPERTIES",3849074793:"IFCDISTRIBUTIONFLOWELEMENTTYPE",3256556792:"IFCDISTRIBUTIONELEMENTTYPE",681481545:"IFCDIMENSIONCURVEDIRECTEDCALLOUT",1457835157:"IFCCURTAINWALLTYPE",3295246426:"IFCCREWRESOURCE",1916426348:"IFCCOVERINGTYPE",1419761937:"IFCCOSTSCHEDULE",3895139033:"IFCCOSTITEM",3293443760:"IFCCONTROL",2559216714:"IFCCONSTRUCTIONRESOURCE",2510884976:"IFCCONIC",3732776249:"IFCCOMPOSITECURVE",300633059:"IFCCOLUMNTYPE",2937912522:"IFCCIRCLEHOLLOWPROFILEDEF",3124254112:"IFCBUILDINGSTOREY",1950629157:"IFCBUILDINGELEMENTTYPE",4031249490:"IFCBUILDING",1260505505:"IFCBOUNDEDCURVE",3649129432:"IFCBOOLEANCLIPPINGRESULT",1334484129:"IFCBLOCK",3207858831:"IFCASYMMETRICISHAPEPROFILEDEF",1674181508:"IFCANNOTATION",2296667514:"IFCACTOR",2097647324:"IFCTRANSPORTELEMENTTYPE",3473067441:"IFCTASK",1580310250:"IFCSYSTEMFURNITUREELEMENTTYPE",4124788165:"IFCSURFACEOFREVOLUTION",2809605785:"IFCSURFACEOFLINEAREXTRUSION",2028607225:"IFCSURFACECURVESWEPTAREASOLID",4070609034:"IFCSTRUCTUREDDIMENSIONCALLOUT",2218152070:"IFCSTRUCTURALSURFACEMEMBERVARYING",3979015343:"IFCSTRUCTURALSURFACEMEMBER",3689010777:"IFCSTRUCTURALREACTION",530289379:"IFCSTRUCTURALMEMBER",3136571912:"IFCSTRUCTURALITEM",3544373492:"IFCSTRUCTURALACTIVITY",451544542:"IFCSPHERE",3893378262:"IFCSPATIALSTRUCTUREELEMENTTYPE",2706606064:"IFCSPATIALSTRUCTUREELEMENT",3626867408:"IFCRIGHTCIRCULARCYLINDER",4158566097:"IFCRIGHTCIRCULARCONE",1856042241:"IFCREVOLVEDAREASOLID",2914609552:"IFCRESOURCE",1401173127:"IFCRELVOIDSELEMENT",3451746338:"IFCRELSPACEBOUNDARY",366585022:"IFCRELSERVICESBUILDINGS",4122056220:"IFCRELSEQUENCE",1058617721:"IFCRELSCHEDULESCOSTITEMS",1245217292:"IFCRELREFERENCEDINSPATIALSTRUCTURE",750771296:"IFCRELPROJECTSELEMENT",202636808:"IFCRELOVERRIDESPROPERTIES",2051452291:"IFCRELOCCUPIESSPACES",3268803585:"IFCRELNESTS",4189434867:"IFCRELINTERACTIONREQUIREMENTS",279856033:"IFCRELFLOWCONTROLELEMENTS",3940055652:"IFCRELFILLSELEMENT",781010003:"IFCRELDEFINESBYTYPE",4186316022:"IFCRELDEFINESBYPROPERTIES",693640335:"IFCRELDEFINES",2551354335:"IFCRELDECOMPOSES",2802773753:"IFCRELCOVERSSPACES",886880790:"IFCRELCOVERSBLDGELEMENTS",3242617779:"IFCRELCONTAINEDINSPATIALSTRUCTURE",3678494232:"IFCRELCONNECTSWITHREALIZINGELEMENTS",504942748:"IFCRELCONNECTSWITHECCENTRICITY",1638771189:"IFCRELCONNECTSSTRUCTURALMEMBER",3912681535:"IFCRELCONNECTSSTRUCTURALELEMENT",2127690289:"IFCRELCONNECTSSTRUCTURALACTIVITY",3190031847:"IFCRELCONNECTSPORTS",4201705270:"IFCRELCONNECTSPORTTOELEMENT",3945020480:"IFCRELCONNECTSPATHELEMENTS",1204542856:"IFCRELCONNECTSELEMENTS",826625072:"IFCRELCONNECTS",2851387026:"IFCRELASSOCIATESPROFILEPROPERTIES",2655215786:"IFCRELASSOCIATESMATERIAL",3840914261:"IFCRELASSOCIATESLIBRARY",982818633:"IFCRELASSOCIATESDOCUMENT",2728634034:"IFCRELASSOCIATESCONSTRAINT",919958153:"IFCRELASSOCIATESCLASSIFICATION",4095574036:"IFCRELASSOCIATESAPPROVAL",1327628568:"IFCRELASSOCIATESAPPLIEDVALUE",1865459582:"IFCRELASSOCIATES",205026976:"IFCRELASSIGNSTORESOURCE",3372526763:"IFCRELASSIGNSTOPROJECTORDER",2857406711:"IFCRELASSIGNSTOPRODUCT",4278684876:"IFCRELASSIGNSTOPROCESS",1307041759:"IFCRELASSIGNSTOGROUP",2495723537:"IFCRELASSIGNSTOCONTROL",1683148259:"IFCRELASSIGNSTOACTOR",3939117080:"IFCRELASSIGNS",3454111270:"IFCRECTANGULARTRIMMEDSURFACE",2798486643:"IFCRECTANGULARPYRAMID",2770003689:"IFCRECTANGLEHOLLOWPROFILEDEF",3219374653:"IFCPROXY",1451395588:"IFCPROPERTYSET",4194566429:"IFCPROJECTIONCURVE",103090709:"IFCPROJECT",4208778838:"IFCPRODUCT",2945172077:"IFCPROCESS",220341763:"IFCPLANE",603570806:"IFCPLANARBOX",3566463478:"IFCPERMEABLECOVERINGPROPERTIES",3505215534:"IFCOFFSETCURVE3D",3388369263:"IFCOFFSETCURVE2D",3888040117:"IFCOBJECT",1425443689:"IFCMANIFOLDSOLIDBREP",1281925730:"IFCLINE",572779678:"IFCLSHAPEPROFILEDEF",1484403080:"IFCISHAPEPROFILEDEF",987898635:"IFCGEOMETRICCURVESET",1268542332:"IFCFURNITURETYPE",4238390223:"IFCFURNISHINGELEMENTTYPE",3455213021:"IFCFLUIDFLOWPROPERTIES",315944413:"IFCFILLAREASTYLETILES",4203026998:"IFCFILLAREASTYLETILESYMBOLWITHSTYLE",374418227:"IFCFILLAREASTYLEHATCHING",2047409740:"IFCFACEBASEDSURFACEMODEL",477187591:"IFCEXTRUDEDAREASOLID",80994333:"IFCENERGYPROPERTIES",2835456948:"IFCELLIPSEPROFILEDEF",2777663545:"IFCELEMENTARYSURFACE",339256511:"IFCELEMENTTYPE",1883228015:"IFCELEMENTQUANTITY",1472233963:"IFCEDGELOOP",4006246654:"IFCDRAUGHTINGPREDEFINEDCURVEFONT",445594917:"IFCDRAUGHTINGPREDEFINEDCOLOUR",3073041342:"IFCDRAUGHTINGCALLOUT",526551008:"IFCDOORSTYLE",1714330368:"IFCDOORPANELPROPERTIES",2963535650:"IFCDOORLININGPROPERTIES",32440307:"IFCDIRECTION",4054601972:"IFCDIMENSIONCURVETERMINATOR",606661476:"IFCDIMENSIONCURVE",693772133:"IFCDEFINEDSYMBOL",2827736869:"IFCCURVEBOUNDEDPLANE",2601014836:"IFCCURVE",2147822146:"IFCCSGSOLID",2506170314:"IFCCSGPRIMITIVE3D",194851669:"IFCCRANERAILFSHAPEPROFILEDEF",4133800736:"IFCCRANERAILASHAPEPROFILEDEF",2485617015:"IFCCOMPOSITECURVESEGMENT",2205249479:"IFCCLOSEDSHELL",1383045692:"IFCCIRCLEPROFILEDEF",1416205885:"IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM",3331915920:"IFCCARTESIANTRANSFORMATIONOPERATOR3D",3486308946:"IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM",3749851601:"IFCCARTESIANTRANSFORMATIONOPERATOR2D",59481748:"IFCCARTESIANTRANSFORMATIONOPERATOR",1123145078:"IFCCARTESIANPOINT",2898889636:"IFCCSHAPEPROFILEDEF",2713105998:"IFCBOXEDHALFSPACE",2581212453:"IFCBOUNDINGBOX",4182860854:"IFCBOUNDEDSURFACE",2736907675:"IFCBOOLEANRESULT",2740243338:"IFCAXIS2PLACEMENT3D",3125803723:"IFCAXIS2PLACEMENT2D",4261334040:"IFCAXIS1PLACEMENT",1302238472:"IFCANNOTATIONSURFACE",2265737646:"IFCANNOTATIONFILLAREAOCCURRENCE",669184980:"IFCANNOTATIONFILLAREA",3288037868:"IFCANNOTATIONCURVEOCCURRENCE",2543172580:"IFCZSHAPEPROFILEDEF",1299126871:"IFCWINDOWSTYLE",512836454:"IFCWINDOWPANELPROPERTIES",336235671:"IFCWINDOWLININGPROPERTIES",2759199220:"IFCVERTEXLOOP",1417489154:"IFCVECTOR",427810014:"IFCUSHAPEPROFILEDEF",2347495698:"IFCTYPEPRODUCT",1628702193:"IFCTYPEOBJECT",1345879162:"IFCTWODIRECTIONREPEATFACTOR",2715220739:"IFCTRAPEZIUMPROFILEDEF",3124975700:"IFCTEXTLITERALWITHEXTENT",4282788508:"IFCTEXTLITERAL",3028897424:"IFCTERMINATORSYMBOL",3071757647:"IFCTSHAPEPROFILEDEF",230924584:"IFCSWEPTSURFACE",1260650574:"IFCSWEPTDISKSOLID",2247615214:"IFCSWEPTAREASOLID",1878645084:"IFCSURFACESTYLERENDERING",2513912981:"IFCSURFACE",2233826070:"IFCSUBEDGE",3653947884:"IFCSTRUCTURALSTEELPROFILEPROPERTIES",3843319758:"IFCSTRUCTURALPROFILEPROPERTIES",1190533807:"IFCSTRUCTURALLOADSINGLEFORCEWARPING",1597423693:"IFCSTRUCTURALLOADSINGLEFORCE",1973038258:"IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION",2473145415:"IFCSTRUCTURALLOADSINGLEDISPLACEMENT",2668620305:"IFCSTRUCTURALLOADPLANARFORCE",1595516126:"IFCSTRUCTURALLOADLINEARFORCE",390701378:"IFCSPACETHERMALLOADPROPERTIES",1202362311:"IFCSOUNDVALUE",2485662743:"IFCSOUNDPROPERTIES",723233188:"IFCSOLIDMODEL",2609359061:"IFCSLIPPAGECONNECTIONCONDITION",4124623270:"IFCSHELLBASEDSURFACEMODEL",2411513650:"IFCSERVICELIFEFACTOR",1509187699:"IFCSECTIONEDSPINE",2778083089:"IFCROUNDEDRECTANGLEPROFILEDEF",478536968:"IFCRELATIONSHIP",3765753017:"IFCREINFORCEMENTDEFINITIONPROPERTIES",3413951693:"IFCREGULARTIMESERIES",3615266464:"IFCRECTANGLEPROFILEDEF",110355661:"IFCPROPERTYTABLEVALUE",3650150729:"IFCPROPERTYSINGLEVALUE",3357820518:"IFCPROPERTYSETDEFINITION",941946838:"IFCPROPERTYREFERENCEVALUE",2752243245:"IFCPROPERTYLISTVALUE",4166981789:"IFCPROPERTYENUMERATEDVALUE",1680319473:"IFCPROPERTYDEFINITION",871118103:"IFCPROPERTYBOUNDEDVALUE",673634403:"IFCPRODUCTDEFINITIONSHAPE",179317114:"IFCPREDEFINEDPOINTMARKERSYMBOL",433424934:"IFCPREDEFINEDDIMENSIONSYMBOL",2559016684:"IFCPREDEFINEDCURVEFONT",759155922:"IFCPREDEFINEDCOLOUR",2775532180:"IFCPOLYGONALBOUNDEDHALFSPACE",2924175390:"IFCPOLYLOOP",1423911732:"IFCPOINTONSURFACE",4022376103:"IFCPOINTONCURVE",2067069095:"IFCPOINT",1663979128:"IFCPLANAREXTENT",2004835150:"IFCPLACEMENT",597895409:"IFCPIXELTEXTURE",3021840470:"IFCPHYSICALCOMPLEXQUANTITY",2519244187:"IFCPATH",2529465313:"IFCPARAMETERIZEDPROFILEDEF",1029017970:"IFCORIENTEDEDGE",2665983363:"IFCOPENSHELL",2833995503:"IFCONEDIRECTIONREPEATFACTOR",219451334:"IFCOBJECTDEFINITION",1430189142:"IFCMECHANICALCONCRETEMATERIALPROPERTIES",2022407955:"IFCMATERIALDEFINITIONREPRESENTATION",2347385850:"IFCMAPPEDITEM",1008929658:"IFCLOOP",2624227202:"IFCLOCALPLACEMENT",3422422726:"IFCLIGHTSOURCESPOT",1520743889:"IFCLIGHTSOURCEPOSITIONAL",4266656042:"IFCLIGHTSOURCEGONIOMETRIC",2604431987:"IFCLIGHTSOURCEDIRECTIONAL",125510826:"IFCLIGHTSOURCEAMBIENT",1402838566:"IFCLIGHTSOURCE",3741457305:"IFCIRREGULARTIMESERIES",3905492369:"IFCIMAGETEXTURE",2445078500:"IFCHYGROSCOPICMATERIALPROPERTIES",812098782:"IFCHALFSPACESOLID",178086475:"IFCGRIDPLACEMENT",3590301190:"IFCGEOMETRICSET",4142052618:"IFCGEOMETRICREPRESENTATIONSUBCONTEXT",2453401579:"IFCGEOMETRICREPRESENTATIONITEM",3448662350:"IFCGEOMETRICREPRESENTATIONCONTEXT",1446786286:"IFCGENERALPROFILEPROPERTIES",803998398:"IFCGENERALMATERIALPROPERTIES",3857492461:"IFCFUELPROPERTIES",738692330:"IFCFILLAREASTYLE",4219587988:"IFCFAILURECONNECTIONCONDITION",3008276851:"IFCFACESURFACE",803316827:"IFCFACEOUTERBOUND",1809719519:"IFCFACEBOUND",2556980723:"IFCFACE",1860660968:"IFCEXTENDEDMATERIALPROPERTIES",476780140:"IFCEDGECURVE",3900360178:"IFCEDGE",4170525392:"IFCDRAUGHTINGPREDEFINEDTEXTFONT",3732053477:"IFCDOCUMENTREFERENCE",1694125774:"IFCDIMENSIONPAIR",2273265877:"IFCDIMENSIONCALLOUTRELATIONSHIP",3632507154:"IFCDERIVEDPROFILEDEF",3800577675:"IFCCURVESTYLE",2889183280:"IFCCONVERSIONBASEDUNIT",3050246964:"IFCCONTEXTDEPENDENTUNIT",45288368:"IFCCONNECTIONPOINTECCENTRICITY",1981873012:"IFCCONNECTIONCURVEGEOMETRY",370225590:"IFCCONNECTEDFACESET",1485152156:"IFCCOMPOSITEPROFILEDEF",2542286263:"IFCCOMPLEXPROPERTY",776857604:"IFCCOLOURRGB",647927063:"IFCCLASSIFICATIONREFERENCE",3150382593:"IFCCENTERLINEPROFILEDEF",616511568:"IFCBLOBTEXTURE",2705031697:"IFCARBITRARYPROFILEDEFWITHVOIDS",1310608509:"IFCARBITRARYOPENPROFILEDEF",3798115385:"IFCARBITRARYCLOSEDPROFILEDEF",2297822566:"IFCANNOTATIONTEXTOCCURRENCE",3612888222:"IFCANNOTATIONSYMBOLOCCURRENCE",962685235:"IFCANNOTATIONSURFACEOCCURRENCE",2442683028:"IFCANNOTATIONOCCURRENCE",1065908215:"IFCWATERPROPERTIES",891718957:"IFCVIRTUALGRIDINTERSECTION",1907098498:"IFCVERTEXPOINT",3304826586:"IFCVERTEXBASEDTEXTUREMAP",2799835756:"IFCVERTEX",180925521:"IFCUNITASSIGNMENT",1735638870:"IFCTOPOLOGYREPRESENTATION",1377556343:"IFCTOPOLOGICALREPRESENTATIONITEM",581633288:"IFCTIMESERIESVALUE",1718945513:"IFCTIMESERIESREFERENCERELATIONSHIP",3101149627:"IFCTIMESERIES",3317419933:"IFCTHERMALMATERIALPROPERTIES",1210645708:"IFCTEXTUREVERTEX",2552916305:"IFCTEXTUREMAP",1742049831:"IFCTEXTURECOORDINATEGENERATOR",280115917:"IFCTEXTURECOORDINATE",1484833681:"IFCTEXTSTYLEWITHBOXCHARACTERISTICS",1640371178:"IFCTEXTSTYLETEXTMODEL",2636378356:"IFCTEXTSTYLEFORDEFINEDFONT",1983826977:"IFCTEXTSTYLEFONTMODEL",1447204868:"IFCTEXTSTYLE",912023232:"IFCTELECOMADDRESS",531007025:"IFCTABLEROW",985171141:"IFCTABLE",1290481447:"IFCSYMBOLSTYLE",626085974:"IFCSURFACETEXTURE",1351298697:"IFCSURFACESTYLEWITHTEXTURES",846575682:"IFCSURFACESTYLESHADING",1607154358:"IFCSURFACESTYLEREFRACTION",3303107099:"IFCSURFACESTYLELIGHTING",1300840506:"IFCSURFACESTYLE",3049322572:"IFCSTYLEDREPRESENTATION",3958052878:"IFCSTYLEDITEM",2830218821:"IFCSTYLEMODEL",3408363356:"IFCSTRUCTURALLOADTEMPERATURE",2525727697:"IFCSTRUCTURALLOADSTATIC",2162789131:"IFCSTRUCTURALLOAD",2273995522:"IFCSTRUCTURALCONNECTIONCONDITION",3692461612:"IFCSIMPLEPROPERTY",4240577450:"IFCSHAPEREPRESENTATION",3982875396:"IFCSHAPEMODEL",867548509:"IFCSHAPEASPECT",4165799628:"IFCSECTIONREINFORCEMENTPROPERTIES",2042790032:"IFCSECTIONPROPERTIES",448429030:"IFCSIUNIT",2341007311:"IFCROOT",3679540991:"IFCRIBPLATEPROFILEPROPERTIES",1660063152:"IFCREPRESENTATIONMAP",3008791417:"IFCREPRESENTATIONITEM",3377609919:"IFCREPRESENTATIONCONTEXT",1076942058:"IFCREPRESENTATION",1222501353:"IFCRELAXATION",1580146022:"IFCREINFORCEMENTBARPROPERTIES",2692823254:"IFCREFERENCESVALUEDOCUMENT",825690147:"IFCQUANTITYWEIGHT",2405470396:"IFCQUANTITYVOLUME",3252649465:"IFCQUANTITYTIME",931644368:"IFCQUANTITYLENGTH",2093928680:"IFCQUANTITYCOUNT",2044713172:"IFCQUANTITYAREA",3710013099:"IFCPROPERTYENUMERATION",148025276:"IFCPROPERTYDEPENDENCYRELATIONSHIP",3896028662:"IFCPROPERTYCONSTRAINTRELATIONSHIP",2598011224:"IFCPROPERTY",2802850158:"IFCPROFILEPROPERTIES",3958567839:"IFCPROFILEDEF",2267347899:"IFCPRODUCTSOFCOMBUSTIONPROPERTIES",2095639259:"IFCPRODUCTREPRESENTATION",2417041796:"IFCPRESENTATIONSTYLEASSIGNMENT",3119450353:"IFCPRESENTATIONSTYLE",1304840413:"IFCPRESENTATIONLAYERWITHSTYLE",2022622350:"IFCPRESENTATIONLAYERASSIGNMENT",1775413392:"IFCPREDEFINEDTEXTFONT",3213052703:"IFCPREDEFINEDTERMINATORSYMBOL",990879717:"IFCPREDEFINEDSYMBOL",3727388367:"IFCPREDEFINEDITEM",3355820592:"IFCPOSTALADDRESS",2226359599:"IFCPHYSICALSIMPLEQUANTITY",2483315170:"IFCPHYSICALQUANTITY",101040310:"IFCPERSONANDORGANIZATION",2077209135:"IFCPERSON",1207048766:"IFCOWNERHISTORY",1411181986:"IFCORGANIZATIONRELATIONSHIP",4251960020:"IFCORGANIZATION",1227763645:"IFCOPTICALMATERIALPROPERTIES",2251480897:"IFCOBJECTIVE",3701648758:"IFCOBJECTPLACEMENT",1918398963:"IFCNAMEDUNIT",2706619895:"IFCMONETARYUNIT",3368373690:"IFCMETRIC",677618848:"IFCMECHANICALSTEELMATERIALPROPERTIES",4256014907:"IFCMECHANICALMATERIALPROPERTIES",2597039031:"IFCMEASUREWITHUNIT",3265635763:"IFCMATERIALPROPERTIES",2199411900:"IFCMATERIALLIST",1303795690:"IFCMATERIALLAYERSETUSAGE",3303938423:"IFCMATERIALLAYERSET",248100487:"IFCMATERIALLAYER",1847130766:"IFCMATERIALCLASSIFICATIONRELATIONSHIP",1838606355:"IFCMATERIAL",30780891:"IFCLOCALTIME",1566485204:"IFCLIGHTINTENSITYDISTRIBUTION",4162380809:"IFCLIGHTDISTRIBUTIONDATA",3452421091:"IFCLIBRARYREFERENCE",2655187982:"IFCLIBRARYINFORMATION",3020489413:"IFCIRREGULARTIMESERIESVALUE",852622518:"IFCGRIDAXIS",3548104201:"IFCEXTERNALLYDEFINEDTEXTFONT",3207319532:"IFCEXTERNALLYDEFINEDSYMBOL",1040185647:"IFCEXTERNALLYDEFINEDSURFACESTYLE",2242383968:"IFCEXTERNALLYDEFINEDHATCHSTYLE",3200245327:"IFCEXTERNALREFERENCE",1648886627:"IFCENVIRONMENTALIMPACTVALUE",3796139169:"IFCDRAUGHTINGCALLOUTRELATIONSHIP",770865208:"IFCDOCUMENTINFORMATIONRELATIONSHIP",1154170062:"IFCDOCUMENTINFORMATION",1376555844:"IFCDOCUMENTELECTRONICFORMAT",2949456006:"IFCDIMENSIONALEXPONENTS",1045800335:"IFCDERIVEDUNITELEMENT",1765591967:"IFCDERIVEDUNIT",1072939445:"IFCDATEANDTIME",3510044353:"IFCCURVESTYLEFONTPATTERN",2367409068:"IFCCURVESTYLEFONTANDSCALING",1105321065:"IFCCURVESTYLEFONT",539742890:"IFCCURRENCYRELATIONSHIP",602808272:"IFCCOSTVALUE",1065062679:"IFCCOORDINATEDUNIVERSALTIMEOFFSET",347226245:"IFCCONSTRAINTRELATIONSHIP",613356794:"IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP",1658513725:"IFCCONSTRAINTAGGREGATIONRELATIONSHIP",1959218052:"IFCCONSTRAINT",2732653382:"IFCCONNECTIONSURFACEGEOMETRY",4257277454:"IFCCONNECTIONPORTGEOMETRY",2614616156:"IFCCONNECTIONPOINTGEOMETRY",2859738748:"IFCCONNECTIONGEOMETRY",3264961684:"IFCCOLOURSPECIFICATION",3639012971:"IFCCLASSIFICATIONNOTATIONFACET",938368621:"IFCCLASSIFICATIONNOTATION",1098599126:"IFCCLASSIFICATIONITEMRELATIONSHIP",1767535486:"IFCCLASSIFICATIONITEM",747523909:"IFCCLASSIFICATION",622194075:"IFCCALENDARDATE",2069777674:"IFCBOUNDARYNODECONDITIONWARPING",1387855156:"IFCBOUNDARYNODECONDITION",3367102660:"IFCBOUNDARYFACECONDITION",1560379544:"IFCBOUNDARYEDGECONDITION",4037036970:"IFCBOUNDARYCONDITION",3869604511:"IFCAPPROVALRELATIONSHIP",390851274:"IFCAPPROVALPROPERTYRELATIONSHIP",2080292479:"IFCAPPROVALACTORRELATIONSHIP",130549933:"IFCAPPROVAL",1110488051:"IFCAPPLIEDVALUERELATIONSHIP",411424972:"IFCAPPLIEDVALUE",639542469:"IFCAPPLICATION",618182010:"IFCADDRESS",3630933823:"IFCACTORROLE",599546466:"FILE_DESCRIPTION",1390159747:"FILE_NAME",1109904537:"FILE_SCHEMA"};class Yt{static async getUnits(t){var e;const{IFCUNITASSIGNMENT:s}=ft,i=await t.getAllPropertiesOfType(s);if(!i)return 1;const n=Object.keys(i),o=i[parseInt(n[0],10)];for(const r of o.Units){if(r.value===void 0||r.value===null)continue;const a=await t.getProperties(r.value);if(!a||!a.UnitType||!a.UnitType.value||a.UnitType.value!=="LENGTHUNIT")continue;let c=1,d=1;return a.Name.value==="METRE"&&(d=1),a.Name.value==="FOOT"&&(d=.3048),((e=a.Prefix)==null?void 0:e.value)==="MILLI"&&(c=.001),d*c}return 1}static async findItemByGuid(t,e){var s;const i=t.getAllPropertiesIDs();for(const n of i){const o=await t.getProperties(n);if(o&&((s=o.GlobalId)==null?void 0:s.value)===e)return o}return null}static async getRelationMap(t,e,s){var i;const n=s??(async()=>{}),o={},r=t.getAllPropertiesIDs();for(const a of r){const c=await t.getProperties(a);if(!c)continue;const d=c.type===e,E=Object.keys(c).find(f=>f.startsWith("Relating")),l=Object.keys(c).find(f=>f.startsWith("Related"));if(!(d&&E&&l))continue;const u=await t.getProperties((i=c[E])==null?void 0:i.value),T=c[l];if(!u||!T||!(T&&Array.isArray(T)))continue;const C=T.map(f=>f.value);await n(u.expressID,C),o[u.expressID]=C}return o}static async getQsetQuantities(t,e,s){const i=s??(()=>{}),n=await t.getProperties(e);return!n||n.type!==Uo?null:(n.Quantities??[{}]).map(o=>(o.value&&i(o.value),o.value)).filter(o=>o!==null)}static async getPsetProps(t,e,s){const i=s??(()=>{}),n=await t.getProperties(e);return!n||n.type!==ti?null:(n.HasProperties??[{}]).map(o=>(o.value&&i(o.value),o.value)).filter(o=>o!==null)}static async getPsetRel(t,e){var s;if(!await t.getProperties(e))return null;const i=await t.getAllPropertiesOfType(_s);if(!i)return null;const n=Object.values(i);let o=null;for(const r of n)((s=r.RelatingPropertyDefinition)==null?void 0:s.value)===e&&(o=r.expressID);return o}static async getQsetRel(t,e){return Yt.getPsetRel(t,e)}static async getEntityName(t,e){var s;const i=await t.getProperties(e);if(!i)return{key:null,name:null};const n=Object.keys(i).find(r=>r.endsWith("Name"))??null,o=n?(s=i[n])==null?void 0:s.value:null;return{key:n,name:o}}static async getQuantityValue(t,e){const s=await t.getProperties(e);if(!s)return{key:null,value:null};const i=Object.keys(s).find(o=>o.endsWith("Value"))??null;let n;return i===null||s[i]===void 0||s[i]===null?n=null:n=s[i].value,{key:i,value:n}}static isRel(t){return no[t].startsWith("IFCREL")}static async attributeExists(t,e,s){const i=await t.getProperties(e);return i?Object.keys(i).includes(s):!1}static async groupEntitiesByType(t,e){var s;const i=new Map;for(const n of e){const o=await t.getProperties(n);if(!o)continue;const r=o.type;i.get(r)||i.set(r,new Set),(s=i.get(r))==null||s.add(n)}return i}}const ka=new Map([[Ai,{forRelating:"IsDecomposedBy",forRelated:"Decomposes"}],[Fi,{forRelating:"AssociatedTo",forRelated:"HasAssociations"}],[gi,{forRelating:"ClassificationForObjects",forRelated:"HasAssociations"}],[Oi,{forRelating:"IsGroupedBy",forRelated:"HasAssignments"}],[_s,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[_i,{forRelated:"IsTypedBy",forRelating:"Types"}],[Mn,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[Ss,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}]]),oo=class pi extends q{constructor(t){super(t),I(this,"onDisposed",new M),I(this,"enabled",!0),I(this,"onRelationsIndexed",new M),I(this,"_relToAttributesMap",ka),I(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements"]),I(this,"_ifcRels",[Ai,Fi,gi,Oi,_s,_i,Mn,Ss]),I(this,"relationMaps",{}),I(this,"onFragmentsDisposed",e=>{delete this.relationMaps[e.groupID]}),this.components.add(pi.uuid,this),t.get(wt).onFragmentsDisposed.add(this.onFragmentsDisposed)}setRelationMap(t,e){this.relationMaps[t.uuid]=e,this.onRelationsIndexed.trigger({modelID:t.uuid,relationsMap:e})}async process(t){if(!t.hasProperties)throw new Error("FragmentsGroup properties not found");let e=this.relationMaps[t.uuid];if(e)return e;e=new Map;for(const s of this._ifcRels)await Yt.getRelationMap(t,s,async(i,n)=>{const o=this._relToAttributesMap.get(s);if(!o)return;const{forRelated:r,forRelating:a}=o,c=e.get(i)??new Map,d=this._inverseAttributes.indexOf(a);c.set(d,n),e.set(i,c);for(const E of n){const l=e.get(E)??new Map,u=this._inverseAttributes.indexOf(r),T=l.get(u)??[];T.push(i),l.set(u,T),e.set(E,l)}});return this.setRelationMap(t,e),e}async processFromWebIfc(t,e){const s=new Map;for(const i of this._ifcRels){const n=this._relToAttributesMap.get(i);if(!n)continue;const{forRelated:o,forRelating:r}=n,a=t.GetLineIDsWithType(e,i);for(let c=0;cm.startsWith("Relating")),l=Object.keys(d).find(m=>m.startsWith("Related"));if(!(E&&l))continue;const u=d[E].value,T=d[l].map(m=>m.value),C=s.get(u)??new Map,f=this._inverseAttributes.indexOf(r);C.set(f,T),s.set(u,C);for(const m of T){const R=s.get(m)??new Map,F=this._inverseAttributes.indexOf(o),p=R.get(F)??[];p.push(u),R.set(F,p),s.set(m,R)}}}return this.onRelationsIndexed.trigger({modelID:e.toString(),relationsMap:s}),s}getEntityRelations(t,e,s){const i=this.relationMaps[t.uuid];if(!i)return null;const n=i.get(e),o=this._inverseAttributes.indexOf(s);return!n||o===-1?null:n.get(o)||null}serializeRelations(t){const e={};for(const[s,i]of t.entries()){e[s]||(e[s]={});for(const[n,o]of i.entries())e[s][n]=o}return JSON.stringify(e)}serializeModelRelations(t){const e=this.relationMaps[t.uuid];return e?this.serializeRelations(e):null}serializeAllRelations(){const t={};for(const e in this.relationMaps){const s=this.relationMaps[e],i={};for(const[n,o]of s.entries()){i[n]||(i[n]={});for(const[r,a]of o.entries())i[n][r]=a}t[e]=i}return JSON.stringify(t)}getRelationsMapFromJSON(t){const e=JSON.parse(t),s=new Map;for(const i in e){const n=e[i],o=new Map;for(const r in n)o.set(Number(r),n[r]);s.set(Number(i),o)}return s}dispose(){this.relationMaps={},this.components.get(wt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(pi.uuid),this.onDisposed.reset()}};I(oo,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let Bi=oo;class Wa{constructor(){I(this,"factor",1),I(this,"complement",1)}apply(t){const e=this.getScaleMatrix().multiply(t);t.copy(e)}setUp(t){var e;this.factor=1;const s=this.getLengthUnits(t);if(!s)return;const i=s==null,n=s.Name===void 0||s.Name===null;i||n||(s.Name.value==="FOOT"?this.factor=.3048:((e=s.Prefix)==null?void 0:e.value)==="MILLI"&&(this.complement=.001))}getLengthUnits(t){try{const e=t.GetLineIDsWithType(0,Wo).get(0),s=t.GetLine(0,e);for(const i of s.Units){if(!i||i.value===null||i.value===void 0)continue;const n=t.GetLine(0,i.value);if(n.UnitType&&n.UnitType.value==="LENGTHUNIT")return n}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const t=this.factor;return new X().fromArray([t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1])}}class ro{constructor(){I(this,"itemsByFloor",{}),I(this,"_units",new Wa)}setUp(t){this._units.setUp(t),this.cleanUp();try{const e=t.GetLineIDsWithType(0,Ss),s=new Set,i=t.GetLineIDsWithType(0,$t);for(let c=0;c{this.getMesh(r,e)});for(const r of this._visitedFragments){const{index:a,fragment:c}=r[1];e.keyFragments.set(a,c.id)}for(const r of e.items){const a=this._fragmentInstances.get(r.id);if(!a)throw new Error("Fragment not found!");const c=[];for(const[d,E]of a)c.push(E);r.add(c)}const o=this.webIfc.GetCoordinationMatrix(0);return e.coordinationMatrix.fromArray(o),e.civilData=this._civil.read(this.webIfc),e}cleanUp(){this.webIfc=null,this.webIfc=new zt,this._visitedFragments.clear(),this._fragmentInstances.clear()}getMesh(t,e){const s=t.geometries.size(),i=t.expressID;for(let n=0;nparseInt(o,10)),i=e[s[0]],n=new Ze(i.expressID);return{ownerHistory:i,ownerHistoryHandle:n}}registerChange(t,...e){this.changeMap[t.uuid]||(this.changeMap[t.uuid]=new Set);for(const s of e)this.changeMap[t.uuid].add(s),this.onDataChanged.trigger({model:t,expressID:s})}async setData(t,...e){for(const s of e){const i=s.expressID;i&&(await t.setProperties(i,s),this.registerChange(t,i))}}async newPset(t,e,s){const i=ue.getIFCSchema(t),{ownerHistoryHandle:n}=await this.getOwnerHistory(t),o=this.newGUID(t),r=new ft[i].IfcLabel(e),a=s?new ft[i].IfcText(s):null,c=new ft[i].IfcPropertySet(o,n,r,a,[]);c.expressID=this.increaseMaxID(t);const d=this.newGUID(t),E=new ft[i].IfcRelDefinesByProperties(d,n,null,null,[],new Ze(c.expressID));return E.expressID=this.increaseMaxID(t),await this.setData(t,c,E),{pset:c,rel:E}}async removePset(t,...e){for(const s of e){const i=await t.getProperties(s);if((i==null?void 0:i.type)!==ti)continue;const n=await Yt.getPsetRel(t,s);if(n&&(await t.setProperties(n,null),this.registerChange(t,n)),i){for(const o of i.HasProperties)await t.setProperties(o.value,null);await t.setProperties(s,null),this.onPsetRemoved.trigger({model:t,psetID:s}),this.registerChange(t,s)}}}async newSingleProperty(t,e,s,i){const n=ue.getIFCSchema(t),o=new ft[n].IfcIdentifier(s),r=new ft[n][e](i),a=new ft[n].IfcPropertySingleValue(o,null,r,null);return a.expressID=this.increaseMaxID(t),await this.setData(t,a),a}newSingleStringProperty(t,e,s,i){return this.newSingleProperty(t,e,s,i)}newSingleNumericProperty(t,e,s,i){return this.newSingleProperty(t,e,s,i)}newSingleBooleanProperty(t,e,s,i){return this.newSingleProperty(t,e,s,i)}async removePsetProp(t,e,s){const i=await t.getProperties(e),n=await t.getProperties(s);!i||!n||i.type===ti&&n&&(i.HasProperties=i.HasProperties.filter(o=>o.value!==s),await t.setProperties(s,null),this.registerChange(t,e,s))}async addElementToPset(t,e,...s){const i=await Yt.getPsetRel(t,e);if(!i)return;const n=await t.getProperties(i);if(n){for(const o of s){const r=new Ze(o);n.RelatedObjects.push(r),this.onElementToPset.trigger({model:t,psetID:e,elementID:o})}this.registerChange(t,e)}}async addPropToPset(t,e,...s){const i=await t.getProperties(e);if(i){for(const n of s){if(i.HasProperties.includes(n))continue;const o=new Ze(n);i.HasProperties.push(o),this.onPropToPset.trigger({model:t,psetID:e,propID:n})}this.registerChange(t,e)}}async saveToIfc(t,e){const s=this.components.get(Xa),i=s.webIfc,n=await s.readIfcFile(e),o=this.changeMap[t.uuid]??[];for(const a of o){const c=await t.getProperties(a);if(c)try{i.WriteLine(n,c)}catch{}else try{i.DeleteLine(n,a)}catch{}}const r=i.SaveModel(n);return s.webIfc.CloseModel(n),s.cleanUp(),r}async setAttributeListener(t,e,s){this.attributeListeners[t.uuid]||(this.attributeListeners[t.uuid]={});const i=this.attributeListeners[t.uuid][e]?this.attributeListeners[t.uuid][e][s]:null;if(i)return i;const n=await t.getProperties(e);if(!n)throw new Error(`Entity with expressID ${e} doesn't exists.`);const o=n[s];if(Array.isArray(o)||!o)throw new Error(`Attribute ${s} is array or null, and it can't have a listener.`);const r=o.value;if(r===void 0||r==null)throw new Error(`Attribute ${s} has a badly defined handle.`);const a=new M;return Object.defineProperty(n[s],"value",{get(){return this._value},async set(c){this._value=c,a.trigger(c)}}),n[s].value=r,this.attributeListeners[t.uuid][e]||(this.attributeListeners[t.uuid][e]={}),this.attributeListeners[t.uuid][e][s]=a,a}};I(Za,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");const lo=class Eo extends q{constructor(t){super(t),I(this,"enabled",!0),I(this,"list",{}),I(this,"onDisposed",new M),I(this,"onFragmentsDisposed",e=>{const{groupID:s,fragmentIDs:i}=e;for(const n in this.list){const o=this.list[n],r=Object.keys(o);if(r.includes(s))delete o[s],Object.values(o).length===0&&delete this.list[n];else for(const a of r){const c=o[a];for(const d of i)delete c[d];Object.values(c).length===0&&delete o[a]}}}),t.add(Eo.uuid,this),t.get(wt).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(wt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(t){for(const e in this.list){const s=this.list[e];for(const i in s){const n=s[i];delete n[t]}}}find(t){const e=this.components.get(wt);if(!t){const o={};for(const[r,a]of e.list)o[r]=new Set(a.ids);return o}const s=Object.keys(t).length,i={};for(const o in t){const r=t[o];if(!this.list[o]){console.warn(`Classification ${o} does not exist.`);continue}for(const a of r){const c=this.list[o][a];if(c)for(const d in c){i[d]||(i[d]=new Map);for(const E of c[d]){const l=i[d].get(E);l===void 0?i[d].set(E,1):i[d].set(E,l+1)}}}}const n={};for(const o in i){const r=i[o];for(const[a,c]of r){if(c===void 0)throw new Error("Malformed fragments map!");c===s&&(n[o]||(n[o]=new Set),n[o].add(a))}}return n}byModel(t,e){this.list.models||(this.list.models={});const s=this.list.models;s[t]||(s[t]={});const i=s[t];for(const[n,o]of e.data){const r=o[0];for(const a of r){const c=e.keyFragments.get(a);c&&(i[c]||(i[c]=new Set),i[c].add(n))}}}async byPredefinedType(t){var e;this.list.predefinedTypes||(this.list.predefinedTypes={});const s=this.list.predefinedTypes,i=t.getAllPropertiesIDs();for(const n of i){const o=await t.getProperties(n);if(!o)continue;const r=String((e=o.PredefinedType)==null?void 0:e.value).toUpperCase();s[r]||(s[r]={});const a=s[r];for(const[c,d]of t.data){const E=d[0];for(const l of E){const u=t.keyFragments.get(l);if(!u)throw new Error("Fragment ID not found!");a[u]||(a[u]=new Set),a[u].add(o.expressID)}}}}byEntity(t){this.list.entities||(this.list.entities={});for(const[e,s]of t.data){const i=s[1][1],n=no[i];this.saveItem(t,"entities",n,e)}}async byIfcRel(t,e,s){Yt.isRel(e)&&await Yt.getRelationMap(t,e,async(i,n)=>{const{name:o}=await Yt.getEntityName(t,i);for(const r of n)this.saveItem(t,s,o??"NO REL NAME",r)})}async bySpatialStructure(t){var e;const s=this.components.get(Bi),i=s.relationMaps[t.uuid];if(!i)throw new Error(`Classifier: model relations of ${t.name||t.uuid} have to exists to group by spatial structure.`);const n="spatialStructures";for(const[o]of i){const r=s.getEntityRelations(t,o,"ContainsElements"),a=await t.getProperties(o);if(!(r&&a))continue;const c=(e=a.Name)==null?void 0:e.value;for(const d of r){this.saveItem(t,n,c,d);const E=s.getEntityRelations(t,Number(d),"IsDecomposedBy");if(E)for(const l of E)this.saveItem(t,n,c,l)}}}setColor(t,e,s=!1){const i=this.components.get(wt);for(const n in t){const o=i.list.get(n);if(!o)continue;const r=t[n];o.setColor(e,r,s)}}resetColor(t){const e=this.components.get(wt);for(const s in t){const i=e.list.get(s);if(!i)continue;const n=t[s];i.resetColor(n)}}saveItem(t,e,s,i){this.list[e]||(this.list[e]={});const n=t.data.get(i);if(n)for(const o of n[0]){const r=t.keyFragments.get(o);if(r){const a=this.list[e];a[s]||(a[s]={}),a[s][r]||(a[s][r]=new Set),a[s][r].add(i)}}}};I(lo,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let Qa=lo;const Io=class uo extends q{constructor(t){super(t),I(this,"enabled",!0),I(this,"height",10),I(this,"groupName","storeys"),I(this,"onDisposed",new M),I(this,"list",new Set),t.add(uo.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(t){if(!this.enabled)return;const e=this.components.get(Qa),s=this.components.get(wt),i=t?1:-1;let n=0;const o=e.list[this.groupName],r=new X;for(const a in o){r.elements[13]=n*i*this.height;for(const c in o[a]){const d=s.list.get(c),E=a+c,l=this.list.has(E);if(!d||t&&l||!t&&!l)continue;t?this.list.add(E):this.list.delete(E);const u=o[a][c];d.applyTransform(u,r)}n++}}};I(Io,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let ah=Io;const po=class Co extends q{constructor(t){super(t),I(this,"enabled",!0),this.components.add(Co.uuid,this)}set(t,e){const s=this.components.get(wt);if(!e){for(const i in s.list){const n=s.list.get(i);n&&(n.setVisibility(t),this.updateCulledVisibility(n))}return}for(const i in e){const n=e[i],o=s.list.get(i);o&&(o.setVisibility(t,n),this.updateCulledVisibility(o))}}isolate(t){this.set(!1),this.set(!0,t)}updateCulledVisibility(t){const e=this.components.get(va);for(const[s,i]of e.list){const n=i.colorMeshes.get(t.id);n&&(n.count=t.mesh.count)}}};I(po,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let hh=po;class ja extends Yi{constructor(){super(...arguments),I(this,"minGeometrySize",10),I(this,"minAssetsSize",1e3)}}class To extends Yi{constructor(){super(...arguments),I(this,"propertiesSize",100)}}class qa extends q{constructor(){super(...arguments),I(this,"onPropertiesStreamed",new Kt),I(this,"onProgress",new Kt),I(this,"onIndicesStreamed",new Kt),I(this,"onDisposed",new M),I(this,"enabled",!0),I(this,"settings",new To),I(this,"webIfc",new zt)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(t){const e=performance.now();await this.readIfcFile(t),await this.streamAllProperties(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-e} ms!`)}async streamFromCallBack(t){const e=performance.now();await this.streamIfcFile(t),await this.streamAllProperties(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-e} ms!`)}async readIfcFile(t){const{path:e,absolute:s,logLevel:i}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),i&&this.webIfc.SetLogLevel(i),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:s,logLevel:i}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),i&&this.webIfc.SetLogLevel(i),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:t}=this.settings,e=new Set(this.webIfc.GetIfcEntityList(0)),s=[_s,_i,Fi,Ss,gi,Oi],i=new Map,n=new Set([Si,Ni,wi,yi,$t]);for(const c of n)e.add(c);let o=.01,r=0;for(const c of e){if(r++,vi.has(c))continue;const d=n.has(c),E=this.webIfc.GetLineIDsWithType(0,c),l=E.size();let u=0;for(let C=0;Co&&(o+=.01,o=Math.max(o,T),await this.onProgress.trigger(Math.round(o*100)/100))}const a=[];for(const[c,d]of i)a.push([c,...d]);await this.onIndicesStreamed.trigger(a)}getIndices(t,e,s){const i=t.RelatedObjects||t.RelatedElements;if(!i){console.log(`Related objects not found: ${e}`);return}const n=t.RelatingType||t.RelatingMaterial||t.RelatingStructure||t.RelatingPropertyDefinition||t.RelatingGroup||t.RelatingClassification;if(!n){console.log(`Relating object not found: ${e}`);return}if(!Array.isArray(i)||n.value===void 0)return;const o=n.value;for(const r of i){if(r.value===void 0||r.value===null)continue;const a=r.value;s.has(a)||s.set(a,new Set),s.get(a).add(o)}}cleanUp(){this.webIfc=null,this.webIfc=new zt}}I(qa,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");const Ka=class mo extends q{constructor(t){super(t),I(this,"onGeometryStreamed",new M),I(this,"onAssetStreamed",new M),I(this,"onProgress",new M),I(this,"onIfcLoaded",new M),I(this,"onDisposed",new M),I(this,"settings",new ja),I(this,"enabled",!0),I(this,"webIfc",new zt),I(this,"_spatialTree",new ro),I(this,"_metaData",new ho),I(this,"_visitedGeometries",new Map),I(this,"_streamSerializer",new bo),I(this,"_geometries",new Map),I(this,"_geometryCount",0),I(this,"_civil",new ao),I(this,"_groupSerializer",new Pn),I(this,"_assets",[]),I(this,"_meshesWithHoles",new Set),this.components.add(mo.uuid,this),this.settings.excludedCategories.add(Un)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(t){const e=performance.now();await this.readIfcFile(t),await this.streamAllGeometries(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-e} ms!`)}async streamFromCallBack(t){const e=performance.now();await this.streamIfcFile(t),await this.streamAllGeometries(),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-e} ms!`)}async readIfcFile(t){const{path:e,absolute:s,logLevel:i}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),i&&this.webIfc.SetLogLevel(i),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:s,logLevel:i}=this.settings.wasm;this.webIfc.SetWasmPath(e,s),await this.webIfc.Init(),i&&this.webIfc.SetLogLevel(i),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:t,minAssetsSize:e}=this.settings;this._spatialTree.setUp(this.webIfc);const s=this.webIfc.GetIfcEntityList(0),i=[[]],n=new Dn,{FILE_NAME:o,FILE_DESCRIPTION:r}=ft;n.ifcMetadata={name:this._metaData.get(this.webIfc,o),description:this._metaData.get(this.webIfc,r),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let a=0,c=0;for(const m of s){if(!this.webIfc.IsIfcElement(m)&&m!==$t||this.settings.excludedCategories.has(m))continue;const R=this.webIfc.GetLineIDsWithType(0,m),F=R.size();console.log(F);for(let p=0;pt&&(a=0,c++,i.push([]));const A=R.get(p);i[c].push(A);const g=this._spatialTree.itemsByFloor[A]||0;n.data.set(A,[[],[g,m]]),a++}}this._spatialTree.cleanUp();let d=.01,E=0;for(const m of i){E++,this.webIfc.StreamMeshes(0,m,F=>{this.getMesh(this.webIfc,F,n)}),this._geometryCount>t&&await this.streamGeometries(),this._assets.length>e&&await this.streamAssets();const R=E/i.length;R>d&&(d+=.01,d=Math.max(d,R),this.onProgress.trigger(Math.round(d*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:l,transparent:u}=n.geometryIDs;for(const[m,{index:R,uuid:F}]of this._visitedGeometries)n.keyFragments.set(R,F),(m>1?l:u).set(m,R);const T=n.data.keys();for(const m of T){const[R]=n.data.get(m);R.length||n.data.delete(m)}const C=this.webIfc.GetCoordinationMatrix(0);n.coordinationMatrix.fromArray(C),n.civilData=this._civil.read(this.webIfc);const f=this._groupSerializer.export(n);this.onIfcLoaded.trigger(f),n.dispose(!0)}cleanUp(){this.webIfc=null,this.webIfc=new zt,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(t,e,s){const i=e.geometries.size(),n=e.expressID,o={id:n,geometries:[]};for(let r=0;ri&&(i+=.01,i=Math.max(i,l),await this.onProgress.trigger(Math.round(i*100)/100))}const o=await this.components.get(Bi).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(o)}cleanUp(){this.webIfc=null,this.webIfc=new zt}}I($a,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");const fo=class Ro extends q{constructor(t){super(t),I(this,"enabled",!0),t.add(Ro.uuid,this)}getFace(t,e,s){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const i=new Map,n=t.geometry.index.array,{plane:o}=this.getFaceData(e,s,t),r=[];for(let E=0;Ep.id);if(!u.size){const p=a++;for(const{id:A}of l)c.set(A,p);d.set(p,{edges:new Set(T),indices:new Set([E])});continue}let C=null;const f=new Set,m=new Set(T);for(const[p,A]of u){C===null?C=A:A!==C&&f.add(A),c.delete(p);const{edges:g}=d.get(A);g.delete(p),m.delete(p)}if(C===null)throw new Error("Error computing face!");const R=d.get(C),{indices:F}=R;F.add(E);for(const p of m){c.set(p,C);const{edges:A}=R;A.add(p)}for(const p of f){const A=d.get(p),{edges:g,indices:_}=A,S=d.get(C),{edges:w,indices:y}=S;for(const L of g)w.add(L),c.set(L,C);for(const L of _)y.add(L);d.delete(p)}}for(const[E,{indices:l,edges:u}]of d)if(l.has(e)){const T=[];for(const C of u){const f=i.get(C);T.push(f)}return{edges:T,indices:l}}return null}static distanceFromPointToLine(t,e,s,i=!1){const n=new At,o=new O;return n.set(e,s),n.closestPointToPoint(t,i,o),o.distanceTo(t)}getFaceData(t,e,s){const i=this.getVerticesAndNormal(s,t,e),{p1:n,p2:o,p3:r,faceNormal:a}=i;this.round(n),this.round(o),this.round(r),this.round(a);const c=[{id:`${n.x}|${n.y}|${n.z}`,value:n},{id:`${o.x}|${o.y}|${o.z}`,value:o},{id:`${r.x}|${r.y}|${r.z}`,value:r}];c.sort((R,F)=>R.idF.id?1:0);const[{id:d,value:E},{id:l,value:u},{id:T,value:C}]=c,f=[{id:`${d}|${l}`,distance:E.distanceTo(u),points:[E,u]},{id:`${l}|${T}`,distance:u.distanceTo(C),points:[u,C]},{id:`${d}|${T}`,distance:E.distanceTo(C),points:[E,C]}],m=new fe;return m.setFromNormalAndCoplanarPoint(a,n),m.constant=Math.round(m.constant*10)/10,{plane:m,edges:f}}getVerticesAndNormal(t,e,s){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const i=t.geometry.index.array,n=t.geometry.attributes.position.array,o=t.geometry.attributes.normal.array,r=i[e*3]*3,a=i[e*3+1]*3,c=i[e*3+2]*3,d=new O(n[r],n[r+1],n[r+2]),E=new O(n[a],n[a+1],n[a+2]),l=new O(n[c],n[c+1],n[c+2]),u=new O(o[r],o[r+1],o[r+2]),T=new O(o[a],o[a+1],o[a+2]),C=new O(o[c],o[c+1],o[c+2]),f=(u.x+T.x+C.x)/3,m=(u.y+T.y+C.y)/3,R=(u.z+T.z+C.z)/3,F=new O(f,m,R);if(s!==void 0&&t instanceof Ge){const p=new X;t.getMatrixAt(s,p);const A=new X;A.extractRotation(p),F.applyMatrix4(A),d.applyMatrix4(p),E.applyMatrix4(p),l.applyMatrix4(p)}return{p1:d,p2:E,p3:l,faceNormal:F}}round(t){t.x=Math.trunc(t.x*1e3)/1e3,t.y=Math.trunc(t.y*1e3)/1e3,t.z=Math.trunc(t.z*1e3)/1e3}};I(fo,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let ch=fo;export{rh as A,va as C,M as D,Yt as G,Ei as H,q as J,Kt as K,ga as N,ah as O,Qa as R,Bi as W,xa as Y,ch as _,me as a,bi as b,Xa as c,no as d,th as e,Ia as f,hh as g,nh as h,sh as i,He as k,ih as m,oh as n,Aa as p,eh as s,wt as u}; diff --git a/examples/assets/index-DHjX9tRF.js b/examples/assets/index-C5tZttZE.js similarity index 76% rename from examples/assets/index-DHjX9tRF.js rename to examples/assets/index-C5tZttZE.js index cf856eee6..715e5ea13 100644 --- a/examples/assets/index-DHjX9tRF.js +++ b/examples/assets/index-C5tZttZE.js @@ -1 +1 @@ -var z=Object.defineProperty;var x=(w,l,e)=>l in w?z(w,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):w[l]=e;var o=(w,l,e)=>(x(w,typeof l!="symbol"?l+"":l,e),e);import{C as M}from"./web-ifc-api-BC8YMRiS.js";import{J as U,U as m,u as C,H as k,A as F}from"./index-b4ozRbQy.js";const S=class S extends U{constructor(e){super(e);o(this,"onDisposed",new m);o(this,"onBeforeUpdate",new m);o(this,"onAfterUpdate",new m);o(this,"onSetup",new m);o(this,"isSetup",!1);o(this,"enabled",!0);o(this,"events",{});o(this,"multiple","ctrlKey");o(this,"zoomFactor",1.5);o(this,"zoomToSelection",!1);o(this,"backupColor",null);o(this,"selection",{});o(this,"config",{selectName:"select",hoverName:"hover",selectionColor:new M("#BCF124"),hoverColor:new M("#6528D7"),autoHighlightOnClick:!0,world:null});o(this,"colors",new Map);o(this,"_mouseState",{down:!1,moved:!1});o(this,"clearHover",()=>{this.selection[this.config.hoverName]={}});o(this,"onMouseDown",()=>{this.enabled&&(this._mouseState.down=!0)});o(this,"onMouseUp",async e=>{const t=this.config.world;if(!t)throw new Error("No world found!");if(!t.renderer)throw new Error("This world doesn't have a renderer!");if(this.enabled&&e.target===t.renderer.three.domElement){if(this._mouseState.down=!1,this._mouseState.moved||e.button!==0){this._mouseState.moved=!1;return}if(this._mouseState.moved=!1,this.config.autoHighlightOnClick){const s=this.multiple==="none"?!0:!e[this.multiple];await this.highlight(this.config.selectName,s,this.zoomToSelection)}}});o(this,"onMouseMove",async()=>{if(!this.enabled)return;if(this._mouseState.moved){this.clear(this.config.hoverName);return}this._mouseState.moved=this._mouseState.down;const e=this.selection[this.config.selectName];await this.highlight(this.config.hoverName,!0,!1,e)});this.components.add(S.uuid,this)}async dispose(){this.setupEvents(!1),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.selection={};for(const e in this.events)this.events[e].onClear.reset(),this.events[e].onHighlight.reset();this.onSetup.reset(),this.events={},this.onDisposed.trigger(S.uuid),this.onDisposed.reset()}add(e,t){if(this.selection[e]||this.colors.has(e))throw new Error("A selection with that name already exists!");this.colors.set(e,t),this.selection[e]={},this.events[e]={onHighlight:new m,onClear:new m}}async highlight(e,t=!0,s=this.zoomToSelection,a={}){if(!this.enabled)return null;if(!this.config.world)throw new Error("No world found in config!");const h=this.config.world;if(!this.selection[e])throw new Error(`Selection ${e} does not exist.`);const n=this.components.get(C).meshes,c=this.components.get(k).get(h).castRay(n);if(!c||!c.face)return this.clear(e),null;const d=c.object,b=d.geometry,E=c.instanceId;if(!b||E===void 0)return null;const v=d.fragment.getItemID(E);if(v===null)throw new Error("Item ID not found!");const D=d.fragment.group;if(!D)throw new Error("Fragment must belong to a FragmentsGroup!");const g=D.getFragmentMap([v]),f={};for(const u in g){const H=g[u],I=a[u];for(const y of H)(!I||!I.has(y))&&(f[u]||(f[u]=new Set),f[u].add(y))}return await this.highlightByID(e,f,t,s),{id:v,fragments:g}}async highlightByID(e,t,s=!0,a=this.zoomToSelection){if(!this.enabled)return;s&&this.clear(e);const h=this.components.get(C),i=this.colors.get(e);if(!i)throw new Error("Color for selection not found!");for(const n in t){const r=h.list.get(n);if(!r)continue;this.selection[e][n]||(this.selection[e][n]=new Set);const p=t[n];for(const c of p)this.selection[e][n].add(c),r.setColor(i,[c])}this.events[e].onHighlight.trigger(this.selection[e]),a&&await this.zoomSelection(e)}clear(e){const t=e?[e]:Object.keys(this.selection);for(const s of t){const a=this.components.get(C),h=this.selection[s];for(const i in this.selection[s]){const n=a.list.get(i);if(!n)continue;const r=h[i];r&&(this.backupColor?n.setColor(this.backupColor):n.resetColor(r))}this.events[s].onClear.trigger(null),this.selection[s]={}}}setup(e){this.config={...this.config,...e},this.add(this.config.selectName,this.config.selectionColor),this.add(this.config.hoverName,this.config.hoverColor),this.setupEvents(!0),this.enabled=!0,this.isSetup=!0,this.onSetup.trigger(this)}async zoomSelection(e){if(!this.config.world)throw new Error("No world found in config!");const t=this.config.world;if(!t.camera.hasCameraControls())return;const s=this.components.get(F),a=this.components.get(C);s.reset();const h=this.selection[e];if(!Object.keys(h).length)return;for(const g in h){const f=a.list.get(g);if(!f)continue;const u=h[g];s.addMesh(f.mesh,u)}const i=s.getSphere(),n=1/0,r=-1/0,{x:p,y:c,z:d}=i.center,b=i.radius===n||p===n||c===n||d===n,E=i.radius===r||p===r||c===r||d===r,v=i.radius===0;if(b||E||v)return;i.radius*=this.zoomFactor,await t.camera.controls.fitToSphere(i,!0)}setupEvents(e){if(!this.config.world)throw new Error("No world found while setting up events!");if(!this.config.world.renderer)throw new Error("The given world doesn't have a renderer!");const t=this.config.world.renderer.three.domElement,s=this.events[this.config.selectName].onHighlight;s.remove(this.clearHover),t.removeEventListener("mousedown",this.onMouseDown),t.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("mousemove",this.onMouseMove),e&&(s.add(this.clearHover),t.addEventListener("mousedown",this.onMouseDown),t.addEventListener("mouseup",this.onMouseUp),t.addEventListener("mousemove",this.onMouseMove))}};o(S,"uuid","cb8a76f2-654a-4b50-80c6-66fd83cafd77");let N=S;export{N as H}; +var z=Object.defineProperty;var x=(w,l,e)=>l in w?z(w,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):w[l]=e;var o=(w,l,e)=>(x(w,typeof l!="symbol"?l+"":l,e),e);import{C as M}from"./web-ifc-api-BC8YMRiS.js";import{J as k,D as m,u as C,H as F,A as T}from"./index-C-JPXu_n.js";const S=class S extends k{constructor(e){super(e);o(this,"onDisposed",new m);o(this,"onBeforeUpdate",new m);o(this,"onAfterUpdate",new m);o(this,"onSetup",new m);o(this,"isSetup",!1);o(this,"enabled",!0);o(this,"events",{});o(this,"multiple","ctrlKey");o(this,"zoomFactor",1.5);o(this,"zoomToSelection",!1);o(this,"backupColor",null);o(this,"selection",{});o(this,"config",{selectName:"select",hoverName:"hover",selectionColor:new M("#BCF124"),hoverColor:new M("#6528D7"),autoHighlightOnClick:!0,world:null});o(this,"colors",new Map);o(this,"_mouseState",{down:!1,moved:!1});o(this,"clearHover",()=>{this.selection[this.config.hoverName]={}});o(this,"onMouseDown",()=>{this.enabled&&(this._mouseState.down=!0)});o(this,"onMouseUp",async e=>{const t=this.config.world;if(!t)throw new Error("No world found!");if(!t.renderer)throw new Error("This world doesn't have a renderer!");if(this.enabled&&e.target===t.renderer.three.domElement){if(this._mouseState.down=!1,this._mouseState.moved||e.button!==0){this._mouseState.moved=!1;return}if(this._mouseState.moved=!1,this.config.autoHighlightOnClick){const s=this.multiple==="none"?!0:!e[this.multiple];await this.highlight(this.config.selectName,s,this.zoomToSelection)}}});o(this,"onMouseMove",async()=>{if(!this.enabled)return;if(this._mouseState.moved){this.clear(this.config.hoverName);return}this._mouseState.moved=this._mouseState.down;const e=this.selection[this.config.selectName];await this.highlight(this.config.hoverName,!0,!1,e)});this.components.add(S.uuid,this)}async dispose(){this.setupEvents(!1),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.selection={};for(const e in this.events)this.events[e].onClear.reset(),this.events[e].onHighlight.reset();this.onSetup.reset(),this.events={},this.onDisposed.trigger(S.uuid),this.onDisposed.reset()}add(e,t){if(this.selection[e]||this.colors.has(e))throw new Error("A selection with that name already exists!");this.colors.set(e,t),this.selection[e]={},this.events[e]={onHighlight:new m,onClear:new m}}async highlight(e,t=!0,s=this.zoomToSelection,a={}){if(!this.enabled)return null;if(!this.config.world)throw new Error("No world found in config!");const h=this.config.world;if(!this.selection[e])throw new Error(`Selection ${e} does not exist.`);const n=this.components.get(C).meshes,c=this.components.get(F).get(h).castRay(n);if(!c||!c.face)return this.clear(e),null;const d=c.object,D=d.geometry,E=c.instanceId;if(!D||E===void 0)return null;const v=d.fragment.getItemID(E);if(v===null)throw new Error("Item ID not found!");const b=d.fragment.group;if(!b)throw new Error("Fragment must belong to a FragmentsGroup!");const g=b.getFragmentMap([v]),f={};for(const u in g){const H=g[u],I=a[u];for(const y of H)(!I||!I.has(y))&&(f[u]||(f[u]=new Set),f[u].add(y))}return await this.highlightByID(e,f,t,s),{id:v,fragments:g}}async highlightByID(e,t,s=!0,a=this.zoomToSelection){if(!this.enabled)return;s&&this.clear(e);const h=this.components.get(C),i=this.colors.get(e);if(!i)throw new Error("Color for selection not found!");for(const n in t){const r=h.list.get(n);if(!r)continue;this.selection[e][n]||(this.selection[e][n]=new Set);const p=t[n];for(const c of p)this.selection[e][n].add(c),r.setColor(i,[c])}this.events[e].onHighlight.trigger(this.selection[e]),a&&await this.zoomSelection(e)}clear(e){const t=e?[e]:Object.keys(this.selection);for(const s of t){const a=this.components.get(C),h=this.selection[s];for(const i in this.selection[s]){const n=a.list.get(i);if(!n)continue;const r=h[i];r&&(this.backupColor?n.setColor(this.backupColor):n.resetColor(r))}this.events[s].onClear.trigger(null),this.selection[s]={}}}setup(e){this.config={...this.config,...e},this.add(this.config.selectName,this.config.selectionColor),this.add(this.config.hoverName,this.config.hoverColor),this.setupEvents(!0),this.enabled=!0,this.isSetup=!0,this.onSetup.trigger(this)}async zoomSelection(e){if(!this.config.world)throw new Error("No world found in config!");const t=this.config.world;if(!t.camera.hasCameraControls())return;const s=this.components.get(T),a=this.components.get(C);s.reset();const h=this.selection[e];if(!Object.keys(h).length)return;for(const g in h){const f=a.list.get(g);if(!f)continue;const u=h[g];s.addMesh(f.mesh,u)}const i=s.getSphere(),n=1/0,r=-1/0,{x:p,y:c,z:d}=i.center,D=i.radius===n||p===n||c===n||d===n,E=i.radius===r||p===r||c===r||d===r,v=i.radius===0;if(D||E||v)return;i.radius*=this.zoomFactor,await t.camera.controls.fitToSphere(i,!0)}setupEvents(e){if(!this.config.world)throw new Error("No world found while setting up events!");if(this.config.world.isDisposing)return;if(!this.config.world.renderer)throw new Error("The given world doesn't have a renderer!");const t=this.config.world.renderer.three.domElement,s=this.events[this.config.selectName].onHighlight;s.remove(this.clearHover),t.removeEventListener("mousedown",this.onMouseDown),t.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("mousemove",this.onMouseMove),e&&(s.add(this.clearHover),t.addEventListener("mousedown",this.onMouseDown),t.addEventListener("mouseup",this.onMouseUp),t.addEventListener("mousemove",this.onMouseMove))}};o(S,"uuid","cb8a76f2-654a-4b50-80c6-66fd83cafd77");let N=S;export{N as H}; diff --git a/examples/assets/index-D6HCkz61.js b/examples/assets/index-CF1rTqG5.js similarity index 99% rename from examples/assets/index-D6HCkz61.js rename to examples/assets/index-CF1rTqG5.js index dd2a2fcc0..eb25a872d 100644 --- a/examples/assets/index-D6HCkz61.js +++ b/examples/assets/index-CF1rTqG5.js @@ -1,4 +1,4 @@ -var P=Object.defineProperty;var I=(i,s,e)=>s in i?P(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e;var t=(i,s,e)=>(I(i,typeof s!="symbol"?s+"":s,e),e);import{E as b,D as M,C as D}from"./index-BraZXcLv.js";import{n as E,ah as m,W as A,d as w,I as g,a as U,j as p,C as B,Z as S}from"./web-ifc-api-BC8YMRiS.js";import{A as x}from"./async-event-D8tC9awa.js";class y{static isTransparent(s){return s.transparent&&s.opacity<1}}function T(i,s,e,r){return new Promise((n,o)=>{function a(){const l=i.clientWaitSync(s,e,0);if(l===i.WAIT_FAILED){o();return}if(l===i.TIMEOUT_EXPIRED){setTimeout(a,r);return}n()}a()})}async function R(i,s,e,r,n,o,a){const l=i.fenceSync(i.SYNC_GPU_COMMANDS_COMPLETE,0);i.flush(),await T(i,l,0,10),i.deleteSync(l),i.bindBuffer(s,e),i.getBufferSubData(s,r,n,o,a),i.bindBuffer(s,null)}async function V(i,s,e,r,n,o,a,l){const d=i.createBuffer();return i.bindBuffer(i.PIXEL_PACK_BUFFER,d),i.bufferData(i.PIXEL_PACK_BUFFER,l.byteLength,i.STREAM_READ),i.readPixels(s,e,r,n,o,a,0),i.bindBuffer(i.PIXEL_PACK_BUFFER,null),await R(i,i.PIXEL_PACK_BUFFER,d,0,l),i.deleteBuffer(d),l}class L{constructor(s,e,r){t(this,"onDisposed",new b);t(this,"onViewUpdated",new x);t(this,"enabled",!0);t(this,"needsUpdate",!1);t(this,"renderDebugFrame",!1);t(this,"components");t(this,"world");t(this,"renderer");t(this,"autoUpdate",!0);t(this,"updateInterval",1e3);t(this,"worker");t(this,"scene",new E);t(this,"_width",512);t(this,"_height",512);t(this,"_availableColor",1);t(this,"renderTarget");t(this,"bufferSize");t(this,"_buffer");t(this,"_isWorkerBusy",!1);t(this,"updateVisibility",async s=>{if(!this.enabled||!this.needsUpdate&&!s||this._isWorkerBusy)return;this._isWorkerBusy=!0;const e=this.world.camera.three;e.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,e);const r=this.renderer.getContext();await V(r,0,0,this._width,this._height,r.RGBA,r.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,e),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1});if(!e.renderer)throw new Error("The given world must have a renderer!");this.components=s,this.applySettings(r),this.world=e,this.renderer=new m,this.renderTarget=new A(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=e.renderer.clippingPlanes;const n=` +var P=Object.defineProperty;var I=(i,s,e)=>s in i?P(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e;var t=(i,s,e)=>(I(i,typeof s!="symbol"?s+"":s,e),e);import{E as b,D as M,C as D}from"./index-BZiAUaTo.js";import{n as E,ah as m,W as A,d as w,I as g,a as U,j as p,C as B,Z as S}from"./web-ifc-api-BC8YMRiS.js";import{A as x}from"./async-event-D8tC9awa.js";class y{static isTransparent(s){return s.transparent&&s.opacity<1}}function T(i,s,e,r){return new Promise((n,o)=>{function a(){const l=i.clientWaitSync(s,e,0);if(l===i.WAIT_FAILED){o();return}if(l===i.TIMEOUT_EXPIRED){setTimeout(a,r);return}n()}a()})}async function R(i,s,e,r,n,o,a){const l=i.fenceSync(i.SYNC_GPU_COMMANDS_COMPLETE,0);i.flush(),await T(i,l,0,10),i.deleteSync(l),i.bindBuffer(s,e),i.getBufferSubData(s,r,n,o,a),i.bindBuffer(s,null)}async function V(i,s,e,r,n,o,a,l){const d=i.createBuffer();return i.bindBuffer(i.PIXEL_PACK_BUFFER,d),i.bufferData(i.PIXEL_PACK_BUFFER,l.byteLength,i.STREAM_READ),i.readPixels(s,e,r,n,o,a,0),i.bindBuffer(i.PIXEL_PACK_BUFFER,null),await R(i,i.PIXEL_PACK_BUFFER,d,0,l),i.deleteBuffer(d),l}class L{constructor(s,e,r){t(this,"onDisposed",new b);t(this,"onViewUpdated",new x);t(this,"enabled",!0);t(this,"needsUpdate",!1);t(this,"renderDebugFrame",!1);t(this,"components");t(this,"world");t(this,"renderer");t(this,"autoUpdate",!0);t(this,"updateInterval",1e3);t(this,"worker");t(this,"scene",new E);t(this,"_width",512);t(this,"_height",512);t(this,"_availableColor",1);t(this,"renderTarget");t(this,"bufferSize");t(this,"_buffer");t(this,"_isWorkerBusy",!1);t(this,"updateVisibility",async s=>{if(!this.enabled||!this.needsUpdate&&!s||this._isWorkerBusy)return;this._isWorkerBusy=!0;const e=this.world.camera.three;e.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,e);const r=this.renderer.getContext();await V(r,0,0,this._width,this._height,r.RGBA,r.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,e),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1});if(!e.renderer)throw new Error("The given world must have a renderer!");this.components=s,this.applySettings(r),this.world=e,this.renderer=new m,this.renderTarget=new A(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=e.renderer.clippingPlanes;const n=` addEventListener("message", (event) => { const { buffer } = event.data; const colors = new Map(); diff --git a/examples/assets/index-MPPnu1_m.js b/examples/assets/index-CYkvDr46.js similarity index 98% rename from examples/assets/index-MPPnu1_m.js rename to examples/assets/index-CYkvDr46.js index 74563cda6..c604892e3 100644 --- a/examples/assets/index-MPPnu1_m.js +++ b/examples/assets/index-CYkvDr46.js @@ -1 +1 @@ -var c=Object.defineProperty;var _=(r,t,e)=>t in r?c(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var s=(r,t,e)=>(_(r,typeof t!="symbol"?t+"":t,e),e);import{M as p,G as g,B as b,c as m,g as u}from"./web-ifc-api-BC8YMRiS.js";import{a as x}from"./index-b4ozRbQy.js";import{M as d}from"./mark-Cj_PmUva.js";import"./import-wrapper-prod-LhqN7JJy.js";import{n as w}from"./dimension-mark-BiAWnjiH.js";const o=class o{constructor(t,e,i){s(this,"label");s(this,"boundingBox",new p);s(this,"world");s(this,"components");s(this,"_length");s(this,"_visible",!0);s(this,"_start");s(this,"_end");s(this,"_root",new g);s(this,"_endpoints",[]);s(this,"_line");this.components=t,this.world=e,this._start=i.start,this._end=i.end,this._length=this.getLength(),this._line=this.createLine(i),this.newEndpointElement(i.endpointElement),this.newEndpointElement(i.endpointElement.cloneNode(!0)),this.label=this.newText(),this._root.renderOrder=2,this.world.scene.three.add(this._root)}get visible(){return this._visible}set visible(t){this._visible=t,this.label.visible=t,this._endpoints[0].visible=t,this._endpoints[1].visible=t;const[e,i]=this._endpoints,n=e.three,h=i.three,l=this.label.three;t?(this.world.scene.three.add(this._root),this._root.add(l,n,h)):(l.removeFromParent(),n.removeFromParent(),h.removeFromParent(),this._root.removeFromParent())}get endPoint(){return this._end}set endPoint(t){this._end=t;const e=this._line.geometry.attributes.position;e.setXYZ(1,t.x,t.y,t.z),e.needsUpdate=!0,this._endpoints[1].three.position.copy(t),this.updateLabel()}get startPoint(){return this._start}set startPoint(t){this._start=t;const e=this._line.geometry.attributes.position;e.setXYZ(0,t.x,t.y,t.z),e.needsUpdate=!0,this._endpoints[0].three.position.copy(t),this.updateLabel()}get _center(){let t=this._end.clone().sub(this._start);const e=t.length()*.5;return t=t.normalize().multiplyScalar(e),this._start.clone().add(t)}dispose(){const t=this.components.get(x);this.visible=!1,t.destroy(this._root),t.destroy(this._line);for(const e of this._endpoints)e.dispose();this._endpoints.length=0,this.label.dispose(),this.boundingBox&&t.destroy(this.boundingBox),this.components=null}createBoundingBox(){this.boundingBox.geometry=new b(1,1,this._length),this.boundingBox.position.copy(this._center),this.boundingBox.lookAt(this._end),this.boundingBox.visible=!1,this._root.add(this.boundingBox)}toggleLabel(){this.label.toggleVisibility()}newEndpointElement(t){const i=this._endpoints.length===0?this._start:this._end,n=new d(this.world,t);n.three.position.copy(i),this._endpoints.push(n),this._root.add(n.three)}updateLabel(){this._length=this.getLength(),this.label.three.element.textContent=this.getTextContent(),this.label.three.position.copy(this._center),this._line.computeLineDistances()}createLine(t){const e=new m;e.setFromPoints([t.start,t.end]);const i=new u(e,t.lineMaterial);return this._root.add(i),i}newText(){const t=w();t.textContent=this.getTextContent();const e=new d(this.world,t);return e.three.position.copy(this._center),this._root.add(e.three),e}getTextContent(){return`${this._length/o.scale} ${o.units}`}getLength(){return parseFloat(this._start.distanceTo(this._end).toFixed(2))}};s(o,"scale",1),s(o,"units","m");let a=o;export{a as S}; +var c=Object.defineProperty;var _=(r,t,e)=>t in r?c(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var s=(r,t,e)=>(_(r,typeof t!="symbol"?t+"":t,e),e);import{M as p,G as g,B as b,c as m,g as u}from"./web-ifc-api-BC8YMRiS.js";import{a as x}from"./index-C-JPXu_n.js";import{M as d}from"./mark-Dwn_ERVH.js";import"./import-wrapper-prod-LhqN7JJy.js";import{n as w}from"./dimension-mark-BiAWnjiH.js";const o=class o{constructor(t,e,i){s(this,"label");s(this,"boundingBox",new p);s(this,"world");s(this,"components");s(this,"_length");s(this,"_visible",!0);s(this,"_start");s(this,"_end");s(this,"_root",new g);s(this,"_endpoints",[]);s(this,"_line");this.components=t,this.world=e,this._start=i.start,this._end=i.end,this._length=this.getLength(),this._line=this.createLine(i),this.newEndpointElement(i.endpointElement),this.newEndpointElement(i.endpointElement.cloneNode(!0)),this.label=this.newText(),this._root.renderOrder=2,this.world.scene.three.add(this._root)}get visible(){return this._visible}set visible(t){this._visible=t,this.label.visible=t,this._endpoints[0].visible=t,this._endpoints[1].visible=t;const[e,i]=this._endpoints,n=e.three,h=i.three,l=this.label.three;t?(this.world.scene.three.add(this._root),this._root.add(l,n,h)):(l.removeFromParent(),n.removeFromParent(),h.removeFromParent(),this._root.removeFromParent())}get endPoint(){return this._end}set endPoint(t){this._end=t;const e=this._line.geometry.attributes.position;e.setXYZ(1,t.x,t.y,t.z),e.needsUpdate=!0,this._endpoints[1].three.position.copy(t),this.updateLabel()}get startPoint(){return this._start}set startPoint(t){this._start=t;const e=this._line.geometry.attributes.position;e.setXYZ(0,t.x,t.y,t.z),e.needsUpdate=!0,this._endpoints[0].three.position.copy(t),this.updateLabel()}get _center(){let t=this._end.clone().sub(this._start);const e=t.length()*.5;return t=t.normalize().multiplyScalar(e),this._start.clone().add(t)}dispose(){const t=this.components.get(x);this.visible=!1,t.destroy(this._root),t.destroy(this._line);for(const e of this._endpoints)e.dispose();this._endpoints.length=0,this.label.dispose(),this.boundingBox&&t.destroy(this.boundingBox),this.components=null}createBoundingBox(){this.boundingBox.geometry=new b(1,1,this._length),this.boundingBox.position.copy(this._center),this.boundingBox.lookAt(this._end),this.boundingBox.visible=!1,this._root.add(this.boundingBox)}toggleLabel(){this.label.toggleVisibility()}newEndpointElement(t){const i=this._endpoints.length===0?this._start:this._end,n=new d(this.world,t);n.three.position.copy(i),this._endpoints.push(n),this._root.add(n.three)}updateLabel(){this._length=this.getLength(),this.label.three.element.textContent=this.getTextContent(),this.label.three.position.copy(this._center),this._line.computeLineDistances()}createLine(t){const e=new m;e.setFromPoints([t.start,t.end]);const i=new u(e,t.lineMaterial);return this._root.add(i),i}newText(){const t=w();t.textContent=this.getTextContent();const e=new d(this.world,t);return e.three.position.copy(this._center),this._root.add(e.three),e}getTextContent(){return`${this._length/o.scale} ${o.units}`}getLength(){return parseFloat(this._start.distanceTo(this._end).toFixed(2))}};s(o,"scale",1),s(o,"units","m");let a=o;export{a as S}; diff --git a/examples/assets/index-DDOiyGyA.js b/examples/assets/index-CiqD_kld.js similarity index 99% rename from examples/assets/index-DDOiyGyA.js rename to examples/assets/index-CiqD_kld.js index 44c3c0cde..4b0149654 100644 --- a/examples/assets/index-DDOiyGyA.js +++ b/examples/assets/index-CiqD_kld.js @@ -1 +1 @@ -var h=Object.defineProperty;var m=(n,F,E)=>F in n?h(n,F,{enumerable:!0,configurable:!0,writable:!0,value:E}):n[F]=E;var L=(n,F,E)=>(m(n,typeof F!="symbol"?F+"":F,E),E);import{$ as b,am as v,af as x,a4 as V,ac as w,a0 as H,a1 as p,a2 as f,a3 as d,a5 as W,a6 as g,a7 as X}from"./web-ifc-api-BC8YMRiS.js";import{C as y,E as o}from"./index-BraZXcLv.js";const Y=class Y extends y{constructor(E){super(E);L(this,"onDisposed",new o);L(this,"onFragmentsLoaded",new o);L(this,"onFragmentsDisposed",new o);L(this,"list",new Map);L(this,"groups",new Map);L(this,"enabled",!0);L(this,"baseCoordinationModel","");L(this,"_loader",new b);this.components.add(Y.uuid,this)}get meshes(){const E=[];for(const[I,C]of this.list)E.push(C.mesh);return E}dispose(){for(const[E,I]of this.groups)I.dispose(!0);this.baseCoordinationModel="",this.groups.clear(),this.list.clear(),this.onFragmentsLoaded.reset(),this.onFragmentsDisposed.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}disposeGroup(E){const{uuid:I}=E,C=[];for(const T of E.items)C.push(T.id),this.list.delete(T.id);E.dispose(!0),this.groups.delete(E.uuid),this.onFragmentsDisposed.trigger({groupID:I,fragmentIDs:C})}load(E,I){const T={...{coordinate:!0},...I},{coordinate:R,properties:A,relationsMap:N}=T,O=this._loader.import(E);for(const S of O.items)S.group=O,this.list.set(S.id,S);return R&&this.coordinate([O]),this.groups.set(O.uuid,O),A&&O.setLocalProperties(A),N&&this.components.get(l).setRelationMap(O,N),this.onFragmentsLoaded.trigger(O),O}export(E){return this._loader.export(E)}coordinate(E=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const T=E.pop();if(!T)return;this.baseCoordinationModel=T.uuid}if(!E.length)return;const C=this.groups.get(this.baseCoordinationModel);if(!C){console.log("No base model found for coordination!");return}for(const T of E)T!==C&&(T.position.set(0,0,0),T.rotation.set(0,0,0),T.scale.set(1,1,1),T.updateMatrix(),T.applyMatrix4(T.coordinationMatrix.clone().invert()),T.applyMatrix4(C.coordinationMatrix))}};L(Y,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let a=Y;const K={950732822:"IFCURIREFERENCE",4075327185:"IFCTIME",1209108979:"IFCTEMPERATURERATEOFCHANGEMEASURE",3457685358:"IFCSOUNDPRESSURELEVELMEASURE",4157543285:"IFCSOUNDPOWERLEVELMEASURE",2798247006:"IFCPROPERTYSETDEFINITIONSET",1790229001:"IFCPOSITIVEINTEGER",525895558:"IFCNONNEGATIVELENGTHMEASURE",1774176899:"IFCLINEINDEX",1275358634:"IFCLANGUAGEID",2541165894:"IFCDURATION",3701338814:"IFCDAYINWEEKNUMBER",2195413836:"IFCDATETIME",937566702:"IFCDATE",1683019596:"IFCCARDINALPOINTREFERENCE",2314439260:"IFCBINARY",1500781891:"IFCAREADENSITYMEASURE",3683503648:"IFCARCINDEX",4065007721:"IFCYEARNUMBER",1718600412:"IFCWARPINGMOMENTMEASURE",51269191:"IFCWARPINGCONSTANTMEASURE",2593997549:"IFCVOLUMETRICFLOWRATEMEASURE",3458127941:"IFCVOLUMEMEASURE",3345633955:"IFCVAPORPERMEABILITYMEASURE",1278329552:"IFCTORQUEMEASURE",2591213694:"IFCTIMESTAMP",2726807636:"IFCTIMEMEASURE",743184107:"IFCTHERMODYNAMICTEMPERATUREMEASURE",2016195849:"IFCTHERMALTRANSMITTANCEMEASURE",857959152:"IFCTHERMALRESISTANCEMEASURE",2281867870:"IFCTHERMALEXPANSIONCOEFFICIENTMEASURE",2645777649:"IFCTHERMALCONDUCTIVITYMEASURE",232962298:"IFCTHERMALADMITTANCEMEASURE",296282323:"IFCTEXTTRANSFORMATION",603696268:"IFCTEXTFONTNAME",3490877962:"IFCTEXTDECORATION",1460886941:"IFCTEXTALIGNMENT",2801250643:"IFCTEXT",58845555:"IFCTEMPERATUREGRADIENTMEASURE",361837227:"IFCSPECULARROUGHNESS",2757832317:"IFCSPECULAREXPONENT",3477203348:"IFCSPECIFICHEATCAPACITYMEASURE",993287707:"IFCSOUNDPRESSUREMEASURE",846465480:"IFCSOUNDPOWERMEASURE",3471399674:"IFCSOLIDANGLEMEASURE",408310005:"IFCSHEARMODULUSMEASURE",2190458107:"IFCSECTIONALAREAINTEGRALMEASURE",3467162246:"IFCSECTIONMODULUSMEASURE",2766185779:"IFCSECONDINMINUTE",3211557302:"IFCROTATIONALSTIFFNESSMEASURE",1755127002:"IFCROTATIONALMASSMEASURE",2133746277:"IFCROTATIONALFREQUENCYMEASURE",200335297:"IFCREAL",96294661:"IFCRATIOMEASURE",3972513137:"IFCRADIOACTIVITYMEASURE",3665567075:"IFCPRESSUREMEASURE",2169031380:"IFCPRESENTABLETEXT",1364037233:"IFCPOWERMEASURE",1245737093:"IFCPOSITIVERATIOMEASURE",3054510233:"IFCPOSITIVEPLANEANGLEMEASURE",2815919920:"IFCPOSITIVELENGTHMEASURE",4042175685:"IFCPLANEANGLEMEASURE",2642773653:"IFCPLANARFORCEMEASURE",2260317790:"IFCPARAMETERVALUE",929793134:"IFCPHMEASURE",2395907400:"IFCNUMERICMEASURE",2095195183:"IFCNORMALISEDRATIOMEASURE",765770214:"IFCMONTHINYEARNUMBER",2615040989:"IFCMONETARYMEASURE",3114022597:"IFCMOMENTOFINERTIAMEASURE",1648970520:"IFCMOLECULARWEIGHTMEASURE",3177669450:"IFCMOISTUREDIFFUSIVITYMEASURE",1753493141:"IFCMODULUSOFSUBGRADEREACTIONMEASURE",1052454078:"IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE",2173214787:"IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE",3341486342:"IFCMODULUSOFELASTICITYMEASURE",102610177:"IFCMINUTEINHOUR",3531705166:"IFCMASSPERLENGTHMEASURE",3124614049:"IFCMASSMEASURE",4017473158:"IFCMASSFLOWRATEMEASURE",1477762836:"IFCMASSDENSITYMEASURE",2486716878:"IFCMAGNETICFLUXMEASURE",286949696:"IFCMAGNETICFLUXDENSITYMEASURE",151039812:"IFCLUMINOUSINTENSITYMEASURE",2755797622:"IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE",2095003142:"IFCLUMINOUSFLUXMEASURE",503418787:"IFCLOGICAL",3086160713:"IFCLINEARVELOCITYMEASURE",1307019551:"IFCLINEARSTIFFNESSMEASURE",2128979029:"IFCLINEARMOMENTMEASURE",191860431:"IFCLINEARFORCEMEASURE",1243674935:"IFCLENGTHMEASURE",3258342251:"IFCLABEL",2054016361:"IFCKINEMATICVISCOSITYMEASURE",3192672207:"IFCISOTHERMALMOISTURECAPACITYMEASURE",3686016028:"IFCIONCONCENTRATIONMEASURE",3809634241:"IFCINTEGERCOUNTRATEMEASURE",1939436016:"IFCINTEGER",2679005408:"IFCINDUCTANCEMEASURE",3358199106:"IFCILLUMINANCEMEASURE",983778844:"IFCIDENTIFIER",2589826445:"IFCHOURINDAY",1158859006:"IFCHEATINGVALUEMEASURE",3113092358:"IFCHEATFLUXDENSITYMEASURE",3064340077:"IFCGLOBALLYUNIQUEID",3044325142:"IFCFREQUENCYMEASURE",1361398929:"IFCFORCEMEASURE",2590844177:"IFCFONTWEIGHT",2715512545:"IFCFONTVARIANT",1102727119:"IFCFONTSTYLE",2078135608:"IFCENERGYMEASURE",2506197118:"IFCELECTRICVOLTAGEMEASURE",2951915441:"IFCELECTRICRESISTANCEMEASURE",3790457270:"IFCELECTRICCURRENTMEASURE",2093906313:"IFCELECTRICCONDUCTANCEMEASURE",3818826038:"IFCELECTRICCHARGEMEASURE",1827137117:"IFCELECTRICCAPACITANCEMEASURE",69416015:"IFCDYNAMICVISCOSITYMEASURE",524656162:"IFCDOSEEQUIVALENTMEASURE",4134073009:"IFCDIMENSIONCOUNT",1514641115:"IFCDESCRIPTIVEMEASURE",300323983:"IFCDAYLIGHTSAVINGHOUR",86635668:"IFCDAYINMONTHNUMBER",94842927:"IFCCURVATUREMEASURE",1778710042:"IFCCOUNTMEASURE",3238673880:"IFCCONTEXTDEPENDENTMEASURE",3812528620:"IFCCOMPOUNDPLANEANGLEMEASURE",2991860651:"IFCCOMPLEXNUMBER",1867003952:"IFCBOXALIGNMENT",2735952531:"IFCBOOLEAN",2650437152:"IFCAREAMEASURE",632304761:"IFCANGULARVELOCITYMEASURE",360377573:"IFCAMOUNTOFSUBSTANCEMEASURE",4182062534:"IFCACCELERATIONMEASURE",3699917729:"IFCABSORBEDDOSEMEASURE",1971632696:"IFCGEOSLICE",2680139844:"IFCGEOMODEL",24726584:"IFCELECTRICFLOWTREATMENTDEVICE",3693000487:"IFCDISTRIBUTIONBOARD",3460952963:"IFCCONVEYORSEGMENT",3999819293:"IFCCAISSONFOUNDATION",3314249567:"IFCBOREHOLE",4196446775:"IFCBEARING",325726236:"IFCALIGNMENT",3425753595:"IFCTRACKELEMENT",991950508:"IFCSIGNAL",3798194928:"IFCREINFORCEDSOIL",3290496277:"IFCRAIL",1383356374:"IFCPAVEMENT",2182337498:"IFCNAVIGATIONELEMENT",234836483:"IFCMOORINGDEVICE",2078563270:"IFCMOBILETELECOMMUNICATIONSAPPLIANCE",1638804497:"IFCLIQUIDTERMINAL",1154579445:"IFCLINEARPOSITIONINGELEMENT",2696325953:"IFCKERB",2713699986:"IFCGEOTECHNICALASSEMBLY",2142170206:"IFCELECTRICFLOWTREATMENTDEVICETYPE",3376911765:"IFCEARTHWORKSFILL",1077100507:"IFCEARTHWORKSELEMENT",3071239417:"IFCEARTHWORKSCUT",479945903:"IFCDISTRIBUTIONBOARDTYPE",3426335179:"IFCDEEPFOUNDATION",1502416096:"IFCCOURSE",2940368186:"IFCCONVEYORSEGMENTTYPE",3203706013:"IFCCAISSONFOUNDATIONTYPE",3862327254:"IFCBUILTSYSTEM",1876633798:"IFCBUILTELEMENT",963979645:"IFCBRIDGEPART",644574406:"IFCBRIDGE",3649138523:"IFCBEARINGTYPE",1662888072:"IFCALIGNMENTVERTICAL",317615605:"IFCALIGNMENTSEGMENT",1545765605:"IFCALIGNMENTHORIZONTAL",4266260250:"IFCALIGNMENTCANT",3956297820:"IFCVIBRATIONDAMPERTYPE",1530820697:"IFCVIBRATIONDAMPER",840318589:"IFCVEHICLE",1953115116:"IFCTRANSPORTATIONDEVICE",618700268:"IFCTRACKELEMENTTYPE",2281632017:"IFCTENDONCONDUITTYPE",3663046924:"IFCTENDONCONDUIT",42703149:"IFCSINESPIRAL",1894708472:"IFCSIGNALTYPE",3599934289:"IFCSIGNTYPE",33720170:"IFCSIGN",1027922057:"IFCSEVENTHORDERPOLYNOMIALSPIRAL",544395925:"IFCSEGMENTEDREFERENCECURVE",3649235739:"IFCSECONDORDERPOLYNOMIALSPIRAL",550521510:"IFCROADPART",146592293:"IFCROAD",3818125796:"IFCRELADHERESTOELEMENT",4021432810:"IFCREFERENT",1891881377:"IFCRAILWAYPART",3992365140:"IFCRAILWAY",1763565496:"IFCRAILTYPE",1946335990:"IFCPOSITIONINGELEMENT",514975943:"IFCPAVEMENTTYPE",506776471:"IFCNAVIGATIONELEMENTTYPE",710110818:"IFCMOORINGDEVICETYPE",1950438474:"IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE",976884017:"IFCMARINEPART",525669439:"IFCMARINEFACILITY",1770583370:"IFCLIQUIDTERMINALTYPE",2176059722:"IFCLINEARELEMENT",679976338:"IFCKERBTYPE",3948183225:"IFCIMPACTPROTECTIONDEVICETYPE",2568555532:"IFCIMPACTPROTECTIONDEVICE",2898700619:"IFCGRADIENTCURVE",1594536857:"IFCGEOTECHNICALSTRATUM",4230923436:"IFCGEOTECHNICALELEMENT",4228831410:"IFCFACILITYPARTCOMMON",1310830890:"IFCFACILITYPART",24185140:"IFCFACILITY",4234616927:"IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID",1306400036:"IFCDEEPFOUNDATIONTYPE",4189326743:"IFCCOURSETYPE",2000195564:"IFCCOSINESPIRAL",3497074424:"IFCCLOTHOID",1626504194:"IFCBUILTELEMENTTYPE",3651464721:"IFCVEHICLETYPE",1229763772:"IFCTRIANGULATEDIRREGULARNETWORK",3665877780:"IFCTRANSPORTATIONDEVICETYPE",782932809:"IFCTHIRDORDERPOLYNOMIALSPIRAL",2735484536:"IFCSPIRAL",1356537516:"IFCSECTIONEDSURFACE",1290935644:"IFCSECTIONEDSOLIDHORIZONTAL",1862484736:"IFCSECTIONEDSOLID",1441486842:"IFCRELPOSITIONS",1033248425:"IFCRELASSOCIATESPROFILEDEF",3381221214:"IFCPOLYNOMIALCURVE",2485787929:"IFCOFFSETCURVEBYDISTANCES",590820931:"IFCOFFSETCURVE",3465909080:"IFCINDEXEDPOLYGONALTEXTUREMAP",593015953:"IFCDIRECTRIXCURVESWEPTAREASOLID",4212018352:"IFCCURVESEGMENT",3425423356:"IFCAXIS2PLACEMENTLINEAR",823603102:"IFCSEGMENT",2165702409:"IFCPOINTBYDISTANCEEXPRESSION",182550632:"IFCOPENCROSSPROFILEDEF",388784114:"IFCLINEARPLACEMENT",536804194:"IFCALIGNMENTHORIZONTALSEGMENT",3752311538:"IFCALIGNMENTCANTSEGMENT",1010789467:"IFCTEXTURECOORDINATEINDICESWITHVOIDS",222769930:"IFCTEXTURECOORDINATEINDICES",2691318326:"IFCQUANTITYNUMBER",3633395639:"IFCALIGNMENTVERTICALSEGMENT",2879124712:"IFCALIGNMENTPARAMETERSEGMENT",25142252:"IFCCONTROLLER",3087945054:"IFCALARM",4288193352:"IFCACTUATOR",630975310:"IFCUNITARYCONTROLELEMENT",4086658281:"IFCSENSOR",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",182646315:"IFCFLOWINSTRUMENT",1426591983:"IFCFIRESUPPRESSIONTERMINAL",819412036:"IFCFILTER",3415622556:"IFCFAN",1003880860:"IFCELECTRICTIMECONTROL",402227799:"IFCELECTRICMOTOR",264262732:"IFCELECTRICGENERATOR",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",862014818:"IFCELECTRICDISTRIBUTIONBOARD",1904799276:"IFCELECTRICAPPLIANCE",1360408905:"IFCDUCTSILENCER",3518393246:"IFCDUCTSEGMENT",342316401:"IFCDUCTFITTING",562808652:"IFCDISTRIBUTIONCIRCUIT",4074379575:"IFCDAMPER",3640358203:"IFCCOOLINGTOWER",4136498852:"IFCCOOLEDBEAM",2272882330:"IFCCONDENSER",3571504051:"IFCCOMPRESSOR",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",639361253:"IFCCOIL",3902619387:"IFCCHILLER",4217484030:"IFCCABLESEGMENT",1051757585:"IFCCABLEFITTING",3758799889:"IFCCABLECARRIERSEGMENT",635142910:"IFCCABLECARRIERFITTING",2938176219:"IFCBURNER",32344328:"IFCBOILER",2906023776:"IFCBEAMSTANDARDCASE",277319702:"IFCAUDIOVISUALAPPLIANCE",2056796094:"IFCAIRTOAIRHEATRECOVERY",177149247:"IFCAIRTERMINALBOX",1634111441:"IFCAIRTERMINAL",486154966:"IFCWINDOWSTANDARDCASE",4237592921:"IFCWASTETERMINAL",4156078855:"IFCWALLELEMENTEDCASE",4207607924:"IFCVALVE",4292641817:"IFCUNITARYEQUIPMENT",3179687236:"IFCUNITARYCONTROLELEMENTTYPE",3026737570:"IFCTUBEBUNDLE",3825984169:"IFCTRANSFORMER",812556717:"IFCTANK",1162798199:"IFCSWITCHINGDEVICE",385403989:"IFCSTRUCTURALLOADCASE",1404847402:"IFCSTACKTERMINAL",1999602285:"IFCSPACEHEATER",3420628829:"IFCSOLARDEVICE",3027962421:"IFCSLABSTANDARDCASE",3127900445:"IFCSLABELEMENTEDCASE",1329646415:"IFCSHADINGDEVICE",3053780830:"IFCSANITARYTERMINAL",2572171363:"IFCREINFORCINGBARTYPE",1232101972:"IFCRATIONALBSPLINECURVEWITHKNOTS",90941305:"IFCPUMP",655969474:"IFCPROTECTIVEDEVICETRIPPINGUNITTYPE",738039164:"IFCPROTECTIVEDEVICE",1156407060:"IFCPLATESTANDARDCASE",3612865200:"IFCPIPESEGMENT",310824031:"IFCPIPEFITTING",3694346114:"IFCOUTLET",144952367:"IFCOUTERBOUNDARYCURVE",2474470126:"IFCMOTORCONNECTION",1911478936:"IFCMEMBERSTANDARDCASE",1437502449:"IFCMEDICALDEVICE",629592764:"IFCLIGHTFIXTURE",76236018:"IFCLAMP",2176052936:"IFCJUNCTIONBOX",4175244083:"IFCINTERCEPTOR",2068733104:"IFCHUMIDIFIER",3319311131:"IFCHEATEXCHANGER",2188021234:"IFCFLOWMETER",1209101575:"IFCEXTERNALSPATIALELEMENT",484807127:"IFCEVAPORATOR",3747195512:"IFCEVAPORATIVECOOLER",2814081492:"IFCENGINE",2417008758:"IFCELECTRICDISTRIBUTIONBOARDTYPE",3242481149:"IFCDOORSTANDARDCASE",3205830791:"IFCDISTRIBUTIONSYSTEM",400855858:"IFCCOMMUNICATIONSAPPLIANCETYPE",905975707:"IFCCOLUMNSTANDARDCASE",1677625105:"IFCCIVILELEMENT",3296154744:"IFCCHIMNEY",2674252688:"IFCCABLEFITTINGTYPE",2188180465:"IFCBURNERTYPE",1177604601:"IFCBUILDINGSYSTEM",39481116:"IFCBUILDINGELEMENTPARTTYPE",1136057603:"IFCBOUNDARYCURVE",2461110595:"IFCBSPLINECURVEWITHKNOTS",1532957894:"IFCAUDIOVISUALAPPLIANCETYPE",4088093105:"IFCWORKCALENDAR",4009809668:"IFCWINDOWTYPE",926996030:"IFCVOIDINGFEATURE",2391383451:"IFCVIBRATIONISOLATOR",2415094496:"IFCTENDONTYPE",3081323446:"IFCTENDONANCHORTYPE",413509423:"IFCSYSTEMFURNITUREELEMENT",3101698114:"IFCSURFACEFEATURE",3657597509:"IFCSTRUCTURALSURFACEACTION",2757150158:"IFCSTRUCTURALCURVEREACTION",1004757350:"IFCSTRUCTURALCURVEACTION",338393293:"IFCSTAIRTYPE",1072016465:"IFCSOLARDEVICETYPE",4074543187:"IFCSHADINGDEVICETYPE",2157484638:"IFCSEAMCURVE",2781568857:"IFCROOFTYPE",2310774935:"IFCREINFORCINGMESHTYPE",964333572:"IFCREINFORCINGELEMENTTYPE",683857671:"IFCRATIONALBSPLINESURFACEWITHKNOTS",1469900589:"IFCRAMPTYPE",2839578677:"IFCPOLYGONALFACESET",1158309216:"IFCPILETYPE",3079942009:"IFCOPENINGSTANDARDCASE",1114901282:"IFCMEDICALDEVICETYPE",3113134337:"IFCINTERSECTIONCURVE",3946677679:"IFCINTERCEPTORTYPE",2571569899:"IFCINDEXEDPOLYCURVE",3493046030:"IFCGEOGRAPHICELEMENT",1509553395:"IFCFURNITURE",1893162501:"IFCFOOTINGTYPE",2853485674:"IFCEXTERNALSPATIALSTRUCTUREELEMENT",4148101412:"IFCEVENT",132023988:"IFCENGINETYPE",2397081782:"IFCELEMENTASSEMBLYTYPE",2323601079:"IFCDOORTYPE",1213902940:"IFCCYLINDRICALSURFACE",1525564444:"IFCCONSTRUCTIONPRODUCTRESOURCETYPE",4105962743:"IFCCONSTRUCTIONMATERIALRESOURCETYPE",2185764099:"IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE",15328376:"IFCCOMPOSITECURVEONSURFACE",3875453745:"IFCCOMPLEXPROPERTYTEMPLATE",3893394355:"IFCCIVILELEMENTTYPE",2197970202:"IFCCHIMNEYTYPE",167062518:"IFCBSPLINESURFACEWITHKNOTS",2887950389:"IFCBSPLINESURFACE",2603310189:"IFCADVANCEDBREPWITHVOIDS",1635779807:"IFCADVANCEDBREP",2916149573:"IFCTRIANGULATEDFACESET",1935646853:"IFCTOROIDALSURFACE",2387106220:"IFCTESSELLATEDFACESET",3206491090:"IFCTASKTYPE",699246055:"IFCSURFACECURVE",4095615324:"IFCSUBCONTRACTRESOURCETYPE",603775116:"IFCSTRUCTURALSURFACEREACTION",4015995234:"IFCSPHERICALSURFACE",2481509218:"IFCSPATIALZONETYPE",463610769:"IFCSPATIALZONE",710998568:"IFCSPATIALELEMENTTYPE",1412071761:"IFCSPATIALELEMENT",3663146110:"IFCSIMPLEPROPERTYTEMPLATE",3243963512:"IFCREVOLVEDAREASOLIDTAPERED",816062949:"IFCREPARAMETRISEDCOMPOSITECURVESEGMENT",1521410863:"IFCRELSPACEBOUNDARY2NDLEVEL",3523091289:"IFCRELSPACEBOUNDARY1STLEVEL",427948657:"IFCRELINTERFERESELEMENTS",307848117:"IFCRELDEFINESBYTEMPLATE",1462361463:"IFCRELDEFINESBYOBJECT",2565941209:"IFCRELDECLARES",1027710054:"IFCRELASSIGNSTOGROUPBYFACTOR",3521284610:"IFCPROPERTYTEMPLATE",492091185:"IFCPROPERTYSETTEMPLATE",653396225:"IFCPROJECTLIBRARY",569719735:"IFCPROCEDURETYPE",3967405729:"IFCPREDEFINEDPROPERTYSET",1682466193:"IFCPCURVE",428585644:"IFCLABORRESOURCETYPE",2294589976:"IFCINDEXEDPOLYGONALFACEWITHVOIDS",178912537:"IFCINDEXEDPOLYGONALFACE",4095422895:"IFCGEOGRAPHICELEMENTTYPE",2652556860:"IFCFIXEDREFERENCESWEPTAREASOLID",2804161546:"IFCEXTRUDEDAREASOLIDTAPERED",4024345920:"IFCEVENTTYPE",2629017746:"IFCCURVEBOUNDEDSURFACE",1815067380:"IFCCREWRESOURCETYPE",3419103109:"IFCCONTEXT",2574617495:"IFCCONSTRUCTIONRESOURCETYPE",2059837836:"IFCCARTESIANPOINTLIST3D",1675464909:"IFCCARTESIANPOINTLIST2D",574549367:"IFCCARTESIANPOINTLIST",3406155212:"IFCADVANCEDFACE",3698973494:"IFCTYPERESOURCE",3736923433:"IFCTYPEPROCESS",901063453:"IFCTESSELLATEDITEM",1096409881:"IFCSWEPTDISKSOLIDPOLYGONAL",1042787934:"IFCRESOURCETIME",1608871552:"IFCRESOURCECONSTRAINTRELATIONSHIP",2943643501:"IFCRESOURCEAPPROVALRELATIONSHIP",2090586900:"IFCQUANTITYSET",1482703590:"IFCPROPERTYTEMPLATEDEFINITION",3778827333:"IFCPREDEFINEDPROPERTIES",2998442950:"IFCMIRROREDPROFILEDEF",853536259:"IFCMATERIALRELATIONSHIP",3404854881:"IFCMATERIALPROFILESETUSAGETAPERING",3079605661:"IFCMATERIALPROFILESETUSAGE",2852063980:"IFCMATERIALCONSTITUENTSET",3708119e3:"IFCMATERIALCONSTITUENT",1585845231:"IFCLAGTIME",2133299955:"IFCINDEXEDTRIANGLETEXTUREMAP",1437953363:"IFCINDEXEDTEXTUREMAP",3570813810:"IFCINDEXEDCOLOURMAP",1437805879:"IFCEXTERNALREFERENCERELATIONSHIP",297599258:"IFCEXTENDEDPROPERTIES",211053100:"IFCEVENTTIME",2713554722:"IFCCONVERSIONBASEDUNITWITHOFFSET",3285139300:"IFCCOLOURRGBLIST",1236880293:"IFCWORKTIME",1199560280:"IFCTIMEPERIOD",3611470254:"IFCTEXTUREVERTEXLIST",2771591690:"IFCTASKTIMERECURRING",1549132990:"IFCTASKTIME",2043862942:"IFCTABLECOLUMN",2934153892:"IFCSURFACEREINFORCEMENTAREA",609421318:"IFCSTRUCTURALLOADORRESULT",3478079324:"IFCSTRUCTURALLOADCONFIGURATION",1054537805:"IFCSCHEDULINGTIME",2439245199:"IFCRESOURCELEVELRELATIONSHIP",2433181523:"IFCREFERENCE",3915482550:"IFCRECURRENCEPATTERN",986844984:"IFCPROPERTYABSTRACTION",3843373140:"IFCPROJECTEDCRS",677532197:"IFCPRESENTATIONITEM",1507914824:"IFCMATERIALUSAGEDEFINITION",552965576:"IFCMATERIALPROFILEWITHOFFSETS",164193824:"IFCMATERIALPROFILESET",2235152071:"IFCMATERIALPROFILE",1847252529:"IFCMATERIALLAYERWITHOFFSETS",760658860:"IFCMATERIALDEFINITION",3057273783:"IFCMAPCONVERSION",4294318154:"IFCEXTERNALINFORMATION",1466758467:"IFCCOORDINATEREFERENCESYSTEM",1785450214:"IFCCOORDINATEOPERATION",775493141:"IFCCONNECTIONVOLUMEGEOMETRY",979691226:"IFCREINFORCINGBAR",3700593921:"IFCELECTRICDISTRIBUTIONPOINT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",578613899:"IFCCONTROLLERTYPE",2454782716:"IFCCHAMFEREDGEFEATURE",753842376:"IFCBEAM",3001207471:"IFCALARMTYPE",2874132201:"IFCACTUATORTYPE",3304561284:"IFCWINDOW",3512223829:"IFCWALLSTANDARDCASE",2391406946:"IFCWALL",3313531582:"IFCVIBRATIONISOLATORTYPE",2347447852:"IFCTENDONANCHOR",3824725483:"IFCTENDON",2515109513:"IFCSTRUCTURALANALYSISMODEL",4252922144:"IFCSTAIRFLIGHT",331165859:"IFCSTAIR",1529196076:"IFCSLAB",1783015770:"IFCSENSORTYPE",1376911519:"IFCROUNDEDEDGEFEATURE",2016517767:"IFCROOF",2320036040:"IFCREINFORCINGMESH",3027567501:"IFCREINFORCINGELEMENT",3055160366:"IFCRATIONALBEZIERCURVE",3283111854:"IFCRAMPFLIGHT",3024970846:"IFCRAMP",2262370178:"IFCRAILING",3171933400:"IFCPLATE",1687234759:"IFCPILE",1073191201:"IFCMEMBER",900683007:"IFCFOOTING",3508470533:"IFCFLOWTREATMENTDEVICE",2223149337:"IFCFLOWTERMINAL",707683696:"IFCFLOWSTORAGEDEVICE",987401354:"IFCFLOWSEGMENT",3132237377:"IFCFLOWMOVINGDEVICE",4037862832:"IFCFLOWINSTRUMENTTYPE",4278956645:"IFCFLOWFITTING",2058353004:"IFCFLOWCONTROLLER",4222183408:"IFCFIRESUPPRESSIONTERMINALTYPE",1810631287:"IFCFILTERTYPE",346874300:"IFCFANTYPE",1658829314:"IFCENERGYCONVERSIONDEVICE",857184966:"IFCELECTRICALELEMENT",1634875225:"IFCELECTRICALCIRCUIT",712377611:"IFCELECTRICTIMECONTROLTYPE",1217240411:"IFCELECTRICMOTORTYPE",1365060375:"IFCELECTRICHEATERTYPE",1534661035:"IFCELECTRICGENERATORTYPE",3277789161:"IFCELECTRICFLOWSTORAGEDEVICETYPE",663422040:"IFCELECTRICAPPLIANCETYPE",855621170:"IFCEDGEFEATURE",2030761528:"IFCDUCTSILENCERTYPE",3760055223:"IFCDUCTSEGMENTTYPE",869906466:"IFCDUCTFITTINGTYPE",395920057:"IFCDOOR",3041715199:"IFCDISTRIBUTIONPORT",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",1945004755:"IFCDISTRIBUTIONELEMENT",2063403501:"IFCDISTRIBUTIONCONTROLELEMENTTYPE",1599208980:"IFCDISTRIBUTIONCHAMBERELEMENTTYPE",2635815018:"IFCDISCRETEACCESSORYTYPE",1335981549:"IFCDISCRETEACCESSORY",4147604152:"IFCDIAMETERDIMENSION",3961806047:"IFCDAMPERTYPE",3495092785:"IFCCURTAINWALL",1973544240:"IFCCOVERING",2954562838:"IFCCOOLINGTOWERTYPE",335055490:"IFCCOOLEDBEAMTYPE",488727124:"IFCCONSTRUCTIONPRODUCTRESOURCE",1060000209:"IFCCONSTRUCTIONMATERIALRESOURCE",3898045240:"IFCCONSTRUCTIONEQUIPMENTRESOURCE",1163958913:"IFCCONDITIONCRITERION",2188551683:"IFCCONDITION",2816379211:"IFCCONDENSERTYPE",3850581409:"IFCCOMPRESSORTYPE",843113511:"IFCCOLUMN",2301859152:"IFCCOILTYPE",2611217952:"IFCCIRCLE",2951183804:"IFCCHILLERTYPE",1285652485:"IFCCABLESEGMENTTYPE",3293546465:"IFCCABLECARRIERSEGMENTTYPE",395041908:"IFCCABLECARRIERFITTINGTYPE",1909888760:"IFCBUILDINGELEMENTPROXYTYPE",1095909175:"IFCBUILDINGELEMENTPROXY",2979338954:"IFCBUILDINGELEMENTPART",52481810:"IFCBUILDINGELEMENTCOMPONENT",3299480353:"IFCBUILDINGELEMENT",231477066:"IFCBOILERTYPE",1916977116:"IFCBEZIERCURVE",819618141:"IFCBEAMTYPE",1967976161:"IFCBSPLINECURVE",3460190687:"IFCASSET",2470393545:"IFCANGULARDIMENSION",1871374353:"IFCAIRTOAIRHEATRECOVERYTYPE",3352864051:"IFCAIRTERMINALTYPE",1411407467:"IFCAIRTERMINALBOXTYPE",3821786052:"IFCACTIONREQUEST",1213861670:"IFC2DCOMPOSITECURVE",1033361043:"IFCZONE",3342526732:"IFCWORKSCHEDULE",4218914973:"IFCWORKPLAN",1028945134:"IFCWORKCONTROL",1133259667:"IFCWASTETERMINALTYPE",1898987631:"IFCWALLTYPE",2769231204:"IFCVIRTUALELEMENT",728799441:"IFCVALVETYPE",1911125066:"IFCUNITARYEQUIPMENTTYPE",1600972822:"IFCTUBEBUNDLETYPE",3593883385:"IFCTRIMMEDCURVE",1620046519:"IFCTRANSPORTELEMENT",1692211062:"IFCTRANSFORMERTYPE",1637806684:"IFCTIMESERIESSCHEDULE",5716631:"IFCTANKTYPE",2254336722:"IFCSYSTEM",2315554128:"IFCSWITCHINGDEVICETYPE",148013059:"IFCSUBCONTRACTRESOURCE",1975003073:"IFCSTRUCTURALSURFACECONNECTION",2986769608:"IFCSTRUCTURALRESULTGROUP",1235345126:"IFCSTRUCTURALPOINTREACTION",734778138:"IFCSTRUCTURALPOINTCONNECTION",2082059205:"IFCSTRUCTURALPOINTACTION",3987759626:"IFCSTRUCTURALPLANARACTIONVARYING",1621171031:"IFCSTRUCTURALPLANARACTION",1252848954:"IFCSTRUCTURALLOADGROUP",1721250024:"IFCSTRUCTURALLINEARACTIONVARYING",1807405624:"IFCSTRUCTURALLINEARACTION",2445595289:"IFCSTRUCTURALCURVEMEMBERVARYING",214636428:"IFCSTRUCTURALCURVEMEMBER",4243806635:"IFCSTRUCTURALCURVECONNECTION",1179482911:"IFCSTRUCTURALCONNECTION",682877961:"IFCSTRUCTURALACTION",1039846685:"IFCSTAIRFLIGHTTYPE",3112655638:"IFCSTACKTERMINALTYPE",3812236995:"IFCSPACETYPE",652456506:"IFCSPACEPROGRAM",1305183839:"IFCSPACEHEATERTYPE",3856911033:"IFCSPACE",2533589738:"IFCSLABTYPE",4097777520:"IFCSITE",4105383287:"IFCSERVICELIFE",3517283431:"IFCSCHEDULETIMECONTROL",1768891740:"IFCSANITARYTERMINALTYPE",2863920197:"IFCRELASSIGNSTASKS",160246688:"IFCRELAGGREGATES",2324767716:"IFCRAMPFLIGHTTYPE",2893384427:"IFCRAILINGTYPE",3248260540:"IFCRADIUSDIMENSION",2250791053:"IFCPUMPTYPE",1842657554:"IFCPROTECTIVEDEVICETYPE",3651124850:"IFCPROJECTIONELEMENT",3642467123:"IFCPROJECTORDERRECORD",2904328755:"IFCPROJECTORDER",2744685151:"IFCPROCEDURE",3740093272:"IFCPORT",3724593414:"IFCPOLYLINE",4017108033:"IFCPLATETYPE",4231323485:"IFCPIPESEGMENTTYPE",804291784:"IFCPIPEFITTINGTYPE",3327091369:"IFCPERMIT",2382730787:"IFCPERFORMANCEHISTORY",2837617999:"IFCOUTLETTYPE",3425660407:"IFCORDERACTION",3588315303:"IFCOPENINGELEMENT",4143007308:"IFCOCCUPANT",1916936684:"IFCMOVE",977012517:"IFCMOTORCONNECTIONTYPE",3181161470:"IFCMEMBERTYPE",2108223431:"IFCMECHANICALFASTENERTYPE",377706215:"IFCMECHANICALFASTENER",2506943328:"IFCLINEARDIMENSION",1161773419:"IFCLIGHTFIXTURETYPE",1051575348:"IFCLAMPTYPE",3827777499:"IFCLABORRESOURCE",4288270099:"IFCJUNCTIONBOXTYPE",2391368822:"IFCINVENTORY",1806887404:"IFCHUMIDIFIERTYPE",1251058090:"IFCHEATEXCHANGERTYPE",2706460486:"IFCGROUP",3009204131:"IFCGRID",200128114:"IFCGASTERMINALTYPE",814719939:"IFCFURNITURESTANDARD",263784265:"IFCFURNISHINGELEMENT",3009222698:"IFCFLOWTREATMENTDEVICETYPE",2297155007:"IFCFLOWTERMINALTYPE",1339347760:"IFCFLOWSTORAGEDEVICETYPE",1834744321:"IFCFLOWSEGMENTTYPE",1482959167:"IFCFLOWMOVINGDEVICETYPE",3815607619:"IFCFLOWMETERTYPE",3198132628:"IFCFLOWFITTINGTYPE",3907093117:"IFCFLOWCONTROLLERTYPE",1287392070:"IFCFEATUREELEMENTSUBTRACTION",2143335405:"IFCFEATUREELEMENTADDITION",2827207264:"IFCFEATUREELEMENT",2489546625:"IFCFASTENERTYPE",647756555:"IFCFASTENER",3737207727:"IFCFACETEDBREPWITHVOIDS",807026263:"IFCFACETEDBREP",3390157468:"IFCEVAPORATORTYPE",3174744832:"IFCEVAPORATIVECOOLERTYPE",3272907226:"IFCEQUIPMENTSTANDARD",1962604670:"IFCEQUIPMENTELEMENT",2107101300:"IFCENERGYCONVERSIONDEVICETYPE",1704287377:"IFCELLIPSE",2590856083:"IFCELEMENTCOMPONENTTYPE",1623761950:"IFCELEMENTCOMPONENT",4123344466:"IFCELEMENTASSEMBLY",1758889154:"IFCELEMENT",360485395:"IFCELECTRICALBASEPROPERTIES",3849074793:"IFCDISTRIBUTIONFLOWELEMENTTYPE",3256556792:"IFCDISTRIBUTIONELEMENTTYPE",681481545:"IFCDIMENSIONCURVEDIRECTEDCALLOUT",1457835157:"IFCCURTAINWALLTYPE",3295246426:"IFCCREWRESOURCE",1916426348:"IFCCOVERINGTYPE",1419761937:"IFCCOSTSCHEDULE",3895139033:"IFCCOSTITEM",3293443760:"IFCCONTROL",2559216714:"IFCCONSTRUCTIONRESOURCE",2510884976:"IFCCONIC",3732776249:"IFCCOMPOSITECURVE",300633059:"IFCCOLUMNTYPE",2937912522:"IFCCIRCLEHOLLOWPROFILEDEF",3124254112:"IFCBUILDINGSTOREY",1950629157:"IFCBUILDINGELEMENTTYPE",4031249490:"IFCBUILDING",1260505505:"IFCBOUNDEDCURVE",3649129432:"IFCBOOLEANCLIPPINGRESULT",1334484129:"IFCBLOCK",3207858831:"IFCASYMMETRICISHAPEPROFILEDEF",1674181508:"IFCANNOTATION",2296667514:"IFCACTOR",2097647324:"IFCTRANSPORTELEMENTTYPE",3473067441:"IFCTASK",1580310250:"IFCSYSTEMFURNITUREELEMENTTYPE",4124788165:"IFCSURFACEOFREVOLUTION",2809605785:"IFCSURFACEOFLINEAREXTRUSION",2028607225:"IFCSURFACECURVESWEPTAREASOLID",4070609034:"IFCSTRUCTUREDDIMENSIONCALLOUT",2218152070:"IFCSTRUCTURALSURFACEMEMBERVARYING",3979015343:"IFCSTRUCTURALSURFACEMEMBER",3689010777:"IFCSTRUCTURALREACTION",530289379:"IFCSTRUCTURALMEMBER",3136571912:"IFCSTRUCTURALITEM",3544373492:"IFCSTRUCTURALACTIVITY",451544542:"IFCSPHERE",3893378262:"IFCSPATIALSTRUCTUREELEMENTTYPE",2706606064:"IFCSPATIALSTRUCTUREELEMENT",3626867408:"IFCRIGHTCIRCULARCYLINDER",4158566097:"IFCRIGHTCIRCULARCONE",1856042241:"IFCREVOLVEDAREASOLID",2914609552:"IFCRESOURCE",1401173127:"IFCRELVOIDSELEMENT",3451746338:"IFCRELSPACEBOUNDARY",366585022:"IFCRELSERVICESBUILDINGS",4122056220:"IFCRELSEQUENCE",1058617721:"IFCRELSCHEDULESCOSTITEMS",1245217292:"IFCRELREFERENCEDINSPATIALSTRUCTURE",750771296:"IFCRELPROJECTSELEMENT",202636808:"IFCRELOVERRIDESPROPERTIES",2051452291:"IFCRELOCCUPIESSPACES",3268803585:"IFCRELNESTS",4189434867:"IFCRELINTERACTIONREQUIREMENTS",279856033:"IFCRELFLOWCONTROLELEMENTS",3940055652:"IFCRELFILLSELEMENT",781010003:"IFCRELDEFINESBYTYPE",4186316022:"IFCRELDEFINESBYPROPERTIES",693640335:"IFCRELDEFINES",2551354335:"IFCRELDECOMPOSES",2802773753:"IFCRELCOVERSSPACES",886880790:"IFCRELCOVERSBLDGELEMENTS",3242617779:"IFCRELCONTAINEDINSPATIALSTRUCTURE",3678494232:"IFCRELCONNECTSWITHREALIZINGELEMENTS",504942748:"IFCRELCONNECTSWITHECCENTRICITY",1638771189:"IFCRELCONNECTSSTRUCTURALMEMBER",3912681535:"IFCRELCONNECTSSTRUCTURALELEMENT",2127690289:"IFCRELCONNECTSSTRUCTURALACTIVITY",3190031847:"IFCRELCONNECTSPORTS",4201705270:"IFCRELCONNECTSPORTTOELEMENT",3945020480:"IFCRELCONNECTSPATHELEMENTS",1204542856:"IFCRELCONNECTSELEMENTS",826625072:"IFCRELCONNECTS",2851387026:"IFCRELASSOCIATESPROFILEPROPERTIES",2655215786:"IFCRELASSOCIATESMATERIAL",3840914261:"IFCRELASSOCIATESLIBRARY",982818633:"IFCRELASSOCIATESDOCUMENT",2728634034:"IFCRELASSOCIATESCONSTRAINT",919958153:"IFCRELASSOCIATESCLASSIFICATION",4095574036:"IFCRELASSOCIATESAPPROVAL",1327628568:"IFCRELASSOCIATESAPPLIEDVALUE",1865459582:"IFCRELASSOCIATES",205026976:"IFCRELASSIGNSTORESOURCE",3372526763:"IFCRELASSIGNSTOPROJECTORDER",2857406711:"IFCRELASSIGNSTOPRODUCT",4278684876:"IFCRELASSIGNSTOPROCESS",1307041759:"IFCRELASSIGNSTOGROUP",2495723537:"IFCRELASSIGNSTOCONTROL",1683148259:"IFCRELASSIGNSTOACTOR",3939117080:"IFCRELASSIGNS",3454111270:"IFCRECTANGULARTRIMMEDSURFACE",2798486643:"IFCRECTANGULARPYRAMID",2770003689:"IFCRECTANGLEHOLLOWPROFILEDEF",3219374653:"IFCPROXY",1451395588:"IFCPROPERTYSET",4194566429:"IFCPROJECTIONCURVE",103090709:"IFCPROJECT",4208778838:"IFCPRODUCT",2945172077:"IFCPROCESS",220341763:"IFCPLANE",603570806:"IFCPLANARBOX",3566463478:"IFCPERMEABLECOVERINGPROPERTIES",3505215534:"IFCOFFSETCURVE3D",3388369263:"IFCOFFSETCURVE2D",3888040117:"IFCOBJECT",1425443689:"IFCMANIFOLDSOLIDBREP",1281925730:"IFCLINE",572779678:"IFCLSHAPEPROFILEDEF",1484403080:"IFCISHAPEPROFILEDEF",987898635:"IFCGEOMETRICCURVESET",1268542332:"IFCFURNITURETYPE",4238390223:"IFCFURNISHINGELEMENTTYPE",3455213021:"IFCFLUIDFLOWPROPERTIES",315944413:"IFCFILLAREASTYLETILES",4203026998:"IFCFILLAREASTYLETILESYMBOLWITHSTYLE",374418227:"IFCFILLAREASTYLEHATCHING",2047409740:"IFCFACEBASEDSURFACEMODEL",477187591:"IFCEXTRUDEDAREASOLID",80994333:"IFCENERGYPROPERTIES",2835456948:"IFCELLIPSEPROFILEDEF",2777663545:"IFCELEMENTARYSURFACE",339256511:"IFCELEMENTTYPE",1883228015:"IFCELEMENTQUANTITY",1472233963:"IFCEDGELOOP",4006246654:"IFCDRAUGHTINGPREDEFINEDCURVEFONT",445594917:"IFCDRAUGHTINGPREDEFINEDCOLOUR",3073041342:"IFCDRAUGHTINGCALLOUT",526551008:"IFCDOORSTYLE",1714330368:"IFCDOORPANELPROPERTIES",2963535650:"IFCDOORLININGPROPERTIES",32440307:"IFCDIRECTION",4054601972:"IFCDIMENSIONCURVETERMINATOR",606661476:"IFCDIMENSIONCURVE",693772133:"IFCDEFINEDSYMBOL",2827736869:"IFCCURVEBOUNDEDPLANE",2601014836:"IFCCURVE",2147822146:"IFCCSGSOLID",2506170314:"IFCCSGPRIMITIVE3D",194851669:"IFCCRANERAILFSHAPEPROFILEDEF",4133800736:"IFCCRANERAILASHAPEPROFILEDEF",2485617015:"IFCCOMPOSITECURVESEGMENT",2205249479:"IFCCLOSEDSHELL",1383045692:"IFCCIRCLEPROFILEDEF",1416205885:"IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM",3331915920:"IFCCARTESIANTRANSFORMATIONOPERATOR3D",3486308946:"IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM",3749851601:"IFCCARTESIANTRANSFORMATIONOPERATOR2D",59481748:"IFCCARTESIANTRANSFORMATIONOPERATOR",1123145078:"IFCCARTESIANPOINT",2898889636:"IFCCSHAPEPROFILEDEF",2713105998:"IFCBOXEDHALFSPACE",2581212453:"IFCBOUNDINGBOX",4182860854:"IFCBOUNDEDSURFACE",2736907675:"IFCBOOLEANRESULT",2740243338:"IFCAXIS2PLACEMENT3D",3125803723:"IFCAXIS2PLACEMENT2D",4261334040:"IFCAXIS1PLACEMENT",1302238472:"IFCANNOTATIONSURFACE",2265737646:"IFCANNOTATIONFILLAREAOCCURRENCE",669184980:"IFCANNOTATIONFILLAREA",3288037868:"IFCANNOTATIONCURVEOCCURRENCE",2543172580:"IFCZSHAPEPROFILEDEF",1299126871:"IFCWINDOWSTYLE",512836454:"IFCWINDOWPANELPROPERTIES",336235671:"IFCWINDOWLININGPROPERTIES",2759199220:"IFCVERTEXLOOP",1417489154:"IFCVECTOR",427810014:"IFCUSHAPEPROFILEDEF",2347495698:"IFCTYPEPRODUCT",1628702193:"IFCTYPEOBJECT",1345879162:"IFCTWODIRECTIONREPEATFACTOR",2715220739:"IFCTRAPEZIUMPROFILEDEF",3124975700:"IFCTEXTLITERALWITHEXTENT",4282788508:"IFCTEXTLITERAL",3028897424:"IFCTERMINATORSYMBOL",3071757647:"IFCTSHAPEPROFILEDEF",230924584:"IFCSWEPTSURFACE",1260650574:"IFCSWEPTDISKSOLID",2247615214:"IFCSWEPTAREASOLID",1878645084:"IFCSURFACESTYLERENDERING",2513912981:"IFCSURFACE",2233826070:"IFCSUBEDGE",3653947884:"IFCSTRUCTURALSTEELPROFILEPROPERTIES",3843319758:"IFCSTRUCTURALPROFILEPROPERTIES",1190533807:"IFCSTRUCTURALLOADSINGLEFORCEWARPING",1597423693:"IFCSTRUCTURALLOADSINGLEFORCE",1973038258:"IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION",2473145415:"IFCSTRUCTURALLOADSINGLEDISPLACEMENT",2668620305:"IFCSTRUCTURALLOADPLANARFORCE",1595516126:"IFCSTRUCTURALLOADLINEARFORCE",390701378:"IFCSPACETHERMALLOADPROPERTIES",1202362311:"IFCSOUNDVALUE",2485662743:"IFCSOUNDPROPERTIES",723233188:"IFCSOLIDMODEL",2609359061:"IFCSLIPPAGECONNECTIONCONDITION",4124623270:"IFCSHELLBASEDSURFACEMODEL",2411513650:"IFCSERVICELIFEFACTOR",1509187699:"IFCSECTIONEDSPINE",2778083089:"IFCROUNDEDRECTANGLEPROFILEDEF",478536968:"IFCRELATIONSHIP",3765753017:"IFCREINFORCEMENTDEFINITIONPROPERTIES",3413951693:"IFCREGULARTIMESERIES",3615266464:"IFCRECTANGLEPROFILEDEF",110355661:"IFCPROPERTYTABLEVALUE",3650150729:"IFCPROPERTYSINGLEVALUE",3357820518:"IFCPROPERTYSETDEFINITION",941946838:"IFCPROPERTYREFERENCEVALUE",2752243245:"IFCPROPERTYLISTVALUE",4166981789:"IFCPROPERTYENUMERATEDVALUE",1680319473:"IFCPROPERTYDEFINITION",871118103:"IFCPROPERTYBOUNDEDVALUE",673634403:"IFCPRODUCTDEFINITIONSHAPE",179317114:"IFCPREDEFINEDPOINTMARKERSYMBOL",433424934:"IFCPREDEFINEDDIMENSIONSYMBOL",2559016684:"IFCPREDEFINEDCURVEFONT",759155922:"IFCPREDEFINEDCOLOUR",2775532180:"IFCPOLYGONALBOUNDEDHALFSPACE",2924175390:"IFCPOLYLOOP",1423911732:"IFCPOINTONSURFACE",4022376103:"IFCPOINTONCURVE",2067069095:"IFCPOINT",1663979128:"IFCPLANAREXTENT",2004835150:"IFCPLACEMENT",597895409:"IFCPIXELTEXTURE",3021840470:"IFCPHYSICALCOMPLEXQUANTITY",2519244187:"IFCPATH",2529465313:"IFCPARAMETERIZEDPROFILEDEF",1029017970:"IFCORIENTEDEDGE",2665983363:"IFCOPENSHELL",2833995503:"IFCONEDIRECTIONREPEATFACTOR",219451334:"IFCOBJECTDEFINITION",1430189142:"IFCMECHANICALCONCRETEMATERIALPROPERTIES",2022407955:"IFCMATERIALDEFINITIONREPRESENTATION",2347385850:"IFCMAPPEDITEM",1008929658:"IFCLOOP",2624227202:"IFCLOCALPLACEMENT",3422422726:"IFCLIGHTSOURCESPOT",1520743889:"IFCLIGHTSOURCEPOSITIONAL",4266656042:"IFCLIGHTSOURCEGONIOMETRIC",2604431987:"IFCLIGHTSOURCEDIRECTIONAL",125510826:"IFCLIGHTSOURCEAMBIENT",1402838566:"IFCLIGHTSOURCE",3741457305:"IFCIRREGULARTIMESERIES",3905492369:"IFCIMAGETEXTURE",2445078500:"IFCHYGROSCOPICMATERIALPROPERTIES",812098782:"IFCHALFSPACESOLID",178086475:"IFCGRIDPLACEMENT",3590301190:"IFCGEOMETRICSET",4142052618:"IFCGEOMETRICREPRESENTATIONSUBCONTEXT",2453401579:"IFCGEOMETRICREPRESENTATIONITEM",3448662350:"IFCGEOMETRICREPRESENTATIONCONTEXT",1446786286:"IFCGENERALPROFILEPROPERTIES",803998398:"IFCGENERALMATERIALPROPERTIES",3857492461:"IFCFUELPROPERTIES",738692330:"IFCFILLAREASTYLE",4219587988:"IFCFAILURECONNECTIONCONDITION",3008276851:"IFCFACESURFACE",803316827:"IFCFACEOUTERBOUND",1809719519:"IFCFACEBOUND",2556980723:"IFCFACE",1860660968:"IFCEXTENDEDMATERIALPROPERTIES",476780140:"IFCEDGECURVE",3900360178:"IFCEDGE",4170525392:"IFCDRAUGHTINGPREDEFINEDTEXTFONT",3732053477:"IFCDOCUMENTREFERENCE",1694125774:"IFCDIMENSIONPAIR",2273265877:"IFCDIMENSIONCALLOUTRELATIONSHIP",3632507154:"IFCDERIVEDPROFILEDEF",3800577675:"IFCCURVESTYLE",2889183280:"IFCCONVERSIONBASEDUNIT",3050246964:"IFCCONTEXTDEPENDENTUNIT",45288368:"IFCCONNECTIONPOINTECCENTRICITY",1981873012:"IFCCONNECTIONCURVEGEOMETRY",370225590:"IFCCONNECTEDFACESET",1485152156:"IFCCOMPOSITEPROFILEDEF",2542286263:"IFCCOMPLEXPROPERTY",776857604:"IFCCOLOURRGB",647927063:"IFCCLASSIFICATIONREFERENCE",3150382593:"IFCCENTERLINEPROFILEDEF",616511568:"IFCBLOBTEXTURE",2705031697:"IFCARBITRARYPROFILEDEFWITHVOIDS",1310608509:"IFCARBITRARYOPENPROFILEDEF",3798115385:"IFCARBITRARYCLOSEDPROFILEDEF",2297822566:"IFCANNOTATIONTEXTOCCURRENCE",3612888222:"IFCANNOTATIONSYMBOLOCCURRENCE",962685235:"IFCANNOTATIONSURFACEOCCURRENCE",2442683028:"IFCANNOTATIONOCCURRENCE",1065908215:"IFCWATERPROPERTIES",891718957:"IFCVIRTUALGRIDINTERSECTION",1907098498:"IFCVERTEXPOINT",3304826586:"IFCVERTEXBASEDTEXTUREMAP",2799835756:"IFCVERTEX",180925521:"IFCUNITASSIGNMENT",1735638870:"IFCTOPOLOGYREPRESENTATION",1377556343:"IFCTOPOLOGICALREPRESENTATIONITEM",581633288:"IFCTIMESERIESVALUE",1718945513:"IFCTIMESERIESREFERENCERELATIONSHIP",3101149627:"IFCTIMESERIES",3317419933:"IFCTHERMALMATERIALPROPERTIES",1210645708:"IFCTEXTUREVERTEX",2552916305:"IFCTEXTUREMAP",1742049831:"IFCTEXTURECOORDINATEGENERATOR",280115917:"IFCTEXTURECOORDINATE",1484833681:"IFCTEXTSTYLEWITHBOXCHARACTERISTICS",1640371178:"IFCTEXTSTYLETEXTMODEL",2636378356:"IFCTEXTSTYLEFORDEFINEDFONT",1983826977:"IFCTEXTSTYLEFONTMODEL",1447204868:"IFCTEXTSTYLE",912023232:"IFCTELECOMADDRESS",531007025:"IFCTABLEROW",985171141:"IFCTABLE",1290481447:"IFCSYMBOLSTYLE",626085974:"IFCSURFACETEXTURE",1351298697:"IFCSURFACESTYLEWITHTEXTURES",846575682:"IFCSURFACESTYLESHADING",1607154358:"IFCSURFACESTYLEREFRACTION",3303107099:"IFCSURFACESTYLELIGHTING",1300840506:"IFCSURFACESTYLE",3049322572:"IFCSTYLEDREPRESENTATION",3958052878:"IFCSTYLEDITEM",2830218821:"IFCSTYLEMODEL",3408363356:"IFCSTRUCTURALLOADTEMPERATURE",2525727697:"IFCSTRUCTURALLOADSTATIC",2162789131:"IFCSTRUCTURALLOAD",2273995522:"IFCSTRUCTURALCONNECTIONCONDITION",3692461612:"IFCSIMPLEPROPERTY",4240577450:"IFCSHAPEREPRESENTATION",3982875396:"IFCSHAPEMODEL",867548509:"IFCSHAPEASPECT",4165799628:"IFCSECTIONREINFORCEMENTPROPERTIES",2042790032:"IFCSECTIONPROPERTIES",448429030:"IFCSIUNIT",2341007311:"IFCROOT",3679540991:"IFCRIBPLATEPROFILEPROPERTIES",1660063152:"IFCREPRESENTATIONMAP",3008791417:"IFCREPRESENTATIONITEM",3377609919:"IFCREPRESENTATIONCONTEXT",1076942058:"IFCREPRESENTATION",1222501353:"IFCRELAXATION",1580146022:"IFCREINFORCEMENTBARPROPERTIES",2692823254:"IFCREFERENCESVALUEDOCUMENT",825690147:"IFCQUANTITYWEIGHT",2405470396:"IFCQUANTITYVOLUME",3252649465:"IFCQUANTITYTIME",931644368:"IFCQUANTITYLENGTH",2093928680:"IFCQUANTITYCOUNT",2044713172:"IFCQUANTITYAREA",3710013099:"IFCPROPERTYENUMERATION",148025276:"IFCPROPERTYDEPENDENCYRELATIONSHIP",3896028662:"IFCPROPERTYCONSTRAINTRELATIONSHIP",2598011224:"IFCPROPERTY",2802850158:"IFCPROFILEPROPERTIES",3958567839:"IFCPROFILEDEF",2267347899:"IFCPRODUCTSOFCOMBUSTIONPROPERTIES",2095639259:"IFCPRODUCTREPRESENTATION",2417041796:"IFCPRESENTATIONSTYLEASSIGNMENT",3119450353:"IFCPRESENTATIONSTYLE",1304840413:"IFCPRESENTATIONLAYERWITHSTYLE",2022622350:"IFCPRESENTATIONLAYERASSIGNMENT",1775413392:"IFCPREDEFINEDTEXTFONT",3213052703:"IFCPREDEFINEDTERMINATORSYMBOL",990879717:"IFCPREDEFINEDSYMBOL",3727388367:"IFCPREDEFINEDITEM",3355820592:"IFCPOSTALADDRESS",2226359599:"IFCPHYSICALSIMPLEQUANTITY",2483315170:"IFCPHYSICALQUANTITY",101040310:"IFCPERSONANDORGANIZATION",2077209135:"IFCPERSON",1207048766:"IFCOWNERHISTORY",1411181986:"IFCORGANIZATIONRELATIONSHIP",4251960020:"IFCORGANIZATION",1227763645:"IFCOPTICALMATERIALPROPERTIES",2251480897:"IFCOBJECTIVE",3701648758:"IFCOBJECTPLACEMENT",1918398963:"IFCNAMEDUNIT",2706619895:"IFCMONETARYUNIT",3368373690:"IFCMETRIC",677618848:"IFCMECHANICALSTEELMATERIALPROPERTIES",4256014907:"IFCMECHANICALMATERIALPROPERTIES",2597039031:"IFCMEASUREWITHUNIT",3265635763:"IFCMATERIALPROPERTIES",2199411900:"IFCMATERIALLIST",1303795690:"IFCMATERIALLAYERSETUSAGE",3303938423:"IFCMATERIALLAYERSET",248100487:"IFCMATERIALLAYER",1847130766:"IFCMATERIALCLASSIFICATIONRELATIONSHIP",1838606355:"IFCMATERIAL",30780891:"IFCLOCALTIME",1566485204:"IFCLIGHTINTENSITYDISTRIBUTION",4162380809:"IFCLIGHTDISTRIBUTIONDATA",3452421091:"IFCLIBRARYREFERENCE",2655187982:"IFCLIBRARYINFORMATION",3020489413:"IFCIRREGULARTIMESERIESVALUE",852622518:"IFCGRIDAXIS",3548104201:"IFCEXTERNALLYDEFINEDTEXTFONT",3207319532:"IFCEXTERNALLYDEFINEDSYMBOL",1040185647:"IFCEXTERNALLYDEFINEDSURFACESTYLE",2242383968:"IFCEXTERNALLYDEFINEDHATCHSTYLE",3200245327:"IFCEXTERNALREFERENCE",1648886627:"IFCENVIRONMENTALIMPACTVALUE",3796139169:"IFCDRAUGHTINGCALLOUTRELATIONSHIP",770865208:"IFCDOCUMENTINFORMATIONRELATIONSHIP",1154170062:"IFCDOCUMENTINFORMATION",1376555844:"IFCDOCUMENTELECTRONICFORMAT",2949456006:"IFCDIMENSIONALEXPONENTS",1045800335:"IFCDERIVEDUNITELEMENT",1765591967:"IFCDERIVEDUNIT",1072939445:"IFCDATEANDTIME",3510044353:"IFCCURVESTYLEFONTPATTERN",2367409068:"IFCCURVESTYLEFONTANDSCALING",1105321065:"IFCCURVESTYLEFONT",539742890:"IFCCURRENCYRELATIONSHIP",602808272:"IFCCOSTVALUE",1065062679:"IFCCOORDINATEDUNIVERSALTIMEOFFSET",347226245:"IFCCONSTRAINTRELATIONSHIP",613356794:"IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP",1658513725:"IFCCONSTRAINTAGGREGATIONRELATIONSHIP",1959218052:"IFCCONSTRAINT",2732653382:"IFCCONNECTIONSURFACEGEOMETRY",4257277454:"IFCCONNECTIONPORTGEOMETRY",2614616156:"IFCCONNECTIONPOINTGEOMETRY",2859738748:"IFCCONNECTIONGEOMETRY",3264961684:"IFCCOLOURSPECIFICATION",3639012971:"IFCCLASSIFICATIONNOTATIONFACET",938368621:"IFCCLASSIFICATIONNOTATION",1098599126:"IFCCLASSIFICATIONITEMRELATIONSHIP",1767535486:"IFCCLASSIFICATIONITEM",747523909:"IFCCLASSIFICATION",622194075:"IFCCALENDARDATE",2069777674:"IFCBOUNDARYNODECONDITIONWARPING",1387855156:"IFCBOUNDARYNODECONDITION",3367102660:"IFCBOUNDARYFACECONDITION",1560379544:"IFCBOUNDARYEDGECONDITION",4037036970:"IFCBOUNDARYCONDITION",3869604511:"IFCAPPROVALRELATIONSHIP",390851274:"IFCAPPROVALPROPERTYRELATIONSHIP",2080292479:"IFCAPPROVALACTORRELATIONSHIP",130549933:"IFCAPPROVAL",1110488051:"IFCAPPLIEDVALUERELATIONSHIP",411424972:"IFCAPPLIEDVALUE",639542469:"IFCAPPLICATION",618182010:"IFCADDRESS",3630933823:"IFCACTORROLE",599546466:"FILE_DESCRIPTION",1390159747:"FILE_NAME",1109904537:"FILE_SCHEMA"};class c{static async getUnits(F){var R;const{IFCUNITASSIGNMENT:E}=w,I=await F.getAllPropertiesOfType(E);if(!I)return 1;const C=Object.keys(I),T=I[parseInt(C[0],10)];for(const A of T.Units){if(A.value===void 0||A.value===null)continue;const N=await F.getProperties(A.value);if(!N||!N.UnitType||!N.UnitType.value||N.UnitType.value!=="LENGTHUNIT")continue;let S=1,P=1;return N.Name.value==="METRE"&&(P=1),N.Name.value==="FOOT"&&(P=.3048),((R=N.Prefix)==null?void 0:R.value)==="MILLI"&&(S=.001),P*S}return 1}static async findItemByGuid(F,E){var C;const I=F.getAllPropertiesIDs();for(const T of I){const R=await F.getProperties(T);if(R&&((C=R.GlobalId)==null?void 0:C.value)===E)return R}return null}static async getRelationMap(F,E,I){var N;const T=I??(async()=>{}),R={},A=F.getAllPropertiesIDs();for(const O of A){const S=await F.getProperties(O);if(!S)continue;const P=S.type===E,M=Object.keys(S).find(s=>s.startsWith("Relating")),e=Object.keys(S).find(s=>s.startsWith("Related"));if(!(P&&M&&e))continue;const t=await F.getProperties((N=S[M])==null?void 0:N.value),U=S[e];if(!t||!U||!(U&&Array.isArray(U)))continue;const i=U.map(s=>s.value);await T(t.expressID,i),R[t.expressID]=i}return R}static async getQsetQuantities(F,E,I){const T=I??(()=>{}),R=await F.getProperties(E);return!R||R.type!==v?null:(R.Quantities??[{}]).map(O=>(O.value&&T(O.value),O.value)).filter(O=>O!==null)}static async getPsetProps(F,E,I){const T=I??(()=>{}),R=await F.getProperties(E);return!R||R.type!==x?null:(R.HasProperties??[{}]).map(O=>(O.value&&T(O.value),O.value)).filter(O=>O!==null)}static async getPsetRel(F,E){var A;if(!await F.getProperties(E))return null;const C=await F.getAllPropertiesOfType(V);if(!C)return null;const T=Object.values(C);let R=null;for(const N of T)((A=N.RelatingPropertyDefinition)==null?void 0:A.value)===E&&(R=N.expressID);return R}static async getQsetRel(F,E){return c.getPsetRel(F,E)}static async getEntityName(F,E){var R;const I=await F.getProperties(E);if(!I)return{key:null,name:null};const C=Object.keys(I).find(A=>A.endsWith("Name"))??null,T=C?(R=I[C])==null?void 0:R.value:null;return{key:C,name:T}}static async getQuantityValue(F,E){const I=await F.getProperties(E);if(!I)return{key:null,value:null};const C=Object.keys(I).find(R=>R.endsWith("Value"))??null;let T;return C===null||I[C]===void 0||I[C]===null?T=null:T=I[C].value,{key:C,value:T}}static isRel(F){return K[F].startsWith("IFCREL")}static async attributeExists(F,E,I){const C=await F.getProperties(E);return C?Object.keys(C).includes(I):!1}static async groupEntitiesByType(F,E){var C;const I=new Map;for(const T of E){const R=await F.getProperties(T);if(!R)continue;const A=R.type;I.get(A)||I.set(A,new Set),(C=I.get(A))==null||C.add(T)}return I}}const Q=new Map([[H,{forRelating:"IsDecomposedBy",forRelated:"Decomposes"}],[p,{forRelating:"AssociatedTo",forRelated:"HasAssociations"}],[f,{forRelating:"ClassificationForObjects",forRelated:"HasAssociations"}],[d,{forRelating:"IsGroupedBy",forRelated:"HasAssignments"}],[V,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[W,{forRelated:"IsTypedBy",forRelating:"Types"}],[g,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[X,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}]]),r=class r extends y{constructor(E){super(E);L(this,"onDisposed",new o);L(this,"enabled",!0);L(this,"onRelationsIndexed",new o);L(this,"_relToAttributesMap",Q);L(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements"]);L(this,"_ifcRels",[H,p,f,d,V,W,g,X]);L(this,"relationMaps",{});L(this,"onFragmentsDisposed",E=>{delete this.relationMaps[E.groupID]});this.components.add(r.uuid,this),E.get(a).onFragmentsDisposed.add(this.onFragmentsDisposed)}setRelationMap(E,I){this.relationMaps[E.uuid]=I,this.onRelationsIndexed.trigger({modelID:E.uuid,relationsMap:I})}async process(E){if(!E.hasProperties)throw new Error("FragmentsGroup properties not found");let I=this.relationMaps[E.uuid];if(I)return I;I=new Map;for(const C of this._ifcRels)await c.getRelationMap(E,C,async(T,R)=>{const A=this._relToAttributesMap.get(C);if(!A)return;const{forRelated:N,forRelating:O}=A,S=I.get(T)??new Map,P=this._inverseAttributes.indexOf(O);S.set(P,R),I.set(T,S);for(const M of R){const e=I.get(M)??new Map,t=this._inverseAttributes.indexOf(N),U=e.get(t)??[];U.push(T),e.set(t,U),I.set(M,e)}});return this.setRelationMap(E,I),I}async processFromWebIfc(E,I){const C=new Map;for(const T of this._ifcRels){const R=this._relToAttributesMap.get(T);if(!R)continue;const{forRelated:A,forRelating:N}=R,O=E.GetLineIDsWithType(I,T);for(let S=0;SD.startsWith("Relating")),e=Object.keys(P).find(D=>D.startsWith("Related"));if(!(M&&e))continue;const t=P[M].value,U=P[e].map(D=>D.value),i=C.get(t)??new Map,s=this._inverseAttributes.indexOf(N);i.set(s,U),C.set(t,i);for(const D of U){const G=C.get(D)??new Map,B=this._inverseAttributes.indexOf(A),u=G.get(B)??[];u.push(t),G.set(B,u),C.set(D,G)}}}return this.onRelationsIndexed.trigger({modelID:I.toString(),relationsMap:C}),C}getEntityRelations(E,I,C){const T=this.relationMaps[E.uuid];if(!T)return null;const R=T.get(I),A=this._inverseAttributes.indexOf(C);if(!R||A===-1)return null;const N=R.get(A);return N||null}serializeRelations(E){const I={};for(const[C,T]of E.entries()){I[C]||(I[C]={});for(const[R,A]of T.entries())I[C][R]=A}return JSON.stringify(I)}serializeModelRelations(E){const I=this.relationMaps[E.uuid];return I?this.serializeRelations(I):null}serializeAllRelations(){const E={};for(const I in this.relationMaps){const C=this.relationMaps[I],T={};for(const[R,A]of C.entries()){T[R]||(T[R]={});for(const[N,O]of A.entries())T[R][N]=O}E[I]=T}return JSON.stringify(E)}getRelationsMapFromJSON(E){const I=JSON.parse(E),C=new Map;for(const T in I){const R=I[T],A=new Map;for(const N in R)A.set(Number(N),R[N]);C.set(Number(T),A)}return C}dispose(){this.relationMaps={},this.components.get(a).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(r.uuid),this.onDisposed.reset()}};L(r,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let l=r;export{a as F,l as I,c as a}; +var h=Object.defineProperty;var m=(n,F,E)=>F in n?h(n,F,{enumerable:!0,configurable:!0,writable:!0,value:E}):n[F]=E;var L=(n,F,E)=>(m(n,typeof F!="symbol"?F+"":F,E),E);import{$ as b,am as v,af as x,a4 as V,ac as w,a0 as H,a1 as p,a2 as f,a3 as d,a5 as W,a6 as g,a7 as X}from"./web-ifc-api-BC8YMRiS.js";import{C as y,E as o}from"./index-BZiAUaTo.js";const Y=class Y extends y{constructor(E){super(E);L(this,"onDisposed",new o);L(this,"onFragmentsLoaded",new o);L(this,"onFragmentsDisposed",new o);L(this,"list",new Map);L(this,"groups",new Map);L(this,"enabled",!0);L(this,"baseCoordinationModel","");L(this,"_loader",new b);this.components.add(Y.uuid,this)}get meshes(){const E=[];for(const[I,C]of this.list)E.push(C.mesh);return E}dispose(){for(const[E,I]of this.groups)I.dispose(!0);this.baseCoordinationModel="",this.groups.clear(),this.list.clear(),this.onFragmentsLoaded.reset(),this.onFragmentsDisposed.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}disposeGroup(E){const{uuid:I}=E,C=[];for(const T of E.items)C.push(T.id),this.list.delete(T.id);E.dispose(!0),this.groups.delete(E.uuid),this.onFragmentsDisposed.trigger({groupID:I,fragmentIDs:C})}load(E,I){const T={...{coordinate:!0},...I},{coordinate:R,properties:A,relationsMap:N}=T,O=this._loader.import(E);for(const S of O.items)S.group=O,this.list.set(S.id,S);return R&&this.coordinate([O]),this.groups.set(O.uuid,O),A&&O.setLocalProperties(A),N&&this.components.get(l).setRelationMap(O,N),this.onFragmentsLoaded.trigger(O),O}export(E){return this._loader.export(E)}coordinate(E=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const T=E.pop();if(!T)return;this.baseCoordinationModel=T.uuid}if(!E.length)return;const C=this.groups.get(this.baseCoordinationModel);if(!C){console.log("No base model found for coordination!");return}for(const T of E)T!==C&&(T.position.set(0,0,0),T.rotation.set(0,0,0),T.scale.set(1,1,1),T.updateMatrix(),T.applyMatrix4(T.coordinationMatrix.clone().invert()),T.applyMatrix4(C.coordinationMatrix))}};L(Y,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let a=Y;const K={950732822:"IFCURIREFERENCE",4075327185:"IFCTIME",1209108979:"IFCTEMPERATURERATEOFCHANGEMEASURE",3457685358:"IFCSOUNDPRESSURELEVELMEASURE",4157543285:"IFCSOUNDPOWERLEVELMEASURE",2798247006:"IFCPROPERTYSETDEFINITIONSET",1790229001:"IFCPOSITIVEINTEGER",525895558:"IFCNONNEGATIVELENGTHMEASURE",1774176899:"IFCLINEINDEX",1275358634:"IFCLANGUAGEID",2541165894:"IFCDURATION",3701338814:"IFCDAYINWEEKNUMBER",2195413836:"IFCDATETIME",937566702:"IFCDATE",1683019596:"IFCCARDINALPOINTREFERENCE",2314439260:"IFCBINARY",1500781891:"IFCAREADENSITYMEASURE",3683503648:"IFCARCINDEX",4065007721:"IFCYEARNUMBER",1718600412:"IFCWARPINGMOMENTMEASURE",51269191:"IFCWARPINGCONSTANTMEASURE",2593997549:"IFCVOLUMETRICFLOWRATEMEASURE",3458127941:"IFCVOLUMEMEASURE",3345633955:"IFCVAPORPERMEABILITYMEASURE",1278329552:"IFCTORQUEMEASURE",2591213694:"IFCTIMESTAMP",2726807636:"IFCTIMEMEASURE",743184107:"IFCTHERMODYNAMICTEMPERATUREMEASURE",2016195849:"IFCTHERMALTRANSMITTANCEMEASURE",857959152:"IFCTHERMALRESISTANCEMEASURE",2281867870:"IFCTHERMALEXPANSIONCOEFFICIENTMEASURE",2645777649:"IFCTHERMALCONDUCTIVITYMEASURE",232962298:"IFCTHERMALADMITTANCEMEASURE",296282323:"IFCTEXTTRANSFORMATION",603696268:"IFCTEXTFONTNAME",3490877962:"IFCTEXTDECORATION",1460886941:"IFCTEXTALIGNMENT",2801250643:"IFCTEXT",58845555:"IFCTEMPERATUREGRADIENTMEASURE",361837227:"IFCSPECULARROUGHNESS",2757832317:"IFCSPECULAREXPONENT",3477203348:"IFCSPECIFICHEATCAPACITYMEASURE",993287707:"IFCSOUNDPRESSUREMEASURE",846465480:"IFCSOUNDPOWERMEASURE",3471399674:"IFCSOLIDANGLEMEASURE",408310005:"IFCSHEARMODULUSMEASURE",2190458107:"IFCSECTIONALAREAINTEGRALMEASURE",3467162246:"IFCSECTIONMODULUSMEASURE",2766185779:"IFCSECONDINMINUTE",3211557302:"IFCROTATIONALSTIFFNESSMEASURE",1755127002:"IFCROTATIONALMASSMEASURE",2133746277:"IFCROTATIONALFREQUENCYMEASURE",200335297:"IFCREAL",96294661:"IFCRATIOMEASURE",3972513137:"IFCRADIOACTIVITYMEASURE",3665567075:"IFCPRESSUREMEASURE",2169031380:"IFCPRESENTABLETEXT",1364037233:"IFCPOWERMEASURE",1245737093:"IFCPOSITIVERATIOMEASURE",3054510233:"IFCPOSITIVEPLANEANGLEMEASURE",2815919920:"IFCPOSITIVELENGTHMEASURE",4042175685:"IFCPLANEANGLEMEASURE",2642773653:"IFCPLANARFORCEMEASURE",2260317790:"IFCPARAMETERVALUE",929793134:"IFCPHMEASURE",2395907400:"IFCNUMERICMEASURE",2095195183:"IFCNORMALISEDRATIOMEASURE",765770214:"IFCMONTHINYEARNUMBER",2615040989:"IFCMONETARYMEASURE",3114022597:"IFCMOMENTOFINERTIAMEASURE",1648970520:"IFCMOLECULARWEIGHTMEASURE",3177669450:"IFCMOISTUREDIFFUSIVITYMEASURE",1753493141:"IFCMODULUSOFSUBGRADEREACTIONMEASURE",1052454078:"IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE",2173214787:"IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE",3341486342:"IFCMODULUSOFELASTICITYMEASURE",102610177:"IFCMINUTEINHOUR",3531705166:"IFCMASSPERLENGTHMEASURE",3124614049:"IFCMASSMEASURE",4017473158:"IFCMASSFLOWRATEMEASURE",1477762836:"IFCMASSDENSITYMEASURE",2486716878:"IFCMAGNETICFLUXMEASURE",286949696:"IFCMAGNETICFLUXDENSITYMEASURE",151039812:"IFCLUMINOUSINTENSITYMEASURE",2755797622:"IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE",2095003142:"IFCLUMINOUSFLUXMEASURE",503418787:"IFCLOGICAL",3086160713:"IFCLINEARVELOCITYMEASURE",1307019551:"IFCLINEARSTIFFNESSMEASURE",2128979029:"IFCLINEARMOMENTMEASURE",191860431:"IFCLINEARFORCEMEASURE",1243674935:"IFCLENGTHMEASURE",3258342251:"IFCLABEL",2054016361:"IFCKINEMATICVISCOSITYMEASURE",3192672207:"IFCISOTHERMALMOISTURECAPACITYMEASURE",3686016028:"IFCIONCONCENTRATIONMEASURE",3809634241:"IFCINTEGERCOUNTRATEMEASURE",1939436016:"IFCINTEGER",2679005408:"IFCINDUCTANCEMEASURE",3358199106:"IFCILLUMINANCEMEASURE",983778844:"IFCIDENTIFIER",2589826445:"IFCHOURINDAY",1158859006:"IFCHEATINGVALUEMEASURE",3113092358:"IFCHEATFLUXDENSITYMEASURE",3064340077:"IFCGLOBALLYUNIQUEID",3044325142:"IFCFREQUENCYMEASURE",1361398929:"IFCFORCEMEASURE",2590844177:"IFCFONTWEIGHT",2715512545:"IFCFONTVARIANT",1102727119:"IFCFONTSTYLE",2078135608:"IFCENERGYMEASURE",2506197118:"IFCELECTRICVOLTAGEMEASURE",2951915441:"IFCELECTRICRESISTANCEMEASURE",3790457270:"IFCELECTRICCURRENTMEASURE",2093906313:"IFCELECTRICCONDUCTANCEMEASURE",3818826038:"IFCELECTRICCHARGEMEASURE",1827137117:"IFCELECTRICCAPACITANCEMEASURE",69416015:"IFCDYNAMICVISCOSITYMEASURE",524656162:"IFCDOSEEQUIVALENTMEASURE",4134073009:"IFCDIMENSIONCOUNT",1514641115:"IFCDESCRIPTIVEMEASURE",300323983:"IFCDAYLIGHTSAVINGHOUR",86635668:"IFCDAYINMONTHNUMBER",94842927:"IFCCURVATUREMEASURE",1778710042:"IFCCOUNTMEASURE",3238673880:"IFCCONTEXTDEPENDENTMEASURE",3812528620:"IFCCOMPOUNDPLANEANGLEMEASURE",2991860651:"IFCCOMPLEXNUMBER",1867003952:"IFCBOXALIGNMENT",2735952531:"IFCBOOLEAN",2650437152:"IFCAREAMEASURE",632304761:"IFCANGULARVELOCITYMEASURE",360377573:"IFCAMOUNTOFSUBSTANCEMEASURE",4182062534:"IFCACCELERATIONMEASURE",3699917729:"IFCABSORBEDDOSEMEASURE",1971632696:"IFCGEOSLICE",2680139844:"IFCGEOMODEL",24726584:"IFCELECTRICFLOWTREATMENTDEVICE",3693000487:"IFCDISTRIBUTIONBOARD",3460952963:"IFCCONVEYORSEGMENT",3999819293:"IFCCAISSONFOUNDATION",3314249567:"IFCBOREHOLE",4196446775:"IFCBEARING",325726236:"IFCALIGNMENT",3425753595:"IFCTRACKELEMENT",991950508:"IFCSIGNAL",3798194928:"IFCREINFORCEDSOIL",3290496277:"IFCRAIL",1383356374:"IFCPAVEMENT",2182337498:"IFCNAVIGATIONELEMENT",234836483:"IFCMOORINGDEVICE",2078563270:"IFCMOBILETELECOMMUNICATIONSAPPLIANCE",1638804497:"IFCLIQUIDTERMINAL",1154579445:"IFCLINEARPOSITIONINGELEMENT",2696325953:"IFCKERB",2713699986:"IFCGEOTECHNICALASSEMBLY",2142170206:"IFCELECTRICFLOWTREATMENTDEVICETYPE",3376911765:"IFCEARTHWORKSFILL",1077100507:"IFCEARTHWORKSELEMENT",3071239417:"IFCEARTHWORKSCUT",479945903:"IFCDISTRIBUTIONBOARDTYPE",3426335179:"IFCDEEPFOUNDATION",1502416096:"IFCCOURSE",2940368186:"IFCCONVEYORSEGMENTTYPE",3203706013:"IFCCAISSONFOUNDATIONTYPE",3862327254:"IFCBUILTSYSTEM",1876633798:"IFCBUILTELEMENT",963979645:"IFCBRIDGEPART",644574406:"IFCBRIDGE",3649138523:"IFCBEARINGTYPE",1662888072:"IFCALIGNMENTVERTICAL",317615605:"IFCALIGNMENTSEGMENT",1545765605:"IFCALIGNMENTHORIZONTAL",4266260250:"IFCALIGNMENTCANT",3956297820:"IFCVIBRATIONDAMPERTYPE",1530820697:"IFCVIBRATIONDAMPER",840318589:"IFCVEHICLE",1953115116:"IFCTRANSPORTATIONDEVICE",618700268:"IFCTRACKELEMENTTYPE",2281632017:"IFCTENDONCONDUITTYPE",3663046924:"IFCTENDONCONDUIT",42703149:"IFCSINESPIRAL",1894708472:"IFCSIGNALTYPE",3599934289:"IFCSIGNTYPE",33720170:"IFCSIGN",1027922057:"IFCSEVENTHORDERPOLYNOMIALSPIRAL",544395925:"IFCSEGMENTEDREFERENCECURVE",3649235739:"IFCSECONDORDERPOLYNOMIALSPIRAL",550521510:"IFCROADPART",146592293:"IFCROAD",3818125796:"IFCRELADHERESTOELEMENT",4021432810:"IFCREFERENT",1891881377:"IFCRAILWAYPART",3992365140:"IFCRAILWAY",1763565496:"IFCRAILTYPE",1946335990:"IFCPOSITIONINGELEMENT",514975943:"IFCPAVEMENTTYPE",506776471:"IFCNAVIGATIONELEMENTTYPE",710110818:"IFCMOORINGDEVICETYPE",1950438474:"IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE",976884017:"IFCMARINEPART",525669439:"IFCMARINEFACILITY",1770583370:"IFCLIQUIDTERMINALTYPE",2176059722:"IFCLINEARELEMENT",679976338:"IFCKERBTYPE",3948183225:"IFCIMPACTPROTECTIONDEVICETYPE",2568555532:"IFCIMPACTPROTECTIONDEVICE",2898700619:"IFCGRADIENTCURVE",1594536857:"IFCGEOTECHNICALSTRATUM",4230923436:"IFCGEOTECHNICALELEMENT",4228831410:"IFCFACILITYPARTCOMMON",1310830890:"IFCFACILITYPART",24185140:"IFCFACILITY",4234616927:"IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID",1306400036:"IFCDEEPFOUNDATIONTYPE",4189326743:"IFCCOURSETYPE",2000195564:"IFCCOSINESPIRAL",3497074424:"IFCCLOTHOID",1626504194:"IFCBUILTELEMENTTYPE",3651464721:"IFCVEHICLETYPE",1229763772:"IFCTRIANGULATEDIRREGULARNETWORK",3665877780:"IFCTRANSPORTATIONDEVICETYPE",782932809:"IFCTHIRDORDERPOLYNOMIALSPIRAL",2735484536:"IFCSPIRAL",1356537516:"IFCSECTIONEDSURFACE",1290935644:"IFCSECTIONEDSOLIDHORIZONTAL",1862484736:"IFCSECTIONEDSOLID",1441486842:"IFCRELPOSITIONS",1033248425:"IFCRELASSOCIATESPROFILEDEF",3381221214:"IFCPOLYNOMIALCURVE",2485787929:"IFCOFFSETCURVEBYDISTANCES",590820931:"IFCOFFSETCURVE",3465909080:"IFCINDEXEDPOLYGONALTEXTUREMAP",593015953:"IFCDIRECTRIXCURVESWEPTAREASOLID",4212018352:"IFCCURVESEGMENT",3425423356:"IFCAXIS2PLACEMENTLINEAR",823603102:"IFCSEGMENT",2165702409:"IFCPOINTBYDISTANCEEXPRESSION",182550632:"IFCOPENCROSSPROFILEDEF",388784114:"IFCLINEARPLACEMENT",536804194:"IFCALIGNMENTHORIZONTALSEGMENT",3752311538:"IFCALIGNMENTCANTSEGMENT",1010789467:"IFCTEXTURECOORDINATEINDICESWITHVOIDS",222769930:"IFCTEXTURECOORDINATEINDICES",2691318326:"IFCQUANTITYNUMBER",3633395639:"IFCALIGNMENTVERTICALSEGMENT",2879124712:"IFCALIGNMENTPARAMETERSEGMENT",25142252:"IFCCONTROLLER",3087945054:"IFCALARM",4288193352:"IFCACTUATOR",630975310:"IFCUNITARYCONTROLELEMENT",4086658281:"IFCSENSOR",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",182646315:"IFCFLOWINSTRUMENT",1426591983:"IFCFIRESUPPRESSIONTERMINAL",819412036:"IFCFILTER",3415622556:"IFCFAN",1003880860:"IFCELECTRICTIMECONTROL",402227799:"IFCELECTRICMOTOR",264262732:"IFCELECTRICGENERATOR",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",862014818:"IFCELECTRICDISTRIBUTIONBOARD",1904799276:"IFCELECTRICAPPLIANCE",1360408905:"IFCDUCTSILENCER",3518393246:"IFCDUCTSEGMENT",342316401:"IFCDUCTFITTING",562808652:"IFCDISTRIBUTIONCIRCUIT",4074379575:"IFCDAMPER",3640358203:"IFCCOOLINGTOWER",4136498852:"IFCCOOLEDBEAM",2272882330:"IFCCONDENSER",3571504051:"IFCCOMPRESSOR",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",639361253:"IFCCOIL",3902619387:"IFCCHILLER",4217484030:"IFCCABLESEGMENT",1051757585:"IFCCABLEFITTING",3758799889:"IFCCABLECARRIERSEGMENT",635142910:"IFCCABLECARRIERFITTING",2938176219:"IFCBURNER",32344328:"IFCBOILER",2906023776:"IFCBEAMSTANDARDCASE",277319702:"IFCAUDIOVISUALAPPLIANCE",2056796094:"IFCAIRTOAIRHEATRECOVERY",177149247:"IFCAIRTERMINALBOX",1634111441:"IFCAIRTERMINAL",486154966:"IFCWINDOWSTANDARDCASE",4237592921:"IFCWASTETERMINAL",4156078855:"IFCWALLELEMENTEDCASE",4207607924:"IFCVALVE",4292641817:"IFCUNITARYEQUIPMENT",3179687236:"IFCUNITARYCONTROLELEMENTTYPE",3026737570:"IFCTUBEBUNDLE",3825984169:"IFCTRANSFORMER",812556717:"IFCTANK",1162798199:"IFCSWITCHINGDEVICE",385403989:"IFCSTRUCTURALLOADCASE",1404847402:"IFCSTACKTERMINAL",1999602285:"IFCSPACEHEATER",3420628829:"IFCSOLARDEVICE",3027962421:"IFCSLABSTANDARDCASE",3127900445:"IFCSLABELEMENTEDCASE",1329646415:"IFCSHADINGDEVICE",3053780830:"IFCSANITARYTERMINAL",2572171363:"IFCREINFORCINGBARTYPE",1232101972:"IFCRATIONALBSPLINECURVEWITHKNOTS",90941305:"IFCPUMP",655969474:"IFCPROTECTIVEDEVICETRIPPINGUNITTYPE",738039164:"IFCPROTECTIVEDEVICE",1156407060:"IFCPLATESTANDARDCASE",3612865200:"IFCPIPESEGMENT",310824031:"IFCPIPEFITTING",3694346114:"IFCOUTLET",144952367:"IFCOUTERBOUNDARYCURVE",2474470126:"IFCMOTORCONNECTION",1911478936:"IFCMEMBERSTANDARDCASE",1437502449:"IFCMEDICALDEVICE",629592764:"IFCLIGHTFIXTURE",76236018:"IFCLAMP",2176052936:"IFCJUNCTIONBOX",4175244083:"IFCINTERCEPTOR",2068733104:"IFCHUMIDIFIER",3319311131:"IFCHEATEXCHANGER",2188021234:"IFCFLOWMETER",1209101575:"IFCEXTERNALSPATIALELEMENT",484807127:"IFCEVAPORATOR",3747195512:"IFCEVAPORATIVECOOLER",2814081492:"IFCENGINE",2417008758:"IFCELECTRICDISTRIBUTIONBOARDTYPE",3242481149:"IFCDOORSTANDARDCASE",3205830791:"IFCDISTRIBUTIONSYSTEM",400855858:"IFCCOMMUNICATIONSAPPLIANCETYPE",905975707:"IFCCOLUMNSTANDARDCASE",1677625105:"IFCCIVILELEMENT",3296154744:"IFCCHIMNEY",2674252688:"IFCCABLEFITTINGTYPE",2188180465:"IFCBURNERTYPE",1177604601:"IFCBUILDINGSYSTEM",39481116:"IFCBUILDINGELEMENTPARTTYPE",1136057603:"IFCBOUNDARYCURVE",2461110595:"IFCBSPLINECURVEWITHKNOTS",1532957894:"IFCAUDIOVISUALAPPLIANCETYPE",4088093105:"IFCWORKCALENDAR",4009809668:"IFCWINDOWTYPE",926996030:"IFCVOIDINGFEATURE",2391383451:"IFCVIBRATIONISOLATOR",2415094496:"IFCTENDONTYPE",3081323446:"IFCTENDONANCHORTYPE",413509423:"IFCSYSTEMFURNITUREELEMENT",3101698114:"IFCSURFACEFEATURE",3657597509:"IFCSTRUCTURALSURFACEACTION",2757150158:"IFCSTRUCTURALCURVEREACTION",1004757350:"IFCSTRUCTURALCURVEACTION",338393293:"IFCSTAIRTYPE",1072016465:"IFCSOLARDEVICETYPE",4074543187:"IFCSHADINGDEVICETYPE",2157484638:"IFCSEAMCURVE",2781568857:"IFCROOFTYPE",2310774935:"IFCREINFORCINGMESHTYPE",964333572:"IFCREINFORCINGELEMENTTYPE",683857671:"IFCRATIONALBSPLINESURFACEWITHKNOTS",1469900589:"IFCRAMPTYPE",2839578677:"IFCPOLYGONALFACESET",1158309216:"IFCPILETYPE",3079942009:"IFCOPENINGSTANDARDCASE",1114901282:"IFCMEDICALDEVICETYPE",3113134337:"IFCINTERSECTIONCURVE",3946677679:"IFCINTERCEPTORTYPE",2571569899:"IFCINDEXEDPOLYCURVE",3493046030:"IFCGEOGRAPHICELEMENT",1509553395:"IFCFURNITURE",1893162501:"IFCFOOTINGTYPE",2853485674:"IFCEXTERNALSPATIALSTRUCTUREELEMENT",4148101412:"IFCEVENT",132023988:"IFCENGINETYPE",2397081782:"IFCELEMENTASSEMBLYTYPE",2323601079:"IFCDOORTYPE",1213902940:"IFCCYLINDRICALSURFACE",1525564444:"IFCCONSTRUCTIONPRODUCTRESOURCETYPE",4105962743:"IFCCONSTRUCTIONMATERIALRESOURCETYPE",2185764099:"IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE",15328376:"IFCCOMPOSITECURVEONSURFACE",3875453745:"IFCCOMPLEXPROPERTYTEMPLATE",3893394355:"IFCCIVILELEMENTTYPE",2197970202:"IFCCHIMNEYTYPE",167062518:"IFCBSPLINESURFACEWITHKNOTS",2887950389:"IFCBSPLINESURFACE",2603310189:"IFCADVANCEDBREPWITHVOIDS",1635779807:"IFCADVANCEDBREP",2916149573:"IFCTRIANGULATEDFACESET",1935646853:"IFCTOROIDALSURFACE",2387106220:"IFCTESSELLATEDFACESET",3206491090:"IFCTASKTYPE",699246055:"IFCSURFACECURVE",4095615324:"IFCSUBCONTRACTRESOURCETYPE",603775116:"IFCSTRUCTURALSURFACEREACTION",4015995234:"IFCSPHERICALSURFACE",2481509218:"IFCSPATIALZONETYPE",463610769:"IFCSPATIALZONE",710998568:"IFCSPATIALELEMENTTYPE",1412071761:"IFCSPATIALELEMENT",3663146110:"IFCSIMPLEPROPERTYTEMPLATE",3243963512:"IFCREVOLVEDAREASOLIDTAPERED",816062949:"IFCREPARAMETRISEDCOMPOSITECURVESEGMENT",1521410863:"IFCRELSPACEBOUNDARY2NDLEVEL",3523091289:"IFCRELSPACEBOUNDARY1STLEVEL",427948657:"IFCRELINTERFERESELEMENTS",307848117:"IFCRELDEFINESBYTEMPLATE",1462361463:"IFCRELDEFINESBYOBJECT",2565941209:"IFCRELDECLARES",1027710054:"IFCRELASSIGNSTOGROUPBYFACTOR",3521284610:"IFCPROPERTYTEMPLATE",492091185:"IFCPROPERTYSETTEMPLATE",653396225:"IFCPROJECTLIBRARY",569719735:"IFCPROCEDURETYPE",3967405729:"IFCPREDEFINEDPROPERTYSET",1682466193:"IFCPCURVE",428585644:"IFCLABORRESOURCETYPE",2294589976:"IFCINDEXEDPOLYGONALFACEWITHVOIDS",178912537:"IFCINDEXEDPOLYGONALFACE",4095422895:"IFCGEOGRAPHICELEMENTTYPE",2652556860:"IFCFIXEDREFERENCESWEPTAREASOLID",2804161546:"IFCEXTRUDEDAREASOLIDTAPERED",4024345920:"IFCEVENTTYPE",2629017746:"IFCCURVEBOUNDEDSURFACE",1815067380:"IFCCREWRESOURCETYPE",3419103109:"IFCCONTEXT",2574617495:"IFCCONSTRUCTIONRESOURCETYPE",2059837836:"IFCCARTESIANPOINTLIST3D",1675464909:"IFCCARTESIANPOINTLIST2D",574549367:"IFCCARTESIANPOINTLIST",3406155212:"IFCADVANCEDFACE",3698973494:"IFCTYPERESOURCE",3736923433:"IFCTYPEPROCESS",901063453:"IFCTESSELLATEDITEM",1096409881:"IFCSWEPTDISKSOLIDPOLYGONAL",1042787934:"IFCRESOURCETIME",1608871552:"IFCRESOURCECONSTRAINTRELATIONSHIP",2943643501:"IFCRESOURCEAPPROVALRELATIONSHIP",2090586900:"IFCQUANTITYSET",1482703590:"IFCPROPERTYTEMPLATEDEFINITION",3778827333:"IFCPREDEFINEDPROPERTIES",2998442950:"IFCMIRROREDPROFILEDEF",853536259:"IFCMATERIALRELATIONSHIP",3404854881:"IFCMATERIALPROFILESETUSAGETAPERING",3079605661:"IFCMATERIALPROFILESETUSAGE",2852063980:"IFCMATERIALCONSTITUENTSET",3708119e3:"IFCMATERIALCONSTITUENT",1585845231:"IFCLAGTIME",2133299955:"IFCINDEXEDTRIANGLETEXTUREMAP",1437953363:"IFCINDEXEDTEXTUREMAP",3570813810:"IFCINDEXEDCOLOURMAP",1437805879:"IFCEXTERNALREFERENCERELATIONSHIP",297599258:"IFCEXTENDEDPROPERTIES",211053100:"IFCEVENTTIME",2713554722:"IFCCONVERSIONBASEDUNITWITHOFFSET",3285139300:"IFCCOLOURRGBLIST",1236880293:"IFCWORKTIME",1199560280:"IFCTIMEPERIOD",3611470254:"IFCTEXTUREVERTEXLIST",2771591690:"IFCTASKTIMERECURRING",1549132990:"IFCTASKTIME",2043862942:"IFCTABLECOLUMN",2934153892:"IFCSURFACEREINFORCEMENTAREA",609421318:"IFCSTRUCTURALLOADORRESULT",3478079324:"IFCSTRUCTURALLOADCONFIGURATION",1054537805:"IFCSCHEDULINGTIME",2439245199:"IFCRESOURCELEVELRELATIONSHIP",2433181523:"IFCREFERENCE",3915482550:"IFCRECURRENCEPATTERN",986844984:"IFCPROPERTYABSTRACTION",3843373140:"IFCPROJECTEDCRS",677532197:"IFCPRESENTATIONITEM",1507914824:"IFCMATERIALUSAGEDEFINITION",552965576:"IFCMATERIALPROFILEWITHOFFSETS",164193824:"IFCMATERIALPROFILESET",2235152071:"IFCMATERIALPROFILE",1847252529:"IFCMATERIALLAYERWITHOFFSETS",760658860:"IFCMATERIALDEFINITION",3057273783:"IFCMAPCONVERSION",4294318154:"IFCEXTERNALINFORMATION",1466758467:"IFCCOORDINATEREFERENCESYSTEM",1785450214:"IFCCOORDINATEOPERATION",775493141:"IFCCONNECTIONVOLUMEGEOMETRY",979691226:"IFCREINFORCINGBAR",3700593921:"IFCELECTRICDISTRIBUTIONPOINT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",578613899:"IFCCONTROLLERTYPE",2454782716:"IFCCHAMFEREDGEFEATURE",753842376:"IFCBEAM",3001207471:"IFCALARMTYPE",2874132201:"IFCACTUATORTYPE",3304561284:"IFCWINDOW",3512223829:"IFCWALLSTANDARDCASE",2391406946:"IFCWALL",3313531582:"IFCVIBRATIONISOLATORTYPE",2347447852:"IFCTENDONANCHOR",3824725483:"IFCTENDON",2515109513:"IFCSTRUCTURALANALYSISMODEL",4252922144:"IFCSTAIRFLIGHT",331165859:"IFCSTAIR",1529196076:"IFCSLAB",1783015770:"IFCSENSORTYPE",1376911519:"IFCROUNDEDEDGEFEATURE",2016517767:"IFCROOF",2320036040:"IFCREINFORCINGMESH",3027567501:"IFCREINFORCINGELEMENT",3055160366:"IFCRATIONALBEZIERCURVE",3283111854:"IFCRAMPFLIGHT",3024970846:"IFCRAMP",2262370178:"IFCRAILING",3171933400:"IFCPLATE",1687234759:"IFCPILE",1073191201:"IFCMEMBER",900683007:"IFCFOOTING",3508470533:"IFCFLOWTREATMENTDEVICE",2223149337:"IFCFLOWTERMINAL",707683696:"IFCFLOWSTORAGEDEVICE",987401354:"IFCFLOWSEGMENT",3132237377:"IFCFLOWMOVINGDEVICE",4037862832:"IFCFLOWINSTRUMENTTYPE",4278956645:"IFCFLOWFITTING",2058353004:"IFCFLOWCONTROLLER",4222183408:"IFCFIRESUPPRESSIONTERMINALTYPE",1810631287:"IFCFILTERTYPE",346874300:"IFCFANTYPE",1658829314:"IFCENERGYCONVERSIONDEVICE",857184966:"IFCELECTRICALELEMENT",1634875225:"IFCELECTRICALCIRCUIT",712377611:"IFCELECTRICTIMECONTROLTYPE",1217240411:"IFCELECTRICMOTORTYPE",1365060375:"IFCELECTRICHEATERTYPE",1534661035:"IFCELECTRICGENERATORTYPE",3277789161:"IFCELECTRICFLOWSTORAGEDEVICETYPE",663422040:"IFCELECTRICAPPLIANCETYPE",855621170:"IFCEDGEFEATURE",2030761528:"IFCDUCTSILENCERTYPE",3760055223:"IFCDUCTSEGMENTTYPE",869906466:"IFCDUCTFITTINGTYPE",395920057:"IFCDOOR",3041715199:"IFCDISTRIBUTIONPORT",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",1945004755:"IFCDISTRIBUTIONELEMENT",2063403501:"IFCDISTRIBUTIONCONTROLELEMENTTYPE",1599208980:"IFCDISTRIBUTIONCHAMBERELEMENTTYPE",2635815018:"IFCDISCRETEACCESSORYTYPE",1335981549:"IFCDISCRETEACCESSORY",4147604152:"IFCDIAMETERDIMENSION",3961806047:"IFCDAMPERTYPE",3495092785:"IFCCURTAINWALL",1973544240:"IFCCOVERING",2954562838:"IFCCOOLINGTOWERTYPE",335055490:"IFCCOOLEDBEAMTYPE",488727124:"IFCCONSTRUCTIONPRODUCTRESOURCE",1060000209:"IFCCONSTRUCTIONMATERIALRESOURCE",3898045240:"IFCCONSTRUCTIONEQUIPMENTRESOURCE",1163958913:"IFCCONDITIONCRITERION",2188551683:"IFCCONDITION",2816379211:"IFCCONDENSERTYPE",3850581409:"IFCCOMPRESSORTYPE",843113511:"IFCCOLUMN",2301859152:"IFCCOILTYPE",2611217952:"IFCCIRCLE",2951183804:"IFCCHILLERTYPE",1285652485:"IFCCABLESEGMENTTYPE",3293546465:"IFCCABLECARRIERSEGMENTTYPE",395041908:"IFCCABLECARRIERFITTINGTYPE",1909888760:"IFCBUILDINGELEMENTPROXYTYPE",1095909175:"IFCBUILDINGELEMENTPROXY",2979338954:"IFCBUILDINGELEMENTPART",52481810:"IFCBUILDINGELEMENTCOMPONENT",3299480353:"IFCBUILDINGELEMENT",231477066:"IFCBOILERTYPE",1916977116:"IFCBEZIERCURVE",819618141:"IFCBEAMTYPE",1967976161:"IFCBSPLINECURVE",3460190687:"IFCASSET",2470393545:"IFCANGULARDIMENSION",1871374353:"IFCAIRTOAIRHEATRECOVERYTYPE",3352864051:"IFCAIRTERMINALTYPE",1411407467:"IFCAIRTERMINALBOXTYPE",3821786052:"IFCACTIONREQUEST",1213861670:"IFC2DCOMPOSITECURVE",1033361043:"IFCZONE",3342526732:"IFCWORKSCHEDULE",4218914973:"IFCWORKPLAN",1028945134:"IFCWORKCONTROL",1133259667:"IFCWASTETERMINALTYPE",1898987631:"IFCWALLTYPE",2769231204:"IFCVIRTUALELEMENT",728799441:"IFCVALVETYPE",1911125066:"IFCUNITARYEQUIPMENTTYPE",1600972822:"IFCTUBEBUNDLETYPE",3593883385:"IFCTRIMMEDCURVE",1620046519:"IFCTRANSPORTELEMENT",1692211062:"IFCTRANSFORMERTYPE",1637806684:"IFCTIMESERIESSCHEDULE",5716631:"IFCTANKTYPE",2254336722:"IFCSYSTEM",2315554128:"IFCSWITCHINGDEVICETYPE",148013059:"IFCSUBCONTRACTRESOURCE",1975003073:"IFCSTRUCTURALSURFACECONNECTION",2986769608:"IFCSTRUCTURALRESULTGROUP",1235345126:"IFCSTRUCTURALPOINTREACTION",734778138:"IFCSTRUCTURALPOINTCONNECTION",2082059205:"IFCSTRUCTURALPOINTACTION",3987759626:"IFCSTRUCTURALPLANARACTIONVARYING",1621171031:"IFCSTRUCTURALPLANARACTION",1252848954:"IFCSTRUCTURALLOADGROUP",1721250024:"IFCSTRUCTURALLINEARACTIONVARYING",1807405624:"IFCSTRUCTURALLINEARACTION",2445595289:"IFCSTRUCTURALCURVEMEMBERVARYING",214636428:"IFCSTRUCTURALCURVEMEMBER",4243806635:"IFCSTRUCTURALCURVECONNECTION",1179482911:"IFCSTRUCTURALCONNECTION",682877961:"IFCSTRUCTURALACTION",1039846685:"IFCSTAIRFLIGHTTYPE",3112655638:"IFCSTACKTERMINALTYPE",3812236995:"IFCSPACETYPE",652456506:"IFCSPACEPROGRAM",1305183839:"IFCSPACEHEATERTYPE",3856911033:"IFCSPACE",2533589738:"IFCSLABTYPE",4097777520:"IFCSITE",4105383287:"IFCSERVICELIFE",3517283431:"IFCSCHEDULETIMECONTROL",1768891740:"IFCSANITARYTERMINALTYPE",2863920197:"IFCRELASSIGNSTASKS",160246688:"IFCRELAGGREGATES",2324767716:"IFCRAMPFLIGHTTYPE",2893384427:"IFCRAILINGTYPE",3248260540:"IFCRADIUSDIMENSION",2250791053:"IFCPUMPTYPE",1842657554:"IFCPROTECTIVEDEVICETYPE",3651124850:"IFCPROJECTIONELEMENT",3642467123:"IFCPROJECTORDERRECORD",2904328755:"IFCPROJECTORDER",2744685151:"IFCPROCEDURE",3740093272:"IFCPORT",3724593414:"IFCPOLYLINE",4017108033:"IFCPLATETYPE",4231323485:"IFCPIPESEGMENTTYPE",804291784:"IFCPIPEFITTINGTYPE",3327091369:"IFCPERMIT",2382730787:"IFCPERFORMANCEHISTORY",2837617999:"IFCOUTLETTYPE",3425660407:"IFCORDERACTION",3588315303:"IFCOPENINGELEMENT",4143007308:"IFCOCCUPANT",1916936684:"IFCMOVE",977012517:"IFCMOTORCONNECTIONTYPE",3181161470:"IFCMEMBERTYPE",2108223431:"IFCMECHANICALFASTENERTYPE",377706215:"IFCMECHANICALFASTENER",2506943328:"IFCLINEARDIMENSION",1161773419:"IFCLIGHTFIXTURETYPE",1051575348:"IFCLAMPTYPE",3827777499:"IFCLABORRESOURCE",4288270099:"IFCJUNCTIONBOXTYPE",2391368822:"IFCINVENTORY",1806887404:"IFCHUMIDIFIERTYPE",1251058090:"IFCHEATEXCHANGERTYPE",2706460486:"IFCGROUP",3009204131:"IFCGRID",200128114:"IFCGASTERMINALTYPE",814719939:"IFCFURNITURESTANDARD",263784265:"IFCFURNISHINGELEMENT",3009222698:"IFCFLOWTREATMENTDEVICETYPE",2297155007:"IFCFLOWTERMINALTYPE",1339347760:"IFCFLOWSTORAGEDEVICETYPE",1834744321:"IFCFLOWSEGMENTTYPE",1482959167:"IFCFLOWMOVINGDEVICETYPE",3815607619:"IFCFLOWMETERTYPE",3198132628:"IFCFLOWFITTINGTYPE",3907093117:"IFCFLOWCONTROLLERTYPE",1287392070:"IFCFEATUREELEMENTSUBTRACTION",2143335405:"IFCFEATUREELEMENTADDITION",2827207264:"IFCFEATUREELEMENT",2489546625:"IFCFASTENERTYPE",647756555:"IFCFASTENER",3737207727:"IFCFACETEDBREPWITHVOIDS",807026263:"IFCFACETEDBREP",3390157468:"IFCEVAPORATORTYPE",3174744832:"IFCEVAPORATIVECOOLERTYPE",3272907226:"IFCEQUIPMENTSTANDARD",1962604670:"IFCEQUIPMENTELEMENT",2107101300:"IFCENERGYCONVERSIONDEVICETYPE",1704287377:"IFCELLIPSE",2590856083:"IFCELEMENTCOMPONENTTYPE",1623761950:"IFCELEMENTCOMPONENT",4123344466:"IFCELEMENTASSEMBLY",1758889154:"IFCELEMENT",360485395:"IFCELECTRICALBASEPROPERTIES",3849074793:"IFCDISTRIBUTIONFLOWELEMENTTYPE",3256556792:"IFCDISTRIBUTIONELEMENTTYPE",681481545:"IFCDIMENSIONCURVEDIRECTEDCALLOUT",1457835157:"IFCCURTAINWALLTYPE",3295246426:"IFCCREWRESOURCE",1916426348:"IFCCOVERINGTYPE",1419761937:"IFCCOSTSCHEDULE",3895139033:"IFCCOSTITEM",3293443760:"IFCCONTROL",2559216714:"IFCCONSTRUCTIONRESOURCE",2510884976:"IFCCONIC",3732776249:"IFCCOMPOSITECURVE",300633059:"IFCCOLUMNTYPE",2937912522:"IFCCIRCLEHOLLOWPROFILEDEF",3124254112:"IFCBUILDINGSTOREY",1950629157:"IFCBUILDINGELEMENTTYPE",4031249490:"IFCBUILDING",1260505505:"IFCBOUNDEDCURVE",3649129432:"IFCBOOLEANCLIPPINGRESULT",1334484129:"IFCBLOCK",3207858831:"IFCASYMMETRICISHAPEPROFILEDEF",1674181508:"IFCANNOTATION",2296667514:"IFCACTOR",2097647324:"IFCTRANSPORTELEMENTTYPE",3473067441:"IFCTASK",1580310250:"IFCSYSTEMFURNITUREELEMENTTYPE",4124788165:"IFCSURFACEOFREVOLUTION",2809605785:"IFCSURFACEOFLINEAREXTRUSION",2028607225:"IFCSURFACECURVESWEPTAREASOLID",4070609034:"IFCSTRUCTUREDDIMENSIONCALLOUT",2218152070:"IFCSTRUCTURALSURFACEMEMBERVARYING",3979015343:"IFCSTRUCTURALSURFACEMEMBER",3689010777:"IFCSTRUCTURALREACTION",530289379:"IFCSTRUCTURALMEMBER",3136571912:"IFCSTRUCTURALITEM",3544373492:"IFCSTRUCTURALACTIVITY",451544542:"IFCSPHERE",3893378262:"IFCSPATIALSTRUCTUREELEMENTTYPE",2706606064:"IFCSPATIALSTRUCTUREELEMENT",3626867408:"IFCRIGHTCIRCULARCYLINDER",4158566097:"IFCRIGHTCIRCULARCONE",1856042241:"IFCREVOLVEDAREASOLID",2914609552:"IFCRESOURCE",1401173127:"IFCRELVOIDSELEMENT",3451746338:"IFCRELSPACEBOUNDARY",366585022:"IFCRELSERVICESBUILDINGS",4122056220:"IFCRELSEQUENCE",1058617721:"IFCRELSCHEDULESCOSTITEMS",1245217292:"IFCRELREFERENCEDINSPATIALSTRUCTURE",750771296:"IFCRELPROJECTSELEMENT",202636808:"IFCRELOVERRIDESPROPERTIES",2051452291:"IFCRELOCCUPIESSPACES",3268803585:"IFCRELNESTS",4189434867:"IFCRELINTERACTIONREQUIREMENTS",279856033:"IFCRELFLOWCONTROLELEMENTS",3940055652:"IFCRELFILLSELEMENT",781010003:"IFCRELDEFINESBYTYPE",4186316022:"IFCRELDEFINESBYPROPERTIES",693640335:"IFCRELDEFINES",2551354335:"IFCRELDECOMPOSES",2802773753:"IFCRELCOVERSSPACES",886880790:"IFCRELCOVERSBLDGELEMENTS",3242617779:"IFCRELCONTAINEDINSPATIALSTRUCTURE",3678494232:"IFCRELCONNECTSWITHREALIZINGELEMENTS",504942748:"IFCRELCONNECTSWITHECCENTRICITY",1638771189:"IFCRELCONNECTSSTRUCTURALMEMBER",3912681535:"IFCRELCONNECTSSTRUCTURALELEMENT",2127690289:"IFCRELCONNECTSSTRUCTURALACTIVITY",3190031847:"IFCRELCONNECTSPORTS",4201705270:"IFCRELCONNECTSPORTTOELEMENT",3945020480:"IFCRELCONNECTSPATHELEMENTS",1204542856:"IFCRELCONNECTSELEMENTS",826625072:"IFCRELCONNECTS",2851387026:"IFCRELASSOCIATESPROFILEPROPERTIES",2655215786:"IFCRELASSOCIATESMATERIAL",3840914261:"IFCRELASSOCIATESLIBRARY",982818633:"IFCRELASSOCIATESDOCUMENT",2728634034:"IFCRELASSOCIATESCONSTRAINT",919958153:"IFCRELASSOCIATESCLASSIFICATION",4095574036:"IFCRELASSOCIATESAPPROVAL",1327628568:"IFCRELASSOCIATESAPPLIEDVALUE",1865459582:"IFCRELASSOCIATES",205026976:"IFCRELASSIGNSTORESOURCE",3372526763:"IFCRELASSIGNSTOPROJECTORDER",2857406711:"IFCRELASSIGNSTOPRODUCT",4278684876:"IFCRELASSIGNSTOPROCESS",1307041759:"IFCRELASSIGNSTOGROUP",2495723537:"IFCRELASSIGNSTOCONTROL",1683148259:"IFCRELASSIGNSTOACTOR",3939117080:"IFCRELASSIGNS",3454111270:"IFCRECTANGULARTRIMMEDSURFACE",2798486643:"IFCRECTANGULARPYRAMID",2770003689:"IFCRECTANGLEHOLLOWPROFILEDEF",3219374653:"IFCPROXY",1451395588:"IFCPROPERTYSET",4194566429:"IFCPROJECTIONCURVE",103090709:"IFCPROJECT",4208778838:"IFCPRODUCT",2945172077:"IFCPROCESS",220341763:"IFCPLANE",603570806:"IFCPLANARBOX",3566463478:"IFCPERMEABLECOVERINGPROPERTIES",3505215534:"IFCOFFSETCURVE3D",3388369263:"IFCOFFSETCURVE2D",3888040117:"IFCOBJECT",1425443689:"IFCMANIFOLDSOLIDBREP",1281925730:"IFCLINE",572779678:"IFCLSHAPEPROFILEDEF",1484403080:"IFCISHAPEPROFILEDEF",987898635:"IFCGEOMETRICCURVESET",1268542332:"IFCFURNITURETYPE",4238390223:"IFCFURNISHINGELEMENTTYPE",3455213021:"IFCFLUIDFLOWPROPERTIES",315944413:"IFCFILLAREASTYLETILES",4203026998:"IFCFILLAREASTYLETILESYMBOLWITHSTYLE",374418227:"IFCFILLAREASTYLEHATCHING",2047409740:"IFCFACEBASEDSURFACEMODEL",477187591:"IFCEXTRUDEDAREASOLID",80994333:"IFCENERGYPROPERTIES",2835456948:"IFCELLIPSEPROFILEDEF",2777663545:"IFCELEMENTARYSURFACE",339256511:"IFCELEMENTTYPE",1883228015:"IFCELEMENTQUANTITY",1472233963:"IFCEDGELOOP",4006246654:"IFCDRAUGHTINGPREDEFINEDCURVEFONT",445594917:"IFCDRAUGHTINGPREDEFINEDCOLOUR",3073041342:"IFCDRAUGHTINGCALLOUT",526551008:"IFCDOORSTYLE",1714330368:"IFCDOORPANELPROPERTIES",2963535650:"IFCDOORLININGPROPERTIES",32440307:"IFCDIRECTION",4054601972:"IFCDIMENSIONCURVETERMINATOR",606661476:"IFCDIMENSIONCURVE",693772133:"IFCDEFINEDSYMBOL",2827736869:"IFCCURVEBOUNDEDPLANE",2601014836:"IFCCURVE",2147822146:"IFCCSGSOLID",2506170314:"IFCCSGPRIMITIVE3D",194851669:"IFCCRANERAILFSHAPEPROFILEDEF",4133800736:"IFCCRANERAILASHAPEPROFILEDEF",2485617015:"IFCCOMPOSITECURVESEGMENT",2205249479:"IFCCLOSEDSHELL",1383045692:"IFCCIRCLEPROFILEDEF",1416205885:"IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM",3331915920:"IFCCARTESIANTRANSFORMATIONOPERATOR3D",3486308946:"IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM",3749851601:"IFCCARTESIANTRANSFORMATIONOPERATOR2D",59481748:"IFCCARTESIANTRANSFORMATIONOPERATOR",1123145078:"IFCCARTESIANPOINT",2898889636:"IFCCSHAPEPROFILEDEF",2713105998:"IFCBOXEDHALFSPACE",2581212453:"IFCBOUNDINGBOX",4182860854:"IFCBOUNDEDSURFACE",2736907675:"IFCBOOLEANRESULT",2740243338:"IFCAXIS2PLACEMENT3D",3125803723:"IFCAXIS2PLACEMENT2D",4261334040:"IFCAXIS1PLACEMENT",1302238472:"IFCANNOTATIONSURFACE",2265737646:"IFCANNOTATIONFILLAREAOCCURRENCE",669184980:"IFCANNOTATIONFILLAREA",3288037868:"IFCANNOTATIONCURVEOCCURRENCE",2543172580:"IFCZSHAPEPROFILEDEF",1299126871:"IFCWINDOWSTYLE",512836454:"IFCWINDOWPANELPROPERTIES",336235671:"IFCWINDOWLININGPROPERTIES",2759199220:"IFCVERTEXLOOP",1417489154:"IFCVECTOR",427810014:"IFCUSHAPEPROFILEDEF",2347495698:"IFCTYPEPRODUCT",1628702193:"IFCTYPEOBJECT",1345879162:"IFCTWODIRECTIONREPEATFACTOR",2715220739:"IFCTRAPEZIUMPROFILEDEF",3124975700:"IFCTEXTLITERALWITHEXTENT",4282788508:"IFCTEXTLITERAL",3028897424:"IFCTERMINATORSYMBOL",3071757647:"IFCTSHAPEPROFILEDEF",230924584:"IFCSWEPTSURFACE",1260650574:"IFCSWEPTDISKSOLID",2247615214:"IFCSWEPTAREASOLID",1878645084:"IFCSURFACESTYLERENDERING",2513912981:"IFCSURFACE",2233826070:"IFCSUBEDGE",3653947884:"IFCSTRUCTURALSTEELPROFILEPROPERTIES",3843319758:"IFCSTRUCTURALPROFILEPROPERTIES",1190533807:"IFCSTRUCTURALLOADSINGLEFORCEWARPING",1597423693:"IFCSTRUCTURALLOADSINGLEFORCE",1973038258:"IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION",2473145415:"IFCSTRUCTURALLOADSINGLEDISPLACEMENT",2668620305:"IFCSTRUCTURALLOADPLANARFORCE",1595516126:"IFCSTRUCTURALLOADLINEARFORCE",390701378:"IFCSPACETHERMALLOADPROPERTIES",1202362311:"IFCSOUNDVALUE",2485662743:"IFCSOUNDPROPERTIES",723233188:"IFCSOLIDMODEL",2609359061:"IFCSLIPPAGECONNECTIONCONDITION",4124623270:"IFCSHELLBASEDSURFACEMODEL",2411513650:"IFCSERVICELIFEFACTOR",1509187699:"IFCSECTIONEDSPINE",2778083089:"IFCROUNDEDRECTANGLEPROFILEDEF",478536968:"IFCRELATIONSHIP",3765753017:"IFCREINFORCEMENTDEFINITIONPROPERTIES",3413951693:"IFCREGULARTIMESERIES",3615266464:"IFCRECTANGLEPROFILEDEF",110355661:"IFCPROPERTYTABLEVALUE",3650150729:"IFCPROPERTYSINGLEVALUE",3357820518:"IFCPROPERTYSETDEFINITION",941946838:"IFCPROPERTYREFERENCEVALUE",2752243245:"IFCPROPERTYLISTVALUE",4166981789:"IFCPROPERTYENUMERATEDVALUE",1680319473:"IFCPROPERTYDEFINITION",871118103:"IFCPROPERTYBOUNDEDVALUE",673634403:"IFCPRODUCTDEFINITIONSHAPE",179317114:"IFCPREDEFINEDPOINTMARKERSYMBOL",433424934:"IFCPREDEFINEDDIMENSIONSYMBOL",2559016684:"IFCPREDEFINEDCURVEFONT",759155922:"IFCPREDEFINEDCOLOUR",2775532180:"IFCPOLYGONALBOUNDEDHALFSPACE",2924175390:"IFCPOLYLOOP",1423911732:"IFCPOINTONSURFACE",4022376103:"IFCPOINTONCURVE",2067069095:"IFCPOINT",1663979128:"IFCPLANAREXTENT",2004835150:"IFCPLACEMENT",597895409:"IFCPIXELTEXTURE",3021840470:"IFCPHYSICALCOMPLEXQUANTITY",2519244187:"IFCPATH",2529465313:"IFCPARAMETERIZEDPROFILEDEF",1029017970:"IFCORIENTEDEDGE",2665983363:"IFCOPENSHELL",2833995503:"IFCONEDIRECTIONREPEATFACTOR",219451334:"IFCOBJECTDEFINITION",1430189142:"IFCMECHANICALCONCRETEMATERIALPROPERTIES",2022407955:"IFCMATERIALDEFINITIONREPRESENTATION",2347385850:"IFCMAPPEDITEM",1008929658:"IFCLOOP",2624227202:"IFCLOCALPLACEMENT",3422422726:"IFCLIGHTSOURCESPOT",1520743889:"IFCLIGHTSOURCEPOSITIONAL",4266656042:"IFCLIGHTSOURCEGONIOMETRIC",2604431987:"IFCLIGHTSOURCEDIRECTIONAL",125510826:"IFCLIGHTSOURCEAMBIENT",1402838566:"IFCLIGHTSOURCE",3741457305:"IFCIRREGULARTIMESERIES",3905492369:"IFCIMAGETEXTURE",2445078500:"IFCHYGROSCOPICMATERIALPROPERTIES",812098782:"IFCHALFSPACESOLID",178086475:"IFCGRIDPLACEMENT",3590301190:"IFCGEOMETRICSET",4142052618:"IFCGEOMETRICREPRESENTATIONSUBCONTEXT",2453401579:"IFCGEOMETRICREPRESENTATIONITEM",3448662350:"IFCGEOMETRICREPRESENTATIONCONTEXT",1446786286:"IFCGENERALPROFILEPROPERTIES",803998398:"IFCGENERALMATERIALPROPERTIES",3857492461:"IFCFUELPROPERTIES",738692330:"IFCFILLAREASTYLE",4219587988:"IFCFAILURECONNECTIONCONDITION",3008276851:"IFCFACESURFACE",803316827:"IFCFACEOUTERBOUND",1809719519:"IFCFACEBOUND",2556980723:"IFCFACE",1860660968:"IFCEXTENDEDMATERIALPROPERTIES",476780140:"IFCEDGECURVE",3900360178:"IFCEDGE",4170525392:"IFCDRAUGHTINGPREDEFINEDTEXTFONT",3732053477:"IFCDOCUMENTREFERENCE",1694125774:"IFCDIMENSIONPAIR",2273265877:"IFCDIMENSIONCALLOUTRELATIONSHIP",3632507154:"IFCDERIVEDPROFILEDEF",3800577675:"IFCCURVESTYLE",2889183280:"IFCCONVERSIONBASEDUNIT",3050246964:"IFCCONTEXTDEPENDENTUNIT",45288368:"IFCCONNECTIONPOINTECCENTRICITY",1981873012:"IFCCONNECTIONCURVEGEOMETRY",370225590:"IFCCONNECTEDFACESET",1485152156:"IFCCOMPOSITEPROFILEDEF",2542286263:"IFCCOMPLEXPROPERTY",776857604:"IFCCOLOURRGB",647927063:"IFCCLASSIFICATIONREFERENCE",3150382593:"IFCCENTERLINEPROFILEDEF",616511568:"IFCBLOBTEXTURE",2705031697:"IFCARBITRARYPROFILEDEFWITHVOIDS",1310608509:"IFCARBITRARYOPENPROFILEDEF",3798115385:"IFCARBITRARYCLOSEDPROFILEDEF",2297822566:"IFCANNOTATIONTEXTOCCURRENCE",3612888222:"IFCANNOTATIONSYMBOLOCCURRENCE",962685235:"IFCANNOTATIONSURFACEOCCURRENCE",2442683028:"IFCANNOTATIONOCCURRENCE",1065908215:"IFCWATERPROPERTIES",891718957:"IFCVIRTUALGRIDINTERSECTION",1907098498:"IFCVERTEXPOINT",3304826586:"IFCVERTEXBASEDTEXTUREMAP",2799835756:"IFCVERTEX",180925521:"IFCUNITASSIGNMENT",1735638870:"IFCTOPOLOGYREPRESENTATION",1377556343:"IFCTOPOLOGICALREPRESENTATIONITEM",581633288:"IFCTIMESERIESVALUE",1718945513:"IFCTIMESERIESREFERENCERELATIONSHIP",3101149627:"IFCTIMESERIES",3317419933:"IFCTHERMALMATERIALPROPERTIES",1210645708:"IFCTEXTUREVERTEX",2552916305:"IFCTEXTUREMAP",1742049831:"IFCTEXTURECOORDINATEGENERATOR",280115917:"IFCTEXTURECOORDINATE",1484833681:"IFCTEXTSTYLEWITHBOXCHARACTERISTICS",1640371178:"IFCTEXTSTYLETEXTMODEL",2636378356:"IFCTEXTSTYLEFORDEFINEDFONT",1983826977:"IFCTEXTSTYLEFONTMODEL",1447204868:"IFCTEXTSTYLE",912023232:"IFCTELECOMADDRESS",531007025:"IFCTABLEROW",985171141:"IFCTABLE",1290481447:"IFCSYMBOLSTYLE",626085974:"IFCSURFACETEXTURE",1351298697:"IFCSURFACESTYLEWITHTEXTURES",846575682:"IFCSURFACESTYLESHADING",1607154358:"IFCSURFACESTYLEREFRACTION",3303107099:"IFCSURFACESTYLELIGHTING",1300840506:"IFCSURFACESTYLE",3049322572:"IFCSTYLEDREPRESENTATION",3958052878:"IFCSTYLEDITEM",2830218821:"IFCSTYLEMODEL",3408363356:"IFCSTRUCTURALLOADTEMPERATURE",2525727697:"IFCSTRUCTURALLOADSTATIC",2162789131:"IFCSTRUCTURALLOAD",2273995522:"IFCSTRUCTURALCONNECTIONCONDITION",3692461612:"IFCSIMPLEPROPERTY",4240577450:"IFCSHAPEREPRESENTATION",3982875396:"IFCSHAPEMODEL",867548509:"IFCSHAPEASPECT",4165799628:"IFCSECTIONREINFORCEMENTPROPERTIES",2042790032:"IFCSECTIONPROPERTIES",448429030:"IFCSIUNIT",2341007311:"IFCROOT",3679540991:"IFCRIBPLATEPROFILEPROPERTIES",1660063152:"IFCREPRESENTATIONMAP",3008791417:"IFCREPRESENTATIONITEM",3377609919:"IFCREPRESENTATIONCONTEXT",1076942058:"IFCREPRESENTATION",1222501353:"IFCRELAXATION",1580146022:"IFCREINFORCEMENTBARPROPERTIES",2692823254:"IFCREFERENCESVALUEDOCUMENT",825690147:"IFCQUANTITYWEIGHT",2405470396:"IFCQUANTITYVOLUME",3252649465:"IFCQUANTITYTIME",931644368:"IFCQUANTITYLENGTH",2093928680:"IFCQUANTITYCOUNT",2044713172:"IFCQUANTITYAREA",3710013099:"IFCPROPERTYENUMERATION",148025276:"IFCPROPERTYDEPENDENCYRELATIONSHIP",3896028662:"IFCPROPERTYCONSTRAINTRELATIONSHIP",2598011224:"IFCPROPERTY",2802850158:"IFCPROFILEPROPERTIES",3958567839:"IFCPROFILEDEF",2267347899:"IFCPRODUCTSOFCOMBUSTIONPROPERTIES",2095639259:"IFCPRODUCTREPRESENTATION",2417041796:"IFCPRESENTATIONSTYLEASSIGNMENT",3119450353:"IFCPRESENTATIONSTYLE",1304840413:"IFCPRESENTATIONLAYERWITHSTYLE",2022622350:"IFCPRESENTATIONLAYERASSIGNMENT",1775413392:"IFCPREDEFINEDTEXTFONT",3213052703:"IFCPREDEFINEDTERMINATORSYMBOL",990879717:"IFCPREDEFINEDSYMBOL",3727388367:"IFCPREDEFINEDITEM",3355820592:"IFCPOSTALADDRESS",2226359599:"IFCPHYSICALSIMPLEQUANTITY",2483315170:"IFCPHYSICALQUANTITY",101040310:"IFCPERSONANDORGANIZATION",2077209135:"IFCPERSON",1207048766:"IFCOWNERHISTORY",1411181986:"IFCORGANIZATIONRELATIONSHIP",4251960020:"IFCORGANIZATION",1227763645:"IFCOPTICALMATERIALPROPERTIES",2251480897:"IFCOBJECTIVE",3701648758:"IFCOBJECTPLACEMENT",1918398963:"IFCNAMEDUNIT",2706619895:"IFCMONETARYUNIT",3368373690:"IFCMETRIC",677618848:"IFCMECHANICALSTEELMATERIALPROPERTIES",4256014907:"IFCMECHANICALMATERIALPROPERTIES",2597039031:"IFCMEASUREWITHUNIT",3265635763:"IFCMATERIALPROPERTIES",2199411900:"IFCMATERIALLIST",1303795690:"IFCMATERIALLAYERSETUSAGE",3303938423:"IFCMATERIALLAYERSET",248100487:"IFCMATERIALLAYER",1847130766:"IFCMATERIALCLASSIFICATIONRELATIONSHIP",1838606355:"IFCMATERIAL",30780891:"IFCLOCALTIME",1566485204:"IFCLIGHTINTENSITYDISTRIBUTION",4162380809:"IFCLIGHTDISTRIBUTIONDATA",3452421091:"IFCLIBRARYREFERENCE",2655187982:"IFCLIBRARYINFORMATION",3020489413:"IFCIRREGULARTIMESERIESVALUE",852622518:"IFCGRIDAXIS",3548104201:"IFCEXTERNALLYDEFINEDTEXTFONT",3207319532:"IFCEXTERNALLYDEFINEDSYMBOL",1040185647:"IFCEXTERNALLYDEFINEDSURFACESTYLE",2242383968:"IFCEXTERNALLYDEFINEDHATCHSTYLE",3200245327:"IFCEXTERNALREFERENCE",1648886627:"IFCENVIRONMENTALIMPACTVALUE",3796139169:"IFCDRAUGHTINGCALLOUTRELATIONSHIP",770865208:"IFCDOCUMENTINFORMATIONRELATIONSHIP",1154170062:"IFCDOCUMENTINFORMATION",1376555844:"IFCDOCUMENTELECTRONICFORMAT",2949456006:"IFCDIMENSIONALEXPONENTS",1045800335:"IFCDERIVEDUNITELEMENT",1765591967:"IFCDERIVEDUNIT",1072939445:"IFCDATEANDTIME",3510044353:"IFCCURVESTYLEFONTPATTERN",2367409068:"IFCCURVESTYLEFONTANDSCALING",1105321065:"IFCCURVESTYLEFONT",539742890:"IFCCURRENCYRELATIONSHIP",602808272:"IFCCOSTVALUE",1065062679:"IFCCOORDINATEDUNIVERSALTIMEOFFSET",347226245:"IFCCONSTRAINTRELATIONSHIP",613356794:"IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP",1658513725:"IFCCONSTRAINTAGGREGATIONRELATIONSHIP",1959218052:"IFCCONSTRAINT",2732653382:"IFCCONNECTIONSURFACEGEOMETRY",4257277454:"IFCCONNECTIONPORTGEOMETRY",2614616156:"IFCCONNECTIONPOINTGEOMETRY",2859738748:"IFCCONNECTIONGEOMETRY",3264961684:"IFCCOLOURSPECIFICATION",3639012971:"IFCCLASSIFICATIONNOTATIONFACET",938368621:"IFCCLASSIFICATIONNOTATION",1098599126:"IFCCLASSIFICATIONITEMRELATIONSHIP",1767535486:"IFCCLASSIFICATIONITEM",747523909:"IFCCLASSIFICATION",622194075:"IFCCALENDARDATE",2069777674:"IFCBOUNDARYNODECONDITIONWARPING",1387855156:"IFCBOUNDARYNODECONDITION",3367102660:"IFCBOUNDARYFACECONDITION",1560379544:"IFCBOUNDARYEDGECONDITION",4037036970:"IFCBOUNDARYCONDITION",3869604511:"IFCAPPROVALRELATIONSHIP",390851274:"IFCAPPROVALPROPERTYRELATIONSHIP",2080292479:"IFCAPPROVALACTORRELATIONSHIP",130549933:"IFCAPPROVAL",1110488051:"IFCAPPLIEDVALUERELATIONSHIP",411424972:"IFCAPPLIEDVALUE",639542469:"IFCAPPLICATION",618182010:"IFCADDRESS",3630933823:"IFCACTORROLE",599546466:"FILE_DESCRIPTION",1390159747:"FILE_NAME",1109904537:"FILE_SCHEMA"};class c{static async getUnits(F){var R;const{IFCUNITASSIGNMENT:E}=w,I=await F.getAllPropertiesOfType(E);if(!I)return 1;const C=Object.keys(I),T=I[parseInt(C[0],10)];for(const A of T.Units){if(A.value===void 0||A.value===null)continue;const N=await F.getProperties(A.value);if(!N||!N.UnitType||!N.UnitType.value||N.UnitType.value!=="LENGTHUNIT")continue;let S=1,P=1;return N.Name.value==="METRE"&&(P=1),N.Name.value==="FOOT"&&(P=.3048),((R=N.Prefix)==null?void 0:R.value)==="MILLI"&&(S=.001),P*S}return 1}static async findItemByGuid(F,E){var C;const I=F.getAllPropertiesIDs();for(const T of I){const R=await F.getProperties(T);if(R&&((C=R.GlobalId)==null?void 0:C.value)===E)return R}return null}static async getRelationMap(F,E,I){var N;const T=I??(async()=>{}),R={},A=F.getAllPropertiesIDs();for(const O of A){const S=await F.getProperties(O);if(!S)continue;const P=S.type===E,M=Object.keys(S).find(s=>s.startsWith("Relating")),e=Object.keys(S).find(s=>s.startsWith("Related"));if(!(P&&M&&e))continue;const t=await F.getProperties((N=S[M])==null?void 0:N.value),U=S[e];if(!t||!U||!(U&&Array.isArray(U)))continue;const i=U.map(s=>s.value);await T(t.expressID,i),R[t.expressID]=i}return R}static async getQsetQuantities(F,E,I){const T=I??(()=>{}),R=await F.getProperties(E);return!R||R.type!==v?null:(R.Quantities??[{}]).map(O=>(O.value&&T(O.value),O.value)).filter(O=>O!==null)}static async getPsetProps(F,E,I){const T=I??(()=>{}),R=await F.getProperties(E);return!R||R.type!==x?null:(R.HasProperties??[{}]).map(O=>(O.value&&T(O.value),O.value)).filter(O=>O!==null)}static async getPsetRel(F,E){var A;if(!await F.getProperties(E))return null;const C=await F.getAllPropertiesOfType(V);if(!C)return null;const T=Object.values(C);let R=null;for(const N of T)((A=N.RelatingPropertyDefinition)==null?void 0:A.value)===E&&(R=N.expressID);return R}static async getQsetRel(F,E){return c.getPsetRel(F,E)}static async getEntityName(F,E){var R;const I=await F.getProperties(E);if(!I)return{key:null,name:null};const C=Object.keys(I).find(A=>A.endsWith("Name"))??null,T=C?(R=I[C])==null?void 0:R.value:null;return{key:C,name:T}}static async getQuantityValue(F,E){const I=await F.getProperties(E);if(!I)return{key:null,value:null};const C=Object.keys(I).find(R=>R.endsWith("Value"))??null;let T;return C===null||I[C]===void 0||I[C]===null?T=null:T=I[C].value,{key:C,value:T}}static isRel(F){return K[F].startsWith("IFCREL")}static async attributeExists(F,E,I){const C=await F.getProperties(E);return C?Object.keys(C).includes(I):!1}static async groupEntitiesByType(F,E){var C;const I=new Map;for(const T of E){const R=await F.getProperties(T);if(!R)continue;const A=R.type;I.get(A)||I.set(A,new Set),(C=I.get(A))==null||C.add(T)}return I}}const Q=new Map([[H,{forRelating:"IsDecomposedBy",forRelated:"Decomposes"}],[p,{forRelating:"AssociatedTo",forRelated:"HasAssociations"}],[f,{forRelating:"ClassificationForObjects",forRelated:"HasAssociations"}],[d,{forRelating:"IsGroupedBy",forRelated:"HasAssignments"}],[V,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[W,{forRelated:"IsTypedBy",forRelating:"Types"}],[g,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[X,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}]]),r=class r extends y{constructor(E){super(E);L(this,"onDisposed",new o);L(this,"enabled",!0);L(this,"onRelationsIndexed",new o);L(this,"_relToAttributesMap",Q);L(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements"]);L(this,"_ifcRels",[H,p,f,d,V,W,g,X]);L(this,"relationMaps",{});L(this,"onFragmentsDisposed",E=>{delete this.relationMaps[E.groupID]});this.components.add(r.uuid,this),E.get(a).onFragmentsDisposed.add(this.onFragmentsDisposed)}setRelationMap(E,I){this.relationMaps[E.uuid]=I,this.onRelationsIndexed.trigger({modelID:E.uuid,relationsMap:I})}async process(E){if(!E.hasProperties)throw new Error("FragmentsGroup properties not found");let I=this.relationMaps[E.uuid];if(I)return I;I=new Map;for(const C of this._ifcRels)await c.getRelationMap(E,C,async(T,R)=>{const A=this._relToAttributesMap.get(C);if(!A)return;const{forRelated:N,forRelating:O}=A,S=I.get(T)??new Map,P=this._inverseAttributes.indexOf(O);S.set(P,R),I.set(T,S);for(const M of R){const e=I.get(M)??new Map,t=this._inverseAttributes.indexOf(N),U=e.get(t)??[];U.push(T),e.set(t,U),I.set(M,e)}});return this.setRelationMap(E,I),I}async processFromWebIfc(E,I){const C=new Map;for(const T of this._ifcRels){const R=this._relToAttributesMap.get(T);if(!R)continue;const{forRelated:A,forRelating:N}=R,O=E.GetLineIDsWithType(I,T);for(let S=0;SD.startsWith("Relating")),e=Object.keys(P).find(D=>D.startsWith("Related"));if(!(M&&e))continue;const t=P[M].value,U=P[e].map(D=>D.value),i=C.get(t)??new Map,s=this._inverseAttributes.indexOf(N);i.set(s,U),C.set(t,i);for(const D of U){const G=C.get(D)??new Map,B=this._inverseAttributes.indexOf(A),u=G.get(B)??[];u.push(t),G.set(B,u),C.set(D,G)}}}return this.onRelationsIndexed.trigger({modelID:I.toString(),relationsMap:C}),C}getEntityRelations(E,I,C){const T=this.relationMaps[E.uuid];if(!T)return null;const R=T.get(I),A=this._inverseAttributes.indexOf(C);if(!R||A===-1)return null;const N=R.get(A);return N||null}serializeRelations(E){const I={};for(const[C,T]of E.entries()){I[C]||(I[C]={});for(const[R,A]of T.entries())I[C][R]=A}return JSON.stringify(I)}serializeModelRelations(E){const I=this.relationMaps[E.uuid];return I?this.serializeRelations(I):null}serializeAllRelations(){const E={};for(const I in this.relationMaps){const C=this.relationMaps[I],T={};for(const[R,A]of C.entries()){T[R]||(T[R]={});for(const[N,O]of A.entries())T[R][N]=O}E[I]=T}return JSON.stringify(E)}getRelationsMapFromJSON(E){const I=JSON.parse(E),C=new Map;for(const T in I){const R=I[T],A=new Map;for(const N in R)A.set(Number(N),R[N]);C.set(Number(T),A)}return C}dispose(){this.relationMaps={},this.components.get(a).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(r.uuid),this.onDisposed.reset()}};L(r,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let l=r;export{a as F,l as I,c as a}; diff --git a/examples/assets/index-s8v5I1cn.js b/examples/assets/index-CwB6Igrg.js similarity index 86% rename from examples/assets/index-s8v5I1cn.js rename to examples/assets/index-CwB6Igrg.js index 0751d942a..30cb2ff41 100644 --- a/examples/assets/index-s8v5I1cn.js +++ b/examples/assets/index-CwB6Igrg.js @@ -1 +1 @@ -var f=Object.defineProperty;var g=(d,n,e)=>n in d?f(d,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[n]=e;var t=(d,n,e)=>(g(d,typeof n!="symbol"?n+"":n,e),e);import{L as u,V as m,O as _}from"./web-ifc-api-BC8YMRiS.js";import{J as v,U as l,H as c}from"./index-b4ozRbQy.js";import{S as b}from"./index-MPPnu1_m.js";import{n as p}from"./dimension-mark-BiAWnjiH.js";import{G as x}from"./graphic-vertex-picker-CEs1V3AG.js";const h=class h extends v{constructor(e){super(e);t(this,"onDisposed",new l);t(this,"onBeforeUpdate",new l);t(this,"onAfterUpdate",new l);t(this,"snapDistance",.25);t(this,"_vertexPicker");t(this,"_lineMaterial",new u({color:"#DC2626",linewidth:2,depthTest:!1}));t(this,"list",[]);t(this,"world");t(this,"_visible",!0);t(this,"_enabled",!1);t(this,"_temp",{isDragging:!1,start:new m,end:new m,dimension:void 0});t(this,"create",e=>{const s=e instanceof _?e:void 0;if(this._enabled){if(!this._temp.isDragging){this.drawStart(s);return}this.endCreation()}});t(this,"onMouseMove",()=>{this.world&&this._vertexPicker.get(this.world)});this.components.add(h.uuid,this),this._vertexPicker=new x(e,{previewElement:p(),snapDistance:this.snapDistance})}get enabled(){return this._enabled}set enabled(e){e||this.cancelCreation(),this._enabled=e,this._vertexPicker.enabled=e,this.setupEvents(e)}get visible(){return this._visible}set visible(e){this._visible=e;for(const s of this.list)s.visible=e}get color(){return this._lineMaterial.color}set color(e){this._lineMaterial.color=e}dispose(){this.setupEvents(!1),this.enabled=!1;for(const e of this.list)e.dispose();this._lineMaterial.dispose(),this.list=[],this._vertexPicker.dispose(),this.onDisposed.trigger(h.uuid),this.onDisposed.reset()}async update(e){this._enabled&&this._temp.isDragging&&this.drawInProcess()}createOnPoints(e,s){const i=this.drawDimension();i.startPoint=e,i.endPoint=s,i.createBoundingBox(),this.list.push(i)}delete(){if(!this.world)throw new Error("World is needed for Length Measurement!");if(!this._enabled||this.list.length===0)return;const e=this.getBoundingBoxes(),r=this.components.get(c).get(this.world).castRay(e);if(!r)return;const o=this.list.find(a=>a.boundingBox===r.object);if(o){const a=this.list.indexOf(o);this.list.splice(a,1),o.dispose()}}async deleteMeasurement(e){if(e){const s=this.list.indexOf(e);this.list.splice(s,1),e.dispose()}}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}cancelCreation(){var e;this._temp.dimension&&(this._temp.isDragging=!1,(e=this._temp.dimension)==null||e.dispose(),this._temp.dimension=void 0)}drawStart(e){if(!this.world)throw new Error("The length measurement needs a world to work!");const s=e?[e]:void 0,o=this.components.get(c).get(this.world).castRay(s),a=this._vertexPicker.get(this.world);o&&a&&(this._temp.isDragging=!0,this._temp.start=e?o.point:a)}drawInProcess(){if(!this.world)throw new Error("The length measurement needs a world to work!");if(!this.components.get(c).get(this.world).castRay())return;const r=this._vertexPicker.get(this.world);r&&(this._temp.end=r,this._temp.dimension||(this._temp.dimension=this.drawDimension()),this._temp.dimension.endPoint=this._temp.end)}endCreation(){this._temp.dimension&&(this._temp.dimension.createBoundingBox(),this.list.push(this._temp.dimension),this._temp.dimension=void 0,this._temp.isDragging=!1)}drawDimension(){if(!this.world)throw new Error("The length measurement needs a world to work!");return new b(this.components,this.world,{start:this._temp.start,end:this._temp.end,lineMaterial:this._lineMaterial,endpointElement:p()})}getBoundingBoxes(){return this.list.map(e=>e.boundingBox).filter(e=>e!==void 0)}setupEvents(e){if(!this.world)throw new Error("The length measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the length measurement needs a renderer!");const i=this.world.renderer.three.domElement.parentElement;i&&(i.removeEventListener("click",this.create),e&&i.addEventListener("mousemove",this.onMouseMove))}};t(h,"uuid","2f9bcacf-18a9-4be6-a293-e898eae64ea1");let w=h;export{w as L}; +var f=Object.defineProperty;var g=(d,n,e)=>n in d?f(d,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[n]=e;var t=(d,n,e)=>(g(d,typeof n!="symbol"?n+"":n,e),e);import{L as u,V as m,O as _}from"./web-ifc-api-BC8YMRiS.js";import{J as v,D as l,H as c}from"./index-C-JPXu_n.js";import{S as b}from"./index-CYkvDr46.js";import{n as p}from"./dimension-mark-BiAWnjiH.js";import{G as x}from"./graphic-vertex-picker-BH9d5rBm.js";const h=class h extends v{constructor(e){super(e);t(this,"onDisposed",new l);t(this,"onBeforeUpdate",new l);t(this,"onAfterUpdate",new l);t(this,"snapDistance",.25);t(this,"_vertexPicker");t(this,"_lineMaterial",new u({color:"#DC2626",linewidth:2,depthTest:!1}));t(this,"list",[]);t(this,"world");t(this,"_visible",!0);t(this,"_enabled",!1);t(this,"_temp",{isDragging:!1,start:new m,end:new m,dimension:void 0});t(this,"create",e=>{const s=e instanceof _?e:void 0;if(this._enabled){if(!this._temp.isDragging){this.drawStart(s);return}this.endCreation()}});t(this,"onMouseMove",()=>{this.world&&this._vertexPicker.get(this.world)});this.components.add(h.uuid,this),this._vertexPicker=new x(e,{previewElement:p(),snapDistance:this.snapDistance})}get enabled(){return this._enabled}set enabled(e){e||this.cancelCreation(),this._enabled=e,this._vertexPicker.enabled=e,this.setupEvents(e)}get visible(){return this._visible}set visible(e){this._visible=e;for(const s of this.list)s.visible=e}get color(){return this._lineMaterial.color}set color(e){this._lineMaterial.color=e}dispose(){this.setupEvents(!1),this.enabled=!1;for(const e of this.list)e.dispose();this._lineMaterial.dispose(),this.list=[],this._vertexPicker.dispose(),this.onDisposed.trigger(h.uuid),this.onDisposed.reset()}async update(e){this._enabled&&this._temp.isDragging&&this.drawInProcess()}createOnPoints(e,s){const i=this.drawDimension();i.startPoint=e,i.endPoint=s,i.createBoundingBox(),this.list.push(i)}delete(){if(!this.world)throw new Error("World is needed for Length Measurement!");if(!this._enabled||this.list.length===0)return;const e=this.getBoundingBoxes(),r=this.components.get(c).get(this.world).castRay(e);if(!r)return;const o=this.list.find(a=>a.boundingBox===r.object);if(o){const a=this.list.indexOf(o);this.list.splice(a,1),o.dispose()}}async deleteMeasurement(e){if(e){const s=this.list.indexOf(e);this.list.splice(s,1),e.dispose()}}deleteAll(){for(const e of this.list)e.dispose();this.list=[]}cancelCreation(){var e;this._temp.dimension&&(this._temp.isDragging=!1,(e=this._temp.dimension)==null||e.dispose(),this._temp.dimension=void 0)}drawStart(e){if(!this.world)throw new Error("The length measurement needs a world to work!");const s=e?[e]:void 0,o=this.components.get(c).get(this.world).castRay(s),a=this._vertexPicker.get(this.world);o&&a&&(this._temp.isDragging=!0,this._temp.start=e?o.point:a)}drawInProcess(){if(!this.world)throw new Error("The length measurement needs a world to work!");if(!this.components.get(c).get(this.world).castRay())return;const r=this._vertexPicker.get(this.world);r&&(this._temp.end=r,this._temp.dimension||(this._temp.dimension=this.drawDimension()),this._temp.dimension.endPoint=this._temp.end)}endCreation(){this._temp.dimension&&(this._temp.dimension.createBoundingBox(),this.list.push(this._temp.dimension),this._temp.dimension=void 0,this._temp.isDragging=!1)}drawDimension(){if(!this.world)throw new Error("The length measurement needs a world to work!");return new b(this.components,this.world,{start:this._temp.start,end:this._temp.end,lineMaterial:this._lineMaterial,endpointElement:p()})}getBoundingBoxes(){return this.list.map(e=>e.boundingBox).filter(e=>e!==void 0)}setupEvents(e){if(!this.world)throw new Error("The length measurement needs a world to work!");if(this.world.isDisposing)return;if(!this.world.renderer)throw new Error("The world of the length measurement needs a renderer!");const i=this.world.renderer.three.domElement.parentElement;i&&(i.removeEventListener("click",this.create),e&&i.addEventListener("mousemove",this.onMouseMove))}};t(h,"uuid","2f9bcacf-18a9-4be6-a293-e898eae64ea1");let w=h;export{w as L}; diff --git a/examples/assets/index-C9jIYBP8.js b/examples/assets/index-D2zeH9ie.js similarity index 65% rename from examples/assets/index-C9jIYBP8.js rename to examples/assets/index-D2zeH9ie.js index 8dcb1c4b3..41350ff2b 100644 --- a/examples/assets/index-C9jIYBP8.js +++ b/examples/assets/index-D2zeH9ie.js @@ -1 +1 @@ -var W=Object.defineProperty;var Q=(b,h,t)=>h in b?W(b,h,{enumerable:!0,configurable:!0,writable:!0,value:t}):b[h]=t;var p=(b,h,t)=>(Q(b,typeof h!="symbol"?h+"":h,t),t);import{V as u,E as q,h as J,c as y,g as v,L as Z,Q as tt,p as I,o as et}from"./web-ifc-api-BC8YMRiS.js";import{J as B,U as V}from"./index-b4ozRbQy.js";import{a as nt}from"./index-Ch1tb-j6.js";import{M as k}from"./index-WVnKWA4H.js";import"./import-wrapper-prod-LhqN7JJy.js";import{M as x}from"./mark-Cj_PmUva.js";const ot=["Station","Radius","Length","InitialKP","FinalKP","KP","Slope","Height","InitialKPV","FinalKPV"],M=class M extends B{constructor(t){super(t);p(this,"enabled",!0);p(this,"world",null);p(this,"_list",new Map);p(this,"_markerKey",0);p(this,"type","horizontal");p(this,"divisionLength",100);t.add(M.uuid,this)}addKPStation(t,i,e){const n=this.components.get(k),s=document.createElement("div"),o=document.createElement("div");s.appendChild(o),o.innerHTML=i,o.style.color=n.color,o.style.borderBottom="1px dotted white",o.style.width="160px",o.style.textAlign="left";const a=new x(t,s),r=new u;r.x=e.geometry.attributes.position.getX(e.geometry.attributes.position.count-1),r.y=e.geometry.attributes.position.getY(e.geometry.attributes.position.count-1),r.z=e.geometry.attributes.position.getZ(e.geometry.attributes.position.count-1);const c=new u;c.x=e.geometry.attributes.position.getX(e.geometry.attributes.position.count-2),c.y=e.geometry.attributes.position.getY(e.geometry.attributes.position.count-2),c.z=e.geometry.attributes.position.getZ(e.geometry.attributes.position.count-2);const d=new u;d.x=(r.x+c.x)/2,d.y=(r.y+c.y)/2,d.z=(r.z+c.z)/2,a.three.position.copy(d);const l=new u;l.subVectors(r,c).normalize();const g=new tt;g.setFromUnitVectors(new u(0,1,0),l);const m=new q().setFromQuaternion(g).z,w=J.radToDeg(m);o.style.transform=`rotate(${-w-90}deg) translate(-35%, -50%)`;const f=this._markerKey.toString();n.setupEvents(t,!0),n.getWorldMarkerList(t).set(f,{label:a,key:f,merged:!1,static:!1}),this._markerKey++,this.save(f,"KP")}addVerticalMarker(t,i,e,n,s){const o=this.components.get(k),a=document.createElement("span");a.innerHTML=i,a.style.color=o.color;const r=new x(t,a,s);if(n==="Height"){const l=document.createElement("span");l.innerHTML=i,l.style.color=o.color;const{position:g}=e.geometry.attributes,w=(g.array.length/3-1)*3,f=g.array.slice(w,w+3);r.three.position.set(f[0],f[1]+10,f[2])}else if(n==="InitialKPV"){const{position:l}=e.geometry.attributes,g=l.getX(0),m=l.getY(0),w=l.getZ(0);r.three.position.set(g-20,m,w)}else if(n==="FinalKPV"){const{position:l}=e.geometry.attributes,g=l.getX(e.geometry.attributes.position.count-1),m=l.getY(e.geometry.attributes.position.count-1),w=l.getZ(e.geometry.attributes.position.count-1);r.three.position.set(g+20,m,w)}else if(n==="Slope"){a.style.color="grey";const{position:l}=e.geometry.attributes,g=new u;g.x=l.getX(0),g.y=l.getY(0),g.z=l.getZ(0);const m=new u;m.x=l.getX(l.count-1),m.y=l.getY(l.count-1),m.z=l.getZ(l.count-1);const w=new u;w.addVectors(g,m).multiplyScalar(.5),r.three.position.set(w.x,w.y-10,w.z)}const c=this._markerKey.toString();return o.setupEvents(t,!0),o.getWorldMarkerList(t).set(c,{label:r,key:c,type:n,merged:!1,static:!1}),this._markerKey++,this.save(c,n),r}addCivilMarker(t,i,e,n){const s=this.components.get(k),o=document.createElement("span");o.innerHTML=i,o.style.color=s.color;const a=new x(t,o);if(n==="InitialKP"){const d=e.geometry.attributes.position.getX(0),l=e.geometry.attributes.position.getY(0),g=e.geometry.attributes.position.getZ(0);a.three.position.set(d+2,l+2,g)}else if(n==="FinalKP"){const d=e.geometry.attributes.position.getX(e.geometry.attributes.position.count-1),l=e.geometry.attributes.position.getY(e.geometry.attributes.position.count-1),g=e.geometry.attributes.position.getZ(e.geometry.attributes.position.count-1);a.three.position.set(d+2,l-2,g)}else if(n==="Length"){const d=new u;d.x=e.geometry.attributes.position.getX(0),d.y=e.geometry.attributes.position.getY(0),d.z=e.geometry.attributes.position.getZ(0);const l=new u;l.x=e.geometry.attributes.position.getX(e.geometry.attributes.position.count-1),l.y=e.geometry.attributes.position.getY(e.geometry.attributes.position.count-1),l.z=e.geometry.attributes.position.getZ(e.geometry.attributes.position.count-1);const g=d.distanceTo(l);a.three.element.innerText=g.toFixed(2);const m=l.clone().add(d).divideScalar(2);a.three.position.copy(m)}const r=this._markerKey.toString();return s.setupEvents(t,!0),s.getWorldMarkerList(t).set(r,{label:a,key:r,type:n,merged:!1,static:!1}),this._markerKey++,this.save(r,n),a}showKPStations(t){if(!this.world)throw new Error("A world is needed for this component to work!");if(this.type==="horizontal"){const i=this.generateStartAndEndKP(t);for(const[,n]of i)this.addKPStation(this.world,n.value,n.normal);const e=this.generateConstantKP(t);for(const[,n]of e)this.addKPStation(this.world,n.value,n.normal)}}showCurveLength(t,i){if(!this.world)throw new Error("A world is needed for this component to work!");const e=this.components.get(k),n=t.length,s=`${i.toFixed(2)} m`,o=Math.round(n/2),a=t[o],r=e.create(this.world,s,a,!0);r!==void 0&&this.save(r,"Radius")}showLineLength(t,i){if(!this.world)throw new Error("A world is needed for this component to work!");const e=this.components.get(k),n=new u;n.x=t.geometry.getAttribute("position").getX(0),n.y=t.geometry.getAttribute("position").getY(0),n.z=t.geometry.getAttribute("position").getZ(0);const s=new u;s.x=t.geometry.getAttribute("position").getX(1),s.y=t.geometry.getAttribute("position").getY(1),s.z=t.geometry.getAttribute("position").getZ(1);const o=`${i.toFixed(2)} m`,a=new u;a.addVectors(n,s).multiplyScalar(.5);const r=e.create(this.world,o,a,!0);r!==void 0&&this.save(r,"Radius")}showCurveRadius(t,i){if(!this.world)throw new Error("A world is needed for this component to work!");const e=this.components.get(k),n=new u;n.x=t.geometry.getAttribute("position").getX(0),n.y=t.geometry.getAttribute("position").getY(0),n.z=t.geometry.getAttribute("position").getZ(0);const s=new u;s.x=t.geometry.getAttribute("position").getX(1),s.y=t.geometry.getAttribute("position").getY(1),s.z=t.geometry.getAttribute("position").getZ(1);const o=`R = ${i.toFixed(2)} m`,a=new u;a.addVectors(n,s).multiplyScalar(.5);const r=e.create(this.world,o,a,!0);r!==void 0&&this.save(r,"Radius")}deleteByType(t=ot){const i=this.components.get(k);for(const e of t){const n=this._list.get(e);if(n){for(const s of n)i.delete(s);this._list.delete(e)}}}generateStartAndEndKP(t){const{alignment:i}=t.curve,e=new Map;for(const n of i.horizontal){const s=n.getLength();if(e.size>0){const o=n.index-1,r=e.get(o).distance+s,c=n.mesh.geometry.getAttribute("position"),d=c.count-1,l=new u;l.x=c.getX(d),l.y=c.getY(d),l.z=c.getZ(d);const g=this.createNormalLine(n.mesh);e.set(n.index,{value:this.getShortendKPValue(r),distance:r,point:l,normal:g})}else{const o=n.mesh.geometry.getAttribute("position"),a=o.count-1,r=new u;r.x=o.getX(a),r.y=o.getY(a),r.z=o.getZ(a);const c=this.createNormalLine(n.mesh);e.set(n.index,{value:this.getShortendKPValue(s),distance:s,point:r,normal:c})}}return e}createNormalLine(t){const i=t.geometry.attributes.position.count-1,e=i-1,n=new u;n.x=t.geometry.attributes.position.getX(i),n.y=t.geometry.attributes.position.getY(i),n.z=t.geometry.attributes.position.getZ(i);const s=new u;s.x=t.geometry.attributes.position.getX(e),s.y=t.geometry.attributes.position.getY(e),s.z=t.geometry.attributes.position.getZ(e);const a=new u().subVectors(n,s).clone().applyAxisAngle(new u(0,0,1),Math.PI*.5).normalize(),r=new y().setFromPoints([a.clone().setLength(10).add(n),a.clone().setLength(-10).add(n)]);return new v(r)}generateConstantKP(t){const{alignment:i}=t.curve,e=new Map,n=i.getLength("horizontal"),s=Math.floor(n/this.divisionLength);for(let o=0;o1e3&&parseInt(e,10)<1e4){const[o,...a]=e;return`${o}+${a.join("")}.${s}`}if(parseInt(e,10)>1e4){const[o,a,...r]=e;return`${o}${a}+${r.join("")}.${s}`}return`0+${e.padStart(3,"0")}.${s}`}save(t,i){this._list.has(i)||this._list.set(i,new Set),this._list.get(i).add(t)}};p(M,"uuid","0af12c32-81ee-4100-a030-e9ae546f6170");let L=M;class st extends B{constructor(t){super(t);p(this,"enabled",!0);p(this,"_highlighter");p(this,"onHighlight",new V);p(this,"onMarkerChange",new V);p(this,"mouseMarkers");p(this,"onMarkerHidden",new V);p(this,"_curves",[]);p(this,"_previousAlignment",null);p(this,"_world",null);p(this,"updateLinesResolution",t=>{var i;(i=this._highlighter)==null||i.setResolution(t)});p(this,"onMouseMove",t=>{var o,a,r;if(!this._world)throw new Error("No world was given for this navigator!");if(!this._world.renderer)return;const e=this._world.renderer.three.domElement.parentElement,n=this._world.camera.three,s=(o=this._highlighter)==null?void 0:o.castRay(t,n,e,this._curves);if(s){const{object:c}=s;(a=this._highlighter)==null||a.hover(c),this.updateMarker(s,"hover");return}this.mouseMarkers&&(this.mouseMarkers.hover.visible=!1),(r=this._highlighter)==null||r.unHover(),this.onMarkerHidden.trigger({type:"hover"})});p(this,"onClick",t=>{var o,a;if(!this._world)throw new Error("No world was given for this navigator!");if(!this._world.renderer)return;const e=this._world.renderer.three.domElement.parentElement,n=this._world.camera.three,s=(o=this._highlighter)==null?void 0:o.castRay(t,n,e,this._curves);if(s){const r=s,c=r.object;if((a=this._highlighter)==null||a.select(c),this.updateMarker(r,"select"),this._world.camera.hasCameraControls()&&(c.geometry.boundingBox||c.geometry.computeBoundingBox(),c.geometry.boundingBox)){const d=this.getScaledBox(c.geometry.boundingBox,2);this._world.camera.controls.fitToBox(d,!0)}this.onHighlight.trigger({mesh:c,point:r.point}),this._previousAlignment!==c.curve.alignment&&(this.components.get(L).showKPStations(c),this._previousAlignment=c.curve.alignment)}});p(this,"onControlsUpdated",()=>{if(!this._world)throw new Error("No world was given for this navigator!");if(!(this._world.camera.three instanceof et)||!this._highlighter)return;const{zoom:t,left:i,right:e,top:n,bottom:s}=this._world.camera.three,o=i-e,a=n-s,c=Math.max(o,a)/t,d=40,{caster:l}=this._highlighter;l.params.Line.threshold=c/d})}get highlighter(){if(!this._highlighter)throw new Error("Highlighter not initialized. You must set a world first!");return this._highlighter}get world(){return this._world}set world(t){var e,n,s;if(t===this._world||(this._world&&this.setupEvents(!1),this._world=t,(e=this._highlighter)==null||e.dispose(),(n=this.mouseMarkers)==null||n.hover.dispose(),(s=this.mouseMarkers)==null||s.select.dispose(),!t))return;const i=t.scene.three;this._highlighter=new nt(i,this.view),this.mouseMarkers={select:this.newMouseMarker("#ffffff",t),hover:this.newMouseMarker("#575757",t)},this.setupEvents(!0)}async draw(t,i){if(!t.civilData)throw new Error("The provided model doesn't have civil data!");if(!this._world)throw new Error("No world was given for this navigator!");const{alignments:e}=t.civilData,n=i||e.values(),s=this._world.scene.three,o=new I;o.makeEmpty(),o.min.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),o.max.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(const r of n){if(!r)throw new Error("Alignment not found!");for(const c of r[this.view])if(s.add(c.mesh),this._curves.push(c.mesh),!o.isEmpty())o.expandByObject(c.mesh);else{c.mesh.geometry.computeBoundingBox();const d=c.mesh.geometry.boundingBox;d instanceof I&&o.copy(d).applyMatrix4(c.mesh.matrixWorld)}}const a=this.getScaledBox(o,1.2);this._world.camera.hasCameraControls()&&await this._world.camera.controls.fitToBox(a,!1)}async dispose(){var t;(t=this._highlighter)==null||t.dispose(),this.clear(),this.onHighlight.reset(),this._curves=[]}clear(){var t,i;(t=this._highlighter)==null||t.unSelect(),(i=this._highlighter)==null||i.unHover();for(const e of this._curves)e.removeFromParent();this._curves=[]}setMarker(t,i,e){if(!this._curves.length)return;const n=t.getCurveAt(i,this.view),s=t.getPointAt(i,this.view),{index:o}=n.curve.getSegmentAt(n.percentage);this.setMouseMarker(s,n.curve.mesh,o,e)}setDefSegments(t){const i=[],e=[],n=(s,o)=>{const a=o[1]-s[1],r=o[0]-s[0];return a/r};for(let s=0;s=0;m--)if(o[m*3]!==void 0&&o[m*3+1]!==void 0){c=o[m*3],d=o[m*3+1];break}const g=(n([a,r],[c,d])*100).toFixed(2);e.push({slope:g})}for(const s of t)for(let o=0;os.clone().add(e))}showLineInfo(h,t){const i=this.components.get(L);i.world=this._world,i.deleteByType(["Length","Radius"]);const e=h.geometry.attributes.position.array,n=this.calculateParallelCurve(e,e.length/3,t),s=new y().setFromPoints(n),o=new v(s,this.markupMaterial);i.showLineLength(o,h.curve.getLength()),this._scene.add(o),this.markupLines.push(o);const{startDimensionPoints:a,endDimensionPoints:r}=this.calculateDimensionLines(h,o),c=this.offsetDimensionLine(a,t*.1),d=this.offsetDimensionLine(r,t*.1),l=new y().setFromPoints(c),g=new y().setFromPoints(d),m=new v(l,this.markupMaterial);this._scene.add(m),this.markupLines.push(m);const w=new v(g,this.markupMaterial);this._scene.add(w),this.markupLines.push(w)}showClothoidInfo(h,t){const i=this.components.get(L);i.world=this._world,i.deleteByType(["Length","Radius"]);const e=h.geometry.attributes.position.array,n=this.calculateParallelCurve(e,e.length/3,t),s=new y().setFromPoints(n);i.showCurveLength(n,h.curve.getLength());const o=new v(s,this.markupMaterial);this._scene.add(o),this.markupLines.push(o);const{startDimensionPoints:a,endDimensionPoints:r}=this.calculateDimensionLines(h,o),c=this.offsetDimensionLine(a,t*.1),d=this.offsetDimensionLine(r,t*.1),l=new y().setFromPoints(c),g=new y().setFromPoints(d),m=new v(l,this.markupMaterial);this._scene.add(m),this.markupLines.push(m);const w=new v(g,this.markupMaterial);this._scene.add(w),this.markupLines.push(w)}showCircularArcInfo(h,t){const i=this.components.get(L);i.world=this._world,i.deleteByType(["Length","Radius"]);const e=h.curve.data.RADIUS,n=h.geometry.attributes.position.array,s=h.geometry.attributes.position.count,o=[],a=new u(n[0],n[1],n[2]),r=(s-1)*3,c=new u(n[r],n[r+1],n[r+2]),d=s/2*3,l=new u(n[d],n[d+1],n[d+2]),g=c.clone().sub(a).normalize(),m=new u(-g.y,g.x,0);m.multiplyScalar(e);const w=l.clone().add(m);o.push(l),o.push(w);const f=new y().setFromPoints(o),P=new v(f,this.markupMaterial);i.showCurveRadius(P,Math.abs(e)),this._scene.add(P),this.markupLines.push(P);const A=[];for(let _=0;_{!this._highlighter||!this.planHighlighter||this.planHighlighter.showCurveInfo(i)})}get world(){return super.world}set world(t){var i;super.world=t,t&&((i=this.planHighlighter)==null||i.dispose(),this.planHighlighter=new it(this.components,t.scene.three,t))}};p(S,"uuid","3096dea0-5bc2-41c7-abce-9089b6c9431b");let F=S;export{F as C,st as a,L as b}; +var W=Object.defineProperty;var Q=(b,h,t)=>h in b?W(b,h,{enumerable:!0,configurable:!0,writable:!0,value:t}):b[h]=t;var p=(b,h,t)=>(Q(b,typeof h!="symbol"?h+"":h,t),t);import{V as u,E as q,h as J,c as y,g as v,L as Z,Q as tt,p as I,o as et}from"./web-ifc-api-BC8YMRiS.js";import{J as B,D as V}from"./index-C-JPXu_n.js";import{a as nt}from"./index-B13Jg0iu.js";import{M as k}from"./index-B1Q8f4gg.js";import"./import-wrapper-prod-LhqN7JJy.js";import{M as x}from"./mark-Dwn_ERVH.js";const ot=["Station","Radius","Length","InitialKP","FinalKP","KP","Slope","Height","InitialKPV","FinalKPV"],M=class M extends B{constructor(t){super(t);p(this,"enabled",!0);p(this,"world",null);p(this,"_list",new Map);p(this,"_markerKey",0);p(this,"type","horizontal");p(this,"divisionLength",100);t.add(M.uuid,this)}addKPStation(t,i,e){const n=this.components.get(k),s=document.createElement("div"),o=document.createElement("div");s.appendChild(o),o.innerHTML=i,o.style.color=n.color,o.style.borderBottom="1px dotted white",o.style.width="160px",o.style.textAlign="left";const a=new x(t,s),r=new u;r.x=e.geometry.attributes.position.getX(e.geometry.attributes.position.count-1),r.y=e.geometry.attributes.position.getY(e.geometry.attributes.position.count-1),r.z=e.geometry.attributes.position.getZ(e.geometry.attributes.position.count-1);const c=new u;c.x=e.geometry.attributes.position.getX(e.geometry.attributes.position.count-2),c.y=e.geometry.attributes.position.getY(e.geometry.attributes.position.count-2),c.z=e.geometry.attributes.position.getZ(e.geometry.attributes.position.count-2);const d=new u;d.x=(r.x+c.x)/2,d.y=(r.y+c.y)/2,d.z=(r.z+c.z)/2,a.three.position.copy(d);const l=new u;l.subVectors(r,c).normalize();const g=new tt;g.setFromUnitVectors(new u(0,1,0),l);const m=new q().setFromQuaternion(g).z,w=J.radToDeg(m);o.style.transform=`rotate(${-w-90}deg) translate(-35%, -50%)`;const f=this._markerKey.toString();n.setupEvents(t,!0),n.getWorldMarkerList(t).set(f,{label:a,key:f,merged:!1,static:!1}),this._markerKey++,this.save(f,"KP")}addVerticalMarker(t,i,e,n,s){const o=this.components.get(k),a=document.createElement("span");a.innerHTML=i,a.style.color=o.color;const r=new x(t,a,s);if(n==="Height"){const l=document.createElement("span");l.innerHTML=i,l.style.color=o.color;const{position:g}=e.geometry.attributes,w=(g.array.length/3-1)*3,f=g.array.slice(w,w+3);r.three.position.set(f[0],f[1]+10,f[2])}else if(n==="InitialKPV"){const{position:l}=e.geometry.attributes,g=l.getX(0),m=l.getY(0),w=l.getZ(0);r.three.position.set(g-20,m,w)}else if(n==="FinalKPV"){const{position:l}=e.geometry.attributes,g=l.getX(e.geometry.attributes.position.count-1),m=l.getY(e.geometry.attributes.position.count-1),w=l.getZ(e.geometry.attributes.position.count-1);r.three.position.set(g+20,m,w)}else if(n==="Slope"){a.style.color="grey";const{position:l}=e.geometry.attributes,g=new u;g.x=l.getX(0),g.y=l.getY(0),g.z=l.getZ(0);const m=new u;m.x=l.getX(l.count-1),m.y=l.getY(l.count-1),m.z=l.getZ(l.count-1);const w=new u;w.addVectors(g,m).multiplyScalar(.5),r.three.position.set(w.x,w.y-10,w.z)}const c=this._markerKey.toString();return o.setupEvents(t,!0),o.getWorldMarkerList(t).set(c,{label:r,key:c,type:n,merged:!1,static:!1}),this._markerKey++,this.save(c,n),r}addCivilMarker(t,i,e,n){const s=this.components.get(k),o=document.createElement("span");o.innerHTML=i,o.style.color=s.color;const a=new x(t,o);if(n==="InitialKP"){const d=e.geometry.attributes.position.getX(0),l=e.geometry.attributes.position.getY(0),g=e.geometry.attributes.position.getZ(0);a.three.position.set(d+2,l+2,g)}else if(n==="FinalKP"){const d=e.geometry.attributes.position.getX(e.geometry.attributes.position.count-1),l=e.geometry.attributes.position.getY(e.geometry.attributes.position.count-1),g=e.geometry.attributes.position.getZ(e.geometry.attributes.position.count-1);a.three.position.set(d+2,l-2,g)}else if(n==="Length"){const d=new u;d.x=e.geometry.attributes.position.getX(0),d.y=e.geometry.attributes.position.getY(0),d.z=e.geometry.attributes.position.getZ(0);const l=new u;l.x=e.geometry.attributes.position.getX(e.geometry.attributes.position.count-1),l.y=e.geometry.attributes.position.getY(e.geometry.attributes.position.count-1),l.z=e.geometry.attributes.position.getZ(e.geometry.attributes.position.count-1);const g=d.distanceTo(l);a.three.element.innerText=g.toFixed(2);const m=l.clone().add(d).divideScalar(2);a.three.position.copy(m)}const r=this._markerKey.toString();return s.setupEvents(t,!0),s.getWorldMarkerList(t).set(r,{label:a,key:r,type:n,merged:!1,static:!1}),this._markerKey++,this.save(r,n),a}showKPStations(t){if(!this.world)throw new Error("A world is needed for this component to work!");if(this.type==="horizontal"){const i=this.generateStartAndEndKP(t);for(const[,n]of i)this.addKPStation(this.world,n.value,n.normal);const e=this.generateConstantKP(t);for(const[,n]of e)this.addKPStation(this.world,n.value,n.normal)}}showCurveLength(t,i){if(!this.world)throw new Error("A world is needed for this component to work!");const e=this.components.get(k),n=t.length,s=`${i.toFixed(2)} m`,o=Math.round(n/2),a=t[o],r=e.create(this.world,s,a,!0);r!==void 0&&this.save(r,"Radius")}showLineLength(t,i){if(!this.world)throw new Error("A world is needed for this component to work!");const e=this.components.get(k),n=new u;n.x=t.geometry.getAttribute("position").getX(0),n.y=t.geometry.getAttribute("position").getY(0),n.z=t.geometry.getAttribute("position").getZ(0);const s=new u;s.x=t.geometry.getAttribute("position").getX(1),s.y=t.geometry.getAttribute("position").getY(1),s.z=t.geometry.getAttribute("position").getZ(1);const o=`${i.toFixed(2)} m`,a=new u;a.addVectors(n,s).multiplyScalar(.5);const r=e.create(this.world,o,a,!0);r!==void 0&&this.save(r,"Radius")}showCurveRadius(t,i){if(!this.world)throw new Error("A world is needed for this component to work!");const e=this.components.get(k),n=new u;n.x=t.geometry.getAttribute("position").getX(0),n.y=t.geometry.getAttribute("position").getY(0),n.z=t.geometry.getAttribute("position").getZ(0);const s=new u;s.x=t.geometry.getAttribute("position").getX(1),s.y=t.geometry.getAttribute("position").getY(1),s.z=t.geometry.getAttribute("position").getZ(1);const o=`R = ${i.toFixed(2)} m`,a=new u;a.addVectors(n,s).multiplyScalar(.5);const r=e.create(this.world,o,a,!0);r!==void 0&&this.save(r,"Radius")}deleteByType(t=ot){const i=this.components.get(k);for(const e of t){const n=this._list.get(e);if(n){for(const s of n)i.delete(s);this._list.delete(e)}}}generateStartAndEndKP(t){const{alignment:i}=t.curve,e=new Map;for(const n of i.horizontal){const s=n.getLength();if(e.size>0){const o=n.index-1,r=e.get(o).distance+s,c=n.mesh.geometry.getAttribute("position"),d=c.count-1,l=new u;l.x=c.getX(d),l.y=c.getY(d),l.z=c.getZ(d);const g=this.createNormalLine(n.mesh);e.set(n.index,{value:this.getShortendKPValue(r),distance:r,point:l,normal:g})}else{const o=n.mesh.geometry.getAttribute("position"),a=o.count-1,r=new u;r.x=o.getX(a),r.y=o.getY(a),r.z=o.getZ(a);const c=this.createNormalLine(n.mesh);e.set(n.index,{value:this.getShortendKPValue(s),distance:s,point:r,normal:c})}}return e}createNormalLine(t){const i=t.geometry.attributes.position.count-1,e=i-1,n=new u;n.x=t.geometry.attributes.position.getX(i),n.y=t.geometry.attributes.position.getY(i),n.z=t.geometry.attributes.position.getZ(i);const s=new u;s.x=t.geometry.attributes.position.getX(e),s.y=t.geometry.attributes.position.getY(e),s.z=t.geometry.attributes.position.getZ(e);const a=new u().subVectors(n,s).clone().applyAxisAngle(new u(0,0,1),Math.PI*.5).normalize(),r=new y().setFromPoints([a.clone().setLength(10).add(n),a.clone().setLength(-10).add(n)]);return new v(r)}generateConstantKP(t){const{alignment:i}=t.curve,e=new Map,n=i.getLength("horizontal"),s=Math.floor(n/this.divisionLength);for(let o=0;o1e3&&parseInt(e,10)<1e4){const[o,...a]=e;return`${o}+${a.join("")}.${s}`}if(parseInt(e,10)>1e4){const[o,a,...r]=e;return`${o}${a}+${r.join("")}.${s}`}return`0+${e.padStart(3,"0")}.${s}`}save(t,i){this._list.has(i)||this._list.set(i,new Set),this._list.get(i).add(t)}};p(M,"uuid","0af12c32-81ee-4100-a030-e9ae546f6170");let L=M;class st extends B{constructor(t){super(t);p(this,"enabled",!0);p(this,"_highlighter");p(this,"onHighlight",new V);p(this,"onMarkerChange",new V);p(this,"mouseMarkers");p(this,"onMarkerHidden",new V);p(this,"_curves",[]);p(this,"_previousAlignment",null);p(this,"_world",null);p(this,"updateLinesResolution",t=>{var i;(i=this._highlighter)==null||i.setResolution(t)});p(this,"onMouseMove",t=>{var o,a,r;if(!this._world)throw new Error("No world was given for this navigator!");if(!this._world.renderer)return;const e=this._world.renderer.three.domElement.parentElement,n=this._world.camera.three,s=(o=this._highlighter)==null?void 0:o.castRay(t,n,e,this._curves);if(s){const{object:c}=s;(a=this._highlighter)==null||a.hover(c),this.updateMarker(s,"hover");return}this.mouseMarkers&&(this.mouseMarkers.hover.visible=!1),(r=this._highlighter)==null||r.unHover(),this.onMarkerHidden.trigger({type:"hover"})});p(this,"onClick",t=>{var o,a;if(!this._world)throw new Error("No world was given for this navigator!");if(!this._world.renderer)return;const e=this._world.renderer.three.domElement.parentElement,n=this._world.camera.three,s=(o=this._highlighter)==null?void 0:o.castRay(t,n,e,this._curves);if(s){const r=s,c=r.object;if((a=this._highlighter)==null||a.select(c),this.updateMarker(r,"select"),this._world.camera.hasCameraControls()&&(c.geometry.boundingBox||c.geometry.computeBoundingBox(),c.geometry.boundingBox)){const d=this.getScaledBox(c.geometry.boundingBox,2);this._world.camera.controls.fitToBox(d,!0)}this.onHighlight.trigger({mesh:c,point:r.point}),this._previousAlignment!==c.curve.alignment&&(this.components.get(L).showKPStations(c),this._previousAlignment=c.curve.alignment)}});p(this,"onControlsUpdated",()=>{if(!this._world)throw new Error("No world was given for this navigator!");if(!(this._world.camera.three instanceof et)||!this._highlighter)return;const{zoom:t,left:i,right:e,top:n,bottom:s}=this._world.camera.three,o=i-e,a=n-s,c=Math.max(o,a)/t,d=40,{caster:l}=this._highlighter;l.params.Line.threshold=c/d})}get highlighter(){if(!this._highlighter)throw new Error("Highlighter not initialized. You must set a world first!");return this._highlighter}get world(){return this._world}set world(t){var e,n,s;if(t===this._world||(this._world&&this.setupEvents(!1),this._world=t,(e=this._highlighter)==null||e.dispose(),(n=this.mouseMarkers)==null||n.hover.dispose(),(s=this.mouseMarkers)==null||s.select.dispose(),!t))return;const i=t.scene.three;this._highlighter=new nt(i,this.view),this.mouseMarkers={select:this.newMouseMarker("#ffffff",t),hover:this.newMouseMarker("#575757",t)},this.setupEvents(!0)}async draw(t,i){if(!t.civilData)throw new Error("The provided model doesn't have civil data!");if(!this._world)throw new Error("No world was given for this navigator!");const{alignments:e}=t.civilData,n=i||e.values(),s=this._world.scene.three,o=new I;o.makeEmpty(),o.min.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),o.max.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(const r of n){if(!r)throw new Error("Alignment not found!");for(const c of r[this.view])if(s.add(c.mesh),this._curves.push(c.mesh),!o.isEmpty())o.expandByObject(c.mesh);else{c.mesh.geometry.computeBoundingBox();const d=c.mesh.geometry.boundingBox;d instanceof I&&o.copy(d).applyMatrix4(c.mesh.matrixWorld)}}const a=this.getScaledBox(o,1.2);this._world.camera.hasCameraControls()&&await this._world.camera.controls.fitToBox(a,!1)}async dispose(){var t;(t=this._highlighter)==null||t.dispose(),this.clear(),this.onHighlight.reset(),this._curves=[]}clear(){var t,i;(t=this._highlighter)==null||t.unSelect(),(i=this._highlighter)==null||i.unHover();for(const e of this._curves)e.removeFromParent();this._curves=[]}setMarker(t,i,e){if(!this._curves.length)return;const n=t.getCurveAt(i,this.view),s=t.getPointAt(i,this.view),{index:o}=n.curve.getSegmentAt(n.percentage);this.setMouseMarker(s,n.curve.mesh,o,e)}setDefSegments(t){const i=[],e=[],n=(s,o)=>{const a=o[1]-s[1],r=o[0]-s[0];return a/r};for(let s=0;s=0;m--)if(o[m*3]!==void 0&&o[m*3+1]!==void 0){c=o[m*3],d=o[m*3+1];break}const g=(n([a,r],[c,d])*100).toFixed(2);e.push({slope:g})}for(const s of t)for(let o=0;os.clone().add(e))}showLineInfo(h,t){const i=this.components.get(L);i.world=this._world,i.deleteByType(["Length","Radius"]);const e=h.geometry.attributes.position.array,n=this.calculateParallelCurve(e,e.length/3,t),s=new y().setFromPoints(n),o=new v(s,this.markupMaterial);i.showLineLength(o,h.curve.getLength()),this._scene.add(o),this.markupLines.push(o);const{startDimensionPoints:a,endDimensionPoints:r}=this.calculateDimensionLines(h,o),c=this.offsetDimensionLine(a,t*.1),d=this.offsetDimensionLine(r,t*.1),l=new y().setFromPoints(c),g=new y().setFromPoints(d),m=new v(l,this.markupMaterial);this._scene.add(m),this.markupLines.push(m);const w=new v(g,this.markupMaterial);this._scene.add(w),this.markupLines.push(w)}showClothoidInfo(h,t){const i=this.components.get(L);i.world=this._world,i.deleteByType(["Length","Radius"]);const e=h.geometry.attributes.position.array,n=this.calculateParallelCurve(e,e.length/3,t),s=new y().setFromPoints(n);i.showCurveLength(n,h.curve.getLength());const o=new v(s,this.markupMaterial);this._scene.add(o),this.markupLines.push(o);const{startDimensionPoints:a,endDimensionPoints:r}=this.calculateDimensionLines(h,o),c=this.offsetDimensionLine(a,t*.1),d=this.offsetDimensionLine(r,t*.1),l=new y().setFromPoints(c),g=new y().setFromPoints(d),m=new v(l,this.markupMaterial);this._scene.add(m),this.markupLines.push(m);const w=new v(g,this.markupMaterial);this._scene.add(w),this.markupLines.push(w)}showCircularArcInfo(h,t){const i=this.components.get(L);i.world=this._world,i.deleteByType(["Length","Radius"]);const e=h.curve.data.RADIUS,n=h.geometry.attributes.position.array,s=h.geometry.attributes.position.count,o=[],a=new u(n[0],n[1],n[2]),r=(s-1)*3,c=new u(n[r],n[r+1],n[r+2]),d=s/2*3,l=new u(n[d],n[d+1],n[d+2]),g=c.clone().sub(a).normalize(),m=new u(-g.y,g.x,0);m.multiplyScalar(e);const w=l.clone().add(m);o.push(l),o.push(w);const f=new y().setFromPoints(o),P=new v(f,this.markupMaterial);i.showCurveRadius(P,Math.abs(e)),this._scene.add(P),this.markupLines.push(P);const A=[];for(let _=0;_{!this._highlighter||!this.planHighlighter||this.planHighlighter.showCurveInfo(i)})}get world(){return super.world}set world(t){var i;super.world=t,t&&((i=this.planHighlighter)==null||i.dispose(),this.planHighlighter=new it(this.components,t.scene.three,t))}};p(S,"uuid","3096dea0-5bc2-41c7-abce-9089b6c9431b");let F=S;export{F as C,st as a,L as b}; diff --git a/examples/assets/index-Dbd7DdKu.js b/examples/assets/index-DHD4JXQh.js similarity index 98% rename from examples/assets/index-Dbd7DdKu.js rename to examples/assets/index-DHD4JXQh.js index 0b2197329..e20989ed9 100644 --- a/examples/assets/index-Dbd7DdKu.js +++ b/examples/assets/index-DHD4JXQh.js @@ -1 +1 @@ -var G=Object.defineProperty;var H=(v,t,e)=>t in v?G(v,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):v[t]=e;var r=(v,t,e)=>(H(v,typeof t!="symbol"?t+"":t,e),e);import{U as P,a as q,b as K,J as Q,m as R}from"./index-b4ozRbQy.js";import{M as Y,c as Z,V as L,a as z,P as ee,r as te,e as se,D as ie,s as ne,I as oe,J as re,L as le}from"./web-ifc-api-BC8YMRiS.js";import{e as ae}from"./import-wrapper-prod-LhqN7JJy.js";import{P as W}from"./index-CwA6v-S5.js";class ce{constructor(t,e,s,i){r(this,"mesh",new Y(new Z));r(this,"world");r(this,"styleName");r(this,"_precission",1e4);r(this,"_tempVector",new L);r(this,"_plane");r(this,"_geometry");r(this,"_plane2DCoordinateSystem",new z);r(this,"_planeAxis");this.world=t,this.mesh.material=i,this.mesh.frustumCulled=!1,this._plane=e;const{x:n,y:l,z:o}=e.normal;Math.abs(n)===1?this._planeAxis="x":Math.abs(l)===1?this._planeAxis="y":Math.abs(o)===1&&(this._planeAxis="z"),this._geometry=s,this.mesh.geometry.attributes.position=s.attributes.position;const a=e.normal.clone().multiplyScalar(.01);this.mesh.position.copy(a),this.visible=!0}get visible(){return this.mesh.parent!==null}set visible(t){const e=this.getStyle();t?(this.world.scene.three.add(this.mesh),e&&e.meshes.add(this.mesh)):(this.mesh.removeFromParent(),e&&e.meshes.delete(this.mesh))}set geometry(t){this._geometry=t,this.mesh.geometry.attributes.position=t.attributes.position}dispose(){const t=this.getStyle();t&&t.meshes.delete(this.mesh),this.mesh.geometry.dispose(),this.mesh.removeFromParent(),this.mesh.geometry=null,this.mesh=null,this._plane=null,this._geometry=null}update(t){const e=this._geometry.attributes.position.array;if(!e)return;this.updatePlane2DCoordinateSystem();const s=[];let i=0;for(let n=0;nthis._localPlane.intersectsBox(i),intersectsTriangle:i=>{let n=0;if(this._tempLine.start.copy(i.a),this._tempLine.end.copy(i.b),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const l=this._tempVector.applyMatrix4(t.matrixWorld);e.setXYZ(s,l.x,l.y,l.z),n++,s++}if(this._tempLine.start.copy(i.b),this._tempLine.end.copy(i.c),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const l=this._tempVector.applyMatrix4(t.matrixWorld);e.setXYZ(s,l.x,l.y,l.z),n++,s++}if(this._tempLine.start.copy(i.c),this._tempLine.end.copy(i.a),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const l=this._tempVector.applyMatrix4(t.matrixWorld);e.setXYZ(s,l.x,l.y,l.z),n++,s++}n!==2&&(s-=n)}}),s}updateDeletedEdges(t){const e=Object.keys(this._edges);for(const s of e)t[s]===void 0&&(this.disposeEdge(s),this.disposeOutline(s))}disposeOutline(t){if(!this.world.renderer)return;const e=this.world.renderer;if(e instanceof W){const s=e.postproduction.customEffects.outlinedMeshes;delete s[t]}}disposeEdge(t){const e=this.components.get(q),s=this._edges[t];s.fill&&s.fill.dispose(),e.destroy(s.mesh,!1),delete this._edges[t]}}class X extends K{constructor(e,s,i,n,l,o=5,a=!0){super(e,s,i,n,l,o,a);r(this,"edges");r(this,"edgesMaxUpdateRate",50);r(this,"_visible",!0);r(this,"_edgesVisible",!0);r(this,"updateFill",()=>{this.edges.fillNeedsUpdate=!0,this.edges.update(),this.edges.visible=this._visible});this.edges=new de(e,s,this.three),this.toggleControls(!0),this.edges.visible=!0,this.onDraggingEnded.add(()=>{this.updateFill()}),this.onDraggingStarted.add(()=>this.edges.visible=!1)}get visible(){return this._visible}set visible(e){super.visible=e,this.toggleControls(e)}set enabled(e){this._enabled=e,this.world.renderer&&this.world.renderer.setPlane(e,this.three)}get enabled(){return super.enabled}dispose(){super.dispose(),this.edges.dispose()}}class he{constructor(){r(this,"onDisposed",new P);r(this,"enabled",!0);r(this,"list",{});r(this,"_defaultLineMaterial",new le({color:0,linewidth:.001}));r(this,"onAfterUpdate",new P);r(this,"onBeforeUpdate",new P)}update(t){this.onBeforeUpdate.trigger(this.list),this.onAfterUpdate.trigger(this.list)}create(t,e,s,i,n,l){if(!s.renderer)throw new Error("The given world doesn't have a renderer!");i||(i=this._defaultLineMaterial);for(const g of e)g.geometry.boundsTree||g.geometry.computeBoundsTree();const o=s.renderer;i.clippingPlanes=o.clippingPlanes;const a={name:t,lineMaterial:i,meshes:e,fillMaterial:n,outlineMaterial:l,fragments:{}};return this.list[t]=a,a}dispose(){const t=Object.keys(this.list);for(const e of t)this.deleteStyle(e);this.list={},this.onDisposed.trigger(),this.onDisposed.reset()}deleteStyle(t,e=!0){var i,n;const s=this.list[t];s&&(s.meshes.clear(),e&&(s.lineMaterial.dispose(),(i=s.fillMaterial)==null||i.dispose(),(n=s.outlineMaterial)==null||n.dispose())),delete this.list[t]}}const N=class N extends Q{constructor(e){super(e);r(this,"onDisposed",new P);r(this,"enabled",!0);r(this,"styles");r(this,"fillsNeedUpdate",!1);r(this,"_visible",!0);this.components.list.set(N.uuid,this),this.styles=new he}get visible(){return this._visible}set visible(e){this._visible=e;const s=this.components.get(R);for(const i of s.list)i instanceof X&&(i.edges.visible=e)}dispose(){this.styles.dispose(),this.onDisposed.trigger()}async update(e=!1){if(!this.enabled)return;const s=this.components.get(R);for(const i of s.list)i instanceof X&&(e||this.fillsNeedUpdate?i.updateFill():i.update());this.fillsNeedUpdate=!1}};r(N,"uuid","24dfc306-a3c4-410f-8071-babc4afa5e4d");let E=N;export{E as C,X as E}; +var G=Object.defineProperty;var H=(v,t,e)=>t in v?G(v,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):v[t]=e;var r=(v,t,e)=>(H(v,typeof t!="symbol"?t+"":t,e),e);import{D as P,a as q,b as K,J as Q,m as R}from"./index-C-JPXu_n.js";import{M as Y,c as Z,V as L,a as z,P as ee,r as te,e as se,D as ie,s as ne,I as oe,J as re,L as le}from"./web-ifc-api-BC8YMRiS.js";import{e as ae}from"./import-wrapper-prod-LhqN7JJy.js";import{P as W}from"./index-q_Y48tt2.js";class ce{constructor(t,e,s,i){r(this,"mesh",new Y(new Z));r(this,"world");r(this,"styleName");r(this,"_precission",1e4);r(this,"_tempVector",new L);r(this,"_plane");r(this,"_geometry");r(this,"_plane2DCoordinateSystem",new z);r(this,"_planeAxis");this.world=t,this.mesh.material=i,this.mesh.frustumCulled=!1,this._plane=e;const{x:n,y:l,z:o}=e.normal;Math.abs(n)===1?this._planeAxis="x":Math.abs(l)===1?this._planeAxis="y":Math.abs(o)===1&&(this._planeAxis="z"),this._geometry=s,this.mesh.geometry.attributes.position=s.attributes.position;const a=e.normal.clone().multiplyScalar(.01);this.mesh.position.copy(a),this.visible=!0}get visible(){return this.mesh.parent!==null}set visible(t){const e=this.getStyle();t?(this.world.scene.three.add(this.mesh),e&&e.meshes.add(this.mesh)):(this.mesh.removeFromParent(),e&&e.meshes.delete(this.mesh))}set geometry(t){this._geometry=t,this.mesh.geometry.attributes.position=t.attributes.position}dispose(){const t=this.getStyle();t&&t.meshes.delete(this.mesh),this.mesh.geometry.dispose(),this.mesh.removeFromParent(),this.mesh.geometry=null,this.mesh=null,this._plane=null,this._geometry=null}update(t){const e=this._geometry.attributes.position.array;if(!e)return;this.updatePlane2DCoordinateSystem();const s=[];let i=0;for(let n=0;nthis._localPlane.intersectsBox(i),intersectsTriangle:i=>{let n=0;if(this._tempLine.start.copy(i.a),this._tempLine.end.copy(i.b),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const l=this._tempVector.applyMatrix4(t.matrixWorld);e.setXYZ(s,l.x,l.y,l.z),n++,s++}if(this._tempLine.start.copy(i.b),this._tempLine.end.copy(i.c),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const l=this._tempVector.applyMatrix4(t.matrixWorld);e.setXYZ(s,l.x,l.y,l.z),n++,s++}if(this._tempLine.start.copy(i.c),this._tempLine.end.copy(i.a),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const l=this._tempVector.applyMatrix4(t.matrixWorld);e.setXYZ(s,l.x,l.y,l.z),n++,s++}n!==2&&(s-=n)}}),s}updateDeletedEdges(t){const e=Object.keys(this._edges);for(const s of e)t[s]===void 0&&(this.disposeEdge(s),this.disposeOutline(s))}disposeOutline(t){if(!this.world.renderer)return;const e=this.world.renderer;if(e instanceof W){const s=e.postproduction.customEffects.outlinedMeshes;delete s[t]}}disposeEdge(t){const e=this.components.get(q),s=this._edges[t];s.fill&&s.fill.dispose(),e.destroy(s.mesh,!1),delete this._edges[t]}}class X extends K{constructor(e,s,i,n,l,o=5,a=!0){super(e,s,i,n,l,o,a);r(this,"edges");r(this,"edgesMaxUpdateRate",50);r(this,"_visible",!0);r(this,"_edgesVisible",!0);r(this,"updateFill",()=>{this.edges.fillNeedsUpdate=!0,this.edges.update(),this.edges.visible=this._visible});this.edges=new de(e,s,this.three),this.toggleControls(!0),this.edges.visible=!0,this.onDraggingEnded.add(()=>{this.updateFill()}),this.onDraggingStarted.add(()=>this.edges.visible=!1)}get visible(){return this._visible}set visible(e){super.visible=e,this.toggleControls(e)}set enabled(e){this._enabled=e,this.world.renderer&&this.world.renderer.setPlane(e,this.three)}get enabled(){return super.enabled}dispose(){super.dispose(),this.edges.dispose()}}class he{constructor(){r(this,"onDisposed",new P);r(this,"enabled",!0);r(this,"list",{});r(this,"_defaultLineMaterial",new le({color:0,linewidth:.001}));r(this,"onAfterUpdate",new P);r(this,"onBeforeUpdate",new P)}update(t){this.onBeforeUpdate.trigger(this.list),this.onAfterUpdate.trigger(this.list)}create(t,e,s,i,n,l){if(!s.renderer)throw new Error("The given world doesn't have a renderer!");i||(i=this._defaultLineMaterial);for(const g of e)g.geometry.boundsTree||g.geometry.computeBoundsTree();const o=s.renderer;i.clippingPlanes=o.clippingPlanes;const a={name:t,lineMaterial:i,meshes:e,fillMaterial:n,outlineMaterial:l,fragments:{}};return this.list[t]=a,a}dispose(){const t=Object.keys(this.list);for(const e of t)this.deleteStyle(e);this.list={},this.onDisposed.trigger(),this.onDisposed.reset()}deleteStyle(t,e=!0){var i,n;const s=this.list[t];s&&(s.meshes.clear(),e&&(s.lineMaterial.dispose(),(i=s.fillMaterial)==null||i.dispose(),(n=s.outlineMaterial)==null||n.dispose())),delete this.list[t]}}const N=class N extends Q{constructor(e){super(e);r(this,"onDisposed",new P);r(this,"enabled",!0);r(this,"styles");r(this,"fillsNeedUpdate",!1);r(this,"_visible",!0);this.components.list.set(N.uuid,this),this.styles=new he}get visible(){return this._visible}set visible(e){this._visible=e;const s=this.components.get(R);for(const i of s.list)i instanceof X&&(i.edges.visible=e)}dispose(){this.styles.dispose(),this.onDisposed.trigger()}async update(e=!1){if(!this.enabled)return;const s=this.components.get(R);for(const i of s.list)i instanceof X&&(e||this.fillsNeedUpdate?i.updateFill():i.update());this.fillsNeedUpdate=!1}};r(N,"uuid","24dfc306-a3c4-410f-8071-babc4afa5e4d");let E=N;export{E as C,X as E}; diff --git a/examples/assets/index-PenRR3X-.js b/examples/assets/index-DgTKnZy1.js similarity index 96% rename from examples/assets/index-PenRR3X-.js rename to examples/assets/index-DgTKnZy1.js index 3f6e7304e..af06385ee 100644 --- a/examples/assets/index-PenRR3X-.js +++ b/examples/assets/index-DgTKnZy1.js @@ -1 +1 @@ -var L=Object.defineProperty;var k=(p,g,t)=>g in p?L(p,g,{enumerable:!0,configurable:!0,writable:!0,value:t}):p[g]=t;var c=(p,g,t)=>(k(p,typeof g!="symbol"?g+"":g,t),t);import{a8 as G,k as S,a9 as T,aa as z,ab as N,N as P,C as W,a as j,c as B,e as C,ac as $}from"./web-ifc-api-BC8YMRiS.js";import{S as O,I as R,C as U}from"./ifc-metadata-reader-j9dl-lHS.js";import{I as V}from"./ifc-fragment-settings-CiVry-YT.js";import{F as J}from"./index-DDOiyGyA.js";import{C as X,E as D,a as q}from"./index-BraZXcLv.js";import{I as H}from"./index-DvHc-rVc.js";const l=class l extends X{constructor(t){super(t);c(this,"onIfcStartedLoading",new D);c(this,"onSetup",new D);c(this,"onDisposed",new D);c(this,"settings",new V);c(this,"enabled",!0);c(this,"webIfc",new G);c(this,"_material",new S);c(this,"_spatialTree",new O);c(this,"_metaData",new R);c(this,"_fragmentInstances",new Map);c(this,"_civil",new U);c(this,"_visitedFragments",new Map);c(this,"_materialT",new S({transparent:!0,opacity:.5}));this.components.add(l.uuid,this),this.settings.excludedCategories.add(T)}dispose(){this.webIfc=null,this.onDisposed.trigger(l.uuid),this.onDisposed.reset()}async setup(t){this.settings={...this.settings,...t},this.settings.autoSetWasm&&await this.autoSetWasm(),this.onSetup.trigger()}async load(t,n=!0){const r=performance.now();this.onIfcStartedLoading.trigger(),await this.readIfcFile(t);const a=await this.getAllGeometries(),m=await this.components.get(H).export(this.webIfc,0);a.setLocalProperties(m),this.cleanUp();const e=this.components.get(J);e.groups.set(a.uuid,a);for(const i of a.items)e.list.set(i.id,i),i.mesh.uuid=i.id,i.group=a;return e.onFragmentsLoaded.trigger(a),n&&e.coordinate([a]),console.log(`Streaming the IFC took ${performance.now()-r} ms!`),a}async readIfcFile(t){const{path:n,absolute:r,logLevel:a}=this.settings.wasm;return this.webIfc.SetWasmPath(n,r),await this.webIfc.Init(),a&&this.webIfc.SetLogLevel(a),this.webIfc.OpenModel(t,this.settings.webIfc)}async getAllGeometries(){this._spatialTree.setUp(this.webIfc);const t=this.webIfc.GetIfcEntityList(0),n=new z,{FILE_NAME:r,FILE_DESCRIPTION:a}=$;n.ifcMetadata={name:this._metaData.get(this.webIfc,r),description:this._metaData.get(this.webIfc,a),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};const o=[];for(const e of t){if(!this.webIfc.IsIfcElement(e)&&e!==N||this.settings.excludedCategories.has(e))continue;const i=this.webIfc.GetLineIDsWithType(0,e),f=i.size();for(let h=0;h{this.getMesh(e,n)});for(const e of this._visitedFragments){const{index:i,fragment:f}=e[1];n.keyFragments.set(i,f.id)}for(const e of n.items){const i=this._fragmentInstances.get(e.id);if(!i)throw new Error("Fragment not found!");const f=[];for(const[h,s]of i)f.push(s);e.add(f)}const m=this.webIfc.GetCoordinationMatrix(0);return n.coordinationMatrix.fromArray(m),n.civilData=this._civil.read(this.webIfc),n}cleanUp(){this.webIfc=null,this.webIfc=new G,this._visitedFragments.clear(),this._fragmentInstances.clear()}getMesh(t,n){const r=t.geometries.size(),a=t.expressID;for(let o=0;og in p?L(p,g,{enumerable:!0,configurable:!0,writable:!0,value:t}):p[g]=t;var c=(p,g,t)=>(k(p,typeof g!="symbol"?g+"":g,t),t);import{a8 as G,k as S,a9 as T,aa as z,ab as N,N as P,C as W,a as j,c as B,e as C,ac as $}from"./web-ifc-api-BC8YMRiS.js";import{S as O,I as R,C as U}from"./ifc-metadata-reader-j9dl-lHS.js";import{I as V}from"./ifc-fragment-settings-CiVry-YT.js";import{F as J}from"./index-CiqD_kld.js";import{C as X,E as D,a as q}from"./index-BZiAUaTo.js";import{I as H}from"./index-BPt-VIyQ.js";const l=class l extends X{constructor(t){super(t);c(this,"onIfcStartedLoading",new D);c(this,"onSetup",new D);c(this,"onDisposed",new D);c(this,"settings",new V);c(this,"enabled",!0);c(this,"webIfc",new G);c(this,"_material",new S);c(this,"_spatialTree",new O);c(this,"_metaData",new R);c(this,"_fragmentInstances",new Map);c(this,"_civil",new U);c(this,"_visitedFragments",new Map);c(this,"_materialT",new S({transparent:!0,opacity:.5}));this.components.add(l.uuid,this),this.settings.excludedCategories.add(T)}dispose(){this.webIfc=null,this.onDisposed.trigger(l.uuid),this.onDisposed.reset()}async setup(t){this.settings={...this.settings,...t},this.settings.autoSetWasm&&await this.autoSetWasm(),this.onSetup.trigger()}async load(t,n=!0){const r=performance.now();this.onIfcStartedLoading.trigger(),await this.readIfcFile(t);const a=await this.getAllGeometries(),m=await this.components.get(H).export(this.webIfc,0);a.setLocalProperties(m),this.cleanUp();const e=this.components.get(J);e.groups.set(a.uuid,a);for(const i of a.items)e.list.set(i.id,i),i.mesh.uuid=i.id,i.group=a;return e.onFragmentsLoaded.trigger(a),n&&e.coordinate([a]),console.log(`Streaming the IFC took ${performance.now()-r} ms!`),a}async readIfcFile(t){const{path:n,absolute:r,logLevel:a}=this.settings.wasm;return this.webIfc.SetWasmPath(n,r),await this.webIfc.Init(),a&&this.webIfc.SetLogLevel(a),this.webIfc.OpenModel(t,this.settings.webIfc)}async getAllGeometries(){this._spatialTree.setUp(this.webIfc);const t=this.webIfc.GetIfcEntityList(0),n=new z,{FILE_NAME:r,FILE_DESCRIPTION:a}=$;n.ifcMetadata={name:this._metaData.get(this.webIfc,r),description:this._metaData.get(this.webIfc,a),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};const o=[];for(const e of t){if(!this.webIfc.IsIfcElement(e)&&e!==N||this.settings.excludedCategories.has(e))continue;const i=this.webIfc.GetLineIDsWithType(0,e),f=i.size();for(let h=0;h{this.getMesh(e,n)});for(const e of this._visitedFragments){const{index:i,fragment:f}=e[1];n.keyFragments.set(i,f.id)}for(const e of n.items){const i=this._fragmentInstances.get(e.id);if(!i)throw new Error("Fragment not found!");const f=[];for(const[h,s]of i)f.push(s);e.add(f)}const m=this.webIfc.GetCoordinationMatrix(0);return n.coordinationMatrix.fromArray(m),n.civilData=this._civil.read(this.webIfc),n}cleanUp(){this.webIfc=null,this.webIfc=new G,this._visitedFragments.clear(),this._fragmentInstances.clear()}getMesh(t,n){const r=t.geometries.size(),a=t.expressID;for(let o=0;ot in l?S(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e;var o=(l,t,e)=>(T(l,typeof t!="symbol"?t+"":t,e),e);import{q as h,U as E,f as m,W as v,H as B,t as R,u as M,C as _,n as w,d as y,I as b,v as z,R as k,w as x,x as V}from"./web-ifc-api-BC8YMRiS.js";import{a as L,n as G}from"./index-b4ozRbQy.js";import{P as d,F as P,$ as O}from"./import-wrapper-prod-LhqN7JJy.js";import{R as N}from"./renderer-with-2d-BOMjjrxA.js";const A={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` +var S=Object.defineProperty;var T=(l,t,e)=>t in l?S(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e;var o=(l,t,e)=>(T(l,typeof t!="symbol"?t+"":t,e),e);import{q as h,U as E,f as m,W as v,H as B,t as R,u as M,C as _,n as w,d as y,I as b,v as z,R as k,w as x,x as V}from"./web-ifc-api-BC8YMRiS.js";import{a as L,n as G}from"./index-C-JPXu_n.js";import{P as d,F as P,$ as O}from"./import-wrapper-prod-LhqN7JJy.js";import{R as N}from"./renderer-with-2d-Vj-QiZHm.js";const A={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; diff --git a/examples/assets/lengthMeasurement.js b/examples/assets/lengthMeasurement.js index ffdc55689..79fa7757e 100644 --- a/examples/assets/lengthMeasurement.js +++ b/examples/assets/lengthMeasurement.js @@ -1,4 +1,4 @@ -import{B as s,b as c,M as r}from"./web-ifc-api-BC8YMRiS.js";import{S as m}from"./stats.min-GTpOrGrX.js";import{f as b,p as d,s as p,k as u,N as h}from"./index-b4ozRbQy.js";import{p as w,a as f,m as k}from"./index-DyM33b1I.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as x}from"./index-CwA6v-S5.js";import{L as D}from"./index-s8v5I1cn.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-BOMjjrxA.js";import"./index-MPPnu1_m.js";import"./mark-Cj_PmUva.js";import"./dimension-mark-BiAWnjiH.js";import"./graphic-vertex-picker-CEs1V3AG.js";const l=document.getElementById("container"),t=new b,g=t.get(d),e=g.create();e.scene=new p(t);e.renderer=new x(t,l);e.camera=new u(t);t.init();e.camera.controls.setLookAt(5,5,5,0,0,0);e.scene.setup();const y=t.get(h);y.create(e);const M=new s(3,3,3),B=new c({color:"#6528D7"}),a=new r(M,B);a.position.set(0,1.5,0);e.scene.three.add(a);e.meshes.add(a);const o=new D(t);o.world=e;o.enabled=!0;o.snapDistance=1;l.ondblclick=()=>o.create();window.onkeydown=n=>{(n.code==="Delete"||n.code==="Backspace")&&o.delete()};const i=new m;i.showPanel(2);document.body.append(i.dom);i.dom.style.left="0px";e.renderer.onBeforeUpdate.add(()=>i.begin());e.renderer.onAfterUpdate.add(()=>i.end());w.init();const $=f.create(()=>k` +import{B as s,b as c,M as r}from"./web-ifc-api-BC8YMRiS.js";import{S as m}from"./stats.min-GTpOrGrX.js";import{f as b,p as d,s as p,k as u,N as h}from"./index-C-JPXu_n.js";import{p as w,a as f,m as k}from"./index-DyM33b1I.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as x}from"./index-q_Y48tt2.js";import{L as D}from"./index-CwB6Igrg.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-Vj-QiZHm.js";import"./index-CYkvDr46.js";import"./mark-Dwn_ERVH.js";import"./dimension-mark-BiAWnjiH.js";import"./graphic-vertex-picker-BH9d5rBm.js";const l=document.getElementById("container"),t=new b,g=t.get(d),e=g.create();e.scene=new p(t);e.renderer=new x(t,l);e.camera=new u(t);t.init();e.camera.controls.setLookAt(5,5,5,0,0,0);e.scene.setup();const y=t.get(h);y.create(e);const M=new s(3,3,3),B=new c({color:"#6528D7"}),a=new r(M,B);a.position.set(0,1.5,0);e.scene.three.add(a);e.meshes.add(a);const o=new D(t);o.world=e;o.enabled=!0;o.snapDistance=1;l.ondblclick=()=>o.create();window.onkeydown=n=>{(n.code==="Delete"||n.code==="Backspace")&&o.delete()};const i=new m;i.showPanel(2);document.body.append(i.dom);i.dom.style.left="0px";e.renderer.onBeforeUpdate.add(()=>i.begin());e.renderer.onAfterUpdate.add(()=>i.end());w.init();const $=f.create(()=>k` diff --git a/examples/assets/mark-Cj_PmUva.js b/examples/assets/mark-Dwn_ERVH.js similarity index 92% rename from examples/assets/mark-Cj_PmUva.js rename to examples/assets/mark-Dwn_ERVH.js index 03c71f0c5..2dd26dbcc 100644 --- a/examples/assets/mark-Cj_PmUva.js +++ b/examples/assets/mark-Dwn_ERVH.js @@ -1 +1 @@ -var h=Object.defineProperty;var l=(i,e,t)=>e in i?h(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var r=(i,e,t)=>(l(i,typeof e!="symbol"?e+"":e,t),t);import{C as n}from"./renderer-with-2d-BOMjjrxA.js";import{U as d}from"./index-b4ozRbQy.js";class p{constructor(e,t,o){r(this,"three");r(this,"world");r(this,"onDisposed",new d);this.world=e;let s;t?s=t:(s=document.createElement("div"),s.style.width="15px",s.style.height="15px",s.style.border="5px solid red"),this.three=new n(s),(o||e.scene.three).add(this.three),this.visible=!0}set visible(e){this.three.visible=e}get visible(){return this.three.visible}toggleVisibility(){this.visible=!this.visible}dispose(){this.three.removeFromParent(),this.three.element.remove(),this.onDisposed.trigger(),this.onDisposed.reset()}}export{p as M}; +var h=Object.defineProperty;var l=(i,e,t)=>e in i?h(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var r=(i,e,t)=>(l(i,typeof e!="symbol"?e+"":e,t),t);import{C as n}from"./renderer-with-2d-Vj-QiZHm.js";import{D as d}from"./index-C-JPXu_n.js";class p{constructor(e,t,o){r(this,"three");r(this,"world");r(this,"onDisposed",new d);this.world=e;let s;t?s=t:(s=document.createElement("div"),s.style.width="15px",s.style.height="15px",s.style.border="5px solid red"),this.three=new n(s),(o||e.scene.three).add(this.three),this.visible=!0}set visible(e){this.three.visible=e}get visible(){return this.three.visible}toggleVisibility(){this.visible=!this.visible}dispose(){this.three.removeFromParent(),this.three.element.remove(),this.onDisposed.trigger(),this.onDisposed.reset()}}export{p as M}; diff --git a/examples/assets/marker.js b/examples/assets/marker.js index c3ae7b16a..53b2224fc 100644 --- a/examples/assets/marker.js +++ b/examples/assets/marker.js @@ -1 +1 @@ -import{V as c}from"./web-ifc-api-BC8YMRiS.js";import{f as i,p as d,s as p,k as h,N as l}from"./index-b4ozRbQy.js";import{M as f}from"./index-WVnKWA4H.js";import"./import-wrapper-prod-LhqN7JJy.js";import{R as w}from"./renderer-with-2d-BOMjjrxA.js";import"./mark-Cj_PmUva.js";import"./_commonjsHelpers-Cpj98o6Y.js";const o=document.getElementById("container"),e=new i,g=e.get(d),r=g.create();r.scene=new p(e);r.renderer=new w(e,o);r.camera=new h(e);e.init();r.camera.controls.setLookAt(5,5,5,0,0,0);o.appendChild(r.renderer.three2D.domElement);const k=e.get(l);k.create(r);const n=e.get(f);n.threshold=10;for(let t=0;t<20;t++){const a=Math.random()*5,s=Math.random()*5,m=Math.random()*5;n.create(r,"🚀",new c(a,s,m))} +import{V as c}from"./web-ifc-api-BC8YMRiS.js";import{f as i,p as d,s as p,k as h,N as l}from"./index-C-JPXu_n.js";import{M as f}from"./index-B1Q8f4gg.js";import"./import-wrapper-prod-LhqN7JJy.js";import{R as w}from"./renderer-with-2d-Vj-QiZHm.js";import"./mark-Dwn_ERVH.js";import"./_commonjsHelpers-Cpj98o6Y.js";const o=document.getElementById("container"),e=new i,g=e.get(d),r=g.create();r.scene=new p(e);r.renderer=new w(e,o);r.camera=new h(e);e.init();r.camera.controls.setLookAt(5,5,5,0,0,0);o.appendChild(r.renderer.three2D.domElement);const k=e.get(l);k.create(r);const n=e.get(f);n.threshold=10;for(let t=0;t<20;t++){const a=Math.random()*5,s=Math.random()*5,m=Math.random()*5;n.create(r,"🚀",new c(a,s,m))} diff --git a/examples/assets/miniMap.js b/examples/assets/miniMap.js index 9303f7585..2c698079f 100644 --- a/examples/assets/miniMap.js +++ b/examples/assets/miniMap.js @@ -1,4 +1,4 @@ -import"./web-ifc-api-BC8YMRiS.js";import{S as p}from"./stats.min-GTpOrGrX.js";import{p as d,a as m,m as c}from"./index-DyM33b1I.js";import{f as b,p as u,s as f,i as g,k as h,N as v,u as x,h as y}from"./index-b4ozRbQy.js";import"./_commonjsHelpers-Cpj98o6Y.js";const z=document.getElementById("container"),a=new b,k=a.get(u),t=k.create();t.scene=new f(a);t.renderer=new g(a,z);t.camera=new h(a);t.scene.setup();a.init();const w=a.get(v);w.create(t);t.camera.controls.setLookAt(1,2,-2,-2,0,-5);t.scene.three.background=null;const $=new x(a),S=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),B=await S.arrayBuffer(),L=new Uint8Array(B),E=$.load(L);t.scene.three.add(E);const A=new y(a),e=A.create(t),I=document.getElementById("minimap"),l=e.renderer.domElement;l.style.borderRadius="12px";I.append(l);e.resize();const o=new p;o.showPanel(2);document.body.append(o.dom);o.dom.style.left="0px";o.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>o.begin());t.renderer.onAfterUpdate.add(()=>o.end());d.init();const r=e.getSize(),i=m.create(()=>c` +import"./web-ifc-api-BC8YMRiS.js";import{S as p}from"./stats.min-GTpOrGrX.js";import{p as d,a as m,m as c}from"./index-DyM33b1I.js";import{f as b,p as u,s as f,i as g,k as h,N as v,u as x,h as y}from"./index-C-JPXu_n.js";import"./_commonjsHelpers-Cpj98o6Y.js";const z=document.getElementById("container"),a=new b,k=a.get(u),t=k.create();t.scene=new f(a);t.renderer=new g(a,z);t.camera=new h(a);t.scene.setup();a.init();const w=a.get(v);w.create(t);t.camera.controls.setLookAt(1,2,-2,-2,0,-5);t.scene.three.background=null;const $=new x(a),S=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),B=await S.arrayBuffer(),L=new Uint8Array(B),E=$.load(L);t.scene.three.add(E);const A=new y(a),e=A.create(t),I=document.getElementById("minimap"),l=e.renderer.domElement;l.style.borderRadius="12px";I.append(l);e.resize();const o=new p;o.showPanel(2);document.body.append(o.dom);o.dom.style.left="0px";o.dom.style.zIndex="unset";t.renderer.onBeforeUpdate.add(()=>o.begin());t.renderer.onAfterUpdate.add(()=>o.end());d.init();const r=e.getSize(),i=m.create(()=>c` diff --git a/examples/assets/orthoPerspectiveCamera.js b/examples/assets/orthoPerspectiveCamera.js index cc637ee96..fc6deff64 100644 --- a/examples/assets/orthoPerspectiveCamera.js +++ b/examples/assets/orthoPerspectiveCamera.js @@ -1,4 +1,4 @@ -import{B as u,b as h,M as w}from"./web-ifc-api-BC8YMRiS.js";import{S as $}from"./stats.min-GTpOrGrX.js";import{p as x,a as g,m as f}from"./index-DyM33b1I.js";import{f as v,p as k,s as P,i as j,n as y,N as F}from"./index-b4ozRbQy.js";import"./_commonjsHelpers-Cpj98o6Y.js";const O=document.getElementById("container");let t=new v,c=t.get(k),e=c.create();e.scene=new P(t);e.renderer=new j(t,O);e.camera=new y(t);e.scene.setup();await e.camera.controls.setLookAt(3,3,3,0,0,0);t.init();e.scene.three.background=null;let l=new u,m=new h({color:"#6528D7"}),n=new w(l,m);n.position.set(0,.5,0);e.scene.three.add(n);e.meshes.add(n);let d=t.get(F),p=d.create(e);e.camera.projection.onChanged.add(()=>{const o=e.camera.projection.current;p.fade=o==="Perspective"});const r=new $;r.showPanel(2);document.body.append(r.dom);r.dom.style.left="0px";r.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>r.begin());e.renderer.onAfterUpdate.add(()=>r.end());x.init();const a=g.create(()=>f` +import{B as u,b as h,M as w}from"./web-ifc-api-BC8YMRiS.js";import{S as $}from"./stats.min-GTpOrGrX.js";import{p as x,a as g,m as f}from"./index-DyM33b1I.js";import{f as v,p as k,s as P,i as j,n as y,N as F}from"./index-C-JPXu_n.js";import"./_commonjsHelpers-Cpj98o6Y.js";const O=document.getElementById("container");let t=new v,c=t.get(k),e=c.create();e.scene=new P(t);e.renderer=new j(t,O);e.camera=new y(t);e.scene.setup();await e.camera.controls.setLookAt(3,3,3,0,0,0);t.init();e.scene.three.background=null;let l=new u,m=new h({color:"#6528D7"}),n=new w(l,m);n.position.set(0,.5,0);e.scene.three.add(n);e.meshes.add(n);let d=t.get(F),p=d.create(e);e.camera.projection.onChanged.add(()=>{const o=e.camera.projection.current;p.fade=o==="Perspective"});const r=new $;r.showPanel(2);document.body.append(r.dom);r.dom.style.left="0px";r.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>r.begin());e.renderer.onAfterUpdate.add(()=>r.end());x.init();const a=g.create(()=>f` diff --git a/examples/assets/plans.js b/examples/assets/plans.js index 76c053cc2..17fd53287 100644 --- a/examples/assets/plans.js +++ b/examples/assets/plans.js @@ -1,4 +1,4 @@ -var N=Object.defineProperty;var B=(n,o,e)=>o in n?N(n,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[o]=e;var r=(n,o,e)=>(B(n,typeof o!="symbol"?o+"":o,e),e);import{V as w,i as R,C as V,d as _,L as W}from"./web-ifc-api-BC8YMRiS.js";import{S as U}from"./stats.min-GTpOrGrX.js";import{J as G,U as b,G as H,m as M,f as $,p as z,s as Y,n as q,N as J,u as K,R as Q,C as X}from"./index-b4ozRbQy.js";import{p as Z,a as y,m as E}from"./index-DyM33b1I.js";import{E as F,C as ee}from"./index-Dbd7DdKu.js";import{P as te}from"./index-CwA6v-S5.js";import"./import-wrapper-prod-LhqN7JJy.js";import{H as se}from"./index-DHjX9tRF.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-BOMjjrxA.js";const P=class P extends G{constructor(e){super(e);r(this,"onDisposed",new b);r(this,"onNavigated",new b);r(this,"onExited",new b);r(this,"enabled",!1);r(this,"currentPlan",null);r(this,"defaultSectionOffset",1.5);r(this,"defaultCameraOffset",30);r(this,"list",[]);r(this,"world");r(this,"_floorPlanViewCached",!1);r(this,"_previousCamera",new w);r(this,"_previousTarget",new w);r(this,"_previousProjection","Perspective");this.components.add(P.uuid,this)}dispose(){this.onExited.reset(),this.onNavigated.reset(),this.list=[],this.onDisposed.trigger(),this.onDisposed.reset()}async generate(e){if(!e.hasProperties)throw new Error("Properties are needed to compute plan views!");const s=await e.getAllPropertiesOfType(R);if(!s)throw new Error("Floorplans not found!");const i=e.coordinationMatrix.elements[13],h=await H.getUnits(e);for(const l of Object.values(s)){const g={value:0};this.getAbsoluteFloorHeight(l.ObjectPlacement,g);const c=g.value*h+i;this.create({name:l.Name.value,id:l.GlobalId.value,normal:new w(0,-1,0),point:new w(0,c,0),ortho:!0,offset:this.defaultSectionOffset})}}create(e){if(!this.world)throw new Error("You must set a world before creating the clipping planes!");if(this.list.find(l=>l.id===e.id)){console.warn(`There's already a plan with the id: ${e.id}`);return}const i=this.createClippingPlane(e),h={...e,plane:i};this.list.push(h)}async goTo(e,s=!1){var i;((i=this.currentPlan)==null?void 0:i.id)!==e&&(this.onNavigated.trigger({id:e}),this.storeCameraPosition(),await this.hidePreviousClippingPlane(),this.updateCurrentPlan(e),await this.activateCurrentPlan(),this.enabled||(await this.moveCameraTo2DPlanPosition(s),this.enabled=!0))}async exitPlanView(e=!1){if(!this.enabled||!this.world)return;this.enabled=!1,this.onExited.trigger(),this.cacheFloorplanView();const s=this.world.camera;s.set("Orbit"),await s.projection.set(this._previousProjection),this.currentPlan&&this.currentPlan.plane&&(this.currentPlan.plane.enabled=!1,this.currentPlan.plane.edges.enabled=!1,this.currentPlan.plane.edges.visible=!1),this.currentPlan=null,await s.controls.setLookAt(this._previousCamera.x,this._previousCamera.y,this._previousCamera.z,this._previousTarget.x,this._previousTarget.y,this._previousTarget.z,e)}storeCameraPosition(){this.enabled?this.cacheFloorplanView():this.store3dCameraPosition()}createClippingPlane(e){if(!this.world)throw new Error("World is needed to create clipping planes!");const{normal:s,point:i}=e,h=i.clone();e.offset&&(h.y+=e.offset);const l=this.components.get(M),g=l.Type;l.Type=F;const c=l.createFromNormalAndCoplanarPoint(this.world,s,h);return c.edges.update(),c.visible=!1,c.enabled=!1,c.edges.enabled=!1,c.edges.visible=!1,l.Type=g,c}cacheFloorplanView(){if(!this.world)throw new Error("World is needed to create clipping planes!");this._floorPlanViewCached=!0,this.world.camera.controls.saveState()}async moveCameraTo2DPlanPosition(e){if(!this.world)throw new Error("World is needed to create clipping planes!");const s=this.world.camera;this._floorPlanViewCached?await s.controls.reset(e):await s.controls.setLookAt(0,100,0,0,0,0,e)}async activateCurrentPlan(){if(!this.world)throw new Error("World is needed to create clipping planes!");if(!this.currentPlan)throw new Error("Current plan is not defined.");const e=this.world.camera;this.currentPlan.plane&&(this.currentPlan.plane.enabled=!0,this.currentPlan.plane.edges.fillNeedsUpdate=!0,this.currentPlan.plane.edges.visible=!0),e.set("Plan");const s=this.currentPlan.ortho?"Orthographic":"Perspective";await e.projection.set(s)}store3dCameraPosition(){if(!this.world)throw new Error("World is needed to create clipping planes!");const e=this.world.camera;e.three.getWorldPosition(this._previousCamera),e.controls.getTarget(this._previousTarget),this._previousProjection=e.projection.current}updateCurrentPlan(e){const s=this.list.find(i=>i.id===e);if(!s)throw new Error("The specified plan is undefined!");this.currentPlan=s}async hidePreviousClippingPlane(){if(this.currentPlan){const e=this.currentPlan.plane;e&&(e.enabled=!1),this.currentPlan.plane instanceof F&&(this.currentPlan.plane.edges.visible=!1)}}getAbsoluteFloorHeight(e,s){const i=e.RelativePlacement.Location.Coordinates;s.value+=i[2].value,e.PlacementRelTo&&this.getAbsoluteFloorHeight(e.PlacementRelTo,s)}};r(P,"uuid","a80874aa-1c93-43a4-80f2-df346da086b1");let v=P;const ne=document.getElementById("container"),a=new $,oe=a.get(z),t=oe.create();t.scene=new Y(a);t.renderer=new te(a,ne);t.camera=new q(a);t.renderer.postproduction.enabled=!0;t.renderer.postproduction.customEffects.outlineEnabled=!0;a.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const L=a.get(J);L.config.color.setHex(6710886);const S=L.create(t);S.three.position.y-=1;t.renderer.postproduction.customEffects.excludedMeshes.push(S.three);const T=a.get(K),re=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),ie=await re.arrayBuffer(),ae=new Uint8Array(ie),d=T.load(ae);t.scene.three.add(d);const le=await fetch("https://thatopen.github.io/engine_components/resources/small.json"),ce=await le.json();d.setLocalProperties(ce);const f=a.get(v);f.world=t;await f.generate(d);Z.init();const u=a.get(Q);u.byModel(d.uuid,d);const D=u.find({models:[d.uuid]}),C=new V("white"),de=t.scene.three.background;u.byEntity(d);const p=a.get(ee),k=a.get(se);k.setup({world:t});const pe=a.get(X),x=pe.create(t);for(const n of d.items)x.add(n.mesh);x.needsUpdate=!0;t.camera.controls.addEventListener("sleep",()=>{x.needsUpdate=!0});const ue=new _({color:"gray",side:2}),he=new W({color:"black"}),fe=new _({color:"black",opacity:.5,side:2,transparent:!0});p.styles.create("thick",new Set,t,he,ue,fe);const I=u.find({entities:["IFCWALLSTANDARDCASE","IFCWALL"]});for(const n in I){const o=T.list.get(n);if(!o)continue;const{mesh:e}=o;p.styles.list.thick.fragments[n]=new Set(I[n]),p.styles.list.thick.meshes.add(e)}p.styles.create("thin",new Set,t);const A=u.find({entities:["IFCDOOR","IFCWINDOW","IFCPLATE","IFCMEMBER"]});for(const n in A){const o=T.list.get(n);if(!o)continue;const{mesh:e}=o;p.styles.list.thin.fragments[n]=new Set(A[n]),p.styles.list.thin.meshes.add(e)}await p.update(!0);const O=y.create(()=>E` +var N=Object.defineProperty;var B=(n,o,e)=>o in n?N(n,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[o]=e;var r=(n,o,e)=>(B(n,typeof o!="symbol"?o+"":o,e),e);import{V as w,i as R,C as V,d as _,L as W}from"./web-ifc-api-BC8YMRiS.js";import{S as G}from"./stats.min-GTpOrGrX.js";import{J as H,D as b,G as M,m as U,f as $,p as z,s as Y,n as q,N as J,u as K,R as Q,C as X}from"./index-C-JPXu_n.js";import{p as Z,a as y,m as E}from"./index-DyM33b1I.js";import{E as F,C as ee}from"./index-DHD4JXQh.js";import{P as te}from"./index-q_Y48tt2.js";import"./import-wrapper-prod-LhqN7JJy.js";import{H as se}from"./index-C5tZttZE.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-Vj-QiZHm.js";const P=class P extends H{constructor(e){super(e);r(this,"onDisposed",new b);r(this,"onNavigated",new b);r(this,"onExited",new b);r(this,"enabled",!1);r(this,"currentPlan",null);r(this,"defaultSectionOffset",1.5);r(this,"defaultCameraOffset",30);r(this,"list",[]);r(this,"world");r(this,"_floorPlanViewCached",!1);r(this,"_previousCamera",new w);r(this,"_previousTarget",new w);r(this,"_previousProjection","Perspective");this.components.add(P.uuid,this)}dispose(){this.onExited.reset(),this.onNavigated.reset(),this.list=[],this.onDisposed.trigger(),this.onDisposed.reset()}async generate(e){if(!e.hasProperties)throw new Error("Properties are needed to compute plan views!");const s=await e.getAllPropertiesOfType(R);if(!s)throw new Error("Floorplans not found!");const i=e.coordinationMatrix.elements[13],h=await M.getUnits(e);for(const l of Object.values(s)){const g={value:0};this.getAbsoluteFloorHeight(l.ObjectPlacement,g);const c=g.value*h+i;this.create({name:l.Name.value,id:l.GlobalId.value,normal:new w(0,-1,0),point:new w(0,c,0),ortho:!0,offset:this.defaultSectionOffset})}}create(e){if(!this.world)throw new Error("You must set a world before creating the clipping planes!");if(this.list.find(l=>l.id===e.id)){console.warn(`There's already a plan with the id: ${e.id}`);return}const i=this.createClippingPlane(e),h={...e,plane:i};this.list.push(h)}async goTo(e,s=!1){var i;((i=this.currentPlan)==null?void 0:i.id)!==e&&(this.onNavigated.trigger({id:e}),this.storeCameraPosition(),await this.hidePreviousClippingPlane(),this.updateCurrentPlan(e),await this.activateCurrentPlan(),this.enabled||(await this.moveCameraTo2DPlanPosition(s),this.enabled=!0))}async exitPlanView(e=!1){if(!this.enabled||!this.world)return;this.enabled=!1,this.onExited.trigger(),this.cacheFloorplanView();const s=this.world.camera;s.set("Orbit"),await s.projection.set(this._previousProjection),this.currentPlan&&this.currentPlan.plane&&(this.currentPlan.plane.enabled=!1,this.currentPlan.plane.edges.enabled=!1,this.currentPlan.plane.edges.visible=!1),this.currentPlan=null,await s.controls.setLookAt(this._previousCamera.x,this._previousCamera.y,this._previousCamera.z,this._previousTarget.x,this._previousTarget.y,this._previousTarget.z,e)}storeCameraPosition(){this.enabled?this.cacheFloorplanView():this.store3dCameraPosition()}createClippingPlane(e){if(!this.world)throw new Error("World is needed to create clipping planes!");const{normal:s,point:i}=e,h=i.clone();e.offset&&(h.y+=e.offset);const l=this.components.get(U),g=l.Type;l.Type=F;const c=l.createFromNormalAndCoplanarPoint(this.world,s,h);return c.edges.update(),c.visible=!1,c.enabled=!1,c.edges.enabled=!1,c.edges.visible=!1,l.Type=g,c}cacheFloorplanView(){if(!this.world)throw new Error("World is needed to create clipping planes!");this._floorPlanViewCached=!0,this.world.camera.controls.saveState()}async moveCameraTo2DPlanPosition(e){if(!this.world)throw new Error("World is needed to create clipping planes!");const s=this.world.camera;this._floorPlanViewCached?await s.controls.reset(e):await s.controls.setLookAt(0,100,0,0,0,0,e)}async activateCurrentPlan(){if(!this.world)throw new Error("World is needed to create clipping planes!");if(!this.currentPlan)throw new Error("Current plan is not defined.");const e=this.world.camera;this.currentPlan.plane&&(this.currentPlan.plane.enabled=!0,this.currentPlan.plane.edges.fillNeedsUpdate=!0,this.currentPlan.plane.edges.visible=!0),e.set("Plan");const s=this.currentPlan.ortho?"Orthographic":"Perspective";await e.projection.set(s)}store3dCameraPosition(){if(!this.world)throw new Error("World is needed to create clipping planes!");const e=this.world.camera;e.three.getWorldPosition(this._previousCamera),e.controls.getTarget(this._previousTarget),this._previousProjection=e.projection.current}updateCurrentPlan(e){const s=this.list.find(i=>i.id===e);if(!s)throw new Error("The specified plan is undefined!");this.currentPlan=s}async hidePreviousClippingPlane(){if(this.currentPlan){const e=this.currentPlan.plane;e&&(e.enabled=!1),this.currentPlan.plane instanceof F&&(this.currentPlan.plane.edges.visible=!1)}}getAbsoluteFloorHeight(e,s){const i=e.RelativePlacement.Location.Coordinates;s.value+=i[2].value,e.PlacementRelTo&&this.getAbsoluteFloorHeight(e.PlacementRelTo,s)}};r(P,"uuid","a80874aa-1c93-43a4-80f2-df346da086b1");let v=P;const ne=document.getElementById("container"),a=new $,oe=a.get(z),t=oe.create();t.scene=new Y(a);t.renderer=new te(a,ne);t.camera=new q(a);t.renderer.postproduction.enabled=!0;t.renderer.postproduction.customEffects.outlineEnabled=!0;a.init();t.camera.controls.setLookAt(12,6,8,0,0,-10);t.scene.setup();const L=a.get(J);L.config.color.setHex(6710886);const D=L.create(t);D.three.position.y-=1;t.renderer.postproduction.customEffects.excludedMeshes.push(D.three);const T=a.get(K),re=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),ie=await re.arrayBuffer(),ae=new Uint8Array(ie),d=T.load(ae);t.scene.three.add(d);const le=await fetch("https://thatopen.github.io/engine_components/resources/small.json"),ce=await le.json();d.setLocalProperties(ce);const f=a.get(v);f.world=t;await f.generate(d);Z.init();const u=a.get(Q);u.byModel(d.uuid,d);const S=u.find({models:[d.uuid]}),C=new V("white"),de=t.scene.three.background;u.byEntity(d);const p=a.get(ee),k=a.get(se);k.setup({world:t});const pe=a.get(X),x=pe.create(t);for(const n of d.items)x.add(n.mesh);x.needsUpdate=!0;t.camera.controls.addEventListener("sleep",()=>{x.needsUpdate=!0});const ue=new _({color:"gray",side:2}),he=new W({color:"black"}),fe=new _({color:"black",opacity:.5,side:2,transparent:!0});p.styles.create("thick",new Set,t,he,ue,fe);const I=u.find({entities:["IFCWALLSTANDARDCASE","IFCWALL"]});for(const n in I){const o=T.list.get(n);if(!o)continue;const{mesh:e}=o;p.styles.list.thick.fragments[n]=new Set(I[n]),p.styles.list.thick.meshes.add(e)}p.styles.create("thin",new Set,t);const A=u.find({entities:["IFCDOOR","IFCWINDOW","IFCPLATE","IFCMEMBER"]});for(const n in A){const o=T.list.get(n);if(!o)continue;const{mesh:e}=o;p.styles.list.thin.fragments[n]=new Set(A[n]),p.styles.list.thin.meshes.add(e)}await p.update(!0);const O=y.create(()=>E` @@ -6,10 +6,10 @@ var N=Object.defineProperty;var B=(n,o,e)=>o in n?N(n,o,{enumerable:!0,configura `);document.body.append(O);const me=t.renderer.postproduction.customEffects.minGloss,j=O.querySelector("bim-panel-section[name='floorPlans']");for(const n of f.list){const o=y.create(()=>E` + @click="${()=>{t.renderer.postproduction.customEffects.minGloss=.1,k.backupColor=C,u.setColor(S,C),t.scene.three.background=C,f.goTo(n.id)}}"> `);j.append(o)}const ge=y.create(()=>E` + @click="${()=>{k.backupColor=null,t.renderer.postproduction.customEffects.minGloss=me,u.resetColor(S),t.scene.three.background=de,f.exitPlanView()}}"> - `);j.append(ge);const m=new U;m.showPanel(2);document.body.append(m.dom);m.dom.style.left="0px";t.renderer.onBeforeUpdate.add(()=>m.begin());t.renderer.onAfterUpdate.add(()=>m.end()); + `);j.append(ge);const m=new G;m.showPanel(2);document.body.append(m.dom);m.dom.style.left="0px";t.renderer.onBeforeUpdate.add(()=>m.begin());t.renderer.onAfterUpdate.add(()=>m.end()); diff --git a/examples/assets/postproductionRenderer.js b/examples/assets/postproductionRenderer.js index de907bada..9c06e084c 100644 --- a/examples/assets/postproductionRenderer.js +++ b/examples/assets/postproductionRenderer.js @@ -1,4 +1,4 @@ -import{C as c}from"./web-ifc-api-BC8YMRiS.js";import{S as b}from"./stats.min-GTpOrGrX.js";import{p,a as m,m as u}from"./index-DyM33b1I.js";import{f as d,p as f,s as h,k as g,N as v,u as x}from"./index-b4ozRbQy.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as $}from"./index-CwA6v-S5.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-BOMjjrxA.js";const k=document.getElementById("container"),t=new d,E=t.get(f),a=E.create();a.scene=new h(t);a.renderer=new $(t,k);a.camera=new g(t);a.scene.three.background=null;t.init();a.camera.controls.setLookAt(12,6,8,0,0,-10);a.scene.setup();const r=t.get(v);r.config.color.set(6710886);const w=r.create(a),o=new b;o.showPanel(2);document.body.append(o.dom);o.dom.style.zIndex="unset";o.dom.style.left="0px";a.renderer.onBeforeUpdate.add(()=>o.begin());a.renderer.onAfterUpdate.add(()=>o.end());const y=new x(t),S=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),R=await S.arrayBuffer(),A=new Uint8Array(R),C=y.load(A);a.scene.three.add(C);const{postproduction:n}=a.renderer;n.enabled=!0;n.customEffects.excludedMeshes.push(w.three);const s=n.n8ao.configuration;p.init();const l=m.create(()=>u` +import{C as c}from"./web-ifc-api-BC8YMRiS.js";import{S as b}from"./stats.min-GTpOrGrX.js";import{p,a as m,m as u}from"./index-DyM33b1I.js";import{f as d,p as f,s as h,k as g,N as v,u as x}from"./index-C-JPXu_n.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as $}from"./index-q_Y48tt2.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-Vj-QiZHm.js";const k=document.getElementById("container"),t=new d,E=t.get(f),a=E.create();a.scene=new h(t);a.renderer=new $(t,k);a.camera=new g(t);a.scene.three.background=null;t.init();a.camera.controls.setLookAt(12,6,8,0,0,-10);a.scene.setup();const r=t.get(v);r.config.color.set(6710886);const w=r.create(a),o=new b;o.showPanel(2);document.body.append(o.dom);o.dom.style.zIndex="unset";o.dom.style.left="0px";a.renderer.onBeforeUpdate.add(()=>o.begin());a.renderer.onAfterUpdate.add(()=>o.end());const y=new x(t),S=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),R=await S.arrayBuffer(),A=new Uint8Array(R),C=y.load(A);a.scene.three.add(C);const{postproduction:n}=a.renderer;n.enabled=!0;n.customEffects.excludedMeshes.push(w.three);const s=n.n8ao.configuration;p.init();const l=m.create(()=>u` diff --git a/examples/assets/raycasters.js b/examples/assets/raycasters.js index df79c8f81..1406ae94a 100644 --- a/examples/assets/raycasters.js +++ b/examples/assets/raycasters.js @@ -1 +1 @@ -import{b as u,B as p,M as i}from"./web-ifc-api-BC8YMRiS.js";import{S as w}from"./stats.min-GTpOrGrX.js";import{f as b,p as f,s as y,i as g,k as x,H as M}from"./index-b4ozRbQy.js";import"./_commonjsHelpers-Cpj98o6Y.js";const h=document.getElementById("container"),o=new b,B=o.get(f),e=B.create();e.scene=new y(o);e.renderer=new g(o,h);e.camera=new x(o);o.init();e.camera.controls.setLookAt(10,10,10,0,0,0);e.scene.setup();e.scene.three.background=null;const d=new u({color:"#6528D7"}),k=new u({color:"#BCF124"}),m=new p(3,3,3),c=new i(m,d),r=new i(m,d),s=new i(m,d);e.scene.three.add(c,r,s);const S=[c,r,s];r.position.x=5;s.position.x=-5;const t=Math.PI/180;function j(){c.rotation.x+=t,c.rotation.y+=t,r.rotation.x+=t,r.rotation.z+=t,s.rotation.y+=t,s.rotation.z+=t}e.renderer.onBeforeUpdate.add(j);const z=o.get(M),I=z.get(e);let l=null;window.onmousemove=()=>{const a=I.castRay(S);l&&(l.material=d),!(!a||!(a.object instanceof i))&&(a.object.material=k,l=a.object)};const n=new w;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end()); +import{b as u,B as p,M as i}from"./web-ifc-api-BC8YMRiS.js";import{S as w}from"./stats.min-GTpOrGrX.js";import{f as b,p as f,s as y,i as g,k as x,H as M}from"./index-C-JPXu_n.js";import"./_commonjsHelpers-Cpj98o6Y.js";const h=document.getElementById("container"),o=new b,B=o.get(f),e=B.create();e.scene=new y(o);e.renderer=new g(o,h);e.camera=new x(o);o.init();e.camera.controls.setLookAt(10,10,10,0,0,0);e.scene.setup();e.scene.three.background=null;const d=new u({color:"#6528D7"}),k=new u({color:"#BCF124"}),m=new p(3,3,3),c=new i(m,d),r=new i(m,d),s=new i(m,d);e.scene.three.add(c,r,s);const S=[c,r,s];r.position.x=5;s.position.x=-5;const t=Math.PI/180;function j(){c.rotation.x+=t,c.rotation.y+=t,r.rotation.x+=t,r.rotation.z+=t,s.rotation.y+=t,s.rotation.z+=t}e.renderer.onBeforeUpdate.add(j);const z=o.get(M),I=z.get(e);let l=null;window.onmousemove=()=>{const a=I.castRay(S);l&&(l.material=d),!(!a||!(a.object instanceof i))&&(a.object.material=k,l=a.object)};const n=new w;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end()); diff --git a/examples/assets/renderer-with-2d-BOMjjrxA.js b/examples/assets/renderer-with-2d-Vj-QiZHm.js similarity index 97% rename from examples/assets/renderer-with-2d-BOMjjrxA.js rename to examples/assets/renderer-with-2d-Vj-QiZHm.js index 587366e9f..377bcd52f 100644 --- a/examples/assets/renderer-with-2d-BOMjjrxA.js +++ b/examples/assets/renderer-with-2d-Vj-QiZHm.js @@ -1 +1 @@ -var z=Object.defineProperty;var _=(l,n,r)=>n in l?z(l,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[n]=r;var S=(l,n,r)=>(_(l,typeof n!="symbol"?n+"":n,r),r);import{V as x,a as M,O as R,f as A,n as q}from"./web-ifc-api-BC8YMRiS.js";import{i as T}from"./index-b4ozRbQy.js";class U extends R{constructor(n=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=n,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new A(.5,.5),this.addEventListener("removed",function(){this.traverse(function(r){r.element instanceof Element&&r.element.parentNode!==null&&r.element.parentNode.removeChild(r.element)})})}copy(n,r){return super.copy(n,r),this.element=n.element.cloneNode(!0),this.center=n.center,this}}const c=new x,D=new M,v=new M,g=new x,w=new x;class F{constructor(n={}){const r=this;let u,m,d,a;const f={objects:new WeakMap},h=n.element!==void 0?n.element:document.createElement("div");h.style.overflow="hidden",this.domElement=h,this.getSize=function(){return{width:u,height:m}},this.render=function(e,t){e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),D.copy(t.matrixWorldInverse),v.multiplyMatrices(t.projectionMatrix,D),y(e,e,t),E(e)},this.setSize=function(e,t){u=e,m=t,d=u/2,a=m/2,h.style.width=e+"px",h.style.height=t+"px"};function y(e,t,s){if(e.isCSS2DObject){c.setFromMatrixPosition(e.matrixWorld),c.applyMatrix4(v);const i=e.visible===!0&&c.z>=-1&&c.z<=1&&e.layers.test(s.layers)===!0;if(e.element.style.display=i===!0?"":"none",i===!0){e.onBeforeRender(r,t,s);const p=e.element;p.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(c.x*d+d)+"px,"+(-c.y*a+a)+"px)",p.parentNode!==h&&h.appendChild(p),e.onAfterRender(r,t,s)}const o={distanceToCameraSquared:W(s,e)};f.objects.set(e,o)}for(let i=0,o=e.children.length;i{if(this.onBeforeUpdate.trigger(this),!this.enabled||!this.currentWorld)return;const d=this.currentWorld.scene.three,a=this.currentWorld.camera.three;d instanceof q&&this.three2D.render(d,a)}),this.onDisposed.add(()=>{this.three2D.domElement.remove()}),this.onResize.add(({x:d,y:a})=>{this.three2D.setSize(d,a)}),this.setupHtmlRenderer(),this.resize()}setupHtmlRenderer(){this.three2D.domElement.style.position="absolute",this.three2D.domElement.style.top="0px",this.three2D.domElement.style.pointerEvents="none",this.container&&this.container.appendChild(this.three2D.domElement)}}export{U as C,B as R}; +var z=Object.defineProperty;var _=(l,n,r)=>n in l?z(l,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[n]=r;var S=(l,n,r)=>(_(l,typeof n!="symbol"?n+"":n,r),r);import{V as x,a as M,O as R,f as A,n as q}from"./web-ifc-api-BC8YMRiS.js";import{i as T}from"./index-C-JPXu_n.js";class U extends R{constructor(n=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=n,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new A(.5,.5),this.addEventListener("removed",function(){this.traverse(function(r){r.element instanceof Element&&r.element.parentNode!==null&&r.element.parentNode.removeChild(r.element)})})}copy(n,r){return super.copy(n,r),this.element=n.element.cloneNode(!0),this.center=n.center,this}}const c=new x,D=new M,v=new M,g=new x,w=new x;class F{constructor(n={}){const r=this;let u,m,d,a;const f={objects:new WeakMap},h=n.element!==void 0?n.element:document.createElement("div");h.style.overflow="hidden",this.domElement=h,this.getSize=function(){return{width:u,height:m}},this.render=function(e,t){e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),D.copy(t.matrixWorldInverse),v.multiplyMatrices(t.projectionMatrix,D),y(e,e,t),E(e)},this.setSize=function(e,t){u=e,m=t,d=u/2,a=m/2,h.style.width=e+"px",h.style.height=t+"px"};function y(e,t,s){if(e.isCSS2DObject){c.setFromMatrixPosition(e.matrixWorld),c.applyMatrix4(v);const i=e.visible===!0&&c.z>=-1&&c.z<=1&&e.layers.test(s.layers)===!0;if(e.element.style.display=i===!0?"":"none",i===!0){e.onBeforeRender(r,t,s);const p=e.element;p.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(c.x*d+d)+"px,"+(-c.y*a+a)+"px)",p.parentNode!==h&&h.appendChild(p),e.onAfterRender(r,t,s)}const o={distanceToCameraSquared:W(s,e)};f.objects.set(e,o)}for(let i=0,o=e.children.length;i{if(this.onBeforeUpdate.trigger(this),!this.enabled||!this.currentWorld)return;const d=this.currentWorld.scene.three,a=this.currentWorld.camera.three;d instanceof q&&this.three2D.render(d,a)}),this.onDisposed.add(()=>{this.three2D.domElement.remove()}),this.onResize.add(({x:d,y:a})=>{this.three2D.setSize(d,a)}),this.setupHtmlRenderer(),this.resize()}setupHtmlRenderer(){this.three2D.domElement.style.position="absolute",this.three2D.domElement.style.top="0px",this.three2D.domElement.style.pointerEvents="none",this.container&&this.container.appendChild(this.three2D.domElement)}}export{U as C,B as R}; diff --git a/examples/assets/shadowDropper.js b/examples/assets/shadowDropper.js index 025434405..3815b1549 100644 --- a/examples/assets/shadowDropper.js +++ b/examples/assets/shadowDropper.js @@ -1,4 +1,4 @@ -var z=Object.defineProperty;var C=(u,v,e)=>v in u?z(u,v,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[v]=e;var s=(u,v,e)=>(C(u,typeof v!="symbol"?v+"":v,e),e);import{d as w,l as k,m as T,n as E,M as g,G as U,W as y,o as F,p as R,V as M,q as S,B as $,b as O,C as G}from"./web-ifc-api-BC8YMRiS.js";import{J as I,U as V,a as H,f as W,p as A,s as N,k as j,N as L}from"./index-b4ozRbQy.js";import{S as Z}from"./stats.min-GTpOrGrX.js";import{p as q,a as J,m as X}from"./index-DyM33b1I.js";import{R as K}from"./renderer-with-2d-BOMjjrxA.js";import"./import-wrapper-prod-LhqN7JJy.js";import"./_commonjsHelpers-Cpj98o6Y.js";const Q={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:` +var z=Object.defineProperty;var C=(u,v,e)=>v in u?z(u,v,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[v]=e;var s=(u,v,e)=>(C(u,typeof v!="symbol"?v+"":v,e),e);import{d as w,l as k,m as T,n as E,M as g,G as U,W as y,o as F,p as R,V as M,q as S,B as $,b as O,C as G}from"./web-ifc-api-BC8YMRiS.js";import{J as I,D as V,a as H,f as W,p as A,s as N,k as j,N as L}from"./index-C-JPXu_n.js";import{S as Z}from"./stats.min-GTpOrGrX.js";import{p as q,a as J,m as X}from"./index-DyM33b1I.js";import{R as K}from"./renderer-with-2d-Vj-QiZHm.js";import"./import-wrapper-prod-LhqN7JJy.js";import"./_commonjsHelpers-Cpj98o6Y.js";const Q={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:` varying vec2 vUv; diff --git a/examples/assets/utils.js b/examples/assets/utils.js index 496aa83ba..7c4a33674 100644 --- a/examples/assets/utils.js +++ b/examples/assets/utils.js @@ -1 +1 @@ -var W=Object.defineProperty;var q=(v,t,e)=>t in v?W(v,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):v[t]=e;var c=(v,t,e)=>(q(v,typeof t!="symbol"?t+"":t,e),e);import{f as O,z as j,r as H,V as D,P as J,I as K,a as R,M as V,ap as Q,L as Z,s as ee}from"./web-ifc-api-BC8YMRiS.js";import{S as te}from"./stats.min-GTpOrGrX.js";import{E as T,C as B,a as se,W as ne,S as oe,b as re,c as ie,G as ae}from"./index-BraZXcLv.js";import{C as ce}from"./index-D6HCkz61.js";import{F as de}from"./index-DDOiyGyA.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./async-event-D8tC9awa.js";class fe{constructor(t){c(this,"_event");c(this,"_position",new O);c(this,"onDisposed",new T);c(this,"updateMouseInfo",t=>{this._event=t});this.dom=t,this.setupEvents(!0)}get position(){if(this._event){const t=this.dom.getBoundingClientRect();this._position.x=this.getPositionX(t,this._event),this._position.y=this.getPositionY(t,this._event)}return this._position}dispose(){this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset()}getPositionY(t,e){return-((e.clientY-t.top)/(t.bottom-t.top))*2+1}getPositionX(t,e){return(e.clientX-t.left)/(t.right-t.left)*2-1}setupEvents(t){t?this.dom.addEventListener("mousemove",this.updateMouseInfo):this.dom.removeEventListener("mousemove",this.updateMouseInfo)}}class le{constructor(t,e){c(this,"enabled",!0);c(this,"components");c(this,"onDisposed",new T);c(this,"mouse");c(this,"three",new j);c(this,"world");const s=e.renderer;if(!s)throw new Error("A renderer is needed for the raycaster to work!");this.world=e,this.mouse=new fe(s.three.domElement),this.components=t}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(t=Array.from(this.world.meshes)){if(!this.world)throw new Error("A world is needed to cast rays!");const e=this.world.camera.three;return this.three.setFromCamera(this.mouse.position,e),this.intersect(t)}castRayFromVector(t,e,s=Array.from(this.world.meshes)){return this.three.set(t,e),this.intersect(s)}intersect(t=Array.from(this.world.meshes)){const e=this.three.intersectObjects(t),s=this.filterClippingPlanes(e);return s.length>0?s[0]:null}filterClippingPlanes(t){if(!this.world.renderer)throw new Error("Renderer not found!");const e=this.world.renderer.three;if(!e.clippingPlanes)return t;const s=e.clippingPlanes;return t.length<=0||!s||(s==null?void 0:s.length)<=0?t:t.filter(m=>s.every(y=>y.distanceToPoint(m.point)>0))}}const A=class A extends B{constructor(e){super(e);c(this,"enabled",!0);c(this,"list",new Map);c(this,"onDisposed",new T);e.add(A.uuid,this)}get(e){if(this.list.has(e.uuid))return this.list.get(e.uuid);const s=new le(this.components,e);return this.list.set(e.uuid,s),e.onDisposed.add(()=>{this.delete(e)}),s}delete(e){const s=this.list.get(e.uuid);s&&s.dispose(),this.list.delete(e.uuid)}dispose(){for(const[e,s]of this.list)s.dispose();this.list.clear(),this.onDisposed.trigger()}};c(A,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let C=A;const S=class S extends B{constructor(e){super(e);c(this,"enabled",!0);e.add(S.uuid,this)}getFace(e,s,m){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const y=new Map,o=e.geometry.index.array,{plane:i}=this.getFaceData(s,m,e),l=[];for(let f=0;fn.id);if(!a.size){const n=x++;for(const{id:u}of h)d.set(u,n);w.set(n,{edges:new Set(g),indices:new Set([f])});continue}let r=null;const E=new Set,M=new Set(g);for(const[n,u]of a){r===null?r=u:u!==r&&E.add(u),d.delete(n);const{edges:z}=w.get(u);z.delete(n),M.delete(n)}if(r===null)throw new Error("Error computing face!");const I=w.get(r),{indices:P}=I;P.add(f);for(const n of M){d.set(n,r);const{edges:u}=I;u.add(n)}for(const n of E){const u=w.get(n),{edges:z,indices:U}=u,X=w.get(r),{edges:Y,indices:k}=X;for(const b of z)Y.add(b),d.set(b,r);for(const b of U)k.add(b);w.delete(n)}}for(const[f,{indices:h,edges:a}]of w)if(h.has(s)){const g=[];for(const r of a){const E=y.get(r);g.push(E)}return{edges:g,indices:h}}return null}static distanceFromPointToLine(e,s,m,y=!1){const o=new H,i=new D;return o.set(s,m),o.closestPointToPoint(e,y,i),i.distanceTo(e)}getFaceData(e,s,m){const y=this.getVerticesAndNormal(m,e,s),{p1:o,p2:i,p3:l,faceNormal:x}=y;this.round(o),this.round(i),this.round(l),this.round(x);const d=[{id:`${o.x}|${o.y}|${o.z}`,value:o},{id:`${i.x}|${i.y}|${i.z}`,value:i},{id:`${l.x}|${l.y}|${l.z}`,value:l}];d.sort((I,P)=>I.idP.id?1:0);const[{id:w,value:f},{id:h,value:a},{id:g,value:r}]=d,E=[{id:`${w}|${h}`,distance:f.distanceTo(a),points:[f,a]},{id:`${h}|${g}`,distance:a.distanceTo(r),points:[a,r]},{id:`${w}|${g}`,distance:f.distanceTo(r),points:[f,r]}],M=new J;return M.setFromNormalAndCoplanarPoint(x,o),M.constant=Math.round(M.constant*10)/10,{plane:M,edges:E}}getVerticesAndNormal(e,s,m){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const y=e.geometry.index.array,o=e.geometry.attributes.position.array,i=e.geometry.attributes.normal.array,l=y[s*3]*3,x=y[s*3+1]*3,d=y[s*3+2]*3,w=new D(o[l],o[l+1],o[l+2]),f=new D(o[x],o[x+1],o[x+2]),h=new D(o[d],o[d+1],o[d+2]),a=new D(i[l],i[l+1],i[l+2]),g=new D(i[x],i[x+1],i[x+2]),r=new D(i[d],i[d+1],i[d+2]),E=(a.x+g.x+r.x)/3,M=(a.y+g.y+r.y)/3,I=(a.z+g.z+r.z)/3,P=new D(E,M,I);if(m!==void 0&&e instanceof K){const n=new R;e.getMatrixAt(m,n);const u=new R;u.extractRotation(n),P.applyMatrix4(u),w.applyMatrix4(n),f.applyMatrix4(n),h.applyMatrix4(n)}return{p1:w,p2:f,p3:h,faceNormal:P}}round(e){e.x=Math.trunc(e.x*1e3)/1e3,e.y=Math.trunc(e.y*1e3)/1e3,e.z=Math.trunc(e.z*1e3)/1e3}};c(S,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let L=S;const ue=document.getElementById("container"),F=new se,pe=F.get(ne),p=pe.create();p.scene=new oe(F);p.renderer=new re(F,ue);p.camera=new ie(F);F.init();p.camera.controls.setLookAt(12,6,8,0,0,-10);p.scene.setup();const he=F.get(ae);he.create(p);const ge=new de(F),me=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),we=await me.arrayBuffer(),ye=new Uint8Array(we),N=ge.load(ye);p.scene.three.add(N);const ve=F.get(ce),_=ve.create(p);for(const v of N.children)v instanceof V&&_.add(v);_.needsUpdate=!0;p.camera.controls.addEventListener("sleep",()=>{_.needsUpdate=!0});const xe=F.get(L),Ee=F.get(C),Fe=Ee.get(p),G=new Q,Me=new Z({color:16711680,depthTest:!1}),De=new ee(G,Me);p.scene.three.add(De);p.renderer&&p.renderer.three.domElement.addEventListener("mousemove",()=>{const t=Fe.castRay([N]);if(!t||!(t.object instanceof V)||t.faceIndex===void 0)return;const e=xe.getFace(t.object,t.faceIndex,t.instanceId);if(e){const s=[];for(const m of e.edges)s.push(...m.points);G.setFromPoints(s)}});const $=new te;$.showPanel(2);document.body.append($.dom);$.dom.style.left="0px";$.dom.style.right="auto";p.renderer.onBeforeUpdate.add(()=>$.begin());p.renderer.onAfterUpdate.add(()=>$.end()); +var W=Object.defineProperty;var q=(v,t,e)=>t in v?W(v,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):v[t]=e;var c=(v,t,e)=>(q(v,typeof t!="symbol"?t+"":t,e),e);import{f as O,z as j,r as H,V as D,P as J,I as K,a as R,M as V,ap as Q,L as Z,s as ee}from"./web-ifc-api-BC8YMRiS.js";import{S as te}from"./stats.min-GTpOrGrX.js";import{E as T,C as B,a as se,W as ne,S as oe,b as re,c as ie,G as ae}from"./index-BZiAUaTo.js";import{C as ce}from"./index-CF1rTqG5.js";import{F as de}from"./index-CiqD_kld.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./async-event-D8tC9awa.js";class fe{constructor(t){c(this,"_event");c(this,"_position",new O);c(this,"onDisposed",new T);c(this,"updateMouseInfo",t=>{this._event=t});this.dom=t,this.setupEvents(!0)}get position(){if(this._event){const t=this.dom.getBoundingClientRect();this._position.x=this.getPositionX(t,this._event),this._position.y=this.getPositionY(t,this._event)}return this._position}dispose(){this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset()}getPositionY(t,e){return-((e.clientY-t.top)/(t.bottom-t.top))*2+1}getPositionX(t,e){return(e.clientX-t.left)/(t.right-t.left)*2-1}setupEvents(t){t?this.dom.addEventListener("mousemove",this.updateMouseInfo):this.dom.removeEventListener("mousemove",this.updateMouseInfo)}}class le{constructor(t,e){c(this,"enabled",!0);c(this,"components");c(this,"onDisposed",new T);c(this,"mouse");c(this,"three",new j);c(this,"world");const s=e.renderer;if(!s)throw new Error("A renderer is needed for the raycaster to work!");this.world=e,this.mouse=new fe(s.three.domElement),this.components=t}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(t=Array.from(this.world.meshes)){if(!this.world)throw new Error("A world is needed to cast rays!");const e=this.world.camera.three;return this.three.setFromCamera(this.mouse.position,e),this.intersect(t)}castRayFromVector(t,e,s=Array.from(this.world.meshes)){return this.three.set(t,e),this.intersect(s)}intersect(t=Array.from(this.world.meshes)){const e=this.three.intersectObjects(t),s=this.filterClippingPlanes(e);return s.length>0?s[0]:null}filterClippingPlanes(t){if(!this.world.renderer)throw new Error("Renderer not found!");const e=this.world.renderer.three;if(!e.clippingPlanes)return t;const s=e.clippingPlanes;return t.length<=0||!s||(s==null?void 0:s.length)<=0?t:t.filter(m=>s.every(y=>y.distanceToPoint(m.point)>0))}}const A=class A extends B{constructor(e){super(e);c(this,"enabled",!0);c(this,"list",new Map);c(this,"onDisposed",new T);e.add(A.uuid,this)}get(e){if(this.list.has(e.uuid))return this.list.get(e.uuid);const s=new le(this.components,e);return this.list.set(e.uuid,s),e.onDisposed.add(()=>{this.delete(e)}),s}delete(e){const s=this.list.get(e.uuid);s&&s.dispose(),this.list.delete(e.uuid)}dispose(){for(const[e,s]of this.list)s.dispose();this.list.clear(),this.onDisposed.trigger()}};c(A,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let C=A;const S=class S extends B{constructor(e){super(e);c(this,"enabled",!0);e.add(S.uuid,this)}getFace(e,s,m){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const y=new Map,o=e.geometry.index.array,{plane:i}=this.getFaceData(s,m,e),l=[];for(let f=0;fn.id);if(!a.size){const n=x++;for(const{id:u}of h)d.set(u,n);w.set(n,{edges:new Set(g),indices:new Set([f])});continue}let r=null;const E=new Set,M=new Set(g);for(const[n,u]of a){r===null?r=u:u!==r&&E.add(u),d.delete(n);const{edges:z}=w.get(u);z.delete(n),M.delete(n)}if(r===null)throw new Error("Error computing face!");const I=w.get(r),{indices:P}=I;P.add(f);for(const n of M){d.set(n,r);const{edges:u}=I;u.add(n)}for(const n of E){const u=w.get(n),{edges:z,indices:U}=u,X=w.get(r),{edges:Y,indices:k}=X;for(const b of z)Y.add(b),d.set(b,r);for(const b of U)k.add(b);w.delete(n)}}for(const[f,{indices:h,edges:a}]of w)if(h.has(s)){const g=[];for(const r of a){const E=y.get(r);g.push(E)}return{edges:g,indices:h}}return null}static distanceFromPointToLine(e,s,m,y=!1){const o=new H,i=new D;return o.set(s,m),o.closestPointToPoint(e,y,i),i.distanceTo(e)}getFaceData(e,s,m){const y=this.getVerticesAndNormal(m,e,s),{p1:o,p2:i,p3:l,faceNormal:x}=y;this.round(o),this.round(i),this.round(l),this.round(x);const d=[{id:`${o.x}|${o.y}|${o.z}`,value:o},{id:`${i.x}|${i.y}|${i.z}`,value:i},{id:`${l.x}|${l.y}|${l.z}`,value:l}];d.sort((I,P)=>I.idP.id?1:0);const[{id:w,value:f},{id:h,value:a},{id:g,value:r}]=d,E=[{id:`${w}|${h}`,distance:f.distanceTo(a),points:[f,a]},{id:`${h}|${g}`,distance:a.distanceTo(r),points:[a,r]},{id:`${w}|${g}`,distance:f.distanceTo(r),points:[f,r]}],M=new J;return M.setFromNormalAndCoplanarPoint(x,o),M.constant=Math.round(M.constant*10)/10,{plane:M,edges:E}}getVerticesAndNormal(e,s,m){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const y=e.geometry.index.array,o=e.geometry.attributes.position.array,i=e.geometry.attributes.normal.array,l=y[s*3]*3,x=y[s*3+1]*3,d=y[s*3+2]*3,w=new D(o[l],o[l+1],o[l+2]),f=new D(o[x],o[x+1],o[x+2]),h=new D(o[d],o[d+1],o[d+2]),a=new D(i[l],i[l+1],i[l+2]),g=new D(i[x],i[x+1],i[x+2]),r=new D(i[d],i[d+1],i[d+2]),E=(a.x+g.x+r.x)/3,M=(a.y+g.y+r.y)/3,I=(a.z+g.z+r.z)/3,P=new D(E,M,I);if(m!==void 0&&e instanceof K){const n=new R;e.getMatrixAt(m,n);const u=new R;u.extractRotation(n),P.applyMatrix4(u),w.applyMatrix4(n),f.applyMatrix4(n),h.applyMatrix4(n)}return{p1:w,p2:f,p3:h,faceNormal:P}}round(e){e.x=Math.trunc(e.x*1e3)/1e3,e.y=Math.trunc(e.y*1e3)/1e3,e.z=Math.trunc(e.z*1e3)/1e3}};c(S,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let L=S;const ue=document.getElementById("container"),F=new se,pe=F.get(ne),p=pe.create();p.scene=new oe(F);p.renderer=new re(F,ue);p.camera=new ie(F);F.init();p.camera.controls.setLookAt(12,6,8,0,0,-10);p.scene.setup();const he=F.get(ae);he.create(p);const ge=new de(F),me=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),we=await me.arrayBuffer(),ye=new Uint8Array(we),N=ge.load(ye);p.scene.three.add(N);const ve=F.get(ce),_=ve.create(p);for(const v of N.children)v instanceof V&&_.add(v);_.needsUpdate=!0;p.camera.controls.addEventListener("sleep",()=>{_.needsUpdate=!0});const xe=F.get(L),Ee=F.get(C),Fe=Ee.get(p),G=new Q,Me=new Z({color:16711680,depthTest:!1}),De=new ee(G,Me);p.scene.three.add(De);p.renderer&&p.renderer.three.domElement.addEventListener("mousemove",()=>{const t=Fe.castRay([N]);if(!t||!(t.object instanceof V)||t.faceIndex===void 0)return;const e=xe.getFace(t.object,t.faceIndex,t.instanceId);if(e){const s=[];for(const m of e.edges)s.push(...m.points);G.setFromPoints(s)}});const $=new te;$.showPanel(2);document.body.append($.dom);$.dom.style.left="0px";$.dom.style.right="auto";p.renderer.onBeforeUpdate.add(()=>$.begin());p.renderer.onAfterUpdate.add(()=>$.end()); diff --git a/examples/assets/volumeMeasurement.js b/examples/assets/volumeMeasurement.js index 67be2054c..912ae8335 100644 --- a/examples/assets/volumeMeasurement.js +++ b/examples/assets/volumeMeasurement.js @@ -1 +1 @@ -var C=Object.defineProperty;var z=(i,m,e)=>m in i?C(i,m,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[m]=e;var h=(i,m,e)=>(z(i,typeof m!="symbol"?m+"":m,e),e);import{M as S,a as E,I as D,V}from"./web-ifc-api-BC8YMRiS.js";import{S as O}from"./stats.min-GTpOrGrX.js";import{J as B,U as I,H,u as L,A as P,f as T,p as U,s as W,k as j,N as K}from"./index-b4ozRbQy.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as _}from"./index-CwA6v-S5.js";import{M as N}from"./mark-Cj_PmUva.js";import{n as R}from"./dimension-mark-BiAWnjiH.js";import{H as G}from"./index-DHjX9tRF.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-BOMjjrxA.js";const b=class b extends B{constructor(e){super(e);h(this,"label",null);h(this,"world");h(this,"onVolumeFound",new I);h(this,"_enabled",!1);h(this,"onDisposed",new I);h(this,"create",()=>{if(!this.enabled)return;if(!this.world)throw new Error("World is needed for Volume Measurement!");const t=this.components.get(H).get(this.world).castRay();if(!t||!t.object)return;const{object:r}=t;if(r instanceof S){const a=this.getVolumeOfMesh(r);this.onVolumeFound.trigger(a)}});h(this,"onMouseMove",()=>{});h(this,"onKeydown",e=>{});this.components.add(b.uuid,this)}set enabled(e){this._enabled=e,this.setupEvents(e),e||this.cancelCreation()}get enabled(){return this._enabled}async dispose(){var e;this.setupEvents(!1),(e=this.label)==null||e.dispose(),this.onDisposed.trigger(),this.onDisposed.reset(),this.components=null}delete(){}async deleteAll(){}endCreation(){}cancelCreation(){}get(){}getVolumeFromFragments(e){const n=this.components.get(L),t=new E,r=[];for(const a in e){const s=n.list.get(a);if(!s)continue;const o=e[a];let c=0;for(const w of o){const u=s.getInstancesIDs(w);u&&(c+=u.size)}const g=new D(s.mesh.geometry,void 0,c);let l=0;for(const w of o){const u=s.getInstancesIDs(w);if(u)for(const y of u)s.mesh.getMatrixAt(y,t),g.setMatrixAt(l++,t)}r.push(g)}return this.getVolumeFromMeshes(r)}getVolumeFromMeshes(e){if(!this.world)throw new Error("World is needed for Volume Measurement!");this.label||(this.label=this.newLabel(),this.label.three.removeFromParent());let n=0;for(const c of e)n+=this.getVolumeOfMesh(c);const t=this.world.scene.three,r=this.label.three;t.add(r);const a=this.components.get(P);for(const c of e)c.geometry.computeBoundingSphere(),a.addMesh(c);const s=a.getSphere();a.reset(),r.position.copy(s.center);const o=Math.trunc(n*100)/100;return r.element.textContent=o.toString(),n}newLabel(){if(!this.world)throw new Error("World is needed for Volume Measurement!");const e=R();return new N(this.world,e)}setupEvents(e){if(!this.world)throw new Error("The volume measurement needs a world to work!");if(!this.world.renderer)throw new Error("The world of the volume measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;e?(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown)):(t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown))}getVolumeOfMesh(e){let n=0;const t=new V,r=new V,a=new V,{index:s}=e.geometry,o=e.geometry.attributes.position.array;if(!s)return console.warn("Geometry must be indexed to compute its volume!"),0;const c=[];if(e instanceof D)for(let l=0;l{const m=p.getVolumeFromFragments(i);console.log(m)});A.events.select.onClear.add(()=>{var i;(i=p.label)==null||i.three.removeFromParent()});F.ondblclick=()=>p.create();F.oncontextmenu=()=>p.endCreation();window.onkeydown=i=>{i.code==="Delete"||i.code};const v=new O;v.showPanel(2);document.body.append(v.dom);v.dom.style.left="0px";d.renderer.onBeforeUpdate.add(()=>v.begin());d.renderer.onAfterUpdate.add(()=>v.end()); +var C=Object.defineProperty;var z=(i,m,e)=>m in i?C(i,m,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[m]=e;var h=(i,m,e)=>(z(i,typeof m!="symbol"?m+"":m,e),e);import{M as S,a as E,I as A,V}from"./web-ifc-api-BC8YMRiS.js";import{S as O}from"./stats.min-GTpOrGrX.js";import{J as B,D as I,H,u as L,A as P,f as T,p as W,s as j,k as K,N as U}from"./index-C-JPXu_n.js";import"./import-wrapper-prod-LhqN7JJy.js";import{P as _}from"./index-q_Y48tt2.js";import{M as N}from"./mark-Dwn_ERVH.js";import{n as R}from"./dimension-mark-BiAWnjiH.js";import{H as G}from"./index-C5tZttZE.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./renderer-with-2d-Vj-QiZHm.js";const b=class b extends B{constructor(e){super(e);h(this,"label",null);h(this,"world");h(this,"onVolumeFound",new I);h(this,"_enabled",!1);h(this,"onDisposed",new I);h(this,"create",()=>{if(!this.enabled)return;if(!this.world)throw new Error("World is needed for Volume Measurement!");const t=this.components.get(H).get(this.world).castRay();if(!t||!t.object)return;const{object:r}=t;if(r instanceof S){const a=this.getVolumeOfMesh(r);this.onVolumeFound.trigger(a)}});h(this,"onMouseMove",()=>{});h(this,"onKeydown",e=>{});this.components.add(b.uuid,this)}set enabled(e){this._enabled=e,this.setupEvents(e),e||this.cancelCreation()}get enabled(){return this._enabled}async dispose(){var e;this.setupEvents(!1),(e=this.label)==null||e.dispose(),this.onDisposed.trigger(),this.onDisposed.reset(),this.components=null}delete(){}async deleteAll(){}endCreation(){}cancelCreation(){}get(){}getVolumeFromFragments(e){const n=this.components.get(L),t=new E,r=[];for(const a in e){const s=n.list.get(a);if(!s)continue;const o=e[a];let c=0;for(const w of o){const u=s.getInstancesIDs(w);u&&(c+=u.size)}const g=new A(s.mesh.geometry,void 0,c);let l=0;for(const w of o){const u=s.getInstancesIDs(w);if(u)for(const y of u)s.mesh.getMatrixAt(y,t),g.setMatrixAt(l++,t)}r.push(g)}return this.getVolumeFromMeshes(r)}getVolumeFromMeshes(e){if(!this.world)throw new Error("World is needed for Volume Measurement!");this.label||(this.label=this.newLabel(),this.label.three.removeFromParent());let n=0;for(const c of e)n+=this.getVolumeOfMesh(c);const t=this.world.scene.three,r=this.label.three;t.add(r);const a=this.components.get(P);for(const c of e)c.geometry.computeBoundingSphere(),a.addMesh(c);const s=a.getSphere();a.reset(),r.position.copy(s.center);const o=Math.trunc(n*100)/100;return r.element.textContent=o.toString(),n}newLabel(){if(!this.world)throw new Error("World is needed for Volume Measurement!");const e=R();return new N(this.world,e)}setupEvents(e){if(!this.world)throw new Error("The volume measurement needs a world to work!");if(this.world.isDisposing)return;if(!this.world.renderer)throw new Error("The world of the volume measurement needs a renderer!");const t=this.world.renderer.three.domElement.parentElement;e?(t.addEventListener("click",this.create),t.addEventListener("mousemove",this.onMouseMove),window.addEventListener("keydown",this.onKeydown)):(t.removeEventListener("click",this.create),t.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("keydown",this.onKeydown))}getVolumeOfMesh(e){let n=0;const t=new V,r=new V,a=new V,{index:s}=e.geometry,o=e.geometry.attributes.position.array;if(!s)return console.warn("Geometry must be indexed to compute its volume!"),0;const c=[];if(e instanceof A)for(let l=0;l{const m=p.getVolumeFromFragments(i);console.log(m)});F.events.select.onClear.add(()=>{var i;(i=p.label)==null||i.three.removeFromParent()});D.ondblclick=()=>p.create();D.oncontextmenu=()=>p.endCreation();window.onkeydown=i=>{i.code==="Delete"||i.code};const v=new O;v.showPanel(2);document.body.append(v.dom);v.dom.style.left="0px";d.renderer.onBeforeUpdate.add(()=>v.begin());d.renderer.onAfterUpdate.add(()=>v.end()); diff --git a/examples/assets/worlds.js b/examples/assets/worlds.js index 36e6f88cc..3933e9549 100644 --- a/examples/assets/worlds.js +++ b/examples/assets/worlds.js @@ -1,4 +1,4 @@ -import{k as l,B as c,M as m,C as d,a_ as p,a$ as b}from"./web-ifc-api-BC8YMRiS.js";import{p as u,a,m as r}from"./index-DyM33b1I.js";import{f as h,p as f,s as g,i as w,k as y}from"./index-b4ozRbQy.js";import{S as k}from"./stats.min-GTpOrGrX.js";import"./_commonjsHelpers-Cpj98o6Y.js";const v=document.getElementById("container"),s=new h,L=s.get(f),e=L.create();e.scene=new g(s);e.renderer=new w(s,v);e.camera=new y(s);s.init();e.scene.three.background=null;const $=new l({color:"#6528D7"}),x=new c,B=new m(x,$);e.scene.three.add(B);e.scene.setup();e.camera.controls.setLookAt(3,3,3,0,0,0);const n=new k;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end());u.init();const i=a.create(()=>r` +import{k as l,B as c,M as m,C as d,a_ as p,a$ as b}from"./web-ifc-api-BC8YMRiS.js";import{p as u,a,m as r}from"./index-DyM33b1I.js";import{f as h,p as f,s as g,i as w,k as y}from"./index-C-JPXu_n.js";import{S as k}from"./stats.min-GTpOrGrX.js";import"./_commonjsHelpers-Cpj98o6Y.js";const v=document.getElementById("container"),s=new h,L=s.get(f),e=L.create();e.scene=new g(s);e.renderer=new w(s,v);e.camera=new y(s);s.init();e.scene.three.background=null;const $=new l({color:"#6528D7"}),x=new c,B=new m(x,$);e.scene.three.add(B);e.scene.setup();e.camera.controls.setLookAt(3,3,3,0,0,0);const n=new k;n.showPanel(2);document.body.append(n.dom);n.dom.style.left="0px";n.dom.style.zIndex="unset";e.renderer.onBeforeUpdate.add(()=>n.begin());e.renderer.onAfterUpdate.add(()=>n.end());u.init();const i=a.create(()=>r` diff --git a/package.json b/package.json index 520468a27..04dc0f79a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "description": "Collection of tools to author BIM apps.", - "version": "2.0.3", + "version": "2.0.4", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/core/package.json b/packages/core/package.json index 4cca6c354..489f333da 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components", "description": "Collection of core functionalities to author BIM apps.", - "version": "2.0.3", + "version": "2.0.4", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", diff --git a/packages/core/src/core/Grids/index.ts b/packages/core/src/core/Grids/index.ts index 85db1ee85..5901a3f32 100644 --- a/packages/core/src/core/Grids/index.ts +++ b/packages/core/src/core/Grids/index.ts @@ -1,13 +1,14 @@ import * as THREE from "three"; import { Component, Disposable, World, Event } from "../Types"; import { GridConfig, SimpleGrid } from "./src"; +import { Components } from "../Components"; export class Grids extends Component implements Disposable { static readonly uuid = "d1e814d5-b81c-4452-87a2-f039375e0489" as const; list = new Map(); - onDisposed = new Event(); + readonly onDisposed = new Event(); config: Required = { color: new THREE.Color(0xbbbbbb), @@ -19,6 +20,11 @@ export class Grids extends Component implements Disposable { /** {@link Component.enabled} */ enabled = true; + constructor(components: Components) { + super(components); + components.add(Grids.uuid, this); + } + create(world: World) { if (this.list.has(world.uuid)) { throw new Error("This world already has a grid!"); @@ -45,5 +51,6 @@ export class Grids extends Component implements Disposable { } this.list.clear(); this.onDisposed.trigger(); + this.onDisposed.reset(); } } diff --git a/packages/front/package.json b/packages/front/package.json index e11c8ef89..adcc00a9e 100644 --- a/packages/front/package.json +++ b/packages/front/package.json @@ -1,7 +1,7 @@ { "name": "@thatopen/components-front", "description": "Collection of frontend tools to author BIM apps.", - "version": "2.0.3", + "version": "2.0.4", "author": "That Open Company", "contributors": [ "Antonio Gonzalez Viegas (https://github.com/agviegas)", @@ -47,7 +47,7 @@ "web-ifc": "0.0.53" }, "dependencies": { - "@thatopen/components": "2.0.3", + "@thatopen/components": "2.0.4", "camera-controls": "2.7.3", "dexie": "^4.0.4", "earcut": "^2.2.4", diff --git a/packages/front/src/civil/Civil3DNavigator/index.ts b/packages/front/src/civil/Civil3DNavigator/index.ts index 47f943c8c..d46365908 100644 --- a/packages/front/src/civil/Civil3DNavigator/index.ts +++ b/packages/front/src/civil/Civil3DNavigator/index.ts @@ -143,7 +143,7 @@ export class Civil3DNavigator extends OBC.Component { throw new Error("No world found!"); } - if (!this.world.renderer) { + if (this.world.isDisposing || !this.world.renderer) { return; } const dom = this.world.renderer.three.domElement; diff --git a/packages/front/src/civil/CivilNavigator/index.ts b/packages/front/src/civil/CivilNavigator/index.ts index 0f1f901d1..329ecf399 100644 --- a/packages/front/src/civil/CivilNavigator/index.ts +++ b/packages/front/src/civil/CivilNavigator/index.ts @@ -242,7 +242,7 @@ export abstract class CivilNavigator extends OBC.Component { throw new Error("No world was given for this navigator!"); } - if (!this._world.renderer) { + if (this._world.isDisposing || !this._world.renderer) { return; } diff --git a/packages/front/src/fragments/Highlighter/index.ts b/packages/front/src/fragments/Highlighter/index.ts index 2a6823b94..f037b4c25 100644 --- a/packages/front/src/fragments/Highlighter/index.ts +++ b/packages/front/src/fragments/Highlighter/index.ts @@ -302,6 +302,10 @@ export class Highlighter throw new Error("No world found while setting up events!"); } + if (this.config.world.isDisposing) { + return; + } + if (!this.config.world.renderer) { throw new Error("The given world doesn't have a renderer!"); } diff --git a/packages/front/src/measurement/AngleMeasurement/index.ts b/packages/front/src/measurement/AngleMeasurement/index.ts index f3f73d1c4..4499d2498 100644 --- a/packages/front/src/measurement/AngleMeasurement/index.ts +++ b/packages/front/src/measurement/AngleMeasurement/index.ts @@ -145,6 +145,11 @@ export class AngleMeasurement if (!this.world) { throw new Error("No world selected for angle measurement!"); } + + if(this.world.isDisposing) { + return; + } + if (!this.world.renderer) { throw new Error("The given world doesn't have a renderer!"); } diff --git a/packages/front/src/measurement/AreaMeasurement/index.ts b/packages/front/src/measurement/AreaMeasurement/index.ts index 9c06d663e..9f52de416 100644 --- a/packages/front/src/measurement/AreaMeasurement/index.ts +++ b/packages/front/src/measurement/AreaMeasurement/index.ts @@ -126,6 +126,11 @@ export class AreaMeasurement if (!this.world) { throw new Error("The area measurement needs a world to work!"); } + + if (this.world.isDisposing) { + return; + } + if (!this.world.renderer) { throw new Error("The world of the area measurement needs a renderer!"); } diff --git a/packages/front/src/measurement/EdgeMeasurement/index.ts b/packages/front/src/measurement/EdgeMeasurement/index.ts index 2edbe74b9..31ffb5099 100644 --- a/packages/front/src/measurement/EdgeMeasurement/index.ts +++ b/packages/front/src/measurement/EdgeMeasurement/index.ts @@ -131,6 +131,9 @@ export class EdgeMeasurement if (!this.world) { throw new Error("The edge measurement needs a world to work!"); } + if (this.world.isDisposing) { + return; + } if (!this.world.renderer) { throw new Error("The world of the edge measurement needs a renderer!"); } diff --git a/packages/front/src/measurement/FaceMeasurement/index.ts b/packages/front/src/measurement/FaceMeasurement/index.ts index fe0f0cf12..6dea5c4c6 100644 --- a/packages/front/src/measurement/FaceMeasurement/index.ts +++ b/packages/front/src/measurement/FaceMeasurement/index.ts @@ -185,6 +185,9 @@ export class FaceMeasurement if (!this.world) { throw new Error("The face measurement needs a world to work!"); } + if (this.world.isDisposing) { + return; + } if (!this.world.renderer) { throw new Error("The world of the face measurement needs a renderer!"); } diff --git a/packages/front/src/measurement/LengthMeasurement/index.ts b/packages/front/src/measurement/LengthMeasurement/index.ts index 681dfeaa9..63ba032b5 100644 --- a/packages/front/src/measurement/LengthMeasurement/index.ts +++ b/packages/front/src/measurement/LengthMeasurement/index.ts @@ -247,6 +247,9 @@ export class LengthMeasurement if (!this.world) { throw new Error("The length measurement needs a world to work!"); } + if (this.world.isDisposing) { + return; + } if (!this.world.renderer) { throw new Error("The world of the length measurement needs a renderer!"); } diff --git a/packages/front/src/measurement/VolumeMeasurement/index.ts b/packages/front/src/measurement/VolumeMeasurement/index.ts index 72b86b807..3661022d0 100644 --- a/packages/front/src/measurement/VolumeMeasurement/index.ts +++ b/packages/front/src/measurement/VolumeMeasurement/index.ts @@ -162,6 +162,9 @@ export class VolumeMeasurement if (!this.world) { throw new Error("The volume measurement needs a world to work!"); } + if (this.world.isDisposing) { + return; + } if (!this.world.renderer) { throw new Error("The world of the volume measurement needs a renderer!"); }