@thatopen/components 2.0.10 → 2.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Clipper/index.d.ts +1 -1
- package/dist/core/Clipper/src/simple-plane.d.ts +16 -16
- package/dist/core/Components/index.d.ts +24 -24
- package/dist/core/Cullers/index.d.ts +3 -3
- package/dist/core/Cullers/src/culler-renderer.d.ts +1 -1
- package/dist/core/Cullers/src/mesh-culler-renderer.d.ts +6 -6
- package/dist/core/Disposer/index.d.ts +1 -1
- package/dist/core/Grids/index.d.ts +10 -9
- package/dist/core/Grids/src/simple-grid.d.ts +16 -4
- package/dist/core/MiniMap/index.d.ts +20 -19
- package/dist/core/MiniMap/src/index.d.ts +16 -16
- package/dist/core/OrthoPerspectiveCamera/index.d.ts +8 -8
- package/dist/core/Raycasters/index.d.ts +2 -1
- package/dist/core/Raycasters/src/mouse.d.ts +1 -4
- package/dist/core/Raycasters/src/simple-raycaster.d.ts +9 -11
- package/dist/core/Types/src/base-camera.d.ts +1 -1
- package/dist/core/Types/src/base-renderer.d.ts +19 -19
- package/dist/core/Types/src/base-scene.d.ts +3 -3
- package/dist/core/Worlds/index.d.ts +15 -15
- package/dist/core/Worlds/src/simple-camera.d.ts +1 -1
- package/dist/core/Worlds/src/simple-scene.d.ts +3 -3
- package/dist/fragments/BoundingBoxer/index.d.ts +151 -1
- package/dist/fragments/Classifier/index.d.ts +133 -0
- package/dist/fragments/Exploder/index.d.ts +39 -2
- package/dist/fragments/FragmentsManager/index.d.ts +45 -6
- package/dist/fragments/Hider/index.d.ts +28 -0
- package/dist/fragments/IfcGeometryTiler/index.d.ts +62 -4
- package/dist/fragments/IfcGeometryTiler/src/base-types.d.ts +14 -0
- package/dist/fragments/IfcGeometryTiler/src/index.d.ts +0 -1
- package/dist/fragments/IfcGeometryTiler/src/streaming-settings.d.ts +11 -5
- package/dist/fragments/IfcLoader/index.d.ts +89 -4
- package/dist/fragments/IfcLoader/src/ifc-fragment-settings.d.ts +14 -0
- package/dist/fragments/IfcPropertiesTiler/index.d.ts +44 -4
- package/dist/fragments/IfcPropertiesTiler/src/index.d.ts +1 -0
- package/dist/fragments/IfcPropertiesTiler/src/streaming-settings.d.ts +11 -0
- package/dist/ifc/IfcJsonExporter/index.d.ts +7 -2
- package/dist/ifc/IfcJsonExporter/src/ifc-geometry-types.d.ts +3 -0
- package/dist/ifc/IfcJsonExporter/src/index.d.ts +1 -0
- package/dist/ifc/IfcPropertiesManager/index.d.ts +195 -11
- package/dist/ifc/IfcRelationsIndexer/index.d.ts +20 -11
- package/dist/ifc/Utils/ifc-category-map.d.ts +3 -0
- package/dist/ifc/Utils/ifc-elements-map.d.ts +8 -0
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +3578 -2906
- package/dist/measurement/MeasurementUtils/index.d.ts +76 -0
- package/dist/measurement/index.d.ts +1 -1
- package/dist/namespace.d.ts +2490 -1634
- package/package.json +2 -2
- package/dist/fragments/IfcGeometryTiler/src/fragment-props-stream-converter.d.ts +0 -27
- package/dist/measurement/Utils/index.d.ts +0 -24
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";var kn=Object.defineProperty;var Wn=(l,s,t)=>s in l?kn(l,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[s]=t;var I=(l,s,t)=>(Wn(l,typeof s!="symbol"?s+"":s,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("three"),fn=require("@thatopen/fragments"),Xn=require("web-ifc");function Fi(l){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(s,t,e.get?e:{enumerable:!0,get:()=>l[t]})}}return s.default=l,Object.freeze(s)}const S=Fi(C),Dt=Fi(fn),U=Fi(Xn),pn=0,Zn=1,Qn=2,wi=2,bs=1.25,Di=1,rs=6*4+4+4,Ps=65535,jn=Math.pow(2,-24),vs=Symbol("SKIP_GENERATION");function qn(l){return l.index?l.index.count:l.attributes.position.count}function Ee(l){return qn(l)/3}function $n(l,s=ArrayBuffer){return l>65535?new Uint32Array(new s(4*l)):new Uint16Array(new s(2*l))}function Kn(l,s){if(!l.index){const t=l.attributes.position.count,e=s.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=$n(t,e);l.setIndex(new C.BufferAttribute(i,1));for(let o=0;o<t;o++)i[o]=o}}function Cn(l){const s=Ee(l),t=l.drawRange,e=t.start/3,i=(t.start+t.count)/3,o=Math.max(0,e),n=Math.min(s,i)-o;return[{offset:Math.floor(o),count:Math.floor(n)}]}function Tn(l){if(!l.groups||!l.groups.length)return Cn(l);const s=[],t=new Set,e=l.drawRange,i=e.start/3,o=(e.start+e.count)/3;for(const r of l.groups){const a=r.start/3,c=(r.start+r.count)/3;t.add(Math.max(i,a)),t.add(Math.min(o,c))}const n=Array.from(t.values()).sort((r,a)=>r-a);for(let r=0;r<n.length-1;r++){const a=n[r],c=n[r+1];s.push({offset:Math.floor(a),count:Math.floor(c-a)})}return s}function Jn(l){if(l.groups.length===0)return!1;const s=Ee(l),t=Tn(l).sort((o,n)=>o.offset-n.offset),e=t[t.length-1];e.count=Math.min(s-e.offset,e.count);let i=0;return t.forEach(({count:o})=>i+=o),s!==i}function q(l,s,t){return t.min.x=s[l],t.min.y=s[l+1],t.min.z=s[l+2],t.max.x=s[l+3],t.max.y=s[l+4],t.max.z=s[l+5],t}function to(l){l[0]=l[1]=l[2]=1/0,l[3]=l[4]=l[5]=-1/0}function Ui(l){let s=-1,t=-1/0;for(let e=0;e<3;e++){const i=l[e+3]-l[e];i>t&&(t=i,s=e)}return s}function xi(l,s){s.set(l)}function bi(l,s,t){let e,i;for(let o=0;o<3;o++){const n=o+3;e=l[o],i=s[o],t[o]=e<i?e:i,e=l[n],i=s[n],t[n]=e>i?e:i}}function ve(l,s,t){for(let e=0;e<3;e++){const i=s[l+2*e],o=s[l+2*e+1],n=i-o,r=i+o;n<t[e]&&(t[e]=n),r>t[e+3]&&(t[e+3]=r)}}function Ie(l){const s=l[3]-l[0],t=l[4]-l[1],e=l[5]-l[2];return 2*(s*t+t*e+e*s)}function Bs(l,s,t,e,i=null){let o=1/0,n=1/0,r=1/0,a=-1/0,c=-1/0,h=-1/0,d=1/0,E=1/0,u=1/0,p=-1/0,F=-1/0,R=-1/0;const T=i!==null;for(let A=s*6,g=(s+t)*6;A<g;A+=6){const f=l[A+0],m=l[A+1],O=f-m,_=f+m;O<o&&(o=O),_>a&&(a=_),T&&f<d&&(d=f),T&&f>p&&(p=f);const N=l[A+2],P=l[A+3],L=N-P,w=N+P;L<n&&(n=L),w>c&&(c=w),T&&N<E&&(E=N),T&&N>F&&(F=N);const M=l[A+4],x=l[A+5],b=M-x,v=M+x;b<r&&(r=b),v>h&&(h=v),T&&M<u&&(u=M),T&&M>R&&(R=M)}e[0]=o,e[1]=n,e[2]=r,e[3]=a,e[4]=c,e[5]=h,T&&(i[0]=d,i[1]=E,i[2]=u,i[3]=p,i[4]=F,i[5]=R)}function eo(l,s,t,e){let i=1/0,o=1/0,n=1/0,r=-1/0,a=-1/0,c=-1/0;for(let h=s*6,d=(s+t)*6;h<d;h+=6){const E=l[h+0];E<i&&(i=E),E>r&&(r=E);const u=l[h+2];u<o&&(o=u),u>a&&(a=u);const p=l[h+4];p<n&&(n=p),p>c&&(c=p)}e[0]=i,e[1]=o,e[2]=n,e[3]=r,e[4]=a,e[5]=c}function so(l,s){to(s);const t=l.attributes.position,e=l.index?l.index.array:null,i=Ee(l),o=new Float32Array(i*6),n=t.normalized,r=t.array,a=t.offset||0;let c=3;t.isInterleavedBufferAttribute&&(c=t.data.stride);const h=["getX","getY","getZ"];for(let d=0;d<i;d++){const E=d*3,u=d*6;let p=E+0,F=E+1,R=E+2;e&&(p=e[p],F=e[F],R=e[R]),n||(p=p*c+a,F=F*c+a,R=R*c+a);for(let T=0;T<3;T++){let A,g,f;n?(A=t[h[T]](p),g=t[h[T]](F),f=t[h[T]](R)):(A=r[p+T],g=r[F+T],f=r[R+T]);let m=A;g<m&&(m=g),f<m&&(m=f);let O=A;g>O&&(O=g),f>O&&(O=f);const _=(O-m)/2,N=T*2;o[u+N+0]=m+_,o[u+N+1]=_+(Math.abs(m)+_)*jn,m<s[T]&&(s[T]=m),O>s[T+3]&&(s[T+3]=O)}}return o}const Ot=32,io=(l,s)=>l.candidate-s.candidate,Nt=new Array(Ot).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),Be=new Float32Array(6);function no(l,s,t,e,i,o){let n=-1,r=0;if(o===pn)n=Ui(s),n!==-1&&(r=(s[n]+s[n+3])/2);else if(o===Zn)n=Ui(l),n!==-1&&(r=oo(t,e,i,n));else if(o===Qn){const a=Ie(l);let c=bs*i;const h=e*6,d=(e+i)*6;for(let E=0;E<3;E++){const u=s[E],R=(s[E+3]-u)/Ot;if(i<Ot/4){const T=[...Nt];T.length=i;let A=0;for(let f=h;f<d;f+=6,A++){const m=T[A];m.candidate=t[f+2*E],m.count=0;const{bounds:O,leftCacheBounds:_,rightCacheBounds:N}=m;for(let P=0;P<3;P++)N[P]=1/0,N[P+3]=-1/0,_[P]=1/0,_[P+3]=-1/0,O[P]=1/0,O[P+3]=-1/0;ve(f,t,O)}T.sort(io);let g=i;for(let f=0;f<g;f++){const m=T[f];for(;f+1<g&&T[f+1].candidate===m.candidate;)T.splice(f+1,1),g--}for(let f=h;f<d;f+=6){const m=t[f+2*E];for(let O=0;O<g;O++){const _=T[O];m>=_.candidate?ve(f,t,_.rightCacheBounds):(ve(f,t,_.leftCacheBounds),_.count++)}}for(let f=0;f<g;f++){const m=T[f],O=m.count,_=i-m.count,N=m.leftCacheBounds,P=m.rightCacheBounds;let L=0;O!==0&&(L=Ie(N)/a);let w=0;_!==0&&(w=Ie(P)/a);const M=Di+bs*(L*O+w*_);M<c&&(n=E,c=M,r=m.candidate)}}else{for(let g=0;g<Ot;g++){const f=Nt[g];f.count=0,f.candidate=u+R+g*R;const m=f.bounds;for(let O=0;O<3;O++)m[O]=1/0,m[O+3]=-1/0}for(let g=h;g<d;g+=6){let O=~~((t[g+2*E]-u)/R);O>=Ot&&(O=Ot-1);const _=Nt[O];_.count++,ve(g,t,_.bounds)}const T=Nt[Ot-1];xi(T.bounds,T.rightCacheBounds);for(let g=Ot-2;g>=0;g--){const f=Nt[g],m=Nt[g+1];bi(f.bounds,m.rightCacheBounds,f.rightCacheBounds)}let A=0;for(let g=0;g<Ot-1;g++){const f=Nt[g],m=f.count,O=f.bounds,N=Nt[g+1].rightCacheBounds;m!==0&&(A===0?xi(O,Be):bi(O,Be,Be)),A+=m;let P=0,L=0;A!==0&&(P=Ie(Be)/a);const w=i-A;w!==0&&(L=Ie(N)/a);const M=Di+bs*(P*A+L*w);M<c&&(n=E,c=M,r=f.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${o} used.`);return{axis:n,pos:r}}function oo(l,s,t,e){let i=0;for(let o=s,n=s+t;o<n;o++)i+=l[o*6+e*2];return i/t}class Ve{constructor(){}}function ro(l,s,t,e,i,o){let n=e,r=e+i-1;const a=o.pos,c=o.axis*2;for(;;){for(;n<=r&&t[n*6+c]<a;)n++;for(;n<=r&&t[r*6+c]>=a;)r--;if(n<r){for(let h=0;h<3;h++){let d=s[n*3+h];s[n*3+h]=s[r*3+h],s[r*3+h]=d}for(let h=0;h<6;h++){let d=t[n*6+h];t[n*6+h]=t[r*6+h],t[r*6+h]=d}n++,r--}else return n}}function ao(l,s,t,e,i,o){let n=e,r=e+i-1;const a=o.pos,c=o.axis*2;for(;;){for(;n<=r&&t[n*6+c]<a;)n++;for(;n<=r&&t[r*6+c]>=a;)r--;if(n<r){let h=l[n];l[n]=l[r],l[r]=h;for(let d=0;d<6;d++){let E=t[n*6+d];t[n*6+d]=t[r*6+d],t[r*6+d]=E}n++,r--}else return n}}function co(l,s){const t=(l.index?l.index.count:l.attributes.position.count)/3,e=t>2**16,i=e?4:2,o=s?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),n=e?new Uint32Array(o):new Uint16Array(o);for(let r=0,a=n.length;r<a;r++)n[r]=r;return n}function lo(l,s){const t=l.geometry,e=t.index?t.index.array:null,i=s.maxDepth,o=s.verbose,n=s.maxLeafTris,r=s.strategy,a=s.onProgress,c=Ee(t),h=l._indirectBuffer;let d=!1;const E=new Float32Array(6),u=new Float32Array(6),p=so(t,E),F=s.indirect?ao:ro,R=[],T=s.indirect?Cn(t):Tn(t);if(T.length===1){const f=T[0],m=new Ve;m.boundingData=E,eo(p,f.offset,f.count,u),g(m,f.offset,f.count,u),R.push(m)}else for(let f of T){const m=new Ve;m.boundingData=new Float32Array(6),Bs(p,f.offset,f.count,m.boundingData,u),g(m,f.offset,f.count,u),R.push(m)}return R;function A(f){a&&a(f/c)}function g(f,m,O,_=null,N=0){if(!d&&N>=i&&(d=!0,o&&(console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),O<=n||N>=i)return A(m+O),f.offset=m,f.count=O,f;const P=no(f.boundingData,_,p,m,O,r);if(P.axis===-1)return A(m+O),f.offset=m,f.count=O,f;const L=F(h,e,p,m,O,P);if(L===m||L===m+O)A(m+O),f.offset=m,f.count=O;else{f.splitAxis=P.axis;const w=new Ve,M=m,x=L-m;f.left=w,w.boundingData=new Float32Array(6),Bs(p,M,x,w.boundingData,u),g(w,M,x,u,N+1);const b=new Ve,v=L,z=O-x;f.right=b,b.boundingData=new Float32Array(6),Bs(p,v,z,b.boundingData,u),g(b,v,z,u,N+1)}return f}}function ho(l,s){const t=l.geometry;s.indirect&&(l._indirectBuffer=co(t,s.useSharedArrayBuffer),Jn(t)&&!s.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.')),l._indirectBuffer||Kn(t,s);const e=lo(l,s);let i,o,n;const r=[],a=s.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let d=0;d<e.length;d++){const E=e[d];let u=c(E);const p=new a(rs*u);i=new Float32Array(p),o=new Uint32Array(p),n=new Uint16Array(p),h(0,E),r.push(p)}l._roots=r;return;function c(d){return d.count?1:1+c(d.left)+c(d.right)}function h(d,E){const u=d/4,p=d/2,F=!!E.count,R=E.boundingData;for(let T=0;T<6;T++)i[u+T]=R[T];if(F){const T=E.offset,A=E.count;return o[u+6]=T,n[p+14]=A,n[p+15]=Ps,d+rs}else{const T=E.left,A=E.right,g=E.splitAxis;let f;if(f=h(d+rs,T),f/4>Math.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return o[u+6]=f/4,f=h(f,A),o[u+7]=g,f}}}class St{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(s,t){let e=1/0,i=-1/0;for(let o=0,n=s.length;o<n;o++){const a=s[o][t];e=a<e?a:e,i=a>i?a:i}this.min=e,this.max=i}setFromPoints(s,t){let e=1/0,i=-1/0;for(let o=0,n=t.length;o<n;o++){const r=t[o],a=s.dot(r);e=a<e?a:e,i=a>i?a:i}this.min=e,this.max=i}isSeparated(s){return this.min>s.max||s.min>this.max}}St.prototype.setFromBox=function(){const l=new C.Vector3;return function(t,e){const i=e.min,o=e.max;let n=1/0,r=-1/0;for(let a=0;a<=1;a++)for(let c=0;c<=1;c++)for(let h=0;h<=1;h++){l.x=i.x*a+o.x*(1-a),l.y=i.y*c+o.y*(1-c),l.z=i.z*h+o.z*(1-h);const d=t.dot(l);n=Math.min(d,n),r=Math.max(d,r)}this.min=n,this.max=r}}();const Eo=function(){const l=new C.Vector3,s=new C.Vector3,t=new C.Vector3;return function(i,o,n){const r=i.start,a=l,c=o.start,h=s;t.subVectors(r,c),l.subVectors(i.end,i.start),s.subVectors(o.end,o.start);const d=t.dot(h),E=h.dot(a),u=h.dot(h),p=t.dot(a),R=a.dot(a)*u-E*E;let T,A;R!==0?T=(d*E-p*u)/R:T=0,A=(d+T*E)/u,n.x=T,n.y=A}}(),gi=function(){const l=new C.Vector2,s=new C.Vector3,t=new C.Vector3;return function(i,o,n,r){Eo(i,o,l);let a=l.x,c=l.y;if(a>=0&&a<=1&&c>=0&&c<=1){i.at(a,n),o.at(c,r);return}else if(a>=0&&a<=1){c<0?o.at(0,r):o.at(1,r),i.closestPointToPoint(r,!0,n);return}else if(c>=0&&c<=1){a<0?i.at(0,n):i.at(1,n),o.closestPointToPoint(n,!0,r);return}else{let h;a<0?h=i.start:h=i.end;let d;c<0?d=o.start:d=o.end;const E=s,u=t;if(i.closestPointToPoint(d,!0,s),o.closestPointToPoint(h,!0,t),E.distanceToSquared(d)<=u.distanceToSquared(h)){n.copy(E),r.copy(d);return}else{n.copy(h),r.copy(u);return}}}}(),uo=function(){const l=new C.Vector3,s=new C.Vector3,t=new C.Plane,e=new C.Line3;return function(o,n){const{radius:r,center:a}=o,{a:c,b:h,c:d}=n;if(e.start=c,e.end=h,e.closestPointToPoint(a,!0,l).distanceTo(a)<=r||(e.start=c,e.end=d,e.closestPointToPoint(a,!0,l).distanceTo(a)<=r)||(e.start=h,e.end=d,e.closestPointToPoint(a,!0,l).distanceTo(a)<=r))return!0;const F=n.getPlane(t);if(Math.abs(F.distanceToPoint(a))<=r){const T=F.projectPoint(a,s);if(n.containsPoint(T))return!0}return!1}}(),Io=1e-15;function Vs(l){return Math.abs(l)<Io}class mt extends C.Triangle{constructor(...s){super(...s),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new C.Vector3),this.satBounds=new Array(4).fill().map(()=>new St),this.points=[this.a,this.b,this.c],this.sphere=new C.Sphere,this.plane=new C.Plane,this.needsUpdate=!0}intersectsSphere(s){return uo(s,this)}update(){const s=this.a,t=this.b,e=this.c,i=this.points,o=this.satAxes,n=this.satBounds,r=o[0],a=n[0];this.getNormal(r),a.setFromPoints(r,i);const c=o[1],h=n[1];c.subVectors(s,t),h.setFromPoints(c,i);const d=o[2],E=n[2];d.subVectors(t,e),E.setFromPoints(d,i);const u=o[3],p=n[3];u.subVectors(e,s),p.setFromPoints(u,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(r,s),this.needsUpdate=!1}}mt.prototype.closestPointToSegment=function(){const l=new C.Vector3,s=new C.Vector3,t=new C.Line3;return function(i,o=null,n=null){const{start:r,end:a}=i,c=this.points;let h,d=1/0;for(let E=0;E<3;E++){const u=(E+1)%3;t.start.copy(c[E]),t.end.copy(c[u]),gi(t,i,l,s),h=l.distanceToSquared(s),h<d&&(d=h,o&&o.copy(l),n&&n.copy(s))}return this.closestPointToPoint(r,l),h=r.distanceToSquared(l),h<d&&(d=h,o&&o.copy(l),n&&n.copy(r)),this.closestPointToPoint(a,l),h=a.distanceToSquared(l),h<d&&(d=h,o&&o.copy(l),n&&n.copy(a)),Math.sqrt(d)}}();mt.prototype.intersectsTriangle=function(){const l=new mt,s=new Array(3),t=new Array(3),e=new St,i=new St,o=new C.Vector3,n=new C.Vector3,r=new C.Vector3,a=new C.Vector3,c=new C.Vector3,h=new C.Line3,d=new C.Line3,E=new C.Line3,u=new C.Vector3;function p(F,R,T){const A=F.points;let g=0,f=-1;for(let m=0;m<3;m++){const{start:O,end:_}=h;O.copy(A[m]),_.copy(A[(m+1)%3]),h.delta(n);const N=Vs(R.distanceToPoint(O));if(Vs(R.normal.dot(n))&&N){T.copy(h),g=2;break}const P=R.intersectLine(h,u);if(!P&&N&&u.copy(O),(P||N)&&!Vs(u.distanceTo(_))){if(g<=1)(g===1?T.start:T.end).copy(u),N&&(f=g);else if(g>=2){(f===1?T.start:T.end).copy(u),g=2;break}if(g++,g===2&&f===-1)break}}return g}return function(R,T=null,A=!1){this.needsUpdate&&this.update(),R.isExtendedTriangle?R.needsUpdate&&R.update():(l.copy(R),l.update(),R=l);const g=this.plane,f=R.plane;if(Math.abs(g.normal.dot(f.normal))>1-1e-10){const m=this.satBounds,O=this.satAxes;t[0]=R.a,t[1]=R.b,t[2]=R.c;for(let P=0;P<4;P++){const L=m[P],w=O[P];if(e.setFromPoints(w,t),L.isSeparated(e))return!1}const _=R.satBounds,N=R.satAxes;s[0]=this.a,s[1]=this.b,s[2]=this.c;for(let P=0;P<4;P++){const L=_[P],w=N[P];if(e.setFromPoints(w,s),L.isSeparated(e))return!1}for(let P=0;P<4;P++){const L=O[P];for(let w=0;w<4;w++){const M=N[w];if(o.crossVectors(L,M),e.setFromPoints(o,s),i.setFromPoints(o,t),e.isSeparated(i))return!1}}return T&&(A||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),T.start.set(0,0,0),T.end.set(0,0,0)),!0}else{const m=p(this,f,d);if(m===1&&R.containsPoint(d.end))return T&&(T.start.copy(d.end),T.end.copy(d.end)),!0;if(m!==2)return!1;const O=p(R,g,E);if(O===1&&this.containsPoint(E.end))return T&&(T.start.copy(E.end),T.end.copy(E.end)),!0;if(O!==2)return!1;if(d.delta(r),E.delta(a),r.dot(a)<0){let x=E.start;E.start=E.end,E.end=x}const _=d.start.dot(r),N=d.end.dot(r),P=E.start.dot(r),L=E.end.dot(r),w=N<P,M=_<L;return _!==L&&P!==N&&w===M?!1:(T&&(c.subVectors(d.start,E.start),c.dot(r)>0?T.start.copy(d.start):T.start.copy(E.start),c.subVectors(d.end,E.end),c.dot(r)<0?T.end.copy(d.end):T.end.copy(E.end)),!0)}}}();mt.prototype.distanceToPoint=function(){const l=new C.Vector3;return function(t){return this.closestPointToPoint(t,l),t.distanceTo(l)}}();mt.prototype.distanceToTriangle=function(){const l=new C.Vector3,s=new C.Vector3,t=["a","b","c"],e=new C.Line3,i=new C.Line3;return function(n,r=null,a=null){const c=r||a?e:null;if(this.intersectsTriangle(n,c))return(r||a)&&(r&&c.getCenter(r),a&&c.getCenter(a)),0;let h=1/0;for(let d=0;d<3;d++){let E;const u=t[d],p=n[u];this.closestPointToPoint(p,l),E=p.distanceToSquared(l),E<h&&(h=E,r&&r.copy(l),a&&a.copy(p));const F=this[u];n.closestPointToPoint(F,l),E=F.distanceToSquared(l),E<h&&(h=E,r&&r.copy(F),a&&a.copy(l))}for(let d=0;d<3;d++){const E=t[d],u=t[(d+1)%3];e.set(this[E],this[u]);for(let p=0;p<3;p++){const F=t[p],R=t[(p+1)%3];i.set(n[F],n[R]),gi(e,i,l,s);const T=l.distanceToSquared(s);T<h&&(h=T,r&&r.copy(l),a&&a.copy(s))}}return Math.sqrt(h)}}();class ot{constructor(s,t,e){this.isOrientedBox=!0,this.min=new C.Vector3,this.max=new C.Vector3,this.matrix=new C.Matrix4,this.invMatrix=new C.Matrix4,this.points=new Array(8).fill().map(()=>new C.Vector3),this.satAxes=new Array(3).fill().map(()=>new C.Vector3),this.satBounds=new Array(3).fill().map(()=>new St),this.alignedSatBounds=new Array(3).fill().map(()=>new St),this.needsUpdate=!1,s&&this.min.copy(s),t&&this.max.copy(t),e&&this.matrix.copy(e)}set(s,t,e){this.min.copy(s),this.max.copy(t),this.matrix.copy(e),this.needsUpdate=!0}copy(s){this.min.copy(s.min),this.max.copy(s.max),this.matrix.copy(s.matrix),this.needsUpdate=!0}}ot.prototype.update=function(){return function(){const s=this.matrix,t=this.min,e=this.max,i=this.points;for(let c=0;c<=1;c++)for(let h=0;h<=1;h++)for(let d=0;d<=1;d++){const E=1*c|2*h|4*d,u=i[E];u.x=c?e.x:t.x,u.y=h?e.y:t.y,u.z=d?e.z:t.z,u.applyMatrix4(s)}const o=this.satBounds,n=this.satAxes,r=i[0];for(let c=0;c<3;c++){const h=n[c],d=o[c],E=1<<c,u=i[E];h.subVectors(r,u),d.setFromPoints(h,i)}const a=this.alignedSatBounds;a[0].setFromPointsField(i,"x"),a[1].setFromPointsField(i,"y"),a[2].setFromPointsField(i,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}();ot.prototype.intersectsBox=function(){const l=new St;return function(t){this.needsUpdate&&this.update();const e=t.min,i=t.max,o=this.satBounds,n=this.satAxes,r=this.alignedSatBounds;if(l.min=e.x,l.max=i.x,r[0].isSeparated(l)||(l.min=e.y,l.max=i.y,r[1].isSeparated(l))||(l.min=e.z,l.max=i.z,r[2].isSeparated(l)))return!1;for(let a=0;a<3;a++){const c=n[a],h=o[a];if(l.setFromBox(c,t),h.isSeparated(l))return!1}return!0}}();ot.prototype.intersectsTriangle=function(){const l=new mt,s=new Array(3),t=new St,e=new St,i=new C.Vector3;return function(n){this.needsUpdate&&this.update(),n.isExtendedTriangle?n.needsUpdate&&n.update():(l.copy(n),l.update(),n=l);const r=this.satBounds,a=this.satAxes;s[0]=n.a,s[1]=n.b,s[2]=n.c;for(let E=0;E<3;E++){const u=r[E],p=a[E];if(t.setFromPoints(p,s),u.isSeparated(t))return!1}const c=n.satBounds,h=n.satAxes,d=this.points;for(let E=0;E<3;E++){const u=c[E],p=h[E];if(t.setFromPoints(p,d),u.isSeparated(t))return!1}for(let E=0;E<3;E++){const u=a[E];for(let p=0;p<4;p++){const F=h[p];if(i.crossVectors(u,F),t.setFromPoints(i,s),e.setFromPoints(i,d),t.isSeparated(e))return!1}}return!0}}();ot.prototype.closestPointToPoint=function(){return function(s,t){return this.needsUpdate&&this.update(),t.copy(s).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),t}}();ot.prototype.distanceToPoint=function(){const l=new C.Vector3;return function(t){return this.closestPointToPoint(t,l),t.distanceTo(l)}}();ot.prototype.distanceToBox=function(){const l=["x","y","z"],s=new Array(12).fill().map(()=>new C.Line3),t=new Array(12).fill().map(()=>new C.Line3),e=new C.Vector3,i=new C.Vector3;return function(n,r=0,a=null,c=null){if(this.needsUpdate&&this.update(),this.intersectsBox(n))return(a||c)&&(n.getCenter(i),this.closestPointToPoint(i,e),n.closestPointToPoint(e,i),a&&a.copy(e),c&&c.copy(i)),0;const h=r*r,d=n.min,E=n.max,u=this.points;let p=1/0;for(let R=0;R<8;R++){const T=u[R];i.copy(T).clamp(d,E);const A=T.distanceToSquared(i);if(A<p&&(p=A,a&&a.copy(T),c&&c.copy(i),A<h))return Math.sqrt(A)}let F=0;for(let R=0;R<3;R++)for(let T=0;T<=1;T++)for(let A=0;A<=1;A++){const g=(R+1)%3,f=(R+2)%3,m=T<<g|A<<f,O=1<<R|T<<g|A<<f,_=u[m],N=u[O];s[F].set(_,N);const L=l[R],w=l[g],M=l[f],x=t[F],b=x.start,v=x.end;b[L]=d[L],b[w]=T?d[w]:E[w],b[M]=A?d[M]:E[w],v[L]=E[L],v[w]=T?d[w]:E[w],v[M]=A?d[M]:E[w],F++}for(let R=0;R<=1;R++)for(let T=0;T<=1;T++)for(let A=0;A<=1;A++){i.x=R?E.x:d.x,i.y=T?E.y:d.y,i.z=A?E.z:d.z,this.closestPointToPoint(i,e);const g=i.distanceToSquared(e);if(g<p&&(p=g,a&&a.copy(e),c&&c.copy(i),g<h))return Math.sqrt(g)}for(let R=0;R<12;R++){const T=s[R];for(let A=0;A<12;A++){const g=t[A];gi(T,g,e,i);const f=e.distanceToSquared(i);if(f<p&&(p=f,a&&a.copy(e),c&&c.copy(i),f<h))return Math.sqrt(f)}}return Math.sqrt(p)}}();class Oi{constructor(s){this._getNewPrimitive=s,this._primitives=[]}getPrimitive(){const s=this._primitives;return s.length===0?this._getNewPrimitive():s.pop()}releasePrimitive(s){this._primitives.push(s)}}class fo extends Oi{constructor(){super(()=>new mt)}}const Et=new fo;function at(l,s){return s[l+15]===65535}function lt(l,s){return s[l+6]}function dt(l,s){return s[l+14]}function ut(l){return l+8}function It(l,s){return s[l+6]}function mn(l,s){return s[l+7]}class po{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const s=[];let t=null;this.setBuffer=e=>{t&&s.push(t),t=e,this.float32Array=new Float32Array(e),this.uint16Array=new Uint16Array(e),this.uint32Array=new Uint32Array(e)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,s.length!==0&&this.setBuffer(s.pop())}}}const X=new po;let wt,re;const Xt=[],Ye=new Oi(()=>new C.Box3);function Co(l,s,t,e,i,o){wt=Ye.getPrimitive(),re=Ye.getPrimitive(),Xt.push(wt,re),X.setBuffer(l._roots[s]);const n=ii(0,l.geometry,t,e,i,o);X.clearBuffer(),Ye.releasePrimitive(wt),Ye.releasePrimitive(re),Xt.pop(),Xt.pop();const r=Xt.length;return r>0&&(re=Xt[r-1],wt=Xt[r-2]),n}function ii(l,s,t,e,i=null,o=0,n=0){const{float32Array:r,uint16Array:a,uint32Array:c}=X;let h=l*2;if(at(h,a)){const E=lt(l,c),u=dt(h,a);return q(l,r,wt),e(E,u,!1,n,o+l,wt)}else{let L=function(M){const{uint16Array:x,uint32Array:b}=X;let v=M*2;for(;!at(v,x);)M=ut(M),v=M*2;return lt(M,b)},w=function(M){const{uint16Array:x,uint32Array:b}=X;let v=M*2;for(;!at(v,x);)M=It(M,b),v=M*2;return lt(M,b)+dt(v,x)};const E=ut(l),u=It(l,c);let p=E,F=u,R,T,A,g;if(i&&(A=wt,g=re,q(p,r,A),q(F,r,g),R=i(A),T=i(g),T<R)){p=u,F=E;const M=R;R=T,T=M,A=g}A||(A=wt,q(p,r,A));const f=at(p*2,a),m=t(A,f,R,n+1,o+p);let O;if(m===wi){const M=L(p),b=w(p)-M;O=e(M,b,!0,n+1,o+p,A)}else O=m&&ii(p,s,t,e,i,o,n+1);if(O)return!0;g=re,q(F,r,g);const _=at(F*2,a),N=t(g,_,T,n+1,o+F);let P;if(N===wi){const M=L(F),b=w(F)-M;P=e(M,b,!0,n+1,o+F,g)}else P=N&&ii(F,s,t,e,i,o,n+1);return!!P}}const fe=new C.Vector3,Ys=new C.Vector3;function To(l,s,t={},e=0,i=1/0){const o=e*e,n=i*i;let r=1/0,a=null;if(l.shapecast({boundsTraverseOrder:h=>(fe.copy(s).clamp(h.min,h.max),fe.distanceToSquared(s)),intersectsBounds:(h,d,E)=>E<r&&E<n,intersectsTriangle:(h,d)=>{h.closestPointToPoint(s,fe);const E=s.distanceToSquared(fe);return E<r&&(Ys.copy(fe),r=E,a=d),E<o}}),r===1/0)return null;const c=Math.sqrt(r);return t.point?t.point.copy(Ys):t.point=Ys.clone(),t.distance=c,t.faceIndex=a,t}const Zt=new C.Vector3,Qt=new C.Vector3,jt=new C.Vector3,Ge=new C.Vector2,ze=new C.Vector2,He=new C.Vector2,vi=new C.Vector3,Bi=new C.Vector3,Vi=new C.Vector3,ke=new C.Vector3;function mo(l,s,t,e,i,o){let n;return o===C.BackSide?n=l.intersectTriangle(e,t,s,!0,i):n=l.intersectTriangle(s,t,e,o!==C.DoubleSide,i),n===null?null:{distance:l.origin.distanceTo(i),point:i.clone()}}function Ro(l,s,t,e,i,o,n,r,a){Zt.fromBufferAttribute(s,o),Qt.fromBufferAttribute(s,n),jt.fromBufferAttribute(s,r);const c=mo(l,Zt,Qt,jt,ke,a);if(c){e&&(Ge.fromBufferAttribute(e,o),ze.fromBufferAttribute(e,n),He.fromBufferAttribute(e,r),c.uv=C.Triangle.getInterpolation(ke,Zt,Qt,jt,Ge,ze,He,new C.Vector2)),i&&(Ge.fromBufferAttribute(i,o),ze.fromBufferAttribute(i,n),He.fromBufferAttribute(i,r),c.uv1=C.Triangle.getInterpolation(ke,Zt,Qt,jt,Ge,ze,He,new C.Vector2)),t&&(vi.fromBufferAttribute(t,o),Bi.fromBufferAttribute(t,n),Vi.fromBufferAttribute(t,r),c.normal=C.Triangle.getInterpolation(ke,Zt,Qt,jt,vi,Bi,Vi,new C.Vector3),c.normal.dot(l.direction)>0&&c.normal.multiplyScalar(-1));const h={a:o,b:n,c:r,normal:new C.Vector3,materialIndex:0};C.Triangle.getNormal(Zt,Qt,jt,h.normal),c.face=h,c.faceIndex=o}return c}function ys(l,s,t,e,i){const o=e*3;let n=o+0,r=o+1,a=o+2;const c=l.index;l.index&&(n=c.getX(n),r=c.getX(r),a=c.getX(a));const{position:h,normal:d,uv:E,uv1:u}=l.attributes,p=Ro(t,h,d,E,u,n,r,a,s);return p?(p.faceIndex=e,i&&i.push(p),p):null}function tt(l,s,t,e){const i=l.a,o=l.b,n=l.c;let r=s,a=s+1,c=s+2;t&&(r=t.getX(r),a=t.getX(a),c=t.getX(c)),i.x=e.getX(r),i.y=e.getY(r),i.z=e.getZ(r),o.x=e.getX(a),o.y=e.getY(a),o.z=e.getZ(a),n.x=e.getX(c),n.y=e.getY(c),n.z=e.getZ(c)}function Ao(l,s,t,e,i,o){const{geometry:n,_indirectBuffer:r}=l;for(let a=e,c=e+i;a<c;a++)ys(n,s,t,a,o)}function Fo(l,s,t,e,i){const{geometry:o,_indirectBuffer:n}=l;let r=1/0,a=null;for(let c=e,h=e+i;c<h;c++){let d;d=ys(o,s,t,c),d&&d.distance<r&&(a=d,r=d.distance)}return a}function go(l,s,t,e,i,o,n){const{geometry:r}=t,{index:a}=r,c=r.attributes.position;for(let h=l,d=s+l;h<d;h++){let E;if(E=h,tt(n,E*3,a,c),n.needsUpdate=!0,e(n,E,i,o))return!0}return!1}function Oo(l,s=null){s&&Array.isArray(s)&&(s=new Set(s));const t=l.geometry,e=t.index?t.index.array:null,i=t.attributes.position;let o,n,r,a,c=0;const h=l._roots;for(let E=0,u=h.length;E<u;E++)o=h[E],n=new Uint32Array(o),r=new Uint16Array(o),a=new Float32Array(o),d(0,c),c+=o.byteLength;function d(E,u,p=!1){const F=E*2;if(r[F+15]===Ps){const T=n[E+6],A=r[F+14];let g=1/0,f=1/0,m=1/0,O=-1/0,_=-1/0,N=-1/0;for(let P=3*T,L=3*(T+A);P<L;P++){let w=e[P];const M=i.getX(w),x=i.getY(w),b=i.getZ(w);M<g&&(g=M),M>O&&(O=M),x<f&&(f=x),x>_&&(_=x),b<m&&(m=b),b>N&&(N=b)}return a[E+0]!==g||a[E+1]!==f||a[E+2]!==m||a[E+3]!==O||a[E+4]!==_||a[E+5]!==N?(a[E+0]=g,a[E+1]=f,a[E+2]=m,a[E+3]=O,a[E+4]=_,a[E+5]=N,!0):!1}else{const T=E+8,A=n[E+6],g=T+u,f=A+u;let m=p,O=!1,_=!1;s?m||(O=s.has(g),_=s.has(f),m=!O&&!_):(O=!0,_=!0);const N=m||O,P=m||_;let L=!1;N&&(L=d(T,u,m));let w=!1;P&&(w=d(A,u,m));const M=L||w;if(M)for(let x=0;x<3;x++){const b=T+x,v=A+x,z=a[b],j=a[b+3],et=a[v],Z=a[v+3];a[E+x]=z<et?z:et,a[E+x+3]=j>Z?j:Z}return M}}}const Yi=new C.Box3;function bt(l,s,t,e){return q(l,s,Yi),t.intersectBox(Yi,e)}function So(l,s,t,e,i,o){const{geometry:n,_indirectBuffer:r}=l;for(let a=e,c=e+i;a<c;a++){let h=r?r[a]:a;ys(n,s,t,h,o)}}function _o(l,s,t,e,i){const{geometry:o,_indirectBuffer:n}=l;let r=1/0,a=null;for(let c=e,h=e+i;c<h;c++){let d;d=ys(o,s,t,n?n[c]:c),d&&d.distance<r&&(a=d,r=d.distance)}return a}function No(l,s,t,e,i,o,n){const{geometry:r}=t,{index:a}=r,c=r.attributes.position;for(let h=l,d=s+l;h<d;h++){let E;if(E=t.resolveTriangleIndex(h),tt(n,E*3,a,c),n.needsUpdate=!0,e(n,E,i,o))return!0}return!1}const Gi=new C.Vector3;function Po(l,s,t,e,i){X.setBuffer(l._roots[s]),ni(0,l,t,e,i),X.clearBuffer()}function ni(l,s,t,e,i){const{float32Array:o,uint16Array:n,uint32Array:r}=X,a=l*2;if(at(a,n)){const h=lt(l,r),d=dt(a,n);Ao(s,t,e,h,d,i)}else{const h=ut(l);bt(h,o,e,Gi)&&ni(h,s,t,e,i);const d=It(l,r);bt(d,o,e,Gi)&&ni(d,s,t,e,i)}}const zi=new C.Vector3,yo=["x","y","z"];function Lo(l,s,t,e){X.setBuffer(l._roots[s]);const i=oi(0,l,t,e);return X.clearBuffer(),i}function oi(l,s,t,e){const{float32Array:i,uint16Array:o,uint32Array:n}=X;let r=l*2;if(at(r,o)){const c=lt(l,n),h=dt(r,o);return Fo(s,t,e,c,h)}else{const c=mn(l,n),h=yo[c],E=e.direction[h]>=0;let u,p;E?(u=ut(l),p=It(l,n)):(u=It(l,n),p=ut(l));const R=bt(u,i,e,zi)?oi(u,s,t,e):null;if(R){const g=R.point[h];if(E?g<=i[p+c]:g>=i[p+c+3])return R}const A=bt(p,i,e,zi)?oi(p,s,t,e):null;return R&&A?R.distance<=A.distance?R:A:R||A||null}}const We=new C.Box3,qt=new mt,$t=new mt,pe=new C.Matrix4,Hi=new ot,Xe=new ot;function Mo(l,s,t,e){X.setBuffer(l._roots[s]);const i=ri(0,l,t,e);return X.clearBuffer(),i}function ri(l,s,t,e,i=null){const{float32Array:o,uint16Array:n,uint32Array:r}=X;let a=l*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Hi.set(t.boundingBox.min,t.boundingBox.max,e),i=Hi),at(a,n)){const h=s.geometry,d=h.index,E=h.attributes.position,u=t.index,p=t.attributes.position,F=lt(l,r),R=dt(a,n);if(pe.copy(e).invert(),t.boundsTree)return q(l,o,Xe),Xe.matrix.copy(pe),Xe.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:A=>Xe.intersectsBox(A),intersectsTriangle:A=>{A.a.applyMatrix4(e),A.b.applyMatrix4(e),A.c.applyMatrix4(e),A.needsUpdate=!0;for(let g=F*3,f=(R+F)*3;g<f;g+=3)if(tt($t,g,d,E),$t.needsUpdate=!0,A.intersectsTriangle($t))return!0;return!1}});for(let T=F*3,A=(R+F)*3;T<A;T+=3){tt(qt,T,d,E),qt.a.applyMatrix4(pe),qt.b.applyMatrix4(pe),qt.c.applyMatrix4(pe),qt.needsUpdate=!0;for(let g=0,f=u.count;g<f;g+=3)if(tt($t,g,u,p),$t.needsUpdate=!0,qt.intersectsTriangle($t))return!0}}else{const h=l+8,d=r[l+6];return q(h,o,We),!!(i.intersectsBox(We)&&ri(h,s,t,e,i)||(q(d,o,We),i.intersectsBox(We)&&ri(d,s,t,e,i)))}}const Ze=new C.Matrix4,Gs=new ot,Ce=new ot,wo=new C.Vector3,Do=new C.Vector3,Uo=new C.Vector3,xo=new C.Vector3;function bo(l,s,t,e={},i={},o=0,n=1/0){s.boundingBox||s.computeBoundingBox(),Gs.set(s.boundingBox.min,s.boundingBox.max,t),Gs.needsUpdate=!0;const r=l.geometry,a=r.attributes.position,c=r.index,h=s.attributes.position,d=s.index,E=Et.getPrimitive(),u=Et.getPrimitive();let p=wo,F=Do,R=null,T=null;i&&(R=Uo,T=xo);let A=1/0,g=null,f=null;return Ze.copy(t).invert(),Ce.matrix.copy(Ze),l.shapecast({boundsTraverseOrder:m=>Gs.distanceToBox(m),intersectsBounds:(m,O,_)=>_<A&&_<n?(O&&(Ce.min.copy(m.min),Ce.max.copy(m.max),Ce.needsUpdate=!0),!0):!1,intersectsRange:(m,O)=>{if(s.boundsTree)return s.boundsTree.shapecast({boundsTraverseOrder:N=>Ce.distanceToBox(N),intersectsBounds:(N,P,L)=>L<A&&L<n,intersectsRange:(N,P)=>{for(let L=N,w=N+P;L<w;L++){tt(u,3*L,d,h),u.a.applyMatrix4(t),u.b.applyMatrix4(t),u.c.applyMatrix4(t),u.needsUpdate=!0;for(let M=m,x=m+O;M<x;M++){tt(E,3*M,c,a),E.needsUpdate=!0;const b=E.distanceToTriangle(u,p,R);if(b<A&&(F.copy(p),T&&T.copy(R),A=b,g=M,f=L),b<o)return!0}}}});{const _=Ee(s);for(let N=0,P=_;N<P;N++){tt(u,3*N,d,h),u.a.applyMatrix4(t),u.b.applyMatrix4(t),u.c.applyMatrix4(t),u.needsUpdate=!0;for(let L=m,w=m+O;L<w;L++){tt(E,3*L,c,a),E.needsUpdate=!0;const M=E.distanceToTriangle(u,p,R);if(M<A&&(F.copy(p),T&&T.copy(R),A=M,g=L,f=N),M<o)return!0}}}}}),Et.releasePrimitive(E),Et.releasePrimitive(u),A===1/0?null:(e.point?e.point.copy(F):e.point=F.clone(),e.distance=A,e.faceIndex=g,i&&(i.point?i.point.copy(T):i.point=T.clone(),i.point.applyMatrix4(Ze),F.applyMatrix4(Ze),i.distance=F.sub(i.point).length(),i.faceIndex=f),e)}function vo(l,s=null){s&&Array.isArray(s)&&(s=new Set(s));const t=l.geometry,e=t.index?t.index.array:null,i=t.attributes.position;let o,n,r,a,c=0;const h=l._roots;for(let E=0,u=h.length;E<u;E++)o=h[E],n=new Uint32Array(o),r=new Uint16Array(o),a=new Float32Array(o),d(0,c),c+=o.byteLength;function d(E,u,p=!1){const F=E*2;if(r[F+15]===Ps){const T=n[E+6],A=r[F+14];let g=1/0,f=1/0,m=1/0,O=-1/0,_=-1/0,N=-1/0;for(let P=T,L=T+A;P<L;P++){const w=3*l.resolveTriangleIndex(P);for(let M=0;M<3;M++){let x=w+M;x=e?e[x]:x;const b=i.getX(x),v=i.getY(x),z=i.getZ(x);b<g&&(g=b),b>O&&(O=b),v<f&&(f=v),v>_&&(_=v),z<m&&(m=z),z>N&&(N=z)}}return a[E+0]!==g||a[E+1]!==f||a[E+2]!==m||a[E+3]!==O||a[E+4]!==_||a[E+5]!==N?(a[E+0]=g,a[E+1]=f,a[E+2]=m,a[E+3]=O,a[E+4]=_,a[E+5]=N,!0):!1}else{const T=E+8,A=n[E+6],g=T+u,f=A+u;let m=p,O=!1,_=!1;s?m||(O=s.has(g),_=s.has(f),m=!O&&!_):(O=!0,_=!0);const N=m||O,P=m||_;let L=!1;N&&(L=d(T,u,m));let w=!1;P&&(w=d(A,u,m));const M=L||w;if(M)for(let x=0;x<3;x++){const b=T+x,v=A+x,z=a[b],j=a[b+3],et=a[v],Z=a[v+3];a[E+x]=z<et?z:et,a[E+x+3]=j>Z?j:Z}return M}}}const ki=new C.Vector3;function Bo(l,s,t,e,i){X.setBuffer(l._roots[s]),ai(0,l,t,e,i),X.clearBuffer()}function ai(l,s,t,e,i){const{float32Array:o,uint16Array:n,uint32Array:r}=X,a=l*2;if(at(a,n)){const h=lt(l,r),d=dt(a,n);So(s,t,e,h,d,i)}else{const h=ut(l);bt(h,o,e,ki)&&ai(h,s,t,e,i);const d=It(l,r);bt(d,o,e,ki)&&ai(d,s,t,e,i)}}const Wi=new C.Vector3,Vo=["x","y","z"];function Yo(l,s,t,e){X.setBuffer(l._roots[s]);const i=ci(0,l,t,e);return X.clearBuffer(),i}function ci(l,s,t,e){const{float32Array:i,uint16Array:o,uint32Array:n}=X;let r=l*2;if(at(r,o)){const c=lt(l,n),h=dt(r,o);return _o(s,t,e,c,h)}else{const c=mn(l,n),h=Vo[c],E=e.direction[h]>=0;let u,p;E?(u=ut(l),p=It(l,n)):(u=It(l,n),p=ut(l));const R=bt(u,i,e,Wi)?ci(u,s,t,e):null;if(R){const g=R.point[h];if(E?g<=i[p+c]:g>=i[p+c+3])return R}const A=bt(p,i,e,Wi)?ci(p,s,t,e):null;return R&&A?R.distance<=A.distance?R:A:R||A||null}}const Qe=new C.Box3,Kt=new mt,Jt=new mt,Te=new C.Matrix4,Xi=new ot,je=new ot;function Go(l,s,t,e){X.setBuffer(l._roots[s]);const i=li(0,l,t,e);return X.clearBuffer(),i}function li(l,s,t,e,i=null){const{float32Array:o,uint16Array:n,uint32Array:r}=X;let a=l*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Xi.set(t.boundingBox.min,t.boundingBox.max,e),i=Xi),at(a,n)){const h=s.geometry,d=h.index,E=h.attributes.position,u=t.index,p=t.attributes.position,F=lt(l,r),R=dt(a,n);if(Te.copy(e).invert(),t.boundsTree)return q(l,o,je),je.matrix.copy(Te),je.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:A=>je.intersectsBox(A),intersectsTriangle:A=>{A.a.applyMatrix4(e),A.b.applyMatrix4(e),A.c.applyMatrix4(e),A.needsUpdate=!0;for(let g=F,f=R+F;g<f;g++)if(tt(Jt,3*s.resolveTriangleIndex(g),d,E),Jt.needsUpdate=!0,A.intersectsTriangle(Jt))return!0;return!1}});for(let T=F,A=R+F;T<A;T++){const g=s.resolveTriangleIndex(T);tt(Kt,3*g,d,E),Kt.a.applyMatrix4(Te),Kt.b.applyMatrix4(Te),Kt.c.applyMatrix4(Te),Kt.needsUpdate=!0;for(let f=0,m=u.count;f<m;f+=3)if(tt(Jt,f,u,p),Jt.needsUpdate=!0,Kt.intersectsTriangle(Jt))return!0}}else{const h=l+8,d=r[l+6];return q(h,o,Qe),!!(i.intersectsBox(Qe)&&li(h,s,t,e,i)||(q(d,o,Qe),i.intersectsBox(Qe)&&li(d,s,t,e,i)))}}const qe=new C.Matrix4,zs=new ot,me=new ot,zo=new C.Vector3,Ho=new C.Vector3,ko=new C.Vector3,Wo=new C.Vector3;function Xo(l,s,t,e={},i={},o=0,n=1/0){s.boundingBox||s.computeBoundingBox(),zs.set(s.boundingBox.min,s.boundingBox.max,t),zs.needsUpdate=!0;const r=l.geometry,a=r.attributes.position,c=r.index,h=s.attributes.position,d=s.index,E=Et.getPrimitive(),u=Et.getPrimitive();let p=zo,F=Ho,R=null,T=null;i&&(R=ko,T=Wo);let A=1/0,g=null,f=null;return qe.copy(t).invert(),me.matrix.copy(qe),l.shapecast({boundsTraverseOrder:m=>zs.distanceToBox(m),intersectsBounds:(m,O,_)=>_<A&&_<n?(O&&(me.min.copy(m.min),me.max.copy(m.max),me.needsUpdate=!0),!0):!1,intersectsRange:(m,O)=>{if(s.boundsTree){const _=s.boundsTree;return _.shapecast({boundsTraverseOrder:N=>me.distanceToBox(N),intersectsBounds:(N,P,L)=>L<A&&L<n,intersectsRange:(N,P)=>{for(let L=N,w=N+P;L<w;L++){const M=_.resolveTriangleIndex(L);tt(u,3*M,d,h),u.a.applyMatrix4(t),u.b.applyMatrix4(t),u.c.applyMatrix4(t),u.needsUpdate=!0;for(let x=m,b=m+O;x<b;x++){const v=l.resolveTriangleIndex(x);tt(E,3*v,c,a),E.needsUpdate=!0;const z=E.distanceToTriangle(u,p,R);if(z<A&&(F.copy(p),T&&T.copy(R),A=z,g=x,f=L),z<o)return!0}}}})}else{const _=Ee(s);for(let N=0,P=_;N<P;N++){tt(u,3*N,d,h),u.a.applyMatrix4(t),u.b.applyMatrix4(t),u.c.applyMatrix4(t),u.needsUpdate=!0;for(let L=m,w=m+O;L<w;L++){const M=l.resolveTriangleIndex(L);tt(E,3*M,c,a),E.needsUpdate=!0;const x=E.distanceToTriangle(u,p,R);if(x<A&&(F.copy(p),T&&T.copy(R),A=x,g=L,f=N),x<o)return!0}}}}}),Et.releasePrimitive(E),Et.releasePrimitive(u),A===1/0?null:(e.point?e.point.copy(F):e.point=F.clone(),e.distance=A,e.faceIndex=g,i&&(i.point?i.point.copy(T):i.point=T.clone(),i.point.applyMatrix4(qe),F.applyMatrix4(qe),i.distance=F.sub(i.point).length(),i.faceIndex=f),e)}function Zo(){return typeof SharedArrayBuffer<"u"}const ye=new X.constructor,ls=new X.constructor,Lt=new Oi(()=>new C.Box3),te=new C.Box3,ee=new C.Box3,Hs=new C.Box3,ks=new C.Box3;let Ws=!1;function Qo(l,s,t,e){if(Ws)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");Ws=!0;const i=l._roots,o=s._roots;let n,r=0,a=0;const c=new C.Matrix4().copy(t).invert();for(let h=0,d=i.length;h<d;h++){ye.setBuffer(i[h]),a=0;const E=Lt.getPrimitive();q(0,ye.float32Array,E),E.applyMatrix4(c);for(let u=0,p=o.length;u<p&&(ls.setBuffer(o[h]),n=ft(0,0,t,c,e,r,a,0,0,E),ls.clearBuffer(),a+=o[u].length,!n);u++);if(Lt.releasePrimitive(E),ye.clearBuffer(),r+=i[h].length,n)break}return Ws=!1,n}function ft(l,s,t,e,i,o=0,n=0,r=0,a=0,c=null,h=!1){let d,E;h?(d=ls,E=ye):(d=ye,E=ls);const u=d.float32Array,p=d.uint32Array,F=d.uint16Array,R=E.float32Array,T=E.uint32Array,A=E.uint16Array,g=l*2,f=s*2,m=at(g,F),O=at(f,A);let _=!1;if(O&&m)h?_=i(lt(s,T),dt(s*2,A),lt(l,p),dt(l*2,F),a,n+s,r,o+l):_=i(lt(l,p),dt(l*2,F),lt(s,T),dt(s*2,A),r,o+l,a,n+s);else if(O){const N=Lt.getPrimitive();q(s,R,N),N.applyMatrix4(t);const P=ut(l),L=It(l,p);q(P,u,te),q(L,u,ee);const w=N.intersectsBox(te),M=N.intersectsBox(ee);_=w&&ft(s,P,e,t,i,n,o,a,r+1,N,!h)||M&&ft(s,L,e,t,i,n,o,a,r+1,N,!h),Lt.releasePrimitive(N)}else{const N=ut(s),P=It(s,T);q(N,R,Hs),q(P,R,ks);const L=c.intersectsBox(Hs),w=c.intersectsBox(ks);if(L&&w)_=ft(l,N,t,e,i,o,n,r,a+1,c,h)||ft(l,P,t,e,i,o,n,r,a+1,c,h);else if(L)if(m)_=ft(l,N,t,e,i,o,n,r,a+1,c,h);else{const M=Lt.getPrimitive();M.copy(Hs).applyMatrix4(t);const x=ut(l),b=It(l,p);q(x,u,te),q(b,u,ee);const v=M.intersectsBox(te),z=M.intersectsBox(ee);_=v&&ft(N,x,e,t,i,n,o,a,r+1,M,!h)||z&&ft(N,b,e,t,i,n,o,a,r+1,M,!h),Lt.releasePrimitive(M)}else if(w)if(m)_=ft(l,P,t,e,i,o,n,r,a+1,c,h);else{const M=Lt.getPrimitive();M.copy(ks).applyMatrix4(t);const x=ut(l),b=It(l,p);q(x,u,te),q(b,u,ee);const v=M.intersectsBox(te),z=M.intersectsBox(ee);_=v&&ft(P,x,e,t,i,n,o,a,r+1,M,!h)||z&&ft(P,b,e,t,i,n,o,a,r+1,M,!h),Lt.releasePrimitive(M)}}return _}const $e=new ot,Zi=new C.Box3;class Si{static serialize(s,t={}){t={cloneBuffers:!0,...t};const e=s.geometry,i=s._roots,o=s._indirectBuffer,n=e.getIndex();let r;return t.cloneBuffers?r={roots:i.map(a=>a.slice()),index:n.array.slice(),indirectBuffer:o?o.slice():null}:r={roots:i,index:n.array,indirectBuffer:o},r}static deserialize(s,t,e={}){e={setIndex:!0,indirect:!!s.indirectBuffer,...e};const{index:i,roots:o,indirectBuffer:n}=s,r=new Si(t,{...e,[vs]:!0});if(r._roots=o,r._indirectBuffer=n||null,e.setIndex){const a=t.getIndex();if(a===null){const c=new C.BufferAttribute(s.index,1,!1);t.setIndex(c)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return r}get indirect(){return!!this._indirectBuffer}constructor(s,t={}){if(s.isBufferGeometry){if(s.index&&s.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:pn,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[vs]:!1},t),t.useSharedArrayBuffer&&!Zo())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=s,this._roots=null,this._indirectBuffer=null,t[vs]||(ho(this,t),!s.boundingBox&&t.setBoundingBox&&(s.boundingBox=this.getBoundingBox(new C.Box3)));const{_indirectBuffer:e}=this;this.resolveTriangleIndex=t.indirect?i=>e[i]:i=>i}refit(s=null){return(this.indirect?vo:Oo)(this,s)}traverse(s,t=0){const e=this._roots[t],i=new Uint32Array(e),o=new Uint16Array(e);n(0);function n(r,a=0){const c=r*2,h=o[c+15]===Ps;if(h){const d=i[r+6],E=o[c+14];s(a,h,new Float32Array(e,r*4,6),d,E)}else{const d=r+rs/4,E=i[r+6],u=i[r+7];s(a,h,new Float32Array(e,r*4,6),u)||(n(d,a+1),n(E,a+1))}}}raycast(s,t=C.FrontSide){const e=this._roots,i=this.geometry,o=[],n=t.isMaterial,r=Array.isArray(t),a=i.groups,c=n?t.side:t,h=this.indirect?Bo:Po;for(let d=0,E=e.length;d<E;d++){const u=r?t[a[d].materialIndex].side:c,p=o.length;if(h(this,d,u,s,o),r){const F=a[d].materialIndex;for(let R=p,T=o.length;R<T;R++)o[R].face.materialIndex=F}}return o}raycastFirst(s,t=C.FrontSide){const e=this._roots,i=this.geometry,o=t.isMaterial,n=Array.isArray(t);let r=null;const a=i.groups,c=o?t.side:t,h=this.indirect?Yo:Lo;for(let d=0,E=e.length;d<E;d++){const u=n?t[a[d].materialIndex].side:c,p=h(this,d,u,s);p!=null&&(r==null||p.distance<r.distance)&&(r=p,n&&(p.face.materialIndex=a[d].materialIndex))}return r}intersectsGeometry(s,t){let e=!1;const i=this._roots,o=this.indirect?Go:Mo;for(let n=0,r=i.length;n<r&&(e=o(this,n,s,t),!e);n++);return e}shapecast(s){const t=Et.getPrimitive(),e=this.indirect?No:go;let{boundsTraverseOrder:i,intersectsBounds:o,intersectsRange:n,intersectsTriangle:r}=s;if(n&&r){const d=n;n=(E,u,p,F,R)=>d(E,u,p,F,R)?!0:e(E,u,this,r,p,F,t)}else n||(r?n=(d,E,u,p)=>e(d,E,this,r,u,p,t):n=(d,E,u)=>u);let a=!1,c=0;const h=this._roots;for(let d=0,E=h.length;d<E;d++){const u=h[d];if(a=Co(this,d,o,n,i,c),a)break;c+=u.byteLength}return Et.releasePrimitive(t),a}bvhcast(s,t,e){let{intersectsRanges:i,intersectsTriangles:o}=e;const n=Et.getPrimitive(),r=this.geometry.index,a=this.geometry.attributes.position,c=this.indirect?p=>{const F=this.resolveTriangleIndex(p);tt(n,F*3,r,a)}:p=>{tt(n,p*3,r,a)},h=Et.getPrimitive(),d=s.geometry.index,E=s.geometry.attributes.position,u=s.indirect?p=>{const F=s.resolveTriangleIndex(p);tt(h,F*3,d,E)}:p=>{tt(h,p*3,d,E)};if(o){const p=(F,R,T,A,g,f,m,O)=>{for(let _=T,N=T+A;_<N;_++){u(_),h.a.applyMatrix4(t),h.b.applyMatrix4(t),h.c.applyMatrix4(t),h.needsUpdate=!0;for(let P=F,L=F+R;P<L;P++)if(c(P),n.needsUpdate=!0,o(n,h,P,_,g,f,m,O))return!0}return!1};if(i){const F=i;i=function(R,T,A,g,f,m,O,_){return F(R,T,A,g,f,m,O,_)?!0:p(R,T,A,g,f,m,O,_)}}else i=p}return Qo(this,s,t,i)}intersectsBox(s,t){return $e.set(s.min,s.max,t),$e.needsUpdate=!0,this.shapecast({intersectsBounds:e=>$e.intersectsBox(e),intersectsTriangle:e=>$e.intersectsTriangle(e)})}intersectsSphere(s){return this.shapecast({intersectsBounds:t=>s.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(s)})}closestPointToGeometry(s,t,e={},i={},o=0,n=1/0){return(this.indirect?Xo:bo)(this,s,t,e,i,o,n)}closestPointToPoint(s,t={},e=0,i=1/0){return To(this,s,t,e,i)}getBoundingBox(s){return s.makeEmpty(),this._roots.forEach(e=>{q(0,new Float32Array(e),Zi),s.union(Zi)}),s}}function Qi(l,s,t){return l===null||(l.point.applyMatrix4(s.matrixWorld),l.distance=l.point.distanceTo(t.ray.origin),l.object=s,l.distance<t.near||l.distance>t.far)?null:l}const Xs=new C.Ray,ji=new C.Matrix4,jo=C.Mesh.prototype.raycast;function qo(l,s){if(this.geometry.boundsTree){if(this.material===void 0)return;ji.copy(this.matrixWorld).invert(),Xs.copy(l.ray).applyMatrix4(ji);const t=this.geometry.boundsTree;if(l.firstHitOnly===!0){const e=Qi(t.raycastFirst(Xs,this.material),this,l);e&&s.push(e)}else{const e=t.raycast(Xs,this.material);for(let i=0,o=e.length;i<o;i++){const n=Qi(e[i],this,l);n&&s.push(n)}}}else jo.call(this,l,s)}function $o(l){return this.boundsTree=new Si(this,l),this.boundsTree}function Ko(){this.boundsTree=null}class D{constructor(){I(this,"trigger",s=>{const t=this.handlers.slice(0);for(const e of t)e(s)});I(this,"handlers",[])}add(s){this.handlers.push(s)}remove(s){this.handlers=this.handlers.filter(t=>t!==s)}reset(){this.handlers.length=0}}class Ut{constructor(){I(this,"trigger",async s=>{const t=this.handlers.slice(0);for(const e of t)await e(s)});I(this,"handlers",[])}add(s){this.handlers.push(s)}remove(s){this.handlers=this.handlers.filter(t=>t!==s)}reset(){this.handlers.length=0}}class Ls{constructor(s){I(this,"isDisposeable",()=>"dispose"in this&&"onDisposed"in this);I(this,"isResizeable",()=>"resize"in this&&"getSize"in this);I(this,"isUpdateable",()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this);I(this,"isHideable",()=>"visible"in this);I(this,"isConfigurable",()=>"setup"in this&&"config"in this&&"onSetup"in this);this.components=s}}class $ extends Ls{}class Ms extends Ls{constructor(t){super(t);I(this,"worlds",new Map);I(this,"onWorldChanged",new D);I(this,"currentWorld",null);this.onWorldChanged.add(({world:e,action:i})=>{i==="removed"&&this.worlds.delete(e.uuid)})}}class Rn extends Ms{constructor(){super(...arguments);I(this,"hasCameraControls",()=>"controls"in this)}}class An extends Ms{constructor(){super(...arguments);I(this,"onAfterUpdate",new D);I(this,"onBeforeUpdate",new D);I(this,"onDisposed",new D);I(this,"onResize",new D);I(this,"onClippingPlanesUpdated",new D);I(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(t,e,i){e.isLocal=i;const o=this.clippingPlanes.indexOf(e);t&&o===-1?this.clippingPlanes.push(e):!t&&o>-1&&this.clippingPlanes.splice(o,1),this.three.clippingPlanes=this.clippingPlanes.filter(n=>!n.isLocal)}}const Le=class Le extends ${constructor(t){super(t);I(this,"_disposedComponents",new Set);I(this,"enabled",!0);t.add(Le.uuid,this)}get(){return this._disposedComponents}destroy(t,e=!0,i=!0){t.removeFromParent();const o=t;o.dispose&&o.dispose(),this.disposeGeometryAndMaterials(t,e),i&&o.children&&o.children.length&&this.disposeChildren(o),t.children.length=0}disposeGeometry(t){t.boundsTree&&t.disposeBoundsTree&&t.disposeBoundsTree(),t.dispose()}disposeGeometryAndMaterials(t,e){const i=t;i.geometry&&this.disposeGeometry(i.geometry),e&&i.material&&Le.disposeMaterial(i),i.material=[],i.geometry=null}disposeChildren(t){for(const e of t.children)this.destroy(e)}static disposeMaterial(t){if(t.material)if(Array.isArray(t.material))for(const e of t.material)e.dispose();else t.material.dispose()}};I(Le,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let _t=Le;class Fn extends Ms{constructor(t){super(t);I(this,"onDisposed",new D)}dispose(){const t=this.components.get(_t);for(const e of this.three.children){const i=e;i.geometry&&t.destroy(i)}this.three.children=[],this.onDisposed.trigger(),this.onDisposed.reset()}}const as=0,Jo=1,tr=new C.Vector3,qi=new C.Line3,Zs=new C.Plane,$i=new C.Vector3,Ke=new C.Triangle;class er{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new Ki,this.unassigned=new Ki,this.vertices=[]}setFromPoints(s){if(s.length>=4){this.makeEmpty();for(let t=0,e=s.length;t<e;t++)this.vertices.push(new sr(s[t]));this.compute()}return this}setFromObject(s){const t=[];return s.updateMatrixWorld(!0),s.traverse(function(e){const i=e.geometry;if(i!==void 0){const o=i.attributes.position;if(o!==void 0)for(let n=0,r=o.count;n<r;n++){const a=new C.Vector3;a.fromBufferAttribute(o,n).applyMatrix4(e.matrixWorld),t.push(a)}}}),this.setFromPoints(t)}containsPoint(s){const t=this.faces;for(let e=0,i=t.length;e<i;e++)if(t[e].distanceToPoint(s)>this.tolerance)return!1;return!0}intersectRay(s,t){const e=this.faces;let i=-1/0,o=1/0;for(let n=0,r=e.length;n<r;n++){const a=e[n],c=a.distanceToPoint(s.origin),h=a.normal.dot(s.direction);if(c>0&&h>=0)return null;const d=h!==0?-c/h:0;if(!(d<=0)&&(h>0?o=Math.min(d,o):i=Math.max(d,i),i>o))return null}return i!==-1/0?s.at(i,t):s.at(o,t),t}intersectsRay(s){return this.intersectRay(s,tr)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(s,t){return s.face=t,t.outside===null?this.assigned.append(s):this.assigned.insertBefore(t.outside,s),t.outside=s,this}removeVertexFromFace(s,t){return s===t.outside&&(s.next!==null&&s.next.face===t?t.outside=s.next:t.outside=null),this.assigned.remove(s),this}removeAllVerticesFromFace(s){if(s.outside!==null){const t=s.outside;let e=s.outside;for(;e.next!==null&&e.next.face===s;)e=e.next;return this.assigned.removeSubList(t,e),t.prev=e.next=null,s.outside=null,t}}deleteFaceVertices(s,t){const e=this.removeAllVerticesFromFace(s);if(e!==void 0)if(t===void 0)this.unassigned.appendChain(e);else{let i=e;do{const o=i.next;t.distanceToPoint(i.point)>this.tolerance?this.addVertexToFace(i,t):this.unassigned.append(i),i=o}while(i!==null)}return this}resolveUnassignedPoints(s){if(this.unassigned.isEmpty()===!1){let t=this.unassigned.first();do{const e=t.next;let i=this.tolerance,o=null;for(let n=0;n<s.length;n++){const r=s[n];if(r.mark===as){const a=r.distanceToPoint(t.point);if(a>i&&(i=a,o=r),i>1e3*this.tolerance)break}}o!==null&&this.addVertexToFace(t,o),t=e}while(t!==null)}return this}computeExtremes(){const s=new C.Vector3,t=new C.Vector3,e=[],i=[];for(let o=0;o<3;o++)e[o]=i[o]=this.vertices[0];s.copy(this.vertices[0].point),t.copy(this.vertices[0].point);for(let o=0,n=this.vertices.length;o<n;o++){const r=this.vertices[o],a=r.point;for(let c=0;c<3;c++)a.getComponent(c)<s.getComponent(c)&&(s.setComponent(c,a.getComponent(c)),e[c]=r);for(let c=0;c<3;c++)a.getComponent(c)>t.getComponent(c)&&(t.setComponent(c,a.getComponent(c)),i[c]=r)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(s.x),Math.abs(t.x))+Math.max(Math.abs(s.y),Math.abs(t.y))+Math.max(Math.abs(s.z),Math.abs(t.z))),{min:e,max:i}}computeInitialHull(){const s=this.vertices,t=this.computeExtremes(),e=t.min,i=t.max;let o=0,n=0;for(let E=0;E<3;E++){const u=i[E].point.getComponent(E)-e[E].point.getComponent(E);u>o&&(o=u,n=E)}const r=e[n],a=i[n];let c,h;o=0,qi.set(r.point,a.point);for(let E=0,u=this.vertices.length;E<u;E++){const p=s[E];if(p!==r&&p!==a){qi.closestPointToPoint(p.point,!0,$i);const F=$i.distanceToSquared(p.point);F>o&&(o=F,c=p)}}o=-1,Zs.setFromCoplanarPoints(r.point,a.point,c.point);for(let E=0,u=this.vertices.length;E<u;E++){const p=s[E];if(p!==r&&p!==a&&p!==c){const F=Math.abs(Zs.distanceToPoint(p.point));F>o&&(o=F,h=p)}}const d=[];if(Zs.distanceToPoint(h.point)<0){d.push(Ct.create(r,a,c),Ct.create(h,a,r),Ct.create(h,c,a),Ct.create(h,r,c));for(let E=0;E<3;E++){const u=(E+1)%3;d[E+1].getEdge(2).setTwin(d[0].getEdge(u)),d[E+1].getEdge(1).setTwin(d[u+1].getEdge(0))}}else{d.push(Ct.create(r,c,a),Ct.create(h,r,a),Ct.create(h,a,c),Ct.create(h,c,r));for(let E=0;E<3;E++){const u=(E+1)%3;d[E+1].getEdge(2).setTwin(d[0].getEdge((3-E)%3)),d[E+1].getEdge(0).setTwin(d[u+1].getEdge(1))}}for(let E=0;E<4;E++)this.faces.push(d[E]);for(let E=0,u=s.length;E<u;E++){const p=s[E];if(p!==r&&p!==a&&p!==c&&p!==h){o=this.tolerance;let F=null;for(let R=0;R<4;R++){const T=this.faces[R].distanceToPoint(p.point);T>o&&(o=T,F=this.faces[R])}F!==null&&this.addVertexToFace(p,F)}}return this}reindexFaces(){const s=[];for(let t=0;t<this.faces.length;t++){const e=this.faces[t];e.mark===as&&s.push(e)}return this.faces=s,this}nextVertexToAdd(){if(this.assigned.isEmpty()===!1){let s,t=0;const e=this.assigned.first().face;let i=e.outside;do{const o=e.distanceToPoint(i.point);o>t&&(t=o,s=i),i=i.next}while(i!==null&&i.face===e);return s}}computeHorizon(s,t,e,i){this.deleteFaceVertices(e),e.mark=Jo;let o;t===null?o=t=e.getEdge(0):o=t.next;do{const n=o.twin,r=n.face;r.mark===as&&(r.distanceToPoint(s)>this.tolerance?this.computeHorizon(s,n,r,i):i.push(o)),o=o.next}while(o!==t);return this}addAdjoiningFace(s,t){const e=Ct.create(s,t.tail(),t.head());return this.faces.push(e),e.getEdge(-1).setTwin(t.twin),e.getEdge(0)}addNewFaces(s,t){this.newFaces=[];let e=null,i=null;for(let o=0;o<t.length;o++){const n=t[o],r=this.addAdjoiningFace(s,n);e===null?e=r:r.next.setTwin(i),this.newFaces.push(r.face),i=r}return e.next.setTwin(i),this}addVertexToHull(s){const t=[];return this.unassigned.clear(),this.removeVertexFromFace(s,s.face),this.computeHorizon(s.point,null,s.face,t),this.addNewFaces(s,t),this.resolveUnassignedPoints(this.newFaces),this}cleanup(){return this.assigned.clear(),this.unassigned.clear(),this.newFaces=[],this}compute(){let s;for(this.computeInitialHull();(s=this.nextVertexToAdd())!==void 0;)this.addVertexToHull(s);return this.reindexFaces(),this.cleanup(),this}}class Ct{constructor(){this.normal=new C.Vector3,this.midpoint=new C.Vector3,this.area=0,this.constant=0,this.outside=null,this.mark=as,this.edge=null}static create(s,t,e){const i=new Ct,o=new Qs(s,i),n=new Qs(t,i),r=new Qs(e,i);return o.next=r.prev=n,n.next=o.prev=r,r.next=n.prev=o,i.edge=o,i.compute()}getEdge(s){let t=this.edge;for(;s>0;)t=t.next,s--;for(;s<0;)t=t.prev,s++;return t}compute(){const s=this.edge.tail(),t=this.edge.head(),e=this.edge.next.head();return Ke.set(s.point,t.point,e.point),Ke.getNormal(this.normal),Ke.getMidpoint(this.midpoint),this.area=Ke.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(s){return this.normal.dot(s)-this.constant}}class Qs{constructor(s,t){this.vertex=s,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 s=this.head(),t=this.tail();return t!==null?t.point.distanceTo(s.point):-1}lengthSquared(){const s=this.head(),t=this.tail();return t!==null?t.point.distanceToSquared(s.point):-1}setTwin(s){return this.twin=s,s.twin=this,this}}class sr{constructor(s){this.point=s,this.prev=null,this.next=null,this.face=null}}class Ki{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(s,t){return t.prev=s.prev,t.next=s,t.prev===null?this.head=t:t.prev.next=t,s.prev=t,this}insertAfter(s,t){return t.prev=s,t.next=s.next,t.next===null?this.tail=t:t.next.prev=t,s.next=t,this}append(s){return this.head===null?this.head=s:this.tail.next=s,s.prev=this.tail,s.next=null,this.tail=s,this}appendChain(s){for(this.head===null?this.head=s:this.tail.next=s,s.prev=this.tail;s.next!==null;)s=s.next;return this.tail=s,this}remove(s){return s.prev===null?this.head=s.next:s.prev.next=s.next,s.next===null?this.tail=s.prev:s.next.prev=s.prev,this}removeSubList(s,t){return s.prev===null?this.head=t.next:s.prev.next=t.next,t.next===null?this.tail=s.prev:t.next.prev=s.prev,this}isEmpty(){return this.head===null}}const hi=[2,2,1],Ei=[1,0,0];function gt(l,s){return l*3+s}function ir(l){const s=l.elements;let t=0;for(let e=0;e<9;e++)t+=s[e]*s[e];return Math.sqrt(t)}function nr(l){const s=l.elements;let t=0;for(let e=0;e<3;e++){const i=s[gt(hi[e],Ei[e])];t+=2*i*i}return Math.sqrt(t)}function or(l,s){let t=0,e=1;const i=l.elements;for(let c=0;c<3;c++){const h=Math.abs(i[gt(hi[c],Ei[c])]);h>t&&(t=h,e=c)}let o=1,n=0;const r=Ei[e],a=hi[e];if(Math.abs(i[gt(a,r)])>Number.EPSILON){const c=i[gt(a,a)],h=i[gt(r,r)],d=i[gt(a,r)],E=(c-h)/2/d;let u;E<0?u=-1/(-E+Math.sqrt(1+E*E)):u=1/(E+Math.sqrt(1+E*E)),o=1/Math.sqrt(1+u*u),n=u*o}return s.identity(),s.elements[gt(r,r)]=o,s.elements[gt(a,a)]=o,s.elements[gt(a,r)]=n,s.elements[gt(r,a)]=-n,s}function rr(l,s){let t=0,e=0;const i=10;s.unitary.identity(),s.diagonal.copy(l);const o=s.unitary,n=s.diagonal,r=new S.Matrix3,a=new S.Matrix3,c=Number.EPSILON*ir(n);for(;e<i&&nr(n)>c;)or(n,r),a.copy(r).transpose(),n.multiply(r),n.premultiply(a),o.multiply(r),++t>2&&(e++,t=0);return s}function gn(l){const s=[];for(let st=0;st<l.length-2;st+=3){const Yt=l[st],J=l[st+1],Wt=l[st+2];s.push(new S.Vector3(Yt,J,Wt))}const t=new er;t.setFromPoints(s);const e={unitary:new S.Matrix3,diagonal:new S.Matrix3},i=t.faces,o=[],n=[];for(let st=0,Yt=i.length;st<Yt;st++){const J=i[st];let Wt=J.edge;o.length=0;do o.push(Wt),Wt=Wt.next;while(Wt!==J.edge);const zn=o.length-2;for(let be=1,Hn=zn;be<=Hn;be++){const Ds=o[0].vertex,Us=o[be+0].vertex,xs=o[be+1].vertex;n.push(Ds.point.x,Ds.point.y,Ds.point.z),n.push(Us.point.x,Us.point.y,Us.point.z),n.push(xs.point.x,xs.point.y,xs.point.z)}}const r=new S.Vector3,a=new S.Vector3,c=new S.Vector3,h=new S.Vector3,d=new S.Vector3,E=new S.Vector3,u=new S.Vector3,p=new S.Vector3;let F=0,R=0,T=0,A=0,g=0,f=0,m=0;for(let st=0,Yt=n.length;st<Yt;st+=9){r.fromArray(n,st),a.fromArray(n,st+3),c.fromArray(n,st+6),u.set(0,0,0),u.add(r).add(a).add(c).divideScalar(3),h.subVectors(a,r),d.subVectors(c,r);const J=E.crossVectors(h,d).length()/2;p.add(E.copy(u).multiplyScalar(J)),F+=J,R+=(9*u.x*u.x+r.x*r.x+a.x*a.x+c.x*c.x)*(J/12),T+=(9*u.x*u.y+r.x*r.y+a.x*a.y+c.x*c.y)*(J/12),A+=(9*u.x*u.z+r.x*r.z+a.x*a.z+c.x*c.z)*(J/12),g+=(9*u.y*u.y+r.y*r.y+a.y*a.y+c.y*c.y)*(J/12),f+=(9*u.y*u.z+r.y*r.z+a.y*a.z+c.y*c.z)*(J/12),m+=(9*u.z*u.z+r.z*r.z+a.z*a.z+c.z*c.z)*(J/12)}p.divideScalar(F),R/=F,T/=F,A/=F,g/=F,f/=F,m/=F,R-=p.x*p.x,T-=p.x*p.y,A-=p.x*p.z,g-=p.y*p.y,f-=p.y*p.z,m-=p.z*p.z;const O=new S.Matrix3;O.elements[0]=R,O.elements[1]=T,O.elements[2]=A,O.elements[3]=T,O.elements[4]=g,O.elements[5]=f,O.elements[6]=A,O.elements[7]=f,O.elements[8]=m,rr(O,e);const _=e.unitary,N=new S.Vector3,P=new S.Vector3,L=new S.Vector3;_.extractBasis(N,P,L);let w=-1/0,M=-1/0,x=-1/0,b=1/0,v=1/0,z=1/0;for(let st=0,Yt=s.length;st<Yt;st++){const J=s[st];w=Math.max(N.dot(J),w),M=Math.max(P.dot(J),M),x=Math.max(L.dot(J),x),b=Math.min(N.dot(J),b),v=Math.min(P.dot(J),v),z=Math.min(L.dot(J),z)}N.multiplyScalar(.5*(b+w)),P.multiplyScalar(.5*(v+M)),L.multiplyScalar(.5*(z+x));const j=new S.Vector3,et=new S.Vector3,Z=new S.Matrix3;j.add(N).add(P).add(L),et.x=w-b,et.y=M-v,et.z=x-z,et.multiplyScalar(.5),Z.copy(_);const{x:vt,y:Bt,z:Vt}=et,xe=new S.Matrix4;xe.makeScale(vt*2,Bt*2,Vt*2);const de=new S.Matrix4;de.makeTranslation(-vt,-Bt,-Vt);const Li=new S.Matrix4;Li.makeTranslation(j.x,j.y,j.z);const Mi=new S.Matrix4;Mi.setFromMatrix3(Z);const ue=new S.Matrix4;return ue.multiply(Li),ue.multiply(Mi),ue.multiply(de),ue.multiply(xe),{center:j,halfSizes:et,rotation:Z,transformation:ue}}function On(l,s,t){const e=[l[0]-s[0],l[1]-s[1],l[2]-s[2]];return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]>0}class di{static isTransparent(s){return s.transparent&&s.opacity<1}}const K=class K{static create(){const s=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return`${K._lut[s&255]+K._lut[s>>8&255]+K._lut[s>>16&255]+K._lut[s>>24&255]}-${K._lut[t&255]}${K._lut[t>>8&255]}-${K._lut[t>>16&15|64]}${K._lut[t>>24&255]}-${K._lut[e&63|128]}${K._lut[e>>8&255]}-${K._lut[e>>16&255]}${K._lut[e>>24&255]}${K._lut[i&255]}${K._lut[i>>8&255]}${K._lut[i>>16&255]}${K._lut[i>>24&255]}`.toLowerCase()}static validate(s){if(!K._pattern.test(s))throw new Error(`${s} is not a valid UUID v4.
|
|
1
|
+
"use strict";var Zn=Object.defineProperty;var Qn=(c,e,t)=>e in c?Zn(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t;var I=(c,e,t)=>(Qn(c,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("three"),In=require("@thatopen/fragments"),jn=require("web-ifc");function Oi(c){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>c[t]})}}return e.default=c,Object.freeze(e)}const S=Oi(C),Dt=Oi(In),b=Oi(jn),fn=0,qn=1,Kn=2,Mi=2,vs=1.25,wi=1,rs=6*4+4+4,ys=65535,$n=Math.pow(2,-24),Bs=Symbol("SKIP_GENERATION");function Jn(c){return c.index?c.index.count:c.attributes.position.count}function he(c){return Jn(c)/3}function to(c,e=ArrayBuffer){return c>65535?new Uint32Array(new e(4*c)):new Uint16Array(new e(2*c))}function eo(c,e){if(!c.index){const t=c.attributes.position.count,s=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=to(t,s);c.setIndex(new C.BufferAttribute(i,1));for(let o=0;o<t;o++)i[o]=o}}function pn(c){const e=he(c),t=c.drawRange,s=t.start/3,i=(t.start+t.count)/3,o=Math.max(0,s),n=Math.min(e,i)-o;return[{offset:Math.floor(o),count:Math.floor(n)}]}function Cn(c){if(!c.groups||!c.groups.length)return pn(c);const e=[],t=new Set,s=c.drawRange,i=s.start/3,o=(s.start+s.count)/3;for(const r of c.groups){const a=r.start/3,l=(r.start+r.count)/3;t.add(Math.max(i,a)),t.add(Math.min(o,l))}const n=Array.from(t.values()).sort((r,a)=>r-a);for(let r=0;r<n.length-1;r++){const a=n[r],l=n[r+1];e.push({offset:Math.floor(a),count:Math.floor(l-a)})}return e}function so(c){if(c.groups.length===0)return!1;const e=he(c),t=Cn(c).sort((o,n)=>o.offset-n.offset),s=t[t.length-1];s.count=Math.min(e-s.offset,s.count);let i=0;return t.forEach(({count:o})=>i+=o),e!==i}function q(c,e,t){return t.min.x=e[c],t.min.y=e[c+1],t.min.z=e[c+2],t.max.x=e[c+3],t.max.y=e[c+4],t.max.z=e[c+5],t}function io(c){c[0]=c[1]=c[2]=1/0,c[3]=c[4]=c[5]=-1/0}function Di(c){let e=-1,t=-1/0;for(let s=0;s<3;s++){const i=c[s+3]-c[s];i>t&&(t=i,e=s)}return e}function Ui(c,e){e.set(c)}function xi(c,e,t){let s,i;for(let o=0;o<3;o++){const n=o+3;s=c[o],i=e[o],t[o]=s<i?s:i,s=c[n],i=e[n],t[n]=s>i?s:i}}function ve(c,e,t){for(let s=0;s<3;s++){const i=e[c+2*s],o=e[c+2*s+1],n=i-o,r=i+o;n<t[s]&&(t[s]=n),r>t[s+3]&&(t[s+3]=r)}}function ue(c){const e=c[3]-c[0],t=c[4]-c[1],s=c[5]-c[2];return 2*(e*t+t*s+s*e)}function Vs(c,e,t,s,i=null){let o=1/0,n=1/0,r=1/0,a=-1/0,l=-1/0,E=-1/0,d=1/0,h=1/0,u=1/0,p=-1/0,F=-1/0,R=-1/0;const T=i!==null;for(let A=e*6,O=(e+t)*6;A<O;A+=6){const f=c[A+0],m=c[A+1],g=f-m,_=f+m;g<o&&(o=g),_>a&&(a=_),T&&f<d&&(d=f),T&&f>p&&(p=f);const N=c[A+2],y=c[A+3],L=N-y,w=N+y;L<n&&(n=L),w>l&&(l=w),T&&N<h&&(h=N),T&&N>F&&(F=N);const M=c[A+4],U=c[A+5],x=M-U,v=M+U;x<r&&(r=x),v>E&&(E=v),T&&M<u&&(u=M),T&&M>R&&(R=M)}s[0]=o,s[1]=n,s[2]=r,s[3]=a,s[4]=l,s[5]=E,T&&(i[0]=d,i[1]=h,i[2]=u,i[3]=p,i[4]=F,i[5]=R)}function no(c,e,t,s){let i=1/0,o=1/0,n=1/0,r=-1/0,a=-1/0,l=-1/0;for(let E=e*6,d=(e+t)*6;E<d;E+=6){const h=c[E+0];h<i&&(i=h),h>r&&(r=h);const u=c[E+2];u<o&&(o=u),u>a&&(a=u);const p=c[E+4];p<n&&(n=p),p>l&&(l=p)}s[0]=i,s[1]=o,s[2]=n,s[3]=r,s[4]=a,s[5]=l}function oo(c,e){io(e);const t=c.attributes.position,s=c.index?c.index.array:null,i=he(c),o=new Float32Array(i*6),n=t.normalized,r=t.array,a=t.offset||0;let l=3;t.isInterleavedBufferAttribute&&(l=t.data.stride);const E=["getX","getY","getZ"];for(let d=0;d<i;d++){const h=d*3,u=d*6;let p=h+0,F=h+1,R=h+2;s&&(p=s[p],F=s[F],R=s[R]),n||(p=p*l+a,F=F*l+a,R=R*l+a);for(let T=0;T<3;T++){let A,O,f;n?(A=t[E[T]](p),O=t[E[T]](F),f=t[E[T]](R)):(A=r[p+T],O=r[F+T],f=r[R+T]);let m=A;O<m&&(m=O),f<m&&(m=f);let g=A;O>g&&(g=O),f>g&&(g=f);const _=(g-m)/2,N=T*2;o[u+N+0]=m+_,o[u+N+1]=_+(Math.abs(m)+_)*$n,m<e[T]&&(e[T]=m),g>e[T+3]&&(e[T+3]=g)}}return o}const gt=32,ro=(c,e)=>c.candidate-e.candidate,Nt=new Array(gt).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),Be=new Float32Array(6);function ao(c,e,t,s,i,o){let n=-1,r=0;if(o===fn)n=Di(e),n!==-1&&(r=(e[n]+e[n+3])/2);else if(o===qn)n=Di(c),n!==-1&&(r=co(t,s,i,n));else if(o===Kn){const a=ue(c);let l=vs*i;const E=s*6,d=(s+i)*6;for(let h=0;h<3;h++){const u=e[h],R=(e[h+3]-u)/gt;if(i<gt/4){const T=[...Nt];T.length=i;let A=0;for(let f=E;f<d;f+=6,A++){const m=T[A];m.candidate=t[f+2*h],m.count=0;const{bounds:g,leftCacheBounds:_,rightCacheBounds:N}=m;for(let y=0;y<3;y++)N[y]=1/0,N[y+3]=-1/0,_[y]=1/0,_[y+3]=-1/0,g[y]=1/0,g[y+3]=-1/0;ve(f,t,g)}T.sort(ro);let O=i;for(let f=0;f<O;f++){const m=T[f];for(;f+1<O&&T[f+1].candidate===m.candidate;)T.splice(f+1,1),O--}for(let f=E;f<d;f+=6){const m=t[f+2*h];for(let g=0;g<O;g++){const _=T[g];m>=_.candidate?ve(f,t,_.rightCacheBounds):(ve(f,t,_.leftCacheBounds),_.count++)}}for(let f=0;f<O;f++){const m=T[f],g=m.count,_=i-m.count,N=m.leftCacheBounds,y=m.rightCacheBounds;let L=0;g!==0&&(L=ue(N)/a);let w=0;_!==0&&(w=ue(y)/a);const M=wi+vs*(L*g+w*_);M<l&&(n=h,l=M,r=m.candidate)}}else{for(let O=0;O<gt;O++){const f=Nt[O];f.count=0,f.candidate=u+R+O*R;const m=f.bounds;for(let g=0;g<3;g++)m[g]=1/0,m[g+3]=-1/0}for(let O=E;O<d;O+=6){let g=~~((t[O+2*h]-u)/R);g>=gt&&(g=gt-1);const _=Nt[g];_.count++,ve(O,t,_.bounds)}const T=Nt[gt-1];Ui(T.bounds,T.rightCacheBounds);for(let O=gt-2;O>=0;O--){const f=Nt[O],m=Nt[O+1];xi(f.bounds,m.rightCacheBounds,f.rightCacheBounds)}let A=0;for(let O=0;O<gt-1;O++){const f=Nt[O],m=f.count,g=f.bounds,N=Nt[O+1].rightCacheBounds;m!==0&&(A===0?Ui(g,Be):xi(g,Be,Be)),A+=m;let y=0,L=0;A!==0&&(y=ue(Be)/a);const w=i-A;w!==0&&(L=ue(N)/a);const M=wi+vs*(y*A+L*w);M<l&&(n=h,l=M,r=f.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${o} used.`);return{axis:n,pos:r}}function co(c,e,t,s){let i=0;for(let o=e,n=e+t;o<n;o++)i+=c[o*6+s*2];return i/t}class Ve{constructor(){}}function lo(c,e,t,s,i,o){let n=s,r=s+i-1;const a=o.pos,l=o.axis*2;for(;;){for(;n<=r&&t[n*6+l]<a;)n++;for(;n<=r&&t[r*6+l]>=a;)r--;if(n<r){for(let E=0;E<3;E++){let d=e[n*3+E];e[n*3+E]=e[r*3+E],e[r*3+E]=d}for(let E=0;E<6;E++){let d=t[n*6+E];t[n*6+E]=t[r*6+E],t[r*6+E]=d}n++,r--}else return n}}function ho(c,e,t,s,i,o){let n=s,r=s+i-1;const a=o.pos,l=o.axis*2;for(;;){for(;n<=r&&t[n*6+l]<a;)n++;for(;n<=r&&t[r*6+l]>=a;)r--;if(n<r){let E=c[n];c[n]=c[r],c[r]=E;for(let d=0;d<6;d++){let h=t[n*6+d];t[n*6+d]=t[r*6+d],t[r*6+d]=h}n++,r--}else return n}}function Eo(c,e){const t=(c.index?c.index.count:c.attributes.position.count)/3,s=t>2**16,i=s?4:2,o=e?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),n=s?new Uint32Array(o):new Uint16Array(o);for(let r=0,a=n.length;r<a;r++)n[r]=r;return n}function uo(c,e){const t=c.geometry,s=t.index?t.index.array:null,i=e.maxDepth,o=e.verbose,n=e.maxLeafTris,r=e.strategy,a=e.onProgress,l=he(t),E=c._indirectBuffer;let d=!1;const h=new Float32Array(6),u=new Float32Array(6),p=oo(t,h),F=e.indirect?ho:lo,R=[],T=e.indirect?pn(t):Cn(t);if(T.length===1){const f=T[0],m=new Ve;m.boundingData=h,no(p,f.offset,f.count,u),O(m,f.offset,f.count,u),R.push(m)}else for(let f of T){const m=new Ve;m.boundingData=new Float32Array(6),Vs(p,f.offset,f.count,m.boundingData,u),O(m,f.offset,f.count,u),R.push(m)}return R;function A(f){a&&a(f/l)}function O(f,m,g,_=null,N=0){if(!d&&N>=i&&(d=!0,o&&(console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),g<=n||N>=i)return A(m+g),f.offset=m,f.count=g,f;const y=ao(f.boundingData,_,p,m,g,r);if(y.axis===-1)return A(m+g),f.offset=m,f.count=g,f;const L=F(E,s,p,m,g,y);if(L===m||L===m+g)A(m+g),f.offset=m,f.count=g;else{f.splitAxis=y.axis;const w=new Ve,M=m,U=L-m;f.left=w,w.boundingData=new Float32Array(6),Vs(p,M,U,w.boundingData,u),O(w,M,U,u,N+1);const x=new Ve,v=L,z=g-U;f.right=x,x.boundingData=new Float32Array(6),Vs(p,v,z,x.boundingData,u),O(x,v,z,u,N+1)}return f}}function Io(c,e){const t=c.geometry;e.indirect&&(c._indirectBuffer=Eo(t,e.useSharedArrayBuffer),so(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.')),c._indirectBuffer||eo(t,e);const s=uo(c,e);let i,o,n;const r=[],a=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let d=0;d<s.length;d++){const h=s[d];let u=l(h);const p=new a(rs*u);i=new Float32Array(p),o=new Uint32Array(p),n=new Uint16Array(p),E(0,h),r.push(p)}c._roots=r;return;function l(d){return d.count?1:1+l(d.left)+l(d.right)}function E(d,h){const u=d/4,p=d/2,F=!!h.count,R=h.boundingData;for(let T=0;T<6;T++)i[u+T]=R[T];if(F){const T=h.offset,A=h.count;return o[u+6]=T,n[p+14]=A,n[p+15]=ys,d+rs}else{const T=h.left,A=h.right,O=h.splitAxis;let f;if(f=E(d+rs,T),f/4>Math.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return o[u+6]=f/4,f=E(f,A),o[u+7]=O,f}}}class St{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let s=1/0,i=-1/0;for(let o=0,n=e.length;o<n;o++){const a=e[o][t];s=a<s?a:s,i=a>i?a:i}this.min=s,this.max=i}setFromPoints(e,t){let s=1/0,i=-1/0;for(let o=0,n=t.length;o<n;o++){const r=t[o],a=e.dot(r);s=a<s?a:s,i=a>i?a:i}this.min=s,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}St.prototype.setFromBox=function(){const c=new C.Vector3;return function(t,s){const i=s.min,o=s.max;let n=1/0,r=-1/0;for(let a=0;a<=1;a++)for(let l=0;l<=1;l++)for(let E=0;E<=1;E++){c.x=i.x*a+o.x*(1-a),c.y=i.y*l+o.y*(1-l),c.z=i.z*E+o.z*(1-E);const d=t.dot(c);n=Math.min(d,n),r=Math.max(d,r)}this.min=n,this.max=r}}();const fo=function(){const c=new C.Vector3,e=new C.Vector3,t=new C.Vector3;return function(i,o,n){const r=i.start,a=c,l=o.start,E=e;t.subVectors(r,l),c.subVectors(i.end,i.start),e.subVectors(o.end,o.start);const d=t.dot(E),h=E.dot(a),u=E.dot(E),p=t.dot(a),R=a.dot(a)*u-h*h;let T,A;R!==0?T=(d*h-p*u)/R:T=0,A=(d+T*h)/u,n.x=T,n.y=A}}(),gi=function(){const c=new C.Vector2,e=new C.Vector3,t=new C.Vector3;return function(i,o,n,r){fo(i,o,c);let a=c.x,l=c.y;if(a>=0&&a<=1&&l>=0&&l<=1){i.at(a,n),o.at(l,r);return}else if(a>=0&&a<=1){l<0?o.at(0,r):o.at(1,r),i.closestPointToPoint(r,!0,n);return}else if(l>=0&&l<=1){a<0?i.at(0,n):i.at(1,n),o.closestPointToPoint(n,!0,r);return}else{let E;a<0?E=i.start:E=i.end;let d;l<0?d=o.start:d=o.end;const h=e,u=t;if(i.closestPointToPoint(d,!0,e),o.closestPointToPoint(E,!0,t),h.distanceToSquared(d)<=u.distanceToSquared(E)){n.copy(h),r.copy(d);return}else{n.copy(E),r.copy(u);return}}}}(),po=function(){const c=new C.Vector3,e=new C.Vector3,t=new C.Plane,s=new C.Line3;return function(o,n){const{radius:r,center:a}=o,{a:l,b:E,c:d}=n;if(s.start=l,s.end=E,s.closestPointToPoint(a,!0,c).distanceTo(a)<=r||(s.start=l,s.end=d,s.closestPointToPoint(a,!0,c).distanceTo(a)<=r)||(s.start=E,s.end=d,s.closestPointToPoint(a,!0,c).distanceTo(a)<=r))return!0;const F=n.getPlane(t);if(Math.abs(F.distanceToPoint(a))<=r){const T=F.projectPoint(a,e);if(n.containsPoint(T))return!0}return!1}}(),Co=1e-15;function Ys(c){return Math.abs(c)<Co}class mt extends C.Triangle{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new C.Vector3),this.satBounds=new Array(4).fill().map(()=>new St),this.points=[this.a,this.b,this.c],this.sphere=new C.Sphere,this.plane=new C.Plane,this.needsUpdate=!0}intersectsSphere(e){return po(e,this)}update(){const e=this.a,t=this.b,s=this.c,i=this.points,o=this.satAxes,n=this.satBounds,r=o[0],a=n[0];this.getNormal(r),a.setFromPoints(r,i);const l=o[1],E=n[1];l.subVectors(e,t),E.setFromPoints(l,i);const d=o[2],h=n[2];d.subVectors(t,s),h.setFromPoints(d,i);const u=o[3],p=n[3];u.subVectors(s,e),p.setFromPoints(u,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(r,e),this.needsUpdate=!1}}mt.prototype.closestPointToSegment=function(){const c=new C.Vector3,e=new C.Vector3,t=new C.Line3;return function(i,o=null,n=null){const{start:r,end:a}=i,l=this.points;let E,d=1/0;for(let h=0;h<3;h++){const u=(h+1)%3;t.start.copy(l[h]),t.end.copy(l[u]),gi(t,i,c,e),E=c.distanceToSquared(e),E<d&&(d=E,o&&o.copy(c),n&&n.copy(e))}return this.closestPointToPoint(r,c),E=r.distanceToSquared(c),E<d&&(d=E,o&&o.copy(c),n&&n.copy(r)),this.closestPointToPoint(a,c),E=a.distanceToSquared(c),E<d&&(d=E,o&&o.copy(c),n&&n.copy(a)),Math.sqrt(d)}}();mt.prototype.intersectsTriangle=function(){const c=new mt,e=new Array(3),t=new Array(3),s=new St,i=new St,o=new C.Vector3,n=new C.Vector3,r=new C.Vector3,a=new C.Vector3,l=new C.Vector3,E=new C.Line3,d=new C.Line3,h=new C.Line3,u=new C.Vector3;function p(F,R,T){const A=F.points;let O=0,f=-1;for(let m=0;m<3;m++){const{start:g,end:_}=E;g.copy(A[m]),_.copy(A[(m+1)%3]),E.delta(n);const N=Ys(R.distanceToPoint(g));if(Ys(R.normal.dot(n))&&N){T.copy(E),O=2;break}const y=R.intersectLine(E,u);if(!y&&N&&u.copy(g),(y||N)&&!Ys(u.distanceTo(_))){if(O<=1)(O===1?T.start:T.end).copy(u),N&&(f=O);else if(O>=2){(f===1?T.start:T.end).copy(u),O=2;break}if(O++,O===2&&f===-1)break}}return O}return function(R,T=null,A=!1){this.needsUpdate&&this.update(),R.isExtendedTriangle?R.needsUpdate&&R.update():(c.copy(R),c.update(),R=c);const O=this.plane,f=R.plane;if(Math.abs(O.normal.dot(f.normal))>1-1e-10){const m=this.satBounds,g=this.satAxes;t[0]=R.a,t[1]=R.b,t[2]=R.c;for(let y=0;y<4;y++){const L=m[y],w=g[y];if(s.setFromPoints(w,t),L.isSeparated(s))return!1}const _=R.satBounds,N=R.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let y=0;y<4;y++){const L=_[y],w=N[y];if(s.setFromPoints(w,e),L.isSeparated(s))return!1}for(let y=0;y<4;y++){const L=g[y];for(let w=0;w<4;w++){const M=N[w];if(o.crossVectors(L,M),s.setFromPoints(o,e),i.setFromPoints(o,t),s.isSeparated(i))return!1}}return T&&(A||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),T.start.set(0,0,0),T.end.set(0,0,0)),!0}else{const m=p(this,f,d);if(m===1&&R.containsPoint(d.end))return T&&(T.start.copy(d.end),T.end.copy(d.end)),!0;if(m!==2)return!1;const g=p(R,O,h);if(g===1&&this.containsPoint(h.end))return T&&(T.start.copy(h.end),T.end.copy(h.end)),!0;if(g!==2)return!1;if(d.delta(r),h.delta(a),r.dot(a)<0){let U=h.start;h.start=h.end,h.end=U}const _=d.start.dot(r),N=d.end.dot(r),y=h.start.dot(r),L=h.end.dot(r),w=N<y,M=_<L;return _!==L&&y!==N&&w===M?!1:(T&&(l.subVectors(d.start,h.start),l.dot(r)>0?T.start.copy(d.start):T.start.copy(h.start),l.subVectors(d.end,h.end),l.dot(r)<0?T.end.copy(d.end):T.end.copy(h.end)),!0)}}}();mt.prototype.distanceToPoint=function(){const c=new C.Vector3;return function(t){return this.closestPointToPoint(t,c),t.distanceTo(c)}}();mt.prototype.distanceToTriangle=function(){const c=new C.Vector3,e=new C.Vector3,t=["a","b","c"],s=new C.Line3,i=new C.Line3;return function(n,r=null,a=null){const l=r||a?s:null;if(this.intersectsTriangle(n,l))return(r||a)&&(r&&l.getCenter(r),a&&l.getCenter(a)),0;let E=1/0;for(let d=0;d<3;d++){let h;const u=t[d],p=n[u];this.closestPointToPoint(p,c),h=p.distanceToSquared(c),h<E&&(E=h,r&&r.copy(c),a&&a.copy(p));const F=this[u];n.closestPointToPoint(F,c),h=F.distanceToSquared(c),h<E&&(E=h,r&&r.copy(F),a&&a.copy(c))}for(let d=0;d<3;d++){const h=t[d],u=t[(d+1)%3];s.set(this[h],this[u]);for(let p=0;p<3;p++){const F=t[p],R=t[(p+1)%3];i.set(n[F],n[R]),gi(s,i,c,e);const T=c.distanceToSquared(e);T<E&&(E=T,r&&r.copy(c),a&&a.copy(e))}}return Math.sqrt(E)}}();class ot{constructor(e,t,s){this.isOrientedBox=!0,this.min=new C.Vector3,this.max=new C.Vector3,this.matrix=new C.Matrix4,this.invMatrix=new C.Matrix4,this.points=new Array(8).fill().map(()=>new C.Vector3),this.satAxes=new Array(3).fill().map(()=>new C.Vector3),this.satBounds=new Array(3).fill().map(()=>new St),this.alignedSatBounds=new Array(3).fill().map(()=>new St),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}}ot.prototype.update=function(){return function(){const e=this.matrix,t=this.min,s=this.max,i=this.points;for(let l=0;l<=1;l++)for(let E=0;E<=1;E++)for(let d=0;d<=1;d++){const h=1*l|2*E|4*d,u=i[h];u.x=l?s.x:t.x,u.y=E?s.y:t.y,u.z=d?s.z:t.z,u.applyMatrix4(e)}const o=this.satBounds,n=this.satAxes,r=i[0];for(let l=0;l<3;l++){const E=n[l],d=o[l],h=1<<l,u=i[h];E.subVectors(r,u),d.setFromPoints(E,i)}const a=this.alignedSatBounds;a[0].setFromPointsField(i,"x"),a[1].setFromPointsField(i,"y"),a[2].setFromPointsField(i,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}();ot.prototype.intersectsBox=function(){const c=new St;return function(t){this.needsUpdate&&this.update();const s=t.min,i=t.max,o=this.satBounds,n=this.satAxes,r=this.alignedSatBounds;if(c.min=s.x,c.max=i.x,r[0].isSeparated(c)||(c.min=s.y,c.max=i.y,r[1].isSeparated(c))||(c.min=s.z,c.max=i.z,r[2].isSeparated(c)))return!1;for(let a=0;a<3;a++){const l=n[a],E=o[a];if(c.setFromBox(l,t),E.isSeparated(c))return!1}return!0}}();ot.prototype.intersectsTriangle=function(){const c=new mt,e=new Array(3),t=new St,s=new St,i=new C.Vector3;return function(n){this.needsUpdate&&this.update(),n.isExtendedTriangle?n.needsUpdate&&n.update():(c.copy(n),c.update(),n=c);const r=this.satBounds,a=this.satAxes;e[0]=n.a,e[1]=n.b,e[2]=n.c;for(let h=0;h<3;h++){const u=r[h],p=a[h];if(t.setFromPoints(p,e),u.isSeparated(t))return!1}const l=n.satBounds,E=n.satAxes,d=this.points;for(let h=0;h<3;h++){const u=l[h],p=E[h];if(t.setFromPoints(p,d),u.isSeparated(t))return!1}for(let h=0;h<3;h++){const u=a[h];for(let p=0;p<4;p++){const F=E[p];if(i.crossVectors(u,F),t.setFromPoints(i,e),s.setFromPoints(i,d),t.isSeparated(s))return!1}}return!0}}();ot.prototype.closestPointToPoint=function(){return function(e,t){return this.needsUpdate&&this.update(),t.copy(e).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),t}}();ot.prototype.distanceToPoint=function(){const c=new C.Vector3;return function(t){return this.closestPointToPoint(t,c),t.distanceTo(c)}}();ot.prototype.distanceToBox=function(){const c=["x","y","z"],e=new Array(12).fill().map(()=>new C.Line3),t=new Array(12).fill().map(()=>new C.Line3),s=new C.Vector3,i=new C.Vector3;return function(n,r=0,a=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(n))return(a||l)&&(n.getCenter(i),this.closestPointToPoint(i,s),n.closestPointToPoint(s,i),a&&a.copy(s),l&&l.copy(i)),0;const E=r*r,d=n.min,h=n.max,u=this.points;let p=1/0;for(let R=0;R<8;R++){const T=u[R];i.copy(T).clamp(d,h);const A=T.distanceToSquared(i);if(A<p&&(p=A,a&&a.copy(T),l&&l.copy(i),A<E))return Math.sqrt(A)}let F=0;for(let R=0;R<3;R++)for(let T=0;T<=1;T++)for(let A=0;A<=1;A++){const O=(R+1)%3,f=(R+2)%3,m=T<<O|A<<f,g=1<<R|T<<O|A<<f,_=u[m],N=u[g];e[F].set(_,N);const L=c[R],w=c[O],M=c[f],U=t[F],x=U.start,v=U.end;x[L]=d[L],x[w]=T?d[w]:h[w],x[M]=A?d[M]:h[w],v[L]=h[L],v[w]=T?d[w]:h[w],v[M]=A?d[M]:h[w],F++}for(let R=0;R<=1;R++)for(let T=0;T<=1;T++)for(let A=0;A<=1;A++){i.x=R?h.x:d.x,i.y=T?h.y:d.y,i.z=A?h.z:d.z,this.closestPointToPoint(i,s);const O=i.distanceToSquared(s);if(O<p&&(p=O,a&&a.copy(s),l&&l.copy(i),O<E))return Math.sqrt(O)}for(let R=0;R<12;R++){const T=e[R];for(let A=0;A<12;A++){const O=t[A];gi(T,O,s,i);const f=s.distanceToSquared(i);if(f<p&&(p=f,a&&a.copy(s),l&&l.copy(i),f<E))return Math.sqrt(f)}}return Math.sqrt(p)}}();class Si{constructor(e){this._getNewPrimitive=e,this._primitives=[]}getPrimitive(){const e=this._primitives;return e.length===0?this._getNewPrimitive():e.pop()}releasePrimitive(e){this._primitives.push(e)}}class To extends Si{constructor(){super(()=>new mt)}}const Et=new To;function at(c,e){return e[c+15]===65535}function lt(c,e){return e[c+6]}function dt(c,e){return e[c+14]}function ut(c){return c+8}function It(c,e){return e[c+6]}function Tn(c,e){return e[c+7]}class mo{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 X=new mo;let wt,oe;const Wt=[],Ye=new Si(()=>new C.Box3);function Ro(c,e,t,s,i,o){wt=Ye.getPrimitive(),oe=Ye.getPrimitive(),Wt.push(wt,oe),X.setBuffer(c._roots[e]);const n=ni(0,c.geometry,t,s,i,o);X.clearBuffer(),Ye.releasePrimitive(wt),Ye.releasePrimitive(oe),Wt.pop(),Wt.pop();const r=Wt.length;return r>0&&(oe=Wt[r-1],wt=Wt[r-2]),n}function ni(c,e,t,s,i=null,o=0,n=0){const{float32Array:r,uint16Array:a,uint32Array:l}=X;let E=c*2;if(at(E,a)){const h=lt(c,l),u=dt(E,a);return q(c,r,wt),s(h,u,!1,n,o+c,wt)}else{let L=function(M){const{uint16Array:U,uint32Array:x}=X;let v=M*2;for(;!at(v,U);)M=ut(M),v=M*2;return lt(M,x)},w=function(M){const{uint16Array:U,uint32Array:x}=X;let v=M*2;for(;!at(v,U);)M=It(M,x),v=M*2;return lt(M,x)+dt(v,U)};const h=ut(c),u=It(c,l);let p=h,F=u,R,T,A,O;if(i&&(A=wt,O=oe,q(p,r,A),q(F,r,O),R=i(A),T=i(O),T<R)){p=u,F=h;const M=R;R=T,T=M,A=O}A||(A=wt,q(p,r,A));const f=at(p*2,a),m=t(A,f,R,n+1,o+p);let g;if(m===Mi){const M=L(p),x=w(p)-M;g=s(M,x,!0,n+1,o+p,A)}else g=m&&ni(p,e,t,s,i,o,n+1);if(g)return!0;O=oe,q(F,r,O);const _=at(F*2,a),N=t(O,_,T,n+1,o+F);let y;if(N===Mi){const M=L(F),x=w(F)-M;y=s(M,x,!0,n+1,o+F,O)}else y=N&&ni(F,e,t,s,i,o,n+1);return!!y}}const Ie=new C.Vector3,Gs=new C.Vector3;function Ao(c,e,t={},s=0,i=1/0){const o=s*s,n=i*i;let r=1/0,a=null;if(c.shapecast({boundsTraverseOrder:E=>(Ie.copy(e).clamp(E.min,E.max),Ie.distanceToSquared(e)),intersectsBounds:(E,d,h)=>h<r&&h<n,intersectsTriangle:(E,d)=>{E.closestPointToPoint(e,Ie);const h=e.distanceToSquared(Ie);return h<r&&(Gs.copy(Ie),r=h,a=d),h<o}}),r===1/0)return null;const l=Math.sqrt(r);return t.point?t.point.copy(Gs):t.point=Gs.clone(),t.distance=l,t.faceIndex=a,t}const Xt=new C.Vector3,Zt=new C.Vector3,Qt=new C.Vector3,Ge=new C.Vector2,ze=new C.Vector2,He=new C.Vector2,bi=new C.Vector3,vi=new C.Vector3,Bi=new C.Vector3,ke=new C.Vector3;function Fo(c,e,t,s,i,o){let n;return o===C.BackSide?n=c.intersectTriangle(s,t,e,!0,i):n=c.intersectTriangle(e,t,s,o!==C.DoubleSide,i),n===null?null:{distance:c.origin.distanceTo(i),point:i.clone()}}function Oo(c,e,t,s,i,o,n,r,a){Xt.fromBufferAttribute(e,o),Zt.fromBufferAttribute(e,n),Qt.fromBufferAttribute(e,r);const l=Fo(c,Xt,Zt,Qt,ke,a);if(l){s&&(Ge.fromBufferAttribute(s,o),ze.fromBufferAttribute(s,n),He.fromBufferAttribute(s,r),l.uv=C.Triangle.getInterpolation(ke,Xt,Zt,Qt,Ge,ze,He,new C.Vector2)),i&&(Ge.fromBufferAttribute(i,o),ze.fromBufferAttribute(i,n),He.fromBufferAttribute(i,r),l.uv1=C.Triangle.getInterpolation(ke,Xt,Zt,Qt,Ge,ze,He,new C.Vector2)),t&&(bi.fromBufferAttribute(t,o),vi.fromBufferAttribute(t,n),Bi.fromBufferAttribute(t,r),l.normal=C.Triangle.getInterpolation(ke,Xt,Zt,Qt,bi,vi,Bi,new C.Vector3),l.normal.dot(c.direction)>0&&l.normal.multiplyScalar(-1));const E={a:o,b:n,c:r,normal:new C.Vector3,materialIndex:0};C.Triangle.getNormal(Xt,Zt,Qt,E.normal),l.face=E,l.faceIndex=o}return l}function Ps(c,e,t,s,i){const o=s*3;let n=o+0,r=o+1,a=o+2;const l=c.index;c.index&&(n=l.getX(n),r=l.getX(r),a=l.getX(a));const{position:E,normal:d,uv:h,uv1:u}=c.attributes,p=Oo(t,E,d,h,u,n,r,a,e);return p?(p.faceIndex=s,i&&i.push(p),p):null}function tt(c,e,t,s){const i=c.a,o=c.b,n=c.c;let r=e,a=e+1,l=e+2;t&&(r=t.getX(r),a=t.getX(a),l=t.getX(l)),i.x=s.getX(r),i.y=s.getY(r),i.z=s.getZ(r),o.x=s.getX(a),o.y=s.getY(a),o.z=s.getZ(a),n.x=s.getX(l),n.y=s.getY(l),n.z=s.getZ(l)}function go(c,e,t,s,i,o){const{geometry:n,_indirectBuffer:r}=c;for(let a=s,l=s+i;a<l;a++)Ps(n,e,t,a,o)}function So(c,e,t,s,i){const{geometry:o,_indirectBuffer:n}=c;let r=1/0,a=null;for(let l=s,E=s+i;l<E;l++){let d;d=Ps(o,e,t,l),d&&d.distance<r&&(a=d,r=d.distance)}return a}function _o(c,e,t,s,i,o,n){const{geometry:r}=t,{index:a}=r,l=r.attributes.position;for(let E=c,d=e+c;E<d;E++){let h;if(h=E,tt(n,h*3,a,l),n.needsUpdate=!0,s(n,h,i,o))return!0}return!1}function No(c,e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=c.geometry,s=t.index?t.index.array:null,i=t.attributes.position;let o,n,r,a,l=0;const E=c._roots;for(let h=0,u=E.length;h<u;h++)o=E[h],n=new Uint32Array(o),r=new Uint16Array(o),a=new Float32Array(o),d(0,l),l+=o.byteLength;function d(h,u,p=!1){const F=h*2;if(r[F+15]===ys){const T=n[h+6],A=r[F+14];let O=1/0,f=1/0,m=1/0,g=-1/0,_=-1/0,N=-1/0;for(let y=3*T,L=3*(T+A);y<L;y++){let w=s[y];const M=i.getX(w),U=i.getY(w),x=i.getZ(w);M<O&&(O=M),M>g&&(g=M),U<f&&(f=U),U>_&&(_=U),x<m&&(m=x),x>N&&(N=x)}return a[h+0]!==O||a[h+1]!==f||a[h+2]!==m||a[h+3]!==g||a[h+4]!==_||a[h+5]!==N?(a[h+0]=O,a[h+1]=f,a[h+2]=m,a[h+3]=g,a[h+4]=_,a[h+5]=N,!0):!1}else{const T=h+8,A=n[h+6],O=T+u,f=A+u;let m=p,g=!1,_=!1;e?m||(g=e.has(O),_=e.has(f),m=!g&&!_):(g=!0,_=!0);const N=m||g,y=m||_;let L=!1;N&&(L=d(T,u,m));let w=!1;y&&(w=d(A,u,m));const M=L||w;if(M)for(let U=0;U<3;U++){const x=T+U,v=A+U,z=a[x],j=a[x+3],et=a[v],Z=a[v+3];a[h+U]=z<et?z:et,a[h+U+3]=j>Z?j:Z}return M}}}const Vi=new C.Box3;function xt(c,e,t,s){return q(c,e,Vi),t.intersectBox(Vi,s)}function yo(c,e,t,s,i,o){const{geometry:n,_indirectBuffer:r}=c;for(let a=s,l=s+i;a<l;a++){let E=r?r[a]:a;Ps(n,e,t,E,o)}}function Po(c,e,t,s,i){const{geometry:o,_indirectBuffer:n}=c;let r=1/0,a=null;for(let l=s,E=s+i;l<E;l++){let d;d=Ps(o,e,t,n?n[l]:l),d&&d.distance<r&&(a=d,r=d.distance)}return a}function Lo(c,e,t,s,i,o,n){const{geometry:r}=t,{index:a}=r,l=r.attributes.position;for(let E=c,d=e+c;E<d;E++){let h;if(h=t.resolveTriangleIndex(E),tt(n,h*3,a,l),n.needsUpdate=!0,s(n,h,i,o))return!0}return!1}const Yi=new C.Vector3;function Mo(c,e,t,s,i){X.setBuffer(c._roots[e]),oi(0,c,t,s,i),X.clearBuffer()}function oi(c,e,t,s,i){const{float32Array:o,uint16Array:n,uint32Array:r}=X,a=c*2;if(at(a,n)){const E=lt(c,r),d=dt(a,n);go(e,t,s,E,d,i)}else{const E=ut(c);xt(E,o,s,Yi)&&oi(E,e,t,s,i);const d=It(c,r);xt(d,o,s,Yi)&&oi(d,e,t,s,i)}}const Gi=new C.Vector3,wo=["x","y","z"];function Do(c,e,t,s){X.setBuffer(c._roots[e]);const i=ri(0,c,t,s);return X.clearBuffer(),i}function ri(c,e,t,s){const{float32Array:i,uint16Array:o,uint32Array:n}=X;let r=c*2;if(at(r,o)){const l=lt(c,n),E=dt(r,o);return So(e,t,s,l,E)}else{const l=Tn(c,n),E=wo[l],h=s.direction[E]>=0;let u,p;h?(u=ut(c),p=It(c,n)):(u=It(c,n),p=ut(c));const R=xt(u,i,s,Gi)?ri(u,e,t,s):null;if(R){const O=R.point[E];if(h?O<=i[p+l]:O>=i[p+l+3])return R}const A=xt(p,i,s,Gi)?ri(p,e,t,s):null;return R&&A?R.distance<=A.distance?R:A:R||A||null}}const We=new C.Box3,jt=new mt,qt=new mt,fe=new C.Matrix4,zi=new ot,Xe=new ot;function Uo(c,e,t,s){X.setBuffer(c._roots[e]);const i=ai(0,c,t,s);return X.clearBuffer(),i}function ai(c,e,t,s,i=null){const{float32Array:o,uint16Array:n,uint32Array:r}=X;let a=c*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),zi.set(t.boundingBox.min,t.boundingBox.max,s),i=zi),at(a,n)){const E=e.geometry,d=E.index,h=E.attributes.position,u=t.index,p=t.attributes.position,F=lt(c,r),R=dt(a,n);if(fe.copy(s).invert(),t.boundsTree)return q(c,o,Xe),Xe.matrix.copy(fe),Xe.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:A=>Xe.intersectsBox(A),intersectsTriangle:A=>{A.a.applyMatrix4(s),A.b.applyMatrix4(s),A.c.applyMatrix4(s),A.needsUpdate=!0;for(let O=F*3,f=(R+F)*3;O<f;O+=3)if(tt(qt,O,d,h),qt.needsUpdate=!0,A.intersectsTriangle(qt))return!0;return!1}});for(let T=F*3,A=(R+F)*3;T<A;T+=3){tt(jt,T,d,h),jt.a.applyMatrix4(fe),jt.b.applyMatrix4(fe),jt.c.applyMatrix4(fe),jt.needsUpdate=!0;for(let O=0,f=u.count;O<f;O+=3)if(tt(qt,O,u,p),qt.needsUpdate=!0,jt.intersectsTriangle(qt))return!0}}else{const E=c+8,d=r[c+6];return q(E,o,We),!!(i.intersectsBox(We)&&ai(E,e,t,s,i)||(q(d,o,We),i.intersectsBox(We)&&ai(d,e,t,s,i)))}}const Ze=new C.Matrix4,zs=new ot,pe=new ot,xo=new C.Vector3,bo=new C.Vector3,vo=new C.Vector3,Bo=new C.Vector3;function Vo(c,e,t,s={},i={},o=0,n=1/0){e.boundingBox||e.computeBoundingBox(),zs.set(e.boundingBox.min,e.boundingBox.max,t),zs.needsUpdate=!0;const r=c.geometry,a=r.attributes.position,l=r.index,E=e.attributes.position,d=e.index,h=Et.getPrimitive(),u=Et.getPrimitive();let p=xo,F=bo,R=null,T=null;i&&(R=vo,T=Bo);let A=1/0,O=null,f=null;return Ze.copy(t).invert(),pe.matrix.copy(Ze),c.shapecast({boundsTraverseOrder:m=>zs.distanceToBox(m),intersectsBounds:(m,g,_)=>_<A&&_<n?(g&&(pe.min.copy(m.min),pe.max.copy(m.max),pe.needsUpdate=!0),!0):!1,intersectsRange:(m,g)=>{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:N=>pe.distanceToBox(N),intersectsBounds:(N,y,L)=>L<A&&L<n,intersectsRange:(N,y)=>{for(let L=N,w=N+y;L<w;L++){tt(u,3*L,d,E),u.a.applyMatrix4(t),u.b.applyMatrix4(t),u.c.applyMatrix4(t),u.needsUpdate=!0;for(let M=m,U=m+g;M<U;M++){tt(h,3*M,l,a),h.needsUpdate=!0;const x=h.distanceToTriangle(u,p,R);if(x<A&&(F.copy(p),T&&T.copy(R),A=x,O=M,f=L),x<o)return!0}}}});{const _=he(e);for(let N=0,y=_;N<y;N++){tt(u,3*N,d,E),u.a.applyMatrix4(t),u.b.applyMatrix4(t),u.c.applyMatrix4(t),u.needsUpdate=!0;for(let L=m,w=m+g;L<w;L++){tt(h,3*L,l,a),h.needsUpdate=!0;const M=h.distanceToTriangle(u,p,R);if(M<A&&(F.copy(p),T&&T.copy(R),A=M,O=L,f=N),M<o)return!0}}}}}),Et.releasePrimitive(h),Et.releasePrimitive(u),A===1/0?null:(s.point?s.point.copy(F):s.point=F.clone(),s.distance=A,s.faceIndex=O,i&&(i.point?i.point.copy(T):i.point=T.clone(),i.point.applyMatrix4(Ze),F.applyMatrix4(Ze),i.distance=F.sub(i.point).length(),i.faceIndex=f),s)}function Yo(c,e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=c.geometry,s=t.index?t.index.array:null,i=t.attributes.position;let o,n,r,a,l=0;const E=c._roots;for(let h=0,u=E.length;h<u;h++)o=E[h],n=new Uint32Array(o),r=new Uint16Array(o),a=new Float32Array(o),d(0,l),l+=o.byteLength;function d(h,u,p=!1){const F=h*2;if(r[F+15]===ys){const T=n[h+6],A=r[F+14];let O=1/0,f=1/0,m=1/0,g=-1/0,_=-1/0,N=-1/0;for(let y=T,L=T+A;y<L;y++){const w=3*c.resolveTriangleIndex(y);for(let M=0;M<3;M++){let U=w+M;U=s?s[U]:U;const x=i.getX(U),v=i.getY(U),z=i.getZ(U);x<O&&(O=x),x>g&&(g=x),v<f&&(f=v),v>_&&(_=v),z<m&&(m=z),z>N&&(N=z)}}return a[h+0]!==O||a[h+1]!==f||a[h+2]!==m||a[h+3]!==g||a[h+4]!==_||a[h+5]!==N?(a[h+0]=O,a[h+1]=f,a[h+2]=m,a[h+3]=g,a[h+4]=_,a[h+5]=N,!0):!1}else{const T=h+8,A=n[h+6],O=T+u,f=A+u;let m=p,g=!1,_=!1;e?m||(g=e.has(O),_=e.has(f),m=!g&&!_):(g=!0,_=!0);const N=m||g,y=m||_;let L=!1;N&&(L=d(T,u,m));let w=!1;y&&(w=d(A,u,m));const M=L||w;if(M)for(let U=0;U<3;U++){const x=T+U,v=A+U,z=a[x],j=a[x+3],et=a[v],Z=a[v+3];a[h+U]=z<et?z:et,a[h+U+3]=j>Z?j:Z}return M}}}const Hi=new C.Vector3;function Go(c,e,t,s,i){X.setBuffer(c._roots[e]),ci(0,c,t,s,i),X.clearBuffer()}function ci(c,e,t,s,i){const{float32Array:o,uint16Array:n,uint32Array:r}=X,a=c*2;if(at(a,n)){const E=lt(c,r),d=dt(a,n);yo(e,t,s,E,d,i)}else{const E=ut(c);xt(E,o,s,Hi)&&ci(E,e,t,s,i);const d=It(c,r);xt(d,o,s,Hi)&&ci(d,e,t,s,i)}}const ki=new C.Vector3,zo=["x","y","z"];function Ho(c,e,t,s){X.setBuffer(c._roots[e]);const i=li(0,c,t,s);return X.clearBuffer(),i}function li(c,e,t,s){const{float32Array:i,uint16Array:o,uint32Array:n}=X;let r=c*2;if(at(r,o)){const l=lt(c,n),E=dt(r,o);return Po(e,t,s,l,E)}else{const l=Tn(c,n),E=zo[l],h=s.direction[E]>=0;let u,p;h?(u=ut(c),p=It(c,n)):(u=It(c,n),p=ut(c));const R=xt(u,i,s,ki)?li(u,e,t,s):null;if(R){const O=R.point[E];if(h?O<=i[p+l]:O>=i[p+l+3])return R}const A=xt(p,i,s,ki)?li(p,e,t,s):null;return R&&A?R.distance<=A.distance?R:A:R||A||null}}const Qe=new C.Box3,Kt=new mt,$t=new mt,Ce=new C.Matrix4,Wi=new ot,je=new ot;function ko(c,e,t,s){X.setBuffer(c._roots[e]);const i=hi(0,c,t,s);return X.clearBuffer(),i}function hi(c,e,t,s,i=null){const{float32Array:o,uint16Array:n,uint32Array:r}=X;let a=c*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Wi.set(t.boundingBox.min,t.boundingBox.max,s),i=Wi),at(a,n)){const E=e.geometry,d=E.index,h=E.attributes.position,u=t.index,p=t.attributes.position,F=lt(c,r),R=dt(a,n);if(Ce.copy(s).invert(),t.boundsTree)return q(c,o,je),je.matrix.copy(Ce),je.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:A=>je.intersectsBox(A),intersectsTriangle:A=>{A.a.applyMatrix4(s),A.b.applyMatrix4(s),A.c.applyMatrix4(s),A.needsUpdate=!0;for(let O=F,f=R+F;O<f;O++)if(tt($t,3*e.resolveTriangleIndex(O),d,h),$t.needsUpdate=!0,A.intersectsTriangle($t))return!0;return!1}});for(let T=F,A=R+F;T<A;T++){const O=e.resolveTriangleIndex(T);tt(Kt,3*O,d,h),Kt.a.applyMatrix4(Ce),Kt.b.applyMatrix4(Ce),Kt.c.applyMatrix4(Ce),Kt.needsUpdate=!0;for(let f=0,m=u.count;f<m;f+=3)if(tt($t,f,u,p),$t.needsUpdate=!0,Kt.intersectsTriangle($t))return!0}}else{const E=c+8,d=r[c+6];return q(E,o,Qe),!!(i.intersectsBox(Qe)&&hi(E,e,t,s,i)||(q(d,o,Qe),i.intersectsBox(Qe)&&hi(d,e,t,s,i)))}}const qe=new C.Matrix4,Hs=new ot,Te=new ot,Wo=new C.Vector3,Xo=new C.Vector3,Zo=new C.Vector3,Qo=new C.Vector3;function jo(c,e,t,s={},i={},o=0,n=1/0){e.boundingBox||e.computeBoundingBox(),Hs.set(e.boundingBox.min,e.boundingBox.max,t),Hs.needsUpdate=!0;const r=c.geometry,a=r.attributes.position,l=r.index,E=e.attributes.position,d=e.index,h=Et.getPrimitive(),u=Et.getPrimitive();let p=Wo,F=Xo,R=null,T=null;i&&(R=Zo,T=Qo);let A=1/0,O=null,f=null;return qe.copy(t).invert(),Te.matrix.copy(qe),c.shapecast({boundsTraverseOrder:m=>Hs.distanceToBox(m),intersectsBounds:(m,g,_)=>_<A&&_<n?(g&&(Te.min.copy(m.min),Te.max.copy(m.max),Te.needsUpdate=!0),!0):!1,intersectsRange:(m,g)=>{if(e.boundsTree){const _=e.boundsTree;return _.shapecast({boundsTraverseOrder:N=>Te.distanceToBox(N),intersectsBounds:(N,y,L)=>L<A&&L<n,intersectsRange:(N,y)=>{for(let L=N,w=N+y;L<w;L++){const M=_.resolveTriangleIndex(L);tt(u,3*M,d,E),u.a.applyMatrix4(t),u.b.applyMatrix4(t),u.c.applyMatrix4(t),u.needsUpdate=!0;for(let U=m,x=m+g;U<x;U++){const v=c.resolveTriangleIndex(U);tt(h,3*v,l,a),h.needsUpdate=!0;const z=h.distanceToTriangle(u,p,R);if(z<A&&(F.copy(p),T&&T.copy(R),A=z,O=U,f=L),z<o)return!0}}}})}else{const _=he(e);for(let N=0,y=_;N<y;N++){tt(u,3*N,d,E),u.a.applyMatrix4(t),u.b.applyMatrix4(t),u.c.applyMatrix4(t),u.needsUpdate=!0;for(let L=m,w=m+g;L<w;L++){const M=c.resolveTriangleIndex(L);tt(h,3*M,l,a),h.needsUpdate=!0;const U=h.distanceToTriangle(u,p,R);if(U<A&&(F.copy(p),T&&T.copy(R),A=U,O=L,f=N),U<o)return!0}}}}}),Et.releasePrimitive(h),Et.releasePrimitive(u),A===1/0?null:(s.point?s.point.copy(F):s.point=F.clone(),s.distance=A,s.faceIndex=O,i&&(i.point?i.point.copy(T):i.point=T.clone(),i.point.applyMatrix4(qe),F.applyMatrix4(qe),i.distance=F.sub(i.point).length(),i.faceIndex=f),s)}function qo(){return typeof SharedArrayBuffer<"u"}const ye=new X.constructor,ls=new X.constructor,Lt=new Si(()=>new C.Box3),Jt=new C.Box3,te=new C.Box3,ks=new C.Box3,Ws=new C.Box3;let Xs=!1;function Ko(c,e,t,s){if(Xs)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");Xs=!0;const i=c._roots,o=e._roots;let n,r=0,a=0;const l=new C.Matrix4().copy(t).invert();for(let E=0,d=i.length;E<d;E++){ye.setBuffer(i[E]),a=0;const h=Lt.getPrimitive();q(0,ye.float32Array,h),h.applyMatrix4(l);for(let u=0,p=o.length;u<p&&(ls.setBuffer(o[E]),n=ft(0,0,t,l,s,r,a,0,0,h),ls.clearBuffer(),a+=o[u].length,!n);u++);if(Lt.releasePrimitive(h),ye.clearBuffer(),r+=i[E].length,n)break}return Xs=!1,n}function ft(c,e,t,s,i,o=0,n=0,r=0,a=0,l=null,E=!1){let d,h;E?(d=ls,h=ye):(d=ye,h=ls);const u=d.float32Array,p=d.uint32Array,F=d.uint16Array,R=h.float32Array,T=h.uint32Array,A=h.uint16Array,O=c*2,f=e*2,m=at(O,F),g=at(f,A);let _=!1;if(g&&m)E?_=i(lt(e,T),dt(e*2,A),lt(c,p),dt(c*2,F),a,n+e,r,o+c):_=i(lt(c,p),dt(c*2,F),lt(e,T),dt(e*2,A),r,o+c,a,n+e);else if(g){const N=Lt.getPrimitive();q(e,R,N),N.applyMatrix4(t);const y=ut(c),L=It(c,p);q(y,u,Jt),q(L,u,te);const w=N.intersectsBox(Jt),M=N.intersectsBox(te);_=w&&ft(e,y,s,t,i,n,o,a,r+1,N,!E)||M&&ft(e,L,s,t,i,n,o,a,r+1,N,!E),Lt.releasePrimitive(N)}else{const N=ut(e),y=It(e,T);q(N,R,ks),q(y,R,Ws);const L=l.intersectsBox(ks),w=l.intersectsBox(Ws);if(L&&w)_=ft(c,N,t,s,i,o,n,r,a+1,l,E)||ft(c,y,t,s,i,o,n,r,a+1,l,E);else if(L)if(m)_=ft(c,N,t,s,i,o,n,r,a+1,l,E);else{const M=Lt.getPrimitive();M.copy(ks).applyMatrix4(t);const U=ut(c),x=It(c,p);q(U,u,Jt),q(x,u,te);const v=M.intersectsBox(Jt),z=M.intersectsBox(te);_=v&&ft(N,U,s,t,i,n,o,a,r+1,M,!E)||z&&ft(N,x,s,t,i,n,o,a,r+1,M,!E),Lt.releasePrimitive(M)}else if(w)if(m)_=ft(c,y,t,s,i,o,n,r,a+1,l,E);else{const M=Lt.getPrimitive();M.copy(Ws).applyMatrix4(t);const U=ut(c),x=It(c,p);q(U,u,Jt),q(x,u,te);const v=M.intersectsBox(Jt),z=M.intersectsBox(te);_=v&&ft(y,U,s,t,i,n,o,a,r+1,M,!E)||z&&ft(y,x,s,t,i,n,o,a,r+1,M,!E),Lt.releasePrimitive(M)}}return _}const Ke=new ot,Xi=new C.Box3;class _i{static serialize(e,t={}){t={cloneBuffers:!0,...t};const s=e.geometry,i=e._roots,o=e._indirectBuffer,n=s.getIndex();let r;return t.cloneBuffers?r={roots:i.map(a=>a.slice()),index:n.array.slice(),indirectBuffer:o?o.slice():null}:r={roots:i,index:n.array,indirectBuffer:o},r}static deserialize(e,t,s={}){s={setIndex:!0,indirect:!!e.indirectBuffer,...s};const{index:i,roots:o,indirectBuffer:n}=e,r=new _i(t,{...s,[Bs]:!0});if(r._roots=o,r._indirectBuffer=n||null,s.setIndex){const a=t.getIndex();if(a===null){const l=new C.BufferAttribute(e.index,1,!1);t.setIndex(l)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return r}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:fn,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[Bs]:!1},t),t.useSharedArrayBuffer&&!qo())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[Bs]||(Io(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new C.Box3)));const{_indirectBuffer:s}=this;this.resolveTriangleIndex=t.indirect?i=>s[i]:i=>i}refit(e=null){return(this.indirect?Yo:No)(this,e)}traverse(e,t=0){const s=this._roots[t],i=new Uint32Array(s),o=new Uint16Array(s);n(0);function n(r,a=0){const l=r*2,E=o[l+15]===ys;if(E){const d=i[r+6],h=o[l+14];e(a,E,new Float32Array(s,r*4,6),d,h)}else{const d=r+rs/4,h=i[r+6],u=i[r+7];e(a,E,new Float32Array(s,r*4,6),u)||(n(d,a+1),n(h,a+1))}}}raycast(e,t=C.FrontSide){const s=this._roots,i=this.geometry,o=[],n=t.isMaterial,r=Array.isArray(t),a=i.groups,l=n?t.side:t,E=this.indirect?Go:Mo;for(let d=0,h=s.length;d<h;d++){const u=r?t[a[d].materialIndex].side:l,p=o.length;if(E(this,d,u,e,o),r){const F=a[d].materialIndex;for(let R=p,T=o.length;R<T;R++)o[R].face.materialIndex=F}}return o}raycastFirst(e,t=C.FrontSide){const s=this._roots,i=this.geometry,o=t.isMaterial,n=Array.isArray(t);let r=null;const a=i.groups,l=o?t.side:t,E=this.indirect?Ho:Do;for(let d=0,h=s.length;d<h;d++){const u=n?t[a[d].materialIndex].side:l,p=E(this,d,u,e);p!=null&&(r==null||p.distance<r.distance)&&(r=p,n&&(p.face.materialIndex=a[d].materialIndex))}return r}intersectsGeometry(e,t){let s=!1;const i=this._roots,o=this.indirect?ko:Uo;for(let n=0,r=i.length;n<r&&(s=o(this,n,e,t),!s);n++);return s}shapecast(e){const t=Et.getPrimitive(),s=this.indirect?Lo:_o;let{boundsTraverseOrder:i,intersectsBounds:o,intersectsRange:n,intersectsTriangle:r}=e;if(n&&r){const d=n;n=(h,u,p,F,R)=>d(h,u,p,F,R)?!0:s(h,u,this,r,p,F,t)}else n||(r?n=(d,h,u,p)=>s(d,h,this,r,u,p,t):n=(d,h,u)=>u);let a=!1,l=0;const E=this._roots;for(let d=0,h=E.length;d<h;d++){const u=E[d];if(a=Ro(this,d,o,n,i,l),a)break;l+=u.byteLength}return Et.releasePrimitive(t),a}bvhcast(e,t,s){let{intersectsRanges:i,intersectsTriangles:o}=s;const n=Et.getPrimitive(),r=this.geometry.index,a=this.geometry.attributes.position,l=this.indirect?p=>{const F=this.resolveTriangleIndex(p);tt(n,F*3,r,a)}:p=>{tt(n,p*3,r,a)},E=Et.getPrimitive(),d=e.geometry.index,h=e.geometry.attributes.position,u=e.indirect?p=>{const F=e.resolveTriangleIndex(p);tt(E,F*3,d,h)}:p=>{tt(E,p*3,d,h)};if(o){const p=(F,R,T,A,O,f,m,g)=>{for(let _=T,N=T+A;_<N;_++){u(_),E.a.applyMatrix4(t),E.b.applyMatrix4(t),E.c.applyMatrix4(t),E.needsUpdate=!0;for(let y=F,L=F+R;y<L;y++)if(l(y),n.needsUpdate=!0,o(n,E,y,_,O,f,m,g))return!0}return!1};if(i){const F=i;i=function(R,T,A,O,f,m,g,_){return F(R,T,A,O,f,m,g,_)?!0:p(R,T,A,O,f,m,g,_)}}else i=p}return Ko(this,e,t,i)}intersectsBox(e,t){return Ke.set(e.min,e.max,t),Ke.needsUpdate=!0,this.shapecast({intersectsBounds:s=>Ke.intersectsBox(s),intersectsTriangle:s=>Ke.intersectsTriangle(s)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,s={},i={},o=0,n=1/0){return(this.indirect?jo:Vo)(this,e,t,s,i,o,n)}closestPointToPoint(e,t={},s=0,i=1/0){return Ao(this,e,t,s,i)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(s=>{q(0,new Float32Array(s),Xi),e.union(Xi)}),e}}function Zi(c,e,t){return c===null||(c.point.applyMatrix4(e.matrixWorld),c.distance=c.point.distanceTo(t.ray.origin),c.object=e,c.distance<t.near||c.distance>t.far)?null:c}const Zs=new C.Ray,Qi=new C.Matrix4,$o=C.Mesh.prototype.raycast;function Jo(c,e){if(this.geometry.boundsTree){if(this.material===void 0)return;Qi.copy(this.matrixWorld).invert(),Zs.copy(c.ray).applyMatrix4(Qi);const t=this.geometry.boundsTree;if(c.firstHitOnly===!0){const s=Zi(t.raycastFirst(Zs,this.material),this,c);s&&e.push(s)}else{const s=t.raycast(Zs,this.material);for(let i=0,o=s.length;i<o;i++){const n=Zi(s[i],this,c);n&&e.push(n)}}}else $o.call(this,c,e)}function tr(c){return this.boundsTree=new _i(this,c),this.boundsTree}function er(){this.boundsTree=null}class D{constructor(){I(this,"trigger",e=>{const t=this.handlers.slice(0);for(const s of t)s(e)});I(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}}class Pe{constructor(){I(this,"trigger",async e=>{const t=this.handlers.slice(0);for(const s of t)await s(e)});I(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}}class Ls{constructor(e){I(this,"isDisposeable",()=>"dispose"in this&&"onDisposed"in this);I(this,"isResizeable",()=>"resize"in this&&"getSize"in this);I(this,"isUpdateable",()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this);I(this,"isHideable",()=>"visible"in this);I(this,"isConfigurable",()=>"setup"in this&&"config"in this&&"onSetup"in this);this.components=e}}class $ extends Ls{}class Ms extends Ls{constructor(t){super(t);I(this,"worlds",new Map);I(this,"onWorldChanged",new D);I(this,"currentWorld",null);this.onWorldChanged.add(({world:s,action:i})=>{i==="removed"&&this.worlds.delete(s.uuid)})}}class mn extends Ms{constructor(){super(...arguments);I(this,"hasCameraControls",()=>"controls"in this)}}class Rn extends Ms{constructor(){super(...arguments);I(this,"onAfterUpdate",new D);I(this,"onBeforeUpdate",new D);I(this,"onDisposed",new D);I(this,"onResize",new D);I(this,"onClippingPlanesUpdated",new D);I(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(t,s,i){s.isLocal=i;const o=this.clippingPlanes.indexOf(s);t&&o===-1?this.clippingPlanes.push(s):!t&&o>-1&&this.clippingPlanes.splice(o,1),this.three.clippingPlanes=this.clippingPlanes.filter(n=>!n.isLocal)}}const Le=class Le extends ${constructor(t){super(t);I(this,"_disposedComponents",new Set);I(this,"enabled",!0);t.add(Le.uuid,this)}get(){return this._disposedComponents}destroy(t,s=!0,i=!0){t.removeFromParent();const o=t;o.dispose&&o.dispose(),this.disposeGeometryAndMaterials(t,s),i&&o.children&&o.children.length&&this.disposeChildren(o),t.children.length=0}disposeGeometry(t){t.boundsTree&&t.disposeBoundsTree&&t.disposeBoundsTree(),t.dispose()}disposeGeometryAndMaterials(t,s){const i=t;i.geometry&&this.disposeGeometry(i.geometry),s&&i.material&&Le.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()}};I(Le,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let _t=Le;class An extends Ms{constructor(t){super(t);I(this,"onDisposed",new D)}dispose(){const t=this.components.get(_t);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 as=0,sr=1,ir=new C.Vector3,ji=new C.Line3,Qs=new C.Plane,qi=new C.Vector3,$e=new C.Triangle;class nr{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new Ki,this.unassigned=new Ki,this.vertices=[]}setFromPoints(e){if(e.length>=4){this.makeEmpty();for(let t=0,s=e.length;t<s;t++)this.vertices.push(new or(e[t]));this.compute()}return this}setFromObject(e){const t=[];return e.updateMatrixWorld(!0),e.traverse(function(s){const i=s.geometry;if(i!==void 0){const o=i.attributes.position;if(o!==void 0)for(let n=0,r=o.count;n<r;n++){const a=new C.Vector3;a.fromBufferAttribute(o,n).applyMatrix4(s.matrixWorld),t.push(a)}}}),this.setFromPoints(t)}containsPoint(e){const t=this.faces;for(let s=0,i=t.length;s<i;s++)if(t[s].distanceToPoint(e)>this.tolerance)return!1;return!0}intersectRay(e,t){const s=this.faces;let i=-1/0,o=1/0;for(let n=0,r=s.length;n<r;n++){const a=s[n],l=a.distanceToPoint(e.origin),E=a.normal.dot(e.direction);if(l>0&&E>=0)return null;const d=E!==0?-l/E:0;if(!(d<=0)&&(E>0?o=Math.min(d,o):i=Math.max(d,i),i>o))return null}return i!==-1/0?e.at(i,t):e.at(o,t),t}intersectsRay(e){return this.intersectRay(e,ir)!==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 s=e.outside;for(;s.next!==null&&s.next.face===e;)s=s.next;return this.assigned.removeSubList(t,s),t.prev=s.next=null,e.outside=null,t}}deleteFaceVertices(e,t){const s=this.removeAllVerticesFromFace(e);if(s!==void 0)if(t===void 0)this.unassigned.appendChain(s);else{let i=s;do{const o=i.next;t.distanceToPoint(i.point)>this.tolerance?this.addVertexToFace(i,t):this.unassigned.append(i),i=o}while(i!==null)}return this}resolveUnassignedPoints(e){if(this.unassigned.isEmpty()===!1){let t=this.unassigned.first();do{const s=t.next;let i=this.tolerance,o=null;for(let n=0;n<e.length;n++){const r=e[n];if(r.mark===as){const a=r.distanceToPoint(t.point);if(a>i&&(i=a,o=r),i>1e3*this.tolerance)break}}o!==null&&this.addVertexToFace(t,o),t=s}while(t!==null)}return this}computeExtremes(){const e=new C.Vector3,t=new C.Vector3,s=[],i=[];for(let o=0;o<3;o++)s[o]=i[o]=this.vertices[0];e.copy(this.vertices[0].point),t.copy(this.vertices[0].point);for(let o=0,n=this.vertices.length;o<n;o++){const r=this.vertices[o],a=r.point;for(let l=0;l<3;l++)a.getComponent(l)<e.getComponent(l)&&(e.setComponent(l,a.getComponent(l)),s[l]=r);for(let l=0;l<3;l++)a.getComponent(l)>t.getComponent(l)&&(t.setComponent(l,a.getComponent(l)),i[l]=r)}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:s,max:i}}computeInitialHull(){const e=this.vertices,t=this.computeExtremes(),s=t.min,i=t.max;let o=0,n=0;for(let h=0;h<3;h++){const u=i[h].point.getComponent(h)-s[h].point.getComponent(h);u>o&&(o=u,n=h)}const r=s[n],a=i[n];let l,E;o=0,ji.set(r.point,a.point);for(let h=0,u=this.vertices.length;h<u;h++){const p=e[h];if(p!==r&&p!==a){ji.closestPointToPoint(p.point,!0,qi);const F=qi.distanceToSquared(p.point);F>o&&(o=F,l=p)}}o=-1,Qs.setFromCoplanarPoints(r.point,a.point,l.point);for(let h=0,u=this.vertices.length;h<u;h++){const p=e[h];if(p!==r&&p!==a&&p!==l){const F=Math.abs(Qs.distanceToPoint(p.point));F>o&&(o=F,E=p)}}const d=[];if(Qs.distanceToPoint(E.point)<0){d.push(Ct.create(r,a,l),Ct.create(E,a,r),Ct.create(E,l,a),Ct.create(E,r,l));for(let h=0;h<3;h++){const u=(h+1)%3;d[h+1].getEdge(2).setTwin(d[0].getEdge(u)),d[h+1].getEdge(1).setTwin(d[u+1].getEdge(0))}}else{d.push(Ct.create(r,l,a),Ct.create(E,r,a),Ct.create(E,a,l),Ct.create(E,l,r));for(let h=0;h<3;h++){const u=(h+1)%3;d[h+1].getEdge(2).setTwin(d[0].getEdge((3-h)%3)),d[h+1].getEdge(0).setTwin(d[u+1].getEdge(1))}}for(let h=0;h<4;h++)this.faces.push(d[h]);for(let h=0,u=e.length;h<u;h++){const p=e[h];if(p!==r&&p!==a&&p!==l&&p!==E){o=this.tolerance;let F=null;for(let R=0;R<4;R++){const T=this.faces[R].distanceToPoint(p.point);T>o&&(o=T,F=this.faces[R])}F!==null&&this.addVertexToFace(p,F)}}return this}reindexFaces(){const e=[];for(let t=0;t<this.faces.length;t++){const s=this.faces[t];s.mark===as&&e.push(s)}return this.faces=e,this}nextVertexToAdd(){if(this.assigned.isEmpty()===!1){let e,t=0;const s=this.assigned.first().face;let i=s.outside;do{const o=s.distanceToPoint(i.point);o>t&&(t=o,e=i),i=i.next}while(i!==null&&i.face===s);return e}}computeHorizon(e,t,s,i){this.deleteFaceVertices(s),s.mark=sr;let o;t===null?o=t=s.getEdge(0):o=t.next;do{const n=o.twin,r=n.face;r.mark===as&&(r.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,n,r,i):i.push(o)),o=o.next}while(o!==t);return this}addAdjoiningFace(e,t){const s=Ct.create(e,t.tail(),t.head());return this.faces.push(s),s.getEdge(-1).setTwin(t.twin),s.getEdge(0)}addNewFaces(e,t){this.newFaces=[];let s=null,i=null;for(let o=0;o<t.length;o++){const n=t[o],r=this.addAdjoiningFace(e,n);s===null?s=r:r.next.setTwin(i),this.newFaces.push(r.face),i=r}return s.next.setTwin(i),this}addVertexToHull(e){const t=[];return this.unassigned.clear(),this.removeVertexFromFace(e,e.face),this.computeHorizon(e.point,null,e.face,t),this.addNewFaces(e,t),this.resolveUnassignedPoints(this.newFaces),this}cleanup(){return this.assigned.clear(),this.unassigned.clear(),this.newFaces=[],this}compute(){let e;for(this.computeInitialHull();(e=this.nextVertexToAdd())!==void 0;)this.addVertexToHull(e);return this.reindexFaces(),this.cleanup(),this}}class Ct{constructor(){this.normal=new C.Vector3,this.midpoint=new C.Vector3,this.area=0,this.constant=0,this.outside=null,this.mark=as,this.edge=null}static create(e,t,s){const i=new Ct,o=new js(e,i),n=new js(t,i),r=new js(s,i);return o.next=r.prev=n,n.next=o.prev=r,r.next=n.prev=o,i.edge=o,i.compute()}getEdge(e){let t=this.edge;for(;e>0;)t=t.next,e--;for(;e<0;)t=t.prev,e++;return t}compute(){const e=this.edge.tail(),t=this.edge.head(),s=this.edge.next.head();return $e.set(e.point,t.point,s.point),$e.getNormal(this.normal),$e.getMidpoint(this.midpoint),this.area=$e.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}}class js{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 or{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}}class Ki{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 Ei=[2,2,1],di=[1,0,0];function Ot(c,e){return c*3+e}function rr(c){const e=c.elements;let t=0;for(let s=0;s<9;s++)t+=e[s]*e[s];return Math.sqrt(t)}function ar(c){const e=c.elements;let t=0;for(let s=0;s<3;s++){const i=e[Ot(Ei[s],di[s])];t+=2*i*i}return Math.sqrt(t)}function cr(c,e){let t=0,s=1;const i=c.elements;for(let l=0;l<3;l++){const E=Math.abs(i[Ot(Ei[l],di[l])]);E>t&&(t=E,s=l)}let o=1,n=0;const r=di[s],a=Ei[s];if(Math.abs(i[Ot(a,r)])>Number.EPSILON){const l=i[Ot(a,a)],E=i[Ot(r,r)],d=i[Ot(a,r)],h=(l-E)/2/d;let u;h<0?u=-1/(-h+Math.sqrt(1+h*h)):u=1/(h+Math.sqrt(1+h*h)),o=1/Math.sqrt(1+u*u),n=u*o}return e.identity(),e.elements[Ot(r,r)]=o,e.elements[Ot(a,a)]=o,e.elements[Ot(a,r)]=n,e.elements[Ot(r,a)]=-n,e}function lr(c,e){let t=0,s=0;const i=10;e.unitary.identity(),e.diagonal.copy(c);const o=e.unitary,n=e.diagonal,r=new S.Matrix3,a=new S.Matrix3,l=Number.EPSILON*rr(n);for(;s<i&&ar(n)>l;)cr(n,r),a.copy(r).transpose(),n.multiply(r),n.premultiply(a),o.multiply(r),++t>2&&(s++,t=0);return e}function Fn(c){const e=[];for(let st=0;st<c.length-2;st+=3){const Vt=c[st],J=c[st+1],kt=c[st+2];e.push(new S.Vector3(Vt,J,kt))}const t=new nr;t.setFromPoints(e);const s={unitary:new S.Matrix3,diagonal:new S.Matrix3},i=t.faces,o=[],n=[];for(let st=0,Vt=i.length;st<Vt;st++){const J=i[st];let kt=J.edge;o.length=0;do o.push(kt),kt=kt.next;while(kt!==J.edge);const Wn=o.length-2;for(let be=1,Xn=Wn;be<=Xn;be++){const Us=o[0].vertex,xs=o[be+0].vertex,bs=o[be+1].vertex;n.push(Us.point.x,Us.point.y,Us.point.z),n.push(xs.point.x,xs.point.y,xs.point.z),n.push(bs.point.x,bs.point.y,bs.point.z)}}const r=new S.Vector3,a=new S.Vector3,l=new S.Vector3,E=new S.Vector3,d=new S.Vector3,h=new S.Vector3,u=new S.Vector3,p=new S.Vector3;let F=0,R=0,T=0,A=0,O=0,f=0,m=0;for(let st=0,Vt=n.length;st<Vt;st+=9){r.fromArray(n,st),a.fromArray(n,st+3),l.fromArray(n,st+6),u.set(0,0,0),u.add(r).add(a).add(l).divideScalar(3),E.subVectors(a,r),d.subVectors(l,r);const J=h.crossVectors(E,d).length()/2;p.add(h.copy(u).multiplyScalar(J)),F+=J,R+=(9*u.x*u.x+r.x*r.x+a.x*a.x+l.x*l.x)*(J/12),T+=(9*u.x*u.y+r.x*r.y+a.x*a.y+l.x*l.y)*(J/12),A+=(9*u.x*u.z+r.x*r.z+a.x*a.z+l.x*l.z)*(J/12),O+=(9*u.y*u.y+r.y*r.y+a.y*a.y+l.y*l.y)*(J/12),f+=(9*u.y*u.z+r.y*r.z+a.y*a.z+l.y*l.z)*(J/12),m+=(9*u.z*u.z+r.z*r.z+a.z*a.z+l.z*l.z)*(J/12)}p.divideScalar(F),R/=F,T/=F,A/=F,O/=F,f/=F,m/=F,R-=p.x*p.x,T-=p.x*p.y,A-=p.x*p.z,O-=p.y*p.y,f-=p.y*p.z,m-=p.z*p.z;const g=new S.Matrix3;g.elements[0]=R,g.elements[1]=T,g.elements[2]=A,g.elements[3]=T,g.elements[4]=O,g.elements[5]=f,g.elements[6]=A,g.elements[7]=f,g.elements[8]=m,lr(g,s);const _=s.unitary,N=new S.Vector3,y=new S.Vector3,L=new S.Vector3;_.extractBasis(N,y,L);let w=-1/0,M=-1/0,U=-1/0,x=1/0,v=1/0,z=1/0;for(let st=0,Vt=e.length;st<Vt;st++){const J=e[st];w=Math.max(N.dot(J),w),M=Math.max(y.dot(J),M),U=Math.max(L.dot(J),U),x=Math.min(N.dot(J),x),v=Math.min(y.dot(J),v),z=Math.min(L.dot(J),z)}N.multiplyScalar(.5*(x+w)),y.multiplyScalar(.5*(v+M)),L.multiplyScalar(.5*(z+U));const j=new S.Vector3,et=new S.Vector3,Z=new S.Matrix3;j.add(N).add(y).add(L),et.x=w-x,et.y=M-v,et.z=U-z,et.multiplyScalar(.5),Z.copy(_);const{x:bt,y:vt,z:Bt}=et,xe=new S.Matrix4;xe.makeScale(bt*2,vt*2,Bt*2);const Ee=new S.Matrix4;Ee.makeTranslation(-bt,-vt,-Bt);const Pi=new S.Matrix4;Pi.makeTranslation(j.x,j.y,j.z);const Li=new S.Matrix4;Li.setFromMatrix3(Z);const de=new S.Matrix4;return de.multiply(Pi),de.multiply(Li),de.multiply(Ee),de.multiply(xe),{center:j,halfSizes:et,rotation:Z,transformation:de}}function On(c,e,t){const s=[c[0]-e[0],c[1]-e[1],c[2]-e[2]];return t[0]*s[0]+t[1]*s[1]+t[2]*s[2]>0}class ui{static isTransparent(e){return e.transparent&&e.opacity<1}}const K=class K{static create(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return`${K._lut[e&255]+K._lut[e>>8&255]+K._lut[e>>16&255]+K._lut[e>>24&255]}-${K._lut[t&255]}${K._lut[t>>8&255]}-${K._lut[t>>16&15|64]}${K._lut[t>>24&255]}-${K._lut[s&63|128]}${K._lut[s>>8&255]}-${K._lut[s>>16&255]}${K._lut[s>>24&255]}${K._lut[i&255]}${K._lut[i>>8&255]}${K._lut[i>>16&255]}${K._lut[i>>24&255]}`.toLowerCase()}static validate(e){if(!K._pattern.test(e))throw new Error(`${e} is not a valid UUID v4.
|
|
2
2
|
|
|
3
3
|
- If you're the tool creator, you can take one from https://www.uuidgenerator.net/.
|
|
4
4
|
|
|
5
|
-
- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};I(K,"_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(K,"_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 ae=K;class ar extends ${constructor(t,e){super(t);I(this,"onVertexFound",new D);I(this,"onVertexLost",new D);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 o=this.components.get(ce).get(t).castRay();if(!o)return this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const n=this.getClosestVertex(o);return n?(this.workingPlane?Math.abs(this.workingPlane.distanceToPoint(n))<.001:!0)?((this._pickedPoint===null||!this._pickedPoint.equals(n))&&(this._pickedPoint=n.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 S.Vector3,i=!1,o=Number.MAX_SAFE_INTEGER;const n=this.getVertices(t);if(n===null)return null;for(const r of n){if(!r)continue;const a=t.point.distanceTo(r);a>o||a>this._config.snapDistance||(i=!0,e=r,o=t.point.distanceTo(r))}return i?e:this.config.showOnlyVertex?null:t.point}getVertices(t){const e=t.object;if(!t.face||!e)return null;const i=e.geometry,o=new S.Matrix4,{instanceId:n}=t,r=n!==void 0,a=e instanceof S.InstancedMesh;return a&&r&&e.getMatrixAt(n,o),[this.getVertex(t.face.a,i),this.getVertex(t.face.b,i),this.getVertex(t.face.c,i)].map(c=>(c&&(a&&r&&c.applyMatrix4(o),c.applyMatrix4(e.matrixWorld)),c))}getVertex(t,e){if(t===void 0)return null;const i=e.attributes.position;return new S.Vector3(i.getX(t),i.getY(t),i.getZ(t))}}const ps=class ps{constructor(){I(this,"onDisposed",new D);I(this,"list",new Map);I(this,"enabled",!1);I(this,"_clock");I(this,"update",()=>{if(!this.enabled)return;const s=this._clock.getDelta();for(const[t,e]of this.list)e.enabled&&e.isUpdateable()&&e.update(s);requestAnimationFrame(this.update)});this._clock=new S.Clock,ps.setupBVH()}add(s,t){if(this.list.has(s))throw new Error("You're trying to add a component that already exists in the components instance. Use Components.get() instead.");ae.validate(s),this.list.set(s,t)}get(s){const t=s.uuid;if(!this.list.has(t)){const e=new s(this);return this.list.has(t)||this.add(t,e),e}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[s,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){S.BufferGeometry.prototype.computeBoundsTree=$o,S.BufferGeometry.prototype.disposeBoundsTree=Ko,S.Mesh.prototype.raycast=qo}};I(ps,"release","2.0.8");let hs=ps;class cr{constructor(s){I(this,"_event");I(this,"_position",new S.Vector2);I(this,"onDisposed",new D);I(this,"updateMouseInfo",s=>{this._event=s});this.dom=s,this.setupEvents(!0)}get position(){if(this._event){const s=this.dom.getBoundingClientRect();this._position.x=this.getPositionX(s,this._event),this._position.y=this.getPositionY(s,this._event)}return this._position}dispose(){this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset()}getPositionY(s,t){return-((t.clientY-s.top)/(s.bottom-s.top))*2+1}getPositionX(s,t){return(t.clientX-s.left)/(s.right-s.left)*2-1}setupEvents(s){s?this.dom.addEventListener("mousemove",this.updateMouseInfo):this.dom.removeEventListener("mousemove",this.updateMouseInfo)}}class lr{constructor(s,t){I(this,"enabled",!0);I(this,"components");I(this,"onDisposed",new D);I(this,"mouse");I(this,"three",new S.Raycaster);I(this,"world");const e=t.renderer;if(!e)throw new Error("A renderer is needed for the raycaster to work!");this.world=t,this.mouse=new cr(e.three.domElement),this.components=s}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(s=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(s)}castRayFromVector(s,t,e=Array.from(this.world.meshes)){return this.three.set(s,t),this.intersect(e)}intersect(s=Array.from(this.world.meshes)){const t=this.three.intersectObjects(s),e=this.filterClippingPlanes(t);return e.length>0?e[0]:null}filterClippingPlanes(s){if(!this.world.renderer)throw new Error("Renderer not found!");const t=this.world.renderer.three;if(!t.clippingPlanes)return s;const e=t.clippingPlanes;return s.length<=0||!e||(e==null?void 0:e.length)<=0?s:s.filter(i=>e.every(o=>o.distanceToPoint(i.point)>0))}}const Cs=class Cs extends ${constructor(t){super(t);I(this,"enabled",!0);I(this,"list",new Map);I(this,"onDisposed",new D);t.add(Cs.uuid,this)}get(t){if(this.list.has(t.uuid))return this.list.get(t.uuid);const e=new lr(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(Cs,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let ce=Cs;class Sn extends Ls{constructor(){super(...arguments);I(this,"meshes",new Set);I(this,"onAfterUpdate",new D);I(this,"onBeforeUpdate",new D);I(this,"onDisposed",new D);I(this,"isDisposing",!1);I(this,"enabled",!0);I(this,"uuid",ae.create());I(this,"name");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(_t);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const i of this.meshes)e.destroy(i);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.onDisposed.trigger()}}class hr extends Fn{constructor(t){super(t);I(this,"isSetup",!1);I(this,"three");I(this,"onSetup",new D);I(this,"config",{directionalLight:{color:new S.Color("white"),intensity:1.5,position:new S.Vector3(5,10,3)},ambientLight:{color:new S.Color("white"),intensity:1}});this.three=new S.Scene,this.three.background=new S.Color(2107698)}setup(t){this.config={...this.config,...t};const e=new S.DirectionalLight(this.config.directionalLight.color,this.config.directionalLight.intensity);e.position.copy(this.config.directionalLight.position);const i=new S.AmbientLight(this.config.ambientLight.color,this.config.ambientLight.intensity);this.three.add(e,i),this.isSetup=!0,this.onSetup.trigger(this)}}class Er extends An{constructor(t,e,i){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 D);I(this,"_resizing",!1);I(this,"resize",t=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const e=t?t.x:this.container.clientWidth,i=t?t.y:this.container.clientHeight;this.three.setSize(e,i),this.onResize.trigger(new S.Vector2(e,i)),this._resizing=!1});I(this,"resizeEvent",()=>{this.resize()});I(this,"onContextLost",t=>{t.preventDefault(),this.enabled=!1});I(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new S.WebGLRenderer({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0});this.container=e,this._parameters=i,this.three=new S.WebGLRenderer({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 o=this.three.getContext(),{canvas:n}=o;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 S.Vector2(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()}}/*!
|
|
5
|
+
- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};I(K,"_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(K,"_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 re=K;class hr extends ${constructor(t,s){super(t);I(this,"onVertexFound",new D);I(this,"onVertexLost",new D);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,...s},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 o=this.components.get(ae).get(t).castRay();if(!o)return this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const n=this.getClosestVertex(o);return n?(this.workingPlane?Math.abs(this.workingPlane.distanceToPoint(n))<.001:!0)?((this._pickedPoint===null||!this._pickedPoint.equals(n))&&(this._pickedPoint=n.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 s=new S.Vector3,i=!1,o=Number.MAX_SAFE_INTEGER;const n=this.getVertices(t);if(n===null)return null;for(const r of n){if(!r)continue;const a=t.point.distanceTo(r);a>o||a>this._config.snapDistance||(i=!0,s=r,o=t.point.distanceTo(r))}return i?s:this.config.showOnlyVertex?null:t.point}getVertices(t){const s=t.object;if(!t.face||!s)return null;const i=s.geometry,o=new S.Matrix4,{instanceId:n}=t,r=n!==void 0,a=s instanceof S.InstancedMesh;return a&&r&&s.getMatrixAt(n,o),[this.getVertex(t.face.a,i),this.getVertex(t.face.b,i),this.getVertex(t.face.c,i)].map(l=>(l&&(a&&r&&l.applyMatrix4(o),l.applyMatrix4(s.matrixWorld)),l))}getVertex(t,s){if(t===void 0)return null;const i=s.attributes.position;return new S.Vector3(i.getX(t),i.getY(t),i.getZ(t))}}const ps=class ps{constructor(){I(this,"onDisposed",new D);I(this,"list",new Map);I(this,"enabled",!1);I(this,"_clock");I(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 S.Clock,ps.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 instance. Use Components.get() instead.");re.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(){S.BufferGeometry.prototype.computeBoundsTree=tr,S.BufferGeometry.prototype.disposeBoundsTree=er,S.Mesh.prototype.raycast=Jo}};I(ps,"release","2.0.12");let hs=ps;class gn{constructor(e){I(this,"_event");I(this,"_position",new S.Vector2);I(this,"onDisposed",new D);I(this,"updateMouseInfo",e=>{this._event=e});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 Sn{constructor(e,t){I(this,"enabled",!0);I(this,"components");I(this,"onDisposed",new D);I(this,"mouse");I(this,"three",new S.Raycaster);I(this,"world");const s=t.renderer;if(!s)throw new Error("A renderer is needed for the raycaster to work!");this.world=t,this.mouse=new gn(s.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,s=Array.from(this.world.meshes)){return this.three.set(e,t),this.intersect(s)}intersect(e=Array.from(this.world.meshes)){const t=this.three.intersectObjects(e),s=this.filterClippingPlanes(t);return s.length>0?s[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 s=t.clippingPlanes;return e.length<=0||!s||(s==null?void 0:s.length)<=0?e:e.filter(i=>s.every(o=>o.distanceToPoint(i.point)>0))}}const Cs=class Cs extends ${constructor(t){super(t);I(this,"enabled",!0);I(this,"list",new Map);I(this,"onDisposed",new D);t.add(Cs.uuid,this)}get(t){if(this.list.has(t.uuid))return this.list.get(t.uuid);const s=new Sn(this.components,t);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()}};I(Cs,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let ae=Cs;class _n extends Ls{constructor(){super(...arguments);I(this,"meshes",new Set);I(this,"onAfterUpdate",new D);I(this,"onBeforeUpdate",new D);I(this,"onDisposed",new D);I(this,"isDisposing",!1);I(this,"enabled",!0);I(this,"uuid",re.create());I(this,"name");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 s=this.components.get(_t);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 Er extends An{constructor(t){super(t);I(this,"isSetup",!1);I(this,"three");I(this,"onSetup",new D);I(this,"config",{directionalLight:{color:new S.Color("white"),intensity:1.5,position:new S.Vector3(5,10,3)},ambientLight:{color:new S.Color("white"),intensity:1}});this.three=new S.Scene,this.three.background=new S.Color(2107698)}setup(t){this.config={...this.config,...t};const s=new S.DirectionalLight(this.config.directionalLight.color,this.config.directionalLight.intensity);s.position.copy(this.config.directionalLight.position);const i=new S.AmbientLight(this.config.ambientLight.color,this.config.ambientLight.intensity);this.three.add(s,i),this.isSetup=!0,this.onSetup.trigger(this)}}class dr extends Rn{constructor(t,s,i){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 D);I(this,"_resizing",!1);I(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 S.Vector2(s,i)),this._resizing=!1});I(this,"resizeEvent",()=>{this.resize()});I(this,"onContextLost",t=>{t.preventDefault(),this.enabled=!1});I(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new S.WebGLRenderer({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0});this.container=s,this._parameters=i,this.three=new S.WebGLRenderer({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 o=this.three.getContext(),{canvas:n}=o;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,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 S.Vector2(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()}}/*!
|
|
6
6
|
* camera-controls
|
|
7
7
|
* https://github.com/yomotsu/camera-controls
|
|
8
8
|
* (c) 2017 @yomotsu
|
|
9
9
|
* Released under the MIT License.
|
|
10
|
-
*/const V={LEFT:1,RIGHT:2,MIDDLE:4},y=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}),se={NONE:0,IN:1,OUT:-1};function Gt(l){return l.isPerspectiveCamera}function yt(l){return l.isOrthographicCamera}const ie=Math.PI*2,Ji=Math.PI/2,_n=1e-5,Re=Math.PI/180;function pt(l,s,t){return Math.max(s,Math.min(t,l))}function W(l,s=_n){return Math.abs(l)<s}function H(l,s,t=_n){return W(l-s,t)}function tn(l,s){return Math.round(l/s)*s}function Ae(l){return isFinite(l)?l:l<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Fe(l){return Math.abs(l)<Number.MAX_VALUE?l:l*(1/0)}function Je(l,s,t,e,i=1/0,o){e=Math.max(1e-4,e);const n=2/e,r=n*o,a=1/(1+r+.48*r*r+.235*r*r*r);let c=l-s;const h=s,d=i*e;c=pt(c,-d,d),s=l-c;const E=(t.value+n*c)*o;t.value=(t.value-n*E)*a;let u=s+(c+E)*a;return h-l>0==u>h&&(u=h,t.value=(u-h)/o),u}function en(l,s,t,e,i=1/0,o,n){e=Math.max(1e-4,e);const r=2/e,a=r*o,c=1/(1+a+.48*a*a+.235*a*a*a);let h=s.x,d=s.y,E=s.z,u=l.x-h,p=l.y-d,F=l.z-E;const R=h,T=d,A=E,g=i*e,f=g*g,m=u*u+p*p+F*F;if(m>f){const v=Math.sqrt(m);u=u/v*g,p=p/v*g,F=F/v*g}h=l.x-u,d=l.y-p,E=l.z-F;const O=(t.x+r*u)*o,_=(t.y+r*p)*o,N=(t.z+r*F)*o;t.x=(t.x-r*O)*c,t.y=(t.y-r*_)*c,t.z=(t.z-r*N)*c,n.x=h+(u+O)*c,n.y=d+(p+_)*c,n.z=E+(F+N)*c;const P=R-l.x,L=T-l.y,w=A-l.z,M=n.x-R,x=n.y-T,b=n.z-A;return P*M+L*x+w*b>0&&(n.x=R,n.y=T,n.z=A,t.x=(n.x-R)/o,t.y=(n.y-T)/o,t.z=(n.z-A)/o),n}function js(l,s){s.set(0,0),l.forEach(t=>{s.x+=t.clientX,s.y+=t.clientY}),s.x/=l.length,s.y/=l.length}function qs(l,s){return yt(l)?(console.warn(`${s} is not supported in OrthographicCamera`),!0):!1}class dr{constructor(){this._listeners={}}addEventListener(s,t){const e=this._listeners;e[s]===void 0&&(e[s]=[]),e[s].indexOf(t)===-1&&e[s].push(t)}hasEventListener(s,t){const e=this._listeners;return e[s]!==void 0&&e[s].indexOf(t)!==-1}removeEventListener(s,t){const i=this._listeners[s];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}removeAllEventListeners(s){if(!s){this._listeners={};return}Array.isArray(this._listeners[s])&&(this._listeners[s].length=0)}dispatchEvent(s){const e=this._listeners[s.type];if(e!==void 0){s.target=this;const i=e.slice(0);for(let o=0,n=i.length;o<n;o++)i[o].call(this,s)}}}const ur="2.7.3",ts=1/8,Nn=typeof window<"u",Ir=Nn&&/Mac/.test(navigator.platform),fr=!(Nn&&"PointerEvent"in window);let B,sn,es,$s,rt,Y,G,ne,ge,Rt,At,zt,nn,on,ht,Oe,oe,rn,Ks,an,Js,ti,ss;class nt extends dr{static install(s){B=s.THREE,sn=Object.freeze(new B.Vector3(0,0,0)),es=Object.freeze(new B.Vector3(0,1,0)),$s=Object.freeze(new B.Vector3(0,0,1)),rt=new B.Vector2,Y=new B.Vector3,G=new B.Vector3,ne=new B.Vector3,ge=new B.Vector3,Rt=new B.Vector3,At=new B.Vector3,zt=new B.Vector3,nn=new B.Vector3,on=new B.Vector3,ht=new B.Spherical,Oe=new B.Spherical,oe=new B.Box3,rn=new B.Box3,Ks=new B.Sphere,an=new B.Quaternion,Js=new B.Quaternion,ti=new B.Matrix4,ss=new B.Raycaster}static get ACTION(){return y}constructor(s,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.verticalDragToForward=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=y.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=se.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=(f,m,O)=>{let _,N;if(Gt(this._camera)){const P=Y.copy(this._camera.position).sub(this._target),L=this._camera.getEffectiveFOV()*Re,w=P.length()*Math.tan(L*.5);_=this.truckSpeed*f*w/this._elementRect.height,N=this.truckSpeed*m*w/this._elementRect.height}else if(yt(this._camera)){const P=this._camera;_=f*(P.right-P.left)/P.zoom/this._elementRect.width,N=m*(P.top-P.bottom)/P.zoom/this._elementRect.height}else return;this.verticalDragToForward?(O?this.setFocalOffset(this._focalOffsetEnd.x+_,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(_,0,!0),this.forward(-N,!0)):O?this.setFocalOffset(this._focalOffsetEnd.x+_,this._focalOffsetEnd.y+N,this._focalOffsetEnd.z,!0):this.truck(_,N,!0)},this._rotateInternal=(f,m)=>{const O=ie*this.azimuthRotateSpeed*f/this._elementRect.height,_=ie*this.polarRotateSpeed*m/this._elementRect.height;this.rotate(O,_,!0)},this._dollyInternal=(f,m,O)=>{const _=Math.pow(.95,-f*this.dollySpeed),N=this._sphericalEnd.radius,P=this._sphericalEnd.radius*_,L=pt(P,this.minDistance,this.maxDistance),w=L-P;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(P,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(w,!0),this._dollyToNoClamp(L,!0)):this._dollyToNoClamp(L,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?P:L)-N,this._dollyControlCoord.set(m,O)),this._lastDollyDirection=Math.sign(-f)},this._zoomInternal=(f,m,O)=>{const _=Math.pow(.95,f*this.dollySpeed),N=this._zoom,P=this._zoom*_;this.zoomTo(P,!0),this.dollyToCursor&&(this._changedZoom+=P-N,this._dollyControlCoord.set(m,O))},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=s,this._yAxisUpSpace=new B.Quaternion().setFromUnitVectors(this._camera.up,es),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=y.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(Y.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:y.ROTATE,middle:y.DOLLY,right:y.TRUCK,wheel:Gt(this._camera)?y.DOLLY:yt(this._camera)?y.ZOOM:y.NONE},this.touches={one:y.TOUCH_ROTATE,two:Gt(this._camera)?y.TOUCH_DOLLY_TRUCK:yt(this._camera)?y.TOUCH_ZOOM_TRUCK:y.NONE,three:y.TOUCH_TRUCK};const e=new B.Vector2,i=new B.Vector2,o=new B.Vector2,n=f=>{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(),N=f.clientX/_.width,P=f.clientY/_.height;if(N<this._interactiveArea.left||N>this._interactiveArea.right||P<this._interactiveArea.top||P>this._interactiveArea.bottom)return}const m=f.pointerType!=="mouse"?null:(f.buttons&V.LEFT)===V.LEFT?V.LEFT:(f.buttons&V.MIDDLE)===V.MIDDLE?V.MIDDLE:(f.buttons&V.RIGHT)===V.RIGHT?V.RIGHT:null;if(m!==null){const _=this._findPointerByMouseButton(m);_&&this._disposePointer(_)}if((f.buttons&V.LEFT)===V.LEFT&&this._lockedPointer)return;const O={pointerId:f.pointerId,clientX:f.clientX,clientY:f.clientY,deltaX:0,deltaY:0,mouseButton:m};this._activePointers.push(O),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),this._isDragging=!0,F(f)},r=f=>{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(),N=f.clientX/_.width,P=f.clientY/_.height;if(N<this._interactiveArea.left||N>this._interactiveArea.right||P<this._interactiveArea.top||P>this._interactiveArea.bottom)return}const m=(f.buttons&V.LEFT)===V.LEFT?V.LEFT:(f.buttons&V.MIDDLE)===V.MIDDLE?V.MIDDLE:(f.buttons&V.RIGHT)===V.RIGHT?V.RIGHT:null;if(m!==null){const _=this._findPointerByMouseButton(m);_&&this._disposePointer(_)}const O={pointerId:1,clientX:f.clientX,clientY:f.clientY,deltaX:0,deltaY:0,mouseButton:(f.buttons&V.LEFT)===V.LEFT?V.LEFT:(f.buttons&V.MIDDLE)===V.LEFT?V.MIDDLE:(f.buttons&V.RIGHT)===V.LEFT?V.RIGHT:null};this._activePointers.push(O),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.addEventListener("mousemove",c),this._domElement.ownerDocument.addEventListener("mouseup",d),this._isDragging=!0,F(f)},a=f=>{f.cancelable&&f.preventDefault();const m=f.pointerId,O=this._lockedPointer||this._findPointerById(m);if(O){if(O.clientX=f.clientX,O.clientY=f.clientY,O.deltaX=f.movementX,O.deltaY=f.movementY,this._state=0,f.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&&(f.buttons&V.LEFT)===V.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(f.buttons&V.MIDDLE)===V.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(f.buttons&V.RIGHT)===V.RIGHT&&(this._state=this._state|this.mouseButtons.right);R()}},c=f=>{const m=this._lockedPointer||this._findPointerById(1);m&&(m.clientX=f.clientX,m.clientY=f.clientY,m.deltaX=f.movementX,m.deltaY=f.movementY,this._state=0,(this._lockedPointer||(f.buttons&V.LEFT)===V.LEFT)&&(this._state=this._state|this.mouseButtons.left),(f.buttons&V.MIDDLE)===V.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(f.buttons&V.RIGHT)===V.RIGHT&&(this._state=this._state|this.mouseButtons.right),R())},h=f=>{const m=this._findPointerById(f.pointerId);if(!(m&&m===this._lockedPointer)){if(m&&this._disposePointer(m),f.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=y.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=y.NONE;T()}},d=()=>{const f=this._findPointerById(1);f&&f===this._lockedPointer||(f&&this._disposePointer(f),this._state=y.NONE,T())};let E=-1;const u=f=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===y.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const P=this._domElement.getBoundingClientRect(),L=f.clientX/P.width,w=f.clientY/P.height;if(L<this._interactiveArea.left||L>this._interactiveArea.right||w<this._interactiveArea.top||w>this._interactiveArea.bottom)return}if(f.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===y.ROTATE||this.mouseButtons.wheel===y.TRUCK){const P=performance.now();E-P<1e3&&this._getClientRect(this._elementRect),E=P}const m=Ir?-1:-3,O=f.deltaMode===1?f.deltaY/m:f.deltaY/(m*10),_=this.dollyToCursor?(f.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,N=this.dollyToCursor?(f.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case y.ROTATE:{this._rotateInternal(f.deltaX,f.deltaY),this._isUserControllingRotate=!0;break}case y.TRUCK:{this._truckInternal(f.deltaX,f.deltaY,!1),this._isUserControllingTruck=!0;break}case y.OFFSET:{this._truckInternal(f.deltaX,f.deltaY,!0),this._isUserControllingOffset=!0;break}case y.DOLLY:{this._dollyInternal(-O,_,N),this._isUserControllingDolly=!0;break}case y.ZOOM:{this._zoomInternal(-O,_,N),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},p=f=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===nt.ACTION.NONE){const m=f instanceof PointerEvent?f.pointerId:(f instanceof MouseEvent,0),O=this._findPointerById(m);O&&this._disposePointer(O),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",d);return}f.preventDefault()}},F=f=>{if(!this._enabled)return;if(js(this._activePointers,rt),this._getClientRect(this._elementRect),e.copy(rt),i.copy(rt),this._activePointers.length>=2){const O=rt.x-this._activePointers[1].clientX,_=rt.y-this._activePointers[1].clientY,N=Math.sqrt(O*O+_*_);o.set(0,N);const P=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,L=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(P,L)}if(this._state=0,!f)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in f&&f.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&&(f.buttons&V.LEFT)===V.LEFT&&(this._state=this._state|this.mouseButtons.left),(f.buttons&V.MIDDLE)===V.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(f.buttons&V.RIGHT)===V.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&y.ROTATE)===y.ROTATE||(this._state&y.TOUCH_ROTATE)===y.TOUCH_ROTATE||(this._state&y.TOUCH_DOLLY_ROTATE)===y.TOUCH_DOLLY_ROTATE||(this._state&y.TOUCH_ZOOM_ROTATE)===y.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&y.TRUCK)===y.TRUCK||(this._state&y.TOUCH_TRUCK)===y.TOUCH_TRUCK||(this._state&y.TOUCH_DOLLY_TRUCK)===y.TOUCH_DOLLY_TRUCK||(this._state&y.TOUCH_ZOOM_TRUCK)===y.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&y.DOLLY)===y.DOLLY||(this._state&y.TOUCH_DOLLY)===y.TOUCH_DOLLY||(this._state&y.TOUCH_DOLLY_TRUCK)===y.TOUCH_DOLLY_TRUCK||(this._state&y.TOUCH_DOLLY_OFFSET)===y.TOUCH_DOLLY_OFFSET||(this._state&y.TOUCH_DOLLY_ROTATE)===y.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&y.ZOOM)===y.ZOOM||(this._state&y.TOUCH_ZOOM)===y.TOUCH_ZOOM||(this._state&y.TOUCH_ZOOM_TRUCK)===y.TOUCH_ZOOM_TRUCK||(this._state&y.TOUCH_ZOOM_OFFSET)===y.TOUCH_ZOOM_OFFSET||(this._state&y.TOUCH_ZOOM_ROTATE)===y.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&y.OFFSET)===y.OFFSET||(this._state&y.TOUCH_OFFSET)===y.TOUCH_OFFSET||(this._state&y.TOUCH_DOLLY_OFFSET)===y.TOUCH_DOLLY_OFFSET||(this._state&y.TOUCH_ZOOM_OFFSET)===y.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},R=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,js(this._activePointers,rt);const m=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,O=m?-m.deltaX:i.x-rt.x,_=m?-m.deltaY:i.y-rt.y;if(i.copy(rt),((this._state&y.ROTATE)===y.ROTATE||(this._state&y.TOUCH_ROTATE)===y.TOUCH_ROTATE||(this._state&y.TOUCH_DOLLY_ROTATE)===y.TOUCH_DOLLY_ROTATE||(this._state&y.TOUCH_ZOOM_ROTATE)===y.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(O,_),this._isUserControllingRotate=!0),(this._state&y.DOLLY)===y.DOLLY||(this._state&y.ZOOM)===y.ZOOM){const N=this.dollyToCursor?(e.x-this._elementRect.x)/this._elementRect.width*2-1:0,P=this.dollyToCursor?(e.y-this._elementRect.y)/this._elementRect.height*-2+1:0,L=this.dollyDragInverted?-1:1;(this._state&y.DOLLY)===y.DOLLY?(this._dollyInternal(L*_*ts,N,P),this._isUserControllingDolly=!0):(this._zoomInternal(L*_*ts,N,P),this._isUserControllingZoom=!0)}if((this._state&y.TOUCH_DOLLY)===y.TOUCH_DOLLY||(this._state&y.TOUCH_ZOOM)===y.TOUCH_ZOOM||(this._state&y.TOUCH_DOLLY_TRUCK)===y.TOUCH_DOLLY_TRUCK||(this._state&y.TOUCH_ZOOM_TRUCK)===y.TOUCH_ZOOM_TRUCK||(this._state&y.TOUCH_DOLLY_OFFSET)===y.TOUCH_DOLLY_OFFSET||(this._state&y.TOUCH_ZOOM_OFFSET)===y.TOUCH_ZOOM_OFFSET||(this._state&y.TOUCH_DOLLY_ROTATE)===y.TOUCH_DOLLY_ROTATE||(this._state&y.TOUCH_ZOOM_ROTATE)===y.TOUCH_ZOOM_ROTATE){const N=rt.x-this._activePointers[1].clientX,P=rt.y-this._activePointers[1].clientY,L=Math.sqrt(N*N+P*P),w=o.y-L;o.set(0,L);const M=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,x=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&y.TOUCH_DOLLY)===y.TOUCH_DOLLY||(this._state&y.TOUCH_DOLLY_ROTATE)===y.TOUCH_DOLLY_ROTATE||(this._state&y.TOUCH_DOLLY_TRUCK)===y.TOUCH_DOLLY_TRUCK||(this._state&y.TOUCH_DOLLY_OFFSET)===y.TOUCH_DOLLY_OFFSET?(this._dollyInternal(w*ts,M,x),this._isUserControllingDolly=!0):(this._zoomInternal(w*ts,M,x),this._isUserControllingZoom=!0)}((this._state&y.TRUCK)===y.TRUCK||(this._state&y.TOUCH_TRUCK)===y.TOUCH_TRUCK||(this._state&y.TOUCH_DOLLY_TRUCK)===y.TOUCH_DOLLY_TRUCK||(this._state&y.TOUCH_ZOOM_TRUCK)===y.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(O,_,!1),this._isUserControllingTruck=!0),((this._state&y.OFFSET)===y.OFFSET||(this._state&y.TOUCH_OFFSET)===y.TOUCH_OFFSET||(this._state&y.TOUCH_DOLLY_OFFSET)===y.TOUCH_DOLLY_OFFSET||(this._state&y.TOUCH_ZOOM_OFFSET)===y.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(O,_,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},T=()=>{js(this._activePointers,rt),i.copy(rt),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",h),this._domElement.ownerDocument.removeEventListener("mouseup",d),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",h),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",A),this._domElement.ownerDocument.addEventListener("pointerlockerror",g),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),F())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",A),this._domElement.ownerDocument.removeEventListener("pointerlockerror",g))};const A=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},g=()=>{this.unlockPointer()};this._addAllEventListeners=f=>{this._domElement=f,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",n),fr&&this._domElement.addEventListener("mousedown",r),this._domElement.addEventListener("pointercancel",h),this._domElement.addEventListener("wheel",u,{passive:!1}),this._domElement.addEventListener("contextmenu",p)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",n),this._domElement.removeEventListener("mousedown",r),this._domElement.removeEventListener("pointercancel",h),this._domElement.removeEventListener("wheel",u,{passive:!1}),this._domElement.removeEventListener("contextmenu",p),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.removeEventListener("pointerlockchange",A),this._domElement.ownerDocument.removeEventListener("pointerlockerror",g))},this.cancel=()=>{this._state!==y.NONE&&(this._state=y.NONE,this._activePointers.length=0,T())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(s){this._camera=s,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(s){this._enabled=s,this._domElement&&(s?(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(s){this._spherical.radius===s&&this._sphericalEnd.radius===s||(this._spherical.radius=s,this._sphericalEnd.radius=s,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(s){this._spherical.theta===s&&this._sphericalEnd.theta===s||(this._spherical.theta=s,this._sphericalEnd.theta=s,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(s){this._spherical.phi===s&&this._sphericalEnd.phi===s||(this._spherical.phi=s,this._sphericalEnd.phi=s,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(s){this._boundaryEnclosesCamera=s,this._needsUpdate=!0}set interactiveArea(s){this._interactiveArea.width=pt(s.width,0,1),this._interactiveArea.height=pt(s.height,0,1),this._interactiveArea.x=pt(s.x,0,1-this._interactiveArea.width),this._interactiveArea.y=pt(s.y,0,1-this._interactiveArea.height)}addEventListener(s,t){super.addEventListener(s,t)}removeEventListener(s,t){super.removeEventListener(s,t)}rotate(s,t,e=!1){return this.rotateTo(this._sphericalEnd.theta+s,this._sphericalEnd.phi+t,e)}rotateAzimuthTo(s,t=!1){return this.rotateTo(s,this._sphericalEnd.phi,t)}rotatePolarTo(s,t=!1){return this.rotateTo(this._sphericalEnd.theta,s,t)}rotateTo(s,t,e=!1){this._isUserControllingRotate=!1;const i=pt(s,this.minAzimuthAngle,this.maxAzimuthAngle),o=pt(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=o,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,e||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const n=!e||H(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&H(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(n)}dolly(s,t=!1){return this.dollyTo(this._sphericalEnd.radius-s,t)}dollyTo(s,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=se.NONE,this._changedDolly=0,this._dollyToNoClamp(pt(s,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(s,t=!1){const e=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const n=this._collisionTest(),r=H(n,this._spherical.radius);if(!(e>s)&&r)return Promise.resolve();this._sphericalEnd.radius=Math.min(s,n)}else this._sphericalEnd.radius=s;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const o=!t||H(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(o)}dollyInFixed(s,t=!1){this._targetEnd.add(this._getCameraDirection(ge).multiplyScalar(s)),t||this._target.copy(this._targetEnd);const e=!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(e)}zoom(s,t=!1){return this.zoomTo(this._zoomEnd+s,t)}zoomTo(s,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=pt(s,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const e=!t||H(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(e)}pan(s,t,e=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(s,t,e)}truck(s,t,e=!1){this._camera.updateMatrix(),Rt.setFromMatrixColumn(this._camera.matrix,0),At.setFromMatrixColumn(this._camera.matrix,1),Rt.multiplyScalar(s),At.multiplyScalar(-t);const i=Y.copy(Rt).add(At),o=G.copy(this._targetEnd).add(i);return this.moveTo(o.x,o.y,o.z,e)}forward(s,t=!1){Y.setFromMatrixColumn(this._camera.matrix,0),Y.crossVectors(this._camera.up,Y),Y.multiplyScalar(s);const e=G.copy(this._targetEnd).add(Y);return this.moveTo(e.x,e.y,e.z,t)}elevate(s,t=!1){return Y.copy(this._camera.up).multiplyScalar(s),this.moveTo(this._targetEnd.x+Y.x,this._targetEnd.y+Y.y,this._targetEnd.z+Y.z,t)}moveTo(s,t,e,i=!1){this._isUserControllingTruck=!1;const o=Y.set(s,t,e).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,o,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const n=!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(n)}lookInDirectionOf(s,t,e,i=!1){const r=Y.set(s,t,e).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(r.x,r.y,r.z,i)}fitToBox(s,t,{cover:e=!1,paddingLeft:i=0,paddingRight:o=0,paddingBottom:n=0,paddingTop:r=0}={}){const a=[],c=s.isBox3?oe.copy(s):oe.setFromObject(s);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const h=tn(this._sphericalEnd.theta,Ji),d=tn(this._sphericalEnd.phi,Ji);a.push(this.rotateTo(h,d,t));const E=Y.setFromSpherical(this._sphericalEnd).normalize(),u=an.setFromUnitVectors(E,$s),p=H(Math.abs(E.y),1);p&&u.multiply(Js.setFromAxisAngle(es,h)),u.multiply(this._yAxisUpSpaceInverse);const F=rn.makeEmpty();G.copy(c.min).applyQuaternion(u),F.expandByPoint(G),G.copy(c.min).setX(c.max.x).applyQuaternion(u),F.expandByPoint(G),G.copy(c.min).setY(c.max.y).applyQuaternion(u),F.expandByPoint(G),G.copy(c.max).setZ(c.min.z).applyQuaternion(u),F.expandByPoint(G),G.copy(c.min).setZ(c.max.z).applyQuaternion(u),F.expandByPoint(G),G.copy(c.max).setY(c.min.y).applyQuaternion(u),F.expandByPoint(G),G.copy(c.max).setX(c.min.x).applyQuaternion(u),F.expandByPoint(G),G.copy(c.max).applyQuaternion(u),F.expandByPoint(G),F.min.x-=i,F.min.y-=n,F.max.x+=o,F.max.y+=r,u.setFromUnitVectors($s,E),p&&u.premultiply(Js.invert()),u.premultiply(this._yAxisUpSpace);const R=F.getSize(Y),T=F.getCenter(G).applyQuaternion(u);if(Gt(this._camera)){const A=this.getDistanceToFitBox(R.x,R.y,R.z,e);a.push(this.moveTo(T.x,T.y,T.z,t)),a.push(this.dollyTo(A,t)),a.push(this.setFocalOffset(0,0,0,t))}else if(yt(this._camera)){const A=this._camera,g=A.right-A.left,f=A.top-A.bottom,m=e?Math.max(g/R.x,f/R.y):Math.min(g/R.x,f/R.y);a.push(this.moveTo(T.x,T.y,T.z,t)),a.push(this.zoomTo(m,t)),a.push(this.setFocalOffset(0,0,0,t))}return Promise.all(a)}fitToSphere(s,t){const e=[],o=s instanceof B.Sphere?Ks.copy(s):nt.createBoundingSphere(s,Ks);if(e.push(this.moveTo(o.center.x,o.center.y,o.center.z,t)),Gt(this._camera)){const n=this.getDistanceToFitSphere(o.radius);e.push(this.dollyTo(n,t))}else if(yt(this._camera)){const n=this._camera.right-this._camera.left,r=this._camera.top-this._camera.bottom,a=2*o.radius,c=Math.min(n/a,r/a);e.push(this.zoomTo(c,t))}return e.push(this.setFocalOffset(0,0,0,t)),Promise.all(e)}setLookAt(s,t,e,i,o,n,r=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=se.NONE,this._changedDolly=0;const a=G.set(i,o,n),c=Y.set(s,t,e);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 h=!r||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(h)}lerpLookAt(s,t,e,i,o,n,r,a,c,h,d,E,u,p=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=se.NONE,this._changedDolly=0;const F=Y.set(i,o,n),R=G.set(s,t,e);ht.setFromVector3(R.sub(F).applyQuaternion(this._yAxisUpSpace));const T=ne.set(h,d,E),A=G.set(r,a,c);Oe.setFromVector3(A.sub(T).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(F.lerp(T,u));const g=Oe.theta-ht.theta,f=Oe.phi-ht.phi,m=Oe.radius-ht.radius;this._sphericalEnd.set(ht.radius+m*u,ht.phi+f*u,ht.theta+g*u),this.normalizeRotations(),this._needsUpdate=!0,p||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const O=!p||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(O)}setPosition(s,t,e,i=!1){return this.setLookAt(s,t,e,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(s,t,e,i=!1){const o=this.getPosition(Y),n=this.setLookAt(o.x,o.y,o.z,s,t,e,i);return this._sphericalEnd.phi=pt(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),n}setFocalOffset(s,t,e,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(s,t,e),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const o=!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(o)}setOrbitPoint(s,t,e){this._camera.updateMatrixWorld(),Rt.setFromMatrixColumn(this._camera.matrixWorldInverse,0),At.setFromMatrixColumn(this._camera.matrixWorldInverse,1),zt.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=Y.set(s,t,e),o=i.distanceTo(this._camera.position),n=i.sub(this._camera.position);Rt.multiplyScalar(n.x),At.multiplyScalar(n.y),zt.multiplyScalar(n.z),Y.copy(Rt).add(At).add(zt),Y.z=Y.z+o,this.dollyTo(o,!1),this.setFocalOffset(-Y.x,Y.y,-Y.z,!1),this.moveTo(s,t,e,!1)}setBoundary(s){if(!s){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(s),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(s,t,e,i){if(s===null){this._viewport=null;return}this._viewport=this._viewport||new B.Vector4,typeof s=="number"?this._viewport.set(s,t,e,i):this._viewport.copy(s)}getDistanceToFitBox(s,t,e,i=!1){if(qs(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const o=s/t,n=this._camera.getEffectiveFOV()*Re,r=this._camera.aspect;return((i?o>r:o<r)?t:s/r)*.5/Math.tan(n*.5)+e*.5}getDistanceToFitSphere(s){if(qs(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*Re,e=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,i=1<this._camera.aspect?t:e;return s/Math.sin(i*.5)}getTarget(s,t=!0){return(s&&s.isVector3?s:new B.Vector3).copy(t?this._targetEnd:this._target)}getPosition(s,t=!0){return(s&&s.isVector3?s:new B.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(s,t=!0){return(s&&s instanceof B.Spherical?s:new B.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(s,t=!0){return(s&&s.isVector3?s:new B.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%ie,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=ie),this._spherical.theta+=ie*Math.round((this._sphericalEnd.theta-this._spherical.theta)/ie)}reset(s=!1){if(!H(this._camera.up.x,this._cameraUp0.x)||!H(this._camera.up.y,this._cameraUp0.y)||!H(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const e=this.getPosition(Y);this.updateCameraUp(),this.setPosition(e.x,e.y,e.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,s),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,s),this.zoomTo(this._zoom0,s)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,es),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const s=Y.subVectors(this._target,this._camera.position).normalize(),t=G.crossVectors(s,this._camera.up);this._camera.up.crossVectors(t,s).normalize(),this._camera.updateMatrixWorld();const e=this.getPosition(Y);this.updateCameraUp(),this.setPosition(e.x,e.y,e.z)}update(s){const t=this._sphericalEnd.theta-this._spherical.theta,e=this._sphericalEnd.phi-this._spherical.phi,i=this._sphericalEnd.radius-this._spherical.radius,o=nn.subVectors(this._targetEnd,this._target),n=on.subVectors(this._focalOffsetEnd,this._focalOffset),r=this._zoomEnd-this._zoom;if(W(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Je(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,d,1/0,s),this._needsUpdate=!0}if(W(e))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Je(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,d,1/0,s),this._needsUpdate=!0}if(W(i))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const d=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Je(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,d,this.maxSpeed,s),this._needsUpdate=!0}if(W(o.x)&&W(o.y)&&W(o.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const d=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;en(this._target,this._targetEnd,this._targetVelocity,d,this.maxSpeed,s,this._target),this._needsUpdate=!0}if(W(n.x)&&W(n.y)&&W(n.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const d=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;en(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,d,this.maxSpeed,s,this._focalOffset),this._needsUpdate=!0}if(W(r))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const d=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Je(this._zoom,this._zoomEnd,this._zoomVelocity,d,1/0,s)}if(this.dollyToCursor){if(Gt(this._camera)&&this._changedDolly!==0){const d=this._spherical.radius-this._lastDistance,E=this._camera,u=this._getCameraDirection(ge),p=Y.copy(u).cross(E.up).normalize();p.lengthSq()===0&&(p.x=1);const F=G.crossVectors(p,u),R=this._sphericalEnd.radius*Math.tan(E.getEffectiveFOV()*Re*.5),A=(this._sphericalEnd.radius-d-this._sphericalEnd.radius)/this._sphericalEnd.radius,g=ne.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x*R*E.aspect)).add(F.multiplyScalar(this._dollyControlCoord.y*R)),f=Y.copy(this._targetEnd).lerp(g,A),m=this._lastDollyDirection===se.IN&&this._spherical.radius<=this.minDistance,O=this._lastDollyDirection===se.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(m||O)){this._sphericalEnd.radius-=d,this._spherical.radius-=d;const N=G.copy(u).multiplyScalar(-d);f.add(N)}this._boundary.clampPoint(f,f);const _=G.subVectors(f,this._targetEnd);this._targetEnd.copy(f),this._target.add(_),this._changedDolly-=d,W(this._changedDolly)&&(this._changedDolly=0)}else if(yt(this._camera)&&this._changedZoom!==0){const d=this._zoom-this._lastZoom,E=this._camera,u=Y.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(E.near+E.far)/(E.near-E.far)).unproject(E),p=G.set(0,0,-1).applyQuaternion(E.quaternion),F=ne.copy(u).add(p.multiplyScalar(-u.dot(E.up))),T=-(this._zoom-d-this._zoom)/this._zoom,A=this._getCameraDirection(ge),g=this._targetEnd.dot(A),f=Y.copy(this._targetEnd).lerp(F,T),m=f.dot(A),O=A.multiplyScalar(m-g);f.sub(O),this._boundary.clampPoint(f,f);const _=G.subVectors(f,this._targetEnd);this._targetEnd.copy(f),this._target.add(_),this._changedZoom-=d,W(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const a=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,a),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!W(this._focalOffset.x)||!W(this._focalOffset.y)||!W(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),Rt.setFromMatrixColumn(this._camera.matrix,0),At.setFromMatrixColumn(this._camera.matrix,1),zt.setFromMatrixColumn(this._camera.matrix,2),Rt.multiplyScalar(this._focalOffset.x),At.multiplyScalar(-this._focalOffset.y),zt.multiplyScalar(this._focalOffset.z),Y.copy(Rt).add(At).add(zt),this._camera.position.add(Y)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),Y.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const h=this._needsUpdate;return h&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):h?(this.dispatchEvent({type:"update"}),W(t,this.restThreshold)&&W(e,this.restThreshold)&&W(i,this.restThreshold)&&W(o.x,this.restThreshold)&&W(o.y,this.restThreshold)&&W(o.z,this.restThreshold)&&W(n.x,this.restThreshold)&&W(n.y,this.restThreshold)&&W(n.z,this.restThreshold)&&W(r,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!h&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=h,this._needsUpdate=!1,h}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Ae(this.maxDistance),minZoom:this.minZoom,maxZoom:Ae(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Ae(this.maxPolarAngle),minAzimuthAngle:Ae(this.minAzimuthAngle),maxAzimuthAngle:Ae(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,verticalDragToForward:this.verticalDragToForward,target:this._targetEnd.toArray(),position:Y.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(s,t=!1){const e=JSON.parse(s);this.enabled=e.enabled,this.minDistance=e.minDistance,this.maxDistance=Fe(e.maxDistance),this.minZoom=e.minZoom,this.maxZoom=Fe(e.maxZoom),this.minPolarAngle=e.minPolarAngle,this.maxPolarAngle=Fe(e.maxPolarAngle),this.minAzimuthAngle=Fe(e.minAzimuthAngle),this.maxAzimuthAngle=Fe(e.maxAzimuthAngle),this.smoothTime=e.smoothTime,this.draggingSmoothTime=e.draggingSmoothTime,this.dollySpeed=e.dollySpeed,this.truckSpeed=e.truckSpeed,this.dollyToCursor=e.dollyToCursor,this.verticalDragToForward=e.verticalDragToForward,this._target0.fromArray(e.target0),this._position0.fromArray(e.position0),this._zoom0=e.zoom0,this._focalOffset0.fromArray(e.focalOffset0),this.moveTo(e.target[0],e.target[1],e.target[2],t),ht.setFromVector3(Y.fromArray(e.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(ht.theta,ht.phi,t),this.dollyTo(ht.radius,t),this.zoomTo(e.zoom,t),this.setFocalOffset(e.focalOffset[0],e.focalOffset[1],e.focalOffset[2],t),this._needsUpdate=!0}connect(s){if(this._domElement){console.warn("camera-controls is already connected.");return}s.setAttribute("data-camera-controls-version",ur),this._addAllEventListeners(s),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(s){return s.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(s){return this._getTargetDirection(s).negate()}_findPointerById(s){return this._activePointers.find(t=>t.pointerId===s)}_findPointerByMouseButton(s){return this._activePointers.find(t=>t.mouseButton===s)}_disposePointer(s){this._activePointers.splice(this._activePointers.indexOf(s),1)}_encloseToBoundary(s,t,e){const i=t.lengthSq();if(i===0)return s;const o=G.copy(t).add(s),r=this._boundary.clampPoint(o,ne).sub(o),a=r.lengthSq();if(a===0)return s.add(t);if(a===i)return s;if(e===0)return s.add(t).add(r);{const c=1+e*a/t.dot(r);return s.add(G.copy(t).multiplyScalar(c)).add(r.multiplyScalar(1-e))}}_updateNearPlaneCorners(){if(Gt(this._camera)){const s=this._camera,t=s.near,e=s.getEffectiveFOV()*Re,i=Math.tan(e*.5)*t,o=i*s.aspect;this._nearPlaneCorners[0].set(-o,-i,0),this._nearPlaneCorners[1].set(o,-i,0),this._nearPlaneCorners[2].set(o,i,0),this._nearPlaneCorners[3].set(-o,i,0)}else if(yt(this._camera)){const s=this._camera,t=1/s.zoom,e=s.left*t,i=s.right*t,o=s.top*t,n=s.bottom*t;this._nearPlaneCorners[0].set(e,o,0),this._nearPlaneCorners[1].set(i,o,0),this._nearPlaneCorners[2].set(i,n,0),this._nearPlaneCorners[3].set(e,n,0)}}_collisionTest(){let s=1/0;if(!(this.colliderMeshes.length>=1)||qs(this._camera,"_collisionTest"))return s;const e=this._getTargetDirection(ge);ti.lookAt(sn,e,this._camera.up);for(let i=0;i<4;i++){const o=G.copy(this._nearPlaneCorners[i]);o.applyMatrix4(ti);const n=ne.addVectors(this._target,o);ss.set(n,e),ss.far=this._spherical.radius+1;const r=ss.intersectObjects(this.colliderMeshes);r.length!==0&&r[0].distance<s&&(s=r[0].distance)}return s}_getClientRect(s){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return s.x=t.left,s.y=t.top,this._viewport?(s.x+=this._viewport.x,s.y+=t.height-this._viewport.w-this._viewport.y,s.width=this._viewport.z,s.height=this._viewport.w):(s.width=t.width,s.height=t.height),s}_createOnRestPromise(s){return s?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const e=()=>{this.removeEventListener("rest",e),t()};this.addEventListener("rest",e)}))}_addAllEventListeners(s){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(s){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(s){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(s,t=new B.Sphere){const e=t,i=e.center;oe.makeEmpty(),s.traverseVisible(n=>{n.isMesh&&oe.expandByObject(n)}),oe.getCenter(i);let o=0;return s.traverseVisible(n=>{if(!n.isMesh)return;const r=n,a=r.geometry.clone();a.applyMatrix4(r.matrixWorld);const h=a.attributes.position;for(let d=0,E=h.count;d<E;d++)Y.fromBufferAttribute(h,d),o=Math.max(o,i.distanceToSquared(Y))}),e.radius=Math.sqrt(o),e}}class le extends Rn{constructor(t){super(t);I(this,"onBeforeUpdate",new D);I(this,"onAfterUpdate",new D);I(this,"onAspectUpdated",new D);I(this,"onDisposed",new D);I(this,"three");I(this,"_allControls",new Map);I(this,"updateAspect",()=>{var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof S.OrthographicCamera){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const e=this.currentWorld.renderer.getSize();this.three.aspect=e.width/e.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}});this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:e,world:i})=>{if(e==="added"){const o=this.newCameraControls();this._allControls.set(i.uuid,o)}if(e==="removed"){const o=this._allControls.get(i.uuid);o&&(o.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.currentWorld!==null&&(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 S.PerspectiveCamera(60,t,1,1e3);return e.position.set(50,50,50),e.lookAt(new S.Vector3(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!");nt.install({THREE:le.getSubsetOfThree()});const{domElement:t}=this.currentWorld.renderer.three,e=new nt(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:S.MOUSE,Vector2:S.Vector2,Vector3:S.Vector3,Vector4:S.Vector4,Quaternion:S.Quaternion,Matrix4:S.Matrix4,Spherical:S.Spherical,Box3:S.Box3,Sphere:S.Sphere,Raycaster:S.Raycaster,MathUtils:S.MathUtils}}}const Ts=class Ts extends ${constructor(t){super(t);I(this,"onAfterUpdate",new D);I(this,"onBeforeUpdate",new D);I(this,"onDisposed",new D);I(this,"onWorldCreated",new D);I(this,"onWorldDeleted",new D);I(this,"list",new Map);I(this,"enabled",!0);t.add(Ts.uuid,this)}create(){const t=new Sn(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){if(!this.list.has(t.uuid))throw new Error("The provided world is not found in the list!");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,i]of this.list)i.update(t)}};I(Ts,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let Es=Ts;class pr{constructor(s,t,e){I(this,"onDisposed",new D);I(this,"world");I(this,"components");I(this,"three");I(this,"_fade",3);I(this,"updateZoom",()=>{this.world.camera instanceof le&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)});this.world=t;const{color:i,size1:o,size2:n,distance:r}=e;this.components=s;const a=new S.PlaneGeometry(2,2,1,1),c=new S.ShaderMaterial({side:S.DoubleSide,uniforms:{uSize1:{value:o},uSize2:{value:n},uColor:{value:i},uDistance:{value:r},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:`
|
|
10
|
+
*/const V={LEFT:1,RIGHT:2,MIDDLE:4},P=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}),ee={NONE:0,IN:1,OUT:-1};function Yt(c){return c.isPerspectiveCamera}function Pt(c){return c.isOrthographicCamera}const se=Math.PI*2,$i=Math.PI/2,Nn=1e-5,me=Math.PI/180;function pt(c,e,t){return Math.max(e,Math.min(t,c))}function W(c,e=Nn){return Math.abs(c)<e}function H(c,e,t=Nn){return W(c-e,t)}function Ji(c,e){return Math.round(c/e)*e}function Re(c){return isFinite(c)?c:c<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Ae(c){return Math.abs(c)<Number.MAX_VALUE?c:c*(1/0)}function Je(c,e,t,s,i=1/0,o){s=Math.max(1e-4,s);const n=2/s,r=n*o,a=1/(1+r+.48*r*r+.235*r*r*r);let l=c-e;const E=e,d=i*s;l=pt(l,-d,d),e=c-l;const h=(t.value+n*l)*o;t.value=(t.value-n*h)*a;let u=e+(l+h)*a;return E-c>0==u>E&&(u=E,t.value=(u-E)/o),u}function tn(c,e,t,s,i=1/0,o,n){s=Math.max(1e-4,s);const r=2/s,a=r*o,l=1/(1+a+.48*a*a+.235*a*a*a);let E=e.x,d=e.y,h=e.z,u=c.x-E,p=c.y-d,F=c.z-h;const R=E,T=d,A=h,O=i*s,f=O*O,m=u*u+p*p+F*F;if(m>f){const v=Math.sqrt(m);u=u/v*O,p=p/v*O,F=F/v*O}E=c.x-u,d=c.y-p,h=c.z-F;const g=(t.x+r*u)*o,_=(t.y+r*p)*o,N=(t.z+r*F)*o;t.x=(t.x-r*g)*l,t.y=(t.y-r*_)*l,t.z=(t.z-r*N)*l,n.x=E+(u+g)*l,n.y=d+(p+_)*l,n.z=h+(F+N)*l;const y=R-c.x,L=T-c.y,w=A-c.z,M=n.x-R,U=n.y-T,x=n.z-A;return y*M+L*U+w*x>0&&(n.x=R,n.y=T,n.z=A,t.x=(n.x-R)/o,t.y=(n.y-T)/o,t.z=(n.z-A)/o),n}function qs(c,e){e.set(0,0),c.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=c.length,e.y/=c.length}function Ks(c,e){return Pt(c)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class ur{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 o=i.indexOf(t);o!==-1&&i.splice(o,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 o=0,n=i.length;o<n;o++)i[o].call(this,e)}}}const Ir="2.7.3",ts=1/8,yn=typeof window<"u",fr=yn&&/Mac/.test(navigator.platform),pr=!(yn&&"PointerEvent"in window);let B,en,es,$s,rt,Y,G,ie,Fe,Rt,At,Gt,sn,nn,ht,Oe,ne,on,Js,rn,ti,ei,ss;class nt extends ur{static install(e){B=e.THREE,en=Object.freeze(new B.Vector3(0,0,0)),es=Object.freeze(new B.Vector3(0,1,0)),$s=Object.freeze(new B.Vector3(0,0,1)),rt=new B.Vector2,Y=new B.Vector3,G=new B.Vector3,ie=new B.Vector3,Fe=new B.Vector3,Rt=new B.Vector3,At=new B.Vector3,Gt=new B.Vector3,sn=new B.Vector3,nn=new B.Vector3,ht=new B.Spherical,Oe=new B.Spherical,ne=new B.Box3,on=new B.Box3,Js=new B.Sphere,rn=new B.Quaternion,ti=new B.Quaternion,ei=new B.Matrix4,ss=new B.Raycaster}static get ACTION(){return P}constructor(e,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.verticalDragToForward=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=P.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=ee.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=(f,m,g)=>{let _,N;if(Yt(this._camera)){const y=Y.copy(this._camera.position).sub(this._target),L=this._camera.getEffectiveFOV()*me,w=y.length()*Math.tan(L*.5);_=this.truckSpeed*f*w/this._elementRect.height,N=this.truckSpeed*m*w/this._elementRect.height}else if(Pt(this._camera)){const y=this._camera;_=f*(y.right-y.left)/y.zoom/this._elementRect.width,N=m*(y.top-y.bottom)/y.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(-N,!0)):g?this.setFocalOffset(this._focalOffsetEnd.x+_,this._focalOffsetEnd.y+N,this._focalOffsetEnd.z,!0):this.truck(_,N,!0)},this._rotateInternal=(f,m)=>{const g=se*this.azimuthRotateSpeed*f/this._elementRect.height,_=se*this.polarRotateSpeed*m/this._elementRect.height;this.rotate(g,_,!0)},this._dollyInternal=(f,m,g)=>{const _=Math.pow(.95,-f*this.dollySpeed),N=this._sphericalEnd.radius,y=this._sphericalEnd.radius*_,L=pt(y,this.minDistance,this.maxDistance),w=L-y;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(y,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(w,!0),this._dollyToNoClamp(L,!0)):this._dollyToNoClamp(L,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?y:L)-N,this._dollyControlCoord.set(m,g)),this._lastDollyDirection=Math.sign(-f)},this._zoomInternal=(f,m,g)=>{const _=Math.pow(.95,f*this.dollySpeed),N=this._zoom,y=this._zoom*_;this.zoomTo(y,!0),this.dollyToCursor&&(this._changedZoom+=y-N,this._dollyControlCoord.set(m,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=e,this._yAxisUpSpace=new B.Quaternion().setFromUnitVectors(this._camera.up,es),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=P.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(Y.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:P.ROTATE,middle:P.DOLLY,right:P.TRUCK,wheel:Yt(this._camera)?P.DOLLY:Pt(this._camera)?P.ZOOM:P.NONE},this.touches={one:P.TOUCH_ROTATE,two:Yt(this._camera)?P.TOUCH_DOLLY_TRUCK:Pt(this._camera)?P.TOUCH_ZOOM_TRUCK:P.NONE,three:P.TOUCH_TRUCK};const s=new B.Vector2,i=new B.Vector2,o=new B.Vector2,n=f=>{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(),N=f.clientX/_.width,y=f.clientY/_.height;if(N<this._interactiveArea.left||N>this._interactiveArea.right||y<this._interactiveArea.top||y>this._interactiveArea.bottom)return}const m=f.pointerType!=="mouse"?null:(f.buttons&V.LEFT)===V.LEFT?V.LEFT:(f.buttons&V.MIDDLE)===V.MIDDLE?V.MIDDLE:(f.buttons&V.RIGHT)===V.RIGHT?V.RIGHT:null;if(m!==null){const _=this._findPointerByMouseButton(m);_&&this._disposePointer(_)}if((f.buttons&V.LEFT)===V.LEFT&&this._lockedPointer)return;const g={pointerId:f.pointerId,clientX:f.clientX,clientY:f.clientY,deltaX:0,deltaY:0,mouseButton:m};this._activePointers.push(g),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",E),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",E),this._isDragging=!0,F(f)},r=f=>{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(),N=f.clientX/_.width,y=f.clientY/_.height;if(N<this._interactiveArea.left||N>this._interactiveArea.right||y<this._interactiveArea.top||y>this._interactiveArea.bottom)return}const m=(f.buttons&V.LEFT)===V.LEFT?V.LEFT:(f.buttons&V.MIDDLE)===V.MIDDLE?V.MIDDLE:(f.buttons&V.RIGHT)===V.RIGHT?V.RIGHT:null;if(m!==null){const _=this._findPointerByMouseButton(m);_&&this._disposePointer(_)}const g={pointerId:1,clientX:f.clientX,clientY:f.clientY,deltaX:0,deltaY:0,mouseButton:(f.buttons&V.LEFT)===V.LEFT?V.LEFT:(f.buttons&V.MIDDLE)===V.LEFT?V.MIDDLE:(f.buttons&V.RIGHT)===V.LEFT?V.RIGHT:null};this._activePointers.push(g),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.addEventListener("mousemove",l),this._domElement.ownerDocument.addEventListener("mouseup",d),this._isDragging=!0,F(f)},a=f=>{f.cancelable&&f.preventDefault();const m=f.pointerId,g=this._lockedPointer||this._findPointerById(m);if(g){if(g.clientX=f.clientX,g.clientY=f.clientY,g.deltaX=f.movementX,g.deltaY=f.movementY,this._state=0,f.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&&(f.buttons&V.LEFT)===V.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(f.buttons&V.MIDDLE)===V.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(f.buttons&V.RIGHT)===V.RIGHT&&(this._state=this._state|this.mouseButtons.right);R()}},l=f=>{const m=this._lockedPointer||this._findPointerById(1);m&&(m.clientX=f.clientX,m.clientY=f.clientY,m.deltaX=f.movementX,m.deltaY=f.movementY,this._state=0,(this._lockedPointer||(f.buttons&V.LEFT)===V.LEFT)&&(this._state=this._state|this.mouseButtons.left),(f.buttons&V.MIDDLE)===V.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(f.buttons&V.RIGHT)===V.RIGHT&&(this._state=this._state|this.mouseButtons.right),R())},E=f=>{const m=this._findPointerById(f.pointerId);if(!(m&&m===this._lockedPointer)){if(m&&this._disposePointer(m),f.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=P.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=P.NONE;T()}},d=()=>{const f=this._findPointerById(1);f&&f===this._lockedPointer||(f&&this._disposePointer(f),this._state=P.NONE,T())};let h=-1;const u=f=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===P.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const y=this._domElement.getBoundingClientRect(),L=f.clientX/y.width,w=f.clientY/y.height;if(L<this._interactiveArea.left||L>this._interactiveArea.right||w<this._interactiveArea.top||w>this._interactiveArea.bottom)return}if(f.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===P.ROTATE||this.mouseButtons.wheel===P.TRUCK){const y=performance.now();h-y<1e3&&this._getClientRect(this._elementRect),h=y}const m=fr?-1:-3,g=f.deltaMode===1?f.deltaY/m:f.deltaY/(m*10),_=this.dollyToCursor?(f.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,N=this.dollyToCursor?(f.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case P.ROTATE:{this._rotateInternal(f.deltaX,f.deltaY),this._isUserControllingRotate=!0;break}case P.TRUCK:{this._truckInternal(f.deltaX,f.deltaY,!1),this._isUserControllingTruck=!0;break}case P.OFFSET:{this._truckInternal(f.deltaX,f.deltaY,!0),this._isUserControllingOffset=!0;break}case P.DOLLY:{this._dollyInternal(-g,_,N),this._isUserControllingDolly=!0;break}case P.ZOOM:{this._zoomInternal(-g,_,N),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},p=f=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===nt.ACTION.NONE){const m=f instanceof PointerEvent?f.pointerId:(f instanceof MouseEvent,0),g=this._findPointerById(m);g&&this._disposePointer(g),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",E),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("mouseup",d);return}f.preventDefault()}},F=f=>{if(!this._enabled)return;if(qs(this._activePointers,rt),this._getClientRect(this._elementRect),s.copy(rt),i.copy(rt),this._activePointers.length>=2){const g=rt.x-this._activePointers[1].clientX,_=rt.y-this._activePointers[1].clientY,N=Math.sqrt(g*g+_*_);o.set(0,N);const y=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,L=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(y,L)}if(this._state=0,!f)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in f&&f.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&&(f.buttons&V.LEFT)===V.LEFT&&(this._state=this._state|this.mouseButtons.left),(f.buttons&V.MIDDLE)===V.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(f.buttons&V.RIGHT)===V.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&P.ROTATE)===P.ROTATE||(this._state&P.TOUCH_ROTATE)===P.TOUCH_ROTATE||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE||(this._state&P.TOUCH_ZOOM_ROTATE)===P.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&P.TRUCK)===P.TRUCK||(this._state&P.TOUCH_TRUCK)===P.TOUCH_TRUCK||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_ZOOM_TRUCK)===P.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&P.DOLLY)===P.DOLLY||(this._state&P.TOUCH_DOLLY)===P.TOUCH_DOLLY||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&P.ZOOM)===P.ZOOM||(this._state&P.TOUCH_ZOOM)===P.TOUCH_ZOOM||(this._state&P.TOUCH_ZOOM_TRUCK)===P.TOUCH_ZOOM_TRUCK||(this._state&P.TOUCH_ZOOM_OFFSET)===P.TOUCH_ZOOM_OFFSET||(this._state&P.TOUCH_ZOOM_ROTATE)===P.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&P.OFFSET)===P.OFFSET||(this._state&P.TOUCH_OFFSET)===P.TOUCH_OFFSET||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET||(this._state&P.TOUCH_ZOOM_OFFSET)===P.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},R=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,qs(this._activePointers,rt);const m=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,g=m?-m.deltaX:i.x-rt.x,_=m?-m.deltaY:i.y-rt.y;if(i.copy(rt),((this._state&P.ROTATE)===P.ROTATE||(this._state&P.TOUCH_ROTATE)===P.TOUCH_ROTATE||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE||(this._state&P.TOUCH_ZOOM_ROTATE)===P.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(g,_),this._isUserControllingRotate=!0),(this._state&P.DOLLY)===P.DOLLY||(this._state&P.ZOOM)===P.ZOOM){const N=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,y=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0,L=this.dollyDragInverted?-1:1;(this._state&P.DOLLY)===P.DOLLY?(this._dollyInternal(L*_*ts,N,y),this._isUserControllingDolly=!0):(this._zoomInternal(L*_*ts,N,y),this._isUserControllingZoom=!0)}if((this._state&P.TOUCH_DOLLY)===P.TOUCH_DOLLY||(this._state&P.TOUCH_ZOOM)===P.TOUCH_ZOOM||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_ZOOM_TRUCK)===P.TOUCH_ZOOM_TRUCK||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET||(this._state&P.TOUCH_ZOOM_OFFSET)===P.TOUCH_ZOOM_OFFSET||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE||(this._state&P.TOUCH_ZOOM_ROTATE)===P.TOUCH_ZOOM_ROTATE){const N=rt.x-this._activePointers[1].clientX,y=rt.y-this._activePointers[1].clientY,L=Math.sqrt(N*N+y*y),w=o.y-L;o.set(0,L);const M=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,U=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&P.TOUCH_DOLLY)===P.TOUCH_DOLLY||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET?(this._dollyInternal(w*ts,M,U),this._isUserControllingDolly=!0):(this._zoomInternal(w*ts,M,U),this._isUserControllingZoom=!0)}((this._state&P.TRUCK)===P.TRUCK||(this._state&P.TOUCH_TRUCK)===P.TOUCH_TRUCK||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_ZOOM_TRUCK)===P.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(g,_,!1),this._isUserControllingTruck=!0),((this._state&P.OFFSET)===P.OFFSET||(this._state&P.TOUCH_OFFSET)===P.TOUCH_OFFSET||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET||(this._state&P.TOUCH_ZOOM_OFFSET)===P.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(g,_,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},T=()=>{qs(this._activePointers,rt),i.copy(rt),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",l),this._domElement.ownerDocument.removeEventListener("pointerup",E),this._domElement.ownerDocument.removeEventListener("mouseup",d),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",E),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",A),this._domElement.ownerDocument.addEventListener("pointerlockerror",O),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",E),F())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",A),this._domElement.ownerDocument.removeEventListener("pointerlockerror",O))};const A=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},O=()=>{this.unlockPointer()};this._addAllEventListeners=f=>{this._domElement=f,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",n),pr&&this._domElement.addEventListener("mousedown",r),this._domElement.addEventListener("pointercancel",E),this._domElement.addEventListener("wheel",u,{passive:!1}),this._domElement.addEventListener("contextmenu",p)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",n),this._domElement.removeEventListener("mousedown",r),this._domElement.removeEventListener("pointercancel",E),this._domElement.removeEventListener("wheel",u,{passive:!1}),this._domElement.removeEventListener("contextmenu",p),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("pointerup",E),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.removeEventListener("pointerlockchange",A),this._domElement.ownerDocument.removeEventListener("pointerlockerror",O))},this.cancel=()=>{this._state!==P.NONE&&(this._state=P.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=pt(e.width,0,1),this._interactiveArea.height=pt(e.height,0,1),this._interactiveArea.x=pt(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=pt(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=pt(e,this.minAzimuthAngle,this.maxAzimuthAngle),o=pt(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=o,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,s||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const n=!s||H(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&H(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(n)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=ee.NONE,this._changedDolly=0,this._dollyToNoClamp(pt(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const s=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const n=this._collisionTest(),r=H(n,this._spherical.radius);if(!(s>e)&&r)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,n)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const o=!t||H(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(o)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Fe).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=pt(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=Y.copy(Rt).add(At),o=G.copy(this._targetEnd).add(i);return this.moveTo(o.x,o.y,o.z,s)}forward(e,t=!1){Y.setFromMatrixColumn(this._camera.matrix,0),Y.crossVectors(this._camera.up,Y),Y.multiplyScalar(e);const s=G.copy(this._targetEnd).add(Y);return this.moveTo(s.x,s.y,s.z,t)}elevate(e,t=!1){return Y.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+Y.x,this._targetEnd.y+Y.y,this._targetEnd.z+Y.z,t)}moveTo(e,t,s,i=!1){this._isUserControllingTruck=!1;const o=Y.set(e,t,s).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,o,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const n=!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(n)}lookInDirectionOf(e,t,s,i=!1){const r=Y.set(e,t,s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(r.x,r.y,r.z,i)}fitToBox(e,t,{cover:s=!1,paddingLeft:i=0,paddingRight:o=0,paddingBottom:n=0,paddingTop:r=0}={}){const a=[],l=e.isBox3?ne.copy(e):ne.setFromObject(e);l.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const E=Ji(this._sphericalEnd.theta,$i),d=Ji(this._sphericalEnd.phi,$i);a.push(this.rotateTo(E,d,t));const h=Y.setFromSpherical(this._sphericalEnd).normalize(),u=rn.setFromUnitVectors(h,$s),p=H(Math.abs(h.y),1);p&&u.multiply(ti.setFromAxisAngle(es,E)),u.multiply(this._yAxisUpSpaceInverse);const F=on.makeEmpty();G.copy(l.min).applyQuaternion(u),F.expandByPoint(G),G.copy(l.min).setX(l.max.x).applyQuaternion(u),F.expandByPoint(G),G.copy(l.min).setY(l.max.y).applyQuaternion(u),F.expandByPoint(G),G.copy(l.max).setZ(l.min.z).applyQuaternion(u),F.expandByPoint(G),G.copy(l.min).setZ(l.max.z).applyQuaternion(u),F.expandByPoint(G),G.copy(l.max).setY(l.min.y).applyQuaternion(u),F.expandByPoint(G),G.copy(l.max).setX(l.min.x).applyQuaternion(u),F.expandByPoint(G),G.copy(l.max).applyQuaternion(u),F.expandByPoint(G),F.min.x-=i,F.min.y-=n,F.max.x+=o,F.max.y+=r,u.setFromUnitVectors($s,h),p&&u.premultiply(ti.invert()),u.premultiply(this._yAxisUpSpace);const R=F.getSize(Y),T=F.getCenter(G).applyQuaternion(u);if(Yt(this._camera)){const A=this.getDistanceToFitBox(R.x,R.y,R.z,s);a.push(this.moveTo(T.x,T.y,T.z,t)),a.push(this.dollyTo(A,t)),a.push(this.setFocalOffset(0,0,0,t))}else if(Pt(this._camera)){const A=this._camera,O=A.right-A.left,f=A.top-A.bottom,m=s?Math.max(O/R.x,f/R.y):Math.min(O/R.x,f/R.y);a.push(this.moveTo(T.x,T.y,T.z,t)),a.push(this.zoomTo(m,t)),a.push(this.setFocalOffset(0,0,0,t))}return Promise.all(a)}fitToSphere(e,t){const s=[],o=e instanceof B.Sphere?Js.copy(e):nt.createBoundingSphere(e,Js);if(s.push(this.moveTo(o.center.x,o.center.y,o.center.z,t)),Yt(this._camera)){const n=this.getDistanceToFitSphere(o.radius);s.push(this.dollyTo(n,t))}else if(Pt(this._camera)){const n=this._camera.right-this._camera.left,r=this._camera.top-this._camera.bottom,a=2*o.radius,l=Math.min(n/a,r/a);s.push(this.zoomTo(l,t))}return s.push(this.setFocalOffset(0,0,0,t)),Promise.all(s)}setLookAt(e,t,s,i,o,n,r=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=ee.NONE,this._changedDolly=0;const a=G.set(i,o,n),l=Y.set(e,t,s);this._targetEnd.copy(a),this._sphericalEnd.setFromVector3(l.sub(a).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,r||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const E=!r||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(E)}lerpLookAt(e,t,s,i,o,n,r,a,l,E,d,h,u,p=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=ee.NONE,this._changedDolly=0;const F=Y.set(i,o,n),R=G.set(e,t,s);ht.setFromVector3(R.sub(F).applyQuaternion(this._yAxisUpSpace));const T=ie.set(E,d,h),A=G.set(r,a,l);Oe.setFromVector3(A.sub(T).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(F.lerp(T,u));const O=Oe.theta-ht.theta,f=Oe.phi-ht.phi,m=Oe.radius-ht.radius;this._sphericalEnd.set(ht.radius+m*u,ht.phi+f*u,ht.theta+O*u),this.normalizeRotations(),this._needsUpdate=!0,p||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const g=!p||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(g)}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 o=this.getPosition(Y),n=this.setLookAt(o.x,o.y,o.z,e,t,s,i);return this._sphericalEnd.phi=pt(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),n}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 o=!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(o)}setOrbitPoint(e,t,s){this._camera.updateMatrixWorld(),Rt.setFromMatrixColumn(this._camera.matrixWorldInverse,0),At.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Gt.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=Y.set(e,t,s),o=i.distanceTo(this._camera.position),n=i.sub(this._camera.position);Rt.multiplyScalar(n.x),At.multiplyScalar(n.y),Gt.multiplyScalar(n.z),Y.copy(Rt).add(At).add(Gt),Y.z=Y.z+o,this.dollyTo(o,!1),this.setFocalOffset(-Y.x,Y.y,-Y.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 B.Vector4,typeof e=="number"?this._viewport.set(e,t,s,i):this._viewport.copy(e)}getDistanceToFitBox(e,t,s,i=!1){if(Ks(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const o=e/t,n=this._camera.getEffectiveFOV()*me,r=this._camera.aspect;return((i?o>r:o<r)?t:e/r)*.5/Math.tan(n*.5)+s*.5}getDistanceToFitSphere(e){if(Ks(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*me,s=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,i=1<this._camera.aspect?t:s;return e/Math.sin(i*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new B.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new B.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e&&e instanceof B.Spherical?e:new B.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new B.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%se,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=se),this._spherical.theta+=se*Math.round((this._sphericalEnd.theta-this._spherical.theta)/se)}reset(e=!1){if(!H(this._camera.up.x,this._cameraUp0.x)||!H(this._camera.up.y,this._cameraUp0.y)||!H(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const s=this.getPosition(Y);this.updateCameraUp(),this.setPosition(s.x,s.y,s.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,es),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=Y.subVectors(this._target,this._camera.position).normalize(),t=G.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const s=this.getPosition(Y);this.updateCameraUp(),this.setPosition(s.x,s.y,s.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,s=this._sphericalEnd.phi-this._spherical.phi,i=this._sphericalEnd.radius-this._spherical.radius,o=sn.subVectors(this._targetEnd,this._target),n=nn.subVectors(this._focalOffsetEnd,this._focalOffset),r=this._zoomEnd-this._zoom;if(W(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Je(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,d,1/0,e),this._needsUpdate=!0}if(W(s))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Je(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,d,1/0,e),this._needsUpdate=!0}if(W(i))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const d=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Je(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,d,this.maxSpeed,e),this._needsUpdate=!0}if(W(o.x)&&W(o.y)&&W(o.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const d=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;tn(this._target,this._targetEnd,this._targetVelocity,d,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(W(n.x)&&W(n.y)&&W(n.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const d=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;tn(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,d,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(W(r))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const d=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Je(this._zoom,this._zoomEnd,this._zoomVelocity,d,1/0,e)}if(this.dollyToCursor){if(Yt(this._camera)&&this._changedDolly!==0){const d=this._spherical.radius-this._lastDistance,h=this._camera,u=this._getCameraDirection(Fe),p=Y.copy(u).cross(h.up).normalize();p.lengthSq()===0&&(p.x=1);const F=G.crossVectors(p,u),R=this._sphericalEnd.radius*Math.tan(h.getEffectiveFOV()*me*.5),A=(this._sphericalEnd.radius-d-this._sphericalEnd.radius)/this._sphericalEnd.radius,O=ie.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x*R*h.aspect)).add(F.multiplyScalar(this._dollyControlCoord.y*R)),f=Y.copy(this._targetEnd).lerp(O,A),m=this._lastDollyDirection===ee.IN&&this._spherical.radius<=this.minDistance,g=this._lastDollyDirection===ee.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(m||g)){this._sphericalEnd.radius-=d,this._spherical.radius-=d;const N=G.copy(u).multiplyScalar(-d);f.add(N)}this._boundary.clampPoint(f,f);const _=G.subVectors(f,this._targetEnd);this._targetEnd.copy(f),this._target.add(_),this._changedDolly-=d,W(this._changedDolly)&&(this._changedDolly=0)}else if(Pt(this._camera)&&this._changedZoom!==0){const d=this._zoom-this._lastZoom,h=this._camera,u=Y.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(h.near+h.far)/(h.near-h.far)).unproject(h),p=G.set(0,0,-1).applyQuaternion(h.quaternion),F=ie.copy(u).add(p.multiplyScalar(-u.dot(h.up))),T=-(this._zoom-d-this._zoom)/this._zoom,A=this._getCameraDirection(Fe),O=this._targetEnd.dot(A),f=Y.copy(this._targetEnd).lerp(F,T),m=f.dot(A),g=A.multiplyScalar(m-O);f.sub(g),this._boundary.clampPoint(f,f);const _=G.subVectors(f,this._targetEnd);this._targetEnd.copy(f),this._target.add(_),this._changedZoom-=d,W(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const a=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,a),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!W(this._focalOffset.x)||!W(this._focalOffset.y)||!W(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),Rt.setFromMatrixColumn(this._camera.matrix,0),At.setFromMatrixColumn(this._camera.matrix,1),Gt.setFromMatrixColumn(this._camera.matrix,2),Rt.multiplyScalar(this._focalOffset.x),At.multiplyScalar(-this._focalOffset.y),Gt.multiplyScalar(this._focalOffset.z),Y.copy(Rt).add(At).add(Gt),this._camera.position.add(Y)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),Y.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const E=this._needsUpdate;return E&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):E?(this.dispatchEvent({type:"update"}),W(t,this.restThreshold)&&W(s,this.restThreshold)&&W(i,this.restThreshold)&&W(o.x,this.restThreshold)&&W(o.y,this.restThreshold)&&W(o.z,this.restThreshold)&&W(n.x,this.restThreshold)&&W(n.y,this.restThreshold)&&W(n.z,this.restThreshold)&&W(r,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!E&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=E,this._needsUpdate=!1,E}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Re(this.maxDistance),minZoom:this.minZoom,maxZoom:Re(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Re(this.maxPolarAngle),minAzimuthAngle:Re(this.minAzimuthAngle),maxAzimuthAngle:Re(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,verticalDragToForward:this.verticalDragToForward,target:this._targetEnd.toArray(),position:Y.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){const s=JSON.parse(e);this.enabled=s.enabled,this.minDistance=s.minDistance,this.maxDistance=Ae(s.maxDistance),this.minZoom=s.minZoom,this.maxZoom=Ae(s.maxZoom),this.minPolarAngle=s.minPolarAngle,this.maxPolarAngle=Ae(s.maxPolarAngle),this.minAzimuthAngle=Ae(s.minAzimuthAngle),this.maxAzimuthAngle=Ae(s.maxAzimuthAngle),this.smoothTime=s.smoothTime,this.draggingSmoothTime=s.draggingSmoothTime,this.dollySpeed=s.dollySpeed,this.truckSpeed=s.truckSpeed,this.dollyToCursor=s.dollyToCursor,this.verticalDragToForward=s.verticalDragToForward,this._target0.fromArray(s.target0),this._position0.fromArray(s.position0),this._zoom0=s.zoom0,this._focalOffset0.fromArray(s.focalOffset0),this.moveTo(s.target[0],s.target[1],s.target[2],t),ht.setFromVector3(Y.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(ht.theta,ht.phi,t),this.dollyTo(ht.radius,t),this.zoomTo(s.zoom,t),this.setFocalOffset(s.focalOffset[0],s.focalOffset[1],s.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",Ir),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.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 o=G.copy(t).add(e),r=this._boundary.clampPoint(o,ie).sub(o),a=r.lengthSq();if(a===0)return e.add(t);if(a===i)return e;if(s===0)return e.add(t).add(r);{const l=1+s*a/t.dot(r);return e.add(G.copy(t).multiplyScalar(l)).add(r.multiplyScalar(1-s))}}_updateNearPlaneCorners(){if(Yt(this._camera)){const e=this._camera,t=e.near,s=e.getEffectiveFOV()*me,i=Math.tan(s*.5)*t,o=i*e.aspect;this._nearPlaneCorners[0].set(-o,-i,0),this._nearPlaneCorners[1].set(o,-i,0),this._nearPlaneCorners[2].set(o,i,0),this._nearPlaneCorners[3].set(-o,i,0)}else if(Pt(this._camera)){const e=this._camera,t=1/e.zoom,s=e.left*t,i=e.right*t,o=e.top*t,n=e.bottom*t;this._nearPlaneCorners[0].set(s,o,0),this._nearPlaneCorners[1].set(i,o,0),this._nearPlaneCorners[2].set(i,n,0),this._nearPlaneCorners[3].set(s,n,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Ks(this._camera,"_collisionTest"))return e;const s=this._getTargetDirection(Fe);ei.lookAt(en,s,this._camera.up);for(let i=0;i<4;i++){const o=G.copy(this._nearPlaneCorners[i]);o.applyMatrix4(ei);const n=ie.addVectors(this._target,o);ss.set(n,s),ss.far=this._spherical.radius+1;const r=ss.intersectObjects(this.colliderMeshes);r.length!==0&&r[0].distance<e&&(e=r[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{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 B.Sphere){const s=t,i=s.center;ne.makeEmpty(),e.traverseVisible(n=>{n.isMesh&&ne.expandByObject(n)}),ne.getCenter(i);let o=0;return e.traverseVisible(n=>{if(!n.isMesh)return;const r=n,a=r.geometry.clone();a.applyMatrix4(r.matrixWorld);const E=a.attributes.position;for(let d=0,h=E.count;d<h;d++)Y.fromBufferAttribute(E,d),o=Math.max(o,i.distanceToSquared(Y))}),s.radius=Math.sqrt(o),s}}class ce extends mn{constructor(t){super(t);I(this,"onBeforeUpdate",new D);I(this,"onAfterUpdate",new D);I(this,"onAspectUpdated",new D);I(this,"onDisposed",new D);I(this,"three");I(this,"_allControls",new Map);I(this,"updateAspect",()=>{var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof S.OrthographicCamera){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 o=this.newCameraControls();this._allControls.set(i.uuid,o)}if(s==="removed"){const o=this._allControls.get(i.uuid);o&&(o.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.currentWorld!==null&&(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 S.PerspectiveCamera(60,t,1,1e3);return s.position.set(50,50,50),s.lookAt(new S.Vector3(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!");nt.install({THREE:ce.getSubsetOfThree()});const{domElement:t}=this.currentWorld.renderer.three,s=new nt(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:S.MOUSE,Vector2:S.Vector2,Vector3:S.Vector3,Vector4:S.Vector4,Quaternion:S.Quaternion,Matrix4:S.Matrix4,Spherical:S.Spherical,Box3:S.Box3,Sphere:S.Sphere,Raycaster:S.Raycaster,MathUtils:S.MathUtils}}}const Ts=class Ts extends ${constructor(t){super(t);I(this,"onAfterUpdate",new D);I(this,"onBeforeUpdate",new D);I(this,"onDisposed",new D);I(this,"onWorldCreated",new D);I(this,"onWorldDeleted",new D);I(this,"list",new Map);I(this,"enabled",!0);t.add(Ts.uuid,this)}create(){const t=new _n(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){if(!this.list.has(t.uuid))throw new Error("The provided world is not found in the list!");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)}};I(Ts,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let Es=Ts;class Pn{constructor(e,t,s){I(this,"onDisposed",new D);I(this,"world");I(this,"components");I(this,"three");I(this,"_fade",3);I(this,"updateZoom",()=>{this.world.camera instanceof ce&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)});this.world=t;const{color:i,size1:o,size2:n,distance:r}=s;this.components=e;const a=new S.PlaneGeometry(2,2,1,1),l=new S.ShaderMaterial({side:S.DoubleSide,uniforms:{uSize1:{value:o},uSize2:{value:n},uColor:{value:i},uDistance:{value:r},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:`
|
|
11
11
|
|
|
12
12
|
varying vec3 worldPosition;
|
|
13
13
|
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
`,extensions:{derivatives:!0}});this.three=new S.Mesh(a,c),this.three.frustumCulled=!1,t.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(s){s?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(s){this._fade=s?3:0,this.material.uniforms.uFade.value=this._fade}dispose(){this.setupEvents(!1),this.components.get(_t).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(s){if(this.world.isDisposing||!(this.world.camera instanceof le))return;const t=this.world.camera.controls;s?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}const ms=class ms extends ${constructor(t){super(t);I(this,"list",new Map);I(this,"config",{color:new S.Color(12303291),size1:1,size2:10,distance:500});I(this,"onDisposed",new D);I(this,"enabled",!0);t.add(ms.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a grid!");const e=new pr(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(),this.onDisposed.reset()}};I(ms,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");let ui=ms;const Ht=new C.Raycaster,it=new C.Vector3,Pt=new C.Vector3,Q=new C.Quaternion,cn={X:new C.Vector3(1,0,0),Y:new C.Vector3(0,1,0),Z:new C.Vector3(0,0,1)},ei={type:"change"},ln={type:"mouseDown"},hn={type:"mouseUp",mode:null},En={type:"objectChange"};class Cr extends C.Object3D{constructor(s,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 e=new gr;this._gizmo=e,this.add(e);const i=new Or;this._plane=i,this.add(i);const o=this;function n(A,g){let f=g;Object.defineProperty(o,A,{get:function(){return f!==void 0?f:g},set:function(m){f!==m&&(f=m,i[A]=m,e[A]=m,o.dispatchEvent({type:A+"-changed",value:m}),o.dispatchEvent(ei))}}),o[A]=g,i[A]=g,e[A]=g}n("camera",s),n("object",void 0),n("enabled",!0),n("axis",null),n("mode","translate"),n("translationSnap",null),n("rotationSnap",null),n("scaleSnap",null),n("space","world"),n("size",1),n("dragging",!1),n("showX",!0),n("showY",!0),n("showZ",!0);const r=new C.Vector3,a=new C.Vector3,c=new C.Quaternion,h=new C.Quaternion,d=new C.Vector3,E=new C.Quaternion,u=new C.Vector3,p=new C.Vector3,F=new C.Vector3,R=0,T=new C.Vector3;n("worldPosition",r),n("worldPositionStart",a),n("worldQuaternion",c),n("worldQuaternionStart",h),n("cameraPosition",d),n("cameraQuaternion",E),n("pointStart",u),n("pointEnd",p),n("rotationAxis",F),n("rotationAngle",R),n("eye",T),this._offset=new C.Vector3,this._startNorm=new C.Vector3,this._endNorm=new C.Vector3,this._cameraScale=new C.Vector3,this._parentPosition=new C.Vector3,this._parentQuaternion=new C.Quaternion,this._parentQuaternionInv=new C.Quaternion,this._parentScale=new C.Vector3,this._worldScaleStart=new C.Vector3,this._worldQuaternionInv=new C.Quaternion,this._worldScale=new C.Vector3,this._positionStart=new C.Vector3,this._quaternionStart=new C.Quaternion,this._scaleStart=new C.Vector3,this._getPointer=Tr.bind(this),this._onPointerDown=Rr.bind(this),this._onPointerHover=mr.bind(this),this._onPointerMove=Ar.bind(this),this._onPointerUp=Fr.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(s){if(this.object===void 0||this.dragging===!0)return;Ht.setFromCamera(s,this.camera);const t=si(this._gizmo.picker[this.mode],Ht);t?this.axis=t.object.name:this.axis=null}pointerDown(s){if(!(this.object===void 0||this.dragging===!0||s.button!==0)&&this.axis!==null){Ht.setFromCamera(s,this.camera);const t=si(this._plane,Ht,!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,ln.mode=this.mode,this.dispatchEvent(ln)}}pointerMove(s){const t=this.axis,e=this.mode,i=this.object;let o=this.space;if(e==="scale"?o="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(o="world"),i===void 0||t===null||this.dragging===!1||s.button!==-1)return;Ht.setFromCamera(s,this.camera);const n=si(this._plane,Ht,!0);if(n){if(this.pointEnd.copy(n.point).sub(this.worldPositionStart),e==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),o==="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),o==="local"&&t!=="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&&(o==="local"&&(i.position.applyQuaternion(Q.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),o==="world"&&(i.parent&&i.position.add(it.setFromMatrixPosition(i.parent.matrixWorld)),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(it.setFromMatrixPosition(i.parent.matrixWorld))));else if(e==="scale"){if(t.search("XYZ")!==-1){let r=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(r*=-1),Pt.set(r,r,r)}else it.copy(this.pointStart),Pt.copy(this.pointEnd),it.applyQuaternion(this._worldQuaternionInv),Pt.applyQuaternion(this._worldQuaternionInv),Pt.divide(it),t.search("X")===-1&&(Pt.x=1),t.search("Y")===-1&&(Pt.y=1),t.search("Z")===-1&&(Pt.z=1);i.scale.copy(this._scaleStart).multiply(Pt),this.scaleSnap&&(t.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(e==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const r=20/this.worldPosition.distanceTo(it.setFromMatrixPosition(this.camera.matrixWorld));let a=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(it.copy(this.rotationAxis).cross(this.eye))*r):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(cn[t]),it.copy(cn[t]),o==="local"&&it.applyQuaternion(this.worldQuaternion),it.cross(this.eye),it.length()===0?a=!0:this.rotationAngle=this._offset.dot(it.normalize())*r),(t==="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),o==="local"&&t!=="E"&&t!=="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(ei),this.dispatchEvent(En)}}pointerUp(s){s.button===0&&(this.dragging&&this.axis!==null&&(hn.mode=this.mode,this.dispatchEvent(hn)),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(s){s.geometry&&s.geometry.dispose(),s.material&&s.material.dispose()})}attach(s){return this.object=s,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(ei),this.dispatchEvent(En),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Ht}getMode(){return this.mode}setMode(s){this.mode=s}setTranslationSnap(s){this.translationSnap=s}setRotationSnap(s){this.rotationSnap=s}setScaleSnap(s){this.scaleSnap=s}setSize(s){this.size=s}setSpace(s){this.space=s}}function Tr(l){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:l.button};{const s=this.domElement.getBoundingClientRect();return{x:(l.clientX-s.left)/s.width*2-1,y:-(l.clientY-s.top)/s.height*2+1,button:l.button}}}function mr(l){if(this.enabled)switch(l.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(l));break}}function Rr(l){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(l.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(l)),this.pointerDown(this._getPointer(l)))}function Ar(l){this.enabled&&this.pointerMove(this._getPointer(l))}function Fr(l){this.enabled&&(this.domElement.releasePointerCapture(l.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(l)))}function si(l,s,t){const e=s.intersectObject(l,!0);for(let i=0;i<e.length;i++)if(e[i].object.visible||t)return e[i];return!1}const is=new C.Euler,k=new C.Vector3(0,1,0),dn=new C.Vector3(0,0,0),un=new C.Matrix4,ns=new C.Quaternion,cs=new C.Quaternion,Ft=new C.Vector3,In=new C.Matrix4,Ne=new C.Vector3(1,0,0),kt=new C.Vector3(0,1,0),Pe=new C.Vector3(0,0,1),os=new C.Vector3,Se=new C.Vector3,_e=new C.Vector3;class gr extends C.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const s=new C.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new C.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=s.clone();e.opacity=.15;const i=t.clone();i.opacity=.5;const o=s.clone();o.color.setHex(16711680);const n=s.clone();n.color.setHex(65280);const r=s.clone();r.color.setHex(255);const a=s.clone();a.color.setHex(16711680),a.opacity=.5;const c=s.clone();c.color.setHex(65280),c.opacity=.5;const h=s.clone();h.color.setHex(255),h.opacity=.5;const d=s.clone();d.opacity=.25;const E=s.clone();E.color.setHex(16776960),E.opacity=.25,s.clone().color.setHex(16776960);const p=s.clone();p.color.setHex(7895160);const F=new C.CylinderGeometry(0,.04,.1,12);F.translate(0,.05,0);const R=new C.BoxGeometry(.08,.08,.08);R.translate(0,.04,0);const T=new C.BufferGeometry;T.setAttribute("position",new C.Float32BufferAttribute([0,0,0,1,0,0],3));const A=new C.CylinderGeometry(.0075,.0075,.5,3);A.translate(0,.25,0);function g(v,z){const j=new C.TorusGeometry(v,.0075,3,64,z*Math.PI*2);return j.rotateY(Math.PI/2),j.rotateX(Math.PI/2),j}function f(){const v=new C.BufferGeometry;return v.setAttribute("position",new C.Float32BufferAttribute([0,0,0,1,1,1],3)),v}const m={X:[[new C.Mesh(F,o),[.5,0,0],[0,0,-Math.PI/2]],[new C.Mesh(F,o),[-.5,0,0],[0,0,Math.PI/2]],[new C.Mesh(A,o),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new C.Mesh(F,n),[0,.5,0]],[new C.Mesh(F,n),[0,-.5,0],[Math.PI,0,0]],[new C.Mesh(A,n)]],Z:[[new C.Mesh(F,r),[0,0,.5],[Math.PI/2,0,0]],[new C.Mesh(F,r),[0,0,-.5],[-Math.PI/2,0,0]],[new C.Mesh(A,r),null,[Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.OctahedronGeometry(.1,0),d.clone()),[0,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),a.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},O={X:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[.3,0,0],[0,0,-Math.PI/2]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,.3,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,-.3,0],[0,0,Math.PI]]],Z:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,.3],[Math.PI/2,0,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.OctahedronGeometry(.2,0),e)]],XY:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,0,.15],[-Math.PI/2,0,0]]]},_={START:[[new C.Mesh(new C.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new C.Mesh(new C.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new C.Line(f(),i),null,null,null,"helper"]],X:[[new C.Line(T,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new C.Line(T,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new C.Line(T,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},N={XYZE:[[new C.Mesh(g(.5,1),p),null,[0,Math.PI/2,0]]],X:[[new C.Mesh(g(.5,.5),o)]],Y:[[new C.Mesh(g(.5,.5),n),null,[0,0,-Math.PI/2]]],Z:[[new C.Mesh(g(.5,.5),r),null,[0,Math.PI/2,0]]],E:[[new C.Mesh(g(.75,1),E),null,[0,Math.PI/2,0]]]},P={AXIS:[[new C.Line(T,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},L={XYZE:[[new C.Mesh(new C.SphereGeometry(.25,10,8),e)]],X:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),e),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),e),[0,0,0],[Math.PI/2,0,0]]],Z:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),e),[0,0,0],[0,0,-Math.PI/2]]],E:[[new C.Mesh(new C.TorusGeometry(.75,.1,2,24),e)]]},w={X:[[new C.Mesh(R,o),[.5,0,0],[0,0,-Math.PI/2]],[new C.Mesh(A,o),[0,0,0],[0,0,-Math.PI/2]],[new C.Mesh(R,o),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(R,n),[0,.5,0]],[new C.Mesh(A,n)],[new C.Mesh(R,n),[0,-.5,0],[0,0,Math.PI]]],Z:[[new C.Mesh(R,r),[0,0,.5],[Math.PI/2,0,0]],[new C.Mesh(A,r),[0,0,0],[Math.PI/2,0,0]],[new C.Mesh(R,r),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.BoxGeometry(.1,.1,.1),d.clone())]]},M={X:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[.3,0,0],[0,0,-Math.PI/2]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,.3,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,-.3,0],[0,0,Math.PI]]],Z:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,.3],[Math.PI/2,0,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.2),e),[0,0,0]]]},x={X:[[new C.Line(T,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new C.Line(T,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new C.Line(T,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function b(v){const z=new C.Object3D;for(const j in v)for(let et=v[j].length;et--;){const Z=v[j][et][0].clone(),vt=v[j][et][1],Bt=v[j][et][2],Vt=v[j][et][3],xe=v[j][et][4];Z.name=j,Z.tag=xe,vt&&Z.position.set(vt[0],vt[1],vt[2]),Bt&&Z.rotation.set(Bt[0],Bt[1],Bt[2]),Vt&&Z.scale.set(Vt[0],Vt[1],Vt[2]),Z.updateMatrix();const de=Z.geometry.clone();de.applyMatrix4(Z.matrix),Z.geometry=de,Z.renderOrder=1/0,Z.position.set(0,0,0),Z.rotation.set(0,0,0),Z.scale.set(1,1,1),z.add(Z)}return z}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=b(m)),this.add(this.gizmo.rotate=b(N)),this.add(this.gizmo.scale=b(w)),this.add(this.picker.translate=b(O)),this.add(this.picker.rotate=b(L)),this.add(this.picker.scale=b(M)),this.add(this.helper.translate=b(_)),this.add(this.helper.rotate=b(P)),this.add(this.helper.scale=b(x)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(s){const e=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:cs;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let o=0;o<i.length;o++){const n=i[o];n.visible=!0,n.rotation.set(0,0,0),n.position.copy(this.worldPosition);let r;if(this.camera.isOrthographicCamera?r=(this.camera.top-this.camera.bottom)/this.camera.zoom:r=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),n.scale.set(1,1,1).multiplyScalar(r*this.size/4),n.tag==="helper"){n.visible=!1,n.name==="AXIS"?(n.visible=!!this.axis,this.axis==="X"&&(Q.setFromEuler(is.set(0,0,0)),n.quaternion.copy(e).multiply(Q),Math.abs(k.copy(Ne).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Y"&&(Q.setFromEuler(is.set(0,0,Math.PI/2)),n.quaternion.copy(e).multiply(Q),Math.abs(k.copy(kt).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Z"&&(Q.setFromEuler(is.set(0,Math.PI/2,0)),n.quaternion.copy(e).multiply(Q),Math.abs(k.copy(Pe).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="XYZE"&&(Q.setFromEuler(is.set(0,Math.PI/2,0)),k.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(un.lookAt(dn,k,kt)),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),it.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),it.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(it),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(Ne).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(kt).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(Pe).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(Pe).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(Ne).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(kt).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)):this.mode==="rotate"&&(ns.copy(e),k.copy(this.eye).applyQuaternion(Q.copy(e).invert()),n.name.search("E")!==-1&&n.quaternion.setFromRotationMatrix(un.lookAt(this.eye,dn,kt)),n.name==="X"&&(Q.setFromAxisAngle(Ne,Math.atan2(-k.y,k.z)),Q.multiplyQuaternions(ns,Q),n.quaternion.copy(Q)),n.name==="Y"&&(Q.setFromAxisAngle(kt,Math.atan2(k.x,k.z)),Q.multiplyQuaternions(ns,Q),n.quaternion.copy(Q)),n.name==="Z"&&(Q.setFromAxisAngle(Pe,Math.atan2(k.y,k.x)),Q.multiplyQuaternions(ns,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(a){return n.name===a}))&&(n.material.color.setHex(16776960),n.material.opacity=1)}super.updateMatrixWorld(s)}}class Or extends C.Mesh{constructor(){super(new C.PlaneGeometry(1e5,1e5,2,2),new C.MeshBasicMaterial({visible:!1,wireframe:!0,side:C.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(s){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),os.copy(Ne).applyQuaternion(t==="local"?this.worldQuaternion:cs),Se.copy(kt).applyQuaternion(t==="local"?this.worldQuaternion:cs),_e.copy(Pe).applyQuaternion(t==="local"?this.worldQuaternion:cs),k.copy(Se),this.mode){case"translate":case"scale":switch(this.axis){case"X":k.copy(this.eye).cross(os),Ft.copy(os).cross(k);break;case"Y":k.copy(this.eye).cross(Se),Ft.copy(Se).cross(k);break;case"Z":k.copy(this.eye).cross(_e),Ft.copy(_e).cross(k);break;case"XY":Ft.copy(_e);break;case"YZ":Ft.copy(os);break;case"XZ":k.copy(_e),Ft.copy(Se);break;case"XYZ":case"E":Ft.set(0,0,0);break}break;case"rotate":default:Ft.set(0,0,0)}Ft.length()===0?this.quaternion.copy(this.cameraQuaternion):(In.lookAt(it.set(0,0,0),Ft,k),this.quaternion.setFromRotationMatrix(In)),super.updateMatrixWorld(s)}}class ws{constructor(s,t,e,i,o,n=5,r=!0){I(this,"onDraggingStarted",new D);I(this,"onDraggingEnded",new D);I(this,"onDisposed",new D);I(this,"normal");I(this,"origin");I(this,"three",new S.Plane);I(this,"components");I(this,"world");I(this,"_helper");I(this,"_visible",!0);I(this,"_enabled",!0);I(this,"_controlsActive",!1);I(this,"_arrowBoundBox",new S.Mesh);I(this,"_planeMesh");I(this,"_controls");I(this,"_hiddenMaterial",new S.MeshBasicMaterial({visible:!1}));I(this,"update",()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)});I(this,"changeDrag",s=>{this._visible=!s.value,this.preventCameraMovement(),this.notifyDraggingChanged(s)});if(this.components=s,this.world=t,!t.renderer)throw new Error("The given world must have a renderer!");this.normal=i,this.origin=e,t.renderer.setPlane(!0,this.three),this._planeMesh=ws.newPlaneMesh(n,o),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(i,e),r&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(s){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=s,this.world.renderer.setPlane(s,this.three)}get visible(){return this._visible}set visible(s){this._visible=s,this._controls.visible=s,this._helper.visible=s,this.toggleControls(s)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(s){this._planeMesh.material=s}get size(){return this._planeMesh.scale.x}set size(s){this._planeMesh.scale.set(s,s,s)}get helper(){return this._helper}setFromNormalAndCoplanarPoint(s,t){this.reset(),this.normal.equals(s)||(this.normal.copy(s),this._helper.lookAt(s)),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 s=new S.Vector3(1,0,0),t=new S.Vector3;this.normal.equals(s)||(this.normal.copy(s),this._helper.lookAt(s)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix()}toggleControls(s){if(s){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=s}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const s=this.world.camera.three,t=this.world.renderer.three.domElement,e=new Cr(s,t);return this.initializeControls(e),this.world.scene.three.add(e),e}initializeControls(s){s.attach(this._helper),s.showX=!1,s.showY=!1,s.setSpace("local"),this.createArrowBoundingBox(),s.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new S.CylinderGeometry(.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(s){s.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const s=new S.Object3D;return s.lookAt(this.normal),s.position.copy(this.origin),this._planeMesh.position.z+=.01,s.add(this._planeMesh),this.world.scene.three.add(s),s}static newPlaneMesh(s,t){const e=new S.PlaneGeometry(1),i=new S.Mesh(e,t);return i.scale.set(s,s,s),i}}const Me=class Me extends ${constructor(t){super(t);I(this,"onBeforeDrag",new D);I(this,"onAfterDrag",new D);I(this,"onBeforeCreate",new D);I(this,"onBeforeCancel",new D);I(this,"onAfterCancel",new D);I(this,"onBeforeDelete",new D);I(this,"onAfterCreate",new D);I(this,"onAfterDelete",new D);I(this,"onDisposed",new D);I(this,"orthogonalY",!1);I(this,"toleranceOrthogonalY",.7);I(this,"Type",ws);I(this,"list",[]);I(this,"_material",new S.MeshBasicMaterial({color:12255487,side:S.DoubleSide,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(Me.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(Me.uuid),this.onDisposed.reset()}create(t){if(!this.enabled)return;const o=this.components.get(ce).get(t).castRay();o&&this.createPlaneFromIntersection(t,o)}createFromNormalAndCoplanarPoint(t,e,i){const o=this.newPlane(t,i,e);return this.updateMaterialsAndPlanes(),o}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 i=this.components.get(ce).get(t),o=this.getAllPlaneMeshes(),n=i.castRay(o);if(n){const r=n.object;return this.list.find(a=>a.meshes.includes(r))}}getAllPlaneMeshes(){const t=[];for(const e of this.list)t.push(...e.meshes);return t}createPlaneFromIntersection(t,e){var a;if(!t.renderer)throw new Error("The given world must have a renderer!");const i=e.point.distanceTo(new S.Vector3(0,0,0)),o=(a=e.face)==null?void 0:a.normal;if(!i||!o)return;const n=this.getWorldNormal(e,o),r=this.newPlane(t,e.point,n.negate());r.visible=this._visible,r.size=this._size,t.renderer.setPlane(!0,r.three),this.updateMaterialsAndPlanes()}getWorldNormal(t,e){const i=t.object;let o=t.object.matrixWorld.clone();if(i instanceof S.InstancedMesh&&t.instanceId!==void 0){const c=new S.Matrix4;i.getMatrixAt(t.instanceId,c),o=c.multiply(o)}const r=new S.Matrix3().getNormalMatrix(o),a=e.clone().applyMatrix3(r).normalize();return this.normalizePlaneDirectionY(a),a}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,i){const o=new this.Type(this.components,t,e,i,this._material);return o.onDraggingStarted.add(this._onStartDragging),o.onDraggingEnded.add(this._onEndDragging),this.list.push(o),this.onAfterCreate.trigger(o),o}updateMaterialsAndPlanes(){const t=this.components.get(Es);for(const[e,i]of t.list){if(!i.renderer)continue;i.renderer.updateClippingPlanes();const{clippingPlanes:o}=i.renderer;for(const n of i.meshes)if(Array.isArray(n.material))for(const r of n.material)r.clippingPlanes=o;else n.material.clippingPlanes=o}}};I(Me,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let Ii=Me;function Sr(l,s,t,e){return new Promise((i,o)=>{function n(){const r=l.clientWaitSync(s,t,0);if(r===l.WAIT_FAILED){o();return}if(r===l.TIMEOUT_EXPIRED){setTimeout(n,e);return}i()}n()})}async function _r(l,s,t,e,i,o,n){const r=l.fenceSync(l.SYNC_GPU_COMMANDS_COMPLETE,0);l.flush(),await Sr(l,r,0,10),l.deleteSync(r),l.bindBuffer(s,t),l.getBufferSubData(s,e,i,o,n),l.bindBuffer(s,null)}async function Pn(l,s,t,e,i,o,n,r){const a=l.createBuffer();return l.bindBuffer(l.PIXEL_PACK_BUFFER,a),l.bufferData(l.PIXEL_PACK_BUFFER,r.byteLength,l.STREAM_READ),l.readPixels(s,t,e,i,o,n,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),await _r(l,l.PIXEL_PACK_BUFFER,a,0,r),l.deleteBuffer(a),r}class yn{constructor(s,t,e){I(this,"onDisposed",new D);I(this,"onViewUpdated",new Ut);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 S.Scene);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 s=>{if(!this.enabled||!this.needsUpdate&&!s||this._isWorkerBusy)return;this._isWorkerBusy=!0;const t=this.world.camera.three;t.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,t);const e=this.renderer.getContext();await Pn(e,0,0,this._width,this._height,e.RGBA,e.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,t),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1});if(!t.renderer)throw new Error("The given world must have a renderer!");this.components=s,this.applySettings(e),this.world=t,this.renderer=new S.WebGLRenderer,this.renderTarget=new S.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const i=`
|
|
71
|
+
`,extensions:{derivatives:!0}});this.three=new S.Mesh(a,l),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}dispose(){this.setupEvents(!1),this.components.get(_t).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 ce))return;const t=this.world.camera.controls;e?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}const ms=class ms extends ${constructor(t){super(t);I(this,"list",new Map);I(this,"config",{color:new S.Color(12303291),size1:1,size2:10,distance:500});I(this,"onDisposed",new D);I(this,"enabled",!0);t.add(ms.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a grid!");const s=new Pn(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()}};I(ms,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");let Ii=ms;const zt=new C.Raycaster,it=new C.Vector3,yt=new C.Vector3,Q=new C.Quaternion,an={X:new C.Vector3(1,0,0),Y:new C.Vector3(0,1,0),Z:new C.Vector3(0,0,1)},si={type:"change"},cn={type:"mouseDown"},ln={type:"mouseUp",mode:null},hn={type:"objectChange"};class Cr extends C.Object3D{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 s=new Or;this._gizmo=s,this.add(s);const i=new gr;this._plane=i,this.add(i);const o=this;function n(A,O){let f=O;Object.defineProperty(o,A,{get:function(){return f!==void 0?f:O},set:function(m){f!==m&&(f=m,i[A]=m,s[A]=m,o.dispatchEvent({type:A+"-changed",value:m}),o.dispatchEvent(si))}}),o[A]=O,i[A]=O,s[A]=O}n("camera",e),n("object",void 0),n("enabled",!0),n("axis",null),n("mode","translate"),n("translationSnap",null),n("rotationSnap",null),n("scaleSnap",null),n("space","world"),n("size",1),n("dragging",!1),n("showX",!0),n("showY",!0),n("showZ",!0);const r=new C.Vector3,a=new C.Vector3,l=new C.Quaternion,E=new C.Quaternion,d=new C.Vector3,h=new C.Quaternion,u=new C.Vector3,p=new C.Vector3,F=new C.Vector3,R=0,T=new C.Vector3;n("worldPosition",r),n("worldPositionStart",a),n("worldQuaternion",l),n("worldQuaternionStart",E),n("cameraPosition",d),n("cameraQuaternion",h),n("pointStart",u),n("pointEnd",p),n("rotationAxis",F),n("rotationAngle",R),n("eye",T),this._offset=new C.Vector3,this._startNorm=new C.Vector3,this._endNorm=new C.Vector3,this._cameraScale=new C.Vector3,this._parentPosition=new C.Vector3,this._parentQuaternion=new C.Quaternion,this._parentQuaternionInv=new C.Quaternion,this._parentScale=new C.Vector3,this._worldScaleStart=new C.Vector3,this._worldQuaternionInv=new C.Quaternion,this._worldScale=new C.Vector3,this._positionStart=new C.Vector3,this._quaternionStart=new C.Quaternion,this._scaleStart=new C.Vector3,this._getPointer=Tr.bind(this),this._onPointerDown=Rr.bind(this),this._onPointerHover=mr.bind(this),this._onPointerMove=Ar.bind(this),this._onPointerUp=Fr.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;zt.setFromCamera(e,this.camera);const t=ii(this._gizmo.picker[this.mode],zt);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){zt.setFromCamera(e,this.camera);const t=ii(this._plane,zt,!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,cn.mode=this.mode,this.dispatchEvent(cn)}}pointerMove(e){const t=this.axis,s=this.mode,i=this.object;let o=this.space;if(s==="scale"?o="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(o="world"),i===void 0||t===null||this.dragging===!1||e.button!==-1)return;zt.setFromCamera(e,this.camera);const n=ii(this._plane,zt,!0);if(n){if(this.pointEnd.copy(n.point).sub(this.worldPositionStart),s==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),o==="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),o==="local"&&t!=="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&&(o==="local"&&(i.position.applyQuaternion(Q.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),o==="world"&&(i.parent&&i.position.add(it.setFromMatrixPosition(i.parent.matrixWorld)),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(it.setFromMatrixPosition(i.parent.matrixWorld))));else if(s==="scale"){if(t.search("XYZ")!==-1){let r=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(r*=-1),yt.set(r,r,r)}else it.copy(this.pointStart),yt.copy(this.pointEnd),it.applyQuaternion(this._worldQuaternionInv),yt.applyQuaternion(this._worldQuaternionInv),yt.divide(it),t.search("X")===-1&&(yt.x=1),t.search("Y")===-1&&(yt.y=1),t.search("Z")===-1&&(yt.z=1);i.scale.copy(this._scaleStart).multiply(yt),this.scaleSnap&&(t.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.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(it.setFromMatrixPosition(this.camera.matrixWorld));let a=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(it.copy(this.rotationAxis).cross(this.eye))*r):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(an[t]),it.copy(an[t]),o==="local"&&it.applyQuaternion(this.worldQuaternion),it.cross(this.eye),it.length()===0?a=!0:this.rotationAngle=this._offset.dot(it.normalize())*r),(t==="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),o==="local"&&t!=="E"&&t!=="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(si),this.dispatchEvent(hn)}}pointerUp(e){e.button===0&&(this.dragging&&this.axis!==null&&(ln.mode=this.mode,this.dispatchEvent(ln)),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(si),this.dispatchEvent(hn),this.pointStart.copy(this.pointEnd))}getRaycaster(){return zt}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 Tr(c){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:c.button};{const e=this.domElement.getBoundingClientRect();return{x:(c.clientX-e.left)/e.width*2-1,y:-(c.clientY-e.top)/e.height*2+1,button:c.button}}}function mr(c){if(this.enabled)switch(c.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(c));break}}function Rr(c){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(c.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(c)),this.pointerDown(this._getPointer(c)))}function Ar(c){this.enabled&&this.pointerMove(this._getPointer(c))}function Fr(c){this.enabled&&(this.domElement.releasePointerCapture(c.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(c)))}function ii(c,e,t){const s=e.intersectObject(c,!0);for(let i=0;i<s.length;i++)if(s[i].object.visible||t)return s[i];return!1}const is=new C.Euler,k=new C.Vector3(0,1,0),En=new C.Vector3(0,0,0),dn=new C.Matrix4,ns=new C.Quaternion,cs=new C.Quaternion,Ft=new C.Vector3,un=new C.Matrix4,_e=new C.Vector3(1,0,0),Ht=new C.Vector3(0,1,0),Ne=new C.Vector3(0,0,1),os=new C.Vector3,ge=new C.Vector3,Se=new C.Vector3;class Or extends C.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new C.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new C.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=e.clone();s.opacity=.15;const i=t.clone();i.opacity=.5;const o=e.clone();o.color.setHex(16711680);const n=e.clone();n.color.setHex(65280);const r=e.clone();r.color.setHex(255);const a=e.clone();a.color.setHex(16711680),a.opacity=.5;const l=e.clone();l.color.setHex(65280),l.opacity=.5;const E=e.clone();E.color.setHex(255),E.opacity=.5;const d=e.clone();d.opacity=.25;const h=e.clone();h.color.setHex(16776960),h.opacity=.25,e.clone().color.setHex(16776960);const p=e.clone();p.color.setHex(7895160);const F=new C.CylinderGeometry(0,.04,.1,12);F.translate(0,.05,0);const R=new C.BoxGeometry(.08,.08,.08);R.translate(0,.04,0);const T=new C.BufferGeometry;T.setAttribute("position",new C.Float32BufferAttribute([0,0,0,1,0,0],3));const A=new C.CylinderGeometry(.0075,.0075,.5,3);A.translate(0,.25,0);function O(v,z){const j=new C.TorusGeometry(v,.0075,3,64,z*Math.PI*2);return j.rotateY(Math.PI/2),j.rotateX(Math.PI/2),j}function f(){const v=new C.BufferGeometry;return v.setAttribute("position",new C.Float32BufferAttribute([0,0,0,1,1,1],3)),v}const m={X:[[new C.Mesh(F,o),[.5,0,0],[0,0,-Math.PI/2]],[new C.Mesh(F,o),[-.5,0,0],[0,0,Math.PI/2]],[new C.Mesh(A,o),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new C.Mesh(F,n),[0,.5,0]],[new C.Mesh(F,n),[0,-.5,0],[Math.PI,0,0]],[new C.Mesh(A,n)]],Z:[[new C.Mesh(F,r),[0,0,.5],[Math.PI/2,0,0]],[new C.Mesh(F,r),[0,0,-.5],[-Math.PI/2,0,0]],[new C.Mesh(A,r),null,[Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.OctahedronGeometry(.1,0),d.clone()),[0,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),E.clone()),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),a.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),l.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},g={X:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.OctahedronGeometry(.2,0),s)]],XY:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]},_={START:[[new C.Mesh(new C.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new C.Mesh(new C.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new C.Line(f(),i),null,null,null,"helper"]],X:[[new C.Line(T,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new C.Line(T,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new C.Line(T,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},N={XYZE:[[new C.Mesh(O(.5,1),p),null,[0,Math.PI/2,0]]],X:[[new C.Mesh(O(.5,.5),o)]],Y:[[new C.Mesh(O(.5,.5),n),null,[0,0,-Math.PI/2]]],Z:[[new C.Mesh(O(.5,.5),r),null,[0,Math.PI/2,0]]],E:[[new C.Mesh(O(.75,1),h),null,[0,Math.PI/2,0]]]},y={AXIS:[[new C.Line(T,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},L={XYZE:[[new C.Mesh(new C.SphereGeometry(.25,10,8),s)]],X:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new C.Mesh(new C.TorusGeometry(.75,.1,2,24),s)]]},w={X:[[new C.Mesh(R,o),[.5,0,0],[0,0,-Math.PI/2]],[new C.Mesh(A,o),[0,0,0],[0,0,-Math.PI/2]],[new C.Mesh(R,o),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(R,n),[0,.5,0]],[new C.Mesh(A,n)],[new C.Mesh(R,n),[0,-.5,0],[0,0,Math.PI]]],Z:[[new C.Mesh(R,r),[0,0,.5],[Math.PI/2,0,0]],[new C.Mesh(A,r),[0,0,0],[Math.PI/2,0,0]],[new C.Mesh(R,r),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),E),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),l),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.BoxGeometry(.1,.1,.1),d.clone())]]},M={X:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.2),s),[0,0,0]]]},U={X:[[new C.Line(T,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new C.Line(T,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new C.Line(T,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function x(v){const z=new C.Object3D;for(const j in v)for(let et=v[j].length;et--;){const Z=v[j][et][0].clone(),bt=v[j][et][1],vt=v[j][et][2],Bt=v[j][et][3],xe=v[j][et][4];Z.name=j,Z.tag=xe,bt&&Z.position.set(bt[0],bt[1],bt[2]),vt&&Z.rotation.set(vt[0],vt[1],vt[2]),Bt&&Z.scale.set(Bt[0],Bt[1],Bt[2]),Z.updateMatrix();const Ee=Z.geometry.clone();Ee.applyMatrix4(Z.matrix),Z.geometry=Ee,Z.renderOrder=1/0,Z.position.set(0,0,0),Z.rotation.set(0,0,0),Z.scale.set(1,1,1),z.add(Z)}return z}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=x(m)),this.add(this.gizmo.rotate=x(N)),this.add(this.gizmo.scale=x(w)),this.add(this.picker.translate=x(g)),this.add(this.picker.rotate=x(L)),this.add(this.picker.scale=x(M)),this.add(this.helper.translate=x(_)),this.add(this.helper.rotate=x(y)),this.add(this.helper.scale=x(U)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const s=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:cs;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let o=0;o<i.length;o++){const n=i[o];n.visible=!0,n.rotation.set(0,0,0),n.position.copy(this.worldPosition);let r;if(this.camera.isOrthographicCamera?r=(this.camera.top-this.camera.bottom)/this.camera.zoom:r=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),n.scale.set(1,1,1).multiplyScalar(r*this.size/4),n.tag==="helper"){n.visible=!1,n.name==="AXIS"?(n.visible=!!this.axis,this.axis==="X"&&(Q.setFromEuler(is.set(0,0,0)),n.quaternion.copy(s).multiply(Q),Math.abs(k.copy(_e).applyQuaternion(s).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Y"&&(Q.setFromEuler(is.set(0,0,Math.PI/2)),n.quaternion.copy(s).multiply(Q),Math.abs(k.copy(Ht).applyQuaternion(s).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Z"&&(Q.setFromEuler(is.set(0,Math.PI/2,0)),n.quaternion.copy(s).multiply(Q),Math.abs(k.copy(Ne).applyQuaternion(s).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="XYZE"&&(Q.setFromEuler(is.set(0,Math.PI/2,0)),k.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(dn.lookAt(En,k,Ht)),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),it.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),it.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(it),n.visible=this.dragging):(n.quaternion.copy(s),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(s),this.mode==="translate"||this.mode==="scale"?(n.name==="X"&&Math.abs(k.copy(_e).applyQuaternion(s).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Y"&&Math.abs(k.copy(Ht).applyQuaternion(s).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Z"&&Math.abs(k.copy(Ne).applyQuaternion(s).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XY"&&Math.abs(k.copy(Ne).applyQuaternion(s).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="YZ"&&Math.abs(k.copy(_e).applyQuaternion(s).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XZ"&&Math.abs(k.copy(Ht).applyQuaternion(s).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)):this.mode==="rotate"&&(ns.copy(s),k.copy(this.eye).applyQuaternion(Q.copy(s).invert()),n.name.search("E")!==-1&&n.quaternion.setFromRotationMatrix(dn.lookAt(this.eye,En,Ht)),n.name==="X"&&(Q.setFromAxisAngle(_e,Math.atan2(-k.y,k.z)),Q.multiplyQuaternions(ns,Q),n.quaternion.copy(Q)),n.name==="Y"&&(Q.setFromAxisAngle(Ht,Math.atan2(k.x,k.z)),Q.multiplyQuaternions(ns,Q),n.quaternion.copy(Q)),n.name==="Z"&&(Q.setFromAxisAngle(Ne,Math.atan2(k.y,k.x)),Q.multiplyQuaternions(ns,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(a){return n.name===a}))&&(n.material.color.setHex(16776960),n.material.opacity=1)}super.updateMatrixWorld(e)}}class gr extends C.Mesh{constructor(){super(new C.PlaneGeometry(1e5,1e5,2,2),new C.MeshBasicMaterial({visible:!1,wireframe:!0,side:C.DoubleSide,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"),os.copy(_e).applyQuaternion(t==="local"?this.worldQuaternion:cs),ge.copy(Ht).applyQuaternion(t==="local"?this.worldQuaternion:cs),Se.copy(Ne).applyQuaternion(t==="local"?this.worldQuaternion:cs),k.copy(ge),this.mode){case"translate":case"scale":switch(this.axis){case"X":k.copy(this.eye).cross(os),Ft.copy(os).cross(k);break;case"Y":k.copy(this.eye).cross(ge),Ft.copy(ge).cross(k);break;case"Z":k.copy(this.eye).cross(Se),Ft.copy(Se).cross(k);break;case"XY":Ft.copy(Se);break;case"YZ":Ft.copy(os);break;case"XZ":k.copy(Se),Ft.copy(ge);break;case"XYZ":case"E":Ft.set(0,0,0);break}break;case"rotate":default:Ft.set(0,0,0)}Ft.length()===0?this.quaternion.copy(this.cameraQuaternion):(un.lookAt(it.set(0,0,0),Ft,k),this.quaternion.setFromRotationMatrix(un)),super.updateMatrixWorld(e)}}class ws{constructor(e,t,s,i,o,n=5,r=!0){I(this,"onDraggingStarted",new D);I(this,"onDraggingEnded",new D);I(this,"onDisposed",new D);I(this,"normal");I(this,"origin");I(this,"three",new S.Plane);I(this,"components");I(this,"world");I(this,"_helper");I(this,"_visible",!0);I(this,"_enabled",!0);I(this,"_controlsActive",!1);I(this,"_arrowBoundBox",new S.Mesh);I(this,"_planeMesh");I(this,"_controls");I(this,"_hiddenMaterial",new S.MeshBasicMaterial({visible:!1}));I(this,"update",()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)});I(this,"changeDrag",e=>{this._visible=!e.value,this.preventCameraMovement(),this.notifyDraggingChanged(e)});if(this.components=e,this.world=t,!t.renderer)throw new Error("The given world must have a renderer!");this.normal=i,this.origin=s,t.renderer.setPlane(!0,this.three),this._planeMesh=ws.newPlaneMesh(n,o),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(i,s),r&&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 S.Vector3(1,0,0),t=new S.Vector3;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,s=new Cr(e,t);return this.initializeControls(s),this.world.scene.three.add(s),s}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 S.CylinderGeometry(.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 S.Object3D;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 s=new S.PlaneGeometry(1),i=new S.Mesh(s,t);return i.scale.set(e,e,e),i}}const Me=class Me extends ${constructor(t){super(t);I(this,"onBeforeDrag",new D);I(this,"onAfterDrag",new D);I(this,"onBeforeCreate",new D);I(this,"onBeforeCancel",new D);I(this,"onAfterCancel",new D);I(this,"onBeforeDelete",new D);I(this,"onAfterCreate",new D);I(this,"onAfterDelete",new D);I(this,"onDisposed",new D);I(this,"orthogonalY",!1);I(this,"toleranceOrthogonalY",.7);I(this,"Type",ws);I(this,"list",[]);I(this,"_material",new S.MeshBasicMaterial({color:12255487,side:S.DoubleSide,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(Me.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const s of this.list)s.enabled=t;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(t){this._visible=t;for(const s of this.list)s.visible=t}get material(){return this._material}set material(t){this._material=t;for(const s of this.list)s.planeMaterial=t}get size(){return this._size}set size(t){this._size=t;for(const s of this.list)s.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(Me.uuid),this.onDisposed.reset()}create(t){if(!this.enabled)return;const o=this.components.get(ae).get(t).castRay();o&&this.createPlaneFromIntersection(t,o)}createFromNormalAndCoplanarPoint(t,s,i){const o=this.newPlane(t,i,s);return this.updateMaterialsAndPlanes(),o}delete(t,s){this.enabled&&(s||(s=this.pickPlane(t)),s&&this.deletePlane(s))}deleteAll(){for(;this.list.length>0;){const t=this.list[0];this.delete(t.world,t)}}deletePlane(t){const s=this.list.indexOf(t);if(s!==-1){if(this.list.splice(s,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 i=this.components.get(ae).get(t),o=this.getAllPlaneMeshes(),n=i.castRay(o);if(n){const r=n.object;return this.list.find(a=>a.meshes.includes(r))}}getAllPlaneMeshes(){const t=[];for(const s of this.list)t.push(...s.meshes);return t}createPlaneFromIntersection(t,s){var a;if(!t.renderer)throw new Error("The given world must have a renderer!");const i=s.point.distanceTo(new S.Vector3(0,0,0)),o=(a=s.face)==null?void 0:a.normal;if(!i||!o)return;const n=this.getWorldNormal(s,o),r=this.newPlane(t,s.point,n.negate());r.visible=this._visible,r.size=this._size,t.renderer.setPlane(!0,r.three),this.updateMaterialsAndPlanes()}getWorldNormal(t,s){const i=t.object;let o=t.object.matrixWorld.clone();if(i instanceof S.InstancedMesh&&t.instanceId!==void 0){const l=new S.Matrix4;i.getMatrixAt(t.instanceId,l),o=l.multiply(o)}const r=new S.Matrix3().getNormalMatrix(o),a=s.clone().applyMatrix3(r).normalize();return this.normalizePlaneDirectionY(a),a}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,s,i){const o=new this.Type(this.components,t,s,i,this._material);return o.onDraggingStarted.add(this._onStartDragging),o.onDraggingEnded.add(this._onEndDragging),this.list.push(o),this.onAfterCreate.trigger(o),o}updateMaterialsAndPlanes(){const t=this.components.get(Es);for(const[s,i]of t.list){if(!i.renderer)continue;i.renderer.updateClippingPlanes();const{clippingPlanes:o}=i.renderer;for(const n of i.meshes)if(Array.isArray(n.material))for(const r of n.material)r.clippingPlanes=o;else n.material.clippingPlanes=o}}};I(Me,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let fi=Me;function Sr(c,e,t,s){return new Promise((i,o)=>{function n(){const r=c.clientWaitSync(e,t,0);if(r===c.WAIT_FAILED){o();return}if(r===c.TIMEOUT_EXPIRED){setTimeout(n,s);return}i()}n()})}async function _r(c,e,t,s,i,o,n){const r=c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE,0);c.flush(),await Sr(c,r,0,10),c.deleteSync(r),c.bindBuffer(e,t),c.getBufferSubData(e,s,i,o,n),c.bindBuffer(e,null)}async function Ln(c,e,t,s,i,o,n,r){const a=c.createBuffer();return c.bindBuffer(c.PIXEL_PACK_BUFFER,a),c.bufferData(c.PIXEL_PACK_BUFFER,r.byteLength,c.STREAM_READ),c.readPixels(e,t,s,i,o,n,0),c.bindBuffer(c.PIXEL_PACK_BUFFER,null),await _r(c,c.PIXEL_PACK_BUFFER,a,0,r),c.deleteBuffer(a),r}class Mn{constructor(e,t,s){I(this,"onDisposed",new D);I(this,"onViewUpdated",new Pe);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 S.Scene);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 e=>{if(!this.enabled||!this.needsUpdate&&!e||this._isWorkerBusy)return;this._isWorkerBusy=!0;const t=this.world.camera.three;t.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,t);const s=this.renderer.getContext();await Ln(s,0,0,this._width,this._height,s.RGBA,s.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,t),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1});if(!t.renderer)throw new Error("The given world must have a renderer!");this.components=e,this.applySettings(s),this.world=t,this.renderer=new S.WebGLRenderer,this.renderTarget=new S.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const i=`
|
|
72
72
|
addEventListener("message", (event) => {
|
|
73
73
|
const { buffer } = event.data;
|
|
74
74
|
const colors = new Map();
|
|
@@ -85,4 +85,4 @@
|
|
|
85
85
|
}
|
|
86
86
|
postMessage({ colors });
|
|
87
87
|
});
|
|
88
|
-
`,o=new Blob([i],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(o))}dispose(){this.enabled=!1;for(const s of this.scene.children)s.removeFromParent();this.onViewUpdated.reset(),this.worker.terminate(),this.renderer.dispose(),this.renderTarget.dispose(),this._buffer=null,this.onDisposed.reset()}getAvailableColor(){let s=BigInt(this._availableColor.toString());const t=[];do t.unshift(Number(s%256n)),s/=256n;while(s);for(;t.length!==3;)t.unshift(0);const[e,i,o]=t,n=`${e}-${i}-${o}`;return{r:e,g:i,b:o,code:n}}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(s){s&&(s.updateInterval!==void 0&&(this.updateInterval=s.updateInterval),s.height!==void 0&&(this._height=s.height),s.width!==void 0&&(this._width=s.width),s.autoUpdate!==void 0&&(this.autoUpdate=s.autoUpdate))}}class Ln extends yn{constructor(t,e,i){super(t,e,i);I(this,"onViewUpdated",new D);I(this,"threshold",100);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 S.MeshBasicMaterial({transparent:!0,opacity:0}));I(this,"handleWorkerMessage",async t=>{if(this.isProcessing)return;const e=t.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[i,o]of e){if(o<this.threshold)continue;const n=this._colorCodeMeshMap.get(i);n&&(this._currentVisibleMeshes.add(n),this._recentlyHiddenMeshes.delete(n))}this.onViewUpdated.trigger({seen:this._currentVisibleMeshes,unseen:this._recentlyHiddenMeshes}),this._isWorkerBusy=!1});this.worker.addEventListener("message",this.handleWorkerMessage),this.autoUpdate&&window.setInterval(async()=>{this.isProcessing||await this.updateVisibility()},this.updateInterval),this.onViewUpdated.add(({seen:o,unseen:n})=>{for(const r of o)r.visible=!0;for(const r of n)r.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(_t);for(const e in this.colorMeshes){const i=this.colorMeshes.get(e);i&&t.destroy(i,!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 S.InstancedMesh,{geometry:i,material:o}=t,{colorMaterial:n,code:r}=this.getAvailableMaterial();let a;if(Array.isArray(o)){let d=!0;const E=[];for(const u of o)di.isTransparent(u)?E.push(this._transparentMat):(d=!1,E.push(n));if(d){n.dispose(),this.isProcessing=!1;return}a=E}else if(di.isTransparent(o)){n.dispose(),this.isProcessing=!1;return}else a=n;this._colorCodeMeshMap.set(r,t),this._meshIDColorCodeMap.set(t.uuid,r);const c=e?t.count:1,h=new S.InstancedMesh(i,a,c);e?h.instanceMatrix=t.instanceMatrix:h.setMatrixAt(0,new S.Matrix4),t.visible=!1,h.applyMatrix4(t.matrix),h.updateMatrix(),this.scene.add(h),this.colorMeshes.set(t.uuid,h),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(_t);this._currentVisibleMeshes.delete(t),this._recentlyHiddenMeshes.delete(t);const i=this.colorMeshes.get(t.uuid),o=this._meshIDColorCodeMap.get(t.uuid);if(!i||!o){this.isProcessing=!1,console.log(t.visible);return}this._colorCodeMeshMap.delete(o),this._meshIDColorCodeMap.delete(t.uuid),this.colorMeshes.delete(t.uuid),i.geometry=void 0,i.material=[],e.destroy(i,!0),this._recentlyHiddenMeshes.delete(t),this._currentVisibleMeshes.delete(t),this.isProcessing=!1}getAvailableMaterial(){const{r:t,g:e,b:i,code:o}=this.getAvailableColor(),n=S.ColorManagement.enabled;S.ColorManagement.enabled=!1;const r=new S.Color(`rgb(${t}, ${e}, ${i})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const a=this.world.renderer.clippingPlanes,c=new S.MeshBasicMaterial({color:r,clippingPlanes:a,side:S.DoubleSide});return S.ColorManagement.enabled=n,{colorMaterial:c,code:o}}}const we=class we extends ${constructor(t){super(t);I(this,"onDisposed",new D);I(this,"_enabled",!0);I(this,"list",new Map);t.add(we.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const[e,i]of this.list)i.enabled=t}create(t,e){if(this.list.has(t.uuid))return this.list.get(t.uuid);const i=new Ln(this.components,t,e);return this.list.set(t.uuid,i),i}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(we.uuid),this.onDisposed.reset();for(const[t,e]of this.list)e.dispose();this.list.clear()}};I(we,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let ds=we;class Nr{constructor(s){I(this,"onDisposed",new D);I(this,"onAfterUpdate",new D);I(this,"onBeforeUpdate",new D);I(this,"onResize",new D);I(this,"frontOffset",0);I(this,"overrideMaterial",new S.MeshDepthMaterial);I(this,"backgroundColor",new S.Color(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 S.Vector2(320,160));I(this,"_tempVector1",new S.Vector3);I(this,"_tempVector2",new S.Vector3);I(this,"_tempTarget",new S.Vector3);I(this,"down",new S.Vector3(0,-1,0));I(this,"updatePlanes",()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const s=[],t=this.world.renderer.three;for(const e of t.clippingPlanes)s.push(e);s.push(this._plane),this.renderer.clippingPlanes=s});if(this.world=s,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new S.WebGLRenderer,this.renderer.setSize(this._size.x,this._size.y);const t=1,e=this._size.x/this._size.y;this._camera=new S.OrthographicCamera(t*e/-2,t*e/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 S.Plane(this.down,200),this.updatePlanes()}get lockRotation(){return this._lockRotation}set lockRotation(s){this._lockRotation=s,s&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(s){this._camera.zoom=s,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 s=this.world.scene.three,t=this.world.camera;if(!t.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(s instanceof S.Scene))throw new Error("The given world must have a THREE.Scene as a root!");const e=t.controls;if(e.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,this.frontOffset!==0&&(e.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){e.getTarget(this._tempTarget);const o=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=o+Math.PI}this._plane.set(this.down,this._tempVector1.y);const i=s.background;s.background=this.backgroundColor,this.renderer.render(s,this._camera),s.background=i,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(s=this._size){this._size.copy(s),this.renderer.setSize(s.x,s.y);const t=s.x/s.y,e=1;this._camera.left=e*t/-2,this._camera.right=e*t/2,this._camera.top=e/2,this._camera.bottom=-e/2,this._camera.updateProjectionMatrix(),this.onResize.trigger(s)}}const Rs=class Rs extends ${constructor(t){super(t);I(this,"onAfterUpdate",new D);I(this,"onBeforeUpdate",new D);I(this,"onDisposed",new D);I(this,"enabled",!0);I(this,"list",new Map);this.components.add(Rs.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a minimap!");const e=new Nr(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(Rs,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let fi=Rs;class Mn{constructor(s){I(this,"enabled",!1);I(this,"id","FirstPerson");this.camera=s}set(s){if(this.enabled=s,s){if(this.camera.projection.current!=="Perspective"){this.camera.set("Orbit");return}this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const s=this.camera.controls,t=new S.Vector3;s.distance--,s.getPosition(t),s.minDistance=1,s.maxDistance=1,s.distance=1,s.moveTo(t.x,t.y,t.z),s.truckSpeed=50,s.mouseButtons.wheel=nt.ACTION.DOLLY,s.touches.two=nt.ACTION.TOUCH_ZOOM_TRUCK}}class wn{constructor(s){I(this,"enabled",!0);I(this,"id","Orbit");this.camera=s,this.activateOrbitControls()}set(s){this.enabled=s,s&&this.activateOrbitControls()}activateOrbitControls(){const s=this.camera.controls;s.minDistance=1,s.maxDistance=300;const t=new S.Vector3;s.getPosition(t);const e=t.length();s.distance=e,s.truckSpeed=2;const{rotation:i}=this.camera.three,o=new S.Vector3(0,0,-1).applyEuler(i),n=t.addScaledVector(o,e);s.moveTo(n.x,n.y,n.z)}}class Dn{constructor(s){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=s,this.defaultAzimuthSpeed=s.controls.azimuthRotateSpeed,this.defaultPolarSpeed=s.controls.polarRotateSpeed}set(s){this.enabled=s;const t=this.camera.controls;t.azimuthRotateSpeed=s?0:this.defaultAzimuthSpeed,t.polarRotateSpeed=s?0:this.defaultPolarSpeed,this.mouseInitialized||(this.mouseAction1=t.touches.one,this.mouseAction2=t.touches.two,this.mouseInitialized=!0),s?(t.mouseButtons.left=nt.ACTION.TRUCK,t.touches.one=nt.ACTION.TOUCH_TRUCK,t.touches.two=nt.ACTION.TOUCH_ZOOM):(t.mouseButtons.left=nt.ACTION.ROTATE,t.touches.one=this.mouseAction1,t.touches.two=this.mouseAction2)}}class Un{constructor(s){I(this,"onChanged",new D);I(this,"current","Perspective");I(this,"camera");I(this,"matchOrthoDistanceEnabled",!1);I(this,"_component");I(this,"_previousDistance",-1);this._component=s,this.camera=s.three}async set(s){this.current!==s&&(s==="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 s=this.getPerspectiveDims();if(!s)return;const{width:t,height:e}=s;this.setupOrthoCamera(e,t),this.camera=this._component.threeOrtho,this.current="Orthographic"}getPerspectiveDims(){const s=this._component.currentWorld;if(!s||!s.renderer)return null;const t=new S.Vector3;this._component.threePersp.getWorldDirection(t);const e=new S.Vector3;this._component.controls.getTarget(e);const o=e.clone().sub(this._component.threePersp.position).dot(t),n=s.renderer.getSize(),r=n.x/n.y,a=this._component.threePersp,c=o*2*Math.atan(a.fov*(Math.PI/180)/2);return{width:c*r,height:c}}setupOrthoCamera(s,t){this._component.controls.mouseButtons.wheel=nt.ACTION.ZOOM,this._component.controls.mouseButtons.middle=nt.ACTION.ZOOM;const e=this._component.threePersp,i=this._component.threeOrtho;i.zoom=1,i.left=t/-2,i.right=t/2,i.top=s/2,i.bottom=s/-2,i.updateProjectionMatrix(),i.position.copy(e.position),i.quaternion.copy(e.quaternion),this._component.controls.camera=i}getDistance(){const s=this._component.threePersp,t=this._component.threeOrtho;return(t.top-t.bottom)/t.zoom/(2*Math.atan(s.fov*(Math.PI/180)/2))}async setPerspectiveCamera(){this._component.controls.mouseButtons.wheel=nt.ACTION.DOLLY,this._component.controls.mouseButtons.middle=nt.ACTION.DOLLY;const s=this._component.threePersp,t=this._component.threeOrtho;s.position.copy(t.position),s.quaternion.copy(t.quaternion),this._component.controls.mouseButtons.wheel=nt.ACTION.DOLLY,this.matchOrthoDistanceEnabled?this._component.controls.distance=this.getDistance():this._component.controls.distance=this._previousDistance,await this._component.controls.zoomTo(1),s.updateProjectionMatrix(),this._component.controls.camera=s,this.camera=s,this.current="Perspective"}}class Pr extends le{constructor(t){super(t);I(this,"projection");I(this,"threeOrtho");I(this,"threePersp");I(this,"_userInputButtons",{});I(this,"_frustumSize",50);I(this,"_navigationModes",new Map);I(this,"_mode",null);I(this,"previousSize",null);this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new Un(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 wn(this)),this._navigationModes.set("FirstPerson",new Mn(this)),this._navigationModes.set("Plan",new Dn(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 i=Number.MAX_VALUE,o=Number.MIN_VALUE,n=new S.Vector3(i,i,i),r=new S.Vector3(o,o,o);for(const u of t){const p=new S.Box3().setFromObject(u);p.min.x<n.x&&(n.x=p.min.x),p.min.y<n.y&&(n.y=p.min.y),p.min.z<n.z&&(n.z=p.min.z),p.max.x>r.x&&(r.x=p.max.x),p.max.y>r.y&&(r.y=p.max.y),p.max.z>r.z&&(r.z=p.max.z)}const a=new S.Box3(n,r),c=new S.Vector3;a.getSize(c);const h=new S.Vector3;a.getCenter(h);const d=Math.max(c.x,c.y,c.z)*e,E=new S.Sphere(h,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 S.OrthographicCamera(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,i=this.threeOrtho.right,o=t.y/this.previousSize.y,n=t.x/this.previousSize.x,r=e*o,a=i*n;this.threeOrtho.left=-a,this.threeOrtho.right=a,this.threeOrtho.top=r,this.threeOrtho.bottom=-r,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(t)}}const Tt=class Tt extends ${constructor(t){super(t);I(this,"enabled",!0);I(this,"onDisposed",new D);I(this,"_absoluteMin");I(this,"_absoluteMax");I(this,"_meshes",[]);this.components.add(Tt.uuid,this),this._absoluteMin=Tt.newBound(!0),this._absoluteMax=Tt.newBound(!1)}static getDimensions(t){const{min:e,max:i}=t,o=Math.abs(i.x-e.x),n=Math.abs(i.y-e.y),r=Math.abs(i.z-e.z),a=new S.Vector3;return a.subVectors(i,e).divideScalar(2).add(e),{width:o,height:n,depth:r,center:a}}static newBound(t){const e=t?1:-1;return new S.Vector3(e*Number.MAX_VALUE,e*Number.MAX_VALUE,e*Number.MAX_VALUE)}static getBounds(t,e,i){const o=i||this.newBound(!1),n=e||this.newBound(!0);for(const r of t)r.x<n.x&&(n.x=r.x),r.y<n.y&&(n.y=r.y),r.z<n.z&&(n.z=r.z),r.x>o.x&&(o.x=r.x),r.y>o.y&&(o.y=r.y),r.z>o.z&&(o.z=r.z);return new S.Box3(e,i)}dispose(){const t=this.components.get(_t);for(const e of this._meshes)t.destroy(e);this._meshes=[],this.onDisposed.trigger(Tt.uuid),this.onDisposed.reset()}get(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone();return new S.Box3(t,e)}getSphere(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone(),i=Math.abs((e.x-t.x)/2),o=Math.abs((e.y-t.y)/2),n=Math.abs((e.z-t.z)/2),r=new S.Vector3(t.x+i,t.y+o,t.z+n),a=r.distanceTo(t);return new S.Sphere(r,a)}getMesh(){const t=new S.Box3(this._absoluteMin,this._absoluteMax),e=Tt.getDimensions(t),{width:i,height:o,depth:n,center:r}=e,a=new S.BoxGeometry(i,o,n),c=new S.Mesh(a);return this._meshes.push(c),c.position.copy(r),c}reset(){this._absoluteMin=Tt.newBound(!0),this._absoluteMax=Tt.newBound(!1)}add(t){for(const e of t.items)this.addMesh(e.mesh)}addMesh(t,e){if(!t.geometry.index)return;const i=Tt.getFragmentBounds(t);t.updateMatrixWorld();const o=t.matrixWorld,n=new S.Matrix4,r=t instanceof S.InstancedMesh,a=new Set;if(e&&t instanceof Dt.FragmentMesh)for(const c of e){const h=t.fragment.getInstancesIDs(c);if(h)for(const d of h)a.add(d)}else a.add(0);for(const c of a){const h=i.min.clone(),d=i.max.clone();r&&(t.getMatrixAt(c,n),h.applyMatrix4(n),d.applyMatrix4(n)),h.applyMatrix4(o),d.applyMatrix4(o),h.x<this._absoluteMin.x&&(this._absoluteMin.x=h.x),h.y<this._absoluteMin.y&&(this._absoluteMin.y=h.y),h.z<this._absoluteMin.z&&(this._absoluteMin.z=h.z),h.x>this._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.x<this._absoluteMin.x&&(this._absoluteMin.x=d.x),d.y<this._absoluteMin.y&&(this._absoluteMin.y=d.y),d.z<this._absoluteMin.z&&(this._absoluteMin.z=d.z)}}static getFragmentBounds(t){const e=t.geometry.attributes.position,i=Number.MAX_VALUE,o=-i,n=new S.Vector3(i,i,i),r=new S.Vector3(o,o,o);if(!t.geometry.index)throw new Error("Geometry must be indexed!");const a=Array.from(t.geometry.index.array);for(let c=0;c<a.length;c++){if(c%3===0&&a[c]===0&&a[c+1]===0&&a[c+2]===0){c+=2;continue}const h=a[c],d=e.getX(h),E=e.getY(h),u=e.getZ(h);d<n.x&&(n.x=d),E<n.y&&(n.y=E),u<n.z&&(n.z=u),d>r.x&&(r.x=d),E>r.y&&(r.y=E),u>r.z&&(r.z=u)}return new S.Box3(n,r)}};I(Tt,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let pi=Tt;const _i=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]),As=class As extends ${constructor(t){super(t);I(this,"enabled",!0);t.add(As.uuid,this)}async export(t,e,i=!1,o=!0){const n={},r=new Set(t.GetIfcEntityList(e)),a=new Set([U.IFCPROJECT,U.IFCSITE,U.IFCBUILDING,U.IFCBUILDINGSTOREY,U.IFCSPACE]);for(const c of a)r.add(c);for(const c of r){if(_i.has(c))continue;const h=a.has(c)&&o,d=t.GetLineIDsWithType(e,c);for(const E of d){const u=t.GetLine(0,E,h,i);n[u.expressID]=u}}return n}};I(As,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let us=As;const Fs=class Fs extends ${constructor(t){super(t);I(this,"onDisposed",new D);I(this,"onFragmentsLoaded",new D);I(this,"onFragmentsDisposed",new D);I(this,"list",new Map);I(this,"groups",new Map);I(this,"enabled",!0);I(this,"baseCoordinationModel","");I(this,"_loader",new fn.Serializer);this.components.add(Fs.uuid,this)}get meshes(){const t=[];for(const[e,i]of this.list)t.push(i.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,i=[];for(const o of t.items)i.push(o.id),this.list.delete(o.id);t.dispose(!0),this.groups.delete(t.uuid),this.onFragmentsDisposed.trigger({groupID:e,fragmentIDs:i})}load(t,e){const o={...{coordinate:!0},...e},{coordinate:n,name:r,properties:a,relationsMap:c}=o,h=this._loader.import(t);r&&(h.name=r);for(const d of h.items)d.group=h,this.list.set(d.id,d);return n&&this.coordinate([h]),this.groups.set(h.uuid,h),a&&h.setLocalProperties(a),c&&this.components.get(he).setRelationMap(h,c),this.onFragmentsLoaded.trigger(h),h}export(t){return this._loader.export(t)}getModelIdMap(t){const e={};for(const i in t){const o=this.list.get(i);if(!(o&&o.group))continue;const n=o.group;n.uuid in e||(e[n.uuid]=new Set);const r=t[i];for(const a of r)e[n.uuid].add(a)}return e}modelIdToFragmentIdMap(t){let e={};for(const i in t){const o=this.groups.get(i);if(!o)continue;const n=t[i],r=o.getFragmentMap(n);e={...e,...r}}return e}coordinate(t=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const o=t.pop();if(!o)return;this.baseCoordinationModel=o.uuid}if(!t.length)return;const i=this.groups.get(this.baseCoordinationModel);if(!i){console.log("No base model found for coordination!");return}for(const o of t)o!==i&&(o.position.set(0,0,0),o.rotation.set(0,0,0),o.scale.set(1,1,1),o.updateMatrix(),o.applyMatrix4(o.coordinationMatrix.clone().invert()),o.applyMatrix4(i.coordinationMatrix))}};I(Fs,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let ct=Fs;const yr=new Map([[U.IFCRELAGGREGATES,{forRelating:"IsDecomposedBy",forRelated:"Decomposes"}],[U.IFCRELASSOCIATESMATERIAL,{forRelating:"AssociatedTo",forRelated:"HasAssociations"}],[U.IFCRELASSOCIATESCLASSIFICATION,{forRelating:"ClassificationForObjects",forRelated:"HasAssociations"}],[U.IFCRELASSIGNSTOGROUP,{forRelating:"IsGroupedBy",forRelated:"HasAssignments"}],[U.IFCRELDEFINESBYPROPERTIES,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[U.IFCRELDEFINESBYTYPE,{forRelated:"IsTypedBy",forRelating:"Types"}],[U.IFCRELDEFINESBYTEMPLATE,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[U.IFCRELCONTAINEDINSPATIALSTRUCTURE,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}]]),De=class De extends ${constructor(t){super(t);I(this,"onDisposed",new D);I(this,"enabled",!0);I(this,"onRelationsIndexed",new D);I(this,"_relToAttributesMap",yr);I(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements"]);I(this,"_ifcRels",[U.IFCRELAGGREGATES,U.IFCRELASSOCIATESMATERIAL,U.IFCRELASSOCIATESCLASSIFICATION,U.IFCRELASSIGNSTOGROUP,U.IFCRELDEFINESBYPROPERTIES,U.IFCRELDEFINESBYTYPE,U.IFCRELDEFINESBYTEMPLATE,U.IFCRELCONTAINEDINSPATIALSTRUCTURE]);I(this,"relationMaps",{});I(this,"onFragmentsDisposed",t=>{delete this.relationMaps[t.groupID]});this.components.add(De.uuid,this),t.get(ct).onFragmentsDisposed.add(this.onFragmentsDisposed)}indexRelations(t,e,i,o){const n=Object.keys(e).find(E=>E.startsWith("Relating")),r=Object.keys(e).find(E=>E.startsWith("Related"));if(!(n&&r))return;const a=e[n].value,c=e[r].map(E=>E.value),h=t.get(a)??new Map,d=this._inverseAttributes.indexOf(o);h.set(d,c),t.set(a,h);for(const E of c){const u=t.get(E)??new Map,p=this._inverseAttributes.indexOf(i),F=u.get(p)??[];F.push(a),u.set(p,F),t.set(E,u)}}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 i of this._ifcRels){const o=await t.getAllPropertiesOfType(i);if(!o)continue;const n=this._relToAttributesMap.get(i);if(!n)continue;const{forRelated:r,forRelating:a}=n;for(const c in o){const h=o[c];this.indexRelations(e,h,r,a)}}return this.setRelationMap(t,e),e}async processFromWebIfc(t,e){const i=new Map;for(const o of this._ifcRels){const n=this._relToAttributesMap.get(o);if(!n)continue;const{forRelated:r,forRelating:a}=n,c=t.GetLineIDsWithType(e,o);for(let h=0;h<c.size();h++){const d=await t.properties.getItemProperties(e,c.get(h));this.indexRelations(i,d,r,a)}}return this.onRelationsIndexed.trigger({modelID:e.toString(),relationsMap:i}),i}getEntityRelations(t,e,i){const o=this.relationMaps[t.uuid];if(!o)return null;const n=o.get(e),r=this._inverseAttributes.indexOf(i);if(!n||r===-1)return null;const a=n.get(r);return a||null}serializeRelations(t){const e={};for(const[i,o]of t.entries()){e[i]||(e[i]={});for(const[n,r]of o.entries())e[i][n]=r}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 i=this.relationMaps[e],o={};for(const[n,r]of i.entries()){o[n]||(o[n]={});for(const[a,c]of r.entries())o[n][a]=c}t[e]=o}return JSON.stringify(t)}getRelationsMapFromJSON(t){const e=JSON.parse(t),i=new Map;for(const o in e){const n=e[o],r=new Map;for(const a in n)r.set(Number(a),n[a]);i.set(Number(o),r)}return i}dispose(){this.relationMaps={},this.components.get(ct).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(De.uuid),this.onDisposed.reset()}};I(De,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let he=De;const xn={103090709:"IFCPROJECT",4097777520:"IFCSITE",4031249490:"IFCBUILDING",3124254112:"IFCBUILDINGSTOREY",3856911033:"IFCSPACE",1674181508:"IFCANNOTATION",25142252:"IFCCONTROLLER",32344328:"IFCBOILER",76236018:"IFCLAMP",90941305:"IFCPUMP",177149247:"IFCAIRTERMINALBOX",182646315:"IFCFLOWINSTRUMENT",263784265:"IFCFURNISHINGELEMENT",264262732:"IFCELECTRICGENERATOR",277319702:"IFCAUDIOVISUALAPPLIANCE",310824031:"IFCPIPEFITTING",331165859:"IFCSTAIR",342316401:"IFCDUCTFITTING",377706215:"IFCMECHANICALFASTENER",395920057:"IFCDOOR",402227799:"IFCELECTRICMOTOR",413509423:"IFCSYSTEMFURNITUREELEMENT",484807127:"IFCEVAPORATOR",486154966:"IFCWINDOWSTANDARDCASE",629592764:"IFCLIGHTFIXTURE",630975310:"IFCUNITARYCONTROLELEMENT",635142910:"IFCCABLECARRIERFITTING",639361253:"IFCCOIL",647756555:"IFCFASTENER",707683696:"IFCFLOWSTORAGEDEVICE",738039164:"IFCPROTECTIVEDEVICE",753842376:"IFCBEAM",812556717:"IFCTANK",819412036:"IFCFILTER",843113511:"IFCCOLUMN",862014818:"IFCELECTRICDISTRIBUTIONBOARD",900683007:"IFCFOOTING",905975707:"IFCCOLUMNSTANDARDCASE",926996030:"IFCVOIDINGFEATURE",979691226:"IFCREINFORCINGBAR",987401354:"IFCFLOWSEGMENT",1003880860:"IFCELECTRICTIMECONTROL",1051757585:"IFCCABLEFITTING",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1073191201:"IFCMEMBER",1095909175:"IFCBUILDINGELEMENTPROXY",1156407060:"IFCPLATESTANDARDCASE",1162798199:"IFCSWITCHINGDEVICE",1329646415:"IFCSHADINGDEVICE",1335981549:"IFCDISCRETEACCESSORY",1360408905:"IFCDUCTSILENCER",1404847402:"IFCSTACKTERMINAL",1426591983:"IFCFIRESUPPRESSIONTERMINAL",1437502449:"IFCMEDICALDEVICE",1509553395:"IFCFURNITURE",1529196076:"IFCSLAB",1620046519:"IFCTRANSPORTELEMENT",1634111441:"IFCAIRTERMINAL",1658829314:"IFCENERGYCONVERSIONDEVICE",1677625105:"IFCCIVILELEMENT",1687234759:"IFCPILE",1904799276:"IFCELECTRICAPPLIANCE",1911478936:"IFCMEMBERSTANDARDCASE",1945004755:"IFCDISTRIBUTIONELEMENT",1973544240:"IFCCOVERING",1999602285:"IFCSPACEHEATER",2016517767:"IFCROOF",2056796094:"IFCAIRTOAIRHEATRECOVERY",2058353004:"IFCFLOWCONTROLLER",2068733104:"IFCHUMIDIFIER",2176052936:"IFCJUNCTIONBOX",2188021234:"IFCFLOWMETER",2223149337:"IFCFLOWTERMINAL",2262370178:"IFCRAILING",2272882330:"IFCCONDENSER",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",2320036040:"IFCREINFORCINGMESH",2347447852:"IFCTENDONANCHOR",2391383451:"IFCVIBRATIONISOLATOR",2391406946:"IFCWALL",2474470126:"IFCMOTORCONNECTION",2769231204:"IFCVIRTUALELEMENT",2814081492:"IFCENGINE",2906023776:"IFCBEAMSTANDARDCASE",2938176219:"IFCBURNER",2979338954:"IFCBUILDINGELEMENTPART",3024970846:"IFCRAMP",3026737570:"IFCTUBEBUNDLE",3027962421:"IFCSLABSTANDARDCASE",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",3053780830:"IFCSANITARYTERMINAL",3079942009:"IFCOPENINGSTANDARDCASE",3087945054:"IFCALARM",3101698114:"IFCSURFACEFEATURE",3127900445:"IFCSLABELEMENTEDCASE",3132237377:"IFCFLOWMOVINGDEVICE",3171933400:"IFCPLATE",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",3242481149:"IFCDOORSTANDARDCASE",3283111854:"IFCRAMPFLIGHT",3296154744:"IFCCHIMNEY",3304561284:"IFCWINDOW",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",3319311131:"IFCHEATEXCHANGER",3415622556:"IFCFAN",3420628829:"IFCSOLARDEVICE",3493046030:"IFCGEOGRAPHICELEMENT",3495092785:"IFCCURTAINWALL",3508470533:"IFCFLOWTREATMENTDEVICE",3512223829:"IFCWALLSTANDARDCASE",3518393246:"IFCDUCTSEGMENT",3571504051:"IFCCOMPRESSOR",3588315303:"IFCOPENINGELEMENT",3612865200:"IFCPIPESEGMENT",3640358203:"IFCCOOLINGTOWER",3651124850:"IFCPROJECTIONELEMENT",3694346114:"IFCOUTLET",3747195512:"IFCEVAPORATIVECOOLER",3758799889:"IFCCABLECARRIERSEGMENT",3824725483:"IFCTENDON",3825984169:"IFCTRANSFORMER",3902619387:"IFCCHILLER",4074379575:"IFCDAMPER",4086658281:"IFCSENSOR",4123344466:"IFCELEMENTASSEMBLY",4136498852:"IFCCOOLEDBEAM",4156078855:"IFCWALLELEMENTEDCASE",4175244083:"IFCINTERCEPTOR",4207607924:"IFCVALVE",4217484030:"IFCCABLESEGMENT",4237592921:"IFCWASTETERMINAL",4252922144:"IFCSTAIRFLIGHT",4278956645:"IFCFLOWFITTING",4288193352:"IFCACTUATOR",4292641817:"IFCUNITARYEQUIPMENT",3009204131:"IFCGRID"};class Lr{getAll(s,t){const e={},i=Object.keys(xn).map(o=>parseInt(o,10));for(let o=0;o<i.length;o++){const n=i[o],r=s.GetLineIDsWithType(t,n),a=r.size();for(let c=0;c<a;c++)e[r.get(c)]=n}return e}}const Ni={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 xt{static async getUnits(s){var n;const{IFCUNITASSIGNMENT:t}=U,e=await s.getAllPropertiesOfType(t);if(!e)return 1;const i=Object.keys(e),o=e[parseInt(i[0],10)];for(const r of o.Units){if(r.value===void 0||r.value===null)continue;const a=await s.getProperties(r.value);if(!a||!a.UnitType||!a.UnitType.value||a.UnitType.value!=="LENGTHUNIT")continue;let h=1,d=1;return a.Name.value==="METRE"&&(d=1),a.Name.value==="FOOT"&&(d=.3048),((n=a.Prefix)==null?void 0:n.value)==="MILLI"&&(h=.001),d*h}return 1}static async findItemByGuid(s,t){var i;const e=s.getAllPropertiesIDs();for(const o of e){const n=await s.getProperties(o);if(n&&((i=n.GlobalId)==null?void 0:i.value)===t)return n}return null}static async getRelationMap(s,t,e){var a;const o=e??(async()=>{}),n={},r=s.getAllPropertiesIDs();for(const c of r){const h=await s.getProperties(c);if(!h)continue;const d=h.type===t,E=Object.keys(h).find(T=>T.startsWith("Relating")),u=Object.keys(h).find(T=>T.startsWith("Related"));if(!(d&&E&&u))continue;const p=await s.getProperties((a=h[E])==null?void 0:a.value),F=h[u];if(!p||!F||!(F&&Array.isArray(F)))continue;const R=F.map(T=>T.value);await o(p.expressID,R),n[p.expressID]=R}return n}static async getQsetQuantities(s,t,e){const o=e??(()=>{}),n=await s.getProperties(t);return!n||n.type!==U.IFCELEMENTQUANTITY?null:(n.Quantities??[{}]).map(c=>(c.value&&o(c.value),c.value)).filter(c=>c!==null)}static async getPsetProps(s,t,e){const o=e??(()=>{}),n=await s.getProperties(t);return!n||n.type!==U.IFCPROPERTYSET?null:(n.HasProperties??[{}]).map(c=>(c.value&&o(c.value),c.value)).filter(c=>c!==null)}static async getPsetRel(s,t){var r;if(!await s.getProperties(t))return null;const i=await s.getAllPropertiesOfType(U.IFCRELDEFINESBYPROPERTIES);if(!i)return null;const o=Object.values(i);let n=null;for(const a of o)((r=a.RelatingPropertyDefinition)==null?void 0:r.value)===t&&(n=a.expressID);return n}static async getQsetRel(s,t){return xt.getPsetRel(s,t)}static async getEntityName(s,t){var n;const e=await s.getProperties(t);if(!e)return{key:null,name:null};const i=Object.keys(e).find(r=>r.endsWith("Name"))??null,o=i?(n=e[i])==null?void 0:n.value:null;return{key:i,name:o}}static async getQuantityValue(s,t){const e=await s.getProperties(t);if(!e)return{key:null,value:null};const i=Object.keys(e).find(n=>n.endsWith("Value"))??null;let o;return i===null||e[i]===void 0||e[i]===null?o=null:o=e[i].value,{key:i,value:o}}static isRel(s){return Ni[s].startsWith("IFCREL")}static async attributeExists(s,t,e){const i=await s.getProperties(t);return i?Object.keys(i).includes(e):!1}static async groupEntitiesByType(s,t){var i;const e=new Map;for(const o of t){const n=await s.getProperties(o);if(!n)continue;const r=n.type;e.get(r)||e.set(r,new Set),(i=e.get(r))==null||i.add(o)}return e}}class Mr{constructor(){I(this,"factor",1);I(this,"complement",1)}apply(s){const e=this.getScaleMatrix().multiply(s);s.copy(e)}setUp(s){var o;this.factor=1;const t=this.getLengthUnits(s);if(!t)return;const e=t==null,i=t.Name===void 0||t.Name===null;e||i||(t.Name.value==="FOOT"?this.factor=.3048:((o=t.Prefix)==null?void 0:o.value)==="MILLI"&&(this.complement=.001))}getLengthUnits(s){try{const e=s.GetLineIDsWithType(0,U.IFCUNITASSIGNMENT).get(0),i=s.GetLine(0,e);for(const o of i.Units){if(!o||o.value===null||o.value===void 0)continue;const n=s.GetLine(0,o.value);if(n.UnitType&&n.UnitType.value==="LENGTHUNIT")return n}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const s=this.factor;return new S.Matrix4().fromArray([s,0,0,0,0,s,0,0,0,0,s,0,0,0,0,1])}}class bn{constructor(){I(this,"itemsByFloor",{});I(this,"_units",new Mr)}setUp(s){this._units.setUp(s),this.cleanUp();try{const t=s.GetLineIDsWithType(0,U.IFCRELCONTAINEDINSPATIALSTRUCTURE),e=new Set,i=s.GetLineIDsWithType(0,U.IFCSPACE);for(let c=0;c<i.size();c++)e.add(i.get(c));const o=s.GetLineIDsWithType(0,U.IFCRELAGGREGATES),n=o.size();for(let c=0;c<n;c++){const h=o.get(c),d=s.GetLine(0,h);if(!d||!d.RelatingObject||!d.RelatedObjects)continue;const E=d.RelatingObject.value,u=d.RelatedObjects;for(const p of u){const F=p.value;e.has(F)&&(this.itemsByFloor[F]=E)}}const r={},a=t.size();for(let c=0;c<a;c++){const h=t.get(c),d=s.GetLine(0,h);if(!d||!d.RelatingStructure||!d.RelatedElements)continue;const E=d.RelatingStructure.value,u=d.RelatedElements;if(e.has(E))for(const p of u){r[E]||(r[E]=[]);const F=p.value;r[E].push(F)}else for(const p of u){const F=p.value;this.itemsByFloor[F]=E}}for(const c in r){const h=this.itemsByFloor[c];if(h!==void 0){const d=r[c];for(const E of d)this.itemsByFloor[E]=h}}for(let c=0;c<n;c++){const h=o.get(c),d=s.GetLine(0,h);if(!d||!d.RelatingObject||!d.RelatedObjects)continue;const E=d.RelatingObject.value,u=d.RelatedObjects;for(const p of u){const F=p.value,R=this.itemsByFloor[E];R!==void 0&&(this.itemsByFloor[F]=R)}}}catch{console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}class Pi{constructor(){I(this,"includeProperties",!0);I(this,"optionalCategories",[U.IFCSPACE]);I(this,"coordinate",!0);I(this,"wasm",{path:"",absolute:!1,logLevel:U.LogLevel.LOG_LEVEL_OFF});I(this,"excludedCategories",new Set);I(this,"saveLocations",!1);I(this,"webIfc",{COORDINATE_TO_ORIGIN:!0,OPTIMIZE_PROFILES:!0});I(this,"autoSetWasm",!0);I(this,"customLocateFileHandler",null)}}class vn{constructor(){I(this,"defLineMat",new S.LineBasicMaterial({color:16777215}))}read(s){const t=s.GetAllAlignments(0),e=s.GetAllCrossSections2D(0),i=s.GetAllCrossSections3D(0),o={IfcAlignment:t,IfcCrossSection2D:e,IfcCrossSection3D:i};return this.get(o)}get(s){if(s.IfcAlignment){const t=new Map;for(const e of s.IfcAlignment){const i=new Dt.Alignment;i.absolute=this.getCurves(e.curve3D,i),i.horizontal=this.getCurves(e.horizontal,i),i.vertical=this.getCurves(e.vertical,i),t.set(t.size,i)}return{alignments:t,coordinationMatrix:new S.Matrix4}}}getCurves(s,t){const e=[];let i=0;for(const o of s){const n={};if(o.data)for(const E of o.data){const[u,p]=E.split(": "),F=parseFloat(p);n[u]=F||p}const{points:r}=o,a=new Float32Array(r.length*3);for(let E=0;E<r.length;E++){const{x:u,y:p,z:F}=r[E];a[E*3]=u,a[E*3+1]=p,a[E*3+2]=F||0}const c=new S.BufferAttribute(a,3),h=new S.EdgesGeometry;h.setAttribute("position",c);const d=new Dt.CurveMesh(i,n,t,h,this.defLineMat);e.push(d.curve),i++}return e}}class Bn{getNameInfo(s){var d;const t={},{arguments:e}=s.GetHeaderLine(0,U.FILE_NAME)||{};if(!e)return t;const[i,o,n,r,a,c,h]=e;if(i!=null&&i.value&&(t.name=i.value),o!=null&&o.value&&(t.creationDate=new Date(o.value)),n){t.author={};const[E,u]=n;E!=null&&E.value&&(t.author.name=E.value),u!=null&&u.value&&(t.author.email=u.value)}return(d=r[0])!=null&&d.value&&(t.organization=r[0].value),a!=null&&a.value&&(t.preprocessorVersion=a==null?void 0:a.value),c!=null&&c.value&&(t.originatingSystem=c==null?void 0:c.value),h!=null&&h.value&&(t.authorization=h==null?void 0:h.value),t}getDescriptionInfo(s){var n;const t={},{arguments:e}=s.GetHeaderLine(0,U.FILE_DESCRIPTION)||{};if(!e)return t;const[i,o]=e;if((n=i[0])!=null&&n.value){const r=i[0].value.match(/\[([^\]]+)\]/);r[1]&&(t.viewDefinition=r[1])}return o!=null&&o.value&&(t.implementationLevel=o.value),t}}const Ue=class Ue extends ${constructor(t){super(t);I(this,"onIfcStartedLoading",new D);I(this,"onSetup",new D);I(this,"onDisposed",new D);I(this,"settings",new Pi);I(this,"enabled",!0);I(this,"webIfc",new U.IfcAPI);I(this,"_material",new S.MeshLambertMaterial);I(this,"_spatialTree",new bn);I(this,"_metaData",new Bn);I(this,"_fragmentInstances",new Map);I(this,"_civil",new vn);I(this,"_visitedFragments",new Map);I(this,"_materialT",new S.MeshLambertMaterial({transparent:!0,opacity:.5}));this.components.add(Ue.uuid,this),this.settings.excludedCategories.add(U.IFCOPENINGELEMENT)}dispose(){this.webIfc=null,this.onDisposed.trigger(Ue.uuid),this.onDisposed.reset()}async setup(t){this.settings={...this.settings,...t},this.settings.autoSetWasm&&await this.autoSetWasm(),this.onSetup.trigger()}async load(t,e=!0){const i=performance.now();this.onIfcStartedLoading.trigger(),await this.readIfcFile(t);const o=await this.getAllGeometries(),r=await this.components.get(us).export(this.webIfc,0);o.setLocalProperties(r),this.cleanUp();const a=this.components.get(ct);a.groups.set(o.uuid,o);for(const c of o.items)a.list.set(c.id,c),c.mesh.uuid=c.id,c.group=o;return a.onFragmentsLoaded.trigger(o),e&&a.coordinate([o]),console.log(`Streaming the IFC took ${performance.now()-i} ms!`),o}async readIfcFile(t){const{path:e,absolute:i,logLevel:o}=this.settings.wasm;return this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModel(t,this.settings.webIfc)}async getAllGeometries(){this._spatialTree.setUp(this.webIfc);const t=this.webIfc.GetIfcEntityList(0),e=new Dt.FragmentsGroup;e.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};const i=[];for(const n of t){if(!this.webIfc.IsIfcElement(n)&&n!==U.IFCSPACE||this.settings.excludedCategories.has(n))continue;const r=this.webIfc.GetLineIDsWithType(0,n),a=r.size();for(let c=0;c<a;c++){const h=r.get(c);i.push(h);const d=this._spatialTree.itemsByFloor[h]||0;e.data.set(h,[[],[d,n]])}}this._spatialTree.cleanUp(),this.webIfc.StreamMeshes(0,i,n=>{this.getMesh(n,e)});for(const n of this._visitedFragments){const{index:r,fragment:a}=n[1];e.keyFragments.set(r,a.id)}for(const n of e.items){const r=this._fragmentInstances.get(n.id);if(!r)throw new Error("Fragment not found!");const a=[];for(const[c,h]of r)a.push(h);n.add(a)}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 U.IfcAPI,this._visitedFragments.clear(),this._fragmentInstances.clear()}getMesh(t,e){const i=t.geometries.size(),o=t.expressID;for(let n=0;n<i;n++){const r=t.geometries.get(n),{x:a,y:c,z:h,w:d}=r.color,E=d!==1,{geometryExpressID:u}=r,p=`${u}-${E}`;if(!this._visitedFragments.has(p)){const m=this.getGeometry(this.webIfc,u),O=E?this._materialT:this._material,_=new Dt.Fragment(m,O,1);e.add(_.mesh),e.items.push(_);const N=this._visitedFragments.size;this._visitedFragments.set(p,{index:N,fragment:_})}const F=new S.Color().setRGB(a,c,h,"srgb"),R=new S.Matrix4;R.fromArray(r.flatTransformation);const T=this._visitedFragments.get(p);if(T===void 0)throw new Error("Error getting geometry data for streaming!");const A=e.data.get(o);if(!A)throw new Error("Data not found!");A[0].push(T.index);const{fragment:g}=T;this._fragmentInstances.has(g.id)||this._fragmentInstances.set(g.id,new Map);const f=this._fragmentInstances.get(g.id);if(!f)throw new Error("Instances not found!");if(f.has(o)){const m=f.get(o);if(!m)throw new Error("Instance not found!");m.transforms.push(R),m.colors&&m.colors.push(F)}else f.set(o,{id:o,transforms:[R],colors:[F]})}}getGeometry(t,e){const i=t.GetGeometry(0,e),o=t.GetIndexArray(i.GetIndexData(),i.GetIndexDataSize()),n=t.GetVertexArray(i.GetVertexData(),i.GetVertexDataSize()),r=new Float32Array(n.length/2),a=new Float32Array(n.length/2);for(let E=0;E<n.length;E+=6)r[E/2]=n[E],r[E/2+1]=n[E+1],r[E/2+2]=n[E+2],a[E/2]=n[E+3],a[E/2+1]=n[E+4],a[E/2+2]=n[E+5];const c=new S.BufferGeometry,h=new S.BufferAttribute(r,3),d=new S.BufferAttribute(a,3);return c.setAttribute("position",h),c.setAttribute("normal",d),c.setIndex(Array.from(o)),i.delete(),c}async autoSetWasm(){const t=await fetch(`https://unpkg.com/openbim-components@${hs.release}/package.json`);if(!t.ok){console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");return}const e=await t.json();if(!("web-ifc"in e.peerDependencies))console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.");else{const i=e.peerDependencies["web-ifc"];this.settings.wasm.path=`https://unpkg.com/web-ifc@${i}/`,this.settings.wasm.absolute=!0}}};I(Ue,"uuid","a659add7-1418-4771-a0d6-7d4d438e4624");let Is=Ue;const Mt=class Mt extends ${constructor(t){super(t);I(this,"onDisposed",new D);I(this,"onRequestFile",new D);I(this,"ifcToExport",null);I(this,"onElementToPset",new D);I(this,"onPropToPset",new D);I(this,"onPsetRemoved",new D);I(this,"onDataChanged",new D);I(this,"wasm",{path:"/",absolute:!1});I(this,"enabled",!0);I(this,"attributeListeners",{});I(this,"selectedModel");I(this,"changeMap",{});this.components.add(Mt.uuid,this)}dispose(){this.selectedModel=void 0,this.attributeListeners={},this.changeMap={},this.onElementToPset.reset(),this.onPropToPset.reset(),this.onPsetRemoved.reset(),this.onDataChanged.reset(),this.onDisposed.trigger(Mt.uuid),this.onDisposed.reset()}increaseMaxID(t){return t.ifcMetadata.maxExpressID++,t.ifcMetadata.maxExpressID}static getIFCSchema(t){const e=t.ifcMetadata.schema;if(!e)throw new Error("IFC Schema not found");return e}newGUID(t){const e=Mt.getIFCSchema(t);return new U[e].IfcGloballyUniqueId(ae.create())}async getOwnerHistory(t){const e=await t.getAllPropertiesOfType(U.IFCOWNERHISTORY);if(!e)throw new Error("No OwnerHistory was found.");const i=Object.keys(e).map(r=>parseInt(r,10)),o=e[i[0]],n=new U.Handle(o.expressID);return{ownerHistory:o,ownerHistoryHandle:n}}registerChange(t,...e){this.changeMap[t.uuid]||(this.changeMap[t.uuid]=new Set);for(const i of e)this.changeMap[t.uuid].add(i),this.onDataChanged.trigger({model:t,expressID:i})}async setData(t,...e){for(const i of e){const o=i.expressID;o&&(await t.setProperties(o,i),this.registerChange(t,o))}}async newPset(t,e,i){const o=Mt.getIFCSchema(t),{ownerHistoryHandle:n}=await this.getOwnerHistory(t),r=this.newGUID(t),a=new U[o].IfcLabel(e),c=i?new U[o].IfcText(i):null,h=new U[o].IfcPropertySet(r,n,a,c,[]);h.expressID=this.increaseMaxID(t);const d=this.newGUID(t),E=new U[o].IfcRelDefinesByProperties(d,n,null,null,[],new U.Handle(h.expressID));return E.expressID=this.increaseMaxID(t),await this.setData(t,h,E),{pset:h,rel:E}}async removePset(t,...e){for(const i of e){const o=await t.getProperties(i);if((o==null?void 0:o.type)!==U.IFCPROPERTYSET)continue;const n=await xt.getPsetRel(t,i);if(n&&(await t.setProperties(n,null),this.registerChange(t,n)),o){for(const r of o.HasProperties)await t.setProperties(r.value,null);await t.setProperties(i,null),this.onPsetRemoved.trigger({model:t,psetID:i}),this.registerChange(t,i)}}}async newSingleProperty(t,e,i,o){const n=Mt.getIFCSchema(t),r=new U[n].IfcIdentifier(i),a=new U[n][e](o),c=new U[n].IfcPropertySingleValue(r,null,a,null);return c.expressID=this.increaseMaxID(t),await this.setData(t,c),c}newSingleStringProperty(t,e,i,o){return this.newSingleProperty(t,e,i,o)}newSingleNumericProperty(t,e,i,o){return this.newSingleProperty(t,e,i,o)}newSingleBooleanProperty(t,e,i,o){return this.newSingleProperty(t,e,i,o)}async removePsetProp(t,e,i){const o=await t.getProperties(e),n=await t.getProperties(i);!o||!n||o.type===U.IFCPROPERTYSET&&n&&(o.HasProperties=o.HasProperties.filter(r=>r.value!==i),await t.setProperties(i,null),this.registerChange(t,e,i))}async addElementToPset(t,e,...i){const o=await xt.getPsetRel(t,e);if(!o)return;const n=await t.getProperties(o);if(n){for(const r of i){const a=new U.Handle(r);n.RelatedObjects.push(a),this.onElementToPset.trigger({model:t,psetID:e,elementID:r})}this.registerChange(t,e)}}async addPropToPset(t,e,...i){const o=await t.getProperties(e);if(o){for(const n of i){if(o.HasProperties.includes(n))continue;const r=new U.Handle(n);o.HasProperties.push(r),this.onPropToPset.trigger({model:t,psetID:e,propID:n})}this.registerChange(t,e)}}async saveToIfc(t,e){const i=this.components.get(Is),o=i.webIfc,n=await i.readIfcFile(e),r=this.changeMap[t.uuid]??[];for(const c of r){const h=await t.getProperties(c);if(h)try{o.WriteLine(n,h)}catch{}else try{o.DeleteLine(n,c)}catch{}}const a=o.SaveModel(n);return i.webIfc.CloseModel(n),i.cleanUp(),a}async setAttributeListener(t,e,i){this.attributeListeners[t.uuid]||(this.attributeListeners[t.uuid]={});const o=this.attributeListeners[t.uuid][e]?this.attributeListeners[t.uuid][e][i]:null;if(o)return o;const n=await t.getProperties(e);if(!n)throw new Error(`Entity with expressID ${e} doesn't exists.`);const r=n[i];if(Array.isArray(r)||!r)throw new Error(`Attribute ${i} is array or null, and it can't have a listener.`);const a=r.value;if(a===void 0||a==null)throw new Error(`Attribute ${i} has a badly defined handle.`);const c=new D;return Object.defineProperty(n[i],"value",{get(){return this._value},async set(h){this._value=h,c.trigger(h)}}),n[i].value=a,this.attributeListeners[t.uuid][e]||(this.attributeListeners[t.uuid][e]={}),this.attributeListeners[t.uuid][e][i]=c,c}};I(Mt,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let Ci=Mt;const gs=class gs extends ${constructor(t){super(t);I(this,"enabled",!0);I(this,"list",{});I(this,"onDisposed",new D);I(this,"onFragmentsDisposed",t=>{const{groupID:e,fragmentIDs:i}=t;for(const o in this.list){const n=this.list[o],r=Object.keys(n);if(r.includes(e))delete n[e],Object.values(n).length===0&&delete this.list[o];else for(const a of r){const c=n[a];for(const h of i)delete c[h];Object.values(c).length===0&&delete n[a]}}});t.add(gs.uuid,this),t.get(ct).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(ct).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(t){for(const e in this.list){const i=this.list[e];for(const o in i){const n=i[o];delete n[t]}}}find(t){const e=this.components.get(ct);if(!t){const r={};for(const[a,c]of e.list)r[a]=new Set(c.ids);return r}const i=Object.keys(t).length,o={};for(const r in t){const a=t[r];if(!this.list[r]){console.warn(`Classification ${r} does not exist.`);continue}for(const c of a){const h=this.list[r][c];if(h)for(const d in h){o[d]||(o[d]=new Map);for(const E of h[d]){const u=o[d].get(E);u===void 0?o[d].set(E,1):o[d].set(E,u+1)}}}}const n={};for(const r in o){const a=o[r];for(const[c,h]of a){if(h===void 0)throw new Error("Malformed fragments map!");h===i&&(n[r]||(n[r]=new Set),n[r].add(c))}}return n}byModel(t,e){this.list.models||(this.list.models={});const i=this.list.models;i[t]||(i[t]={});const o=i[t];for(const[n,r]of e.data){const a=r[0];for(const c of a){const h=e.keyFragments.get(c);h&&(o[h]||(o[h]=new Set),o[h].add(n))}}}async byPredefinedType(t){var o;this.list.predefinedTypes||(this.list.predefinedTypes={});const e=this.list.predefinedTypes,i=t.getAllPropertiesIDs();for(const n of i){const r=await t.getProperties(n);if(!r)continue;const a=String((o=r.PredefinedType)==null?void 0:o.value).toUpperCase();e[a]||(e[a]={});const c=e[a];for(const[h,d]of t.data){const E=d[0];for(const u of E){const p=t.keyFragments.get(u);if(!p)throw new Error("Fragment ID not found!");c[p]||(c[p]=new Set),c[p].add(r.expressID)}}}}byEntity(t){this.list.entities||(this.list.entities={});for(const[e,i]of t.data){const n=i[1][1],r=Ni[n];this.saveItem(t,"entities",r,e)}}async byIfcRel(t,e,i){xt.isRel(e)&&await xt.getRelationMap(t,e,async(o,n)=>{const{name:r}=await xt.getEntityName(t,o);for(const a of n)this.saveItem(t,i,r??"NO REL NAME",a)})}async bySpatialStructure(t){var n;const e=this.components.get(he),i=e.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 o="spatialStructures";for(const[r]of i){const a=e.getEntityRelations(t,r,"ContainsElements"),c=await t.getProperties(r);if(!(a&&c))continue;const h=(n=c.Name)==null?void 0:n.value;for(const d of a){this.saveItem(t,o,h,d);const E=e.getEntityRelations(t,Number(d),"IsDecomposedBy");if(E)for(const u of E)this.saveItem(t,o,h,u)}}}setColor(t,e,i=!1){const o=this.components.get(ct);for(const n in t){const r=o.list.get(n);if(!r)continue;const a=t[n];r.setColor(e,a,i)}}resetColor(t){const e=this.components.get(ct);for(const i in t){const o=e.list.get(i);if(!o)continue;const n=t[i];o.resetColor(n)}}saveItem(t,e,i,o){this.list[e]||(this.list[e]={});const n=t.data.get(o);if(n)for(const r of n[0]){const a=t.keyFragments.get(r);if(a){const c=this.list[e];c[i]||(c[i]={}),c[i][a]||(c[i][a]=new Set),c[i][a].add(o)}}}};I(gs,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let fs=gs;const Os=class Os extends ${constructor(t){super(t);I(this,"enabled",!0);I(this,"height",10);I(this,"groupName","storeys");I(this,"onDisposed",new D);I(this,"list",new Set);t.add(Os.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(t){if(!this.enabled)return;const e=this.components.get(fs),i=this.components.get(ct),o=t?1:-1;let n=0;const r=e.list[this.groupName],a=new S.Matrix4;for(const c in r){a.elements[13]=n*o*this.height;for(const h in r[c]){const d=i.list.get(h),E=c+h,u=this.list.has(E);if(!d||t&&u||!t&&!u)continue;t?this.list.add(E):this.list.delete(E);const p=r[c][h];d.applyTransform(p,a)}n++}}};I(Os,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let Ti=Os;const Ss=class Ss extends ${constructor(t){super(t);I(this,"enabled",!0);this.components.add(Ss.uuid,this)}set(t,e){const i=this.components.get(ct);if(!e){for(const o in i.list){const n=i.list.get(o);n&&(n.setVisibility(t),this.updateCulledVisibility(n))}return}for(const o in e){const n=e[o],r=i.list.get(o);r&&(r.setVisibility(t,n),this.updateCulledVisibility(r))}}isolate(t){this.set(!1),this.set(!0,t)}updateCulledVisibility(t){const e=this.components.get(ds);for(const[i,o]of e.list){const n=o.colorMeshes.get(t.id);n&&(n.count=t.mesh.count)}}};I(Ss,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let mi=Ss;class Vn extends Pi{constructor(){super(...arguments);I(this,"minGeometrySize",10);I(this,"minAssetsSize",1e3)}}class yi extends Pi{constructor(){super(...arguments);I(this,"propertiesSize",100)}}class Yn extends ${constructor(){super(...arguments);I(this,"onPropertiesStreamed",new Ut);I(this,"onProgress",new Ut);I(this,"onIndicesStreamed",new Ut);I(this,"onDisposed",new D);I(this,"enabled",!0);I(this,"settings",new yi);I(this,"webIfc",new U.IfcAPI)}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:i,logLevel:o}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:i,logLevel:o}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:t}=this.settings,e=new Set(this.webIfc.GetIfcEntityList(0)),i=[U.IFCRELDEFINESBYPROPERTIES,U.IFCRELDEFINESBYTYPE,U.IFCRELASSOCIATESMATERIAL,U.IFCRELCONTAINEDINSPATIALSTRUCTURE,U.IFCRELASSOCIATESCLASSIFICATION,U.IFCRELASSIGNSTOGROUP],o=new Map,n=new Set([U.IFCPROJECT,U.IFCSITE,U.IFCBUILDING,U.IFCBUILDINGSTOREY,U.IFCSPACE]);for(const h of n)e.add(h);let r=.01,a=0;for(const h of e){if(a++,_i.has(h))continue;const d=n.has(h),E=this.webIfc.GetLineIDsWithType(0,h),u=E.size();let p=0;for(let R=0;R<u-t;R+=t){const T={};for(let A=0;A<t;A++){p++;const g=E.get(R+A);try{const f=this.webIfc.GetLine(0,g,d);i.includes(h)&&this.getIndices(f,g,o),T[f.expressID]=f}catch{console.log(`Could not get property: ${g}`)}}await this.onPropertiesStreamed.trigger({type:h,data:T})}if(p!==u){const R={};for(let T=p;T<u;T++){const A=E.get(T);try{const g=this.webIfc.GetLine(0,A,d);i.includes(h)&&this.getIndices(g,A,o),R[g.expressID]=g}catch{console.log(`Could not get property: ${A}`)}}await this.onPropertiesStreamed.trigger({type:h,data:R})}const F=a/e.size;F>r&&(r+=.01,r=Math.max(r,F),await this.onProgress.trigger(Math.round(r*100)/100))}const c=[];for(const[h,d]of o)c.push([h,...d]);await this.onIndicesStreamed.trigger(c)}getIndices(t,e,i){const o=t.RelatedObjects||t.RelatedElements;if(!o){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(o)||n.value===void 0)return;const r=n.value;for(const a of o){if(a.value===void 0||a.value===null)continue;const c=a.value;i.has(c)||i.set(c,new Set),i.get(c).add(r)}}cleanUp(){this.webIfc=null,this.webIfc=new U.IfcAPI}}I(Yn,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");const _s=class _s extends ${constructor(t){super(t);I(this,"onGeometryStreamed",new D);I(this,"onAssetStreamed",new D);I(this,"onProgress",new D);I(this,"onIfcLoaded",new D);I(this,"onDisposed",new D);I(this,"settings",new Vn);I(this,"enabled",!0);I(this,"webIfc",new U.IfcAPI);I(this,"_spatialTree",new bn);I(this,"_metaData",new Bn);I(this,"_visitedGeometries",new Map);I(this,"_streamSerializer",new Dt.StreamSerializer);I(this,"_geometries",new Map);I(this,"_geometryCount",0);I(this,"_civil",new vn);I(this,"_groupSerializer",new Dt.Serializer);I(this,"_assets",[]);I(this,"_meshesWithHoles",new Set);this.components.add(_s.uuid,this),this.settings.excludedCategories.add(U.IFCOPENINGELEMENT)}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:i,logLevel:o}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:i,logLevel:o}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:t,minAssetsSize:e}=this.settings;this._spatialTree.setUp(this.webIfc);const i=this.webIfc.GetIfcEntityList(0),o=[[]],n=new Dt.FragmentsGroup;n.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let r=0,a=0;for(const R of i){if(!this.webIfc.IsIfcElement(R)&&R!==U.IFCSPACE||this.settings.excludedCategories.has(R))continue;const T=this.webIfc.GetLineIDsWithType(0,R),A=T.size();for(let g=0;g<A;g++){r>t&&(r=0,a++,o.push([]));const f=T.get(g);o[a].push(f);const m=this._spatialTree.itemsByFloor[f]||0;n.data.set(f,[[],[m,R]]),r++}}this._spatialTree.cleanUp();let c=.01,h=0;for(const R of o){h++,this.webIfc.StreamMeshes(0,R,A=>{this.getMesh(this.webIfc,A,n)}),this._geometryCount>t&&await this.streamGeometries(),this._assets.length>e&&await this.streamAssets();const T=h/o.length;T>c&&(c+=.01,c=Math.max(c,T),this.onProgress.trigger(Math.round(c*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:d,transparent:E}=n.geometryIDs;for(const[R,{index:T,uuid:A}]of this._visitedGeometries)n.keyFragments.set(T,A),(R>1?d:E).set(R,T);const u=n.data.keys();for(const R of u){const[T]=n.data.get(R);T.length||n.data.delete(R)}const p=this.webIfc.GetCoordinationMatrix(0);n.coordinationMatrix.fromArray(p),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 U.IfcAPI,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(t,e,i){const o=e.geometries.size(),n=e.expressID,r={id:n,geometries:[]};for(let a=0;a<o;a++){const c=e.geometries.get(a),h=c.geometryExpressID,d=c.color.w===1?1:-1,E=h*d;if(!this._visitedGeometries.has(E)){this._visitedGeometries.has(h)||this.getGeometry(t,h);const m=this._visitedGeometries.size,O=S.MathUtils.generateUUID();this._visitedGeometries.set(E,{uuid:O,index:m})}const u=this._visitedGeometries.get(E);if(u===void 0)throw new Error("Error getting geometry data for streaming!");const p=i.data.get(n);if(!p)throw new Error("Data not found!");p[0].push(u.index);const{x:F,y:R,z:T,w:A}=c.color,g=[F,R,T,A],f=c.flatTransformation;r.geometries.push({color:g,geometryID:h,transformation:f})}this._assets.push(r)}getGeometry(t,e){const i=t.GetGeometry(0,e),o=t.GetIndexArray(i.GetIndexData(),i.GetIndexDataSize()),n=t.GetVertexArray(i.GetVertexData(),i.GetVertexDataSize()),r=new Float32Array(n.length/2),a=new Float32Array(n.length/2);for(let u=0;u<n.length;u+=6)r[u/2]=n[u],r[u/2+1]=n[u+1],r[u/2+2]=n[u+2],a[u/2]=n[u+3],a[u/2+1]=n[u+4],a[u/2+2]=n[u+5];const c=gn(r),h=new Float32Array(c.transformation.elements),d=[c.center.x,c.center.y,c.center.z];let E=!1;for(let u=0;u<r.length-2;u+=3){const p=r[u],F=r[u+1],R=r[u+2],T=a[u],A=a[u+1],g=a[u+2];if(On(d,[p,F,R],[T,A,g])){E=!0;break}}this._geometries.set(e,{position:r,normal:a,index:o,boundingBox:h,hasHoles:E}),i.delete(),this._geometryCount++}async streamAssets(){await this.onAssetStreamed.trigger(this._assets),this._assets=null,this._assets=[]}async streamGeometries(){let t=this._streamSerializer.export(this._geometries),e={};for(const[i,{boundingBox:o,hasHoles:n}]of this._geometries)e[i]={boundingBox:o,hasHoles:n};this.onGeometryStreamed.trigger({data:e,buffer:t}),e=null,t=null,this._geometries.clear(),this._geometryCount=0}};I(_s,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let Ri=_s;class Gn extends ${constructor(){super(...arguments);I(this,"onPropertiesStreamed",new Ut);I(this,"onProgress",new Ut);I(this,"onIndicesStreamed",new Ut);I(this,"onDisposed",new D);I(this,"enabled",!0);I(this,"settings",new yi);I(this,"webIfc",new U.IfcAPI)}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:i,logLevel:o}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:i,logLevel:o}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:t}=this.settings,e=new Set(this.webIfc.GetIfcEntityList(0)),i=new Set([U.IFCPROJECT,U.IFCSITE,U.IFCBUILDING,U.IFCBUILDINGSTOREY,U.IFCSPACE]);for(const c of i)e.add(c);let o=.01,n=0;for(const c of e){if(n++,_i.has(c))continue;const h=i.has(c),d=this.webIfc.GetLineIDsWithType(0,c),E=d.size();let u=0;for(let F=0;F<E-t;F+=t){const R={};for(let T=0;T<t;T++){u++;const A=d.get(F+T);try{const g=this.webIfc.GetLine(0,A,h);R[g.expressID]=g}catch{console.log(`Could not get property: ${A}`)}}await this.onPropertiesStreamed.trigger({type:c,data:R})}if(u!==E){const F={};for(let R=u;R<E;R++){const T=d.get(R);try{const A=this.webIfc.GetLine(0,T,h);F[A.expressID]=A}catch{console.log(`Could not get property: ${T}`)}}await this.onPropertiesStreamed.trigger({type:c,data:F})}const p=n/e.size;p>o&&(o+=.01,o=Math.max(o,p),await this.onProgress.trigger(Math.round(o*100)/100))}const a=await this.components.get(he).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(a)}cleanUp(){this.webIfc=null,this.webIfc=new U.IfcAPI}}I(Gn,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");const Ns=class Ns extends ${constructor(t){super(t);I(this,"enabled",!0);t.add(Ns.uuid,this)}getFace(t,e,i){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const o=new Map,n=t.geometry.index.array,{plane:r}=this.getFaceData(e,i,t),a=[];for(let E=0;E<n.length/3;E++){const{plane:u,edges:p}=this.getFaceData(E,i,t);if(u.equals(r)){a.push({index:E,edges:p});for(const{id:F,points:R,distance:T}of p)o.set(F,{points:R,distance:T})}}let c=0;const h=new Map,d=new Map;for(const{index:E,edges:u}of a){const p=new Map;for(const{id:m}of u)if(h.has(m)){const O=h.get(m);p.set(m,O)}const F=u.map(m=>m.id);if(!p.size){const m=c++;for(const{id:O}of u)h.set(O,m);d.set(m,{edges:new Set(F),indices:new Set([E])});continue}let R=null;const T=new Set,A=new Set(F);for(const[m,O]of p){R===null?R=O:O!==R&&T.add(O),h.delete(m);const{edges:_}=d.get(O);_.delete(m),A.delete(m)}if(R===null)throw new Error("Error computing face!");const g=d.get(R),{indices:f}=g;f.add(E);for(const m of A){h.set(m,R);const{edges:O}=g;O.add(m)}for(const m of T){const O=d.get(m),{edges:_,indices:N}=O,P=d.get(R),{edges:L,indices:w}=P;for(const M of _)L.add(M),h.set(M,R);for(const M of N)w.add(M);d.delete(m)}}for(const[E,{indices:u,edges:p}]of d)if(u.has(e)){const F=[];for(const R of p){const T=o.get(R);F.push(T)}return{edges:F,indices:u}}return null}static distanceFromPointToLine(t,e,i,o=!1){const n=new S.Line3,r=new S.Vector3;return n.set(e,i),n.closestPointToPoint(t,o,r),r.distanceTo(t)}getFaceData(t,e,i){const o=this.getVerticesAndNormal(i,t,e),{p1:n,p2:r,p3:a,faceNormal:c}=o;this.round(n),this.round(r),this.round(a),this.round(c);const h=[{id:`${n.x}|${n.y}|${n.z}`,value:n},{id:`${r.x}|${r.y}|${r.z}`,value:r},{id:`${a.x}|${a.y}|${a.z}`,value:a}];h.sort((g,f)=>g.id<f.id?-1:g.id>f.id?1:0);const[{id:d,value:E},{id:u,value:p},{id:F,value:R}]=h,T=[{id:`${d}|${u}`,distance:E.distanceTo(p),points:[E,p]},{id:`${u}|${F}`,distance:p.distanceTo(R),points:[p,R]},{id:`${d}|${F}`,distance:E.distanceTo(R),points:[E,R]}],A=new S.Plane;return A.setFromNormalAndCoplanarPoint(c,n),A.constant=Math.round(A.constant*10)/10,{plane:A,edges:T}}getVerticesAndNormal(t,e,i){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const o=t.geometry.index.array,n=t.geometry.attributes.position.array,r=t.geometry.attributes.normal.array,a=o[e*3]*3,c=o[e*3+1]*3,h=o[e*3+2]*3,d=new S.Vector3(n[a],n[a+1],n[a+2]),E=new S.Vector3(n[c],n[c+1],n[c+2]),u=new S.Vector3(n[h],n[h+1],n[h+2]),p=new S.Vector3(r[a],r[a+1],r[a+2]),F=new S.Vector3(r[c],r[c+1],r[c+2]),R=new S.Vector3(r[h],r[h+1],r[h+2]),T=(p.x+F.x+R.x)/3,A=(p.y+F.y+R.y)/3,g=(p.z+F.z+R.z)/3,f=new S.Vector3(T,A,g);if(i!==void 0&&t instanceof S.InstancedMesh){const m=new S.Matrix4;t.getMatrixAt(i,m);const O=new S.Matrix4;O.extractRotation(m),f.applyMatrix4(O),d.applyMatrix4(m),E.applyMatrix4(m),u.applyMatrix4(m)}return{p1:d,p2:E,p3:u,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(Ns,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let Ai=Ns;exports.AsyncEvent=Ut;exports.Base=Ls;exports.BaseCamera=Rn;exports.BaseRenderer=An;exports.BaseScene=Fn;exports.BaseWorldItem=Ms;exports.BoundingBoxer=pi;exports.Classifier=fs;exports.Clipper=Ii;exports.Component=$;exports.Components=hs;exports.CullerRenderer=yn;exports.Cullers=ds;exports.Disposer=_t;exports.Event=D;exports.Exploder=Ti;exports.FirstPersonMode=Mn;exports.FragmentPropsStreamConverter=Yn;exports.FragmentsManager=ct;exports.Grids=ui;exports.Hider=mi;exports.IfcCategories=Lr;exports.IfcCategoryMap=Ni;exports.IfcElements=xn;exports.IfcGeometryTiler=Ri;exports.IfcJsonExporter=us;exports.IfcLoader=Is;exports.IfcPropertiesManager=Ci;exports.IfcPropertiesTiler=Gn;exports.IfcPropertiesUtils=xt;exports.IfcRelationsIndexer=he;exports.IfcStreamingSettings=Vn;exports.MaterialsUtils=di;exports.MeasurementUtils=Ai;exports.MeshCullerRenderer=Ln;exports.MiniMaps=fi;exports.OrbitMode=wn;exports.OrthoPerspectiveCamera=Pr;exports.PlanMode=Dn;exports.ProjectionManager=Un;exports.PropertiesStreamingSettings=yi;exports.Raycasters=ce;exports.SimpleCamera=le;exports.SimplePlane=ws;exports.SimpleRenderer=Er;exports.SimpleScene=hr;exports.SimpleWorld=Sn;exports.UUID=ae;exports.VertexPicker=ar;exports.Worlds=Es;exports.isPointInFrontOfPlane=On;exports.obbFromPoints=gn;exports.readPixelsAsync=Pn;
|
|
88
|
+
`,o=new Blob([i],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(o))}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[s,i,o]=t,n=`${s}-${i}-${o}`;return{r:s,g:i,b:o,code:n}}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 wn extends Mn{constructor(t,s,i){super(t,s,i);I(this,"onViewUpdated",new D);I(this,"threshold",100);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 S.MeshBasicMaterial({transparent:!0,opacity:0}));I(this,"handleWorkerMessage",async t=>{if(this.isProcessing)return;const s=t.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[i,o]of s){if(o<this.threshold)continue;const n=this._colorCodeMeshMap.get(i);n&&(this._currentVisibleMeshes.add(n),this._recentlyHiddenMeshes.delete(n))}this.onViewUpdated.trigger({seen:this._currentVisibleMeshes,unseen:this._recentlyHiddenMeshes}),this._isWorkerBusy=!1});this.worker.addEventListener("message",this.handleWorkerMessage),this.autoUpdate&&window.setInterval(async()=>{this.isProcessing||await this.updateVisibility()},this.updateInterval),this.onViewUpdated.add(({seen:o,unseen:n})=>{for(const r of o)r.visible=!0;for(const r of n)r.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(_t);for(const s in this.colorMeshes){const i=this.colorMeshes.get(s);i&&t.destroy(i,!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 s=t instanceof S.InstancedMesh,{geometry:i,material:o}=t,{colorMaterial:n,code:r}=this.getAvailableMaterial();let a;if(Array.isArray(o)){let d=!0;const h=[];for(const u of o)ui.isTransparent(u)?h.push(this._transparentMat):(d=!1,h.push(n));if(d){n.dispose(),this.isProcessing=!1;return}a=h}else if(ui.isTransparent(o)){n.dispose(),this.isProcessing=!1;return}else a=n;this._colorCodeMeshMap.set(r,t),this._meshIDColorCodeMap.set(t.uuid,r);const l=s?t.count:1,E=new S.InstancedMesh(i,a,l);s?E.instanceMatrix=t.instanceMatrix:E.setMatrixAt(0,new S.Matrix4),t.visible=!1,E.applyMatrix4(t.matrix),E.updateMatrix(),this.scene.add(E),this.colorMeshes.set(t.uuid,E),this.increaseColor(),this.isProcessing=!1}remove(t){if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const s=this.components.get(_t);this._currentVisibleMeshes.delete(t),this._recentlyHiddenMeshes.delete(t);const i=this.colorMeshes.get(t.uuid),o=this._meshIDColorCodeMap.get(t.uuid);if(!i||!o){this.isProcessing=!1,console.log(t.visible);return}this._colorCodeMeshMap.delete(o),this._meshIDColorCodeMap.delete(t.uuid),this.colorMeshes.delete(t.uuid),i.geometry=void 0,i.material=[],s.destroy(i,!0),this._recentlyHiddenMeshes.delete(t),this._currentVisibleMeshes.delete(t),this.isProcessing=!1}getAvailableMaterial(){const{r:t,g:s,b:i,code:o}=this.getAvailableColor(),n=S.ColorManagement.enabled;S.ColorManagement.enabled=!1;const r=new S.Color(`rgb(${t}, ${s}, ${i})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const a=this.world.renderer.clippingPlanes,l=new S.MeshBasicMaterial({color:r,clippingPlanes:a,side:S.DoubleSide});return S.ColorManagement.enabled=n,{colorMaterial:l,code:o}}}const we=class we extends ${constructor(t){super(t);I(this,"onDisposed",new D);I(this,"_enabled",!0);I(this,"list",new Map);t.add(we.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const[s,i]of this.list)i.enabled=t}create(t,s){if(this.list.has(t.uuid))return this.list.get(t.uuid);const i=new wn(this.components,t,s);return this.list.set(t.uuid,i),i}delete(t){const s=this.list.get(t.uuid);s&&s.dispose(),this.list.delete(t.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(we.uuid),this.onDisposed.reset();for(const[t,s]of this.list)s.dispose();this.list.clear()}};I(we,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let ds=we;class Dn{constructor(e){I(this,"onDisposed",new D);I(this,"onAfterUpdate",new D);I(this,"onBeforeUpdate",new D);I(this,"onResize",new D);I(this,"frontOffset",0);I(this,"overrideMaterial",new S.MeshDepthMaterial);I(this,"backgroundColor",new S.Color(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 S.Vector2(320,160));I(this,"_tempVector1",new S.Vector3);I(this,"_tempVector2",new S.Vector3);I(this,"_tempTarget",new S.Vector3);I(this,"down",new S.Vector3(0,-1,0));I(this,"updatePlanes",()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const e=[],t=this.world.renderer.three;for(const s of t.clippingPlanes)e.push(s);e.push(this._plane),this.renderer.clippingPlanes=e});if(this.world=e,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new S.WebGLRenderer,this.renderer.setSize(this._size.x,this._size.y);const t=1,s=this._size.x/this._size.y;this._camera=new S.OrthographicCamera(t*s/-2,t*s/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 S.Plane(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 S.Scene))throw new Error("The given world must have a THREE.Scene as a root!");const s=t.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 o=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=o+Math.PI}this._plane.set(this.down,this._tempVector1.y);const i=e.background;e.background=this.backgroundColor,this.renderer.render(e,this._camera),e.background=i,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,s=1;this._camera.left=s*t/-2,this._camera.right=s*t/2,this._camera.top=s/2,this._camera.bottom=-s/2,this._camera.updateProjectionMatrix(),this.onResize.trigger(e)}}const Rs=class Rs extends ${constructor(t){super(t);I(this,"onAfterUpdate",new D);I(this,"onBeforeUpdate",new D);I(this,"onDisposed",new D);I(this,"enabled",!0);I(this,"list",new Map);this.components.add(Rs.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a minimap!");const s=new Dn(t);return this.list.set(t.uuid,s),s}delete(t){const s=this.list.get(t);s&&s.dispose(),this.list.delete(t)}dispose(){for(const[t,s]of this.list)s.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[t,s]of this.list)s.update()}};I(Rs,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let pi=Rs;class Un{constructor(e){I(this,"enabled",!1);I(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 S.Vector3;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=nt.ACTION.DOLLY,e.touches.two=nt.ACTION.TOUCH_ZOOM_TRUCK}}class xn{constructor(e){I(this,"enabled",!0);I(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 S.Vector3;e.getPosition(t);const s=t.length();e.distance=s,e.truckSpeed=2;const{rotation:i}=this.camera.three,o=new S.Vector3(0,0,-1).applyEuler(i),n=t.addScaledVector(o,s);e.moveTo(n.x,n.y,n.z)}}class bn{constructor(e){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=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=nt.ACTION.TRUCK,t.touches.one=nt.ACTION.TOUCH_TRUCK,t.touches.two=nt.ACTION.TOUCH_ZOOM):(t.mouseButtons.left=nt.ACTION.ROTATE,t.touches.one=this.mouseAction1,t.touches.two=this.mouseAction2)}}class vn{constructor(e){I(this,"onChanged",new D);I(this,"current","Perspective");I(this,"camera");I(this,"matchOrthoDistanceEnabled",!1);I(this,"_component");I(this,"_previousDistance",-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 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 e=this.getPerspectiveDims();if(!e)return;const{width:t,height:s}=e;this.setupOrthoCamera(s,t),this.camera=this._component.threeOrtho,this.current="Orthographic"}getPerspectiveDims(){const e=this._component.currentWorld;if(!e||!e.renderer)return null;const t=new S.Vector3;this._component.threePersp.getWorldDirection(t);const s=new S.Vector3;this._component.controls.getTarget(s);const o=s.clone().sub(this._component.threePersp.position).dot(t),n=e.renderer.getSize(),r=n.x/n.y,a=this._component.threePersp,l=o*2*Math.atan(a.fov*(Math.PI/180)/2);return{width:l*r,height:l}}setupOrthoCamera(e,t){this._component.controls.mouseButtons.wheel=nt.ACTION.ZOOM,this._component.controls.mouseButtons.middle=nt.ACTION.ZOOM;const s=this._component.threePersp,i=this._component.threeOrtho;i.zoom=1,i.left=t/-2,i.right=t/2,i.top=e/2,i.bottom=e/-2,i.updateProjectionMatrix(),i.position.copy(s.position),i.quaternion.copy(s.quaternion),this._component.controls.camera=i}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=nt.ACTION.DOLLY,this._component.controls.mouseButtons.middle=nt.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=nt.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 Nr extends ce{constructor(t){super(t);I(this,"projection");I(this,"threeOrtho");I(this,"threePersp");I(this,"_userInputButtons",{});I(this,"_frustumSize",50);I(this,"_navigationModes",new Map);I(this,"_mode",null);I(this,"previousSize",null);this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new vn(this),this.onAspectUpdated.add(()=>{this.setOrthoPerspCameraAspect()}),this.projection.onChanged.add(s=>{this.three=s,this.updateAspect()}),this.onWorldChanged.add(({action:s})=>{s==="added"&&(this._navigationModes.clear(),this._navigationModes.set("Orbit",new xn(this)),this._navigationModes.set("FirstPerson",new Un(this)),this._navigationModes.set("Plan",new bn(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,s=1.5){if(!this.enabled)return;const i=Number.MAX_VALUE,o=Number.MIN_VALUE,n=new S.Vector3(i,i,i),r=new S.Vector3(o,o,o);for(const u of t){const p=new S.Box3().setFromObject(u);p.min.x<n.x&&(n.x=p.min.x),p.min.y<n.y&&(n.y=p.min.y),p.min.z<n.z&&(n.z=p.min.z),p.max.x>r.x&&(r.x=p.max.x),p.max.y>r.y&&(r.y=p.max.y),p.max.z>r.z&&(r.z=p.max.z)}const a=new S.Box3(n,r),l=new S.Vector3;a.getSize(l);const E=new S.Vector3;a.getCenter(E);const d=Math.max(l.x,l.y,l.z)*s,h=new S.Sphere(E,d);await this.controls.fitToSphere(h,!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 S.OrthographicCamera(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(),s=this.threeOrtho.top,i=this.threeOrtho.right,o=t.y/this.previousSize.y,n=t.x/this.previousSize.x,r=s*o,a=i*n;this.threeOrtho.left=-a,this.threeOrtho.right=a,this.threeOrtho.top=r,this.threeOrtho.bottom=-r,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(t)}}const Tt=class Tt extends ${constructor(t){super(t);I(this,"enabled",!0);I(this,"onDisposed",new D);I(this,"_absoluteMin");I(this,"_absoluteMax");I(this,"_meshes",[]);this.components.add(Tt.uuid,this),this._absoluteMin=Tt.newBound(!0),this._absoluteMax=Tt.newBound(!1)}static getDimensions(t){const{min:s,max:i}=t,o=Math.abs(i.x-s.x),n=Math.abs(i.y-s.y),r=Math.abs(i.z-s.z),a=new S.Vector3;return a.subVectors(i,s).divideScalar(2).add(s),{width:o,height:n,depth:r,center:a}}static newBound(t){const s=t?1:-1;return new S.Vector3(s*Number.MAX_VALUE,s*Number.MAX_VALUE,s*Number.MAX_VALUE)}static getBounds(t,s,i){const o=i||this.newBound(!1),n=s||this.newBound(!0);for(const r of t)r.x<n.x&&(n.x=r.x),r.y<n.y&&(n.y=r.y),r.z<n.z&&(n.z=r.z),r.x>o.x&&(o.x=r.x),r.y>o.y&&(o.y=r.y),r.z>o.z&&(o.z=r.z);return new S.Box3(s,i)}dispose(){const t=this.components.get(_t);for(const s of this._meshes)t.destroy(s);this._meshes=[],this.onDisposed.trigger(Tt.uuid),this.onDisposed.reset()}get(){const t=this._absoluteMin.clone(),s=this._absoluteMax.clone();return new S.Box3(t,s)}getSphere(){const t=this._absoluteMin.clone(),s=this._absoluteMax.clone(),i=Math.abs((s.x-t.x)/2),o=Math.abs((s.y-t.y)/2),n=Math.abs((s.z-t.z)/2),r=new S.Vector3(t.x+i,t.y+o,t.z+n),a=r.distanceTo(t);return new S.Sphere(r,a)}getMesh(){const t=new S.Box3(this._absoluteMin,this._absoluteMax),s=Tt.getDimensions(t),{width:i,height:o,depth:n,center:r}=s,a=new S.BoxGeometry(i,o,n),l=new S.Mesh(a);return this._meshes.push(l),l.position.copy(r),l}reset(){this._absoluteMin=Tt.newBound(!0),this._absoluteMax=Tt.newBound(!1)}add(t){for(const s of t.items)this.addMesh(s.mesh)}addMesh(t,s){if(!t.geometry.index)return;const i=Tt.getFragmentBounds(t);t.updateMatrixWorld();const o=t.matrixWorld,n=new S.Matrix4,r=t instanceof S.InstancedMesh,a=new Set;if(s&&t instanceof Dt.FragmentMesh)for(const l of s){const E=t.fragment.getInstancesIDs(l);if(E)for(const d of E)a.add(d)}else a.add(0);for(const l of a){const E=i.min.clone(),d=i.max.clone();r&&(t.getMatrixAt(l,n),E.applyMatrix4(n),d.applyMatrix4(n)),E.applyMatrix4(o),d.applyMatrix4(o),E.x<this._absoluteMin.x&&(this._absoluteMin.x=E.x),E.y<this._absoluteMin.y&&(this._absoluteMin.y=E.y),E.z<this._absoluteMin.z&&(this._absoluteMin.z=E.z),E.x>this._absoluteMax.x&&(this._absoluteMax.x=E.x),E.y>this._absoluteMax.y&&(this._absoluteMax.y=E.y),E.z>this._absoluteMax.z&&(this._absoluteMax.z=E.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.x<this._absoluteMin.x&&(this._absoluteMin.x=d.x),d.y<this._absoluteMin.y&&(this._absoluteMin.y=d.y),d.z<this._absoluteMin.z&&(this._absoluteMin.z=d.z)}}static getFragmentBounds(t){const s=t.geometry.attributes.position,i=Number.MAX_VALUE,o=-i,n=new S.Vector3(i,i,i),r=new S.Vector3(o,o,o);if(!t.geometry.index)throw new Error("Geometry must be indexed!");const a=Array.from(t.geometry.index.array);for(let l=0;l<a.length;l++){if(l%3===0&&a[l]===0&&a[l+1]===0&&a[l+2]===0){l+=2;continue}const E=a[l],d=s.getX(E),h=s.getY(E),u=s.getZ(E);d<n.x&&(n.x=d),h<n.y&&(n.y=h),u<n.z&&(n.z=u),d>r.x&&(r.x=d),h>r.y&&(r.y=h),u>r.z&&(r.z=u)}return new S.Box3(n,r)}};I(Tt,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let Ci=Tt;const Ni=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]),As=class As extends ${constructor(t){super(t);I(this,"enabled",!0);t.add(As.uuid,this)}async export(t,s,i=!1,o=!0){const n={},r=new Set(t.GetIfcEntityList(s)),a=new Set([b.IFCPROJECT,b.IFCSITE,b.IFCBUILDING,b.IFCBUILDINGSTOREY,b.IFCSPACE]);for(const l of a)r.add(l);for(const l of r){if(Ni.has(l))continue;const E=a.has(l)&&o,d=t.GetLineIDsWithType(s,l);for(const h of d){const u=t.GetLine(0,h,E,i);n[u.expressID]=u}}return n}};I(As,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let us=As;const Fs=class Fs extends ${constructor(t){super(t);I(this,"onDisposed",new D);I(this,"onFragmentsLoaded",new D);I(this,"onFragmentsDisposed",new D);I(this,"list",new Map);I(this,"groups",new Map);I(this,"baseCoordinationModel","");I(this,"enabled",!0);I(this,"_loader",new In.Serializer);this.components.add(Fs.uuid,this)}get meshes(){const t=[];for(const[s,i]of this.list)t.push(i.mesh);return t}dispose(){for(const[t,s]of this.groups)s.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:s}=t,i=[];for(const o of t.items)i.push(o.id),this.list.delete(o.id);t.dispose(!0),this.groups.delete(t.uuid),this.onFragmentsDisposed.trigger({groupID:s,fragmentIDs:i})}load(t,s){const o={...{coordinate:!0},...s},{coordinate:n,name:r,properties:a,relationsMap:l}=o,E=this._loader.import(t);r&&(E.name=r);for(const d of E.items)d.group=E,this.list.set(d.id,d);return n&&this.coordinate([E]),this.groups.set(E.uuid,E),a&&E.setLocalProperties(a),l&&this.components.get(le).setRelationMap(E,l),this.onFragmentsLoaded.trigger(E),E}export(t){return this._loader.export(t)}getModelIdMap(t){const s={};for(const i in t){const o=this.list.get(i);if(!(o&&o.group))continue;const n=o.group;n.uuid in s||(s[n.uuid]=new Set);const r=t[i];for(const a of r)s[n.uuid].add(a)}return s}modelIdToFragmentIdMap(t){let s={};for(const i in t){const o=this.groups.get(i);if(!o)continue;const n=t[i],r=o.getFragmentMap(n);s={...s,...r}}return s}coordinate(t=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const o=t.pop();if(!o)return;this.baseCoordinationModel=o.uuid}if(!t.length)return;const i=this.groups.get(this.baseCoordinationModel);if(!i){console.log("No base model found for coordination!");return}for(const o of t)o!==i&&(o.position.set(0,0,0),o.rotation.set(0,0,0),o.scale.set(1,1,1),o.updateMatrix(),o.applyMatrix4(o.coordinationMatrix.clone().invert()),o.applyMatrix4(i.coordinationMatrix))}};I(Fs,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let ct=Fs;const yr=new Map([[b.IFCRELAGGREGATES,{forRelating:"IsDecomposedBy",forRelated:"Decomposes"}],[b.IFCRELASSOCIATESMATERIAL,{forRelating:"AssociatedTo",forRelated:"HasAssociations"}],[b.IFCRELASSOCIATESCLASSIFICATION,{forRelating:"ClassificationForObjects",forRelated:"HasAssociations"}],[b.IFCRELASSIGNSTOGROUP,{forRelating:"IsGroupedBy",forRelated:"HasAssignments"}],[b.IFCRELDEFINESBYPROPERTIES,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[b.IFCRELDEFINESBYTYPE,{forRelated:"IsTypedBy",forRelating:"Types"}],[b.IFCRELDEFINESBYTEMPLATE,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[b.IFCRELCONTAINEDINSPATIALSTRUCTURE,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}]]),De=class De extends ${constructor(t){super(t);I(this,"onDisposed",new D);I(this,"onRelationsIndexed",new D);I(this,"relationMaps",{});I(this,"enabled",!0);I(this,"_relToAttributesMap",yr);I(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements"]);I(this,"_ifcRels",[b.IFCRELAGGREGATES,b.IFCRELASSOCIATESMATERIAL,b.IFCRELASSOCIATESCLASSIFICATION,b.IFCRELASSIGNSTOGROUP,b.IFCRELDEFINESBYPROPERTIES,b.IFCRELDEFINESBYTYPE,b.IFCRELDEFINESBYTEMPLATE,b.IFCRELCONTAINEDINSPATIALSTRUCTURE]);I(this,"onFragmentsDisposed",t=>{delete this.relationMaps[t.groupID]});this.components.add(De.uuid,this),t.get(ct).onFragmentsDisposed.add(this.onFragmentsDisposed)}indexRelations(t,s,i,o){const n=Object.keys(s).find(h=>h.startsWith("Relating")),r=Object.keys(s).find(h=>h.startsWith("Related"));if(!(n&&r))return;const a=s[n].value,l=s[r].map(h=>h.value),E=t.get(a)??new Map,d=this._inverseAttributes.indexOf(o);E.set(d,l),t.set(a,E);for(const h of l){const u=t.get(h)??new Map,p=this._inverseAttributes.indexOf(i),F=u.get(p)??[];F.push(a),u.set(p,F),t.set(h,u)}}setRelationMap(t,s){this.relationMaps[t.uuid]=s,this.onRelationsIndexed.trigger({modelID:t.uuid,relationsMap:s})}async process(t){if(!t.hasProperties)throw new Error("FragmentsGroup properties not found");let s=this.relationMaps[t.uuid];if(s)return s;s=new Map;for(const i of this._ifcRels){const o=await t.getAllPropertiesOfType(i);if(!o)continue;const n=this._relToAttributesMap.get(i);if(!n)continue;const{forRelated:r,forRelating:a}=n;for(const l in o){const E=o[l];this.indexRelations(s,E,r,a)}}return this.setRelationMap(t,s),s}async processFromWebIfc(t,s){const i=new Map;for(const o of this._ifcRels){const n=this._relToAttributesMap.get(o);if(!n)continue;const{forRelated:r,forRelating:a}=n,l=t.GetLineIDsWithType(s,o);for(let E=0;E<l.size();E++){const d=await t.properties.getItemProperties(s,l.get(E));this.indexRelations(i,d,r,a)}}return this.onRelationsIndexed.trigger({modelID:s.toString(),relationsMap:i}),i}getEntityRelations(t,s,i){const o=this.relationMaps[t.uuid];if(!o)return null;const n=o.get(s),r=this._inverseAttributes.indexOf(i);if(!n||r===-1)return null;const a=n.get(r);return a||null}serializeRelations(t){const s={};for(const[i,o]of t.entries()){s[i]||(s[i]={});for(const[n,r]of o.entries())s[i][n]=r}return JSON.stringify(s)}serializeModelRelations(t){const s=this.relationMaps[t.uuid];return s?this.serializeRelations(s):null}serializeAllRelations(){const t={};for(const s in this.relationMaps){const i=this.relationMaps[s],o={};for(const[n,r]of i.entries()){o[n]||(o[n]={});for(const[a,l]of r.entries())o[n][a]=l}t[s]=o}return JSON.stringify(t)}getRelationsMapFromJSON(t){const s=JSON.parse(t),i=new Map;for(const o in s){const n=s[o],r=new Map;for(const a in n)r.set(Number(a),n[a]);i.set(Number(o),r)}return i}dispose(){this.relationMaps={},this.components.get(ct).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(De.uuid),this.onDisposed.reset()}};I(De,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let le=De;const Bn={103090709:"IFCPROJECT",4097777520:"IFCSITE",4031249490:"IFCBUILDING",3124254112:"IFCBUILDINGSTOREY",3856911033:"IFCSPACE",1674181508:"IFCANNOTATION",25142252:"IFCCONTROLLER",32344328:"IFCBOILER",76236018:"IFCLAMP",90941305:"IFCPUMP",177149247:"IFCAIRTERMINALBOX",182646315:"IFCFLOWINSTRUMENT",263784265:"IFCFURNISHINGELEMENT",264262732:"IFCELECTRICGENERATOR",277319702:"IFCAUDIOVISUALAPPLIANCE",310824031:"IFCPIPEFITTING",331165859:"IFCSTAIR",342316401:"IFCDUCTFITTING",377706215:"IFCMECHANICALFASTENER",395920057:"IFCDOOR",402227799:"IFCELECTRICMOTOR",413509423:"IFCSYSTEMFURNITUREELEMENT",484807127:"IFCEVAPORATOR",486154966:"IFCWINDOWSTANDARDCASE",629592764:"IFCLIGHTFIXTURE",630975310:"IFCUNITARYCONTROLELEMENT",635142910:"IFCCABLECARRIERFITTING",639361253:"IFCCOIL",647756555:"IFCFASTENER",707683696:"IFCFLOWSTORAGEDEVICE",738039164:"IFCPROTECTIVEDEVICE",753842376:"IFCBEAM",812556717:"IFCTANK",819412036:"IFCFILTER",843113511:"IFCCOLUMN",862014818:"IFCELECTRICDISTRIBUTIONBOARD",900683007:"IFCFOOTING",905975707:"IFCCOLUMNSTANDARDCASE",926996030:"IFCVOIDINGFEATURE",979691226:"IFCREINFORCINGBAR",987401354:"IFCFLOWSEGMENT",1003880860:"IFCELECTRICTIMECONTROL",1051757585:"IFCCABLEFITTING",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1073191201:"IFCMEMBER",1095909175:"IFCBUILDINGELEMENTPROXY",1156407060:"IFCPLATESTANDARDCASE",1162798199:"IFCSWITCHINGDEVICE",1329646415:"IFCSHADINGDEVICE",1335981549:"IFCDISCRETEACCESSORY",1360408905:"IFCDUCTSILENCER",1404847402:"IFCSTACKTERMINAL",1426591983:"IFCFIRESUPPRESSIONTERMINAL",1437502449:"IFCMEDICALDEVICE",1509553395:"IFCFURNITURE",1529196076:"IFCSLAB",1620046519:"IFCTRANSPORTELEMENT",1634111441:"IFCAIRTERMINAL",1658829314:"IFCENERGYCONVERSIONDEVICE",1677625105:"IFCCIVILELEMENT",1687234759:"IFCPILE",1904799276:"IFCELECTRICAPPLIANCE",1911478936:"IFCMEMBERSTANDARDCASE",1945004755:"IFCDISTRIBUTIONELEMENT",1973544240:"IFCCOVERING",1999602285:"IFCSPACEHEATER",2016517767:"IFCROOF",2056796094:"IFCAIRTOAIRHEATRECOVERY",2058353004:"IFCFLOWCONTROLLER",2068733104:"IFCHUMIDIFIER",2176052936:"IFCJUNCTIONBOX",2188021234:"IFCFLOWMETER",2223149337:"IFCFLOWTERMINAL",2262370178:"IFCRAILING",2272882330:"IFCCONDENSER",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",2320036040:"IFCREINFORCINGMESH",2347447852:"IFCTENDONANCHOR",2391383451:"IFCVIBRATIONISOLATOR",2391406946:"IFCWALL",2474470126:"IFCMOTORCONNECTION",2769231204:"IFCVIRTUALELEMENT",2814081492:"IFCENGINE",2906023776:"IFCBEAMSTANDARDCASE",2938176219:"IFCBURNER",2979338954:"IFCBUILDINGELEMENTPART",3024970846:"IFCRAMP",3026737570:"IFCTUBEBUNDLE",3027962421:"IFCSLABSTANDARDCASE",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",3053780830:"IFCSANITARYTERMINAL",3079942009:"IFCOPENINGSTANDARDCASE",3087945054:"IFCALARM",3101698114:"IFCSURFACEFEATURE",3127900445:"IFCSLABELEMENTEDCASE",3132237377:"IFCFLOWMOVINGDEVICE",3171933400:"IFCPLATE",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",3242481149:"IFCDOORSTANDARDCASE",3283111854:"IFCRAMPFLIGHT",3296154744:"IFCCHIMNEY",3304561284:"IFCWINDOW",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",3319311131:"IFCHEATEXCHANGER",3415622556:"IFCFAN",3420628829:"IFCSOLARDEVICE",3493046030:"IFCGEOGRAPHICELEMENT",3495092785:"IFCCURTAINWALL",3508470533:"IFCFLOWTREATMENTDEVICE",3512223829:"IFCWALLSTANDARDCASE",3518393246:"IFCDUCTSEGMENT",3571504051:"IFCCOMPRESSOR",3588315303:"IFCOPENINGELEMENT",3612865200:"IFCPIPESEGMENT",3640358203:"IFCCOOLINGTOWER",3651124850:"IFCPROJECTIONELEMENT",3694346114:"IFCOUTLET",3747195512:"IFCEVAPORATIVECOOLER",3758799889:"IFCCABLECARRIERSEGMENT",3824725483:"IFCTENDON",3825984169:"IFCTRANSFORMER",3902619387:"IFCCHILLER",4074379575:"IFCDAMPER",4086658281:"IFCSENSOR",4123344466:"IFCELEMENTASSEMBLY",4136498852:"IFCCOOLEDBEAM",4156078855:"IFCWALLELEMENTEDCASE",4175244083:"IFCINTERCEPTOR",4207607924:"IFCVALVE",4217484030:"IFCCABLESEGMENT",4237592921:"IFCWASTETERMINAL",4252922144:"IFCSTAIRFLIGHT",4278956645:"IFCFLOWFITTING",4288193352:"IFCACTUATOR",4292641817:"IFCUNITARYEQUIPMENT",3009204131:"IFCGRID"};class Pr{getAll(e,t){const s={},i=Object.keys(Bn).map(o=>parseInt(o,10));for(let o=0;o<i.length;o++){const n=i[o],r=e.GetLineIDsWithType(t,n),a=r.size();for(let l=0;l<a;l++)s[r.get(l)]=n}return s}}const yi={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 Ut{static async getUnits(e){var n;const{IFCUNITASSIGNMENT:t}=b,s=await e.getAllPropertiesOfType(t);if(!s)return 1;const i=Object.keys(s),o=s[parseInt(i[0],10)];for(const r of o.Units){if(r.value===void 0||r.value===null)continue;const a=await e.getProperties(r.value);if(!a||!a.UnitType||!a.UnitType.value||a.UnitType.value!=="LENGTHUNIT")continue;let E=1,d=1;return a.Name.value==="METRE"&&(d=1),a.Name.value==="FOOT"&&(d=.3048),((n=a.Prefix)==null?void 0:n.value)==="MILLI"&&(E=.001),d*E}return 1}static async findItemByGuid(e,t){var i;const s=e.getAllPropertiesIDs();for(const o of s){const n=await e.getProperties(o);if(n&&((i=n.GlobalId)==null?void 0:i.value)===t)return n}return null}static async getRelationMap(e,t,s){var a;const o=s??(async()=>{}),n={},r=e.getAllPropertiesIDs();for(const l of r){const E=await e.getProperties(l);if(!E)continue;const d=E.type===t,h=Object.keys(E).find(T=>T.startsWith("Relating")),u=Object.keys(E).find(T=>T.startsWith("Related"));if(!(d&&h&&u))continue;const p=await e.getProperties((a=E[h])==null?void 0:a.value),F=E[u];if(!p||!F||!(F&&Array.isArray(F)))continue;const R=F.map(T=>T.value);await o(p.expressID,R),n[p.expressID]=R}return n}static async getQsetQuantities(e,t,s){const o=s??(()=>{}),n=await e.getProperties(t);return!n||n.type!==b.IFCELEMENTQUANTITY?null:(n.Quantities??[{}]).map(l=>(l.value&&o(l.value),l.value)).filter(l=>l!==null)}static async getPsetProps(e,t,s){const o=s??(()=>{}),n=await e.getProperties(t);return!n||n.type!==b.IFCPROPERTYSET?null:(n.HasProperties??[{}]).map(l=>(l.value&&o(l.value),l.value)).filter(l=>l!==null)}static async getPsetRel(e,t){var r;if(!await e.getProperties(t))return null;const i=await e.getAllPropertiesOfType(b.IFCRELDEFINESBYPROPERTIES);if(!i)return null;const o=Object.values(i);let n=null;for(const a of o)((r=a.RelatingPropertyDefinition)==null?void 0:r.value)===t&&(n=a.expressID);return n}static async getQsetRel(e,t){return Ut.getPsetRel(e,t)}static async getEntityName(e,t){var n;const s=await e.getProperties(t);if(!s)return{key:null,name:null};const i=Object.keys(s).find(r=>r.endsWith("Name"))??null,o=i?(n=s[i])==null?void 0:n.value:null;return{key:i,name:o}}static async getQuantityValue(e,t){const s=await e.getProperties(t);if(!s)return{key:null,value:null};const i=Object.keys(s).find(n=>n.endsWith("Value"))??null;let o;return i===null||s[i]===void 0||s[i]===null?o=null:o=s[i].value,{key:i,value:o}}static isRel(e){return yi[e].startsWith("IFCREL")}static async attributeExists(e,t,s){const i=await e.getProperties(t);return i?Object.keys(i).includes(s):!1}static async groupEntitiesByType(e,t){var i;const s=new Map;for(const o of t){const n=await e.getProperties(o);if(!n)continue;const r=n.type;s.get(r)||s.set(r,new Set),(i=s.get(r))==null||i.add(o)}return s}}class Lr{constructor(){I(this,"factor",1);I(this,"complement",1)}apply(e){const s=this.getScaleMatrix().multiply(e);e.copy(s)}setUp(e){var o;this.factor=1;const t=this.getLengthUnits(e);if(!t)return;const s=t==null,i=t.Name===void 0||t.Name===null;s||i||(t.Name.value==="FOOT"?this.factor=.3048:((o=t.Prefix)==null?void 0:o.value)==="MILLI"&&(this.complement=.001))}getLengthUnits(e){try{const s=e.GetLineIDsWithType(0,b.IFCUNITASSIGNMENT).get(0),i=e.GetLine(0,s);for(const o of i.Units){if(!o||o.value===null||o.value===void 0)continue;const n=e.GetLine(0,o.value);if(n.UnitType&&n.UnitType.value==="LENGTHUNIT")return n}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const e=this.factor;return new S.Matrix4().fromArray([e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1])}}class Vn{constructor(){I(this,"itemsByFloor",{});I(this,"_units",new Lr)}setUp(e){this._units.setUp(e),this.cleanUp();try{const t=e.GetLineIDsWithType(0,b.IFCRELCONTAINEDINSPATIALSTRUCTURE),s=new Set,i=e.GetLineIDsWithType(0,b.IFCSPACE);for(let l=0;l<i.size();l++)s.add(i.get(l));const o=e.GetLineIDsWithType(0,b.IFCRELAGGREGATES),n=o.size();for(let l=0;l<n;l++){const E=o.get(l),d=e.GetLine(0,E);if(!d||!d.RelatingObject||!d.RelatedObjects)continue;const h=d.RelatingObject.value,u=d.RelatedObjects;for(const p of u){const F=p.value;s.has(F)&&(this.itemsByFloor[F]=h)}}const r={},a=t.size();for(let l=0;l<a;l++){const E=t.get(l),d=e.GetLine(0,E);if(!d||!d.RelatingStructure||!d.RelatedElements)continue;const h=d.RelatingStructure.value,u=d.RelatedElements;if(s.has(h))for(const p of u){r[h]||(r[h]=[]);const F=p.value;r[h].push(F)}else for(const p of u){const F=p.value;this.itemsByFloor[F]=h}}for(const l in r){const E=this.itemsByFloor[l];if(E!==void 0){const d=r[l];for(const h of d)this.itemsByFloor[h]=E}}for(let l=0;l<n;l++){const E=o.get(l),d=e.GetLine(0,E);if(!d||!d.RelatingObject||!d.RelatedObjects)continue;const h=d.RelatingObject.value,u=d.RelatedObjects;for(const p of u){const F=p.value,R=this.itemsByFloor[h];R!==void 0&&(this.itemsByFloor[F]=R)}}}catch{console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}class Ds{constructor(){I(this,"includeProperties",!0);I(this,"optionalCategories",[b.IFCSPACE]);I(this,"coordinate",!0);I(this,"wasm",{path:"",absolute:!1,logLevel:b.LogLevel.LOG_LEVEL_OFF});I(this,"excludedCategories",new Set);I(this,"saveLocations",!1);I(this,"webIfc",{COORDINATE_TO_ORIGIN:!0,OPTIMIZE_PROFILES:!0});I(this,"autoSetWasm",!0);I(this,"customLocateFileHandler",null)}}class Yn{constructor(){I(this,"defLineMat",new S.LineBasicMaterial({color:16777215}))}read(e){const t=e.GetAllAlignments(0),s=e.GetAllCrossSections2D(0),i=e.GetAllCrossSections3D(0),o={IfcAlignment:t,IfcCrossSection2D:s,IfcCrossSection3D:i};return this.get(o)}get(e){if(e.IfcAlignment){const t=new Map;for(const s of e.IfcAlignment){const i=new Dt.Alignment;i.absolute=this.getCurves(s.curve3D,i),i.horizontal=this.getCurves(s.horizontal,i),i.vertical=this.getCurves(s.vertical,i),t.set(t.size,i)}return{alignments:t,coordinationMatrix:new S.Matrix4}}}getCurves(e,t){const s=[];let i=0;for(const o of e){const n={};if(o.data)for(const h of o.data){const[u,p]=h.split(": "),F=parseFloat(p);n[u]=F||p}const{points:r}=o,a=new Float32Array(r.length*3);for(let h=0;h<r.length;h++){const{x:u,y:p,z:F}=r[h];a[h*3]=u,a[h*3+1]=p,a[h*3+2]=F||0}const l=new S.BufferAttribute(a,3),E=new S.EdgesGeometry;E.setAttribute("position",l);const d=new Dt.CurveMesh(i,n,t,E,this.defLineMat);s.push(d.curve),i++}return s}}class Gn{getNameInfo(e){var d;const t={},{arguments:s}=e.GetHeaderLine(0,b.FILE_NAME)||{};if(!s)return t;const[i,o,n,r,a,l,E]=s;if(i!=null&&i.value&&(t.name=i.value),o!=null&&o.value&&(t.creationDate=new Date(o.value)),n){t.author={};const[h,u]=n;h!=null&&h.value&&(t.author.name=h.value),u!=null&&u.value&&(t.author.email=u.value)}return(d=r[0])!=null&&d.value&&(t.organization=r[0].value),a!=null&&a.value&&(t.preprocessorVersion=a==null?void 0:a.value),l!=null&&l.value&&(t.originatingSystem=l==null?void 0:l.value),E!=null&&E.value&&(t.authorization=E==null?void 0:E.value),t}getDescriptionInfo(e){var n;const t={},{arguments:s}=e.GetHeaderLine(0,b.FILE_DESCRIPTION)||{};if(!s)return t;const[i,o]=s;if((n=i[0])!=null&&n.value){const r=i[0].value.match(/\[([^\]]+)\]/);r[1]&&(t.viewDefinition=r[1])}return o!=null&&o.value&&(t.implementationLevel=o.value),t}}const Ue=class Ue extends ${constructor(t){super(t);I(this,"onDisposed",new D);I(this,"onIfcStartedLoading",new D);I(this,"onSetup",new D);I(this,"settings",new Ds);I(this,"webIfc",new b.IfcAPI);I(this,"enabled",!0);I(this,"_material",new S.MeshLambertMaterial);I(this,"_spatialTree",new Vn);I(this,"_metaData",new Gn);I(this,"_fragmentInstances",new Map);I(this,"_civil",new Yn);I(this,"_visitedFragments",new Map);I(this,"_materialT",new S.MeshLambertMaterial({transparent:!0,opacity:.5}));this.components.add(Ue.uuid,this),this.settings.excludedCategories.add(b.IFCOPENINGELEMENT)}dispose(){this.webIfc=null,this.onDisposed.trigger(Ue.uuid),this.onDisposed.reset()}async setup(t){this.settings={...this.settings,...t},this.settings.autoSetWasm&&await this.autoSetWasm(),this.onSetup.trigger()}async load(t,s=!0){const i=performance.now();this.onIfcStartedLoading.trigger(),await this.readIfcFile(t);const o=await this.getAllGeometries(),r=await this.components.get(us).export(this.webIfc,0);o.setLocalProperties(r),this.cleanUp();const a=this.components.get(ct);a.groups.set(o.uuid,o);for(const l of o.items)a.list.set(l.id,l),l.mesh.uuid=l.id,l.group=o;return a.onFragmentsLoaded.trigger(o),s&&a.coordinate([o]),console.log(`Streaming the IFC took ${performance.now()-i} ms!`),o}async readIfcFile(t){const{path:s,absolute:i,logLevel:o}=this.settings.wasm;return this.webIfc.SetWasmPath(s,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModel(t,this.settings.webIfc)}cleanUp(){this.webIfc=null,this.webIfc=new b.IfcAPI,this._visitedFragments.clear(),this._fragmentInstances.clear()}async getAllGeometries(){this._spatialTree.setUp(this.webIfc);const t=this.webIfc.GetIfcEntityList(0),s=new Dt.FragmentsGroup;s.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};const i=[];for(const n of t){if(!this.webIfc.IsIfcElement(n)&&n!==b.IFCSPACE||this.settings.excludedCategories.has(n))continue;const r=this.webIfc.GetLineIDsWithType(0,n),a=r.size();for(let l=0;l<a;l++){const E=r.get(l);i.push(E);const d=this._spatialTree.itemsByFloor[E]||0;s.data.set(E,[[],[d,n]])}}this._spatialTree.cleanUp(),this.webIfc.StreamMeshes(0,i,n=>{this.getMesh(n,s)});for(const n of this._visitedFragments){const{index:r,fragment:a}=n[1];s.keyFragments.set(r,a.id)}for(const n of s.items){const r=this._fragmentInstances.get(n.id);if(!r)throw new Error("Fragment not found!");const a=[];for(const[l,E]of r)a.push(E);n.add(a)}const o=this.webIfc.GetCoordinationMatrix(0);return s.coordinationMatrix.fromArray(o),s.civilData=this._civil.read(this.webIfc),s}getMesh(t,s){const i=t.geometries.size(),o=t.expressID;for(let n=0;n<i;n++){const r=t.geometries.get(n),{x:a,y:l,z:E,w:d}=r.color,h=d!==1,{geometryExpressID:u}=r,p=`${u}-${h}`;if(!this._visitedFragments.has(p)){const m=this.getGeometry(this.webIfc,u),g=h?this._materialT:this._material,_=new Dt.Fragment(m,g,1);s.add(_.mesh),s.items.push(_);const N=this._visitedFragments.size;this._visitedFragments.set(p,{index:N,fragment:_})}const F=new S.Color().setRGB(a,l,E,"srgb"),R=new S.Matrix4;R.fromArray(r.flatTransformation);const T=this._visitedFragments.get(p);if(T===void 0)throw new Error("Error getting geometry data for streaming!");const A=s.data.get(o);if(!A)throw new Error("Data not found!");A[0].push(T.index);const{fragment:O}=T;this._fragmentInstances.has(O.id)||this._fragmentInstances.set(O.id,new Map);const f=this._fragmentInstances.get(O.id);if(!f)throw new Error("Instances not found!");if(f.has(o)){const m=f.get(o);if(!m)throw new Error("Instance not found!");m.transforms.push(R),m.colors&&m.colors.push(F)}else f.set(o,{id:o,transforms:[R],colors:[F]})}}getGeometry(t,s){const i=t.GetGeometry(0,s),o=t.GetIndexArray(i.GetIndexData(),i.GetIndexDataSize()),n=t.GetVertexArray(i.GetVertexData(),i.GetVertexDataSize()),r=new Float32Array(n.length/2),a=new Float32Array(n.length/2);for(let h=0;h<n.length;h+=6)r[h/2]=n[h],r[h/2+1]=n[h+1],r[h/2+2]=n[h+2],a[h/2]=n[h+3],a[h/2+1]=n[h+4],a[h/2+2]=n[h+5];const l=new S.BufferGeometry,E=new S.BufferAttribute(r,3),d=new S.BufferAttribute(a,3);return l.setAttribute("position",E),l.setAttribute("normal",d),l.setIndex(Array.from(o)),i.delete(),l}async autoSetWasm(){const t=await fetch(`https://unpkg.com/@thatopen/components@${hs.release}/package.json`);if(!t.ok){console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");return}const s=await t.json();if(!("web-ifc"in s.peerDependencies))console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.");else{const i=s.peerDependencies["web-ifc"];this.settings.wasm.path=`https://unpkg.com/web-ifc@${i}/`,this.settings.wasm.absolute=!0}}};I(Ue,"uuid","a659add7-1418-4771-a0d6-7d4d438e4624");let Is=Ue;const Mt=class Mt extends ${constructor(t){super(t);I(this,"onDisposed",new D);I(this,"onRequestFile",new D);I(this,"ifcToExport",null);I(this,"onElementToPset",new D);I(this,"onPropToPset",new D);I(this,"onPsetRemoved",new D);I(this,"onDataChanged",new D);I(this,"wasm",{path:"/",absolute:!1});I(this,"enabled",!0);I(this,"attributeListeners",{});I(this,"selectedModel");I(this,"changeMap",{});this.components.add(Mt.uuid,this)}dispose(){this.selectedModel=void 0,this.attributeListeners={},this.changeMap={},this.onElementToPset.reset(),this.onPropToPset.reset(),this.onPsetRemoved.reset(),this.onDataChanged.reset(),this.onDisposed.trigger(Mt.uuid),this.onDisposed.reset()}static getIFCSchema(t){const s=t.ifcMetadata.schema;if(!s)throw new Error("IFC Schema not found");return s}async setData(t,...s){for(const i of s){const o=i.expressID;o&&(await t.setProperties(o,i),this.registerChange(t,o))}}async newPset(t,s,i){const o=Mt.getIFCSchema(t),{ownerHistoryHandle:n}=await this.getOwnerHistory(t),r=this.newGUID(t),a=new b[o].IfcLabel(s),l=i?new b[o].IfcText(i):null,E=new b[o].IfcPropertySet(r,n,a,l,[]);E.expressID=this.increaseMaxID(t);const d=this.newGUID(t),h=new b[o].IfcRelDefinesByProperties(d,n,null,null,[],new b.Handle(E.expressID));return h.expressID=this.increaseMaxID(t),await this.setData(t,E,h),{pset:E,rel:h}}async removePset(t,...s){for(const i of s){const o=await t.getProperties(i);if((o==null?void 0:o.type)!==b.IFCPROPERTYSET)continue;const n=await Ut.getPsetRel(t,i);if(n&&(await t.setProperties(n,null),this.registerChange(t,n)),o){for(const r of o.HasProperties)await t.setProperties(r.value,null);await t.setProperties(i,null),this.onPsetRemoved.trigger({model:t,psetID:i}),this.registerChange(t,i)}}}newSingleStringProperty(t,s,i,o){return this.newSingleProperty(t,s,i,o)}newSingleNumericProperty(t,s,i,o){return this.newSingleProperty(t,s,i,o)}newSingleBooleanProperty(t,s,i,o){return this.newSingleProperty(t,s,i,o)}async removePsetProp(t,s,i){const o=await t.getProperties(s),n=await t.getProperties(i);!o||!n||o.type===b.IFCPROPERTYSET&&n&&(o.HasProperties=o.HasProperties.filter(r=>r.value!==i),await t.setProperties(i,null),this.registerChange(t,s,i))}async addElementToPset(t,s,...i){const o=await Ut.getPsetRel(t,s);if(!o)return;const n=await t.getProperties(o);if(n){for(const r of i){const a=new b.Handle(r);n.RelatedObjects.push(a),this.onElementToPset.trigger({model:t,psetID:s,elementID:r})}this.registerChange(t,s)}}async addPropToPset(t,s,...i){const o=await t.getProperties(s);if(o){for(const n of i){if(o.HasProperties.includes(n))continue;const r=new b.Handle(n);o.HasProperties.push(r),this.onPropToPset.trigger({model:t,psetID:s,propID:n})}this.registerChange(t,s)}}async saveToIfc(t,s){const i=this.components.get(Is),o=i.webIfc,n=await i.readIfcFile(s),r=this.changeMap[t.uuid]??[];for(const l of r){const E=await t.getProperties(l);if(E)try{o.WriteLine(n,E)}catch{}else try{o.DeleteLine(n,l)}catch{}}const a=o.SaveModel(n);return i.webIfc.CloseModel(n),i.cleanUp(),a}async setAttributeListener(t,s,i){this.attributeListeners[t.uuid]||(this.attributeListeners[t.uuid]={});const o=this.attributeListeners[t.uuid][s]?this.attributeListeners[t.uuid][s][i]:null;if(o)return o;const n=await t.getProperties(s);if(!n)throw new Error(`Entity with expressID ${s} doesn't exists.`);const r=n[i];if(Array.isArray(r)||!r)throw new Error(`Attribute ${i} is array or null, and it can't have a listener.`);const a=r.value;if(a===void 0||a==null)throw new Error(`Attribute ${i} has a badly defined handle.`);const l=new D;return Object.defineProperty(n[i],"value",{get(){return this._value},async set(E){this._value=E,l.trigger(E)}}),n[i].value=a,this.attributeListeners[t.uuid][s]||(this.attributeListeners[t.uuid][s]={}),this.attributeListeners[t.uuid][s][i]=l,l}increaseMaxID(t){return t.ifcMetadata.maxExpressID++,t.ifcMetadata.maxExpressID}newGUID(t){const s=Mt.getIFCSchema(t);return new b[s].IfcGloballyUniqueId(re.create())}async getOwnerHistory(t){const s=await t.getAllPropertiesOfType(b.IFCOWNERHISTORY);if(!s)throw new Error("No OwnerHistory was found.");const i=Object.keys(s).map(r=>parseInt(r,10)),o=s[i[0]],n=new b.Handle(o.expressID);return{ownerHistory:o,ownerHistoryHandle:n}}registerChange(t,...s){this.changeMap[t.uuid]||(this.changeMap[t.uuid]=new Set);for(const i of s)this.changeMap[t.uuid].add(i),this.onDataChanged.trigger({model:t,expressID:i})}async newSingleProperty(t,s,i,o){const n=Mt.getIFCSchema(t),r=new b[n].IfcIdentifier(i),a=new b[n][s](o),l=new b[n].IfcPropertySingleValue(r,null,a,null);return l.expressID=this.increaseMaxID(t),await this.setData(t,l),l}};I(Mt,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let Ti=Mt;const Os=class Os extends ${constructor(t){super(t);I(this,"enabled",!0);I(this,"list",{});I(this,"onDisposed",new D);I(this,"onFragmentsDisposed",t=>{const{groupID:s,fragmentIDs:i}=t;for(const o in this.list){const n=this.list[o],r=Object.keys(n);if(r.includes(s))delete n[s],Object.values(n).length===0&&delete this.list[o];else for(const a of r){const l=n[a];for(const E of i)delete l[E];Object.values(l).length===0&&delete n[a]}}});t.add(Os.uuid,this),t.get(ct).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(ct).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(t){for(const s in this.list){const i=this.list[s];for(const o in i){const n=i[o];delete n[t]}}}find(t){const s=this.components.get(ct);if(!t){const r={};for(const[a,l]of s.list)r[a]=new Set(l.ids);return r}const i=Object.keys(t).length,o={};for(const r in t){const a=t[r];if(!this.list[r]){console.warn(`Classification ${r} does not exist.`);continue}for(const l of a){const E=this.list[r][l];if(E)for(const d in E){o[d]||(o[d]=new Map);for(const h of E[d]){const u=o[d].get(h);u===void 0?o[d].set(h,1):o[d].set(h,u+1)}}}}const n={};for(const r in o){const a=o[r];for(const[l,E]of a){if(E===void 0)throw new Error("Malformed fragments map!");E===i&&(n[r]||(n[r]=new Set),n[r].add(l))}}return n}byModel(t,s){this.list.models||(this.list.models={});const i=this.list.models;i[t]||(i[t]={});const o=i[t];for(const[n,r]of s.data){const a=r[0];for(const l of a){const E=s.keyFragments.get(l);E&&(o[E]||(o[E]=new Set),o[E].add(n))}}}async byPredefinedType(t){var o;this.list.predefinedTypes||(this.list.predefinedTypes={});const s=this.list.predefinedTypes,i=t.getAllPropertiesIDs();for(const n of i){const r=await t.getProperties(n);if(!r)continue;const a=String((o=r.PredefinedType)==null?void 0:o.value).toUpperCase();s[a]||(s[a]={});const l=s[a];for(const[E,d]of t.data){const h=d[0];for(const u of h){const p=t.keyFragments.get(u);if(!p)throw new Error("Fragment ID not found!");l[p]||(l[p]=new Set),l[p].add(r.expressID)}}}}byEntity(t){this.list.entities||(this.list.entities={});for(const[s,i]of t.data){const n=i[1][1],r=yi[n];this.saveItem(t,"entities",r,s)}}async byIfcRel(t,s,i){Ut.isRel(s)&&await Ut.getRelationMap(t,s,async(o,n)=>{const{name:r}=await Ut.getEntityName(t,o);for(const a of n)this.saveItem(t,i,r??"NO REL NAME",a)})}async bySpatialStructure(t){var n;const s=this.components.get(le),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 o="spatialStructures";for(const[r]of i){const a=s.getEntityRelations(t,r,"ContainsElements"),l=await t.getProperties(r);if(!(a&&l))continue;const E=(n=l.Name)==null?void 0:n.value;for(const d of a){this.saveItem(t,o,E,d);const h=s.getEntityRelations(t,Number(d),"IsDecomposedBy");if(h)for(const u of h)this.saveItem(t,o,E,u)}}}setColor(t,s,i=!1){const o=this.components.get(ct);for(const n in t){const r=o.list.get(n);if(!r)continue;const a=t[n];r.setColor(s,a,i)}}resetColor(t){const s=this.components.get(ct);for(const i in t){const o=s.list.get(i);if(!o)continue;const n=t[i];o.resetColor(n)}}saveItem(t,s,i,o){this.list[s]||(this.list[s]={});const n=t.data.get(o);if(n)for(const r of n[0]){const a=t.keyFragments.get(r);if(a){const l=this.list[s];l[i]||(l[i]={}),l[i][a]||(l[i][a]=new Set),l[i][a].add(o)}}}};I(Os,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let fs=Os;const gs=class gs extends ${constructor(t){super(t);I(this,"onDisposed",new D);I(this,"enabled",!0);I(this,"height",10);I(this,"groupName","storeys");I(this,"list",new Set);t.add(gs.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(t){if(!this.enabled)return;const s=this.components.get(fs),i=this.components.get(ct),o=t?1:-1;let n=0;const r=s.list[this.groupName],a=new S.Matrix4;for(const l in r){a.elements[13]=n*o*this.height;for(const E in r[l]){const d=i.list.get(E),h=l+E,u=this.list.has(h);if(!d||t&&u||!t&&!u)continue;t?this.list.add(h):this.list.delete(h);const p=r[l][E];d.applyTransform(p,a)}n++}}};I(gs,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let mi=gs;const Ss=class Ss extends ${constructor(t){super(t);I(this,"enabled",!0);this.components.add(Ss.uuid,this)}set(t,s){const i=this.components.get(ct);if(!s){for(const o in i.list){const n=i.list.get(o);n&&(n.setVisibility(t),this.updateCulledVisibility(n))}return}for(const o in s){const n=s[o],r=i.list.get(o);r&&(r.setVisibility(t,n),this.updateCulledVisibility(r))}}isolate(t){this.set(!1),this.set(!0,t)}updateCulledVisibility(t){const s=this.components.get(ds);for(const[i,o]of s.list){const n=o.colorMeshes.get(t.id);n&&(n.count=t.mesh.count)}}};I(Ss,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let Ri=Ss;class zn extends Ds{constructor(){super(...arguments);I(this,"minGeometrySize",10);I(this,"minAssetsSize",1e3)}}const _s=class _s extends ${constructor(t){super(t);I(this,"onGeometryStreamed",new D);I(this,"onAssetStreamed",new D);I(this,"onProgress",new D);I(this,"onIfcLoaded",new D);I(this,"onDisposed",new D);I(this,"settings",new zn);I(this,"enabled",!0);I(this,"webIfc",new b.IfcAPI);I(this,"_spatialTree",new Vn);I(this,"_metaData",new Gn);I(this,"_visitedGeometries",new Map);I(this,"_streamSerializer",new Dt.StreamSerializer);I(this,"_geometries",new Map);I(this,"_geometryCount",0);I(this,"_civil",new Yn);I(this,"_groupSerializer",new Dt.Serializer);I(this,"_assets",[]);I(this,"_meshesWithHoles",new Set);this.components.add(_s.uuid,this),this.settings.excludedCategories.add(b.IFCOPENINGELEMENT)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(t){await this.readIfcFile(t),await this.streamAllGeometries(),this.cleanUp()}async streamFromCallBack(t){await this.streamIfcFile(t),await this.streamAllGeometries(),this.cleanUp()}async readIfcFile(t){const{path:s,absolute:i,logLevel:o}=this.settings.wasm;this.webIfc.SetWasmPath(s,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:s,absolute:i,logLevel:o}=this.settings.wasm;this.webIfc.SetWasmPath(s,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:t,minAssetsSize:s}=this.settings;this._spatialTree.setUp(this.webIfc);const i=this.webIfc.GetIfcEntityList(0),o=[[]],n=new Dt.FragmentsGroup;n.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let r=0,a=0;for(const R of i){if(!this.webIfc.IsIfcElement(R)&&R!==b.IFCSPACE||this.settings.excludedCategories.has(R))continue;const T=this.webIfc.GetLineIDsWithType(0,R),A=T.size();for(let O=0;O<A;O++){r>t&&(r=0,a++,o.push([]));const f=T.get(O);o[a].push(f);const m=this._spatialTree.itemsByFloor[f]||0;n.data.set(f,[[],[m,R]]),r++}}this._spatialTree.cleanUp();let l=.01,E=0;for(const R of o){E++,this.webIfc.StreamMeshes(0,R,A=>{this.getMesh(this.webIfc,A,n)}),this._geometryCount>t&&await this.streamGeometries(),this._assets.length>s&&await this.streamAssets();const T=E/o.length;T>l&&(l+=.01,l=Math.max(l,T),this.onProgress.trigger(Math.round(l*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:d,transparent:h}=n.geometryIDs;for(const[R,{index:T,uuid:A}]of this._visitedGeometries)n.keyFragments.set(T,A),(R>1?d:h).set(R,T);const u=n.data.keys();for(const R of u){const[T]=n.data.get(R);T.length||n.data.delete(R)}const p=this.webIfc.GetCoordinationMatrix(0);n.coordinationMatrix.fromArray(p),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 b.IfcAPI,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(t,s,i){const o=s.geometries.size(),n=s.expressID,r={id:n,geometries:[]};for(let a=0;a<o;a++){const l=s.geometries.get(a),E=l.geometryExpressID,d=l.color.w===1?1:-1,h=E*d;if(!this._visitedGeometries.has(h)){this._visitedGeometries.has(E)||this.getGeometry(t,E);const m=this._visitedGeometries.size,g=S.MathUtils.generateUUID();this._visitedGeometries.set(h,{uuid:g,index:m})}const u=this._visitedGeometries.get(h);if(u===void 0)throw new Error("Error getting geometry data for streaming!");const p=i.data.get(n);if(!p)throw new Error("Data not found!");p[0].push(u.index);const{x:F,y:R,z:T,w:A}=l.color,O=[F,R,T,A],f=l.flatTransformation;r.geometries.push({color:O,geometryID:E,transformation:f})}this._assets.push(r)}getGeometry(t,s){const i=t.GetGeometry(0,s),o=t.GetIndexArray(i.GetIndexData(),i.GetIndexDataSize()),n=t.GetVertexArray(i.GetVertexData(),i.GetVertexDataSize()),r=new Float32Array(n.length/2),a=new Float32Array(n.length/2);for(let u=0;u<n.length;u+=6)r[u/2]=n[u],r[u/2+1]=n[u+1],r[u/2+2]=n[u+2],a[u/2]=n[u+3],a[u/2+1]=n[u+4],a[u/2+2]=n[u+5];const l=Fn(r),E=new Float32Array(l.transformation.elements),d=[l.center.x,l.center.y,l.center.z];let h=!1;for(let u=0;u<r.length-2;u+=3){const p=r[u],F=r[u+1],R=r[u+2],T=a[u],A=a[u+1],O=a[u+2];if(On(d,[p,F,R],[T,A,O])){h=!0;break}}this._geometries.set(s,{position:r,normal:a,index:o,boundingBox:E,hasHoles:h}),i.delete(),this._geometryCount++}async streamAssets(){await this.onAssetStreamed.trigger(this._assets),this._assets=null,this._assets=[]}async streamGeometries(){let t=this._streamSerializer.export(this._geometries),s={};for(const[i,{boundingBox:o,hasHoles:n}]of this._geometries)s[i]={boundingBox:o,hasHoles:n};this.onGeometryStreamed.trigger({data:s,buffer:t}),s=null,t=null,this._geometries.clear(),this._geometryCount=0}};I(_s,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let Ai=_s;class Hn extends Ds{constructor(){super(...arguments);I(this,"propertiesSize",100)}}class kn extends ${constructor(){super(...arguments);I(this,"onPropertiesStreamed",new Pe);I(this,"onProgress",new Pe);I(this,"onIndicesStreamed",new Pe);I(this,"onDisposed",new D);I(this,"enabled",!0);I(this,"settings",new Hn);I(this,"webIfc",new b.IfcAPI)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(t){await this.readIfcFile(t),await this.streamAllProperties(),this.cleanUp()}async streamFromCallBack(t){await this.streamIfcFile(t),await this.streamAllProperties(),this.cleanUp()}async readIfcFile(t){const{path:s,absolute:i,logLevel:o}=this.settings.wasm;this.webIfc.SetWasmPath(s,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:s,absolute:i,logLevel:o}=this.settings.wasm;this.webIfc.SetWasmPath(s,i),await this.webIfc.Init(),o&&this.webIfc.SetLogLevel(o),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:t}=this.settings,s=new Set(this.webIfc.GetIfcEntityList(0)),i=new Set([b.IFCPROJECT,b.IFCSITE,b.IFCBUILDING,b.IFCBUILDINGSTOREY,b.IFCSPACE]);for(const l of i)s.add(l);let o=.01,n=0;for(const l of s){if(n++,Ni.has(l))continue;const E=i.has(l),d=this.webIfc.GetLineIDsWithType(0,l),h=d.size();let u=0;for(let F=0;F<h-t;F+=t){const R={};for(let T=0;T<t;T++){u++;const A=d.get(F+T);try{const O=this.webIfc.GetLine(0,A,E);R[O.expressID]=O}catch{console.log(`Could not get property: ${A}`)}}await this.onPropertiesStreamed.trigger({type:l,data:R})}if(u!==h){const F={};for(let R=u;R<h;R++){const T=d.get(R);try{const A=this.webIfc.GetLine(0,T,E);F[A.expressID]=A}catch{console.log(`Could not get property: ${T}`)}}await this.onPropertiesStreamed.trigger({type:l,data:F})}const p=n/s.size;p>o&&(o+=.01,o=Math.max(o,p),await this.onProgress.trigger(Math.round(o*100)/100))}const a=await this.components.get(le).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(a)}cleanUp(){this.webIfc=null,this.webIfc=new b.IfcAPI}}I(kn,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");const Ns=class Ns extends ${constructor(t){super(t);I(this,"enabled",!0);t.add(Ns.uuid,this)}static distanceFromPointToLine(t,s,i,o=!1){const n=new S.Line3,r=new S.Vector3;return n.set(s,i),n.closestPointToPoint(t,o,r),r.distanceTo(t)}getFace(t,s,i){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const o=new Map,n=t.geometry.index.array,{plane:r}=this.getFaceData(s,i,t),a=[];for(let h=0;h<n.length/3;h++){const{plane:u,edges:p}=this.getFaceData(h,i,t);if(u.equals(r)){a.push({index:h,edges:p});for(const{id:F,points:R,distance:T}of p)o.set(F,{points:R,distance:T})}}let l=0;const E=new Map,d=new Map;for(const{index:h,edges:u}of a){const p=new Map;for(const{id:m}of u)if(E.has(m)){const g=E.get(m);p.set(m,g)}const F=u.map(m=>m.id);if(!p.size){const m=l++;for(const{id:g}of u)E.set(g,m);d.set(m,{edges:new Set(F),indices:new Set([h])});continue}let R=null;const T=new Set,A=new Set(F);for(const[m,g]of p){R===null?R=g:g!==R&&T.add(g),E.delete(m);const{edges:_}=d.get(g);_.delete(m),A.delete(m)}if(R===null)throw new Error("Error computing face!");const O=d.get(R),{indices:f}=O;f.add(h);for(const m of A){E.set(m,R);const{edges:g}=O;g.add(m)}for(const m of T){const g=d.get(m),{edges:_,indices:N}=g,y=d.get(R),{edges:L,indices:w}=y;for(const M of _)L.add(M),E.set(M,R);for(const M of N)w.add(M);d.delete(m)}}for(const[h,{indices:u,edges:p}]of d)if(u.has(s)){const F=[];for(const R of p){const T=o.get(R);F.push(T)}return{edges:F,indices:u}}return null}getVerticesAndNormal(t,s,i){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const o=t.geometry.index.array,n=t.geometry.attributes.position.array,r=t.geometry.attributes.normal.array,a=o[s*3]*3,l=o[s*3+1]*3,E=o[s*3+2]*3,d=new S.Vector3(n[a],n[a+1],n[a+2]),h=new S.Vector3(n[l],n[l+1],n[l+2]),u=new S.Vector3(n[E],n[E+1],n[E+2]),p=new S.Vector3(r[a],r[a+1],r[a+2]),F=new S.Vector3(r[l],r[l+1],r[l+2]),R=new S.Vector3(r[E],r[E+1],r[E+2]),T=(p.x+F.x+R.x)/3,A=(p.y+F.y+R.y)/3,O=(p.z+F.z+R.z)/3,f=new S.Vector3(T,A,O);if(i!==void 0&&t instanceof S.InstancedMesh){const m=new S.Matrix4;t.getMatrixAt(i,m);const g=new S.Matrix4;g.extractRotation(m),f.applyMatrix4(g),d.applyMatrix4(m),h.applyMatrix4(m),u.applyMatrix4(m)}return{p1:d,p2:h,p3:u,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}getFaceData(t,s,i){const o=this.getVerticesAndNormal(i,t,s),{p1:n,p2:r,p3:a,faceNormal:l}=o;this.round(n),this.round(r),this.round(a),this.round(l);const E=[{id:`${n.x}|${n.y}|${n.z}`,value:n},{id:`${r.x}|${r.y}|${r.z}`,value:r},{id:`${a.x}|${a.y}|${a.z}`,value:a}];E.sort((O,f)=>O.id<f.id?-1:O.id>f.id?1:0);const[{id:d,value:h},{id:u,value:p},{id:F,value:R}]=E,T=[{id:`${d}|${u}`,distance:h.distanceTo(p),points:[h,p]},{id:`${u}|${F}`,distance:p.distanceTo(R),points:[p,R]},{id:`${d}|${F}`,distance:h.distanceTo(R),points:[h,R]}],A=new S.Plane;return A.setFromNormalAndCoplanarPoint(l,n),A.constant=Math.round(A.constant*10)/10,{plane:A,edges:T}}};I(Ns,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let Fi=Ns;exports.AsyncEvent=Pe;exports.Base=Ls;exports.BaseCamera=mn;exports.BaseRenderer=Rn;exports.BaseScene=An;exports.BaseWorldItem=Ms;exports.BoundingBoxer=Ci;exports.Classifier=fs;exports.Clipper=fi;exports.Component=$;exports.Components=hs;exports.CullerRenderer=Mn;exports.Cullers=ds;exports.Disposer=_t;exports.Event=D;exports.Exploder=mi;exports.FirstPersonMode=Un;exports.FragmentsManager=ct;exports.GeometryTypes=Ni;exports.Grids=Ii;exports.Hider=Ri;exports.IfcCategories=Pr;exports.IfcCategoryMap=yi;exports.IfcElements=Bn;exports.IfcFragmentSettings=Ds;exports.IfcGeometryTiler=Ai;exports.IfcJsonExporter=us;exports.IfcLoader=Is;exports.IfcPropertiesManager=Ti;exports.IfcPropertiesTiler=kn;exports.IfcPropertiesUtils=Ut;exports.IfcRelationsIndexer=le;exports.IfcStreamingSettings=zn;exports.MaterialsUtils=ui;exports.MeasurementUtils=Fi;exports.MeshCullerRenderer=wn;exports.MiniMap=Dn;exports.MiniMaps=pi;exports.Mouse=gn;exports.OrbitMode=xn;exports.OrthoPerspectiveCamera=Nr;exports.PlanMode=bn;exports.ProjectionManager=vn;exports.PropertiesStreamingSettings=Hn;exports.Raycasters=ae;exports.SimpleCamera=ce;exports.SimpleGrid=Pn;exports.SimplePlane=ws;exports.SimpleRaycaster=Sn;exports.SimpleRenderer=dr;exports.SimpleScene=Er;exports.SimpleWorld=_n;exports.UUID=re;exports.VertexPicker=hr;exports.Worlds=Es;exports.isPointInFrontOfPlane=On;exports.obbFromPoints=Fn;exports.readPixelsAsync=Ln;
|