ifc-reader-2 1.2.4 → 1.2.5
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/base-types.d.ts +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/base-types.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -36,5 +36,5 @@ return ret;
|
|
|
36
36
|
* @license
|
|
37
37
|
* Copyright 2010-2023 Three.js Authors
|
|
38
38
|
* SPDX-License-Identifier: MIT
|
|
39
|
-
*/const CM="162",gM=300,bB=1e3,rb=1001,HB=1002,BB=1003,Nx=1006,vx=1008,Ax=1009,Ox=1014,Sx=1020,Lx=1023,cH=1026,MB=1027,mx="",Px=515,ab=2e3,xB=2001;class bM{addEventListener(t,b){this._listeners===void 0&&(this._listeners={});const _=this._listeners;_[t]===void 0&&(_[t]=[]),_[t].indexOf(b)===-1&&_[t].push(b)}hasEventListener(t,b){if(this._listeners===void 0)return!1;const _=this._listeners;return _[t]!==void 0&&_[t].indexOf(b)!==-1}removeEventListener(t,b){if(this._listeners===void 0)return;const le=this._listeners[t];if(le!==void 0){const se=le.indexOf(b);se!==-1&&le.splice(se,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const _=this._listeners[t.type];if(_!==void 0){t.target=this;const le=_.slice(0);for(let se=0,Se=le.length;se<Se;se++)le[se].call(this,t);t.target=null}}}const Kr=["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"];function cB(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,b=Math.random()*4294967295|0,_=Math.random()*4294967295|0;return(Kr[e&255]+Kr[e>>8&255]+Kr[e>>16&255]+Kr[e>>24&255]+"-"+Kr[t&255]+Kr[t>>8&255]+"-"+Kr[t>>16&15|64]+Kr[t>>24&255]+"-"+Kr[b&63|128]+Kr[b>>8&255]+"-"+Kr[b>>16&255]+Kr[b>>24&255]+Kr[_&255]+Kr[_>>8&255]+Kr[_>>16&255]+Kr[_>>24&255]).toLowerCase()}function S7(e,t,b){return Math.max(t,Math.min(b,e))}class ng{constructor(t=0,b=0){ng.prototype.isVector2=!0,this.x=t,this.y=b}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,b){return this.x=t,this.y=b,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,b){switch(t){case 0:this.x=b;break;case 1:this.y=b;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,b){return this.x=t.x+b.x,this.y=t.y+b.y,this}addScaledVector(t,b){return this.x+=t.x*b,this.y+=t.y*b,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,b){return this.x=t.x-b.x,this.y=t.y-b.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const b=this.x,_=this.y,le=t.elements;return this.x=le[0]*b+le[3]*_+le[6],this.y=le[1]*b+le[4]*_+le[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,b){return this.x=Math.max(t.x,Math.min(b.x,this.x)),this.y=Math.max(t.y,Math.min(b.y,this.y)),this}clampScalar(t,b){return this.x=Math.max(t,Math.min(b,this.x)),this.y=Math.max(t,Math.min(b,this.y)),this}clampLength(t,b){const _=this.length();return this.divideScalar(_||1).multiplyScalar(Math.max(t,Math.min(b,_)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const b=Math.sqrt(this.lengthSq()*t.lengthSq());if(b===0)return Math.PI/2;const _=this.dot(t)/b;return Math.acos(S7(_,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const b=this.x-t.x,_=this.y-t.y;return b*b+_*_}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,b){return this.x+=(t.x-this.x)*b,this.y+=(t.y-this.y)*b,this}lerpVectors(t,b,_){return this.x=t.x+(b.x-t.x)*_,this.y=t.y+(b.y-t.y)*_,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,b=0){return this.x=t[b],this.y=t[b+1],this}toArray(t=[],b=0){return t[b]=this.x,t[b+1]=this.y,t}fromBufferAttribute(t,b){return this.x=t.getX(b),this.y=t.getY(b),this}rotateAround(t,b){const _=Math.cos(b),le=Math.sin(b),se=this.x-t.x,Se=this.y-t.y;return this.x=se*_-Se*le+t.x,this.y=se*le+Se*_+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Rg{constructor(t,b,_,le,se,Se,He,me,ve){Rg.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,b,_,le,se,Se,He,me,ve)}set(t,b,_,le,se,Se,He,me,ve){const be=this.elements;return be[0]=t,be[1]=le,be[2]=He,be[3]=b,be[4]=se,be[5]=me,be[6]=_,be[7]=Se,be[8]=ve,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const b=this.elements,_=t.elements;return b[0]=_[0],b[1]=_[1],b[2]=_[2],b[3]=_[3],b[4]=_[4],b[5]=_[5],b[6]=_[6],b[7]=_[7],b[8]=_[8],this}extractBasis(t,b,_){return t.setFromMatrix3Column(this,0),b.setFromMatrix3Column(this,1),_.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const b=t.elements;return this.set(b[0],b[4],b[8],b[1],b[5],b[9],b[2],b[6],b[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,b){const _=t.elements,le=b.elements,se=this.elements,Se=_[0],He=_[3],me=_[6],ve=_[1],be=_[4],Ue=_[7],qe=_[2],Oe=_[5],Qe=_[8],it=le[0],yt=le[3],Rt=le[6],li=le[1],Jt=le[4],Di=le[7],Ai=le[2],At=le[5],mt=le[8];return se[0]=Se*it+He*li+me*Ai,se[3]=Se*yt+He*Jt+me*At,se[6]=Se*Rt+He*Di+me*mt,se[1]=ve*it+be*li+Ue*Ai,se[4]=ve*yt+be*Jt+Ue*At,se[7]=ve*Rt+be*Di+Ue*mt,se[2]=qe*it+Oe*li+Qe*Ai,se[5]=qe*yt+Oe*Jt+Qe*At,se[8]=qe*Rt+Oe*Di+Qe*mt,this}multiplyScalar(t){const b=this.elements;return b[0]*=t,b[3]*=t,b[6]*=t,b[1]*=t,b[4]*=t,b[7]*=t,b[2]*=t,b[5]*=t,b[8]*=t,this}determinant(){const t=this.elements,b=t[0],_=t[1],le=t[2],se=t[3],Se=t[4],He=t[5],me=t[6],ve=t[7],be=t[8];return b*Se*be-b*He*ve-_*se*be+_*He*me+le*se*ve-le*Se*me}invert(){const t=this.elements,b=t[0],_=t[1],le=t[2],se=t[3],Se=t[4],He=t[5],me=t[6],ve=t[7],be=t[8],Ue=be*Se-He*ve,qe=He*me-be*se,Oe=ve*se-Se*me,Qe=b*Ue+_*qe+le*Oe;if(Qe===0)return this.set(0,0,0,0,0,0,0,0,0);const it=1/Qe;return t[0]=Ue*it,t[1]=(le*ve-be*_)*it,t[2]=(He*_-le*Se)*it,t[3]=qe*it,t[4]=(be*b-le*me)*it,t[5]=(le*se-He*b)*it,t[6]=Oe*it,t[7]=(_*me-ve*b)*it,t[8]=(Se*b-_*se)*it,this}transpose(){let t;const b=this.elements;return t=b[1],b[1]=b[3],b[3]=t,t=b[2],b[2]=b[6],b[6]=t,t=b[5],b[5]=b[7],b[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const b=this.elements;return t[0]=b[0],t[1]=b[3],t[2]=b[6],t[3]=b[1],t[4]=b[4],t[5]=b[7],t[6]=b[2],t[7]=b[5],t[8]=b[8],this}setUvTransform(t,b,_,le,se,Se,He){const me=Math.cos(se),ve=Math.sin(se);return this.set(_*me,_*ve,-_*(me*Se+ve*He)+Se+t,-le*ve,le*me,-le*(-ve*Se+me*He)+He+b,0,0,1),this}scale(t,b){return this.premultiply(IH.makeScale(t,b)),this}rotate(t){return this.premultiply(IH.makeRotation(-t)),this}translate(t,b){return this.premultiply(IH.makeTranslation(t,b)),this}makeTranslation(t,b){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,b,0,0,1),this}makeRotation(t){const b=Math.cos(t),_=Math.sin(t);return this.set(b,-_,0,_,b,0,0,0,1),this}makeScale(t,b){return this.set(t,0,0,0,b,0,0,0,1),this}equals(t){const b=this.elements,_=t.elements;for(let le=0;le<9;le++)if(b[le]!==_[le])return!1;return!0}fromArray(t,b=0){for(let _=0;_<9;_++)this.elements[_]=t[_+b];return this}toArray(t=[],b=0){const _=this.elements;return t[b]=_[0],t[b+1]=_[1],t[b+2]=_[2],t[b+3]=_[3],t[b+4]=_[4],t[b+5]=_[5],t[b+6]=_[6],t[b+7]=_[7],t[b+8]=_[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const IH=new Rg;function UB(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function hH(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}let dS;class Cx{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let b;if(t instanceof HTMLCanvasElement)b=t;else{dS===void 0&&(dS=UB("canvas")),dS.width=t.width,dS.height=t.height;const _=dS.getContext("2d");t instanceof ImageData?_.putImageData(t,0,0):_.drawImage(t,0,0,t.width,t.height),b=dS}return b.width>2048||b.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),b.toDataURL("image/jpeg",.6)):b.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const b=UB("canvas");b.width=t.width,b.height=t.height;const _=b.getContext("2d");_.drawImage(t,0,0,t.width,t.height);const le=_.getImageData(0,0,t.width,t.height),se=le.data;for(let Se=0;Se<se.length;Se++)se[Se]=hH(se[Se]/255)*255;return _.putImageData(le,0,0),b}else if(t.data){const b=t.data.slice(0);for(let _=0;_<b.length;_++)b instanceof Uint8Array||b instanceof Uint8ClampedArray?b[_]=Math.floor(hH(b[_]/255)*255):b[_]=hH(b[_]);return{data:b,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let gx=0;class bx{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:gx++}),this.uuid=cB(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){const b=t===void 0||typeof t=="string";if(!b&&t.images[this.uuid]!==void 0)return t.images[this.uuid];const _={uuid:this.uuid,url:""},le=this.data;if(le!==null){let se;if(Array.isArray(le)){se=[];for(let Se=0,He=le.length;Se<He;Se++)le[Se].isDataTexture?se.push(fH(le[Se].image)):se.push(fH(le[Se]))}else se=fH(le);_.url=se}return b||(t.images[this.uuid]=_),_}}function fH(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap?Cx.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Hx=0;class SD extends bM{constructor(t=SD.DEFAULT_IMAGE,b=SD.DEFAULT_MAPPING,_=rb,le=rb,se=Nx,Se=vx,He=Lx,me=Ax,ve=SD.DEFAULT_ANISOTROPY,be=mx){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Hx++}),this.uuid=cB(),this.name="",this.source=new bx(t),this.mipmaps=[],this.mapping=b,this.channel=0,this.wrapS=_,this.wrapT=le,this.magFilter=se,this.minFilter=Se,this.anisotropy=ve,this.format=He,this.internalFormat=null,this.type=me,this.offset=new ng(0,0),this.repeat=new ng(1,1),this.center=new ng(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Rg,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=be,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const b=t===void 0||typeof t=="string";if(!b&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const _={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(_.userData=this.userData),b||(t.textures[this.uuid]=_),_}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==gM)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case bB:t.x=t.x-Math.floor(t.x);break;case rb:t.x=t.x<0?0:1;break;case HB:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case bB:t.y=t.y-Math.floor(t.y);break;case rb:t.y=t.y<0?0:1;break;case HB:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}}SD.DEFAULT_IMAGE=null;SD.DEFAULT_MAPPING=gM;SD.DEFAULT_ANISOTROPY=1;class Dg{constructor(t=0,b=0,_=0,le=1){this.isQuaternion=!0,this._x=t,this._y=b,this._z=_,this._w=le}static slerpFlat(t,b,_,le,se,Se,He){let me=_[le+0],ve=_[le+1],be=_[le+2],Ue=_[le+3];const qe=se[Se+0],Oe=se[Se+1],Qe=se[Se+2],it=se[Se+3];if(He===0){t[b+0]=me,t[b+1]=ve,t[b+2]=be,t[b+3]=Ue;return}if(He===1){t[b+0]=qe,t[b+1]=Oe,t[b+2]=Qe,t[b+3]=it;return}if(Ue!==it||me!==qe||ve!==Oe||be!==Qe){let yt=1-He;const Rt=me*qe+ve*Oe+be*Qe+Ue*it,li=Rt>=0?1:-1,Jt=1-Rt*Rt;if(Jt>Number.EPSILON){const Ai=Math.sqrt(Jt),At=Math.atan2(Ai,Rt*li);yt=Math.sin(yt*At)/Ai,He=Math.sin(He*At)/Ai}const Di=He*li;if(me=me*yt+qe*Di,ve=ve*yt+Oe*Di,be=be*yt+Qe*Di,Ue=Ue*yt+it*Di,yt===1-He){const Ai=1/Math.sqrt(me*me+ve*ve+be*be+Ue*Ue);me*=Ai,ve*=Ai,be*=Ai,Ue*=Ai}}t[b]=me,t[b+1]=ve,t[b+2]=be,t[b+3]=Ue}static multiplyQuaternionsFlat(t,b,_,le,se,Se){const He=_[le],me=_[le+1],ve=_[le+2],be=_[le+3],Ue=se[Se],qe=se[Se+1],Oe=se[Se+2],Qe=se[Se+3];return t[b]=He*Qe+be*Ue+me*Oe-ve*qe,t[b+1]=me*Qe+be*qe+ve*Ue-He*Oe,t[b+2]=ve*Qe+be*Oe+He*qe-me*Ue,t[b+3]=be*Qe-He*Ue-me*qe-ve*Oe,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,b,_,le){return this._x=t,this._y=b,this._z=_,this._w=le,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,b=!0){const _=t._x,le=t._y,se=t._z,Se=t._order,He=Math.cos,me=Math.sin,ve=He(_/2),be=He(le/2),Ue=He(se/2),qe=me(_/2),Oe=me(le/2),Qe=me(se/2);switch(Se){case"XYZ":this._x=qe*be*Ue+ve*Oe*Qe,this._y=ve*Oe*Ue-qe*be*Qe,this._z=ve*be*Qe+qe*Oe*Ue,this._w=ve*be*Ue-qe*Oe*Qe;break;case"YXZ":this._x=qe*be*Ue+ve*Oe*Qe,this._y=ve*Oe*Ue-qe*be*Qe,this._z=ve*be*Qe-qe*Oe*Ue,this._w=ve*be*Ue+qe*Oe*Qe;break;case"ZXY":this._x=qe*be*Ue-ve*Oe*Qe,this._y=ve*Oe*Ue+qe*be*Qe,this._z=ve*be*Qe+qe*Oe*Ue,this._w=ve*be*Ue-qe*Oe*Qe;break;case"ZYX":this._x=qe*be*Ue-ve*Oe*Qe,this._y=ve*Oe*Ue+qe*be*Qe,this._z=ve*be*Qe-qe*Oe*Ue,this._w=ve*be*Ue+qe*Oe*Qe;break;case"YZX":this._x=qe*be*Ue+ve*Oe*Qe,this._y=ve*Oe*Ue+qe*be*Qe,this._z=ve*be*Qe-qe*Oe*Ue,this._w=ve*be*Ue-qe*Oe*Qe;break;case"XZY":this._x=qe*be*Ue-ve*Oe*Qe,this._y=ve*Oe*Ue-qe*be*Qe,this._z=ve*be*Qe+qe*Oe*Ue,this._w=ve*be*Ue+qe*Oe*Qe;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+Se)}return b===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,b){const _=b/2,le=Math.sin(_);return this._x=t.x*le,this._y=t.y*le,this._z=t.z*le,this._w=Math.cos(_),this._onChangeCallback(),this}setFromRotationMatrix(t){const b=t.elements,_=b[0],le=b[4],se=b[8],Se=b[1],He=b[5],me=b[9],ve=b[2],be=b[6],Ue=b[10],qe=_+He+Ue;if(qe>0){const Oe=.5/Math.sqrt(qe+1);this._w=.25/Oe,this._x=(be-me)*Oe,this._y=(se-ve)*Oe,this._z=(Se-le)*Oe}else if(_>He&&_>Ue){const Oe=2*Math.sqrt(1+_-He-Ue);this._w=(be-me)/Oe,this._x=.25*Oe,this._y=(le+Se)/Oe,this._z=(se+ve)/Oe}else if(He>Ue){const Oe=2*Math.sqrt(1+He-_-Ue);this._w=(se-ve)/Oe,this._x=(le+Se)/Oe,this._y=.25*Oe,this._z=(me+be)/Oe}else{const Oe=2*Math.sqrt(1+Ue-_-He);this._w=(Se-le)/Oe,this._x=(se+ve)/Oe,this._y=(me+be)/Oe,this._z=.25*Oe}return this._onChangeCallback(),this}setFromUnitVectors(t,b){let _=t.dot(b)+1;return _<Number.EPSILON?(_=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=_):(this._x=0,this._y=-t.z,this._z=t.y,this._w=_)):(this._x=t.y*b.z-t.z*b.y,this._y=t.z*b.x-t.x*b.z,this._z=t.x*b.y-t.y*b.x,this._w=_),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(S7(this.dot(t),-1,1)))}rotateTowards(t,b){const _=this.angleTo(t);if(_===0)return this;const le=Math.min(1,b/_);return this.slerp(t,le),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,b){const _=t._x,le=t._y,se=t._z,Se=t._w,He=b._x,me=b._y,ve=b._z,be=b._w;return this._x=_*be+Se*He+le*ve-se*me,this._y=le*be+Se*me+se*He-_*ve,this._z=se*be+Se*ve+_*me-le*He,this._w=Se*be-_*He-le*me-se*ve,this._onChangeCallback(),this}slerp(t,b){if(b===0)return this;if(b===1)return this.copy(t);const _=this._x,le=this._y,se=this._z,Se=this._w;let He=Se*t._w+_*t._x+le*t._y+se*t._z;if(He<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,He=-He):this.copy(t),He>=1)return this._w=Se,this._x=_,this._y=le,this._z=se,this;const me=1-He*He;if(me<=Number.EPSILON){const Oe=1-b;return this._w=Oe*Se+b*this._w,this._x=Oe*_+b*this._x,this._y=Oe*le+b*this._y,this._z=Oe*se+b*this._z,this.normalize(),this}const ve=Math.sqrt(me),be=Math.atan2(ve,He),Ue=Math.sin((1-b)*be)/ve,qe=Math.sin(b*be)/ve;return this._w=Se*Ue+this._w*qe,this._x=_*Ue+this._x*qe,this._y=le*Ue+this._y*qe,this._z=se*Ue+this._z*qe,this._onChangeCallback(),this}slerpQuaternions(t,b,_){return this.copy(t).slerp(b,_)}random(){const t=2*Math.PI*Math.random(),b=2*Math.PI*Math.random(),_=Math.random(),le=Math.sqrt(1-_),se=Math.sqrt(_);return this.set(le*Math.sin(t),le*Math.cos(t),se*Math.sin(b),se*Math.cos(b))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,b=0){return this._x=t[b],this._y=t[b+1],this._z=t[b+2],this._w=t[b+3],this._onChangeCallback(),this}toArray(t=[],b=0){return t[b]=this._x,t[b+1]=this._y,t[b+2]=this._z,t[b+3]=this._w,t}fromBufferAttribute(t,b){return this._x=t.getX(b),this._y=t.getY(b),this._z=t.getZ(b),this._w=t.getW(b),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class jn{constructor(t=0,b=0,_=0){jn.prototype.isVector3=!0,this.x=t,this.y=b,this.z=_}set(t,b,_){return _===void 0&&(_=this.z),this.x=t,this.y=b,this.z=_,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,b){switch(t){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,b){return this.x=t.x+b.x,this.y=t.y+b.y,this.z=t.z+b.z,this}addScaledVector(t,b){return this.x+=t.x*b,this.y+=t.y*b,this.z+=t.z*b,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,b){return this.x=t.x-b.x,this.y=t.y-b.y,this.z=t.z-b.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,b){return this.x=t.x*b.x,this.y=t.y*b.y,this.z=t.z*b.z,this}applyEuler(t){return this.applyQuaternion(GB.setFromEuler(t))}applyAxisAngle(t,b){return this.applyQuaternion(GB.setFromAxisAngle(t,b))}applyMatrix3(t){const b=this.x,_=this.y,le=this.z,se=t.elements;return this.x=se[0]*b+se[3]*_+se[6]*le,this.y=se[1]*b+se[4]*_+se[7]*le,this.z=se[2]*b+se[5]*_+se[8]*le,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const b=this.x,_=this.y,le=this.z,se=t.elements,Se=1/(se[3]*b+se[7]*_+se[11]*le+se[15]);return this.x=(se[0]*b+se[4]*_+se[8]*le+se[12])*Se,this.y=(se[1]*b+se[5]*_+se[9]*le+se[13])*Se,this.z=(se[2]*b+se[6]*_+se[10]*le+se[14])*Se,this}applyQuaternion(t){const b=this.x,_=this.y,le=this.z,se=t.x,Se=t.y,He=t.z,me=t.w,ve=2*(Se*le-He*_),be=2*(He*b-se*le),Ue=2*(se*_-Se*b);return this.x=b+me*ve+Se*Ue-He*be,this.y=_+me*be+He*ve-se*Ue,this.z=le+me*Ue+se*be-Se*ve,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const b=this.x,_=this.y,le=this.z,se=t.elements;return this.x=se[0]*b+se[4]*_+se[8]*le,this.y=se[1]*b+se[5]*_+se[9]*le,this.z=se[2]*b+se[6]*_+se[10]*le,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,b){return this.x=Math.max(t.x,Math.min(b.x,this.x)),this.y=Math.max(t.y,Math.min(b.y,this.y)),this.z=Math.max(t.z,Math.min(b.z,this.z)),this}clampScalar(t,b){return this.x=Math.max(t,Math.min(b,this.x)),this.y=Math.max(t,Math.min(b,this.y)),this.z=Math.max(t,Math.min(b,this.z)),this}clampLength(t,b){const _=this.length();return this.divideScalar(_||1).multiplyScalar(Math.max(t,Math.min(b,_)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,b){return this.x+=(t.x-this.x)*b,this.y+=(t.y-this.y)*b,this.z+=(t.z-this.z)*b,this}lerpVectors(t,b,_){return this.x=t.x+(b.x-t.x)*_,this.y=t.y+(b.y-t.y)*_,this.z=t.z+(b.z-t.z)*_,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,b){const _=t.x,le=t.y,se=t.z,Se=b.x,He=b.y,me=b.z;return this.x=le*me-se*He,this.y=se*Se-_*me,this.z=_*He-le*Se,this}projectOnVector(t){const b=t.lengthSq();if(b===0)return this.set(0,0,0);const _=t.dot(this)/b;return this.copy(t).multiplyScalar(_)}projectOnPlane(t){return pH.copy(this).projectOnVector(t),this.sub(pH)}reflect(t){return this.sub(pH.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const b=Math.sqrt(this.lengthSq()*t.lengthSq());if(b===0)return Math.PI/2;const _=this.dot(t)/b;return Math.acos(S7(_,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const b=this.x-t.x,_=this.y-t.y,le=this.z-t.z;return b*b+_*_+le*le}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,b,_){const le=Math.sin(b)*t;return this.x=le*Math.sin(_),this.y=Math.cos(b)*t,this.z=le*Math.cos(_),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,b,_){return this.x=t*Math.sin(b),this.y=_,this.z=t*Math.cos(b),this}setFromMatrixPosition(t){const b=t.elements;return this.x=b[12],this.y=b[13],this.z=b[14],this}setFromMatrixScale(t){const b=this.setFromMatrixColumn(t,0).length(),_=this.setFromMatrixColumn(t,1).length(),le=this.setFromMatrixColumn(t,2).length();return this.x=b,this.y=_,this.z=le,this}setFromMatrixColumn(t,b){return this.fromArray(t.elements,b*4)}setFromMatrix3Column(t,b){return this.fromArray(t.elements,b*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,b=0){return this.x=t[b],this.y=t[b+1],this.z=t[b+2],this}toArray(t=[],b=0){return t[b]=this.x,t[b+1]=this.y,t[b+2]=this.z,t}fromBufferAttribute(t,b){return this.x=t.getX(b),this.y=t.getY(b),this.z=t.getZ(b),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,b=Math.random()*2-1,_=Math.sqrt(1-b*b);return this.x=_*Math.cos(t),this.y=b,this.z=_*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const pH=new jn,GB=new Dg;class l4{constructor(t,b,_,le,se,Se,He,me,ve,be,Ue,qe,Oe,Qe,it,yt){l4.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,b,_,le,se,Se,He,me,ve,be,Ue,qe,Oe,Qe,it,yt)}set(t,b,_,le,se,Se,He,me,ve,be,Ue,qe,Oe,Qe,it,yt){const Rt=this.elements;return Rt[0]=t,Rt[4]=b,Rt[8]=_,Rt[12]=le,Rt[1]=se,Rt[5]=Se,Rt[9]=He,Rt[13]=me,Rt[2]=ve,Rt[6]=be,Rt[10]=Ue,Rt[14]=qe,Rt[3]=Oe,Rt[7]=Qe,Rt[11]=it,Rt[15]=yt,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new l4().fromArray(this.elements)}copy(t){const b=this.elements,_=t.elements;return b[0]=_[0],b[1]=_[1],b[2]=_[2],b[3]=_[3],b[4]=_[4],b[5]=_[5],b[6]=_[6],b[7]=_[7],b[8]=_[8],b[9]=_[9],b[10]=_[10],b[11]=_[11],b[12]=_[12],b[13]=_[13],b[14]=_[14],b[15]=_[15],this}copyPosition(t){const b=this.elements,_=t.elements;return b[12]=_[12],b[13]=_[13],b[14]=_[14],this}setFromMatrix3(t){const b=t.elements;return this.set(b[0],b[3],b[6],0,b[1],b[4],b[7],0,b[2],b[5],b[8],0,0,0,0,1),this}extractBasis(t,b,_){return t.setFromMatrixColumn(this,0),b.setFromMatrixColumn(this,1),_.setFromMatrixColumn(this,2),this}makeBasis(t,b,_){return this.set(t.x,b.x,_.x,0,t.y,b.y,_.y,0,t.z,b.z,_.z,0,0,0,0,1),this}extractRotation(t){const b=this.elements,_=t.elements,le=1/rS.setFromMatrixColumn(t,0).length(),se=1/rS.setFromMatrixColumn(t,1).length(),Se=1/rS.setFromMatrixColumn(t,2).length();return b[0]=_[0]*le,b[1]=_[1]*le,b[2]=_[2]*le,b[3]=0,b[4]=_[4]*se,b[5]=_[5]*se,b[6]=_[6]*se,b[7]=0,b[8]=_[8]*Se,b[9]=_[9]*Se,b[10]=_[10]*Se,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,this}makeRotationFromEuler(t){const b=this.elements,_=t.x,le=t.y,se=t.z,Se=Math.cos(_),He=Math.sin(_),me=Math.cos(le),ve=Math.sin(le),be=Math.cos(se),Ue=Math.sin(se);if(t.order==="XYZ"){const qe=Se*be,Oe=Se*Ue,Qe=He*be,it=He*Ue;b[0]=me*be,b[4]=-me*Ue,b[8]=ve,b[1]=Oe+Qe*ve,b[5]=qe-it*ve,b[9]=-He*me,b[2]=it-qe*ve,b[6]=Qe+Oe*ve,b[10]=Se*me}else if(t.order==="YXZ"){const qe=me*be,Oe=me*Ue,Qe=ve*be,it=ve*Ue;b[0]=qe+it*He,b[4]=Qe*He-Oe,b[8]=Se*ve,b[1]=Se*Ue,b[5]=Se*be,b[9]=-He,b[2]=Oe*He-Qe,b[6]=it+qe*He,b[10]=Se*me}else if(t.order==="ZXY"){const qe=me*be,Oe=me*Ue,Qe=ve*be,it=ve*Ue;b[0]=qe-it*He,b[4]=-Se*Ue,b[8]=Qe+Oe*He,b[1]=Oe+Qe*He,b[5]=Se*be,b[9]=it-qe*He,b[2]=-Se*ve,b[6]=He,b[10]=Se*me}else if(t.order==="ZYX"){const qe=Se*be,Oe=Se*Ue,Qe=He*be,it=He*Ue;b[0]=me*be,b[4]=Qe*ve-Oe,b[8]=qe*ve+it,b[1]=me*Ue,b[5]=it*ve+qe,b[9]=Oe*ve-Qe,b[2]=-ve,b[6]=He*me,b[10]=Se*me}else if(t.order==="YZX"){const qe=Se*me,Oe=Se*ve,Qe=He*me,it=He*ve;b[0]=me*be,b[4]=it-qe*Ue,b[8]=Qe*Ue+Oe,b[1]=Ue,b[5]=Se*be,b[9]=-He*be,b[2]=-ve*be,b[6]=Oe*Ue+Qe,b[10]=qe-it*Ue}else if(t.order==="XZY"){const qe=Se*me,Oe=Se*ve,Qe=He*me,it=He*ve;b[0]=me*be,b[4]=-Ue,b[8]=ve*be,b[1]=qe*Ue+it,b[5]=Se*be,b[9]=Oe*Ue-Qe,b[2]=Qe*Ue-Oe,b[6]=He*be,b[10]=it*Ue+qe}return b[3]=0,b[7]=0,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Bx,t,Mx)}lookAt(t,b,_){const le=this.elements;return Jh.subVectors(t,b),Jh.lengthSq()===0&&(Jh.z=1),Jh.normalize(),GR.crossVectors(_,Jh),GR.lengthSq()===0&&(Math.abs(_.z)===1?Jh.x+=1e-4:Jh.z+=1e-4,Jh.normalize(),GR.crossVectors(_,Jh)),GR.normalize(),cb.crossVectors(Jh,GR),le[0]=GR.x,le[4]=cb.x,le[8]=Jh.x,le[1]=GR.y,le[5]=cb.y,le[9]=Jh.y,le[2]=GR.z,le[6]=cb.z,le[10]=Jh.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,b){const _=t.elements,le=b.elements,se=this.elements,Se=_[0],He=_[4],me=_[8],ve=_[12],be=_[1],Ue=_[5],qe=_[9],Oe=_[13],Qe=_[2],it=_[6],yt=_[10],Rt=_[14],li=_[3],Jt=_[7],Di=_[11],Ai=_[15],At=le[0],mt=le[4],Gs=le[8],Yn=le[12],Et=le[1],Ft=le[5],ed=le[9],wl=le[13],qn=le[2],Zd=le[6],Ui=le[10],ai=le[14],Jd=le[3],td=le[7],mn=le[11],_d=le[15];return se[0]=Se*At+He*Et+me*qn+ve*Jd,se[4]=Se*mt+He*Ft+me*Zd+ve*td,se[8]=Se*Gs+He*ed+me*Ui+ve*mn,se[12]=Se*Yn+He*wl+me*ai+ve*_d,se[1]=be*At+Ue*Et+qe*qn+Oe*Jd,se[5]=be*mt+Ue*Ft+qe*Zd+Oe*td,se[9]=be*Gs+Ue*ed+qe*Ui+Oe*mn,se[13]=be*Yn+Ue*wl+qe*ai+Oe*_d,se[2]=Qe*At+it*Et+yt*qn+Rt*Jd,se[6]=Qe*mt+it*Ft+yt*Zd+Rt*td,se[10]=Qe*Gs+it*ed+yt*Ui+Rt*mn,se[14]=Qe*Yn+it*wl+yt*ai+Rt*_d,se[3]=li*At+Jt*Et+Di*qn+Ai*Jd,se[7]=li*mt+Jt*Ft+Di*Zd+Ai*td,se[11]=li*Gs+Jt*ed+Di*Ui+Ai*mn,se[15]=li*Yn+Jt*wl+Di*ai+Ai*_d,this}multiplyScalar(t){const b=this.elements;return b[0]*=t,b[4]*=t,b[8]*=t,b[12]*=t,b[1]*=t,b[5]*=t,b[9]*=t,b[13]*=t,b[2]*=t,b[6]*=t,b[10]*=t,b[14]*=t,b[3]*=t,b[7]*=t,b[11]*=t,b[15]*=t,this}determinant(){const t=this.elements,b=t[0],_=t[4],le=t[8],se=t[12],Se=t[1],He=t[5],me=t[9],ve=t[13],be=t[2],Ue=t[6],qe=t[10],Oe=t[14],Qe=t[3],it=t[7],yt=t[11],Rt=t[15];return Qe*(+se*me*Ue-le*ve*Ue-se*He*qe+_*ve*qe+le*He*Oe-_*me*Oe)+it*(+b*me*Oe-b*ve*qe+se*Se*qe-le*Se*Oe+le*ve*be-se*me*be)+yt*(+b*ve*Ue-b*He*Oe-se*Se*Ue+_*Se*Oe+se*He*be-_*ve*be)+Rt*(-le*He*be-b*me*Ue+b*He*qe+le*Se*Ue-_*Se*qe+_*me*be)}transpose(){const t=this.elements;let b;return b=t[1],t[1]=t[4],t[4]=b,b=t[2],t[2]=t[8],t[8]=b,b=t[6],t[6]=t[9],t[9]=b,b=t[3],t[3]=t[12],t[12]=b,b=t[7],t[7]=t[13],t[13]=b,b=t[11],t[11]=t[14],t[14]=b,this}setPosition(t,b,_){const le=this.elements;return t.isVector3?(le[12]=t.x,le[13]=t.y,le[14]=t.z):(le[12]=t,le[13]=b,le[14]=_),this}invert(){const t=this.elements,b=t[0],_=t[1],le=t[2],se=t[3],Se=t[4],He=t[5],me=t[6],ve=t[7],be=t[8],Ue=t[9],qe=t[10],Oe=t[11],Qe=t[12],it=t[13],yt=t[14],Rt=t[15],li=Ue*yt*ve-it*qe*ve+it*me*Oe-He*yt*Oe-Ue*me*Rt+He*qe*Rt,Jt=Qe*qe*ve-be*yt*ve-Qe*me*Oe+Se*yt*Oe+be*me*Rt-Se*qe*Rt,Di=be*it*ve-Qe*Ue*ve+Qe*He*Oe-Se*it*Oe-be*He*Rt+Se*Ue*Rt,Ai=Qe*Ue*me-be*it*me-Qe*He*qe+Se*it*qe+be*He*yt-Se*Ue*yt,At=b*li+_*Jt+le*Di+se*Ai;if(At===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const mt=1/At;return t[0]=li*mt,t[1]=(it*qe*se-Ue*yt*se-it*le*Oe+_*yt*Oe+Ue*le*Rt-_*qe*Rt)*mt,t[2]=(He*yt*se-it*me*se+it*le*ve-_*yt*ve-He*le*Rt+_*me*Rt)*mt,t[3]=(Ue*me*se-He*qe*se-Ue*le*ve+_*qe*ve+He*le*Oe-_*me*Oe)*mt,t[4]=Jt*mt,t[5]=(be*yt*se-Qe*qe*se+Qe*le*Oe-b*yt*Oe-be*le*Rt+b*qe*Rt)*mt,t[6]=(Qe*me*se-Se*yt*se-Qe*le*ve+b*yt*ve+Se*le*Rt-b*me*Rt)*mt,t[7]=(Se*qe*se-be*me*se+be*le*ve-b*qe*ve-Se*le*Oe+b*me*Oe)*mt,t[8]=Di*mt,t[9]=(Qe*Ue*se-be*it*se-Qe*_*Oe+b*it*Oe+be*_*Rt-b*Ue*Rt)*mt,t[10]=(Se*it*se-Qe*He*se+Qe*_*ve-b*it*ve-Se*_*Rt+b*He*Rt)*mt,t[11]=(be*He*se-Se*Ue*se-be*_*ve+b*Ue*ve+Se*_*Oe-b*He*Oe)*mt,t[12]=Ai*mt,t[13]=(be*it*le-Qe*Ue*le+Qe*_*qe-b*it*qe-be*_*yt+b*Ue*yt)*mt,t[14]=(Qe*He*le-Se*it*le-Qe*_*me+b*it*me+Se*_*yt-b*He*yt)*mt,t[15]=(Se*Ue*le-be*He*le+be*_*me-b*Ue*me-Se*_*qe+b*He*qe)*mt,this}scale(t){const b=this.elements,_=t.x,le=t.y,se=t.z;return b[0]*=_,b[4]*=le,b[8]*=se,b[1]*=_,b[5]*=le,b[9]*=se,b[2]*=_,b[6]*=le,b[10]*=se,b[3]*=_,b[7]*=le,b[11]*=se,this}getMaxScaleOnAxis(){const t=this.elements,b=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],_=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],le=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(b,_,le))}makeTranslation(t,b,_){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,b,0,0,1,_,0,0,0,1),this}makeRotationX(t){const b=Math.cos(t),_=Math.sin(t);return this.set(1,0,0,0,0,b,-_,0,0,_,b,0,0,0,0,1),this}makeRotationY(t){const b=Math.cos(t),_=Math.sin(t);return this.set(b,0,_,0,0,1,0,0,-_,0,b,0,0,0,0,1),this}makeRotationZ(t){const b=Math.cos(t),_=Math.sin(t);return this.set(b,-_,0,0,_,b,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,b){const _=Math.cos(b),le=Math.sin(b),se=1-_,Se=t.x,He=t.y,me=t.z,ve=se*Se,be=se*He;return this.set(ve*Se+_,ve*He-le*me,ve*me+le*He,0,ve*He+le*me,be*He+_,be*me-le*Se,0,ve*me-le*He,be*me+le*Se,se*me*me+_,0,0,0,0,1),this}makeScale(t,b,_){return this.set(t,0,0,0,0,b,0,0,0,0,_,0,0,0,0,1),this}makeShear(t,b,_,le,se,Se){return this.set(1,_,se,0,t,1,Se,0,b,le,1,0,0,0,0,1),this}compose(t,b,_){const le=this.elements,se=b._x,Se=b._y,He=b._z,me=b._w,ve=se+se,be=Se+Se,Ue=He+He,qe=se*ve,Oe=se*be,Qe=se*Ue,it=Se*be,yt=Se*Ue,Rt=He*Ue,li=me*ve,Jt=me*be,Di=me*Ue,Ai=_.x,At=_.y,mt=_.z;return le[0]=(1-(it+Rt))*Ai,le[1]=(Oe+Di)*Ai,le[2]=(Qe-Jt)*Ai,le[3]=0,le[4]=(Oe-Di)*At,le[5]=(1-(qe+Rt))*At,le[6]=(yt+li)*At,le[7]=0,le[8]=(Qe+Jt)*mt,le[9]=(yt-li)*mt,le[10]=(1-(qe+it))*mt,le[11]=0,le[12]=t.x,le[13]=t.y,le[14]=t.z,le[15]=1,this}decompose(t,b,_){const le=this.elements;let se=rS.set(le[0],le[1],le[2]).length();const Se=rS.set(le[4],le[5],le[6]).length(),He=rS.set(le[8],le[9],le[10]).length();this.determinant()<0&&(se=-se),t.x=le[12],t.y=le[13],t.z=le[14],Pp.copy(this);const ve=1/se,be=1/Se,Ue=1/He;return Pp.elements[0]*=ve,Pp.elements[1]*=ve,Pp.elements[2]*=ve,Pp.elements[4]*=be,Pp.elements[5]*=be,Pp.elements[6]*=be,Pp.elements[8]*=Ue,Pp.elements[9]*=Ue,Pp.elements[10]*=Ue,b.setFromRotationMatrix(Pp),_.x=se,_.y=Se,_.z=He,this}makePerspective(t,b,_,le,se,Se,He=ab){const me=this.elements,ve=2*se/(b-t),be=2*se/(_-le),Ue=(b+t)/(b-t),qe=(_+le)/(_-le);let Oe,Qe;if(He===ab)Oe=-(Se+se)/(Se-se),Qe=-2*Se*se/(Se-se);else if(He===xB)Oe=-Se/(Se-se),Qe=-Se*se/(Se-se);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+He);return me[0]=ve,me[4]=0,me[8]=Ue,me[12]=0,me[1]=0,me[5]=be,me[9]=qe,me[13]=0,me[2]=0,me[6]=0,me[10]=Oe,me[14]=Qe,me[3]=0,me[7]=0,me[11]=-1,me[15]=0,this}makeOrthographic(t,b,_,le,se,Se,He=ab){const me=this.elements,ve=1/(b-t),be=1/(_-le),Ue=1/(Se-se),qe=(b+t)*ve,Oe=(_+le)*be;let Qe,it;if(He===ab)Qe=(Se+se)*Ue,it=-2*Ue;else if(He===xB)Qe=se*Ue,it=-1*Ue;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+He);return me[0]=2*ve,me[4]=0,me[8]=0,me[12]=-qe,me[1]=0,me[5]=2*be,me[9]=0,me[13]=-Oe,me[2]=0,me[6]=0,me[10]=it,me[14]=-Qe,me[3]=0,me[7]=0,me[11]=0,me[15]=1,this}equals(t){const b=this.elements,_=t.elements;for(let le=0;le<16;le++)if(b[le]!==_[le])return!1;return!0}fromArray(t,b=0){for(let _=0;_<16;_++)this.elements[_]=t[_+b];return this}toArray(t=[],b=0){const _=this.elements;return t[b]=_[0],t[b+1]=_[1],t[b+2]=_[2],t[b+3]=_[3],t[b+4]=_[4],t[b+5]=_[5],t[b+6]=_[6],t[b+7]=_[7],t[b+8]=_[8],t[b+9]=_[9],t[b+10]=_[10],t[b+11]=_[11],t[b+12]=_[12],t[b+13]=_[13],t[b+14]=_[14],t[b+15]=_[15],t}}const rS=new jn,Pp=new l4,Bx=new jn(0,0,0),Mx=new jn(1,1,1),GR=new jn,cb=new jn,Jh=new jn,FB=new l4,VB=new Dg;class bb{constructor(t=0,b=0,_=0,le=bb.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=b,this._z=_,this._order=le}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,b,_,le=this._order){return this._x=t,this._y=b,this._z=_,this._order=le,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,b=this._order,_=!0){const le=t.elements,se=le[0],Se=le[4],He=le[8],me=le[1],ve=le[5],be=le[9],Ue=le[2],qe=le[6],Oe=le[10];switch(b){case"XYZ":this._y=Math.asin(S7(He,-1,1)),Math.abs(He)<.9999999?(this._x=Math.atan2(-be,Oe),this._z=Math.atan2(-Se,se)):(this._x=Math.atan2(qe,ve),this._z=0);break;case"YXZ":this._x=Math.asin(-S7(be,-1,1)),Math.abs(be)<.9999999?(this._y=Math.atan2(He,Oe),this._z=Math.atan2(me,ve)):(this._y=Math.atan2(-Ue,se),this._z=0);break;case"ZXY":this._x=Math.asin(S7(qe,-1,1)),Math.abs(qe)<.9999999?(this._y=Math.atan2(-Ue,Oe),this._z=Math.atan2(-Se,ve)):(this._y=0,this._z=Math.atan2(me,se));break;case"ZYX":this._y=Math.asin(-S7(Ue,-1,1)),Math.abs(Ue)<.9999999?(this._x=Math.atan2(qe,Oe),this._z=Math.atan2(me,se)):(this._x=0,this._z=Math.atan2(-Se,ve));break;case"YZX":this._z=Math.asin(S7(me,-1,1)),Math.abs(me)<.9999999?(this._x=Math.atan2(-be,ve),this._y=Math.atan2(-Ue,se)):(this._x=0,this._y=Math.atan2(He,Oe));break;case"XZY":this._z=Math.asin(-S7(Se,-1,1)),Math.abs(Se)<.9999999?(this._x=Math.atan2(qe,ve),this._y=Math.atan2(He,se)):(this._x=Math.atan2(-be,Oe),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+b)}return this._order=b,_===!0&&this._onChangeCallback(),this}setFromQuaternion(t,b,_){return FB.makeRotationFromQuaternion(t),this.setFromRotationMatrix(FB,b,_)}setFromVector3(t,b=this._order){return this.set(t.x,t.y,t.z,b)}reorder(t){return VB.setFromEuler(this),this.setFromQuaternion(VB,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],b=0){return t[b]=this._x,t[b+1]=this._y,t[b+2]=this._z,t[b+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}bb.DEFAULT_ORDER="XYZ";class xx{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}}let Ux=0;const WB=new jn,aS=new Dg,O7=new l4,Ib=new jn,XC=new jn,Gx=new jn,Fx=new Dg,jB=new jn(1,0,0),YB=new jn(0,1,0),qB=new jn(0,0,1),Vx={type:"added"},Wx={type:"removed"},yH={type:"childadded",child:null},wH={type:"childremoved",child:null};class Nv extends bM{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ux++}),this.uuid=cB(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Nv.DEFAULT_UP.clone();const t=new jn,b=new bb,_=new Dg,le=new jn(1,1,1);function se(){_.setFromEuler(b,!1)}function Se(){b.setFromQuaternion(_,void 0,!1)}b._onChange(se),_._onChange(Se),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:b},quaternion:{configurable:!0,enumerable:!0,value:_},scale:{configurable:!0,enumerable:!0,value:le},modelViewMatrix:{value:new l4},normalMatrix:{value:new Rg}}),this.matrix=new l4,this.matrixWorld=new l4,this.matrixAutoUpdate=Nv.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Nv.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new xx,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,b){this.quaternion.setFromAxisAngle(t,b)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,b){return aS.setFromAxisAngle(t,b),this.quaternion.multiply(aS),this}rotateOnWorldAxis(t,b){return aS.setFromAxisAngle(t,b),this.quaternion.premultiply(aS),this}rotateX(t){return this.rotateOnAxis(jB,t)}rotateY(t){return this.rotateOnAxis(YB,t)}rotateZ(t){return this.rotateOnAxis(qB,t)}translateOnAxis(t,b){return WB.copy(t).applyQuaternion(this.quaternion),this.position.add(WB.multiplyScalar(b)),this}translateX(t){return this.translateOnAxis(jB,t)}translateY(t){return this.translateOnAxis(YB,t)}translateZ(t){return this.translateOnAxis(qB,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(O7.copy(this.matrixWorld).invert())}lookAt(t,b,_){t.isVector3?Ib.copy(t):Ib.set(t,b,_);const le=this.parent;this.updateWorldMatrix(!0,!1),XC.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?O7.lookAt(XC,Ib,this.up):O7.lookAt(Ib,XC,this.up),this.quaternion.setFromRotationMatrix(O7),le&&(O7.extractRotation(le.matrixWorld),aS.setFromRotationMatrix(O7),this.quaternion.premultiply(aS.invert()))}add(t){if(arguments.length>1){for(let b=0;b<arguments.length;b++)this.add(arguments[b]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Vx),yH.child=t,this.dispatchEvent(yH),yH.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let _=0;_<arguments.length;_++)this.remove(arguments[_]);return this}const b=this.children.indexOf(t);return b!==-1&&(t.parent=null,this.children.splice(b,1),t.dispatchEvent(Wx),wH.child=t,this.dispatchEvent(wH),wH.child=null),this}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),O7.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),O7.multiply(t.parent.matrixWorld)),t.applyMatrix4(O7),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,b){if(this[t]===b)return this;for(let _=0,le=this.children.length;_<le;_++){const Se=this.children[_].getObjectByProperty(t,b);if(Se!==void 0)return Se}}getObjectsByProperty(t,b,_=[]){this[t]===b&&_.push(this);const le=this.children;for(let se=0,Se=le.length;se<Se;se++)le[se].getObjectsByProperty(t,b,_);return _}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(XC,t,Gx),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(XC,Fx,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const b=this.matrixWorld.elements;return t.set(b[8],b[9],b[10]).normalize()}raycast(){}traverse(t){t(this);const b=this.children;for(let _=0,le=b.length;_<le;_++)b[_].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);const b=this.children;for(let _=0,le=b.length;_<le;_++)b[_].traverseVisible(t)}traverseAncestors(t){const b=this.parent;b!==null&&(t(b),b.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const b=this.children;for(let _=0,le=b.length;_<le;_++){const se=b[_];(se.matrixWorldAutoUpdate===!0||t===!0)&&se.updateMatrixWorld(t)}}updateWorldMatrix(t,b){const _=this.parent;if(t===!0&&_!==null&&_.matrixWorldAutoUpdate===!0&&_.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),b===!0){const le=this.children;for(let se=0,Se=le.length;se<Se;se++){const He=le[se];He.matrixWorldAutoUpdate===!0&&He.updateWorldMatrix(!1,!0)}}}toJSON(t){const b=t===void 0||typeof t=="string",_={};b&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},_.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const le={};le.uuid=this.uuid,le.type=this.type,this.name!==""&&(le.name=this.name),this.castShadow===!0&&(le.castShadow=!0),this.receiveShadow===!0&&(le.receiveShadow=!0),this.visible===!1&&(le.visible=!1),this.frustumCulled===!1&&(le.frustumCulled=!1),this.renderOrder!==0&&(le.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(le.userData=this.userData),le.layers=this.layers.mask,le.matrix=this.matrix.toArray(),le.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(le.matrixAutoUpdate=!1),this.isInstancedMesh&&(le.type="InstancedMesh",le.count=this.count,le.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(le.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(le.type="BatchedMesh",le.perObjectFrustumCulled=this.perObjectFrustumCulled,le.sortObjects=this.sortObjects,le.drawRanges=this._drawRanges,le.reservedRanges=this._reservedRanges,le.visibility=this._visibility,le.active=this._active,le.bounds=this._bounds.map(He=>({boxInitialized:He.boxInitialized,boxMin:He.box.min.toArray(),boxMax:He.box.max.toArray(),sphereInitialized:He.sphereInitialized,sphereRadius:He.sphere.radius,sphereCenter:He.sphere.center.toArray()})),le.maxGeometryCount=this._maxGeometryCount,le.maxVertexCount=this._maxVertexCount,le.maxIndexCount=this._maxIndexCount,le.geometryInitialized=this._geometryInitialized,le.geometryCount=this._geometryCount,le.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(le.boundingSphere={center:le.boundingSphere.center.toArray(),radius:le.boundingSphere.radius}),this.boundingBox!==null&&(le.boundingBox={min:le.boundingBox.min.toArray(),max:le.boundingBox.max.toArray()}));function se(He,me){return He[me.uuid]===void 0&&(He[me.uuid]=me.toJSON(t)),me.uuid}if(this.isScene)this.background&&(this.background.isColor?le.background=this.background.toJSON():this.background.isTexture&&(le.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(le.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){le.geometry=se(t.geometries,this.geometry);const He=this.geometry.parameters;if(He!==void 0&&He.shapes!==void 0){const me=He.shapes;if(Array.isArray(me))for(let ve=0,be=me.length;ve<be;ve++){const Ue=me[ve];se(t.shapes,Ue)}else se(t.shapes,me)}}if(this.isSkinnedMesh&&(le.bindMode=this.bindMode,le.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(se(t.skeletons,this.skeleton),le.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const He=[];for(let me=0,ve=this.material.length;me<ve;me++)He.push(se(t.materials,this.material[me]));le.material=He}else le.material=se(t.materials,this.material);if(this.children.length>0){le.children=[];for(let He=0;He<this.children.length;He++)le.children.push(this.children[He].toJSON(t).object)}if(this.animations.length>0){le.animations=[];for(let He=0;He<this.animations.length;He++){const me=this.animations[He];le.animations.push(se(t.animations,me))}}if(b){const He=Se(t.geometries),me=Se(t.materials),ve=Se(t.textures),be=Se(t.images),Ue=Se(t.shapes),qe=Se(t.skeletons),Oe=Se(t.animations),Qe=Se(t.nodes);He.length>0&&(_.geometries=He),me.length>0&&(_.materials=me),ve.length>0&&(_.textures=ve),be.length>0&&(_.images=be),Ue.length>0&&(_.shapes=Ue),qe.length>0&&(_.skeletons=qe),Oe.length>0&&(_.animations=Oe),Qe.length>0&&(_.nodes=Qe)}return _.object=le,_;function Se(He){const me=[];for(const ve in He){const be=He[ve];delete be.metadata,me.push(be)}return me}}clone(t){return new this.constructor().copy(this,t)}copy(t,b=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),b===!0)for(let _=0;_<t.children.length;_++){const le=t.children[_];this.add(le.clone())}return this}}Nv.DEFAULT_UP=new jn(0,1,0);Nv.DEFAULT_MATRIX_AUTO_UPDATE=!0;Nv.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class jx extends SD{constructor(t,b,_,le,se,Se,He,me,ve,be){if(be=be!==void 0?be:cH,be!==cH&&be!==MB)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");_===void 0&&be===cH&&(_=Ox),_===void 0&&be===MB&&(_=Sx),super(null,le,se,Se,He,me,be,_,ve),this.isDepthTexture=!0,this.image={width:t,height:b},this.magFilter=He!==void 0?He:BB,this.minFilter=me!==void 0?me:BB,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const b=super.toJSON(t);return this.compareFunction!==null&&(b.compareFunction=this.compareFunction),b}}const Yx=new jx(1,1);Yx.compareFunction=Px;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:CM}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=CM);class qx{constructor(){this.factor=1,this.complement=1}apply(t){const _=this.getScaleMatrix().multiply(t);t.copy(_)}setUp(t){this.factor=1;const b=this.getLengthUnits(t);if(!b)return;const _=b==null,le=b.Name===void 0||b.Name===null;_||le||(b.Name.value==="FOOT"?this.factor=.3048:b.Prefix?.value==="MILLI"&&(this.complement=.001))}getLengthUnits(t){try{const _=t.GetLineIDsWithType(0,ix).get(0),le=t.GetLine(0,_);for(const se of le.Units){if(!se||se.value===null||se.value===void 0)continue;const Se=t.GetLine(0,se.value);if(Se.UnitType&&Se.UnitType.value==="LENGTHUNIT")return Se}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const t=this.factor;return new l4().fromArray([t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1])}}class kx{constructor(){this.itemsByFloor={},this._units=new qx}setUp(t){this._units.setUp(t),this.cleanUp();try{const b=t.GetLineIDsWithType(0,he),_=new Set,le=t.GetLineIDsWithType(0,Sn);for(let ve=0;ve<le.size();ve++)_.add(le.get(ve));const se=t.GetLineIDsWithType(0,w),Se=se.size();for(let ve=0;ve<Se;ve++){const be=se.get(ve),Ue=t.GetLine(0,be);if(!Ue||!Ue.RelatingObject||!Ue.RelatedObjects)continue;const qe=Ue.RelatingObject.value,Oe=Ue.RelatedObjects;for(const Qe of Oe){const it=Qe.value;_.has(it)&&(this.itemsByFloor[it]=qe)}}const He={},me=b.size();for(let ve=0;ve<me;ve++){const be=b.get(ve),Ue=t.GetLine(0,be);if(!Ue||!Ue.RelatingStructure||!Ue.RelatedElements)continue;const qe=Ue.RelatingStructure.value,Oe=Ue.RelatedElements;if(_.has(qe))for(const Qe of Oe){He[qe]||(He[qe]=[]);const it=Qe.value;He[qe].push(it)}else for(const Qe of Oe){const it=Qe.value;this.itemsByFloor[it]=qe}}for(const ve in He){const be=this.itemsByFloor[ve];if(be!==void 0){const Ue=He[ve];for(const qe of Ue)this.itemsByFloor[qe]=be}}for(let ve=0;ve<Se;ve++){const be=se.get(ve),Ue=t.GetLine(0,be);if(!Ue||!Ue.RelatingObject||!Ue.RelatedObjects)continue;const qe=Ue.RelatingObject.value,Oe=Ue.RelatedObjects;for(const Qe of Oe){const it=Qe.value,yt=this.itemsByFloor[qe];yt!==void 0&&(this.itemsByFloor[it]=yt)}}}catch{console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}const zx=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]);class Kx{async export(t,b,_=!1,le=!0){const se={},Se=new Set(t.GetIfcEntityList(b)),He=new Set([Wp,M0,vu,Q0,Sn]);for(const me of He)Se.add(me);for(const me of Se){if(zx.has(me))continue;const ve=He.has(me)&&le,be=t.GetLineIDsWithType(b,me);for(const Ue of be){const qe=t.GetLine(0,Ue,ve,_);se[qe.expressID]=qe}}return se}}class Qx{constructor(){this.normal=[],this.position=[],this.instances=[],this.id=""}}class $x{constructor(){this.id="",this.transform=[],this.material=new IB}}class IB{constructor(){this.Name="",this.Opacity=1,this.Metalness=0,this.Roughness=1,this.Red=225,this.Green=225,this.Blue=225}}class HM{constructor(){this.Materials=[],this.Elements=[],this.Data=new BM,this.CameraData=new Hb,this.Translation=[]}}class BM{constructor(){this.Data={}}}class Zx{constructor(){this.Data={},this.CameraData=new Hb}}class TH{constructor(){this.Solids=[],this.Id="",this.Instances=[]}}class MM{constructor(){this.MaterialIndex=0,this.Vertices=[],this.Indices=[],this.Buffer=[],this.Id="",this.GeometryId="",this.Transform=[]}}class xM{constructor(){this.BasisX=new Au,this.BasisY=new Au,this.BasisZ=new Au,this.Offset=new Au,this.Id="",this.Matrix=new l4}}class Au{constructor(t=0,b=0,_=0){this.X=0,this.Y=0,this.Z=0,this.X=t,this.Y=b,this.Z=_}}class Hb{constructor(){this.scale=0,this.origin=new Au,this.eyePosition=new Au,this.upDirection=new Au,this.forwardDirection=new Au,this.target=new Au,this.box=new UM}}class UM{constructor(){this.min=new Au,this.max=new Au}}const Lb=class Lb{constructor(t=!0,b){this._webIfc=new Rx,this.settings=new Dx,this._fragments=new Map,this._spatialTree=new kx,this._propertyExporter=new Kx,this._materials=[],this._groupByGeometryId={},this.settings.autoSetWasm=t,this._customWasmPath=b,this.settings.excludedCategories.add(Ms)}async setup(){this.settings.autoSetWasm&&await this.autoSetWasm()}async autoSetWasm(){const t=await fetch(`https://unpkg.com/@thatopen/components@${Lb.release}/package.json`);if(!t.ok){console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");return}const b=await t.json();if(!("web-ifc"in b.peerDependencies))console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.");else{const _=b.peerDependencies["web-ifc"];this.settings.wasm.path=`https://unpkg.com/web-ifc@${_}/`,this.settings.wasm.absolute=!0}}async loadByUrl(t){this._dispose();const _=await(await fetch(t)).arrayBuffer(),le=new Uint8Array(_);let se=await this.load2(le);return this._webIfc.Dispose(),se}async load2(t,b=!0){await this.readIfcFile(t);const _=await this.getAllGeometries2(),le=await this.getAllProperties(),se=await this.getWorldCoordinationMatrix();let Se=new HM;Se.Translation=se,Se.Elements=_.elements,_.material.forEach((He,me)=>{let ve=new IB;ve.Red=Math.round(He.x*255),ve.Green=Math.round(He.y*255),ve.Blue=Math.round(He.z*255),ve.Opacity=He.w,ve.Name=me.toString(),Se.Materials.push(ve)});for(const He of Object.keys(le)){let me=le,ve=this.flattenObject(me[He]),be={};for(const Ue of Object.keys(ve)){let qe={name:Ue,value:ve[Ue]?ve[Ue].toString():""};be[Ue]=qe}Se.Data.Data[ve.expressID]=be}return Se.CameraData=this.generateBoundingbox(Se.Elements),Se}async readIfcFile(t){const{path:b,absolute:_,logLevel:le}=this.settings.wasm;return console.log(this.settings.autoSetWasm),this.settings.autoSetWasm?this._webIfc.SetWasmPath(b,_):this._webIfc.SetWasmPath(this._customWasmPath?this._customWasmPath:"./wasm/",!0),await this._webIfc.Init(),le&&this._webIfc.SetLogLevel(le),this._webIfc.OpenModel(t,this.settings.webIfc)}async getAllGeometries2(){this._spatialTree.setUp(this._webIfc);const t=this._webIfc.GetIfcEntityList(0),b=[];for(const le of t){if(!this._webIfc.IsIfcElement(le)&&le!==Sn)continue;const se=this.settings.includedCategories;if(se.size>0&&!se.has(le))continue;if(this.settings.excludedCategories.has(le))continue;const Se=this._webIfc.GetLineIDsWithType(0,le),He=Se.size();for(let me=0;me<He;me++){const ve=Se.get(me);b.push(ve),this._spatialTree.itemsByFloor[ve]}}this._spatialTree.cleanUp();let _=[];return this._webIfc.StreamMeshes(0,b,(le,se,Se)=>{this.getMesh2(le)}),_=this.generateInstancedMesh(),{elements:_,material:this._materials}}getMesh2(t){let b=new TH;const _=t.geometries.size(),le=t.expressID;b.Id=le.toString();for(let se=0;se<_;se++){let Se=new MM;const He=t.geometries.get(se),{x:me,y:ve,z:be,w:Ue}=He.color;let qe=this._materials.findIndex(li=>li.x==me&&li.y==ve&&li.z==be&&li.w==Ue);qe<0&&(this._materials.push({x:me,y:ve,z:be,w:Ue}),qe=this._materials.length-1),Se.MaterialIndex=qe;const Oe=Ue!==1,{geometryExpressID:Qe}=He,it=`${Qe}-${Oe}`,yt=this.getGeometry(this._webIfc,Qe);new l4().fromArray(He.flatTransformation);for(let li=0;li<yt.position.length;li+=3){const Jt=yt.position[li],Di=yt.position[li+1],Ai=yt.position[li+2],At=new jn(Jt,Di,Ai);//!switch back to revit xyz, get revit axis is a standard for every format so we dont have to recode again.
|
|
39
|
+
*/const CM="162",gM=300,bB=1e3,rb=1001,HB=1002,BB=1003,Nx=1006,vx=1008,Ax=1009,Ox=1014,Sx=1020,Lx=1023,cH=1026,MB=1027,mx="",Px=515,ab=2e3,xB=2001;class bM{addEventListener(t,b){this._listeners===void 0&&(this._listeners={});const _=this._listeners;_[t]===void 0&&(_[t]=[]),_[t].indexOf(b)===-1&&_[t].push(b)}hasEventListener(t,b){if(this._listeners===void 0)return!1;const _=this._listeners;return _[t]!==void 0&&_[t].indexOf(b)!==-1}removeEventListener(t,b){if(this._listeners===void 0)return;const le=this._listeners[t];if(le!==void 0){const se=le.indexOf(b);se!==-1&&le.splice(se,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const _=this._listeners[t.type];if(_!==void 0){t.target=this;const le=_.slice(0);for(let se=0,Se=le.length;se<Se;se++)le[se].call(this,t);t.target=null}}}const Kr=["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"];function cB(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,b=Math.random()*4294967295|0,_=Math.random()*4294967295|0;return(Kr[e&255]+Kr[e>>8&255]+Kr[e>>16&255]+Kr[e>>24&255]+"-"+Kr[t&255]+Kr[t>>8&255]+"-"+Kr[t>>16&15|64]+Kr[t>>24&255]+"-"+Kr[b&63|128]+Kr[b>>8&255]+"-"+Kr[b>>16&255]+Kr[b>>24&255]+Kr[_&255]+Kr[_>>8&255]+Kr[_>>16&255]+Kr[_>>24&255]).toLowerCase()}function S7(e,t,b){return Math.max(t,Math.min(b,e))}class ng{constructor(t=0,b=0){ng.prototype.isVector2=!0,this.x=t,this.y=b}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,b){return this.x=t,this.y=b,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,b){switch(t){case 0:this.x=b;break;case 1:this.y=b;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,b){return this.x=t.x+b.x,this.y=t.y+b.y,this}addScaledVector(t,b){return this.x+=t.x*b,this.y+=t.y*b,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,b){return this.x=t.x-b.x,this.y=t.y-b.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const b=this.x,_=this.y,le=t.elements;return this.x=le[0]*b+le[3]*_+le[6],this.y=le[1]*b+le[4]*_+le[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,b){return this.x=Math.max(t.x,Math.min(b.x,this.x)),this.y=Math.max(t.y,Math.min(b.y,this.y)),this}clampScalar(t,b){return this.x=Math.max(t,Math.min(b,this.x)),this.y=Math.max(t,Math.min(b,this.y)),this}clampLength(t,b){const _=this.length();return this.divideScalar(_||1).multiplyScalar(Math.max(t,Math.min(b,_)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const b=Math.sqrt(this.lengthSq()*t.lengthSq());if(b===0)return Math.PI/2;const _=this.dot(t)/b;return Math.acos(S7(_,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const b=this.x-t.x,_=this.y-t.y;return b*b+_*_}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,b){return this.x+=(t.x-this.x)*b,this.y+=(t.y-this.y)*b,this}lerpVectors(t,b,_){return this.x=t.x+(b.x-t.x)*_,this.y=t.y+(b.y-t.y)*_,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,b=0){return this.x=t[b],this.y=t[b+1],this}toArray(t=[],b=0){return t[b]=this.x,t[b+1]=this.y,t}fromBufferAttribute(t,b){return this.x=t.getX(b),this.y=t.getY(b),this}rotateAround(t,b){const _=Math.cos(b),le=Math.sin(b),se=this.x-t.x,Se=this.y-t.y;return this.x=se*_-Se*le+t.x,this.y=se*le+Se*_+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Rg{constructor(t,b,_,le,se,Se,He,me,ve){Rg.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,b,_,le,se,Se,He,me,ve)}set(t,b,_,le,se,Se,He,me,ve){const be=this.elements;return be[0]=t,be[1]=le,be[2]=He,be[3]=b,be[4]=se,be[5]=me,be[6]=_,be[7]=Se,be[8]=ve,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const b=this.elements,_=t.elements;return b[0]=_[0],b[1]=_[1],b[2]=_[2],b[3]=_[3],b[4]=_[4],b[5]=_[5],b[6]=_[6],b[7]=_[7],b[8]=_[8],this}extractBasis(t,b,_){return t.setFromMatrix3Column(this,0),b.setFromMatrix3Column(this,1),_.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const b=t.elements;return this.set(b[0],b[4],b[8],b[1],b[5],b[9],b[2],b[6],b[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,b){const _=t.elements,le=b.elements,se=this.elements,Se=_[0],He=_[3],me=_[6],ve=_[1],be=_[4],Ue=_[7],qe=_[2],Oe=_[5],Qe=_[8],it=le[0],yt=le[3],Rt=le[6],li=le[1],Jt=le[4],Di=le[7],Ai=le[2],At=le[5],mt=le[8];return se[0]=Se*it+He*li+me*Ai,se[3]=Se*yt+He*Jt+me*At,se[6]=Se*Rt+He*Di+me*mt,se[1]=ve*it+be*li+Ue*Ai,se[4]=ve*yt+be*Jt+Ue*At,se[7]=ve*Rt+be*Di+Ue*mt,se[2]=qe*it+Oe*li+Qe*Ai,se[5]=qe*yt+Oe*Jt+Qe*At,se[8]=qe*Rt+Oe*Di+Qe*mt,this}multiplyScalar(t){const b=this.elements;return b[0]*=t,b[3]*=t,b[6]*=t,b[1]*=t,b[4]*=t,b[7]*=t,b[2]*=t,b[5]*=t,b[8]*=t,this}determinant(){const t=this.elements,b=t[0],_=t[1],le=t[2],se=t[3],Se=t[4],He=t[5],me=t[6],ve=t[7],be=t[8];return b*Se*be-b*He*ve-_*se*be+_*He*me+le*se*ve-le*Se*me}invert(){const t=this.elements,b=t[0],_=t[1],le=t[2],se=t[3],Se=t[4],He=t[5],me=t[6],ve=t[7],be=t[8],Ue=be*Se-He*ve,qe=He*me-be*se,Oe=ve*se-Se*me,Qe=b*Ue+_*qe+le*Oe;if(Qe===0)return this.set(0,0,0,0,0,0,0,0,0);const it=1/Qe;return t[0]=Ue*it,t[1]=(le*ve-be*_)*it,t[2]=(He*_-le*Se)*it,t[3]=qe*it,t[4]=(be*b-le*me)*it,t[5]=(le*se-He*b)*it,t[6]=Oe*it,t[7]=(_*me-ve*b)*it,t[8]=(Se*b-_*se)*it,this}transpose(){let t;const b=this.elements;return t=b[1],b[1]=b[3],b[3]=t,t=b[2],b[2]=b[6],b[6]=t,t=b[5],b[5]=b[7],b[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const b=this.elements;return t[0]=b[0],t[1]=b[3],t[2]=b[6],t[3]=b[1],t[4]=b[4],t[5]=b[7],t[6]=b[2],t[7]=b[5],t[8]=b[8],this}setUvTransform(t,b,_,le,se,Se,He){const me=Math.cos(se),ve=Math.sin(se);return this.set(_*me,_*ve,-_*(me*Se+ve*He)+Se+t,-le*ve,le*me,-le*(-ve*Se+me*He)+He+b,0,0,1),this}scale(t,b){return this.premultiply(IH.makeScale(t,b)),this}rotate(t){return this.premultiply(IH.makeRotation(-t)),this}translate(t,b){return this.premultiply(IH.makeTranslation(t,b)),this}makeTranslation(t,b){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,b,0,0,1),this}makeRotation(t){const b=Math.cos(t),_=Math.sin(t);return this.set(b,-_,0,_,b,0,0,0,1),this}makeScale(t,b){return this.set(t,0,0,0,b,0,0,0,1),this}equals(t){const b=this.elements,_=t.elements;for(let le=0;le<9;le++)if(b[le]!==_[le])return!1;return!0}fromArray(t,b=0){for(let _=0;_<9;_++)this.elements[_]=t[_+b];return this}toArray(t=[],b=0){const _=this.elements;return t[b]=_[0],t[b+1]=_[1],t[b+2]=_[2],t[b+3]=_[3],t[b+4]=_[4],t[b+5]=_[5],t[b+6]=_[6],t[b+7]=_[7],t[b+8]=_[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const IH=new Rg;function UB(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function hH(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}let dS;class Cx{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let b;if(t instanceof HTMLCanvasElement)b=t;else{dS===void 0&&(dS=UB("canvas")),dS.width=t.width,dS.height=t.height;const _=dS.getContext("2d");t instanceof ImageData?_.putImageData(t,0,0):_.drawImage(t,0,0,t.width,t.height),b=dS}return b.width>2048||b.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),b.toDataURL("image/jpeg",.6)):b.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const b=UB("canvas");b.width=t.width,b.height=t.height;const _=b.getContext("2d");_.drawImage(t,0,0,t.width,t.height);const le=_.getImageData(0,0,t.width,t.height),se=le.data;for(let Se=0;Se<se.length;Se++)se[Se]=hH(se[Se]/255)*255;return _.putImageData(le,0,0),b}else if(t.data){const b=t.data.slice(0);for(let _=0;_<b.length;_++)b instanceof Uint8Array||b instanceof Uint8ClampedArray?b[_]=Math.floor(hH(b[_]/255)*255):b[_]=hH(b[_]);return{data:b,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let gx=0;class bx{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:gx++}),this.uuid=cB(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){const b=t===void 0||typeof t=="string";if(!b&&t.images[this.uuid]!==void 0)return t.images[this.uuid];const _={uuid:this.uuid,url:""},le=this.data;if(le!==null){let se;if(Array.isArray(le)){se=[];for(let Se=0,He=le.length;Se<He;Se++)le[Se].isDataTexture?se.push(fH(le[Se].image)):se.push(fH(le[Se]))}else se=fH(le);_.url=se}return b||(t.images[this.uuid]=_),_}}function fH(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap?Cx.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Hx=0;class SD extends bM{constructor(t=SD.DEFAULT_IMAGE,b=SD.DEFAULT_MAPPING,_=rb,le=rb,se=Nx,Se=vx,He=Lx,me=Ax,ve=SD.DEFAULT_ANISOTROPY,be=mx){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Hx++}),this.uuid=cB(),this.name="",this.source=new bx(t),this.mipmaps=[],this.mapping=b,this.channel=0,this.wrapS=_,this.wrapT=le,this.magFilter=se,this.minFilter=Se,this.anisotropy=ve,this.format=He,this.internalFormat=null,this.type=me,this.offset=new ng(0,0),this.repeat=new ng(1,1),this.center=new ng(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Rg,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=be,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const b=t===void 0||typeof t=="string";if(!b&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const _={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(_.userData=this.userData),b||(t.textures[this.uuid]=_),_}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==gM)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case bB:t.x=t.x-Math.floor(t.x);break;case rb:t.x=t.x<0?0:1;break;case HB:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case bB:t.y=t.y-Math.floor(t.y);break;case rb:t.y=t.y<0?0:1;break;case HB:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}}SD.DEFAULT_IMAGE=null;SD.DEFAULT_MAPPING=gM;SD.DEFAULT_ANISOTROPY=1;class Dg{constructor(t=0,b=0,_=0,le=1){this.isQuaternion=!0,this._x=t,this._y=b,this._z=_,this._w=le}static slerpFlat(t,b,_,le,se,Se,He){let me=_[le+0],ve=_[le+1],be=_[le+2],Ue=_[le+3];const qe=se[Se+0],Oe=se[Se+1],Qe=se[Se+2],it=se[Se+3];if(He===0){t[b+0]=me,t[b+1]=ve,t[b+2]=be,t[b+3]=Ue;return}if(He===1){t[b+0]=qe,t[b+1]=Oe,t[b+2]=Qe,t[b+3]=it;return}if(Ue!==it||me!==qe||ve!==Oe||be!==Qe){let yt=1-He;const Rt=me*qe+ve*Oe+be*Qe+Ue*it,li=Rt>=0?1:-1,Jt=1-Rt*Rt;if(Jt>Number.EPSILON){const Ai=Math.sqrt(Jt),At=Math.atan2(Ai,Rt*li);yt=Math.sin(yt*At)/Ai,He=Math.sin(He*At)/Ai}const Di=He*li;if(me=me*yt+qe*Di,ve=ve*yt+Oe*Di,be=be*yt+Qe*Di,Ue=Ue*yt+it*Di,yt===1-He){const Ai=1/Math.sqrt(me*me+ve*ve+be*be+Ue*Ue);me*=Ai,ve*=Ai,be*=Ai,Ue*=Ai}}t[b]=me,t[b+1]=ve,t[b+2]=be,t[b+3]=Ue}static multiplyQuaternionsFlat(t,b,_,le,se,Se){const He=_[le],me=_[le+1],ve=_[le+2],be=_[le+3],Ue=se[Se],qe=se[Se+1],Oe=se[Se+2],Qe=se[Se+3];return t[b]=He*Qe+be*Ue+me*Oe-ve*qe,t[b+1]=me*Qe+be*qe+ve*Ue-He*Oe,t[b+2]=ve*Qe+be*Oe+He*qe-me*Ue,t[b+3]=be*Qe-He*Ue-me*qe-ve*Oe,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,b,_,le){return this._x=t,this._y=b,this._z=_,this._w=le,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,b=!0){const _=t._x,le=t._y,se=t._z,Se=t._order,He=Math.cos,me=Math.sin,ve=He(_/2),be=He(le/2),Ue=He(se/2),qe=me(_/2),Oe=me(le/2),Qe=me(se/2);switch(Se){case"XYZ":this._x=qe*be*Ue+ve*Oe*Qe,this._y=ve*Oe*Ue-qe*be*Qe,this._z=ve*be*Qe+qe*Oe*Ue,this._w=ve*be*Ue-qe*Oe*Qe;break;case"YXZ":this._x=qe*be*Ue+ve*Oe*Qe,this._y=ve*Oe*Ue-qe*be*Qe,this._z=ve*be*Qe-qe*Oe*Ue,this._w=ve*be*Ue+qe*Oe*Qe;break;case"ZXY":this._x=qe*be*Ue-ve*Oe*Qe,this._y=ve*Oe*Ue+qe*be*Qe,this._z=ve*be*Qe+qe*Oe*Ue,this._w=ve*be*Ue-qe*Oe*Qe;break;case"ZYX":this._x=qe*be*Ue-ve*Oe*Qe,this._y=ve*Oe*Ue+qe*be*Qe,this._z=ve*be*Qe-qe*Oe*Ue,this._w=ve*be*Ue+qe*Oe*Qe;break;case"YZX":this._x=qe*be*Ue+ve*Oe*Qe,this._y=ve*Oe*Ue+qe*be*Qe,this._z=ve*be*Qe-qe*Oe*Ue,this._w=ve*be*Ue-qe*Oe*Qe;break;case"XZY":this._x=qe*be*Ue-ve*Oe*Qe,this._y=ve*Oe*Ue-qe*be*Qe,this._z=ve*be*Qe+qe*Oe*Ue,this._w=ve*be*Ue+qe*Oe*Qe;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+Se)}return b===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,b){const _=b/2,le=Math.sin(_);return this._x=t.x*le,this._y=t.y*le,this._z=t.z*le,this._w=Math.cos(_),this._onChangeCallback(),this}setFromRotationMatrix(t){const b=t.elements,_=b[0],le=b[4],se=b[8],Se=b[1],He=b[5],me=b[9],ve=b[2],be=b[6],Ue=b[10],qe=_+He+Ue;if(qe>0){const Oe=.5/Math.sqrt(qe+1);this._w=.25/Oe,this._x=(be-me)*Oe,this._y=(se-ve)*Oe,this._z=(Se-le)*Oe}else if(_>He&&_>Ue){const Oe=2*Math.sqrt(1+_-He-Ue);this._w=(be-me)/Oe,this._x=.25*Oe,this._y=(le+Se)/Oe,this._z=(se+ve)/Oe}else if(He>Ue){const Oe=2*Math.sqrt(1+He-_-Ue);this._w=(se-ve)/Oe,this._x=(le+Se)/Oe,this._y=.25*Oe,this._z=(me+be)/Oe}else{const Oe=2*Math.sqrt(1+Ue-_-He);this._w=(Se-le)/Oe,this._x=(se+ve)/Oe,this._y=(me+be)/Oe,this._z=.25*Oe}return this._onChangeCallback(),this}setFromUnitVectors(t,b){let _=t.dot(b)+1;return _<Number.EPSILON?(_=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=_):(this._x=0,this._y=-t.z,this._z=t.y,this._w=_)):(this._x=t.y*b.z-t.z*b.y,this._y=t.z*b.x-t.x*b.z,this._z=t.x*b.y-t.y*b.x,this._w=_),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(S7(this.dot(t),-1,1)))}rotateTowards(t,b){const _=this.angleTo(t);if(_===0)return this;const le=Math.min(1,b/_);return this.slerp(t,le),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,b){const _=t._x,le=t._y,se=t._z,Se=t._w,He=b._x,me=b._y,ve=b._z,be=b._w;return this._x=_*be+Se*He+le*ve-se*me,this._y=le*be+Se*me+se*He-_*ve,this._z=se*be+Se*ve+_*me-le*He,this._w=Se*be-_*He-le*me-se*ve,this._onChangeCallback(),this}slerp(t,b){if(b===0)return this;if(b===1)return this.copy(t);const _=this._x,le=this._y,se=this._z,Se=this._w;let He=Se*t._w+_*t._x+le*t._y+se*t._z;if(He<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,He=-He):this.copy(t),He>=1)return this._w=Se,this._x=_,this._y=le,this._z=se,this;const me=1-He*He;if(me<=Number.EPSILON){const Oe=1-b;return this._w=Oe*Se+b*this._w,this._x=Oe*_+b*this._x,this._y=Oe*le+b*this._y,this._z=Oe*se+b*this._z,this.normalize(),this}const ve=Math.sqrt(me),be=Math.atan2(ve,He),Ue=Math.sin((1-b)*be)/ve,qe=Math.sin(b*be)/ve;return this._w=Se*Ue+this._w*qe,this._x=_*Ue+this._x*qe,this._y=le*Ue+this._y*qe,this._z=se*Ue+this._z*qe,this._onChangeCallback(),this}slerpQuaternions(t,b,_){return this.copy(t).slerp(b,_)}random(){const t=2*Math.PI*Math.random(),b=2*Math.PI*Math.random(),_=Math.random(),le=Math.sqrt(1-_),se=Math.sqrt(_);return this.set(le*Math.sin(t),le*Math.cos(t),se*Math.sin(b),se*Math.cos(b))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,b=0){return this._x=t[b],this._y=t[b+1],this._z=t[b+2],this._w=t[b+3],this._onChangeCallback(),this}toArray(t=[],b=0){return t[b]=this._x,t[b+1]=this._y,t[b+2]=this._z,t[b+3]=this._w,t}fromBufferAttribute(t,b){return this._x=t.getX(b),this._y=t.getY(b),this._z=t.getZ(b),this._w=t.getW(b),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class jn{constructor(t=0,b=0,_=0){jn.prototype.isVector3=!0,this.x=t,this.y=b,this.z=_}set(t,b,_){return _===void 0&&(_=this.z),this.x=t,this.y=b,this.z=_,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,b){switch(t){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,b){return this.x=t.x+b.x,this.y=t.y+b.y,this.z=t.z+b.z,this}addScaledVector(t,b){return this.x+=t.x*b,this.y+=t.y*b,this.z+=t.z*b,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,b){return this.x=t.x-b.x,this.y=t.y-b.y,this.z=t.z-b.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,b){return this.x=t.x*b.x,this.y=t.y*b.y,this.z=t.z*b.z,this}applyEuler(t){return this.applyQuaternion(GB.setFromEuler(t))}applyAxisAngle(t,b){return this.applyQuaternion(GB.setFromAxisAngle(t,b))}applyMatrix3(t){const b=this.x,_=this.y,le=this.z,se=t.elements;return this.x=se[0]*b+se[3]*_+se[6]*le,this.y=se[1]*b+se[4]*_+se[7]*le,this.z=se[2]*b+se[5]*_+se[8]*le,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const b=this.x,_=this.y,le=this.z,se=t.elements,Se=1/(se[3]*b+se[7]*_+se[11]*le+se[15]);return this.x=(se[0]*b+se[4]*_+se[8]*le+se[12])*Se,this.y=(se[1]*b+se[5]*_+se[9]*le+se[13])*Se,this.z=(se[2]*b+se[6]*_+se[10]*le+se[14])*Se,this}applyQuaternion(t){const b=this.x,_=this.y,le=this.z,se=t.x,Se=t.y,He=t.z,me=t.w,ve=2*(Se*le-He*_),be=2*(He*b-se*le),Ue=2*(se*_-Se*b);return this.x=b+me*ve+Se*Ue-He*be,this.y=_+me*be+He*ve-se*Ue,this.z=le+me*Ue+se*be-Se*ve,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const b=this.x,_=this.y,le=this.z,se=t.elements;return this.x=se[0]*b+se[4]*_+se[8]*le,this.y=se[1]*b+se[5]*_+se[9]*le,this.z=se[2]*b+se[6]*_+se[10]*le,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,b){return this.x=Math.max(t.x,Math.min(b.x,this.x)),this.y=Math.max(t.y,Math.min(b.y,this.y)),this.z=Math.max(t.z,Math.min(b.z,this.z)),this}clampScalar(t,b){return this.x=Math.max(t,Math.min(b,this.x)),this.y=Math.max(t,Math.min(b,this.y)),this.z=Math.max(t,Math.min(b,this.z)),this}clampLength(t,b){const _=this.length();return this.divideScalar(_||1).multiplyScalar(Math.max(t,Math.min(b,_)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,b){return this.x+=(t.x-this.x)*b,this.y+=(t.y-this.y)*b,this.z+=(t.z-this.z)*b,this}lerpVectors(t,b,_){return this.x=t.x+(b.x-t.x)*_,this.y=t.y+(b.y-t.y)*_,this.z=t.z+(b.z-t.z)*_,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,b){const _=t.x,le=t.y,se=t.z,Se=b.x,He=b.y,me=b.z;return this.x=le*me-se*He,this.y=se*Se-_*me,this.z=_*He-le*Se,this}projectOnVector(t){const b=t.lengthSq();if(b===0)return this.set(0,0,0);const _=t.dot(this)/b;return this.copy(t).multiplyScalar(_)}projectOnPlane(t){return pH.copy(this).projectOnVector(t),this.sub(pH)}reflect(t){return this.sub(pH.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const b=Math.sqrt(this.lengthSq()*t.lengthSq());if(b===0)return Math.PI/2;const _=this.dot(t)/b;return Math.acos(S7(_,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const b=this.x-t.x,_=this.y-t.y,le=this.z-t.z;return b*b+_*_+le*le}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,b,_){const le=Math.sin(b)*t;return this.x=le*Math.sin(_),this.y=Math.cos(b)*t,this.z=le*Math.cos(_),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,b,_){return this.x=t*Math.sin(b),this.y=_,this.z=t*Math.cos(b),this}setFromMatrixPosition(t){const b=t.elements;return this.x=b[12],this.y=b[13],this.z=b[14],this}setFromMatrixScale(t){const b=this.setFromMatrixColumn(t,0).length(),_=this.setFromMatrixColumn(t,1).length(),le=this.setFromMatrixColumn(t,2).length();return this.x=b,this.y=_,this.z=le,this}setFromMatrixColumn(t,b){return this.fromArray(t.elements,b*4)}setFromMatrix3Column(t,b){return this.fromArray(t.elements,b*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,b=0){return this.x=t[b],this.y=t[b+1],this.z=t[b+2],this}toArray(t=[],b=0){return t[b]=this.x,t[b+1]=this.y,t[b+2]=this.z,t}fromBufferAttribute(t,b){return this.x=t.getX(b),this.y=t.getY(b),this.z=t.getZ(b),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,b=Math.random()*2-1,_=Math.sqrt(1-b*b);return this.x=_*Math.cos(t),this.y=b,this.z=_*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const pH=new jn,GB=new Dg;class l4{constructor(t,b,_,le,se,Se,He,me,ve,be,Ue,qe,Oe,Qe,it,yt){l4.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,b,_,le,se,Se,He,me,ve,be,Ue,qe,Oe,Qe,it,yt)}set(t,b,_,le,se,Se,He,me,ve,be,Ue,qe,Oe,Qe,it,yt){const Rt=this.elements;return Rt[0]=t,Rt[4]=b,Rt[8]=_,Rt[12]=le,Rt[1]=se,Rt[5]=Se,Rt[9]=He,Rt[13]=me,Rt[2]=ve,Rt[6]=be,Rt[10]=Ue,Rt[14]=qe,Rt[3]=Oe,Rt[7]=Qe,Rt[11]=it,Rt[15]=yt,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new l4().fromArray(this.elements)}copy(t){const b=this.elements,_=t.elements;return b[0]=_[0],b[1]=_[1],b[2]=_[2],b[3]=_[3],b[4]=_[4],b[5]=_[5],b[6]=_[6],b[7]=_[7],b[8]=_[8],b[9]=_[9],b[10]=_[10],b[11]=_[11],b[12]=_[12],b[13]=_[13],b[14]=_[14],b[15]=_[15],this}copyPosition(t){const b=this.elements,_=t.elements;return b[12]=_[12],b[13]=_[13],b[14]=_[14],this}setFromMatrix3(t){const b=t.elements;return this.set(b[0],b[3],b[6],0,b[1],b[4],b[7],0,b[2],b[5],b[8],0,0,0,0,1),this}extractBasis(t,b,_){return t.setFromMatrixColumn(this,0),b.setFromMatrixColumn(this,1),_.setFromMatrixColumn(this,2),this}makeBasis(t,b,_){return this.set(t.x,b.x,_.x,0,t.y,b.y,_.y,0,t.z,b.z,_.z,0,0,0,0,1),this}extractRotation(t){const b=this.elements,_=t.elements,le=1/rS.setFromMatrixColumn(t,0).length(),se=1/rS.setFromMatrixColumn(t,1).length(),Se=1/rS.setFromMatrixColumn(t,2).length();return b[0]=_[0]*le,b[1]=_[1]*le,b[2]=_[2]*le,b[3]=0,b[4]=_[4]*se,b[5]=_[5]*se,b[6]=_[6]*se,b[7]=0,b[8]=_[8]*Se,b[9]=_[9]*Se,b[10]=_[10]*Se,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,this}makeRotationFromEuler(t){const b=this.elements,_=t.x,le=t.y,se=t.z,Se=Math.cos(_),He=Math.sin(_),me=Math.cos(le),ve=Math.sin(le),be=Math.cos(se),Ue=Math.sin(se);if(t.order==="XYZ"){const qe=Se*be,Oe=Se*Ue,Qe=He*be,it=He*Ue;b[0]=me*be,b[4]=-me*Ue,b[8]=ve,b[1]=Oe+Qe*ve,b[5]=qe-it*ve,b[9]=-He*me,b[2]=it-qe*ve,b[6]=Qe+Oe*ve,b[10]=Se*me}else if(t.order==="YXZ"){const qe=me*be,Oe=me*Ue,Qe=ve*be,it=ve*Ue;b[0]=qe+it*He,b[4]=Qe*He-Oe,b[8]=Se*ve,b[1]=Se*Ue,b[5]=Se*be,b[9]=-He,b[2]=Oe*He-Qe,b[6]=it+qe*He,b[10]=Se*me}else if(t.order==="ZXY"){const qe=me*be,Oe=me*Ue,Qe=ve*be,it=ve*Ue;b[0]=qe-it*He,b[4]=-Se*Ue,b[8]=Qe+Oe*He,b[1]=Oe+Qe*He,b[5]=Se*be,b[9]=it-qe*He,b[2]=-Se*ve,b[6]=He,b[10]=Se*me}else if(t.order==="ZYX"){const qe=Se*be,Oe=Se*Ue,Qe=He*be,it=He*Ue;b[0]=me*be,b[4]=Qe*ve-Oe,b[8]=qe*ve+it,b[1]=me*Ue,b[5]=it*ve+qe,b[9]=Oe*ve-Qe,b[2]=-ve,b[6]=He*me,b[10]=Se*me}else if(t.order==="YZX"){const qe=Se*me,Oe=Se*ve,Qe=He*me,it=He*ve;b[0]=me*be,b[4]=it-qe*Ue,b[8]=Qe*Ue+Oe,b[1]=Ue,b[5]=Se*be,b[9]=-He*be,b[2]=-ve*be,b[6]=Oe*Ue+Qe,b[10]=qe-it*Ue}else if(t.order==="XZY"){const qe=Se*me,Oe=Se*ve,Qe=He*me,it=He*ve;b[0]=me*be,b[4]=-Ue,b[8]=ve*be,b[1]=qe*Ue+it,b[5]=Se*be,b[9]=Oe*Ue-Qe,b[2]=Qe*Ue-Oe,b[6]=He*be,b[10]=it*Ue+qe}return b[3]=0,b[7]=0,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Bx,t,Mx)}lookAt(t,b,_){const le=this.elements;return Jh.subVectors(t,b),Jh.lengthSq()===0&&(Jh.z=1),Jh.normalize(),GR.crossVectors(_,Jh),GR.lengthSq()===0&&(Math.abs(_.z)===1?Jh.x+=1e-4:Jh.z+=1e-4,Jh.normalize(),GR.crossVectors(_,Jh)),GR.normalize(),cb.crossVectors(Jh,GR),le[0]=GR.x,le[4]=cb.x,le[8]=Jh.x,le[1]=GR.y,le[5]=cb.y,le[9]=Jh.y,le[2]=GR.z,le[6]=cb.z,le[10]=Jh.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,b){const _=t.elements,le=b.elements,se=this.elements,Se=_[0],He=_[4],me=_[8],ve=_[12],be=_[1],Ue=_[5],qe=_[9],Oe=_[13],Qe=_[2],it=_[6],yt=_[10],Rt=_[14],li=_[3],Jt=_[7],Di=_[11],Ai=_[15],At=le[0],mt=le[4],Gs=le[8],Yn=le[12],Et=le[1],Ft=le[5],ed=le[9],wl=le[13],qn=le[2],Zd=le[6],Ui=le[10],ai=le[14],Jd=le[3],td=le[7],mn=le[11],_d=le[15];return se[0]=Se*At+He*Et+me*qn+ve*Jd,se[4]=Se*mt+He*Ft+me*Zd+ve*td,se[8]=Se*Gs+He*ed+me*Ui+ve*mn,se[12]=Se*Yn+He*wl+me*ai+ve*_d,se[1]=be*At+Ue*Et+qe*qn+Oe*Jd,se[5]=be*mt+Ue*Ft+qe*Zd+Oe*td,se[9]=be*Gs+Ue*ed+qe*Ui+Oe*mn,se[13]=be*Yn+Ue*wl+qe*ai+Oe*_d,se[2]=Qe*At+it*Et+yt*qn+Rt*Jd,se[6]=Qe*mt+it*Ft+yt*Zd+Rt*td,se[10]=Qe*Gs+it*ed+yt*Ui+Rt*mn,se[14]=Qe*Yn+it*wl+yt*ai+Rt*_d,se[3]=li*At+Jt*Et+Di*qn+Ai*Jd,se[7]=li*mt+Jt*Ft+Di*Zd+Ai*td,se[11]=li*Gs+Jt*ed+Di*Ui+Ai*mn,se[15]=li*Yn+Jt*wl+Di*ai+Ai*_d,this}multiplyScalar(t){const b=this.elements;return b[0]*=t,b[4]*=t,b[8]*=t,b[12]*=t,b[1]*=t,b[5]*=t,b[9]*=t,b[13]*=t,b[2]*=t,b[6]*=t,b[10]*=t,b[14]*=t,b[3]*=t,b[7]*=t,b[11]*=t,b[15]*=t,this}determinant(){const t=this.elements,b=t[0],_=t[4],le=t[8],se=t[12],Se=t[1],He=t[5],me=t[9],ve=t[13],be=t[2],Ue=t[6],qe=t[10],Oe=t[14],Qe=t[3],it=t[7],yt=t[11],Rt=t[15];return Qe*(+se*me*Ue-le*ve*Ue-se*He*qe+_*ve*qe+le*He*Oe-_*me*Oe)+it*(+b*me*Oe-b*ve*qe+se*Se*qe-le*Se*Oe+le*ve*be-se*me*be)+yt*(+b*ve*Ue-b*He*Oe-se*Se*Ue+_*Se*Oe+se*He*be-_*ve*be)+Rt*(-le*He*be-b*me*Ue+b*He*qe+le*Se*Ue-_*Se*qe+_*me*be)}transpose(){const t=this.elements;let b;return b=t[1],t[1]=t[4],t[4]=b,b=t[2],t[2]=t[8],t[8]=b,b=t[6],t[6]=t[9],t[9]=b,b=t[3],t[3]=t[12],t[12]=b,b=t[7],t[7]=t[13],t[13]=b,b=t[11],t[11]=t[14],t[14]=b,this}setPosition(t,b,_){const le=this.elements;return t.isVector3?(le[12]=t.x,le[13]=t.y,le[14]=t.z):(le[12]=t,le[13]=b,le[14]=_),this}invert(){const t=this.elements,b=t[0],_=t[1],le=t[2],se=t[3],Se=t[4],He=t[5],me=t[6],ve=t[7],be=t[8],Ue=t[9],qe=t[10],Oe=t[11],Qe=t[12],it=t[13],yt=t[14],Rt=t[15],li=Ue*yt*ve-it*qe*ve+it*me*Oe-He*yt*Oe-Ue*me*Rt+He*qe*Rt,Jt=Qe*qe*ve-be*yt*ve-Qe*me*Oe+Se*yt*Oe+be*me*Rt-Se*qe*Rt,Di=be*it*ve-Qe*Ue*ve+Qe*He*Oe-Se*it*Oe-be*He*Rt+Se*Ue*Rt,Ai=Qe*Ue*me-be*it*me-Qe*He*qe+Se*it*qe+be*He*yt-Se*Ue*yt,At=b*li+_*Jt+le*Di+se*Ai;if(At===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const mt=1/At;return t[0]=li*mt,t[1]=(it*qe*se-Ue*yt*se-it*le*Oe+_*yt*Oe+Ue*le*Rt-_*qe*Rt)*mt,t[2]=(He*yt*se-it*me*se+it*le*ve-_*yt*ve-He*le*Rt+_*me*Rt)*mt,t[3]=(Ue*me*se-He*qe*se-Ue*le*ve+_*qe*ve+He*le*Oe-_*me*Oe)*mt,t[4]=Jt*mt,t[5]=(be*yt*se-Qe*qe*se+Qe*le*Oe-b*yt*Oe-be*le*Rt+b*qe*Rt)*mt,t[6]=(Qe*me*se-Se*yt*se-Qe*le*ve+b*yt*ve+Se*le*Rt-b*me*Rt)*mt,t[7]=(Se*qe*se-be*me*se+be*le*ve-b*qe*ve-Se*le*Oe+b*me*Oe)*mt,t[8]=Di*mt,t[9]=(Qe*Ue*se-be*it*se-Qe*_*Oe+b*it*Oe+be*_*Rt-b*Ue*Rt)*mt,t[10]=(Se*it*se-Qe*He*se+Qe*_*ve-b*it*ve-Se*_*Rt+b*He*Rt)*mt,t[11]=(be*He*se-Se*Ue*se-be*_*ve+b*Ue*ve+Se*_*Oe-b*He*Oe)*mt,t[12]=Ai*mt,t[13]=(be*it*le-Qe*Ue*le+Qe*_*qe-b*it*qe-be*_*yt+b*Ue*yt)*mt,t[14]=(Qe*He*le-Se*it*le-Qe*_*me+b*it*me+Se*_*yt-b*He*yt)*mt,t[15]=(Se*Ue*le-be*He*le+be*_*me-b*Ue*me-Se*_*qe+b*He*qe)*mt,this}scale(t){const b=this.elements,_=t.x,le=t.y,se=t.z;return b[0]*=_,b[4]*=le,b[8]*=se,b[1]*=_,b[5]*=le,b[9]*=se,b[2]*=_,b[6]*=le,b[10]*=se,b[3]*=_,b[7]*=le,b[11]*=se,this}getMaxScaleOnAxis(){const t=this.elements,b=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],_=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],le=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(b,_,le))}makeTranslation(t,b,_){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,b,0,0,1,_,0,0,0,1),this}makeRotationX(t){const b=Math.cos(t),_=Math.sin(t);return this.set(1,0,0,0,0,b,-_,0,0,_,b,0,0,0,0,1),this}makeRotationY(t){const b=Math.cos(t),_=Math.sin(t);return this.set(b,0,_,0,0,1,0,0,-_,0,b,0,0,0,0,1),this}makeRotationZ(t){const b=Math.cos(t),_=Math.sin(t);return this.set(b,-_,0,0,_,b,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,b){const _=Math.cos(b),le=Math.sin(b),se=1-_,Se=t.x,He=t.y,me=t.z,ve=se*Se,be=se*He;return this.set(ve*Se+_,ve*He-le*me,ve*me+le*He,0,ve*He+le*me,be*He+_,be*me-le*Se,0,ve*me-le*He,be*me+le*Se,se*me*me+_,0,0,0,0,1),this}makeScale(t,b,_){return this.set(t,0,0,0,0,b,0,0,0,0,_,0,0,0,0,1),this}makeShear(t,b,_,le,se,Se){return this.set(1,_,se,0,t,1,Se,0,b,le,1,0,0,0,0,1),this}compose(t,b,_){const le=this.elements,se=b._x,Se=b._y,He=b._z,me=b._w,ve=se+se,be=Se+Se,Ue=He+He,qe=se*ve,Oe=se*be,Qe=se*Ue,it=Se*be,yt=Se*Ue,Rt=He*Ue,li=me*ve,Jt=me*be,Di=me*Ue,Ai=_.x,At=_.y,mt=_.z;return le[0]=(1-(it+Rt))*Ai,le[1]=(Oe+Di)*Ai,le[2]=(Qe-Jt)*Ai,le[3]=0,le[4]=(Oe-Di)*At,le[5]=(1-(qe+Rt))*At,le[6]=(yt+li)*At,le[7]=0,le[8]=(Qe+Jt)*mt,le[9]=(yt-li)*mt,le[10]=(1-(qe+it))*mt,le[11]=0,le[12]=t.x,le[13]=t.y,le[14]=t.z,le[15]=1,this}decompose(t,b,_){const le=this.elements;let se=rS.set(le[0],le[1],le[2]).length();const Se=rS.set(le[4],le[5],le[6]).length(),He=rS.set(le[8],le[9],le[10]).length();this.determinant()<0&&(se=-se),t.x=le[12],t.y=le[13],t.z=le[14],Pp.copy(this);const ve=1/se,be=1/Se,Ue=1/He;return Pp.elements[0]*=ve,Pp.elements[1]*=ve,Pp.elements[2]*=ve,Pp.elements[4]*=be,Pp.elements[5]*=be,Pp.elements[6]*=be,Pp.elements[8]*=Ue,Pp.elements[9]*=Ue,Pp.elements[10]*=Ue,b.setFromRotationMatrix(Pp),_.x=se,_.y=Se,_.z=He,this}makePerspective(t,b,_,le,se,Se,He=ab){const me=this.elements,ve=2*se/(b-t),be=2*se/(_-le),Ue=(b+t)/(b-t),qe=(_+le)/(_-le);let Oe,Qe;if(He===ab)Oe=-(Se+se)/(Se-se),Qe=-2*Se*se/(Se-se);else if(He===xB)Oe=-Se/(Se-se),Qe=-Se*se/(Se-se);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+He);return me[0]=ve,me[4]=0,me[8]=Ue,me[12]=0,me[1]=0,me[5]=be,me[9]=qe,me[13]=0,me[2]=0,me[6]=0,me[10]=Oe,me[14]=Qe,me[3]=0,me[7]=0,me[11]=-1,me[15]=0,this}makeOrthographic(t,b,_,le,se,Se,He=ab){const me=this.elements,ve=1/(b-t),be=1/(_-le),Ue=1/(Se-se),qe=(b+t)*ve,Oe=(_+le)*be;let Qe,it;if(He===ab)Qe=(Se+se)*Ue,it=-2*Ue;else if(He===xB)Qe=se*Ue,it=-1*Ue;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+He);return me[0]=2*ve,me[4]=0,me[8]=0,me[12]=-qe,me[1]=0,me[5]=2*be,me[9]=0,me[13]=-Oe,me[2]=0,me[6]=0,me[10]=it,me[14]=-Qe,me[3]=0,me[7]=0,me[11]=0,me[15]=1,this}equals(t){const b=this.elements,_=t.elements;for(let le=0;le<16;le++)if(b[le]!==_[le])return!1;return!0}fromArray(t,b=0){for(let _=0;_<16;_++)this.elements[_]=t[_+b];return this}toArray(t=[],b=0){const _=this.elements;return t[b]=_[0],t[b+1]=_[1],t[b+2]=_[2],t[b+3]=_[3],t[b+4]=_[4],t[b+5]=_[5],t[b+6]=_[6],t[b+7]=_[7],t[b+8]=_[8],t[b+9]=_[9],t[b+10]=_[10],t[b+11]=_[11],t[b+12]=_[12],t[b+13]=_[13],t[b+14]=_[14],t[b+15]=_[15],t}}const rS=new jn,Pp=new l4,Bx=new jn(0,0,0),Mx=new jn(1,1,1),GR=new jn,cb=new jn,Jh=new jn,FB=new l4,VB=new Dg;class bb{constructor(t=0,b=0,_=0,le=bb.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=b,this._z=_,this._order=le}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,b,_,le=this._order){return this._x=t,this._y=b,this._z=_,this._order=le,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,b=this._order,_=!0){const le=t.elements,se=le[0],Se=le[4],He=le[8],me=le[1],ve=le[5],be=le[9],Ue=le[2],qe=le[6],Oe=le[10];switch(b){case"XYZ":this._y=Math.asin(S7(He,-1,1)),Math.abs(He)<.9999999?(this._x=Math.atan2(-be,Oe),this._z=Math.atan2(-Se,se)):(this._x=Math.atan2(qe,ve),this._z=0);break;case"YXZ":this._x=Math.asin(-S7(be,-1,1)),Math.abs(be)<.9999999?(this._y=Math.atan2(He,Oe),this._z=Math.atan2(me,ve)):(this._y=Math.atan2(-Ue,se),this._z=0);break;case"ZXY":this._x=Math.asin(S7(qe,-1,1)),Math.abs(qe)<.9999999?(this._y=Math.atan2(-Ue,Oe),this._z=Math.atan2(-Se,ve)):(this._y=0,this._z=Math.atan2(me,se));break;case"ZYX":this._y=Math.asin(-S7(Ue,-1,1)),Math.abs(Ue)<.9999999?(this._x=Math.atan2(qe,Oe),this._z=Math.atan2(me,se)):(this._x=0,this._z=Math.atan2(-Se,ve));break;case"YZX":this._z=Math.asin(S7(me,-1,1)),Math.abs(me)<.9999999?(this._x=Math.atan2(-be,ve),this._y=Math.atan2(-Ue,se)):(this._x=0,this._y=Math.atan2(He,Oe));break;case"XZY":this._z=Math.asin(-S7(Se,-1,1)),Math.abs(Se)<.9999999?(this._x=Math.atan2(qe,ve),this._y=Math.atan2(He,se)):(this._x=Math.atan2(-be,Oe),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+b)}return this._order=b,_===!0&&this._onChangeCallback(),this}setFromQuaternion(t,b,_){return FB.makeRotationFromQuaternion(t),this.setFromRotationMatrix(FB,b,_)}setFromVector3(t,b=this._order){return this.set(t.x,t.y,t.z,b)}reorder(t){return VB.setFromEuler(this),this.setFromQuaternion(VB,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],b=0){return t[b]=this._x,t[b+1]=this._y,t[b+2]=this._z,t[b+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}bb.DEFAULT_ORDER="XYZ";class xx{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}}let Ux=0;const WB=new jn,aS=new Dg,O7=new l4,Ib=new jn,XC=new jn,Gx=new jn,Fx=new Dg,jB=new jn(1,0,0),YB=new jn(0,1,0),qB=new jn(0,0,1),Vx={type:"added"},Wx={type:"removed"},yH={type:"childadded",child:null},wH={type:"childremoved",child:null};class Nv extends bM{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ux++}),this.uuid=cB(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Nv.DEFAULT_UP.clone();const t=new jn,b=new bb,_=new Dg,le=new jn(1,1,1);function se(){_.setFromEuler(b,!1)}function Se(){b.setFromQuaternion(_,void 0,!1)}b._onChange(se),_._onChange(Se),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:b},quaternion:{configurable:!0,enumerable:!0,value:_},scale:{configurable:!0,enumerable:!0,value:le},modelViewMatrix:{value:new l4},normalMatrix:{value:new Rg}}),this.matrix=new l4,this.matrixWorld=new l4,this.matrixAutoUpdate=Nv.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Nv.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new xx,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,b){this.quaternion.setFromAxisAngle(t,b)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,b){return aS.setFromAxisAngle(t,b),this.quaternion.multiply(aS),this}rotateOnWorldAxis(t,b){return aS.setFromAxisAngle(t,b),this.quaternion.premultiply(aS),this}rotateX(t){return this.rotateOnAxis(jB,t)}rotateY(t){return this.rotateOnAxis(YB,t)}rotateZ(t){return this.rotateOnAxis(qB,t)}translateOnAxis(t,b){return WB.copy(t).applyQuaternion(this.quaternion),this.position.add(WB.multiplyScalar(b)),this}translateX(t){return this.translateOnAxis(jB,t)}translateY(t){return this.translateOnAxis(YB,t)}translateZ(t){return this.translateOnAxis(qB,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(O7.copy(this.matrixWorld).invert())}lookAt(t,b,_){t.isVector3?Ib.copy(t):Ib.set(t,b,_);const le=this.parent;this.updateWorldMatrix(!0,!1),XC.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?O7.lookAt(XC,Ib,this.up):O7.lookAt(Ib,XC,this.up),this.quaternion.setFromRotationMatrix(O7),le&&(O7.extractRotation(le.matrixWorld),aS.setFromRotationMatrix(O7),this.quaternion.premultiply(aS.invert()))}add(t){if(arguments.length>1){for(let b=0;b<arguments.length;b++)this.add(arguments[b]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Vx),yH.child=t,this.dispatchEvent(yH),yH.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let _=0;_<arguments.length;_++)this.remove(arguments[_]);return this}const b=this.children.indexOf(t);return b!==-1&&(t.parent=null,this.children.splice(b,1),t.dispatchEvent(Wx),wH.child=t,this.dispatchEvent(wH),wH.child=null),this}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),O7.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),O7.multiply(t.parent.matrixWorld)),t.applyMatrix4(O7),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,b){if(this[t]===b)return this;for(let _=0,le=this.children.length;_<le;_++){const Se=this.children[_].getObjectByProperty(t,b);if(Se!==void 0)return Se}}getObjectsByProperty(t,b,_=[]){this[t]===b&&_.push(this);const le=this.children;for(let se=0,Se=le.length;se<Se;se++)le[se].getObjectsByProperty(t,b,_);return _}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(XC,t,Gx),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(XC,Fx,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const b=this.matrixWorld.elements;return t.set(b[8],b[9],b[10]).normalize()}raycast(){}traverse(t){t(this);const b=this.children;for(let _=0,le=b.length;_<le;_++)b[_].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);const b=this.children;for(let _=0,le=b.length;_<le;_++)b[_].traverseVisible(t)}traverseAncestors(t){const b=this.parent;b!==null&&(t(b),b.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const b=this.children;for(let _=0,le=b.length;_<le;_++){const se=b[_];(se.matrixWorldAutoUpdate===!0||t===!0)&&se.updateMatrixWorld(t)}}updateWorldMatrix(t,b){const _=this.parent;if(t===!0&&_!==null&&_.matrixWorldAutoUpdate===!0&&_.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),b===!0){const le=this.children;for(let se=0,Se=le.length;se<Se;se++){const He=le[se];He.matrixWorldAutoUpdate===!0&&He.updateWorldMatrix(!1,!0)}}}toJSON(t){const b=t===void 0||typeof t=="string",_={};b&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},_.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const le={};le.uuid=this.uuid,le.type=this.type,this.name!==""&&(le.name=this.name),this.castShadow===!0&&(le.castShadow=!0),this.receiveShadow===!0&&(le.receiveShadow=!0),this.visible===!1&&(le.visible=!1),this.frustumCulled===!1&&(le.frustumCulled=!1),this.renderOrder!==0&&(le.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(le.userData=this.userData),le.layers=this.layers.mask,le.matrix=this.matrix.toArray(),le.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(le.matrixAutoUpdate=!1),this.isInstancedMesh&&(le.type="InstancedMesh",le.count=this.count,le.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(le.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(le.type="BatchedMesh",le.perObjectFrustumCulled=this.perObjectFrustumCulled,le.sortObjects=this.sortObjects,le.drawRanges=this._drawRanges,le.reservedRanges=this._reservedRanges,le.visibility=this._visibility,le.active=this._active,le.bounds=this._bounds.map(He=>({boxInitialized:He.boxInitialized,boxMin:He.box.min.toArray(),boxMax:He.box.max.toArray(),sphereInitialized:He.sphereInitialized,sphereRadius:He.sphere.radius,sphereCenter:He.sphere.center.toArray()})),le.maxGeometryCount=this._maxGeometryCount,le.maxVertexCount=this._maxVertexCount,le.maxIndexCount=this._maxIndexCount,le.geometryInitialized=this._geometryInitialized,le.geometryCount=this._geometryCount,le.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(le.boundingSphere={center:le.boundingSphere.center.toArray(),radius:le.boundingSphere.radius}),this.boundingBox!==null&&(le.boundingBox={min:le.boundingBox.min.toArray(),max:le.boundingBox.max.toArray()}));function se(He,me){return He[me.uuid]===void 0&&(He[me.uuid]=me.toJSON(t)),me.uuid}if(this.isScene)this.background&&(this.background.isColor?le.background=this.background.toJSON():this.background.isTexture&&(le.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(le.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){le.geometry=se(t.geometries,this.geometry);const He=this.geometry.parameters;if(He!==void 0&&He.shapes!==void 0){const me=He.shapes;if(Array.isArray(me))for(let ve=0,be=me.length;ve<be;ve++){const Ue=me[ve];se(t.shapes,Ue)}else se(t.shapes,me)}}if(this.isSkinnedMesh&&(le.bindMode=this.bindMode,le.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(se(t.skeletons,this.skeleton),le.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const He=[];for(let me=0,ve=this.material.length;me<ve;me++)He.push(se(t.materials,this.material[me]));le.material=He}else le.material=se(t.materials,this.material);if(this.children.length>0){le.children=[];for(let He=0;He<this.children.length;He++)le.children.push(this.children[He].toJSON(t).object)}if(this.animations.length>0){le.animations=[];for(let He=0;He<this.animations.length;He++){const me=this.animations[He];le.animations.push(se(t.animations,me))}}if(b){const He=Se(t.geometries),me=Se(t.materials),ve=Se(t.textures),be=Se(t.images),Ue=Se(t.shapes),qe=Se(t.skeletons),Oe=Se(t.animations),Qe=Se(t.nodes);He.length>0&&(_.geometries=He),me.length>0&&(_.materials=me),ve.length>0&&(_.textures=ve),be.length>0&&(_.images=be),Ue.length>0&&(_.shapes=Ue),qe.length>0&&(_.skeletons=qe),Oe.length>0&&(_.animations=Oe),Qe.length>0&&(_.nodes=Qe)}return _.object=le,_;function Se(He){const me=[];for(const ve in He){const be=He[ve];delete be.metadata,me.push(be)}return me}}clone(t){return new this.constructor().copy(this,t)}copy(t,b=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),b===!0)for(let _=0;_<t.children.length;_++){const le=t.children[_];this.add(le.clone())}return this}}Nv.DEFAULT_UP=new jn(0,1,0);Nv.DEFAULT_MATRIX_AUTO_UPDATE=!0;Nv.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class jx extends SD{constructor(t,b,_,le,se,Se,He,me,ve,be){if(be=be!==void 0?be:cH,be!==cH&&be!==MB)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");_===void 0&&be===cH&&(_=Ox),_===void 0&&be===MB&&(_=Sx),super(null,le,se,Se,He,me,be,_,ve),this.isDepthTexture=!0,this.image={width:t,height:b},this.magFilter=He!==void 0?He:BB,this.minFilter=me!==void 0?me:BB,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const b=super.toJSON(t);return this.compareFunction!==null&&(b.compareFunction=this.compareFunction),b}}const Yx=new jx(1,1);Yx.compareFunction=Px;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:CM}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=CM);class qx{constructor(){this.factor=1,this.complement=1}apply(t){const _=this.getScaleMatrix().multiply(t);t.copy(_)}setUp(t){this.factor=1;const b=this.getLengthUnits(t);if(!b)return;const _=b==null,le=b.Name===void 0||b.Name===null;_||le||(b.Name.value==="FOOT"?this.factor=.3048:b.Prefix?.value==="MILLI"&&(this.complement=.001))}getLengthUnits(t){try{const _=t.GetLineIDsWithType(0,ix).get(0),le=t.GetLine(0,_);for(const se of le.Units){if(!se||se.value===null||se.value===void 0)continue;const Se=t.GetLine(0,se.value);if(Se.UnitType&&Se.UnitType.value==="LENGTHUNIT")return Se}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const t=this.factor;return new l4().fromArray([t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1])}}class kx{constructor(){this.itemsByFloor={},this._units=new qx}setUp(t){this._units.setUp(t),this.cleanUp();try{const b=t.GetLineIDsWithType(0,he),_=new Set,le=t.GetLineIDsWithType(0,Sn);for(let ve=0;ve<le.size();ve++)_.add(le.get(ve));const se=t.GetLineIDsWithType(0,w),Se=se.size();for(let ve=0;ve<Se;ve++){const be=se.get(ve),Ue=t.GetLine(0,be);if(!Ue||!Ue.RelatingObject||!Ue.RelatedObjects)continue;const qe=Ue.RelatingObject.value,Oe=Ue.RelatedObjects;for(const Qe of Oe){const it=Qe.value;_.has(it)&&(this.itemsByFloor[it]=qe)}}const He={},me=b.size();for(let ve=0;ve<me;ve++){const be=b.get(ve),Ue=t.GetLine(0,be);if(!Ue||!Ue.RelatingStructure||!Ue.RelatedElements)continue;const qe=Ue.RelatingStructure.value,Oe=Ue.RelatedElements;if(_.has(qe))for(const Qe of Oe){He[qe]||(He[qe]=[]);const it=Qe.value;He[qe].push(it)}else for(const Qe of Oe){const it=Qe.value;this.itemsByFloor[it]=qe}}for(const ve in He){const be=this.itemsByFloor[ve];if(be!==void 0){const Ue=He[ve];for(const qe of Ue)this.itemsByFloor[qe]=be}}for(let ve=0;ve<Se;ve++){const be=se.get(ve),Ue=t.GetLine(0,be);if(!Ue||!Ue.RelatingObject||!Ue.RelatedObjects)continue;const qe=Ue.RelatingObject.value,Oe=Ue.RelatedObjects;for(const Qe of Oe){const it=Qe.value,yt=this.itemsByFloor[qe];yt!==void 0&&(this.itemsByFloor[it]=yt)}}}catch{console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}const zx=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]);class Kx{async export(t,b,_=!1,le=!0){const se={},Se=new Set(t.GetIfcEntityList(b)),He=new Set([Wp,M0,vu,Q0,Sn]);for(const me of He)Se.add(me);for(const me of Se){if(zx.has(me))continue;const ve=He.has(me)&&le,be=t.GetLineIDsWithType(b,me);for(const Ue of be){const qe=t.GetLine(0,Ue,ve,_);se[qe.expressID]=qe}}return se}}class Qx{constructor(){this.normal=[],this.position=[],this.instances=[],this.id=""}}class $x{constructor(){this.id="",this.transform=[],this.material=new IB}}class IB{constructor(){this.Name="",this.Opacity=1,this.Metalness=0,this.Roughness=1,this.Red=225,this.Green=225,this.Blue=225}}class HM{constructor(){this.Materials=[],this.Elements=[],this.Data=new BM,this.CameraData=new Hb,this.Translation=[]}}class BM{constructor(){this.Data={}}}class Zx{constructor(){this.Data={},this.CameraData=new Hb,this.Translation=[]}}class TH{constructor(){this.Solids=[],this.Id="",this.Instances=[]}}class MM{constructor(){this.MaterialIndex=0,this.Vertices=[],this.Indices=[],this.Buffer=[],this.Id="",this.GeometryId="",this.Transform=[]}}class xM{constructor(){this.BasisX=new Au,this.BasisY=new Au,this.BasisZ=new Au,this.Offset=new Au,this.Id="",this.Matrix=new l4}}class Au{constructor(t=0,b=0,_=0){this.X=0,this.Y=0,this.Z=0,this.X=t,this.Y=b,this.Z=_}}class Hb{constructor(){this.scale=0,this.origin=new Au,this.eyePosition=new Au,this.upDirection=new Au,this.forwardDirection=new Au,this.target=new Au,this.box=new UM}}class UM{constructor(){this.min=new Au,this.max=new Au}}const Lb=class Lb{constructor(t=!0,b){this._webIfc=new Rx,this.settings=new Dx,this._fragments=new Map,this._spatialTree=new kx,this._propertyExporter=new Kx,this._materials=[],this._groupByGeometryId={},this.settings.autoSetWasm=t,this._customWasmPath=b,this.settings.excludedCategories.add(Ms)}async setup(){this.settings.autoSetWasm&&await this.autoSetWasm()}async autoSetWasm(){const t=await fetch(`https://unpkg.com/@thatopen/components@${Lb.release}/package.json`);if(!t.ok){console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");return}const b=await t.json();if(!("web-ifc"in b.peerDependencies))console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.");else{const _=b.peerDependencies["web-ifc"];this.settings.wasm.path=`https://unpkg.com/web-ifc@${_}/`,this.settings.wasm.absolute=!0}}async loadByUrl(t){this._dispose();const _=await(await fetch(t)).arrayBuffer(),le=new Uint8Array(_);let se=await this.load2(le);return this._webIfc.Dispose(),se}async load2(t,b=!0){await this.readIfcFile(t);const _=await this.getAllGeometries2(),le=await this.getAllProperties(),se=await this.getWorldCoordinationMatrix();let Se=new HM;Se.Translation=se,Se.Elements=_.elements,_.material.forEach((He,me)=>{let ve=new IB;ve.Red=Math.round(He.x*255),ve.Green=Math.round(He.y*255),ve.Blue=Math.round(He.z*255),ve.Opacity=He.w,ve.Name=me.toString(),Se.Materials.push(ve)});for(const He of Object.keys(le)){let me=le,ve=this.flattenObject(me[He]),be={};for(const Ue of Object.keys(ve)){let qe={name:Ue,value:ve[Ue]?ve[Ue].toString():""};be[Ue]=qe}Se.Data.Data[ve.expressID]=be}return Se.CameraData=this.generateBoundingbox(Se.Elements),Se}async readIfcFile(t){const{path:b,absolute:_,logLevel:le}=this.settings.wasm;return console.log(this.settings.autoSetWasm),this.settings.autoSetWasm?this._webIfc.SetWasmPath(b,_):this._webIfc.SetWasmPath(this._customWasmPath?this._customWasmPath:"./wasm/",!0),await this._webIfc.Init(),le&&this._webIfc.SetLogLevel(le),this._webIfc.OpenModel(t,this.settings.webIfc)}async getAllGeometries2(){this._spatialTree.setUp(this._webIfc);const t=this._webIfc.GetIfcEntityList(0),b=[];for(const le of t){if(!this._webIfc.IsIfcElement(le)&&le!==Sn)continue;const se=this.settings.includedCategories;if(se.size>0&&!se.has(le))continue;if(this.settings.excludedCategories.has(le))continue;const Se=this._webIfc.GetLineIDsWithType(0,le),He=Se.size();for(let me=0;me<He;me++){const ve=Se.get(me);b.push(ve),this._spatialTree.itemsByFloor[ve]}}this._spatialTree.cleanUp();let _=[];return this._webIfc.StreamMeshes(0,b,(le,se,Se)=>{this.getMesh2(le)}),_=this.generateInstancedMesh(),{elements:_,material:this._materials}}getMesh2(t){let b=new TH;const _=t.geometries.size(),le=t.expressID;b.Id=le.toString();for(let se=0;se<_;se++){let Se=new MM;const He=t.geometries.get(se),{x:me,y:ve,z:be,w:Ue}=He.color;let qe=this._materials.findIndex(li=>li.x==me&&li.y==ve&&li.z==be&&li.w==Ue);qe<0&&(this._materials.push({x:me,y:ve,z:be,w:Ue}),qe=this._materials.length-1),Se.MaterialIndex=qe;const Oe=Ue!==1,{geometryExpressID:Qe}=He,it=`${Qe}-${Oe}`,yt=this.getGeometry(this._webIfc,Qe);new l4().fromArray(He.flatTransformation);for(let li=0;li<yt.position.length;li+=3){const Jt=yt.position[li],Di=yt.position[li+1],Ai=yt.position[li+2],At=new jn(Jt,Di,Ai);//!switch back to revit xyz, get revit axis is a standard for every format so we dont have to recode again.
|
|
40
40
|
Se.Vertices.push(new Au(-At.x,At.z,At.y))}Se.Indices=yt.index,Se.GeometryId=it,Se.Transform=He.flatTransformation,Se.Id=le.toString(),this._groupByGeometryId[it]||(this._groupByGeometryId[it]=[]),this._groupByGeometryId[it].push(Se),b.Solids.push(Se)}return b}getGeometry(t,b){const _=t.GetGeometry(0,b),le=t.GetIndexArray(_.GetIndexData(),_.GetIndexDataSize()),se=t.GetVertexArray(_.GetVertexData(),_.GetVertexDataSize()),Se=new Float32Array(se.length/2),He=new Float32Array(se.length/2);for(let me=0;me<se.length;me+=6)Se[me/2]=se[me],Se[me/2+1]=se[me+1],Se[me/2+2]=se[me+2],He[me/2]=se[me+3],He[me/2+1]=se[me+4],He[me/2+2]=se[me+5];return _.delete(),{position:Se,normal:He,index:Array.from(le)}}async getAllProperties(){return await this._propertyExporter.export(this._webIfc,0)}async getWorldCoordinationMatrix(){return this._webIfc.GetCoordinationMatrix(0)}async _dispose(){this._fragments.clear(),this._materials=[],this._groupByGeometryId={}}flattenObject(t,b="",_={}){for(const le of Object.keys(t)){const se=b?`${b}.${le}`:le;typeof t[le]=="object"&&t[le]!==null&&!Array.isArray(t[le])?this.flattenObject(t[le],se,_):_[se]=t[le]}return _}generateInstancedMesh(){let t=[];for(const b of Object.keys(this._groupByGeometryId)){let _=this._groupByGeometryId[b],le=new TH;le.Id=b,le.Solids=[_[0]],_.forEach(se=>{let Se=new xM;Se.Id=se.Id,Se.Matrix=new l4().fromArray(se.Transform),Se.BasisX=new Au(se.Transform[0],-se.Transform[2],-se.Transform[1]),Se.BasisZ=new Au(-se.Transform[4],se.Transform[6],se.Transform[5]),Se.BasisY=new Au(-se.Transform[8],se.Transform[10],se.Transform[9]),Se.Offset=new Au(-se.Transform[12],se.Transform[14],se.Transform[13]),le.Instances.push(Se)}),t.push(le)}return console.log(t),t}generateBoundingbox(t){let _=t.map(me=>me.Instances).flat().map(me=>me.Offset),le=_.map(me=>me.X),se=_.map(me=>me.Y),Se=_.map(me=>me.Z),He=new Hb;return He.box.min=new Au(Math.min(...le),Math.min(...se),Math.min(...Se)),He.box.max=new Au(Math.max(...le),Math.max(...se),Math.max(...Se)),He}};Lb.release="3.1.2";let EH=Lb;exports.Fragment=Qx;exports.FragmentInstance=$x;exports.IFCReader=EH;exports.RenderMaterial=IB;exports.RevitTransform=xM;exports.ViralPoint=Au;exports.ViralutionBox=UM;exports.ViralutionCamera=Hb;exports.ViralutionElement=TH;exports.ViralutionIFCModel=HM;exports.ViralutionInformation=BM;exports.ViralutionSolid=MM;exports.ViralutionTrackingModel=Zx;
|
package/dist/index.js
CHANGED
|
@@ -37230,7 +37230,7 @@ class qx {
|
|
|
37230
37230
|
}
|
|
37231
37231
|
class eU {
|
|
37232
37232
|
constructor() {
|
|
37233
|
-
this.Data = {}, this.CameraData = new rB();
|
|
37233
|
+
this.Data = {}, this.CameraData = new rB(), this.Translation = [];
|
|
37234
37234
|
}
|
|
37235
37235
|
}
|
|
37236
37236
|
class jB {
|