diff --git a/examples/AngleMeasurement/index.html b/examples/AngleMeasurement/index.html index dd1e9b74c..5ce760552 100644 --- a/examples/AngleMeasurement/index.html +++ b/examples/AngleMeasurement/index.html @@ -58,9 +58,9 @@ - - - + + + diff --git a/examples/AreaMeasurement/index.html b/examples/AreaMeasurement/index.html index 2511d6557..2c9b20099 100644 --- a/examples/AreaMeasurement/index.html +++ b/examples/AreaMeasurement/index.html @@ -58,10 +58,10 @@ - + - - + +
diff --git a/examples/BoundingBoxer/index.html b/examples/BoundingBoxer/index.html index b59883078..a0a2484b1 100644 --- a/examples/BoundingBoxer/index.html +++ b/examples/BoundingBoxer/index.html @@ -58,10 +58,10 @@ - + - - + + diff --git a/examples/Civil3DNavigator/index.html b/examples/Civil3DNavigator/index.html index 668556ef9..4009680a4 100644 --- a/examples/Civil3DNavigator/index.html +++ b/examples/Civil3DNavigator/index.html @@ -58,10 +58,10 @@ - - + + - + diff --git a/examples/CivilCrossSectionNavigator/index.html b/examples/CivilCrossSectionNavigator/index.html index d6740de31..8695b3ae9 100644 --- a/examples/CivilCrossSectionNavigator/index.html +++ b/examples/CivilCrossSectionNavigator/index.html @@ -76,11 +76,11 @@ - - - - - + + + + + diff --git a/examples/CivilElevationNavigator/index.html b/examples/CivilElevationNavigator/index.html index 8bb1bde42..5333b8f10 100644 --- a/examples/CivilElevationNavigator/index.html +++ b/examples/CivilElevationNavigator/index.html @@ -77,11 +77,11 @@ - - - - - + + + + + diff --git a/examples/CivilPlanNavigator/index.html b/examples/CivilPlanNavigator/index.html index 42727d0e6..9f2c0cb4c 100644 --- a/examples/CivilPlanNavigator/index.html +++ b/examples/CivilPlanNavigator/index.html @@ -66,11 +66,11 @@ - - - - - + + + + + diff --git a/examples/Classifier/index.html b/examples/Classifier/index.html index 3ffc4b698..ef2bfae0d 100644 --- a/examples/Classifier/index.html +++ b/examples/Classifier/index.html @@ -58,10 +58,10 @@ - + - - + + diff --git a/examples/ClipEdges/index.html b/examples/ClipEdges/index.html index 1474469b9..734d35f1b 100644 --- a/examples/ClipEdges/index.html +++ b/examples/ClipEdges/index.html @@ -58,11 +58,11 @@ - + - - - + + + diff --git a/examples/Clipper/index.html b/examples/Clipper/index.html index 1c545fca3..d1a5474c9 100644 --- a/examples/Clipper/index.html +++ b/examples/Clipper/index.html @@ -58,10 +58,10 @@ - + - - + + diff --git a/examples/Cullers/index.html b/examples/Cullers/index.html index d9bf4699f..9d2f4bff2 100644 --- a/examples/Cullers/index.html +++ b/examples/Cullers/index.html @@ -58,9 +58,9 @@ - + - + diff --git a/examples/EdgeMeasurement/index.html b/examples/EdgeMeasurement/index.html index efa58e08e..71d84741c 100644 --- a/examples/EdgeMeasurement/index.html +++ b/examples/EdgeMeasurement/index.html @@ -58,10 +58,10 @@ - + - - + + diff --git a/examples/Exploder/index.html b/examples/Exploder/index.html index 3be339945..90a32eee0 100644 --- a/examples/Exploder/index.html +++ b/examples/Exploder/index.html @@ -58,10 +58,10 @@ - + - - + + diff --git a/examples/FaceMeasurement/index.html b/examples/FaceMeasurement/index.html index 856a79cb6..629f787aa 100644 --- a/examples/FaceMeasurement/index.html +++ b/examples/FaceMeasurement/index.html @@ -58,10 +58,10 @@ - + - - + + diff --git a/examples/FragmentsManager/index.html b/examples/FragmentsManager/index.html index a375bc7c0..01efe5bec 100644 --- a/examples/FragmentsManager/index.html +++ b/examples/FragmentsManager/index.html @@ -58,10 +58,10 @@ - + - - + + diff --git a/examples/Grids/index.html b/examples/Grids/index.html index 513b36b17..30a24e1b4 100644 --- a/examples/Grids/index.html +++ b/examples/Grids/index.html @@ -64,8 +64,8 @@ - - + + diff --git a/examples/Hider/index.html b/examples/Hider/index.html index e10a3ea6e..67ceb20e2 100644 --- a/examples/Hider/index.html +++ b/examples/Hider/index.html @@ -58,10 +58,10 @@ - + - - + + diff --git a/examples/Highlighter/index.html b/examples/Highlighter/index.html index 42cdfd6a5..996d29f99 100644 --- a/examples/Highlighter/index.html +++ b/examples/Highlighter/index.html @@ -58,9 +58,9 @@ - - - + + + diff --git a/examples/IfcGeometryTiler/index.html b/examples/IfcGeometryTiler/index.html index a6c65e96c..5b93a1d34 100644 --- a/examples/IfcGeometryTiler/index.html +++ b/examples/IfcGeometryTiler/index.html @@ -58,10 +58,10 @@ - + - - + + diff --git a/examples/IfcJsonExporter/index.html b/examples/IfcJsonExporter/index.html index 602f2915d..181d30e83 100644 --- a/examples/IfcJsonExporter/index.html +++ b/examples/IfcJsonExporter/index.html @@ -58,10 +58,10 @@ - + - - + + diff --git a/examples/IfcLoader/index.html b/examples/IfcLoader/index.html index 7b05ae4f2..81f8793b7 100644 --- a/examples/IfcLoader/index.html +++ b/examples/IfcLoader/index.html @@ -58,10 +58,10 @@ - - + + - + diff --git a/examples/IfcPropertiesManager/index.html b/examples/IfcPropertiesManager/index.html index e653fe99a..2331b4a43 100644 --- a/examples/IfcPropertiesManager/index.html +++ b/examples/IfcPropertiesManager/index.html @@ -6,7 +6,7 @@Jt.intersectsBox(e),intersectsTriangle:e=>Jt.intersectsTriangle(e)})}intersectsSphere(s){return this.shapecast({intersectsBounds:t=>s.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(s)})}closestPointToGeometry(s,t,e={},n={},E=0,i=1/0){return(this.indirect?ni:ks)(this,s,t,e,n,E,i)}closestPointToPoint(s,t={},e=0,n=1/0){return Ds(this,s,t,e,n)}getBoundingBox(s){return s.makeEmpty(),this._roots.forEach(e=>{Y(0,new Float32Array(e),In),s.union(In)}),s}}function rn(I,s,t){return I===null||(I.point.applyMatrix4(s.matrixWorld),I.distance=I.point.distanceTo(t.ray.origin),I.object=s,I.distance Jt.intersectsBox(e),intersectsTriangle:e=>Jt.intersectsTriangle(e)})}intersectsSphere(n){return this.shapecast({intersectsBounds:t=>n.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(n)})}closestPointToGeometry(n,t,e={},s={},E=0,i=1/0){return(this.indirect?ni:$n)(this,n,t,e,s,E,i)}closestPointToPoint(n,t={},e=0,s=1/0){return hn(this,n,t,e,s)}getBoundingBox(n){return n.makeEmpty(),this._roots.forEach(e=>{Y(0,new Float32Array(e),os),n.union(os)}),n}}function rs(r,n,t){return r===null||(r.point.applyMatrix4(n.matrixWorld),r.distance=r.point.distanceTo(t.ray.origin),r.object=n,r.distance _&&(_=D)}return a[l+0]!==R||a[l+1]!==A||a[l+2]!==p||a[l+3]!==F||a[l+4]!==g||a[l+5]!==_?(a[l+0]=R,a[l+1]=A,a[l+2]=p,a[l+3]=F,a[l+4]=g,a[l+5]=_,!0):!1}else{const m=l+8,f=o[l+6],R=m+u,A=f+u;let p=C,F=!1,g=!1;t?p||(F=t.has(R),g=t.has(A),p=!F&&!g):(F=!0,g=!0);const _=p||F,S=p||g;let y=!1;_&&(y=E(m,u,p));let w=!1;S&&(w=E(f,u,p));const L=y||w;if(L)for(let P=0;P<3;P++){const D=m+P,x=f+P,Y=a[D],z=a[D+3],tt=a[x],W=a[x+3];a[l+P]=YW?z:W}return L}}}const Qi=new st;function Yt(c,t,e,s){return j(c,t,Qi),e.intersectBox(Qi,s)}function br(c,t,e,s,i,n){const{geometry:o,_indirectBuffer:r}=c;for(let a=s,h=s+i;a _&&(_=Y)}}return a[l+0]!==R||a[l+1]!==A||a[l+2]!==p||a[l+3]!==F||a[l+4]!==g||a[l+5]!==_?(a[l+0]=R,a[l+1]=A,a[l+2]=p,a[l+3]=F,a[l+4]=g,a[l+5]=_,!0):!1}else{const m=l+8,f=o[l+6],R=m+u,A=f+u;let p=C,F=!1,g=!1;t?p||(F=t.has(R),g=t.has(A),p=!F&&!g):(F=!0,g=!0);const _=p||F,S=p||g;let y=!1;_&&(y=E(m,u,p));let w=!1;S&&(w=E(f,u,p));const L=y||w;if(L)for(let P=0;P<3;P++){const D=m+P,x=f+P,Y=a[D],z=a[D+3],tt=a[x],W=a[x+3];a[l+P]=YW?z:W}return L}}}const $i=new O;function qr(c,t,e,s,i){Z.setBuffer(c._roots[t]),ni(0,c,e,s,i),Z.clearBuffer()}function ni(c,t,e,s,i){const{float32Array:n,uint16Array:o,uint32Array:r}=Z,a=c*2;if(ct(a,o)){const h=lt(c,r),d=It(a,o);br(t,e,s,h,d,i)}else{const h=pt(c);Yt(h,n,s,$i)&&ni(h,t,e,s,i);const d=Ct(c,r);Yt(d,n,s,$i)&&ni(d,t,e,s,i)}}const Ji=new O,Kr=["x","y","z"];function $r(c,t,e,s){Z.setBuffer(c._roots[t]);const i=oi(0,c,e,s);return Z.clearBuffer(),i}function oi(c,t,e,s){const{float32Array:i,uint16Array:n,uint32Array:o}=Z;let r=c*2;if(ct(r,n)){const a=lt(c,o),h=It(r,n);return Br(t,e,s,a,h)}else{const a=Bn(c,o),h=Kr[a],d=s.direction[h]>=0;let E,l;d?(E=pt(c),l=Ct(c,o)):(E=Ct(c,o),l=pt(c));const u=Yt(E,i,s,Ji)?oi(E,t,e,s):null;if(u){const T=u.point[h];if(d?T<=i[l+a]:T>=i[l+a+3])return u}const C=Yt(l,i,s,Ji)?oi(l,t,e,s):null;return u&&C?u.distance<=C.distance?u:C:u||C||null}}const os=new st,oe=new gt,re=new gt,ye=new H,tn=new at,rs=new at;function Jr(c,t,e,s){Z.setBuffer(c._roots[t]);const i=ri(0,c,e,s);return Z.clearBuffer(),i}function ri(c,t,e,s,i=null){const{float32Array:n,uint16Array:o,uint32Array:r}=Z;let a=c*2;if(i===null&&(e.boundingBox||e.computeBoundingBox(),tn.set(e.boundingBox.min,e.boundingBox.max,s),i=tn),ct(a,o)){const h=t.geometry,d=h.index,E=h.attributes.position,l=e.index,u=e.attributes.position,C=lt(c,r),T=It(a,o);if(ye.copy(s).invert(),e.boundsTree)return j(c,n,rs),rs.matrix.copy(ye),rs.needsUpdate=!0,e.boundsTree.shapecast({intersectsBounds:m=>rs.intersectsBox(m),intersectsTriangle:m=>{m.a.applyMatrix4(s),m.b.applyMatrix4(s),m.c.applyMatrix4(s),m.needsUpdate=!0;for(let f=C,R=T+C;f _&&(_=D)}return a[l+0]!==R||a[l+1]!==A||a[l+2]!==p||a[l+3]!==F||a[l+4]!==g||a[l+5]!==_?(a[l+0]=R,a[l+1]=A,a[l+2]=p,a[l+3]=F,a[l+4]=g,a[l+5]=_,!0):!1}else{const m=l+8,f=o[l+6],R=m+u,A=f+u;let p=C,F=!1,g=!1;t?p||(F=t.has(R),g=t.has(A),p=!F&&!g):(F=!0,g=!0);const _=p||F,S=p||g;let y=!1;_&&(y=E(m,u,p));let w=!1;S&&(w=E(f,u,p));const P=y||w;if(P)for(let L=0;L<3;L++){const D=m+L,x=f+L,Y=a[D],z=a[D+3],tt=a[x],W=a[x+3];a[l+L]=YW?z:W}return P}}}const Qi=new st;function Yt(c,t,e,s){return j(c,t,Qi),e.intersectBox(Qi,s)}function Yr(c,t,e,s,i,n){const{geometry:o,_indirectBuffer:r}=c;for(let a=s,h=s+i;a _&&(_=Y)}}return a[l+0]!==R||a[l+1]!==A||a[l+2]!==p||a[l+3]!==F||a[l+4]!==g||a[l+5]!==_?(a[l+0]=R,a[l+1]=A,a[l+2]=p,a[l+3]=F,a[l+4]=g,a[l+5]=_,!0):!1}else{const m=l+8,f=o[l+6],R=m+u,A=f+u;let p=C,F=!1,g=!1;t?p||(F=t.has(R),g=t.has(A),p=!F&&!g):(F=!0,g=!0);const _=p||F,S=p||g;let y=!1;_&&(y=E(m,u,p));let w=!1;S&&(w=E(f,u,p));const P=y||w;if(P)for(let L=0;L<3;L++){const D=m+L,x=f+L,Y=a[D],z=a[D+3],tt=a[x],W=a[x+3];a[l+L]=YW?z:W}return P}}}const $i=new O;function $r(c,t,e,s,i){Z.setBuffer(c._roots[t]),ni(0,c,e,s,i),Z.clearBuffer()}function ni(c,t,e,s,i){const{float32Array:n,uint16Array:o,uint32Array:r}=Z,a=c*2;if(ct(a,o)){const h=lt(c,r),d=It(a,o);Yr(t,e,s,h,d,i)}else{const h=pt(c);Yt(h,n,s,$i)&&ni(h,t,e,s,i);const d=Ct(c,r);Yt(d,n,s,$i)&&ni(d,t,e,s,i)}}const Ji=new O,Jr=["x","y","z"];function ta(c,t,e,s){Z.setBuffer(c._roots[t]);const i=oi(0,c,e,s);return Z.clearBuffer(),i}function oi(c,t,e,s){const{float32Array:i,uint16Array:n,uint32Array:o}=Z;let r=c*2;if(ct(r,n)){const a=lt(c,o),h=It(r,n);return zr(t,e,s,a,h)}else{const a=Gn(c,o),h=Jr[a],d=s.direction[h]>=0;let E,l;d?(E=pt(c),l=Ct(c,o)):(E=Ct(c,o),l=pt(c));const u=Yt(E,i,s,Ji)?oi(E,t,e,s):null;if(u){const T=u.point[h];if(d?T<=i[l+a]:T>=i[l+a+3])return u}const C=Yt(l,i,s,Ji)?oi(l,t,e,s):null;return u&&C?u.distance<=C.distance?u:C:u||C||null}}const os=new st,oe=new gt,re=new gt,ye=new H,tn=new at,rs=new at;function ea(c,t,e,s){Z.setBuffer(c._roots[t]);const i=ri(0,c,e,s);return Z.clearBuffer(),i}function ri(c,t,e,s,i=null){const{float32Array:n,uint16Array:o,uint32Array:r}=Z;let a=c*2;if(i===null&&(e.boundingBox||e.computeBoundingBox(),tn.set(e.boundingBox.min,e.boundingBox.max,s),i=tn),ct(a,o)){const h=t.geometry,d=h.index,E=h.attributes.position,l=e.index,u=e.attributes.position,C=lt(c,r),T=It(a,o);if(ye.copy(s).invert(),e.boundsTree)return j(c,n,rs),rs.matrix.copy(ye),rs.needsUpdate=!0,e.boundsTree.shapecast({intersectsBounds:m=>rs.intersectsBox(m),intersectsTriangle:m=>{m.a.applyMatrix4(s),m.b.applyMatrix4(s),m.c.applyMatrix4(s),m.needsUpdate=!0;for(let f=C,R=T+C;f new st),ae=new st,he=new st,Ys=new st,zs=new st;let Gs=!1;function ha(c,t,e,s){if(Gs)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");Gs=!0;const i=c._roots,n=t._roots;let o,r=0,a=0;const h=new H().copy(e).invert();for(let d=0,E=i.length;ds?e:s}}function Vt(r,n,t){for(let e=0;e<3;e++){const s=n[r+2*e],E=n[r+2*e+1],i=s-E,o=s+E;iL&&(L=O),A>L&&(L=A);const P=(L-f)/2,p=F*2;E[R+p+0]=f+P,E[R+p+1]=P+(Math.abs(f)+P)*rn,fo.value!==s),await t.setProperties(s,null),this.registerChange(t,e,s))}async addElementToPset(t,e,...s){const E=await Ee.getPsetRel(t,e);if(!E)return;const i=await t.getProperties(E);if(!i)return;for(const I of s){const c=new bt(I);i.RelatedObjects.push(c),this.onElementToPset.trigger({model:t,psetID:e,elementID:I})}this.registerChange(t,e);const o=this.components.get(ie);for(const I of s)o.addEntityRelations(t,I,"IsDefinedBy",e)}async addPropToPset(t,e,...s){const E=await t.getProperties(e);if(E){for(const i of s){if(E.HasProperties.includes(i))continue;const o=new bt(i);E.HasProperties.push(o),this.onPropToPset.trigger({model:t,psetID:e,propID:i})}this.registerChange(t,e)}}async saveToIfc(t,e){const s=this.components.get(oe),E=s.webIfc,i=await s.readIfcFile(e),o=this.changeMap[t.uuid]??[];for(const c of o){const C=await t.getProperties(c);if(C)try{E.WriteLine(i,C)}catch{}else try{E.DeleteLine(i,c)}catch{}}const I=E.SaveModel(i);return s.webIfc.CloseModel(i),s.cleanUp(),I}async setAttributeListener(t,e,s){this.attributeListeners[t.uuid]||(this.attributeListeners[t.uuid]={});const E=this.attributeListeners[t.uuid][e]?this.attributeListeners[t.uuid][e][s]:null;if(E)return E;const i=await t.getProperties(e);if(!i)throw new Error(`Entity with expressID ${e} doesn't exists.`);const o=i[s];if(Array.isArray(o)||!o)throw new Error(`Attribute ${s} is array or null, and it can't have a listener.`);const I=o.value;if(I===void 0||I==null)throw new Error(`Attribute ${s} has a badly defined handle.`);const c=new x;return Object.defineProperty(i[s],"value",{get(){return this._value},async set(C){this._value=C,c.trigger(C)}}),i[s].value=I,this.attributeListeners[t.uuid][e]||(this.attributeListeners[t.uuid][e]={}),this.attributeListeners[t.uuid][e][s]=c,c}increaseMaxID(t){return t.ifcMetadata.maxExpressID++,t.ifcMetadata.maxExpressID}newGUID(t){const e=nt.getIFCSchema(t);return new Q[e].IfcGloballyUniqueId(se.create())}async getOwnerHistory(t){const e=await t.getAllPropertiesOfType(nn);if(!e)throw new Error("No OwnerHistory was found.");const s=Object.keys(e).map(o=>parseInt(o,10)),E=e[s[0]],i=new bt(E.expressID);return{ownerHistory:E,ownerHistoryHandle:i}}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 newSingleProperty(t,e,s,E){const i=nt.getIFCSchema(t),o=new Q[i].IfcIdentifier(s),I=new Q[i][e](E),c=new Q[i].IfcPropertySingleValue(o,null,I,null);return c.expressID=this.increaseMaxID(t),await this.setData(t,c),c}};M(nt,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let Be=nt;const Us=new ne,Ds=Us.get(oe);await Ds.setup();const Oi=await fetch("https://thatopen.github.io/engine_components/resources/small.ifc"),hs=await Oi.arrayBuffer(),ot=await Ds.load(new Uint8Array(hs)),Ot=Us.get(Be),{pset:ys}=await Ot.newPset(ot,"CalculatedQuantities"),Si=await Ot.newSingleNumericProperty(ot,"IfcReal","Volume",12.25);await Ot.addPropToPset(ot,ys.expressID,Si.expressID);await Ot.addElementToPset(ot,ys.expressID,186);const Pe=await ot.getProperties(186);Pe&&(Pe.Name.value="New Wall Name",await Ot.setData(ot,Pe));const Li=await Ot.saveToIfc(ot,new Uint8Array(hs)),gs=new File([Li],"small-modified.ifc"),ve=document.createElement("a");ve.href=URL.createObjectURL(gs);ve.download=gs.name;URL.revokeObjectURL(ve.href);
diff --git a/examples/assets/ifcPropertiesTiler.js b/examples/assets/ifcPropertiesTiler.js
index f8e80698f..3c6293d4a 100644
--- a/examples/assets/ifcPropertiesTiler.js
+++ b/examples/assets/ifcPropertiesTiler.js
@@ -1,4 +1,4 @@
-import"./web-ifc-api-x-FY_BW3.js";import{S as b}from"./stats.min-BpIepu9J.js";import{m as w,t as f,a as u}from"./index-tywNknxv.js";import{p as y,C as g,o as h,r as B,W as F,d as L,h as S,$ as U,b as k}from"./index-Dr4eFCtu.js";const v=document.getElementById("container"),n=new y,x=n.get(g),s=x.create();s.scene=new h(n);s.renderer=new B(n,v);s.camera=new F(n);n.init();s.camera.controls.setLookAt(12,6,8,0,0,-10);s.scene.setup();const I=n.get(L);I.create(s);s.scene.three.background=null;const R=new S(n),A=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),P=await A.arrayBuffer(),$=new Uint8Array(P),j=R.load($);s.scene.three.add(j);function C(e,o){const t=new File([o],e),a=document.createElement("a"),p=URL.createObjectURL(t);a.href=p,a.download=t.name,a.click(),URL.revokeObjectURL(p)}async function O(e){for(const{name:o,bits:t}of e)C(o,t),await new Promise(a=>{setTimeout(a,100)})}const c=n.get(U);c.settings.wasm={path:"https://unpkg.com/web-ifc@0.0.56/",absolute:!0};const r={types:{},ids:{},indexesFile:"small.ifc-processed-properties-indexes"};let l=0;const d=[];c.onPropertiesStreamed.add(async e=>{r.types[e.type]||(r.types[e.type]=[]),r.types[e.type].push(l);for(const a in e.data)r.ids[a]=l;const o=`small.ifc-processed-properties-${l}`,t=new Blob([JSON.stringify(e.data)]);d.push({bits:t,name:o}),l++});c.onProgress.add(async e=>{console.log(e)});c.onIndicesStreamed.add(async e=>{d.push({name:"small.ifc-processed-properties.json",bits:new Blob([JSON.stringify(r)])});const t=n.get(k).serializeRelations(e);d.push({name:"small.ifc-processed-properties-indexes",bits:new Blob([t])}),await O(d)});async function z(){const o=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),t=new Uint8Array(o);await c.streamFromBuffer(t)}const i=new b;i.showPanel(2);document.body.append(i.dom);i.dom.style.left="0px";i.dom.style.zIndex="unset";s.renderer.onBeforeUpdate.add(()=>i.begin());s.renderer.onAfterUpdate.add(()=>i.end());w.init();const m=f.create(()=>u`
+import"./web-ifc-api-56EJvEs4.js";import{S as b}from"./stats.min-BpIepu9J.js";import{m as w,t as f,a as u}from"./index-TmOv0r_5.js";import{p as y,C as g,o as h,r as B,W as F,u as L,h as S,J as U,c as k}from"./index-BcIWfMQD.js";const v=document.getElementById("container"),n=new y,x=n.get(g),s=x.create();s.scene=new h(n);s.renderer=new B(n,v);s.camera=new F(n);n.init();s.camera.controls.setLookAt(12,6,8,0,0,-10);s.scene.setup();const I=n.get(L);I.create(s);s.scene.three.background=null;const R=new S(n),A=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),P=await A.arrayBuffer(),j=new Uint8Array(P),C=R.load(j);s.scene.three.add(C);function J(e,o){const t=new File([o],e),a=document.createElement("a"),p=URL.createObjectURL(t);a.href=p,a.download=t.name,a.click(),URL.revokeObjectURL(p)}async function O(e){for(const{name:o,bits:t}of e)J(o,t),await new Promise(a=>{setTimeout(a,100)})}const c=n.get(U);c.settings.wasm={path:"https://unpkg.com/web-ifc@0.0.56/",absolute:!0};const r={types:{},ids:{},indexesFile:"small.ifc-processed-properties-indexes"};let l=0;const d=[];c.onPropertiesStreamed.add(async e=>{r.types[e.type]||(r.types[e.type]=[]),r.types[e.type].push(l);for(const a in e.data)r.ids[a]=l;const o=`small.ifc-processed-properties-${l}`,t=new Blob([JSON.stringify(e.data)]);d.push({bits:t,name:o}),l++});c.onProgress.add(async e=>{console.log(e)});c.onIndicesStreamed.add(async e=>{d.push({name:"small.ifc-processed-properties.json",bits:new Blob([JSON.stringify(r)])});const t=n.get(k).serializeRelations(e);d.push({name:"small.ifc-processed-properties-indexes",bits:new Blob([t])}),await O(d)});async function z(){const o=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),t=new Uint8Array(o);await c.streamFromBuffer(t)}const i=new b;i.showPanel(2);document.body.append(i.dom);i.dom.style.left="0px";i.dom.style.zIndex="unset";s.renderer.onBeforeUpdate.add(()=>i.begin());s.renderer.onAfterUpdate.add(()=>i.end());w.init();const m=f.create(()=>u`
0?m.start.copy(E.start):m.start.copy(l.start),h.subVectors(E.end,l.end),h.dot(r)<0?m.end.copy(E.end):m.end.copy(l.end)),!0)}}}();gt.prototype.distanceToPoint=function(){const c=new O;return function(t){return this.closestPointToPoint(t,c),t.distanceTo(c)}}();gt.prototype.distanceToTriangle=function(){const c=new O,t=new O,e=["a","b","c"],s=new Ft,i=new Ft;return function(n,o=null,r=null){const a=o||r?s:null;if(this.intersectsTriangle(n,a))return(o||r)&&(o&&a.getCenter(o),r&&a.getCenter(r)),0;let h=1/0;for(let d=0;d<3;d++){let E;const l=e[d],u=n[l];this.closestPointToPoint(u,c),E=u.distanceToSquared(c),Ehs.intersectsBox(s),intersectsTriangle:s=>hs.intersectsTriangle(s)})}intersectsSphere(t){return this.shapecast({intersectsBounds:e=>t.intersectsBox(e),intersectsTriangle:e=>e.intersectsSphere(t)})}closestPointToGeometry(t,e,s={},i={},n=0,o=1/0){return(this.indirect?na:Qr)(this,t,e,s,i,n,o)}closestPointToPoint(t,e={},s=0,i=1/0){return Lr(this,t,e,s,i)}getBoundingBox(t){return t.makeEmpty(),this._roots.forEach(e=>{j(0,new Float32Array(e),en),t.union(en)}),t}}function sn(c,t,e){return c===null||(c.point.applyMatrix4(t.matrixWorld),c.distance=c.point.distanceTo(e.ray.origin),c.object=t,c.distancethis.tolerance)return!1;return!0}intersectRay(t,e){const s=this.faces;let i=-1/0,n=1/0;for(let o=0,r=s.length;o0?m.start.copy(E.start):m.start.copy(l.start),h.subVectors(E.end,l.end),h.dot(r)<0?m.end.copy(E.end):m.end.copy(l.end)),!0)}}}();gt.prototype.distanceToPoint=function(){const c=new O;return function(t){return this.closestPointToPoint(t,c),t.distanceTo(c)}}();gt.prototype.distanceToTriangle=function(){const c=new O,t=new O,e=["a","b","c"],s=new Ft,i=new Ft;return function(n,o=null,r=null){const a=o||r?s:null;if(this.intersectsTriangle(n,a))return(o||r)&&(o&&a.getCenter(o),r&&a.getCenter(r)),0;let h=1/0;for(let d=0;d<3;d++){let E;const l=e[d],u=n[l];this.closestPointToPoint(u,c),E=u.distanceToSquared(c),E