@realsee/five 6.9.0-alpha.2 → 6.9.0-alpha.3
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/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/five.AdaptiveLuminancePass.html +1 -1
- package/docs/classes/five.EyeDomeLightingPass.html +1 -1
- package/docs/classes/five.FivePass.html +1 -1
- package/docs/classes/five.FlowingFireworks3DPass.html +1 -1
- package/docs/classes/five.FlowingLight2DPass.html +1 -1
- package/docs/classes/five.FlowingLight3DPass.html +1 -1
- package/docs/classes/five.GaussianBlurPass.html +1 -1
- package/docs/classes/five.Model.html +1 -1
- package/docs/classes/five.ModelScene.html +1 -1
- package/docs/classes/five.PBMCustomShader.html +1 -1
- package/docs/classes/five.PBMGSObject.html +26 -6
- package/docs/classes/five.PBMMeshMaterial.html +1 -1
- package/docs/classes/five.PBMPanoFilter.html +1 -1
- package/docs/classes/five.PBMPointCloudMaterial.html +1 -1
- package/docs/classes/five.PBMUpdateable.html +1 -1
- package/docs/classes/five.Parameter.html +1 -1
- package/docs/classes/five.Tile3D.html +1 -1
- package/docs/classes/five.TileNode.html +1 -1
- package/docs/classes/five.TrajectoryNode.html +1 -1
- package/docs/classes/five.WorkResolvedObserver.html +1 -1
- package/docs/classes/gltf-loader.DDSLoader.html +1 -1
- package/docs/classes/gltf-loader.DRACOLoader.html +1 -1
- package/docs/classes/gltf-loader.GLTFObject.html +1 -1
- package/docs/classes/gltf-loader.THREEGLTFLoader.html +1 -1
- package/docs/classes/line.LineGeometry.html +1 -1
- package/docs/classes/line.LineMaterial.html +1 -1
- package/docs/classes/line.LineSegmentsGeometry.html +1 -1
- package/docs/classes/line.THREE_Line2.html +1 -1
- package/docs/classes/line.THREE_LineSegments2.html +1 -1
- package/docs/classes/plugins.CSS2DObject.html +1 -1
- package/docs/classes/plugins.CSS3DObject.html +1 -1
- package/docs/classes/plugins.CSS3DSprite.html +1 -1
- package/docs/classes/plugins.InstancedPrefabBufferGeometry.html +1 -1
- package/docs/classes/plugins.Object3DHelperController.html +1 -1
- package/docs/classes/plugins.PointBufferGeometry.html +1 -1
- package/docs/classes/plugins.PrefabBufferGeometry.html +1 -1
- package/docs/classes/plugins.RoundedBoxGeometry.html +1 -1
- package/docs/classes/vfx.Airflow.html +1 -1
- package/docs/classes/vfx.Flame.html +1 -1
- package/docs/classes/vfx.Particle.html +1 -1
- package/docs/classes/vfx.ParticleGPU.html +1 -1
- package/docs/classes/vfx.SpotLight.html +1 -1
- package/docs/functions/five.loadSpz.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/five.LooseWorkWithExtrinsics.html +1 -1
- package/docs/interfaces/five.PBMMaterial.html +1 -1
- package/docs/interfaces/five.PBMMeshMaterialParameters.html +1 -1
- package/docs/interfaces/five.PBMPointCloudMaterialParameters.html +1 -1
- package/docs/interfaces/five.ParameterMaterialValue.html +1 -1
- package/docs/interfaces/five.ParameterTilesetValue.html +1 -1
- package/docs/interfaces/five.ParameterValue.html +1 -1
- package/docs/interfaces/five.ResolvedParameterValue.html +1 -1
- package/docs/interfaces/five.SplatData.html +4 -2
- package/docs/interfaces/five.ViewLayer.html +1 -1
- package/docs/interfaces/five.WorkCubeImage.html +1 -1
- package/docs/interfaces/five.WorkImage.html +1 -1
- package/docs/interfaces/five.WorkObserver.html +1 -1
- package/docs/interfaces/five.WorkObserverProto.html +1 -1
- package/docs/interfaces/five.WorkTile.html +1 -1
- package/docs/interfaces/plugins.BackgroundPluginController.html +1 -1
- package/docs/interfaces/plugins.BackgroundPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.CSS2DPluginController.html +1 -1
- package/docs/interfaces/plugins.CSS2DPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.CSS2DPluginType.State.html +1 -1
- package/docs/interfaces/plugins.CSS3DPluginController.html +1 -1
- package/docs/interfaces/plugins.CSS3DPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.CSS3DPluginType.State.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginController.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.DynamicPathLinePluginType.State.html +1 -1
- package/docs/interfaces/plugins.GaussianSplattingEntranceAnimationController.html +1 -1
- package/docs/interfaces/plugins.GaussianSplattingEntranceAnimationPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.GaussianSplattingEntranceAnimationPluginType.State.html +1 -1
- package/docs/interfaces/plugins.ItemMaskController.html +1 -1
- package/docs/interfaces/plugins.ItemMaskPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.ItemMaskPluginType.State.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.BaseController.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.BaseHelper.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.BoundingBoxController.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.MoveController.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.MoveHelperAbstract.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.RotateController.html +1 -1
- package/docs/interfaces/plugins.Object3DHelperPluginType.RotateHelperAbstract.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginController.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.OrientationPluginType.State.html +1 -1
- package/docs/interfaces/plugins.PanoAnimeController.html +1 -1
- package/docs/interfaces/plugins.PanoAnimePluginType.EventMap.html +1 -1
- package/docs/interfaces/plugins.PanoAnimePluginType.State.html +1 -1
- package/docs/interfaces/plugins.PluginTemplateType.EventMap.html +1 -1
- package/docs/interfaces/plugins.PluginTemplateType.State.html +1 -1
- package/docs/interfaces/plugins.TrajectoryController.html +1 -1
- package/docs/interfaces/react.FiveInjectionTypes.html +1 -1
- package/docs/interfaces/react.UseFivePluginOptions.html +1 -1
- package/docs/interfaces/react.UseFivePluginOptionsWithCreate.html +1 -1
- package/docs/types/five.ParseOptions.html +1 -1
- package/five/gaussian-splatting/objectParamsStore.d.ts +35 -0
- package/five/index.js +10 -10
- package/five/index.mjs +105 -64
- package/five/model/loaders/spz.d.ts +9 -0
- package/five/model/objects/pbmGaussianSplattingObject.d.ts +34 -0
- package/five/model/objects/pbmGaussianSplattingRenderMesh.d.ts +6 -0
- package/gltf-loader/index.js +3 -3
- package/gltf-loader/index.mjs +3 -3
- package/line/index.js +3 -3
- package/line/index.mjs +3 -3
- package/package.json +1 -1
- package/{pbmGaussianSplattingObject-C6i7CUTu.cjs → pbmGaussianSplattingObject-BDOzNal0.cjs} +3 -3
- package/{pbmGaussianSplattingObject-CaE6q4r-.js → pbmGaussianSplattingObject-BwsrwWs6.js} +27 -10
- package/plugins/index.js +2 -2
- package/plugins/index.mjs +2 -2
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/shader-lib/index.js +2 -2
- package/shader-lib/index.mjs +2 -2
- package/sticker/index.js +3 -3
- package/sticker/index.mjs +3 -3
- package/umd/five-gltf-loader.js +3 -3
- package/umd/five-line.js +3 -3
- package/umd/five-plugins.js +2 -2
- package/umd/five-react.js +2 -2
- package/umd/five-shader-lib.js +2 -2
- package/umd/five-sticker.js +3 -3
- package/umd/five-vfx.js +2 -2
- package/umd/five-vue.js +2 -2
- package/umd/five.js +8 -8
- package/vfx/index.js +2 -2
- package/vfx/index.mjs +2 -2
- package/vue/index.js +2 -2
- package/vue/index.mjs +2 -2
- package/work-downloader/index.js +2 -2
- package/work-downloader/index.mjs +2 -2
package/five/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated:
|
|
5
|
-
* Version: 6.9.0-alpha.
|
|
4
|
+
* Generated: 8/5/2026
|
|
5
|
+
* Version: 6.9.0-alpha.3
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
* No amendment to or modification of this Agreement will be binding unless in
|
|
253
253
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
254
|
* Agreement and all related documents shall be drafted in English.
|
|
255
|
-
*/Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../pbmGaussianSplattingObject-C6i7CUTu.cjs`);let t=require(`three`);t=e.r(t,1);let n=require(`protobufjs/minimal`);n=e.r(n,1);var r=Number(t.REVISION);if(r<115||r>117)throw Error(`"Five" needs "THREE.js" version between 125 - 117.`);var i={},a=a||function(e,t){var n={},r=n.lib={},i=r.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var n=new e;return t&&n.mixIn(t),n.hasOwnProperty(`init`)||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty(`toString`)&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),a=r.WordArray=i.extend({init:function(e,n){e=this.words=e||[],n==t?this.sigBytes=e.length*4:this.sigBytes=n},toString:function(e){return(e||s).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var a=0;a<i;a++){var o=n[a>>>2]>>>24-a%4*8&255;t[r+a>>>2]|=o<<24-(r+a)%4*8}else for(var a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r<t;r+=4)n.push(e.random()*4294967296|0);return new a.init(n,t)}}),o=n.enc={},s=o.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push((a>>>4).toString(16)),r.push((a&15).toString(16))}return r.join(``)},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new a.init(n,t/2)}},c=o.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(a))}return r.join(``)},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(e.charCodeAt(r)&255)<<24-r%4*8;return new a.init(n,t)}},l=o.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error(`Malformed UTF-8 data`)}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},u=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){typeof e==`string`&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,i=n.sigBytes,o=this.blockSize,s=i/(o*4);s=t?e.ceil(s):e.max((s|0)-this._minBufferSize,0);var c=s*o,l=e.min(c*4,i);if(c){for(var u=0;u<c;u+=o)this._doProcessBlock(r,u);var d=r.splice(0,c);n.sigBytes-=l}return new a.init(d,l)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});r.Hasher=u.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){u.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:512/32,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new d.HMAC.init(e,n).finalize(t)}}});var d=n.algo={};return n}(Math);(function(e){for(var t=a,n=t.lib,r=n.WordArray,i=n.Hasher,n=t.algo,o=[],s=[],c=function(e){return 4294967296*(e-(e|0))|0},l=2,u=0;64>u;){var d;a:{d=l;for(var f=e.sqrt(d),p=2;p<=f;p++)if(!(d%p)){d=!1;break a}d=!0}d&&(8>u&&(o[u]=c(e.pow(l,.5))),s[u]=c(e.pow(l,1/3)),u++),l++}var m=[],n=n.SHA256=i.extend({_doReset:function(){this._hash=new r.init(o.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],a=n[2],o=n[3],c=n[4],l=n[5],u=n[6],d=n[7],f=0;64>f;f++){if(16>f)m[f]=e[t+f]|0;else{var p=m[f-15],h=m[f-2];m[f]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+m[f-7]+((h<<15|h>>>17)^(h<<13|h>>>19)^h>>>10)+m[f-16]}p=d+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&l^~c&u)+s[f]+m[f],h=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&a^i&a),d=u,u=l,l=c,c=o+p|0,o=a,a=i,i=r,r=p+h|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+o|0,n[4]=n[4]+c|0,n[5]=n[5]+l|0,n[6]=n[6]+u|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[(i+64>>>9<<4)+14]=e.floor(r/4294967296),n[(i+64>>>9<<4)+15]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(n),t.HmacSHA256=i._createHmacHelper(n)})(Math),a.lib.Cipher||function(e){var t=a,n=t.lib,r=n.Base,i=n.WordArray,o=n.BufferedBlockAlgorithm,s=t.enc.Base64,c=t.algo.EvpKDF,l=n.Cipher=o.extend({cfg:r.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,n,r){return(typeof n==`string`?h:m).encrypt(e,t,n,r)},decrypt:function(t,n,r){return(typeof n==`string`?h:m).decrypt(e,t,n,r)}}}});n.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=t.mode={},d=function(t,n,r){var i=this._iv;i?this._iv=e:i=this._prevBlock;for(var a=0;a<r;a++)t[n+a]^=i[a]},f=(n.BlockCipherMode=r.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();f.Encryptor=f.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize;d.call(this,e,t,r),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}}),f.Decryptor=f.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,i=e.slice(t,t+r);n.decryptBlock(e,t),d.call(this,e,t,r),this._prevBlock=i}}),u=u.CBC=f,f=(t.pad={}).Pkcs7={pad:function(e,t){for(var n=4*t,n=n-e.sigBytes%n,r=n<<24|n<<16|n<<8|n,a=[],o=0;o<n;o+=4)a.push(r);n=i.create(a,n),e.concat(n)},unpad:function(e){e.sigBytes-=e.words[e.sigBytes-1>>>2]&255}},n.BlockCipher=l.extend({cfg:l.cfg.extend({mode:u,padding:f}),reset:function(){l.reset.call(this);var e=this.cfg,t=e.iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=e.createEncryptor;else n=e.createDecryptor,this._minBufferSize=1;this._mode=n.call(e,this,t&&t.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var p=n.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),u=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return e=e.salt,(e?i.create([1398893684,1701076831]).concat(e).concat(t):t).toString(s)},parse:function(e){e=s.parse(e);var t=e.words;if(t[0]==1398893684&&t[1]==1701076831){var n=i.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return p.create({ciphertext:e,salt:n})}},m=n.SerializableCipher=r.extend({cfg:r.extend({format:u}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r);return t=i.finalize(t),i=i.cfg,p.create({ciphertext:t,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return typeof e==`string`?t.parse(e,this):e}}),t=(t.kdf={}).OpenSSL={execute:function(e,t,n,r){return r||(r=i.random(8)),e=c.create({keySize:t+n}).compute(e,r),n=i.create(e.words.slice(t),4*n),e.sigBytes=4*t,p.create({key:e,iv:n,salt:r})}},h=n.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:t}),encrypt:function(e,t,n,r){return r=this.cfg.extend(r),n=r.kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,e=m.encrypt.call(this,e,t,n.key,r),e.mixIn(n),e},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),n=r.kdf.execute(n,e.keySize,e.ivSize,t.salt),r.iv=n.iv,m.decrypt.call(this,e,t,n.key,r)}})}(),(function(){for(var e=a,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],o=[],s=[],c=[],l=[],u=[],d=[],f=[],p=[],m=[],h=0;256>h;h++)m[h]=128>h?h<<1:h<<1^283;for(var g=0,_=0,h=0;256>h;h++){var v=_^_<<1^_<<2^_<<3^_<<4,v=v>>>8^v&255^99;r[g]=v,i[v]=g;var y=m[g],b=m[y],x=m[b],S=257*m[v]^16843008*v;o[g]=S<<24|S>>>8,s[g]=S<<16|S>>>16,c[g]=S<<8|S>>>24,l[g]=S,S=16843009*x^65537*b^257*y^16843008*g,u[v]=S<<24|S>>>8,d[v]=S<<16|S>>>16,f[v]=S<<8|S>>>24,p[v]=S,g?(g=y^m[m[m[x^y]]],_^=m[m[_]]):g=_=1}var C=[0,1,2,4,8,16,32,64,128,27,54],n=n.AES=t.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes/4,e=4*((this._nRounds=n+6)+1),i=this._keySchedule=[],a=0;a<e;a++)if(a<n)i[a]=t[a];else{var o=i[a-1];a%n?6<n&&a%n==4&&(o=r[o>>>24]<<24|r[o>>>16&255]<<16|r[o>>>8&255]<<8|r[o&255]):(o=o<<8|o>>>24,o=r[o>>>24]<<24|r[o>>>16&255]<<16|r[o>>>8&255]<<8|r[o&255],o^=C[a/n|0]<<24),i[a]=i[a-n]^o}for(t=this._invKeySchedule=[],n=0;n<e;n++)a=e-n,o=n%4?i[a]:i[a-4],t[n]=4>n||4>=a?o:u[r[o>>>24]]^d[r[o>>>16&255]]^f[r[o>>>8&255]]^p[r[o&255]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,c,l,r)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,u,d,f,p,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,a,o,s){for(var c=this._nRounds,l=e[t]^n[0],u=e[t+1]^n[1],d=e[t+2]^n[2],f=e[t+3]^n[3],p=4,m=1;m<c;m++)var h=r[l>>>24]^i[u>>>16&255]^a[d>>>8&255]^o[f&255]^n[p++],g=r[u>>>24]^i[d>>>16&255]^a[f>>>8&255]^o[l&255]^n[p++],_=r[d>>>24]^i[f>>>16&255]^a[l>>>8&255]^o[u&255]^n[p++],f=r[f>>>24]^i[l>>>16&255]^a[u>>>8&255]^o[d&255]^n[p++],l=h,u=g,d=_;h=(s[l>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[f&255])^n[p++],g=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[f>>>8&255]<<8|s[l&255])^n[p++],_=(s[d>>>24]<<24|s[f>>>16&255]<<16|s[l>>>8&255]<<8|s[u&255])^n[p++],f=(s[f>>>24]<<24|s[l>>>16&255]<<16|s[u>>>8&255]<<8|s[d&255])^n[p++],e[t]=h,e[t+1]=g,e[t+2]=_,e[t+3]=f},keySize:8});e.AES=t._createHelper(n)})();var o,s=!0;function c(e,t,n){e!=null&&(typeof e==`number`?this.fromNumber(e,t,n):t==null&&typeof e!=`string`?this.fromString(e,256):this.fromString(e,t))}function l(){return new c(null)}function u(e,t,n,r,i,a){for(;--a>=0;){var o=t*this[e++]+n[r]+i;i=Math.floor(o/67108864),n[r++]=o&67108863}return i}function d(e,t,n,r,i,a){for(var o=t&32767,s=t>>15;--a>=0;){var c=this[e]&32767,l=this[e++]>>15,u=s*c+l*o;c=o*c+((u&32767)<<15)+n[r]+(i&1073741823),i=(c>>>30)+(u>>>15)+s*l+(i>>>30),n[r++]=c&1073741823}return i}function f(e,t,n,r,i,a){for(var o=t&16383,s=t>>14;--a>=0;){var c=this[e]&16383,l=this[e++]>>14,u=s*c+l*o;c=o*c+((u&16383)<<14)+n[r]+i,i=(c>>28)+(u>>14)+s*l,n[r++]=c&268435455}return i}s&&typeof navigator<`u`&&navigator.appName==`Microsoft Internet Explorer`?(c.prototype.am=d,o=30):s&&typeof navigator<`u`&&navigator.appName!=`Netscape`?(c.prototype.am=u,o=26):(c.prototype.am=f,o=28),c.prototype.DB=o,c.prototype.DM=(1<<o)-1,c.prototype.DV=1<<o;var p=52;c.prototype.FV=Math.pow(2,p),c.prototype.F1=p-o,c.prototype.F2=2*o-p;var m=`0123456789abcdefghijklmnopqrstuvwxyz`,h=[],g=48,_;for(_=0;_<=9;++_)h[g++]=_;for(g=97,_=10;_<36;++_)h[g++]=_;for(g=65,_=10;_<36;++_)h[g++]=_;function v(e){return m.charAt(e)}function y(e,t){var n=h[e.charCodeAt(t)];return n==null?-1:n}function b(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function x(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function S(e){var t=l();return t.fromInt(e),t}function C(e,t){var n;if(t==16)n=4;else if(t==8)n=3;else if(t==256)n=8;else if(t==2)n=1;else if(t==32)n=5;else if(t==4)n=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var r=e.length,i=!1,a=0;--r>=0;){var o=n==8?e[r]&255:y(e,r);if(o<0){e.charAt(r)==`-`&&(i=!0);continue}i=!1,a==0?this[this.t++]=o:a+n>this.DB?(this[this.t-1]|=(o&(1<<this.DB-a)-1)<<a,this[this.t++]=o>>this.DB-a):this[this.t-1]|=o<<a,a+=n,a>=this.DB&&(a-=this.DB)}n==8&&e[0]&128&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),i&&c.ZERO.subTo(this,this)}function w(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function T(e){if(this.s<0)return`-`+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var n=(1<<t)-1,r,i=!1,a=``,o=this.t,s=this.DB-o*this.DB%t;if(o-- >0)for(s<this.DB&&(r=this[o]>>s)>0&&(i=!0,a=v(r));o>=0;)s<t?(r=(this[o]&(1<<s)-1)<<t-s,r|=this[--o]>>(s+=this.DB-t)):(r=this[o]>>(s-=t)&n,s<=0&&(s+=this.DB,--o)),r>0&&(i=!0),i&&(a+=v(r));return i?a:`0`}function E(){var e=l();return c.ZERO.subTo(this,e),e}function D(){return this.s<0?this.negate():this}function O(e){var t=this.s-e.s;if(t!=0)return t;var n=this.t;if(t=n-e.t,t!=0)return this.s<0?-t:t;for(;--n>=0;)if((t=this[n]-e[n])!=0)return t;return 0}function k(e){var t=1,n;return(n=e>>>16)!=0&&(e=n,t+=16),(n=e>>8)!=0&&(e=n,t+=8),(n=e>>4)!=0&&(e=n,t+=4),(n=e>>2)!=0&&(e=n,t+=2),(n=e>>1)!=0&&(e=n,t+=1),t}function A(){return this.t<=0?0:this.DB*(this.t-1)+k(this[this.t-1]^this.s&this.DM)}function j(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function M(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s}function N(e,t){var n=e%this.DB,r=this.DB-n,i=(1<<r)-1,a=Math.floor(e/this.DB),o=this.s<<n&this.DM,s;for(s=this.t-1;s>=0;--s)t[s+a+1]=this[s]>>r|o,o=(this[s]&i)<<n;for(s=a-1;s>=0;--s)t[s]=0;t[a]=o,t.t=this.t+a+1,t.s=this.s,t.clamp()}function ee(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t){t.t=0;return}var r=e%this.DB,i=this.DB-r,a=(1<<r)-1;t[0]=this[n]>>r;for(var o=n+1;o<this.t;++o)t[o-n-1]|=(this[o]&a)<<i,t[o-n]=this[o]>>r;r>0&&(t[this.t-n-1]|=(this.s&a)<<i),t.t=this.t-n,t.clamp()}function te(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()}function ne(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i<r.t;++i)t[i+n.t]=n.am(0,r[i],t,i,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&c.ZERO.subTo(t,t)}function re(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function ie(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t<r.t){t!=null&&t.fromInt(0),n!=null&&this.copyTo(n);return}n==null&&(n=l());var a=l(),o=this.s,s=e.s,u=this.DB-k(r[r.t-1]);u>0?(r.lShiftTo(u,a),i.lShiftTo(u,n)):(r.copyTo(a),i.copyTo(n));var d=a.t,f=a[d-1];if(f!=0){var p=f*(1<<this.F1)+(d>1?a[d-2]>>this.F2:0),m=this.FV/p,h=(1<<this.F1)/p,g=1<<this.F2,_=n.t,v=_-d,y=t==null?l():t;for(a.dlShiftTo(v,y),n.compareTo(y)>=0&&(n[n.t++]=1,n.subTo(y,n)),c.ONE.dlShiftTo(d,y),y.subTo(a,a);a.t<d;)a[a.t++]=0;for(;--v>=0;){var b=n[--_]==f?this.DM:Math.floor(n[_]*m+(n[_-1]+g)*h);if((n[_]+=a.am(0,b,n,v,0,d))<b)for(a.dlShiftTo(v,y),n.subTo(y,n);n[_]<--b;)n.subTo(y,n)}t!=null&&(n.drShiftTo(d,t),o!=s&&c.ZERO.subTo(t,t)),n.t=d,n.clamp(),u>0&&n.rShiftTo(u,n),o<0&&c.ZERO.subTo(n,n)}}}function ae(e){var t=l();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(c.ZERO)>0&&e.subTo(t,t),t}function oe(e){this.m=e}function se(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function ce(e){return e}function le(e){e.divRemTo(this.m,null,e)}function P(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function ue(e,t){e.squareTo(t),this.reduce(t)}oe.prototype.convert=se,oe.prototype.revert=ce,oe.prototype.reduce=le,oe.prototype.mulTo=P,oe.prototype.sqrTo=ue;function de(){if(this.t<1)return 0;var e=this[0];if(!(e&1))return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function fe(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function pe(e){var t=l();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(c.ZERO)>0&&this.m.subTo(t,t),t}function me(e){var t=l();return e.copyTo(t),this.reduce(t),t}function he(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=e[t]&32767,r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function ge(e,t){e.squareTo(t),this.reduce(t)}function _e(e,t,n){e.multiplyTo(t,n),this.reduce(n)}fe.prototype.convert=pe,fe.prototype.revert=me,fe.prototype.reduce=he,fe.prototype.mulTo=_e,fe.prototype.sqrTo=ge;function ve(){return(this.t>0?this[0]&1:this.s)==0}function ye(e,t){if(e>4294967295||e<1)return c.ONE;var n=l(),r=l(),i=t.convert(this),a=k(e)-1;for(i.copyTo(n);--a>=0;)if(t.sqrTo(n,r),(e&1<<a)>0)t.mulTo(r,i,n);else{var o=n;n=r,r=o}return t.revert(n)}function be(e,t){var n=e<256||t.isEven()?new oe(t):new fe(t);return this.exp(e,n)}c.prototype.copyTo=b,c.prototype.fromInt=x,c.prototype.fromString=C,c.prototype.clamp=w,c.prototype.dlShiftTo=j,c.prototype.drShiftTo=M,c.prototype.lShiftTo=N,c.prototype.rShiftTo=ee,c.prototype.subTo=te,c.prototype.multiplyTo=ne,c.prototype.squareTo=re,c.prototype.divRemTo=ie,c.prototype.invDigit=de,c.prototype.isEven=ve,c.prototype.exp=ye,c.prototype.toString=T,c.prototype.negate=E,c.prototype.abs=D,c.prototype.compareTo=O,c.prototype.bitLength=A,c.prototype.mod=ae,c.prototype.modPowInt=be,c.ZERO=S(0),c.ONE=S(1);function xe(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else if(this.t==1)return this[0];else if(this.t==0)return 0;return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function Se(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function Ce(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function we(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return`0`;var t=this.chunkSize(e),n=Math.pow(e,t),r=S(n),i=l(),a=l(),o=``;for(this.divRemTo(r,i,a);i.signum()>0;)o=(n+a.intValue()).toString(e).substr(1)+o,i.divRemTo(r,i,a);return a.intValue().toString(e)+o}c.prototype.chunkSize=Se,c.prototype.toRadix=we,c.prototype.intValue=xe,c.prototype.signum=Ce;var Te=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ee=`=`;function De(e){var t,n,r=``;for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=Te.charAt(n>>6)+Te.charAt(n&63);if(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=Te.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=Te.charAt(n>>2)+Te.charAt((n&3)<<4)),Ee)for(;(r.length&3)>0;)r+=Ee;return r}function Oe(e){var t=``,n,r=0,i,a;for(n=0;n<e.length&&e.charAt(n)!=Ee;++n)a=Te.indexOf(e.charAt(n)),!(a<0)&&(r==0?(t+=v(a>>2),i=a&3,r=1):r==1?(t+=v(i<<2|a>>4),i=a&15,r=2):r==2?(t+=v(i),t+=v(a>>2),i=a&3,r=3):(t+=v(i<<2|a>>4),t+=v(a&15),r=0));return r==1&&(t+=v(i<<2)),t}function F(e,t){return new c(e,t)}function ke(e,t){if(t<e.length+11)throw`Message too long for RSA`;for(var n=[],r=e.length-1;r>=0&&t>0;){var i=e.charCodeAt(r--);i<128?n[--t]=i:i>127&&i<2048?(n[--t]=i&63|128,n[--t]=i>>6|192):(n[--t]=i&63|128,n[--t]=i>>6&63|128,n[--t]=i>>12|224)}n[--t]=0;for(var a=new SecureRandom,o=[];t>2;){for(o[0]=0;o[0]==0;)a.nextBytes(o);n[--t]=o[0]}return n[--t]=2,n[--t]=0,new c(n)}function Ae(e,t,n){for(var r=``,i=0;r.length<t;)r+=n(String.fromCharCode.apply(String,e.concat([(i&4278190080)>>24,(i&16711680)>>16,(i&65280)>>8,i&255]))),i+=1;return r}function je(e,t,n,r){var a=i.crypto.MessageDigest,o=i.crypto.Util,s=null;if(n||(n=`sha1`),typeof n==`string`&&(s=a.getCanonicalAlgName(n),r=a.getHashLength(s),n=function(e){return qe(o.hashHex(Je(e),s))}),e.length+2*r+2>t)throw`Message too long for RSA`;var l=``,u;for(u=0;u<t-e.length-2*r-2;u+=1)l+=`\0`;var d=n(``)+l+``+e,f=Array(r);new SecureRandom().nextBytes(f);var p=Ae(f,d.length,n),m=[];for(u=0;u<d.length;u+=1)m[u]=d.charCodeAt(u)^p.charCodeAt(u);var h=Ae(m,f.length,n),g=[0];for(u=0;u<f.length;u+=1)g[u+1]=f[u]^h.charCodeAt(u);return new c(g.concat(m))}function I(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function Me(e,t){if(this.isPublic=!0,this.isPrivate=!1,typeof e!=`string`)this.n=e,this.e=t;else if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=F(e,16),this.e=parseInt(t,16);else throw`Invalid RSA public key`}function Ne(e){return e.modPowInt(this.e,this.n)}function Pe(e){var t=ke(e,this.n.bitLength()+7>>3);if(t==null)return null;var n=this.doPublic(t);if(n==null)return null;var r=n.toString(16);return r.length&1?`0`+r:r}function Fe(e,t,n){var r=je(e,this.n.bitLength()+7>>3,t,n);if(r==null)return null;var i=this.doPublic(r);if(i==null)return null;var a=i.toString(16);return a.length&1?`0`+a:a}I.prototype.doPublic=Ne,I.prototype.setPublic=Me,I.prototype.encrypt=Pe,I.prototype.encryptOAEP=Fe,I.prototype.type=`RSA`;function Ie(e,t){for(var n=e.toByteArray(),r=0;r<n.length&&n[r]==0;)++r;if(n.length-r!=t-1||n[r]!=2)return null;for(++r;n[r]!=0;)if(++r>=n.length)return null;for(var i=``;++r<n.length;){var a=n[r]&255;a<128?i+=String.fromCharCode(a):a>191&&a<224?(i+=String.fromCharCode((a&31)<<6|n[r+1]&63),++r):(i+=String.fromCharCode((a&15)<<12|(n[r+1]&63)<<6|n[r+2]&63),r+=2)}return i}function Le(e,t,n){for(var r=``,i=0;r.length<t;)r+=n(e+String.fromCharCode.apply(String,[(i&4278190080)>>24,(i&16711680)>>16,(i&65280)>>8,i&255])),i+=1;return r}function Re(e,t,n,r){var a=i.crypto.MessageDigest,o=i.crypto.Util,s=null;n||(n=`sha1`),typeof n==`string`&&(s=a.getCanonicalAlgName(n),r=a.getHashLength(s),n=function(e){return qe(o.hashHex(Je(e),s))}),e=e.toByteArray();var c;for(c=0;c<e.length;c+=1)e[c]&=255;for(;e.length<t;)e.unshift(0);if(e=String.fromCharCode.apply(String,e),e.length<2*r+2)throw`Cipher too short`;var l=e.substr(1,r),u=e.substr(r+1),d=Le(u,r,n),f=[],c;for(c=0;c<l.length;c+=1)f[c]=l.charCodeAt(c)^d.charCodeAt(c);var p=Le(String.fromCharCode.apply(String,f),e.length-r,n),m=[];for(c=0;c<u.length;c+=1)m[c]=u.charCodeAt(c)^p.charCodeAt(c);if(m=String.fromCharCode.apply(String,m),m.substr(0,r)!==n(``))throw`Hash mismatch`;m=m.substr(r);var h=m.indexOf(``);if((h==-1?-1:m.substr(0,h).lastIndexOf(`\0`))+1!=h)throw`Malformed data`;return m.substr(h+1)}function ze(e,t,n){if(this.isPrivate=!0,typeof e!=`string`)this.n=e,this.e=t,this.d=n;else if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=F(e,16),this.e=parseInt(t,16),this.d=F(n,16);else throw`Invalid RSA private key`}function Be(e,t,n,r,i,a,o,s){if(this.isPrivate=!0,this.isPublic=!1,e==null)throw`RSASetPrivateEx N == null`;if(t==null)throw`RSASetPrivateEx E == null`;if(e.length==0)throw`RSASetPrivateEx N.length == 0`;if(t.length==0)throw`RSASetPrivateEx E.length == 0`;if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=F(e,16),this.e=parseInt(t,16),this.d=F(n,16),this.p=F(r,16),this.q=F(i,16),this.dmp1=F(a,16),this.dmq1=F(o,16),this.coeff=F(s,16);else throw`Invalid RSA private key in RSASetPrivateEx`}function Ve(e){if(this.p==null||this.q==null)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)}function He(e){if(e.length!=Math.ceil(this.n.bitLength()/4))throw Error(`wrong ctext length`);var t=F(e,16),n=this.doPrivate(t);return n==null?null:Ie(n,this.n.bitLength()+7>>3)}function Ue(e,t,n){if(e.length!=Math.ceil(this.n.bitLength()/4))throw Error(`wrong ctext length`);var r=F(e,16),i=this.doPrivate(r);return i==null?null:Re(i,this.n.bitLength()+7>>3,t,n)}I.prototype.doPrivate=Ve,I.prototype.setPrivate=ze,I.prototype.setPrivateEx=Be,I.prototype.decrypt=He,I.prototype.decryptOAEP=Ue,(i.lang===void 0||!i.lang)&&(i.lang={}),i.lang.String=function(){};function We(e){return e.length%4==2?e+=`==`:e.length%4==3&&(e+=`=`),e=e.replace(/-/g,`+`),e=e.replace(/_/g,`/`),e}function Ge(e){return Oe(We(e))}function Ke(e){return decodeURIComponent(et(e))}function qe(e){for(var t=``,n=0;n<e.length-1;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return t}function Je(e){for(var t=``,n=0;n<e.length;n++)t+=(`0`+e.charCodeAt(n).toString(16)).slice(-2);return t}function Ye(e){return De(e)}function Xe(e){var t=Ye(e).replace(/(.{64})/g,`$1\r
|
|
255
|
+
*/Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../pbmGaussianSplattingObject-BDOzNal0.cjs`);let t=require(`three`);t=e.r(t,1);let n=require(`protobufjs/minimal`);n=e.r(n,1);var r=Number(t.REVISION);if(r<115||r>117)throw Error(`"Five" needs "THREE.js" version between 125 - 117.`);var i={},a=a||function(e,t){var n={},r=n.lib={},i=r.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var n=new e;return t&&n.mixIn(t),n.hasOwnProperty(`init`)||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty(`toString`)&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),a=r.WordArray=i.extend({init:function(e,n){e=this.words=e||[],n==t?this.sigBytes=e.length*4:this.sigBytes=n},toString:function(e){return(e||s).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var a=0;a<i;a++){var o=n[a>>>2]>>>24-a%4*8&255;t[r+a>>>2]|=o<<24-(r+a)%4*8}else for(var a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r<t;r+=4)n.push(e.random()*4294967296|0);return new a.init(n,t)}}),o=n.enc={},s=o.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push((a>>>4).toString(16)),r.push((a&15).toString(16))}return r.join(``)},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new a.init(n,t/2)}},c=o.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(a))}return r.join(``)},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(e.charCodeAt(r)&255)<<24-r%4*8;return new a.init(n,t)}},l=o.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error(`Malformed UTF-8 data`)}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},u=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(e){typeof e==`string`&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,i=n.sigBytes,o=this.blockSize,s=i/(o*4);s=t?e.ceil(s):e.max((s|0)-this._minBufferSize,0);var c=s*o,l=e.min(c*4,i);if(c){for(var u=0;u<c;u+=o)this._doProcessBlock(r,u);var d=r.splice(0,c);n.sigBytes-=l}return new a.init(d,l)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});r.Hasher=u.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){u.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:512/32,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new d.HMAC.init(e,n).finalize(t)}}});var d=n.algo={};return n}(Math);(function(e){for(var t=a,n=t.lib,r=n.WordArray,i=n.Hasher,n=t.algo,o=[],s=[],c=function(e){return 4294967296*(e-(e|0))|0},l=2,u=0;64>u;){var d;a:{d=l;for(var f=e.sqrt(d),p=2;p<=f;p++)if(!(d%p)){d=!1;break a}d=!0}d&&(8>u&&(o[u]=c(e.pow(l,.5))),s[u]=c(e.pow(l,1/3)),u++),l++}var m=[],n=n.SHA256=i.extend({_doReset:function(){this._hash=new r.init(o.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],a=n[2],o=n[3],c=n[4],l=n[5],u=n[6],d=n[7],f=0;64>f;f++){if(16>f)m[f]=e[t+f]|0;else{var p=m[f-15],h=m[f-2];m[f]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+m[f-7]+((h<<15|h>>>17)^(h<<13|h>>>19)^h>>>10)+m[f-16]}p=d+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&l^~c&u)+s[f]+m[f],h=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&a^i&a),d=u,u=l,l=c,c=o+p|0,o=a,a=i,i=r,r=p+h|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+o|0,n[4]=n[4]+c|0,n[5]=n[5]+l|0,n[6]=n[6]+u|0,n[7]=n[7]+d|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[(i+64>>>9<<4)+14]=e.floor(r/4294967296),n[(i+64>>>9<<4)+15]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(n),t.HmacSHA256=i._createHmacHelper(n)})(Math),a.lib.Cipher||function(e){var t=a,n=t.lib,r=n.Base,i=n.WordArray,o=n.BufferedBlockAlgorithm,s=t.enc.Base64,c=t.algo.EvpKDF,l=n.Cipher=o.extend({cfg:r.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,n,r){return(typeof n==`string`?h:m).encrypt(e,t,n,r)},decrypt:function(t,n,r){return(typeof n==`string`?h:m).decrypt(e,t,n,r)}}}});n.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=t.mode={},d=function(t,n,r){var i=this._iv;i?this._iv=e:i=this._prevBlock;for(var a=0;a<r;a++)t[n+a]^=i[a]},f=(n.BlockCipherMode=r.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();f.Encryptor=f.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize;d.call(this,e,t,r),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}}),f.Decryptor=f.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,i=e.slice(t,t+r);n.decryptBlock(e,t),d.call(this,e,t,r),this._prevBlock=i}}),u=u.CBC=f,f=(t.pad={}).Pkcs7={pad:function(e,t){for(var n=4*t,n=n-e.sigBytes%n,r=n<<24|n<<16|n<<8|n,a=[],o=0;o<n;o+=4)a.push(r);n=i.create(a,n),e.concat(n)},unpad:function(e){e.sigBytes-=e.words[e.sigBytes-1>>>2]&255}},n.BlockCipher=l.extend({cfg:l.cfg.extend({mode:u,padding:f}),reset:function(){l.reset.call(this);var e=this.cfg,t=e.iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=e.createEncryptor;else n=e.createDecryptor,this._minBufferSize=1;this._mode=n.call(e,this,t&&t.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var p=n.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),u=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return e=e.salt,(e?i.create([1398893684,1701076831]).concat(e).concat(t):t).toString(s)},parse:function(e){e=s.parse(e);var t=e.words;if(t[0]==1398893684&&t[1]==1701076831){var n=i.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return p.create({ciphertext:e,salt:n})}},m=n.SerializableCipher=r.extend({cfg:r.extend({format:u}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r);return t=i.finalize(t),i=i.cfg,p.create({ciphertext:t,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return typeof e==`string`?t.parse(e,this):e}}),t=(t.kdf={}).OpenSSL={execute:function(e,t,n,r){return r||(r=i.random(8)),e=c.create({keySize:t+n}).compute(e,r),n=i.create(e.words.slice(t),4*n),e.sigBytes=4*t,p.create({key:e,iv:n,salt:r})}},h=n.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:t}),encrypt:function(e,t,n,r){return r=this.cfg.extend(r),n=r.kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,e=m.encrypt.call(this,e,t,n.key,r),e.mixIn(n),e},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),n=r.kdf.execute(n,e.keySize,e.ivSize,t.salt),r.iv=n.iv,m.decrypt.call(this,e,t,n.key,r)}})}(),(function(){for(var e=a,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],o=[],s=[],c=[],l=[],u=[],d=[],f=[],p=[],m=[],h=0;256>h;h++)m[h]=128>h?h<<1:h<<1^283;for(var g=0,_=0,h=0;256>h;h++){var v=_^_<<1^_<<2^_<<3^_<<4,v=v>>>8^v&255^99;r[g]=v,i[v]=g;var y=m[g],b=m[y],x=m[b],S=257*m[v]^16843008*v;o[g]=S<<24|S>>>8,s[g]=S<<16|S>>>16,c[g]=S<<8|S>>>24,l[g]=S,S=16843009*x^65537*b^257*y^16843008*g,u[v]=S<<24|S>>>8,d[v]=S<<16|S>>>16,f[v]=S<<8|S>>>24,p[v]=S,g?(g=y^m[m[m[x^y]]],_^=m[m[_]]):g=_=1}var C=[0,1,2,4,8,16,32,64,128,27,54],n=n.AES=t.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes/4,e=4*((this._nRounds=n+6)+1),i=this._keySchedule=[],a=0;a<e;a++)if(a<n)i[a]=t[a];else{var o=i[a-1];a%n?6<n&&a%n==4&&(o=r[o>>>24]<<24|r[o>>>16&255]<<16|r[o>>>8&255]<<8|r[o&255]):(o=o<<8|o>>>24,o=r[o>>>24]<<24|r[o>>>16&255]<<16|r[o>>>8&255]<<8|r[o&255],o^=C[a/n|0]<<24),i[a]=i[a-n]^o}for(t=this._invKeySchedule=[],n=0;n<e;n++)a=e-n,o=n%4?i[a]:i[a-4],t[n]=4>n||4>=a?o:u[r[o>>>24]]^d[r[o>>>16&255]]^f[r[o>>>8&255]]^p[r[o&255]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,c,l,r)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,u,d,f,p,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,a,o,s){for(var c=this._nRounds,l=e[t]^n[0],u=e[t+1]^n[1],d=e[t+2]^n[2],f=e[t+3]^n[3],p=4,m=1;m<c;m++)var h=r[l>>>24]^i[u>>>16&255]^a[d>>>8&255]^o[f&255]^n[p++],g=r[u>>>24]^i[d>>>16&255]^a[f>>>8&255]^o[l&255]^n[p++],_=r[d>>>24]^i[f>>>16&255]^a[l>>>8&255]^o[u&255]^n[p++],f=r[f>>>24]^i[l>>>16&255]^a[u>>>8&255]^o[d&255]^n[p++],l=h,u=g,d=_;h=(s[l>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[f&255])^n[p++],g=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[f>>>8&255]<<8|s[l&255])^n[p++],_=(s[d>>>24]<<24|s[f>>>16&255]<<16|s[l>>>8&255]<<8|s[u&255])^n[p++],f=(s[f>>>24]<<24|s[l>>>16&255]<<16|s[u>>>8&255]<<8|s[d&255])^n[p++],e[t]=h,e[t+1]=g,e[t+2]=_,e[t+3]=f},keySize:8});e.AES=t._createHelper(n)})();var o,s=!0;function c(e,t,n){e!=null&&(typeof e==`number`?this.fromNumber(e,t,n):t==null&&typeof e!=`string`?this.fromString(e,256):this.fromString(e,t))}function l(){return new c(null)}function u(e,t,n,r,i,a){for(;--a>=0;){var o=t*this[e++]+n[r]+i;i=Math.floor(o/67108864),n[r++]=o&67108863}return i}function d(e,t,n,r,i,a){for(var o=t&32767,s=t>>15;--a>=0;){var c=this[e]&32767,l=this[e++]>>15,u=s*c+l*o;c=o*c+((u&32767)<<15)+n[r]+(i&1073741823),i=(c>>>30)+(u>>>15)+s*l+(i>>>30),n[r++]=c&1073741823}return i}function f(e,t,n,r,i,a){for(var o=t&16383,s=t>>14;--a>=0;){var c=this[e]&16383,l=this[e++]>>14,u=s*c+l*o;c=o*c+((u&16383)<<14)+n[r]+i,i=(c>>28)+(u>>14)+s*l,n[r++]=c&268435455}return i}s&&typeof navigator<`u`&&navigator.appName==`Microsoft Internet Explorer`?(c.prototype.am=d,o=30):s&&typeof navigator<`u`&&navigator.appName!=`Netscape`?(c.prototype.am=u,o=26):(c.prototype.am=f,o=28),c.prototype.DB=o,c.prototype.DM=(1<<o)-1,c.prototype.DV=1<<o;var p=52;c.prototype.FV=Math.pow(2,p),c.prototype.F1=p-o,c.prototype.F2=2*o-p;var m=`0123456789abcdefghijklmnopqrstuvwxyz`,h=[],g=48,_;for(_=0;_<=9;++_)h[g++]=_;for(g=97,_=10;_<36;++_)h[g++]=_;for(g=65,_=10;_<36;++_)h[g++]=_;function v(e){return m.charAt(e)}function y(e,t){var n=h[e.charCodeAt(t)];return n==null?-1:n}function b(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function x(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function S(e){var t=l();return t.fromInt(e),t}function C(e,t){var n;if(t==16)n=4;else if(t==8)n=3;else if(t==256)n=8;else if(t==2)n=1;else if(t==32)n=5;else if(t==4)n=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var r=e.length,i=!1,a=0;--r>=0;){var o=n==8?e[r]&255:y(e,r);if(o<0){e.charAt(r)==`-`&&(i=!0);continue}i=!1,a==0?this[this.t++]=o:a+n>this.DB?(this[this.t-1]|=(o&(1<<this.DB-a)-1)<<a,this[this.t++]=o>>this.DB-a):this[this.t-1]|=o<<a,a+=n,a>=this.DB&&(a-=this.DB)}n==8&&e[0]&128&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),i&&c.ZERO.subTo(this,this)}function w(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function T(e){if(this.s<0)return`-`+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var n=(1<<t)-1,r,i=!1,a=``,o=this.t,s=this.DB-o*this.DB%t;if(o-- >0)for(s<this.DB&&(r=this[o]>>s)>0&&(i=!0,a=v(r));o>=0;)s<t?(r=(this[o]&(1<<s)-1)<<t-s,r|=this[--o]>>(s+=this.DB-t)):(r=this[o]>>(s-=t)&n,s<=0&&(s+=this.DB,--o)),r>0&&(i=!0),i&&(a+=v(r));return i?a:`0`}function E(){var e=l();return c.ZERO.subTo(this,e),e}function D(){return this.s<0?this.negate():this}function O(e){var t=this.s-e.s;if(t!=0)return t;var n=this.t;if(t=n-e.t,t!=0)return this.s<0?-t:t;for(;--n>=0;)if((t=this[n]-e[n])!=0)return t;return 0}function k(e){var t=1,n;return(n=e>>>16)!=0&&(e=n,t+=16),(n=e>>8)!=0&&(e=n,t+=8),(n=e>>4)!=0&&(e=n,t+=4),(n=e>>2)!=0&&(e=n,t+=2),(n=e>>1)!=0&&(e=n,t+=1),t}function A(){return this.t<=0?0:this.DB*(this.t-1)+k(this[this.t-1]^this.s&this.DM)}function j(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function M(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s}function N(e,t){var n=e%this.DB,r=this.DB-n,i=(1<<r)-1,a=Math.floor(e/this.DB),o=this.s<<n&this.DM,s;for(s=this.t-1;s>=0;--s)t[s+a+1]=this[s]>>r|o,o=(this[s]&i)<<n;for(s=a-1;s>=0;--s)t[s]=0;t[a]=o,t.t=this.t+a+1,t.s=this.s,t.clamp()}function ee(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t){t.t=0;return}var r=e%this.DB,i=this.DB-r,a=(1<<r)-1;t[0]=this[n]>>r;for(var o=n+1;o<this.t;++o)t[o-n-1]|=(this[o]&a)<<i,t[o-n]=this[o]>>r;r>0&&(t[this.t-n-1]|=(this.s&a)<<i),t.t=this.t-n,t.clamp()}function te(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()}function ne(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i<r.t;++i)t[i+n.t]=n.am(0,r[i],t,i,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&c.ZERO.subTo(t,t)}function re(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function ie(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t<r.t){t!=null&&t.fromInt(0),n!=null&&this.copyTo(n);return}n==null&&(n=l());var a=l(),o=this.s,s=e.s,u=this.DB-k(r[r.t-1]);u>0?(r.lShiftTo(u,a),i.lShiftTo(u,n)):(r.copyTo(a),i.copyTo(n));var d=a.t,f=a[d-1];if(f!=0){var p=f*(1<<this.F1)+(d>1?a[d-2]>>this.F2:0),m=this.FV/p,h=(1<<this.F1)/p,g=1<<this.F2,_=n.t,v=_-d,y=t==null?l():t;for(a.dlShiftTo(v,y),n.compareTo(y)>=0&&(n[n.t++]=1,n.subTo(y,n)),c.ONE.dlShiftTo(d,y),y.subTo(a,a);a.t<d;)a[a.t++]=0;for(;--v>=0;){var b=n[--_]==f?this.DM:Math.floor(n[_]*m+(n[_-1]+g)*h);if((n[_]+=a.am(0,b,n,v,0,d))<b)for(a.dlShiftTo(v,y),n.subTo(y,n);n[_]<--b;)n.subTo(y,n)}t!=null&&(n.drShiftTo(d,t),o!=s&&c.ZERO.subTo(t,t)),n.t=d,n.clamp(),u>0&&n.rShiftTo(u,n),o<0&&c.ZERO.subTo(n,n)}}}function ae(e){var t=l();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(c.ZERO)>0&&e.subTo(t,t),t}function oe(e){this.m=e}function se(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function ce(e){return e}function le(e){e.divRemTo(this.m,null,e)}function P(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function ue(e,t){e.squareTo(t),this.reduce(t)}oe.prototype.convert=se,oe.prototype.revert=ce,oe.prototype.reduce=le,oe.prototype.mulTo=P,oe.prototype.sqrTo=ue;function de(){if(this.t<1)return 0;var e=this[0];if(!(e&1))return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function fe(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function pe(e){var t=l();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(c.ZERO)>0&&this.m.subTo(t,t),t}function me(e){var t=l();return e.copyTo(t),this.reduce(t),t}function he(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=e[t]&32767,r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function ge(e,t){e.squareTo(t),this.reduce(t)}function _e(e,t,n){e.multiplyTo(t,n),this.reduce(n)}fe.prototype.convert=pe,fe.prototype.revert=me,fe.prototype.reduce=he,fe.prototype.mulTo=_e,fe.prototype.sqrTo=ge;function ve(){return(this.t>0?this[0]&1:this.s)==0}function ye(e,t){if(e>4294967295||e<1)return c.ONE;var n=l(),r=l(),i=t.convert(this),a=k(e)-1;for(i.copyTo(n);--a>=0;)if(t.sqrTo(n,r),(e&1<<a)>0)t.mulTo(r,i,n);else{var o=n;n=r,r=o}return t.revert(n)}function be(e,t){var n=e<256||t.isEven()?new oe(t):new fe(t);return this.exp(e,n)}c.prototype.copyTo=b,c.prototype.fromInt=x,c.prototype.fromString=C,c.prototype.clamp=w,c.prototype.dlShiftTo=j,c.prototype.drShiftTo=M,c.prototype.lShiftTo=N,c.prototype.rShiftTo=ee,c.prototype.subTo=te,c.prototype.multiplyTo=ne,c.prototype.squareTo=re,c.prototype.divRemTo=ie,c.prototype.invDigit=de,c.prototype.isEven=ve,c.prototype.exp=ye,c.prototype.toString=T,c.prototype.negate=E,c.prototype.abs=D,c.prototype.compareTo=O,c.prototype.bitLength=A,c.prototype.mod=ae,c.prototype.modPowInt=be,c.ZERO=S(0),c.ONE=S(1);function xe(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else if(this.t==1)return this[0];else if(this.t==0)return 0;return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function Se(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function Ce(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function we(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return`0`;var t=this.chunkSize(e),n=Math.pow(e,t),r=S(n),i=l(),a=l(),o=``;for(this.divRemTo(r,i,a);i.signum()>0;)o=(n+a.intValue()).toString(e).substr(1)+o,i.divRemTo(r,i,a);return a.intValue().toString(e)+o}c.prototype.chunkSize=Se,c.prototype.toRadix=we,c.prototype.intValue=xe,c.prototype.signum=Ce;var Te=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ee=`=`;function De(e){var t,n,r=``;for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=Te.charAt(n>>6)+Te.charAt(n&63);if(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=Te.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=Te.charAt(n>>2)+Te.charAt((n&3)<<4)),Ee)for(;(r.length&3)>0;)r+=Ee;return r}function Oe(e){var t=``,n,r=0,i,a;for(n=0;n<e.length&&e.charAt(n)!=Ee;++n)a=Te.indexOf(e.charAt(n)),!(a<0)&&(r==0?(t+=v(a>>2),i=a&3,r=1):r==1?(t+=v(i<<2|a>>4),i=a&15,r=2):r==2?(t+=v(i),t+=v(a>>2),i=a&3,r=3):(t+=v(i<<2|a>>4),t+=v(a&15),r=0));return r==1&&(t+=v(i<<2)),t}function F(e,t){return new c(e,t)}function ke(e,t){if(t<e.length+11)throw`Message too long for RSA`;for(var n=[],r=e.length-1;r>=0&&t>0;){var i=e.charCodeAt(r--);i<128?n[--t]=i:i>127&&i<2048?(n[--t]=i&63|128,n[--t]=i>>6|192):(n[--t]=i&63|128,n[--t]=i>>6&63|128,n[--t]=i>>12|224)}n[--t]=0;for(var a=new SecureRandom,o=[];t>2;){for(o[0]=0;o[0]==0;)a.nextBytes(o);n[--t]=o[0]}return n[--t]=2,n[--t]=0,new c(n)}function Ae(e,t,n){for(var r=``,i=0;r.length<t;)r+=n(String.fromCharCode.apply(String,e.concat([(i&4278190080)>>24,(i&16711680)>>16,(i&65280)>>8,i&255]))),i+=1;return r}function je(e,t,n,r){var a=i.crypto.MessageDigest,o=i.crypto.Util,s=null;if(n||(n=`sha1`),typeof n==`string`&&(s=a.getCanonicalAlgName(n),r=a.getHashLength(s),n=function(e){return qe(o.hashHex(Je(e),s))}),e.length+2*r+2>t)throw`Message too long for RSA`;var l=``,u;for(u=0;u<t-e.length-2*r-2;u+=1)l+=`\0`;var d=n(``)+l+``+e,f=Array(r);new SecureRandom().nextBytes(f);var p=Ae(f,d.length,n),m=[];for(u=0;u<d.length;u+=1)m[u]=d.charCodeAt(u)^p.charCodeAt(u);var h=Ae(m,f.length,n),g=[0];for(u=0;u<f.length;u+=1)g[u+1]=f[u]^h.charCodeAt(u);return new c(g.concat(m))}function I(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function Me(e,t){if(this.isPublic=!0,this.isPrivate=!1,typeof e!=`string`)this.n=e,this.e=t;else if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=F(e,16),this.e=parseInt(t,16);else throw`Invalid RSA public key`}function Ne(e){return e.modPowInt(this.e,this.n)}function Pe(e){var t=ke(e,this.n.bitLength()+7>>3);if(t==null)return null;var n=this.doPublic(t);if(n==null)return null;var r=n.toString(16);return r.length&1?`0`+r:r}function Fe(e,t,n){var r=je(e,this.n.bitLength()+7>>3,t,n);if(r==null)return null;var i=this.doPublic(r);if(i==null)return null;var a=i.toString(16);return a.length&1?`0`+a:a}I.prototype.doPublic=Ne,I.prototype.setPublic=Me,I.prototype.encrypt=Pe,I.prototype.encryptOAEP=Fe,I.prototype.type=`RSA`;function Ie(e,t){for(var n=e.toByteArray(),r=0;r<n.length&&n[r]==0;)++r;if(n.length-r!=t-1||n[r]!=2)return null;for(++r;n[r]!=0;)if(++r>=n.length)return null;for(var i=``;++r<n.length;){var a=n[r]&255;a<128?i+=String.fromCharCode(a):a>191&&a<224?(i+=String.fromCharCode((a&31)<<6|n[r+1]&63),++r):(i+=String.fromCharCode((a&15)<<12|(n[r+1]&63)<<6|n[r+2]&63),r+=2)}return i}function Le(e,t,n){for(var r=``,i=0;r.length<t;)r+=n(e+String.fromCharCode.apply(String,[(i&4278190080)>>24,(i&16711680)>>16,(i&65280)>>8,i&255])),i+=1;return r}function Re(e,t,n,r){var a=i.crypto.MessageDigest,o=i.crypto.Util,s=null;n||(n=`sha1`),typeof n==`string`&&(s=a.getCanonicalAlgName(n),r=a.getHashLength(s),n=function(e){return qe(o.hashHex(Je(e),s))}),e=e.toByteArray();var c;for(c=0;c<e.length;c+=1)e[c]&=255;for(;e.length<t;)e.unshift(0);if(e=String.fromCharCode.apply(String,e),e.length<2*r+2)throw`Cipher too short`;var l=e.substr(1,r),u=e.substr(r+1),d=Le(u,r,n),f=[],c;for(c=0;c<l.length;c+=1)f[c]=l.charCodeAt(c)^d.charCodeAt(c);var p=Le(String.fromCharCode.apply(String,f),e.length-r,n),m=[];for(c=0;c<u.length;c+=1)m[c]=u.charCodeAt(c)^p.charCodeAt(c);if(m=String.fromCharCode.apply(String,m),m.substr(0,r)!==n(``))throw`Hash mismatch`;m=m.substr(r);var h=m.indexOf(``);if((h==-1?-1:m.substr(0,h).lastIndexOf(`\0`))+1!=h)throw`Malformed data`;return m.substr(h+1)}function ze(e,t,n){if(this.isPrivate=!0,typeof e!=`string`)this.n=e,this.e=t,this.d=n;else if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=F(e,16),this.e=parseInt(t,16),this.d=F(n,16);else throw`Invalid RSA private key`}function Be(e,t,n,r,i,a,o,s){if(this.isPrivate=!0,this.isPublic=!1,e==null)throw`RSASetPrivateEx N == null`;if(t==null)throw`RSASetPrivateEx E == null`;if(e.length==0)throw`RSASetPrivateEx N.length == 0`;if(t.length==0)throw`RSASetPrivateEx E.length == 0`;if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=F(e,16),this.e=parseInt(t,16),this.d=F(n,16),this.p=F(r,16),this.q=F(i,16),this.dmp1=F(a,16),this.dmq1=F(o,16),this.coeff=F(s,16);else throw`Invalid RSA private key in RSASetPrivateEx`}function Ve(e){if(this.p==null||this.q==null)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(n)<0;)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)}function He(e){if(e.length!=Math.ceil(this.n.bitLength()/4))throw Error(`wrong ctext length`);var t=F(e,16),n=this.doPrivate(t);return n==null?null:Ie(n,this.n.bitLength()+7>>3)}function Ue(e,t,n){if(e.length!=Math.ceil(this.n.bitLength()/4))throw Error(`wrong ctext length`);var r=F(e,16),i=this.doPrivate(r);return i==null?null:Re(i,this.n.bitLength()+7>>3,t,n)}I.prototype.doPrivate=Ve,I.prototype.setPrivate=ze,I.prototype.setPrivateEx=Be,I.prototype.decrypt=He,I.prototype.decryptOAEP=Ue,(i.lang===void 0||!i.lang)&&(i.lang={}),i.lang.String=function(){};function We(e){return e.length%4==2?e+=`==`:e.length%4==3&&(e+=`=`),e=e.replace(/-/g,`+`),e=e.replace(/_/g,`/`),e}function Ge(e){return Oe(We(e))}function Ke(e){return decodeURIComponent(et(e))}function qe(e){for(var t=``,n=0;n<e.length-1;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return t}function Je(e){for(var t=``,n=0;n<e.length;n++)t+=(`0`+e.charCodeAt(n).toString(16)).slice(-2);return t}function Ye(e){return De(e)}function Xe(e){var t=Ye(e).replace(/(.{64})/g,`$1\r
|
|
256
256
|
`);return t=t.replace(/\r\n$/,``),t}function Ze(e){return Oe(e.replace(/[^0-9A-Za-z\/+=]*/g,``))}function Qe(e,t){var n=Xe(e);return`-----BEGIN `+t+`-----\r
|
|
257
257
|
`+n+`\r
|
|
258
258
|
-----END `+t+`-----\r
|
|
@@ -858,7 +858,7 @@ j \x006\0 \0\rA\b \vA~ wq6\0\f\v@ (F@ \x006\f\v \x006\v \
|
|
|
858
858
|
Aj$\0 \0\v}\vA\0!\0@ \0 FE@ \0A\fl"Aj"j*\0!\f A\bj"j*\0!\v \bj j*\0"\r8\0 \b j \v8\0 \b j \f8\0 \0At"j j"#*\x008\0 \0At"Ar"$At" j j" *\x008\0 Ar"%At"!j !j"!*\x008\0 Ar"&At""j "j""*\x008\0
|
|
859
859
|
j j"'*\x008\0
|
|
860
860
|
j j"*\x008\0
|
|
861
|
-
j j*\0"8\0 \x07 \0Atj" \v8\b \f8 \r8\0 j-\0\0 $j-\0\0A\btr %j-\0\0Atr &j-\0\0Atr6\f *\0! '*\0! "*\0"\f \f !*\0"\v \v #*\0" *\0"\r \r"C\0\0\0\0^@ \f "!\f \r !\r ! \v !\v\v \r \f" \v "" " C\0\0? \v \v" \f \f"" " \r \v" \f "" " C\0\0@ \v \f"\x1B \r ""\f \f"\f "\v \v"\v C\0\0? \r \r" "\r \r"\r C\0\0@6 C\0\0? " " " " \x1B " "C\0\0@ \f \f \v \v \r \rC\0\0@6 A\x006 \f \v \r C\0\0@ C\0\0@6 \0Aj!\0\f\v\v\v\0\v\v \0A\b\v`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:ee}}function b(){function e(e,t){return ne=e.exports,N(ne),d(),ne}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h!=null||(h=g()),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch(e){}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==`function`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._pack=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var ee={a:k};function te(){f();function e(){var e;n.calledRun=!0,!o&&(p(),c==null||c(n),(e=n.onRuntimeInitialized)==null||e.call(n),m())}n.setStatus?(n.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>n.setStatus(``),1),e()},1)):e()}var ne=b();return te(),t=u?n:new Promise((e,t)=>{c=e}),t}),ns.apply(this,arguments)}var rs='(function(){var e=(e,t)=>()=>(e&&(t=e(e=0)),t);function t(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function n(...e){}function r(e){return typeof Symbol>`u`?`$Symbol<${e}>$`:Symbol(e)}r(`$$FIVE_EVENT$$`);let i=Date.now();typeof performance<`u`&&(typeof performance.timeOrigin==`number`?i=performance.timeOrigin:performance.timing!==void 0&&(i=performance.timing.navigationStart));let a=typeof performance<`u`?(()=>i+performance.now()):(()=>Date.now()),o=[/\\.([0-9a-z]+)\\.jsonp([\\?\\#].*)?$/i,/jsonp_([0-9a-z]+)([\\?\\#].*)?$/i],s=typeof location<`u`?location.href:``,c=/^https\\:/.test(s);var l=class extends Error{constructor(e,t,n){super(`[NETWORK]: request proxy error(type: ${t}, reason: ${n}): ${e}`)}},u=class extends Error{constructor(e,t,n){super(`[NETWORK]: response error(type: ${t}, status: ${n}): ${e}`),this.httpStatus=n}},d=class extends Error{constructor(e,t,n){super(`[NETWORK]: request timeout(type: ${t}, timeout: ${n}ms): ${e}`)}};function f(e){if(!e)return{};let t={},n=e.trim().split(`\n`);for(let e=0;e<n.length;e++){let r=n[e],i=r.indexOf(`:`),a=r.slice(0,i).trim().toLowerCase(),o=r.slice(i+1).trim();o&&(t[a]?t[a]+=`, `+o:t[a]=o)}return t}function p(e){for(let t of o){let n=e.match(t);if(n)return`jsonp_`+n[1]}return null}function m(e){return p(e)!==null}function h(e,t={},r=n,i=n,o=n){let m=a(),h=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>c&&/^http\\:/.test(e)?(console.warn(`The page at \'${s}\' was loaded over HTTPS, but requested an insecure element \'${e}\'. This request was automatically upgraded to HTTPS`),e.replace(/^http\\:/,`https:`)):e).catch(n=>{var r;p(e);let i=new l(h,`XMLHttpRequest`,n&&n.message?String(n.message):String(n));return(r=t.networkSubscribe)==null||r.emit(`network`,e,`XMLHttpRequest`,`forbidden`,i.message),Promise.reject(i)}).then(e=>new Promise((s,c)=>{let l=p(e);if(l){let n=window,o=null,f=!1,p=document.createElement(`script`);n[l]=d=>{var g,_;let v=a(),y=v-m;if(delete n[l],p.parentNode&&p.parentNode.removeChild(p),o!==null&&(window.clearTimeout(o),o=null),f===!0)return;if(d.indexOf(`data:`)!==0){let n=new u(e,`XMLHttpRequest`,500);i(n),c(n),(g=t.networkSubscribe)==null||g.emit(`network`,e,`XMLHttpRequest`,`error`,n.message);return}let b=d.split(`,`),x=(b[0].match(/:(.*?);/)||[])[1],S=b[1];if(t.responseType===`arraybuffer`||t.responseType===`blob`){let e=atob(b[1]),n=e.length,r=new Uint8Array(n);for(let t=0;t<n;t++)r[t]=e.charCodeAt(t);S=t.responseType===`arraybuffer`?r.buffer:new Blob([r],{type:x})}let C={body:S,meta:{origin:h,source:e,requestTime:m,responseTime:v,costs:y,headers:{}}};r(C),s(C),(_=t.networkSubscribe)==null||_.emit(`network`,e,`XMLHttpRequest`,`ok`,JSON.stringify(C.meta)),f=!0},p.src=e,document.body.appendChild(p),typeof t.timeout==`number`&&(o=window.setTimeout(()=>{var n;if(o=null,f!==!0){f=!0;let r=new d(e,`XMLHttpRequest`,t.timeout||NaN);i(r),c(r),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`timeout`,r.message)}},t.timeout))}else{let l=!1,p=new XMLHttpRequest,g=()=>{p&&(p.removeEventListener(`timeout`,_,!1),p.removeEventListener(`progress`,v,!1),p.removeEventListener(`load`,y,!1),p.removeEventListener(`error`,b,!1)),p=null,g=n},_=function(){var n;if(l===!0)return;l=!0,g();let r=new d(e,`XMLHttpRequest`,t.timeout||NaN);i(r),c(r),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`timeout`,r.message)},v=function(e){l!==!0&&e.lengthComputable&&(e.total<=0||o(e.loaded/e.total,e.loaded,e.total))},y=function(n){var i;if(l===!0)return;let o=this.status;if(o===0||o>=200&&o<400){l=!0,g();let o=a(),c=o-m,u=f(this.getAllResponseHeaders()),d=n.total,p={body:this.response,meta:{origin:h,source:e,requestTime:m,responseTime:o,costs:c,headers:u,size:d}};r(p),s(p),(i=t.networkSubscribe)==null||i.emit(`network`,e,`XMLHttpRequest`,`ok`,JSON.stringify(p.meta))}else b.call(this)},b=function(){var n;if(l===!0)return;l=!0,g();let r=new u(e,`XMLHttpRequest`,this.status);i(r),c(r),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`error`,r.message)};p.addEventListener(`timeout`,_,!1),p.addEventListener(`progress`,v,!1),p.addEventListener(`load`,y,!1),p.addEventListener(`error`,b,!1),t.responseType&&(p.responseType=t.responseType),typeof t.timeout==`number`&&(p.timeout=t.timeout),p.open(`GET`,e,!0),p.send(null)}}))}let g={};function _(e,t={}){let r=a(),i=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>c&&/^http\\:/.test(e)?(console.warn(`The page at \'${s}\' was loaded over HTTPS, but requested an insecure element \'${e}\'. This request was automatically upgraded to HTTPS`),e.replace(/^http\\:/,`https:`)):e).catch(n=>{var r;let a=new l(i,`Link`,n&&n.message?String(n.message):String(n));return(r=t.networkSubscribe)==null||r.emit(`network`,e,`Link`,`forbidden`,a.message),Promise.reject(a)}).then(e=>e in g?g[e]:g[e]=new Promise((o,s)=>{let c=document.head||document.getElementsByTagName(`head`)[0],l=document.createElement(`link`),d=!1,f=null;l.onload=s=>{var c;if(f!==null&&(clearTimeout(f),f=null),d===!0)return;d=!0,o(),l.onerror=n,l.onload=n;let u=a(),p={origin:i,source:e,requestTime:r,responseTime:u,costs:u-r,headers:{}};(c=t.networkSubscribe)==null||c.emit(`network`,e,`Link`,`preload`,JSON.stringify(p))},l.onerror=r=>{var i;if(f!==null&&(clearTimeout(f),f=null),d===!0)return;d=!0,delete g[e],c&&l.parentNode===c&&c.removeChild(l);let a=new u(e,`Link`,0);s(a),l.onerror=n,l.onload=n,(i=t.networkSubscribe)==null||i.emit(`network`,e,`Link`,`error`,a.message)},typeof t.timeout==`number`&&(f=window.setTimeout(()=>{var s;if(f=null,d===!0)return;d=!0,o(),l.onerror=n,l.onload=n;let c=a(),u={origin:i,source:e,requestTime:r,responseTime:c,costs:c-r,headers:{}};(s=t.networkSubscribe)==null||s.emit(`network`,e,`Link`,`timeout`,JSON.stringify(u))},t.timeout)),l.rel=l.relList&&l.relList.supports(`prefetch`)?`prefetch`:`preload`,l.as=`fetch`,l.crossOrigin=``,l.fetchPriority=`high`,l.href=e,c&&c.appendChild(l)}))}function v(e,t={},r=n,i=n,o=n,f){let p=a(),g=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>c&&/^http\\:/.test(e)?(console.warn(`The page at \'${s}\' was loaded over HTTPS, but requested an insecure element \'${e}\'. This request was automatically upgraded to HTTPS`),e.replace(/^http\\:/,`https:`)):e).catch(n=>{var r;let i=new l(g,`Image`,n&&n.message?String(n.message):String(n));return(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`forbidden`,i.message),Promise.reject(i)}).then(e=>m(e)?h(e,{responseType:`blob`,networkSubscribe:t.networkSubscribe}).then(e=>URL.createObjectURL(e.body)):e).then(e=>new Promise((s,c)=>{let l=f==null?new Image:f,m=!1,h=null;typeof t.timeout==`number`&&(h=window.setTimeout(()=>{var r;if(l.onload=n,l.onerror=n,h=null,m===!0)return;m=!0;let a=new d(e,`Image`,t.timeout);i(a),c(a),(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`timeout`,a.message)},t.timeout)),l.onload=()=>{var i;if(l.onload=n,l.onerror=n,h!==null&&(clearTimeout(h),h=null),m===!0)return;let c=a(),u={headers:{},origin:g,source:e,requestTime:p,responseTime:c,costs:c-p};m=!0;let d={body:l,meta:u};o(1),r(d),s(d),(i=t.networkSubscribe)==null||i.emit(`network`,e,`Image`,`ok`,JSON.stringify(d.meta))},l.onerror=()=>{var r;if(l.onload=n,l.onerror=n,h!==null&&(clearTimeout(h),h=null),m===!0)return;m=!0;let a=new u(e,`Image`,0);i(a),c(a),(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`ok`,a.message)},o(0),l.src=e}))}new class{constructor(e={}){this.options=e}ajax(e,t={},r=n,i=n,a=n){var o;let s=this.options;return h(e,{responseType:t.responseType,timeout:(o=t.timeout)==null?s.timeout:o,get requestProxy(){var e;return(e=t.requestProxy)==null?s.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?s.networkSubscribe:e}},r,i,a)}loadImage(e,t={},r=n,i=n,a=n,o){var s;let c=this.options;return v(e,{timeout:(s=t.timeout)==null?c.timeout:s,get requestProxy(){var e;return(e=t.requestProxy)==null?c.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?c.networkSubscribe:e}},r,i,a,o)}preload(e,t={}){var n;let r=this.options;return _(e,{timeout:(n=t.timeout)==null?r.timeout:n,get requestProxy(){var e;return(e=t.requestProxy)==null?r.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?r.networkSubscribe:e}})}};function y(){}function b(e,t){this.x=e||0,this.y=t||0}function x(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error(`THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.`)}function S(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(this,`id`,{value:gc++}),this.uuid=X.generateUUID(),this.name=``,this.image=e===void 0?S.DEFAULT_IMAGE:e,this.mipmaps=[],this.mapping=t===void 0?S.DEFAULT_MAPPING:t,this.wrapS=n===void 0?Vo:n,this.wrapT=r===void 0?Vo:r,this.magFilter=i===void 0?Ko:i,this.minFilter=a===void 0?Jo:a,this.anisotropy=c===void 0?1:c,this.format=o===void 0?es:o,this.internalFormat=null,this.type=s===void 0?Yo:s,this.offset=new b(0,0),this.repeat=new b(1,1),this.center=new b(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new x,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l===void 0?$s:l,this.version=0,this.onUpdate=null}function C(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=r===void 0?1:r}function w(e,t,n){this.width=e,this.height=t,this.scissor=new C(0,0,e,t),this.scissorTest=!1,this.viewport=new C(0,0,e,t),n=n||{},this.texture=new S(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=n.generateMipmaps===void 0?!1:n.generateMipmaps,this.texture.minFilter=n.minFilter===void 0?Ko:n.minFilter,this.depthBuffer=n.depthBuffer===void 0?!0:n.depthBuffer,this.stencilBuffer=n.stencilBuffer===void 0?!0:n.stencilBuffer,this.depthTexture=n.depthTexture===void 0?null:n.depthTexture}function T(e,t,n){w.call(this,e,t,n),this.samples=4}function E(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=r===void 0?1:r}function D(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function O(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error(`THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.`)}function k(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||k.DefaultOrder}function A(){this.mask=1}function j(){Object.defineProperty(this,`id`,{value:Oc++}),this.uuid=X.generateUUID(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=j.DefaultUp.clone();var e=new D,t=new k,n=new E,r=new D(1,1,1);function i(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(i),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new O},normalMatrix:{value:new x}}),this.matrix=new O,this.matrixWorld=new O,this.matrixAutoUpdate=j.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new A,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function M(){j.call(this),this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}function N(e,t){this.min=e===void 0?new D(1/0,1/0,1/0):e,this.max=t===void 0?new D(-1/0,-1/0,-1/0):t}function P(e,t,n,r,i){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){$c.fromArray(e,a);var s=i.x*Math.abs($c.x)+i.y*Math.abs($c.y)+i.z*Math.abs($c.z),c=t.dot($c),l=n.dot($c),u=r.dot($c);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>s)return!1}return!0}function F(e,t){this.center=e===void 0?new D:e,this.radius=t===void 0?-1:t}function I(e,t){this.origin=e===void 0?new D:e,this.direction=t===void 0?new D(0,0,-1):t}function L(e,t){this.normal=e===void 0?new D(1,0,0):e,this.constant=t===void 0?0:t}function R(e,t,n){this.a=e===void 0?new D:e,this.b=t===void 0?new D:t,this.c=n===void 0?new D:n}function z(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}function ee(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}function te(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}function ne(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}function B(e,t,n,r,i,a){this.a=e,this.b=t,this.c=n,this.normal=r&&r.isVector3?r:new D,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new z,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=a===void 0?0:a}function V(){Object.defineProperty(this,`id`,{value:wl++}),this.uuid=X.generateUUID(),this.name=``,this.type=`Material`,this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=lc,this.stencilZFail=lc,this.stencilZPass=lc,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function re(e){V.call(this),this.type=`MeshBasicMaterial`,this.color=new z(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.setValues(e)}function H(e,t,n){if(Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n===!0,this.usage=uc,this.updateRange={offset:0,count:-1},this.version=0}function U(e,t,n){H.call(this,new Int8Array(e),t,n)}function ie(e,t,n){H.call(this,new Uint8Array(e),t,n)}function W(e,t,n){H.call(this,new Uint8ClampedArray(e),t,n)}function ae(e,t,n){H.call(this,new Int16Array(e),t,n)}function G(e,t,n){H.call(this,new Uint16Array(e),t,n)}function oe(e,t,n){H.call(this,new Int32Array(e),t,n)}function se(e,t,n){H.call(this,new Uint32Array(e),t,n)}function K(e,t,n){H.call(this,new Float32Array(e),t,n)}function ce(e,t,n){H.call(this,new Float64Array(e),t,n)}function le(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function ue(e){if(e.length===0)return-1/0;let t=e[0];for(let n=1,r=e.length;n<r;++n)e[n]>t&&(t=e[n]);return t}function q(){Object.defineProperty(this,`id`,{value:El+=2}),this.uuid=X.generateUUID(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}function de(e,t){j.call(this),this.type=`Mesh`,this.geometry=e===void 0?new q:e,this.material=t===void 0?new re:t,this.updateMorphTargets()}function fe(e,t,n,r,i,a,o,s){if((t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side!==2,s))===null)return null;Yl.copy(s),Yl.applyMatrix4(e.matrixWorld);var c=n.ray.origin.distanceTo(Yl);return c<n.near||c>n.far?null:{distance:c,point:Yl.clone(),object:e}}function pe(e,t,n,r,i,a,o,s,c,l,u,d){Il.fromBufferAttribute(i,l),Ll.fromBufferAttribute(i,u),Rl.fromBufferAttribute(i,d);var f=e.morphTargetInfluences;if(t.morphTargets&&a&&f){Hl.set(0,0,0),Ul.set(0,0,0),Wl.set(0,0,0);for(var p=0,m=a.length;p<m;p++){var h=f[p],g=a[p];h!==0&&(zl.fromBufferAttribute(g,l),Bl.fromBufferAttribute(g,u),Vl.fromBufferAttribute(g,d),o?(Hl.addScaledVector(zl,h),Ul.addScaledVector(Bl,h),Wl.addScaledVector(Vl,h)):(Hl.addScaledVector(zl.sub(Il),h),Ul.addScaledVector(Bl.sub(Ll),h),Wl.addScaledVector(Vl.sub(Rl),h)))}Il.add(Hl),Ll.add(Ul),Rl.add(Wl)}e.isSkinnedMesh&&(e.boneTransform(l,Il),e.boneTransform(u,Ll),e.boneTransform(d,Rl));var _=fe(e,t,n,r,Il,Ll,Rl,Jl);if(_){s&&(Gl.fromBufferAttribute(s,l),Kl.fromBufferAttribute(s,u),ql.fromBufferAttribute(s,d),_.uv=R.getUV(Jl,Il,Ll,Rl,Gl,Kl,ql,new b)),c&&(Gl.fromBufferAttribute(c,l),Kl.fromBufferAttribute(c,u),ql.fromBufferAttribute(c,d),_.uv2=R.getUV(Jl,Il,Ll,Rl,Gl,Kl,ql,new b));var v=new B(l,u,d);R.getNormal(Il,Ll,Rl,v.normal),_.face=v}return _}function J(){Object.defineProperty(this,`id`,{value:Xl+=2}),this.uuid=X.generateUUID(),this.name=``,this.type=`Geometry`,this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function me(e){var t={};for(var n in e)for(var r in t[n]={},e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}function he(e){for(var t={},n=0;n<e.length;n++){var r=me(e[n]);for(var i in r)t[i]=r[i]}return t}function ge(e){V.call(this),this.type=`ShaderMaterial`,this.defines={},this.uniforms={},this.vertexShader=ru,this.fragmentShader=iu,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,e!==void 0&&(e.attributes!==void 0&&console.error(`THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.`),this.setValues(e))}function _e(){j.call(this),this.type=`Camera`,this.matrixWorldInverse=new O,this.projectionMatrix=new O,this.projectionMatrixInverse=new O}function ve(e,t,n,r){_e.call(this),this.type=`PerspectiveCamera`,this.fov=e===void 0?50:e,this.zoom=1,this.near=n===void 0?.1:n,this.far=r===void 0?2e3:r,this.focus=10,this.aspect=t===void 0?1:t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function ye(e,t,n){if(j.call(this),this.type=`CubeCamera`,n.isWebGLCubeRenderTarget!==!0){console.error(`THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.`);return}this.renderTarget=n;var r=new ve(au,ou,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new D(1,0,0)),this.add(r);var i=new ve(au,ou,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new D(-1,0,0)),this.add(i);var a=new ve(au,ou,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new D(0,1,0)),this.add(a);var o=new ve(au,ou,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new D(0,-1,0)),this.add(o);var s=new ve(au,ou,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new D(0,0,1)),this.add(s);var c=new ve(au,ou,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new D(0,0,-1)),this.add(c),this.update=function(e,t){this.parent===null&&this.updateMatrixWorld();var l=e.xr.enabled,u=e.getRenderTarget();e.xr.enabled=!1;var d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,i),e.setRenderTarget(n,2),e.render(t,a),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,s),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(u),e.xr.enabled=l},this.clear=function(e,t,r,i){for(var a=e.getRenderTarget(),o=0;o<6;o++)e.setRenderTarget(n,o),e.clear(t,r,i);e.setRenderTarget(a)}}function be(e,t,n){Number.isInteger(t)&&(console.warn(`THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )`),t=n),w.call(this,e,e,t)}function xe(e,t,n,r,i,a,o,s,c,l,u,d){S.call(this,null,a,o,s,c,l,r,i,u,d),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=c===void 0?Uo:c,this.minFilter=l===void 0?Uo:l,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}function Se(e,t,n,r,i,a){this.planes=[e===void 0?new L:e,t===void 0?new L:t,n===void 0?new L:n,r===void 0?new L:r,i===void 0?new L:i,a===void 0?new L:a]}function Ce(){var e=null,t=!1,n=null;function r(i,a){t!==!1&&(n(i,a),e.requestAnimationFrame(r))}return{start:function(){t!==!0&&n!==null&&(e.requestAnimationFrame(r),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function we(e,t){var n=t.isWebGL2,r=new WeakMap;function i(t,n){var r=t.array,i=t.usage,a=e.createBuffer();e.bindBuffer(n,a),e.bufferData(n,r,i),t.onUploadCallback();var o=5126;return r instanceof Float32Array?o=5126:r instanceof Float64Array?console.warn(`THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.`):r instanceof Uint16Array?o=5123:r instanceof Int16Array?o=5122:r instanceof Uint32Array?o=5125:r instanceof Int32Array?o=5124:r instanceof Int8Array?o=5120:r instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version}}function a(t,r,i){var a=r.array,o=r.updateRange;e.bindBuffer(i,t),o.count===-1?e.bufferSubData(i,0,a):(n?e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}function o(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)}function s(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))}function c(e,t){e.isInterleavedBufferAttribute&&(e=e.data);var n=r.get(e);n===void 0?r.set(e,i(e,t)):n.version<e.version&&(a(n.buffer,e,t),n.version=e.version)}return{get:o,remove:s,update:c}}function Te(e,t,n,r){J.call(this),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new Ee(e,t,n,r)),this.mergeVertices()}function Ee(e,t,n,r){q.call(this),this.type=`PlaneBufferGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},e=e||1,t=t||1;var i=e/2,a=t/2,o=Math.floor(n)||1,s=Math.floor(r)||1,c=o+1,l=s+1,u=e/o,d=t/s,f,p,m=[],h=[],g=[],_=[];for(p=0;p<l;p++){var v=p*d-a;for(f=0;f<c;f++){var y=f*u-i;h.push(y,-v,0),g.push(0,0,1),_.push(f/o),_.push(1-p/s)}}for(p=0;p<s;p++)for(f=0;f<o;f++){var b=f+c*p,x=f+c*(p+1),S=f+1+c*(p+1),C=f+1+c*p;m.push(b,x,C),m.push(x,S,C)}this.setIndex(m),this.setAttribute(`position`,new K(h,3)),this.setAttribute(`normal`,new K(g,3)),this.setAttribute(`uv`,new K(_,2))}function De(e,t,n,r){var i=new z(0),a=0,o,s,c=null,l=0,u=null;function d(t,r,d,p){var m=r.background,h=e.xr,g=h.getSession&&h.getSession();if(g&&g.environmentBlendMode===`additive`&&(m=null),m===null?f(i,a):m&&m.isColor&&(f(m,1),p=!0),(e.autoClear||p)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),m&&(m.isCubeTexture||m.isWebGLCubeRenderTarget||m.mapping===306)){s===void 0&&(s=new de(new tu(1,1,1),new ge({type:`BackgroundCubeMaterial`,uniforms:me(lu.cube.uniforms),vertexShader:lu.cube.vertexShader,fragmentShader:lu.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute(`normal`),s.geometry.deleteAttribute(`uv`),s.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(s.material,`envMap`,{get:function(){return this.uniforms.envMap.value}}),n.update(s));var _=m.isWebGLCubeRenderTarget?m.texture:m;s.material.uniforms.envMap.value=_,s.material.uniforms.flipEnvMap.value=_.isCubeTexture?-1:1,(c!==m||l!==_.version||u!==e.toneMapping)&&(s.material.needsUpdate=!0,c=m,l=_.version,u=e.toneMapping),t.unshift(s,s.geometry,s.material,0,0,null)}else m&&m.isTexture&&(o===void 0&&(o=new de(new Ee(2,2),new ge({type:`BackgroundMaterial`,uniforms:me(lu.background.uniforms),vertexShader:lu.background.vertexShader,fragmentShader:lu.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute(`normal`),Object.defineProperty(o.material,`map`,{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=m,m.matrixAutoUpdate===!0&&m.updateMatrix(),o.material.uniforms.uvTransform.value.copy(m.matrix),(c!==m||l!==m.version||u!==e.toneMapping)&&(o.material.needsUpdate=!0,c=m,l=m.version,u=e.toneMapping),t.unshift(o,o.geometry,o.material,0,0,null))}function f(e,n){t.buffers.color.setClear(e.r,e.g,e.b,n,r)}return{getClearColor:function(){return i},setClearColor:function(e,t){i.set(e),a=t===void 0?1:t,f(i,a)},getClearAlpha:function(){return a},setClearAlpha:function(e){a=e,f(i,a)},render:d}}function Oe(e,t,n,r){var i=r.isWebGL2,a;function o(e){a=e}function s(t,r){e.drawArrays(a,t,r),n.update(r,a)}function c(r,o,s,c){if(c!==0){var l,u;if(i)l=e,u=`drawArraysInstanced`;else if(l=t.get(`ANGLE_instanced_arrays`),u=`drawArraysInstancedANGLE`,l===null){console.error(`THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.`);return}l[u](a,o,s,c),n.update(s,a,c)}}this.setMode=o,this.render=s,this.renderInstances=c}function ke(e,t,n){var r;function i(){if(r!==void 0)return r;var n=t.get(`EXT_texture_filter_anisotropic`);return r=n===null?0:e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT),r}function a(t){if(t===`highp`){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?`mediump`:`lowp`}var o=typeof WebGL2RenderingContext<`u`&&e instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<`u`&&e instanceof WebGL2ComputeRenderingContext,s=n.precision===void 0?`highp`:n.precision,c=a(s);c!==s&&(console.warn(`THREE.WebGLRenderer:`,s,`not supported, using`,c,`instead.`),s=c);var l=n.logarithmicDepthBuffer===!0,u=e.getParameter(34930),d=e.getParameter(35660),f=e.getParameter(3379),p=e.getParameter(34076),m=e.getParameter(34921),h=e.getParameter(36347),g=e.getParameter(36348),_=e.getParameter(36349),v=d>0,y=o||!!t.get(`OES_texture_float`),b=v&&y,x=o?e.getParameter(36183):0;return{isWebGL2:o,getMaxAnisotropy:i,getMaxPrecision:a,precision:s,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:d,maxTextureSize:f,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:h,maxVaryings:g,maxFragmentUniforms:_,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:b,maxSamples:x}}function Ae(){var e=this,t=null,n=0,r=!1,i=!1,a=new L,o=new x,s={value:null,needsUpdate:!1};this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,i,a){var o=e.length!==0||i||n!==0||r;return r=i,t=l(e,a,0),n=e.length,o},this.beginShadows=function(){i=!0,l(null)},this.endShadows=function(){i=!1,c()},this.setState=function(e,a,o,u,d,f){if(!r||e===null||e.length===0||i&&!o)i?l(null):c();else{var p=i?0:n,m=p*4,h=d.clippingState||null;s.value=h,h=l(e,u,m,f);for(var g=0;g!==m;++g)h[g]=t[g];d.clippingState=h,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=p}};function c(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function l(t,n,r,i){var c=t===null?0:t.length,l=null;if(c!==0){if(l=s.value,i!==!0||l===null){var u=r+c*4,d=n.matrixWorldInverse;o.getNormalMatrix(d),(l===null||l.length<u)&&(l=new Float32Array(u));for(var f=0,p=r;f!==c;++f,p+=4)a.copy(t[f]).applyMatrix4(d,o),a.normal.toArray(l,p),l[p+3]=a.constant}s.value=l,s.needsUpdate=!0}return e.numPlanes=c,e.numIntersection=0,l}}function je(e){var t={};return{get:function(n){if(t[n]!==void 0)return t[n];var r;switch(n){case`WEBGL_depth_texture`:r=e.getExtension(`WEBGL_depth_texture`)||e.getExtension(`MOZ_WEBGL_depth_texture`)||e.getExtension(`WEBKIT_WEBGL_depth_texture`);break;case`EXT_texture_filter_anisotropic`:r=e.getExtension(`EXT_texture_filter_anisotropic`)||e.getExtension(`MOZ_EXT_texture_filter_anisotropic`)||e.getExtension(`WEBKIT_EXT_texture_filter_anisotropic`);break;case`WEBGL_compressed_texture_s3tc`:r=e.getExtension(`WEBGL_compressed_texture_s3tc`)||e.getExtension(`MOZ_WEBGL_compressed_texture_s3tc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_s3tc`);break;case`WEBGL_compressed_texture_pvrtc`:r=e.getExtension(`WEBGL_compressed_texture_pvrtc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_pvrtc`);break;default:r=e.getExtension(n)}return r===null&&console.warn(`THREE.WebGLRenderer: `+n+` extension not supported.`),t[n]=r,r}}}function Me(e,t,n){var r=new WeakMap,i=new WeakMap;function a(e){var o=e.target,s=r.get(o);for(var c in s.index!==null&&t.remove(s.index),s.attributes)t.remove(s.attributes[c]);o.removeEventListener(`dispose`,a),r.delete(o);var l=i.get(s);l&&(t.remove(l),i.delete(s)),n.memory.geometries--}function o(e,t){var i=r.get(t);return i||(t.addEventListener(`dispose`,a),t.isBufferGeometry?i=t:t.isGeometry&&(t._bufferGeometry===void 0&&(t._bufferGeometry=new q().setFromObject(e)),i=t._bufferGeometry),r.set(t,i),n.memory.geometries++,i)}function s(e){var n=e.index,r=e.attributes;for(var i in n!==null&&t.update(n,34963),r)t.update(r[i],34962);var a=e.morphAttributes;for(var i in a)for(var o=a[i],s=0,c=o.length;s<c;s++)t.update(o[s],34962)}function c(e){var n=[],r=e.index,a=e.attributes.position,o=0;if(r!==null){var s=r.array;o=r.version;for(var c=0,l=s.length;c<l;c+=3){var u=s[c+0],d=s[c+1],f=s[c+2];n.push(u,d,d,f,f,u)}}else{var s=a.array;o=a.version;for(var c=0,l=s.length/3-1;c<l;c+=3){var u=c+0,d=c+1,f=c+2;n.push(u,d,d,f,f,u)}}var p=new(ue(n)>65535?se:G)(n,1);p.version=o,t.update(p,34963);var m=i.get(e);m&&t.remove(m),i.set(e,p)}function l(e){var t=i.get(e);if(t){var n=e.index;n!==null&&t.version<n.version&&c(e)}else c(e);return i.get(e)}return{get:o,update:s,getWireframeAttribute:l}}function Ne(e,t,n,r){var i=r.isWebGL2,a;function o(e){a=e}var s,c;function l(e){s=e.type,c=e.bytesPerElement}function u(t,r){e.drawElements(a,r,s,t*c),n.update(r,a)}function d(r,o,l,u){if(u!==0){var d,f;if(i)d=e,f=`drawElementsInstanced`;else if(d=t.get(`ANGLE_instanced_arrays`),f=`drawElementsInstancedANGLE`,d===null){console.error(`THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.`);return}d[f](a,l,s,o*c,u),n.update(l,a,u)}}this.setMode=o,this.setIndex=l,this.render=u,this.renderInstances=d}function Pe(e){var t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(e,t,r){switch(r=r||1,n.calls++,t){case 4:n.triangles+=e/3*r;break;case 1:n.lines+=e/2*r;break;case 3:n.lines+=r*(e-1);break;case 2:n.lines+=r*e;break;case 0:n.points+=r*e;break;default:console.error(`THREE.WebGLInfo: Unknown draw mode:`,t);break}}function i(){n.frame++,n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:i,update:r}}function Fe(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Ie(e){var t={},n=new Float32Array(8);function r(r,i,a,o){var s=r.morphTargetInfluences,c=s===void 0?0:s.length,l=t[i.id];if(l===void 0){l=[];for(var u=0;u<c;u++)l[u]=[u,0];t[i.id]=l}for(var d=a.morphTargets&&i.morphAttributes.position,f=a.morphNormals&&i.morphAttributes.normal,u=0;u<c;u++){var p=l[u];p[1]!==0&&(d&&i.deleteAttribute(`morphTarget`+u),f&&i.deleteAttribute(`morphNormal`+u))}for(var u=0;u<c;u++){var p=l[u];p[0]=u,p[1]=s[u]}l.sort(Fe);for(var m=0,u=0;u<8;u++){var p=l[u];if(p){var h=p[0],g=p[1];if(g){d&&i.setAttribute(`morphTarget`+u,d[h]),f&&i.setAttribute(`morphNormal`+u,f[h]),n[u]=g,m+=g;continue}}n[u]=0}var _=i.morphTargetsRelative?1:1-m;o.getUniforms().setValue(e,`morphTargetBaseInfluence`,_),o.getUniforms().setValue(e,`morphTargetInfluences`,n)}return{update:r}}function Le(e,t,n,r){var i=new WeakMap;function a(e){var a=r.render.frame,o=e.geometry,s=t.get(e,o);return i.get(s)!==a&&(o.isGeometry&&s.updateFromObject(e),t.update(s),i.set(s,a)),e.isInstancedMesh&&n.update(e.instanceMatrix,34962),s}function o(){i=new WeakMap}return{update:a,dispose:o}}function Re(e,t,n,r,i,a,o,s,c,l){e=e===void 0?[]:e,t=t===void 0?301:t,o=o===void 0?$o:o,S.call(this,e,t,n,r,i,a,o,s,c,l),this.flipY=!1}function ze(e,t,n,r){S.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=Uo,this.minFilter=Uo,this.wrapR=Vo,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Be(e,t,n,r){S.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=Uo,this.minFilter=Uo,this.wrapR=Vo,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Ve(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,a=mu[i];if(a===void 0&&(a=new Float32Array(i),mu[i]=a),t!==0){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function He(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Ue(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function We(e,t){var n=hu[t];n===void 0&&(n=new Int32Array(t),hu[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function Ge(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Ke(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(He(n,t))return;e.uniform2fv(this.addr,t),Ue(n,t)}}function qe(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(t.r!==void 0)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(He(n,t))return;e.uniform3fv(this.addr,t),Ue(n,t)}}function Je(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(He(n,t))return;e.uniform4fv(this.addr,t),Ue(n,t)}}function Ye(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(He(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ue(n,t)}else{if(He(n,r))return;vu.set(r),e.uniformMatrix2fv(this.addr,!1,vu),Ue(n,r)}}function Xe(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(He(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ue(n,t)}else{if(He(n,r))return;_u.set(r),e.uniformMatrix3fv(this.addr,!1,_u),Ue(n,r)}}function Ze(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(He(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ue(n,t)}else{if(He(n,r))return;gu.set(r),e.uniformMatrix4fv(this.addr,!1,gu),Ue(n,r)}}function Qe(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(t||uu,i)}function $e(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||du,i)}function et(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||fu,i)}function tt(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(t||pu,i)}function nt(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function rt(e,t){var n=this.cache;He(n,t)||(e.uniform2iv(this.addr,t),Ue(n,t))}function it(e,t){var n=this.cache;He(n,t)||(e.uniform3iv(this.addr,t),Ue(n,t))}function at(e,t){var n=this.cache;He(n,t)||(e.uniform4iv(this.addr,t),Ue(n,t))}function ot(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function st(e){switch(e){case 5126:return Ge;case 35664:return Ke;case 35665:return qe;case 35666:return Je;case 35674:return Ye;case 35675:return Xe;case 35676:return Ze;case 5124:case 35670:return nt;case 35667:case 35671:return rt;case 35668:case 35672:return it;case 35669:case 35673:return at;case 5125:return ot;case 35678:case 36198:case 36298:case 36306:case 35682:return Qe;case 35679:case 36299:case 36307:return et;case 35680:case 36300:case 36308:case 36293:return tt;case 36289:case 36303:case 36311:case 36292:return $e}}function ct(e,t){e.uniform1fv(this.addr,t)}function lt(e,t){e.uniform1iv(this.addr,t)}function ut(e,t){e.uniform2iv(this.addr,t)}function dt(e,t){e.uniform3iv(this.addr,t)}function ft(e,t){e.uniform4iv(this.addr,t)}function pt(e,t){var n=Ve(t,this.size,2);e.uniform2fv(this.addr,n)}function mt(e,t){var n=Ve(t,this.size,3);e.uniform3fv(this.addr,n)}function ht(e,t){var n=Ve(t,this.size,4);e.uniform4fv(this.addr,n)}function gt(e,t){var n=Ve(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function _t(e,t){var n=Ve(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function vt(e,t){var n=Ve(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function yt(e,t,n){var r=t.length,i=We(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTexture2D(t[a]||uu,i[a])}function bt(e,t,n){var r=t.length,i=We(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTextureCube(t[a]||pu,i[a])}function xt(e){switch(e){case 5126:return ct;case 35664:return pt;case 35665:return mt;case 35666:return ht;case 35674:return gt;case 35675:return _t;case 35676:return vt;case 5124:case 35670:return lt;case 35667:case 35671:return ut;case 35668:case 35672:return dt;case 35669:case 35673:return ft;case 35678:case 36198:case 36298:case 36306:case 35682:return yt;case 35680:case 36300:case 36308:case 36293:return bt}}function St(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=st(t.type)}function Ct(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=xt(t.type)}function wt(e){this.id=e,this.seq=[],this.map={}}function Tt(e,t){e.seq.push(t),e.map[t.id]=t}function Et(e,t,n){var r=e.name,i=r.length;for(yu.lastIndex=0;;){var a=yu.exec(r),o=yu.lastIndex,s=a[1],c=a[2]===`]`,l=a[3];if(c&&(s|=0),l===void 0||l===`[`&&o+2===i){Tt(n,l===void 0?new St(s,e,t):new Ct(s,e,t));break}else{var u=n.map[s];u===void 0&&(u=new wt(s),Tt(n,u)),n=u}}}function Dt(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),r=0;r<n;++r){var i=e.getActiveUniform(t,r);Et(i,e.getUniformLocation(t,i.name),this)}}function Ot(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}function kt(e){for(var t=e.split(`\n`),n=0;n<t.length;n++)t[n]=n+1+`: `+t[n];return t.join(`\n`)}function At(e){switch(e){case $s:return[`Linear`,`( value )`];case ec:return[`sRGB`,`( value )`];case nc:return[`RGBE`,`( value )`];case ic:return[`RGBM`,`( value, 7.0 )`];case ac:return[`RGBM`,`( value, 16.0 )`];case oc:return[`RGBD`,`( value, 256.0 )`];case tc:return[`Gamma`,`( value, float( GAMMA_FACTOR ) )`];case rc:return[`LogLuv`,`( value )`];default:throw Error(`unsupported encoding: `+e)}}function jt(e,t,n){var r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(r&&i===``)return``;var a=e.getShaderSource(t);return`THREE.WebGLShader: gl.getShaderInfoLog() `+n+`\n`+i+kt(a)}function Mt(e,t){var n=At(t);return`vec4 `+e+`( vec4 value ) { return `+n[0]+`ToLinear`+n[1]+`; }`}function Nt(e,t){var n=At(t);return`vec4 `+e+`( vec4 value ) { return LinearTo`+n[0]+n[1]+`; }`}function Pt(e,t){var n;switch(t){case 1:n=`Linear`;break;case 2:n=`Reinhard`;break;case 3:n=`Uncharted2`;break;case 4:n=`OptimizedCineon`;break;case 5:n=`ACESFilmic`;break;default:throw Error(`unsupported toneMapping: `+t)}return`vec3 `+e+`( vec3 color ) { return `+n+`ToneMapping( color ); }`}function Ft(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||e.shaderID===`physical`?`#extension GL_OES_standard_derivatives : enable`:``,(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?`#extension GL_EXT_frag_depth : enable`:``,e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?`#extension GL_EXT_draw_buffers : require`:``,(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?`#extension GL_EXT_shader_texture_lod : enable`:``].filter(Rt).join(`\n`)}function It(e){var t=[];for(var n in e){var r=e[n];r!==!1&&t.push(`#define `+n+` `+r)}return t.join(`\n`)}function Lt(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var a=e.getActiveAttrib(t,i).name;n[a]=e.getAttribLocation(t,a)}return n}function Rt(e){return e!==``}function zt(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Bt(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}function Vt(e){return e.replace(xu,Ht)}function Ht(e,t){var n=Q[t];if(n===void 0)throw Error(`Can not resolve #include <`+t+`>`);return Vt(n)}function Ut(e){return e.replace(Cu,Gt).replace(Su,Wt)}function Wt(e,t,n,r){return console.warn(`WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.`),Gt(e,t,n,r)}function Gt(e,t,n,r){for(var i=``,a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\\[ i \\]/g,`[ `+a+` ]`).replace(/UNROLLED_LOOP_INDEX/g,a);return i}function Kt(e){var t=`precision `+e.precision+` float;\nprecision `+e.precision+` int;`;return e.precision===`highp`?t+=`\n#define HIGH_PRECISION`:e.precision===`mediump`?t+=`\n#define MEDIUM_PRECISION`:e.precision===`lowp`&&(t+=`\n#define LOW_PRECISION`),t}function qt(e){var t=`SHADOWMAP_TYPE_BASIC`;return e.shadowMapType===1?t=`SHADOWMAP_TYPE_PCF`:e.shadowMapType===2?t=`SHADOWMAP_TYPE_PCF_SOFT`:e.shadowMapType===3&&(t=`SHADOWMAP_TYPE_VSM`),t}function Jt(e){var t=`ENVMAP_TYPE_CUBE`;if(e.envMap)switch(e.envMapMode){case 301:case 302:t=`ENVMAP_TYPE_CUBE`;break;case 306:case 307:t=`ENVMAP_TYPE_CUBE_UV`;break;case 303:case 304:t=`ENVMAP_TYPE_EQUIREC`;break;case 305:t=`ENVMAP_TYPE_SPHERE`;break}return t}function Yt(e){var t=`ENVMAP_MODE_REFLECTION`;if(e.envMap)switch(e.envMapMode){case 302:case 304:t=`ENVMAP_MODE_REFRACTION`;break}return t}function Xt(e){var t=`ENVMAP_BLENDING_NONE`;if(e.envMap)switch(e.combine){case 0:t=`ENVMAP_BLENDING_MULTIPLY`;break;case 1:t=`ENVMAP_BLENDING_MIX`;break;case 2:t=`ENVMAP_BLENDING_ADD`;break}return t}function Zt(e,t,n){var r=e.getContext(),i=n.defines,a=n.vertexShader,o=n.fragmentShader,s=qt(n),c=Jt(n),l=Yt(n),u=Xt(n),d=e.gammaFactor>0?e.gammaFactor:1,f=n.isWebGL2?``:Ft(n),p=It(i),m=r.createProgram(),h,g;if(n.isRawShaderMaterial?(h=[p].filter(Rt).join(`\n`),h.length>0&&(h+=`\n`),g=[f,p].filter(Rt).join(`\n`),g.length>0&&(g+=`\n`)):(h=[Kt(n),`#define SHADER_NAME `+n.shaderName,p,n.instancing?`#define USE_INSTANCING`:``,n.supportsVertexTextures?`#define VERTEX_TEXTURES`:``,`#define GAMMA_FACTOR `+d,`#define MAX_BONES `+n.maxBones,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMap&&n.objectSpaceNormalMap?`#define OBJECTSPACE_NORMALMAP`:``,n.normalMap&&n.tangentSpaceNormalMap?`#define TANGENTSPACE_NORMALMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.displacementMap&&n.supportsVertexTextures?`#define USE_DISPLACEMENTMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.vertexTangents?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexUvs?`#define USE_UV`:``,n.uvsVertexOnly?`#define UVS_VERTEX_ONLY`:``,n.flatShading?`#define FLAT_SHADED`:``,n.skinning?`#define USE_SKINNING`:``,n.useVertexTexture?`#define BONE_TEXTURE`:``,n.morphTargets?`#define USE_MORPHTARGETS`:``,n.morphNormals&&n.flatShading===!1?`#define USE_MORPHNORMALS`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+s:``,n.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?`#define USE_LOGDEPTHBUF_EXT`:``,`uniform mat4 modelMatrix;`,`uniform mat4 modelViewMatrix;`,`uniform mat4 projectionMatrix;`,`uniform mat4 viewMatrix;`,`uniform mat3 normalMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,`#ifdef USE_INSTANCING`,` attribute mat4 instanceMatrix;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#ifdef USE_COLOR`,` attribute vec3 color;`,`#endif`,`#ifdef USE_MORPHTARGETS`,` attribute vec3 morphTarget0;`,` attribute vec3 morphTarget1;`,` attribute vec3 morphTarget2;`,` attribute vec3 morphTarget3;`,` #ifdef USE_MORPHNORMALS`,` attribute vec3 morphNormal0;`,` attribute vec3 morphNormal1;`,` attribute vec3 morphNormal2;`,` attribute vec3 morphNormal3;`,` #else`,` attribute vec3 morphTarget4;`,` attribute vec3 morphTarget5;`,` attribute vec3 morphTarget6;`,` attribute vec3 morphTarget7;`,` #endif`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,`\n`].filter(Rt).join(`\n`),g=[f,Kt(n),`#define SHADER_NAME `+n.shaderName,p,n.alphaTest?`#define ALPHATEST `+n.alphaTest+(n.alphaTest%1?``:`.0`):``,`#define GAMMA_FACTOR `+d,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.matcap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+c:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMap&&n.objectSpaceNormalMap?`#define OBJECTSPACE_NORMALMAP`:``,n.normalMap&&n.tangentSpaceNormalMap?`#define TANGENTSPACE_NORMALMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.sheen?`#define USE_SHEEN`:``,n.vertexTangents?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexUvs?`#define USE_UV`:``,n.uvsVertexOnly?`#define UVS_VERTEX_ONLY`:``,n.gradientMap?`#define USE_GRADIENTMAP`:``,n.flatShading?`#define FLAT_SHADED`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+s:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.physicallyCorrectLights?`#define PHYSICALLY_CORRECT_LIGHTS`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?`#define USE_LOGDEPTHBUF_EXT`:``,(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?`#define TEXTURE_LOD_EXT`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:Q.tonemapping_pars_fragment,n.toneMapping===0?``:Pt(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?Q.encodings_pars_fragment:``,n.mapEncoding?Mt(`mapTexelToLinear`,n.mapEncoding):``,n.matcapEncoding?Mt(`matcapTexelToLinear`,n.matcapEncoding):``,n.envMapEncoding?Mt(`envMapTexelToLinear`,n.envMapEncoding):``,n.emissiveMapEncoding?Mt(`emissiveMapTexelToLinear`,n.emissiveMapEncoding):``,n.lightMapEncoding?Mt(`lightMapTexelToLinear`,n.lightMapEncoding):``,n.outputEncoding?Nt(`linearToOutputTexel`,n.outputEncoding):``,n.depthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,`\n`].filter(Rt).join(`\n`)),a=Vt(a),a=zt(a,n),a=Bt(a,n),o=Vt(o),o=zt(o,n),o=Bt(o,n),a=Ut(a),o=Ut(o),n.isWebGL2&&!n.isRawShaderMaterial){var _=!1,v=/^\\s*#version\\s+300\\s+es\\s*\\n/;n.isShaderMaterial&&a.match(v)!==null&&o.match(v)!==null&&(_=!0,a=a.replace(v,``),o=o.replace(v,``)),h=[`#version 300 es\n`,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(`\n`)+`\n`+h,g=[`#version 300 es\n`,`#define varying in`,_?``:`out highp vec4 pc_fragColor;`,_?``:`#define gl_FragColor pc_fragColor`,`#define gl_FragDepthEXT gl_FragDepth`,`#define texture2D texture`,`#define textureCube texture`,`#define texture2DProj textureProj`,`#define texture2DLodEXT textureLod`,`#define texture2DProjLodEXT textureProjLod`,`#define textureCubeLodEXT textureLod`,`#define texture2DGradEXT textureGrad`,`#define texture2DProjGradEXT textureProjGrad`,`#define textureCubeGradEXT textureGrad`].join(`\n`)+`\n`+g}var y=h+a,b=g+o,x=Ot(r,35633,y),S=Ot(r,35632,b);if(r.attachShader(m,x),r.attachShader(m,S),n.index0AttributeName===void 0?n.morphTargets===!0&&r.bindAttribLocation(m,0,`position`):r.bindAttribLocation(m,0,n.index0AttributeName),r.linkProgram(m),e.debug.checkShaderErrors){var C=r.getProgramInfoLog(m).trim(),w=r.getShaderInfoLog(x).trim(),T=r.getShaderInfoLog(S).trim(),E=!0,D=!0;if(r.getProgramParameter(m,35714)===!1){E=!1;var O=jt(r,x,`vertex`),k=jt(r,S,`fragment`);console.error(`THREE.WebGLProgram: shader error: `,r.getError(),`35715`,r.getProgramParameter(m,35715),`gl.getProgramInfoLog`,C,O,k)}else C===``?(w===``||T===``)&&(D=!1):console.warn(`THREE.WebGLProgram: gl.getProgramInfoLog()`,C);D&&(this.diagnostics={runnable:E,programLog:C,vertexShader:{log:w,prefix:h},fragmentShader:{log:T,prefix:g}})}r.deleteShader(x),r.deleteShader(S);var A;this.getUniforms=function(){return A===void 0&&(A=new Dt(r,m)),A};var j;return this.getAttributes=function(){return j===void 0&&(j=Lt(r,m)),j},this.destroy=function(){r.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=bu++,this.cacheKey=t,this.usedTimes=1,this.program=m,this.vertexShader=x,this.fragmentShader=S,this}function Qt(e,t,n){var r=[],i=n.isWebGL2,a=n.logarithmicDepthBuffer,o=n.floatVertexTextures,s=n.precision,c=n.maxVertexUniforms,l=n.vertexTextures,u={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distanceRGBA`,MeshNormalMaterial:`normal`,MeshBasicMaterial:`basic`,MeshLambertMaterial:`lambert`,MeshPhongMaterial:`phong`,MeshToonMaterial:`toon`,MeshStandardMaterial:`physical`,MeshPhysicalMaterial:`physical`,MeshMatcapMaterial:`matcap`,LineBasicMaterial:`basic`,LineDashedMaterial:`dashed`,PointsMaterial:`points`,ShadowMaterial:`shadow`,SpriteMaterial:`sprite`},d=`precision.isWebGL2.supportsVertexTextures.outputEncoding.instancing.map.mapEncoding.matcap.matcapEncoding.envMap.envMapMode.envMapEncoding.envMapCubeUV.lightMap.lightMapEncoding.aoMap.emissiveMap.emissiveMapEncoding.bumpMap.normalMap.objectSpaceNormalMap.tangentSpaceNormalMap.clearcoatMap.clearcoatRoughnessMap.clearcoatNormalMap.displacementMap.specularMap.roughnessMap.metalnessMap.gradientMap.alphaMap.combine.vertexColors.vertexTangents.vertexUvs.uvsVertexOnly.fog.useFog.fogExp2.flatShading.sizeAttenuation.logarithmicDepthBuffer.skinning.maxBones.useVertexTexture.morphTargets.morphNormals.maxMorphTargets.maxMorphNormals.premultipliedAlpha.numDirLights.numPointLights.numSpotLights.numHemiLights.numRectAreaLights.numDirLightShadows.numPointLightShadows.numSpotLightShadows.shadowMapEnabled.shadowMapType.toneMapping.physicallyCorrectLights.alphaTest.doubleSided.flipSided.numClippingPlanes.numClipIntersection.depthPacking.dithering.sheen`.split(`.`);function f(e,t){var n;if(t){var r=lu[t];n={name:e.type,uniforms:nu.clone(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader}}else n={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return n}function p(e){var t=e.skeleton.bones;if(o)return 1024;var n=Math.floor((c-20)/4),r=Math.min(n,t.length);return r<t.length?(console.warn(`THREE.WebGLRenderer: Skeleton has `+t.length+` bones. This GPU supports `+r+`.`),0):r}function m(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn(`THREE.WebGLPrograms.getTextureEncodingFromMap: don\'t use render targets as textures. Use their .texture property instead.`),t=e.texture.encoding):t=$s,t}this.getParameters=function(r,c,d,h,g,_,v){var y=h.fog,b=r.isMeshStandardMaterial?h.environment:null,x=r.envMap||b,S=u[r.type],C=v.isSkinnedMesh?p(v):0;r.precision!==null&&(s=n.getMaxPrecision(r.precision),s!==r.precision&&console.warn(`THREE.WebGLProgram.getParameters:`,r.precision,`not supported, using`,s,`instead.`));var w=f(r,S);r.onBeforeCompile(w,e);var T=e.getRenderTarget();return{isWebGL2:i,shaderID:S,shaderName:w.name,uniforms:w.uniforms,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,defines:r.defines,isRawShaderMaterial:r.isRawShaderMaterial,isShaderMaterial:r.isShaderMaterial,precision:s,instancing:v.isInstancedMesh===!0,supportsVertexTextures:l,outputEncoding:T===null?e.outputEncoding:m(T.texture),map:!!r.map,mapEncoding:m(r.map),matcap:!!r.matcap,matcapEncoding:m(r.matcap),envMap:!!x,envMapMode:x&&x.mapping,envMapEncoding:m(x),envMapCubeUV:!!x&&(x.mapping===306||x.mapping===307),lightMap:!!r.lightMap,lightMapEncoding:m(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:m(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:r.normalMapType===1,tangentSpaceNormalMap:r.normalMapType===0,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexUvs:!!r.map||!!r.bumpMap||!!r.normalMap||!!r.specularMap||!!r.alphaMap||!!r.emissiveMap||!!r.roughnessMap||!!r.metalnessMap||!!r.clearcoatMap||!!r.clearcoatRoughnessMap||!!r.clearcoatNormalMap||!!r.displacementMap,uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap)&&!!r.displacementMap,fog:!!y,useFog:r.fog,fogExp2:y&&y.isFogExp2,flatShading:r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:a,skinning:r.skinning&&C>0,maxBones:C,useVertexTexture:o,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:c.directional.length,numPointLights:c.point.length,numSpotLights:c.spot.length,numRectAreaLights:c.rectArea.length,numHemiLights:c.hemi.length,numDirLightShadows:c.directionalShadowMap.length,numPointLightShadows:c.pointShadowMap.length,numSpotLightShadows:c.spotShadowMap.length,numClippingPlanes:g,numClipIntersection:_,dithering:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:r.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===2,flipSided:r.side===1,depthPacking:r.depthPacking===void 0?!1:r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:i||t.get(`EXT_frag_depth`)!==null,rendererExtensionDrawBuffers:i||t.get(`WEBGL_draw_buffers`)!==null,rendererExtensionShaderTextureLod:i||t.get(`EXT_shader_texture_lod`)!==null,onBeforeCompile:r.onBeforeCompile}},this.getProgramCacheKey=function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),t.defines!==void 0)for(var r in t.defines)n.push(r),n.push(t.defines[r]);if(t.isRawShaderMaterial===void 0){for(var i=0;i<d.length;i++)n.push(t[d[i]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.onBeforeCompile.toString()),n.join()},this.acquireProgram=function(t,n){for(var i,a=0,o=r.length;a<o;a++){var s=r[a];if(s.cacheKey===n){i=s,++i.usedTimes;break}}return i===void 0&&(i=new Zt(e,n,t),r.push(i)),i},this.releaseProgram=function(e){if(--e.usedTimes===0){var t=r.indexOf(e);r[t]=r[r.length-1],r.pop(),e.destroy()}},this.programs=r}function $t(){var e=new WeakMap;function t(t){var n=e.get(t);return n===void 0&&(n={},e.set(t,n)),n}function n(t){e.delete(t)}function r(t,n,r){e.get(t)[n]=r}function i(){e=new WeakMap}return{get:t,remove:n,update:r,dispose:i}}function en(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.program===t.program?e.material.id===t.material.id?e.z===t.z?e.id-t.id:e.z-t.z:e.material.id-t.material.id:e.program.id-t.program.id:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function tn(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.z===t.z?e.id-t.id:t.z-e.z:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function nn(){var e=[],t=0,n=[],r=[],i={id:-1};function a(){t=0,n.length=0,r.length=0}function o(n,r,a,o,s,c){var l=e[t];return l===void 0?(l={id:n.id,object:n,geometry:r,material:a,program:a.program||i,groupOrder:o,renderOrder:n.renderOrder,z:s,group:c},e[t]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=a,l.program=a.program||i,l.groupOrder=o,l.renderOrder=n.renderOrder,l.z=s,l.group=c),t++,l}function s(e,t,i,a,s,c){var l=o(e,t,i,a,s,c);(i.transparent===!0?r:n).push(l)}function c(e,t,i,a,s,c){var l=o(e,t,i,a,s,c);(i.transparent===!0?r:n).unshift(l)}function l(e,t){n.length>1&&n.sort(e||en),r.length>1&&r.sort(t||tn)}function u(){for(var n=t,r=e.length;n<r;n++){var i=e[n];if(i.id===null)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}}return{opaque:n,transparent:r,init:a,push:s,unshift:c,finish:u,sort:l}}function rn(){var e=new WeakMap;function t(n){var r=n.target;r.removeEventListener(`dispose`,t),e.delete(r)}function n(n,r){var i=e.get(n),a;return i===void 0?(a=new nn,e.set(n,new WeakMap),e.get(n).set(r,a),n.addEventListener(`dispose`,t)):(a=i.get(r),a===void 0&&(a=new nn,i.set(r,a))),a}function r(){e=new WeakMap}return{get:n,dispose:r}}function an(){var e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];var n;switch(t.type){case`DirectionalLight`:n={direction:new D,color:new z};break;case`SpotLight`:n={position:new D,direction:new D,color:new z,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new D,color:new z,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new D,skyColor:new z,groundColor:new z};break;case`RectAreaLight`:n={color:new z,position:new D,halfWidth:new D,halfHeight:new D};break}return e[t.id]=n,n}}}function on(){var e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];var n;switch(t.type){case`DirectionalLight`:n={shadowBias:0,shadowRadius:1,shadowMapSize:new b};break;case`SpotLight`:n={shadowBias:0,shadowRadius:1,shadowMapSize:new b};break;case`PointLight`:n={shadowBias:0,shadowRadius:1,shadowMapSize:new b,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}function sn(e,t){return!!t.castShadow-+!!e.castShadow}function cn(){for(var e=new an,t=on(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},r=0;r<9;r++)n.probe.push(new D);var i=new D,a=new O,o=new O;function s(r,s,c){for(var l=0,u=0,d=0,f=0;f<9;f++)n.probe[f].set(0,0,0);var p=0,m=0,h=0,g=0,_=0,v=0,y=0,b=0,x=c.matrixWorldInverse;r.sort(sn);for(var f=0,S=r.length;f<S;f++){var C=r[f],w=C.color,T=C.intensity,E=C.distance,D=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)l+=w.r*T,u+=w.g*T,d+=w.b*T;else if(C.isLightProbe)for(var O=0;O<9;O++)n.probe[O].addScaledVector(C.sh.coefficients[O],T);else if(C.isDirectionalLight){var k=e.get(C);if(k.color.copy(C.color).multiplyScalar(C.intensity),k.direction.setFromMatrixPosition(C.matrixWorld),i.setFromMatrixPosition(C.target.matrixWorld),k.direction.sub(i),k.direction.transformDirection(x),C.castShadow){var A=C.shadow,j=t.get(C);j.shadowBias=A.bias,j.shadowRadius=A.radius,j.shadowMapSize=A.mapSize,n.directionalShadow[p]=j,n.directionalShadowMap[p]=D,n.directionalShadowMatrix[p]=C.shadow.matrix,v++}n.directional[p]=k,p++}else if(C.isSpotLight){var k=e.get(C);if(k.position.setFromMatrixPosition(C.matrixWorld),k.position.applyMatrix4(x),k.color.copy(w).multiplyScalar(T),k.distance=E,k.direction.setFromMatrixPosition(C.matrixWorld),i.setFromMatrixPosition(C.target.matrixWorld),k.direction.sub(i),k.direction.transformDirection(x),k.coneCos=Math.cos(C.angle),k.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),k.decay=C.decay,C.castShadow){var A=C.shadow,j=t.get(C);j.shadowBias=A.bias,j.shadowRadius=A.radius,j.shadowMapSize=A.mapSize,n.spotShadow[h]=j,n.spotShadowMap[h]=D,n.spotShadowMatrix[h]=C.shadow.matrix,b++}n.spot[h]=k,h++}else if(C.isRectAreaLight){var k=e.get(C);k.color.copy(w).multiplyScalar(T),k.position.setFromMatrixPosition(C.matrixWorld),k.position.applyMatrix4(x),o.identity(),a.copy(C.matrixWorld),a.premultiply(x),o.extractRotation(a),k.halfWidth.set(C.width*.5,0,0),k.halfHeight.set(0,C.height*.5,0),k.halfWidth.applyMatrix4(o),k.halfHeight.applyMatrix4(o),n.rectArea[g]=k,g++}else if(C.isPointLight){var k=e.get(C);if(k.position.setFromMatrixPosition(C.matrixWorld),k.position.applyMatrix4(x),k.color.copy(C.color).multiplyScalar(C.intensity),k.distance=C.distance,k.decay=C.decay,C.castShadow){var A=C.shadow,j=t.get(C);j.shadowBias=A.bias,j.shadowRadius=A.radius,j.shadowMapSize=A.mapSize,j.shadowCameraNear=A.camera.near,j.shadowCameraFar=A.camera.far,n.pointShadow[m]=j,n.pointShadowMap[m]=D,n.pointShadowMatrix[m]=C.shadow.matrix,y++}n.point[m]=k,m++}else if(C.isHemisphereLight){var k=e.get(C);k.direction.setFromMatrixPosition(C.matrixWorld),k.direction.transformDirection(x),k.direction.normalize(),k.skyColor.copy(C.color).multiplyScalar(T),k.groundColor.copy(C.groundColor).multiplyScalar(T),n.hemi[_]=k,_++}}n.ambient[0]=l,n.ambient[1]=u,n.ambient[2]=d;var M=n.hash;(M.directionalLength!==p||M.pointLength!==m||M.spotLength!==h||M.rectAreaLength!==g||M.hemiLength!==_||M.numDirectionalShadows!==v||M.numPointShadows!==y||M.numSpotShadows!==b)&&(n.directional.length=p,n.spot.length=h,n.rectArea.length=g,n.point.length=m,n.hemi.length=_,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.pointShadow.length=y,n.pointShadowMap.length=y,n.spotShadow.length=b,n.spotShadowMap.length=b,n.directionalShadowMatrix.length=v,n.pointShadowMatrix.length=y,n.spotShadowMatrix.length=b,M.directionalLength=p,M.pointLength=m,M.spotLength=h,M.rectAreaLength=g,M.hemiLength=_,M.numDirectionalShadows=v,M.numPointShadows=y,M.numSpotShadows=b,n.version=wu++)}return{setup:s,state:n}}function ln(){var e=new cn,t=[],n=[];function r(){t.length=0,n.length=0}function i(e){t.push(e)}function a(e){n.push(e)}function o(r){e.setup(t,n,r)}return{init:r,state:{lightsArray:t,shadowsArray:n,lights:e},setupLights:o,pushLight:i,pushShadow:a}}function un(){var e=new WeakMap;function t(n){var r=n.target;r.removeEventListener(`dispose`,t),e.delete(r)}function n(n,r){var i;return e.has(n)===!1?(i=new ln,e.set(n,new WeakMap),e.get(n).set(r,i),n.addEventListener(`dispose`,t)):e.get(n).has(r)===!1?(i=new ln,e.get(n).set(r,i)):i=e.get(n).get(r),i}function r(){e=new WeakMap}return{get:n,dispose:r}}function dn(e){V.call(this),this.type=`MeshDepthMaterial`,this.depthPacking=sc,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}function fn(e){V.call(this),this.type=`MeshDistanceMaterial`,this.referencePosition=new D,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}function pn(e,t,n){var r=new Se,i=new b,a=new b,o=new C,s=[],c=[],l={},u={0:1,1:0,2:2},d=new ge({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new b},radius:{value:4}},vertexShader:Eu,fragmentShader:Tu}),f=d.clone();f.defines.HORIZONAL_PASS=1;var p=new q;p.setAttribute(`position`,new H(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var m=new de(p,d),h=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,s,c){if(h.enabled!==!1&&!(h.autoUpdate===!1&&h.needsUpdate===!1)&&t.length!==0){var l=e.getRenderTarget(),u=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);for(var p=0,m=t.length;p<m;p++){var _=t[p],v=_.shadow;if(v===void 0){console.warn(`THREE.WebGLShadowMap:`,_,`has no shadow.`);continue}i.copy(v.mapSize);var y=v.getFrameExtents();if(i.multiply(y),a.copy(v.mapSize),(i.x>n||i.y>n)&&(i.x>n&&(a.x=Math.floor(n/y.x),i.x=a.x*y.x,v.mapSize.x=a.x),i.y>n&&(a.y=Math.floor(n/y.y),i.y=a.y*y.y,v.mapSize.y=a.y)),v.map===null&&!v.isPointLightShadow&&this.type===3){var b={minFilter:Ko,magFilter:Ko,format:es};v.map=new w(i.x,i.y,b),v.map.texture.name=_.name+`.shadowMap`,v.mapPass=new w(i.x,i.y,b),v.camera.updateProjectionMatrix()}if(v.map===null){var b={minFilter:Uo,magFilter:Uo,format:es};v.map=new w(i.x,i.y,b),v.map.texture.name=_.name+`.shadowMap`,v.camera.updateProjectionMatrix()}e.setRenderTarget(v.map),e.clear();for(var S=v.getViewportCount(),C=0;C<S;C++){var T=v.getViewport(C);o.set(a.x*T.x,a.y*T.y,a.x*T.z,a.y*T.w),f.viewport(o),v.updateMatrices(_,C),r=v.getFrustum(),x(s,c,v.camera,_,this.type)}!v.isPointLightShadow&&this.type===3&&g(v,c)}h.needsUpdate=!1,e.setRenderTarget(l,u,d)}};function g(n,r){var i=t.update(m);d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,i,d,m,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,f,m,null)}function _(e,t,n){var r=e<<0|t<<1|n<<2,i=s[r];return i===void 0&&(i=new dn({depthPacking:cc,morphTargets:e,skinning:t}),s[r]=i),i}function v(e,t,n){var r=e<<0|t<<1|n<<2,i=c[r];return i===void 0&&(i=new fn({morphTargets:e,skinning:t}),c[r]=i),i}function y(t,n,r,i,a,o,s){var c=null,d=_,f=t.customDepthMaterial;if(i.isPointLight===!0&&(d=v,f=t.customDistanceMaterial),f===void 0){var p=!1;r.morphTargets===!0&&(p=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);var m=!1;t.isSkinnedMesh===!0&&(r.skinning===!0?m=!0:console.warn(`THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:`,t));var h=t.isInstancedMesh===!0;c=d(p,m,h)}else c=f;if(e.localClippingEnabled&&r.clipShadows===!0&&r.clippingPlanes.length!==0){var g=c.uuid,y=r.uuid,b=l[g];b===void 0&&(b={},l[g]=b);var x=b[y];x===void 0&&(x=c.clone(),b[y]=x),c=x}return c.visible=r.visible,c.wireframe=r.wireframe,s===3?c.side=r.shadowSide===null?r.side:r.shadowSide:c.side=r.shadowSide===null?u[r.side]:r.shadowSide,c.clipShadows=r.clipShadows,c.clippingPlanes=r.clippingPlanes,c.clipIntersection=r.clipIntersection,c.wireframeLinewidth=r.wireframeLinewidth,c.linewidth=r.linewidth,i.isPointLight===!0&&c.isMeshDistanceMaterial===!0&&(c.referencePosition.setFromMatrixPosition(i.matrixWorld),c.nearDistance=a,c.farDistance=o),c}function x(n,i,a,o,s){if(n.visible!==!1){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var c=t.update(n),l=n.material;if(Array.isArray(l))for(var u=c.groups,d=0,f=u.length;d<f;d++){var p=u[d],m=l[p.materialIndex];if(m&&m.visible){var h=y(n,c,m,o,a.near,a.far,s);e.renderBufferDirect(a,null,c,h,n,p)}}else if(l.visible){var h=y(n,c,l,o,a.near,a.far,s);e.renderBufferDirect(a,null,c,h,n,null)}}for(var g=n.children,_=0,v=g.length;_<v;_++)x(g[_],i,a,o,s)}}}function mn(e,t,n){var r=n.isWebGL2;function i(){var t=!1,n=new C,r=null,i=new C(0,0,0,0);return{setMask:function(n){r!==n&&!t&&(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){s===!0&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),i.equals(n)===!1&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}}function a(){var t=!1,n=null,r=null,i=null;return{setTest:function(e){e?H(2929):U(2929)},setMask:function(r){n!==r&&!t&&(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}}function o(){var t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(e){t||(e?H(2960):U(2960))},setMask:function(r){n!==r&&!t&&(e.stencilMask(r),n=r)},setFunc:function(t,n,o){(r!==t||i!==n||a!==o)&&(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){(o!==t||s!==n||c!==r)&&(e.stencilOp(t,n,r),o=t,s=n,c=r)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null}}}var s=new i,c=new a,l=new o,u=e.getParameter(34921),d=new Uint8Array(u),f=new Uint8Array(u),p=new Uint8Array(u),m={},h=null,g=null,_=null,v=null,y=null,b=null,x=null,S=null,w=null,T=!1,E=null,D=null,O=null,k=null,A=null,j=e.getParameter(35661),M=!1,N=0,P=e.getParameter(7938);P.indexOf(`WebGL`)===-1?P.indexOf(`OpenGL ES`)!==-1&&(N=parseFloat(/^OpenGL\\ ES\\ ([0-9])/.exec(P)[1]),M=N>=2):(N=parseFloat(/^WebGL\\ ([0-9])/.exec(P)[1]),M=N>=1);var F=null,I={},L=new C,R=new C;function z(t,n,r){var i=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o<r;o++)e.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return a}var ee={};ee[3553]=z(3553,3553,1),ee[34067]=z(34067,34069,6),s.setClear(0,0,0,1),c.setClear(1),l.setClear(0),H(2929),c.setFunc(3),K(!1),ce(1),H(2884),oe(0);function te(){for(var e=0,t=d.length;e<t;e++)d[e]=0}function ne(e){B(e,0)}function B(n,i){d[n]=1,f[n]===0&&(e.enableVertexAttribArray(n),f[n]=1),p[n]!==i&&((r?e:t.get(`ANGLE_instanced_arrays`))[r?`vertexAttribDivisor`:`vertexAttribDivisorANGLE`](n,i),p[n]=i)}function V(){for(var t=0,n=f.length;t!==n;++t)f[t]!==d[t]&&(e.disableVertexAttribArray(t),f[t]=0)}function re(t,n,i,a,o,s){r===!0&&(i===5124||i===5125)?e.vertexAttribIPointer(t,n,i,a,o,s):e.vertexAttribPointer(t,n,i,a,o,s)}function H(t){m[t]!==!0&&(e.enable(t),m[t]=!0)}function U(t){m[t]!==!1&&(e.disable(t),m[t]=!1)}function ie(t){return h===t?!1:(e.useProgram(t),h=t,!0)}var W={100:32774,101:32778,102:32779};if(r)W[103]=32775,W[104]=32776;else{var ae=t.get(`EXT_blend_minmax`);ae!==null&&(W[103]=ae.MIN_EXT,W[104]=ae.MAX_EXT)}var G={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function oe(t,n,r,i,a,o,s,c){if(t===0){g&&(U(3042),g=!1);return}if(g||(H(3042),g=!0),t!==5){if(t!==_||c!==T){if((v!==100||x!==100)&&(e.blendEquation(32774),v=100,x=100),c)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,0,769,771);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error(`THREE.WebGLState: Invalid blending: `,t);break}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFunc(0,769);break;case 4:e.blendFunc(0,768);break;default:console.error(`THREE.WebGLState: Invalid blending: `,t);break}y=null,b=null,S=null,w=null,_=t,T=c}return}a=a||n,o=o||r,s=s||i,(n!==v||a!==x)&&(e.blendEquationSeparate(W[n],W[a]),v=n,x=a),(r!==y||i!==b||o!==S||s!==w)&&(e.blendFuncSeparate(G[r],G[i],G[o],G[s]),y=r,b=i,S=o,w=s),_=t,T=null}function se(e,t){e.side===2?U(2884):H(2884);var n=e.side===1;t&&(n=!n),K(n),e.blending===1&&e.transparent===!1?oe(0):oe(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),c.setFunc(e.depthFunc),c.setTest(e.depthTest),c.setMask(e.depthWrite),s.setMask(e.colorWrite);var r=e.stencilWrite;l.setTest(r),r&&(l.setMask(e.stencilWriteMask),l.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),l.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),ue(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function K(t){E!==t&&(t?e.frontFace(2304):e.frontFace(2305),E=t)}function ce(t){t===0?U(2884):(H(2884),t!==D&&(t===1?e.cullFace(1029):t===2?e.cullFace(1028):e.cullFace(1032))),D=t}function le(t){t!==O&&(M&&e.lineWidth(t),O=t)}function ue(t,n,r){t?(H(32823),(k!==n||A!==r)&&(e.polygonOffset(n,r),k=n,A=r)):U(32823)}function q(e){e?H(3089):U(3089)}function de(t){t===void 0&&(t=33984+j-1),F!==t&&(e.activeTexture(t),F=t)}function fe(t,n){F===null&&de();var r=I[F];r===void 0&&(r={type:void 0,texture:void 0},I[F]=r),(r.type!==t||r.texture!==n)&&(e.bindTexture(t,n||ee[t]),r.type=t,r.texture=n)}function pe(){var t=I[F];t!==void 0&&t.type!==void 0&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)}function J(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function me(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function he(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function ge(t){L.equals(t)===!1&&(e.scissor(t.x,t.y,t.z,t.w),L.copy(t))}function _e(t){R.equals(t)===!1&&(e.viewport(t.x,t.y,t.z,t.w),R.copy(t))}function ve(){for(var t=0;t<f.length;t++)f[t]===1&&(e.disableVertexAttribArray(t),f[t]=0);m={},F=null,I={},h=null,_=null,E=null,D=null,s.reset(),c.reset(),l.reset()}return{buffers:{color:s,depth:c,stencil:l},initAttributes:te,enableAttribute:ne,enableAttributeAndDivisor:B,disableUnusedAttributes:V,vertexAttribPointer:re,enable:H,disable:U,useProgram:ie,setBlending:oe,setMaterial:se,setFlipSided:K,setCullFace:ce,setLineWidth:le,setPolygonOffset:ue,setScissorTest:q,activeTexture:de,bindTexture:fe,unbindTexture:pe,compressedTexImage2D:J,texImage2D:me,texImage3D:he,scissor:ge,viewport:_e,reset:ve}}function hn(e,t,n,r,i,a,o){var s=i.isWebGL2,c=i.maxTextures,l=i.maxCubemapSize,u=i.maxTextureSize,d=i.maxSamples,f=new WeakMap,p,m=!1;try{m=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch(e){}function h(e,t){return m?new OffscreenCanvas(e,t):document.createElementNS(`http://www.w3.org/1999/xhtml`,`canvas`)}function g(e,t,n,r){var i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||t===!0)if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){var a=t?X.floorPowerOfTwo:Math.floor,o=a(i*e.width),s=a(i*e.height);p===void 0&&(p=h(o,s));var c=n?h(o,s):p;return c.width=o,c.height=s,c.getContext(`2d`).drawImage(e,0,0,o,s),console.warn(`THREE.WebGLRenderer: Texture has been resized from (`+e.width+`x`+e.height+`) to (`+o+`x`+s+`).`),c}else return`data`in e&&console.warn(`THREE.WebGLRenderer: Image in DataTexture is too big (`+e.width+`x`+e.height+`).`),e;return e}function _(e){return X.isPowerOfTwo(e.width)&&X.isPowerOfTwo(e.height)}function v(e){return s?!1:e.wrapS!==1001||e.wrapT!==1001||e.minFilter!==1003&&e.minFilter!==1006}function y(e,t){return e.generateMipmaps&&t&&e.minFilter!==1003&&e.minFilter!==1006}function b(t,n,i,a){e.generateMipmap(t);var o=r.get(n);o.__maxMipLevel=Math.log(Math.max(i,a))*Math.LOG2E}function x(n,r,i){if(s===!1)return r;if(n!==null){if(e[n]!==void 0)return e[n];console.warn(`THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'`+n+`\'`)}var a=r;return r===6403&&(i===5126&&(a=33326),i===5131&&(a=33325),i===5121&&(a=33321)),r===6407&&(i===5126&&(a=34837),i===5131&&(a=34843),i===5121&&(a=32849)),r===6408&&(i===5126&&(a=34836),i===5131&&(a=34842),i===5121&&(a=32856)),(a===33325||a===33326||a===34842||a===34836)&&t.get(`EXT_color_buffer_float`),a}function S(e){return e===1003||e===1004||e===1005?9728:9729}function C(e){var t=e.target;t.removeEventListener(`dispose`,C),T(t),t.isVideoTexture&&f.delete(t),o.memory.textures--}function w(e){var t=e.target;t.removeEventListener(`dispose`,w),E(t),o.memory.textures--}function T(t){var n=r.get(t);n.__webglInit!==void 0&&(e.deleteTexture(n.__webglTexture),r.remove(t))}function E(t){var n=r.get(t),i=r.get(t.texture);if(t){if(i.__webglTexture!==void 0&&e.deleteTexture(i.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);r.remove(t.texture),r.remove(t)}}var D=0;function O(){D=0}function k(){var e=D;return e>=c&&console.warn(`THREE.WebGLTextures: Trying to use `+e+` texture units while this GPU supports only `+c),D+=1,e}function A(e,t){var i=r.get(e);if(e.isVideoTexture&&ie(e),e.version>0&&i.__version!==e.version){var a=e.image;if(a===void 0)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is undefined`);else if(a.complete===!1)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is incomplete`);else{z(i,e,t);return}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}function j(e,t){var i=r.get(e);if(e.version>0&&i.__version!==e.version){z(i,e,t);return}n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture)}function M(e,t){var i=r.get(e);if(e.version>0&&i.__version!==e.version){z(i,e,t);return}n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture)}function N(t,i){if(t.image.length===6){var o=r.get(t);if(t.version>0&&o.__version!==t.version){R(o,t),n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture),e.pixelStorei(37440,t.flipY);for(var c=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),u=t.image[0]&&t.image[0].isDataTexture,d=[],f=0;f<6;f++)!c&&!u?d[f]=g(t.image[f],!1,!0,l):d[f]=u?t.image[f].image:t.image[f];var p=d[0],m=_(p)||s,h=a.convert(t.format),v=a.convert(t.type),S=x(t.internalFormat,h,v);L(34067,t,m);var C;if(c){for(var f=0;f<6;f++){C=d[f].mipmaps;for(var w=0;w<C.length;w++){var T=C[w];t.format!==1023&&t.format!==1022?h===null?console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()`):n.compressedTexImage2D(34069+f,w,S,T.width,T.height,0,T.data):n.texImage2D(34069+f,w,S,T.width,T.height,0,h,v,T.data)}}o.__maxMipLevel=C.length-1}else{C=t.mipmaps;for(var f=0;f<6;f++)if(u){n.texImage2D(34069+f,0,S,d[f].width,d[f].height,0,h,v,d[f].data);for(var w=0;w<C.length;w++){var T=C[w],E=T.image[f].image;n.texImage2D(34069+f,w+1,S,E.width,E.height,0,h,v,E.data)}}else{n.texImage2D(34069+f,0,S,h,v,d[f]);for(var w=0;w<C.length;w++){var T=C[w];n.texImage2D(34069+f,w+1,S,h,v,T.image[f])}}o.__maxMipLevel=C.length}y(t,m)&&b(34067,t,p.width,p.height),o.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture)}}function P(e,t){n.activeTexture(33984+t),n.bindTexture(34067,r.get(e).__webglTexture)}var F={[Bo]:10497,[Vo]:33071,[Ho]:33648},I={[Uo]:9728,[Wo]:9984,[Go]:9986,[Ko]:9729,[qo]:9985,[Jo]:9987};function L(n,a,o){o?(e.texParameteri(n,10242,F[a.wrapS]),e.texParameteri(n,10243,F[a.wrapT]),(n===32879||n===35866)&&e.texParameteri(n,32882,F[a.wrapR]),e.texParameteri(n,10240,I[a.magFilter]),e.texParameteri(n,10241,I[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),(n===32879||n===35866)&&e.texParameteri(n,32882,33071),(a.wrapS!==1001||a.wrapT!==1001)&&console.warn(`THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.`),e.texParameteri(n,10240,S(a.magFilter)),e.texParameteri(n,10241,S(a.minFilter)),a.minFilter!==1003&&a.minFilter!==1006&&console.warn(`THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.`));var c=t.get(`EXT_texture_filter_anisotropic`);if(c){if(a.type===1015&&t.get(`OES_texture_float_linear`)===null||a.type===1016&&(s||t.get(`OES_texture_half_float_linear`))===null)return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function R(t,n){t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,C),t.__webglTexture=e.createTexture(),o.memory.textures++)}function z(t,r,i){var o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),R(t,r),n.activeTexture(33984+i),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment);var c=v(r)&&_(r.image)===!1,l=g(r.image,c,!1,u),d=_(l)||s,f=a.convert(r.format),p=a.convert(r.type),m=x(r.internalFormat,f,p);L(o,r,d);var h,S=r.mipmaps;if(r.isDepthTexture)m=6402,s?m=r.type===1015?36012:r.type===1014?33190:r.type===1020?35056:33189:r.type===1015&&console.error(`WebGLRenderer: Floating point depth texture requires WebGL2.`),r.format===1026&&m===6402&&r.type!==1012&&r.type!==1014&&(console.warn(`THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.`),r.type=Xo,p=a.convert(r.type)),r.format===1027&&m===6402&&(m=34041,r.type!==1020&&(console.warn(`THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.`),r.type=Qo,p=a.convert(r.type))),n.texImage2D(3553,0,m,l.width,l.height,0,f,p,null);else if(r.isDataTexture)if(S.length>0&&d){for(var C=0,w=S.length;C<w;C++)h=S[C],n.texImage2D(3553,C,m,h.width,h.height,0,f,p,h.data);r.generateMipmaps=!1,t.__maxMipLevel=S.length-1}else n.texImage2D(3553,0,m,l.width,l.height,0,f,p,l.data),t.__maxMipLevel=0;else if(r.isCompressedTexture){for(var C=0,w=S.length;C<w;C++)h=S[C],r.format!==1023&&r.format!==1022?f===null?console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`):n.compressedTexImage2D(3553,C,m,h.width,h.height,0,h.data):n.texImage2D(3553,C,m,h.width,h.height,0,f,p,h.data);t.__maxMipLevel=S.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,m,l.width,l.height,l.depth,0,f,p,l.data),t.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,m,l.width,l.height,l.depth,0,f,p,l.data),t.__maxMipLevel=0;else if(S.length>0&&d){for(var C=0,w=S.length;C<w;C++)h=S[C],n.texImage2D(3553,C,m,f,p,h);r.generateMipmaps=!1,t.__maxMipLevel=S.length-1}else n.texImage2D(3553,0,m,f,p,l),t.__maxMipLevel=0;y(r,d)&&b(o,r,l.width,l.height),t.__version=r.version,r.onUpdate&&r.onUpdate(r)}function ee(t,i,o,s){var c=a.convert(i.texture.format),l=a.convert(i.texture.type),u=x(i.texture.internalFormat,c,l);n.texImage2D(s,0,u,i.width,i.height,0,c,l,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,s,r.get(i.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function te(t,n,r){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var i=33189;if(r){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===1015?i=36012:o.type===1014&&(i=33190));var s=U(n);e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(r){var s=U(n);e.renderbufferStorageMultisample(36161,s,35056,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var c=a.convert(n.texture.format),l=a.convert(n.texture.type),i=x(n.texture.internalFormat,c,l);if(r){var s=U(n);e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height)}e.bindRenderbuffer(36161,null)}function ne(t,n){if(n&&n.isWebGLCubeRenderTarget)throw Error(`Depth Texture with cube render targets is not supported`);if(e.bindFramebuffer(36160,t),!(n.depthTexture&&n.depthTexture.isDepthTexture))throw Error(`renderTarget.depthTexture must be an instance of THREE.DepthTexture`);(!r.get(n.depthTexture).__webglTexture||n.depthTexture.image.width!==n.width||n.depthTexture.image.height!==n.height)&&(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),A(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===1026)e.framebufferTexture2D(36160,36096,3553,i,0);else if(n.depthTexture.format===1027)e.framebufferTexture2D(36160,33306,3553,i,0);else throw Error(`Unknown depthTexture format`)}function B(t){var n=r.get(t),i=t.isWebGLCubeRenderTarget===!0;if(t.depthTexture){if(i)throw Error(`target.depthTexture not supported in Cube render targets`);ne(n.__webglFramebuffer,t)}else if(i){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=e.createRenderbuffer(),te(n.__webglDepthbuffer[a],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),te(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function V(t){var i=r.get(t),c=r.get(t.texture);t.addEventListener(`dispose`,w),c.__webglTexture=e.createTexture(),o.memory.textures++;var l=t.isWebGLCubeRenderTarget===!0,u=t.isWebGLMultisampleRenderTarget===!0,d=_(t)||s;if(s&&t.texture.format===1022&&(t.texture.type===1015||t.texture.type===1016)&&(t.texture.format=es,console.warn(`THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.`)),l){i.__webglFramebuffer=[];for(var f=0;f<6;f++)i.__webglFramebuffer[f]=e.createFramebuffer()}else if(i.__webglFramebuffer=e.createFramebuffer(),u)if(s){i.__webglMultisampledFramebuffer=e.createFramebuffer(),i.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,i.__webglColorRenderbuffer);var p=a.convert(t.texture.format),m=a.convert(t.texture.type),h=x(t.texture.internalFormat,p,m),g=U(t);e.renderbufferStorageMultisample(36161,g,h,t.width,t.height),e.bindFramebuffer(36160,i.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,i.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(i.__webglDepthRenderbuffer=e.createRenderbuffer(),te(i.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn(`THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.`);if(l){n.bindTexture(34067,c.__webglTexture),L(34067,t.texture,d);for(var f=0;f<6;f++)ee(i.__webglFramebuffer[f],t,36064,34069+f);y(t.texture,d)&&b(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,c.__webglTexture),L(3553,t.texture,d),ee(i.__webglFramebuffer,t,36064,3553),y(t.texture,d)&&b(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&B(t)}function re(e){var t=e.texture;if(y(t,_(e)||s)){var i=e.isWebGLCubeRenderTarget?34067:3553,a=r.get(t).__webglTexture;n.bindTexture(i,a),b(i,t,e.width,e.height),n.bindTexture(i,null)}}function H(t){if(t.isWebGLMultisampleRenderTarget)if(s){var n=r.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var i=t.width,a=t.height,o=16384;t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024),e.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn(`THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.`)}function U(e){return s&&e.isWebGLMultisampleRenderTarget?Math.min(d,e.samples):0}function ie(e){var t=o.render.frame;f.get(e)!==t&&(f.set(e,t),e.update())}var W=!1,ae=!1;function G(e,t){e&&e.isWebGLRenderTarget&&(W===!1&&(console.warn(`THREE.WebGLTextures.safeSetTexture2D: don\'t use render targets as textures. Use their .texture property instead.`),W=!0),e=e.texture),A(e,t)}function oe(e,t){e&&e.isWebGLCubeRenderTarget&&(ae===!1&&(console.warn(`THREE.WebGLTextures.safeSetTextureCube: don\'t use cube render targets as textures. Use their .texture property instead.`),ae=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&e.image.length===6?N(e,t):P(e,t)}this.allocateTextureUnit=k,this.resetTextureUnits=O,this.setTexture2D=A,this.setTexture2DArray=j,this.setTexture3D=M,this.setTextureCube=N,this.setTextureCubeDynamic=P,this.setupRenderTarget=V,this.updateRenderTargetMipmap=re,this.updateMultisampleRenderTarget=H,this.safeSetTexture2D=G,this.safeSetTextureCube=oe}function gn(e,t,n){var r=n.isWebGL2;function i(e){var n;if(e===1009)return 5121;if(e===1017)return 32819;if(e===1018)return 32820;if(e===1019)return 33635;if(e===1010)return 5120;if(e===1011)return 5122;if(e===1012)return 5123;if(e===1013)return 5124;if(e===1014)return 5125;if(e===1015)return 5126;if(e===1016)return r?5131:(n=t.get(`OES_texture_half_float`),n===null?null:n.HALF_FLOAT_OES);if(e===1021)return 6406;if(e===1022)return 6407;if(e===1023)return 6408;if(e===1024)return 6409;if(e===1025)return 6410;if(e===1026)return 6402;if(e===1027)return 34041;if(e===1028)return 6403;if(e===1029)return 36244;if(e===1030)return 33319;if(e===1031)return 33320;if(e===1032)return 36248;if(e===1033)return 36249;if(e===33776||e===33777||e===33778||e===33779)if(n=t.get(`WEBGL_compressed_texture_s3tc`),n!==null){if(e===33776)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===33777)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===33778)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===33779)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===35840||e===35841||e===35842||e===35843)if(n=t.get(`WEBGL_compressed_texture_pvrtc`),n!==null){if(e===35840)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===35841)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===35842)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===35843)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===36196)return n=t.get(`WEBGL_compressed_texture_etc1`),n===null?null:n.COMPRESSED_RGB_ETC1_WEBGL;if((e===37492||e===37496)&&(n=t.get(`WEBGL_compressed_texture_etc`),n!==null)){if(e===37492)return n.COMPRESSED_RGB8_ETC2;if(e===37496)return n.COMPRESSED_RGBA8_ETC2_EAC}if(e===37808||e===37809||e===37810||e===37811||e===37812||e===37813||e===37814||e===37815||e===37816||e===37817||e===37818||e===37819||e===37820||e===37821||e===37840||e===37841||e===37842||e===37843||e===37844||e===37845||e===37846||e===37847||e===37848||e===37849||e===37850||e===37851||e===37852||e===37853)return n=t.get(`WEBGL_compressed_texture_astc`),n===null?null:e;if(e===36492)return n=t.get(`EXT_texture_compression_bptc`),n===null?null:e;if(e===1020)return r?34042:(n=t.get(`WEBGL_depth_texture`),n===null?null:n.UNSIGNED_INT_24_8_WEBGL)}return{convert:i}}function _n(e){ve.call(this),this.cameras=e||[]}function vn(){j.call(this),this.type=`Group`}function yn(){this._targetRay=null,this._grip=null}function bn(e,t){var n=this,r=null,i=1,a=null,o=`local-floor`,s=null,c=[],l=new Map,u=new ve;u.layers.enable(1),u.viewport=new C;var d=new ve;d.layers.enable(2),d.viewport=new C;var f=[u,d],p=new _n;p.layers.enable(1),p.layers.enable(2);var m=null,h=null;this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=c[e];return t===void 0&&(t=new yn,c[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){var t=c[e];return t===void 0&&(t=new yn,c[e]=t),t.getGripSpace()};function g(e){var t=l.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}function _(){l.forEach(function(e,t){e.disconnect(t)}),l.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),O.stop(),n.isPresenting=!1,n.dispatchEvent({type:`sessionend`})}function v(e){a=e,O.setContext(r),O.start(),n.isPresenting=!0,n.dispatchEvent({type:`sessionstart`})}this.setFramebufferScaleFactor=function(e){i=e,n.isPresenting===!0&&console.warn(`THREE.WebXRManager: Cannot change framebuffer scale while presenting.`)},this.setReferenceSpaceType=function(e){o=e,n.isPresenting===!0&&console.warn(`THREE.WebXRManager: Cannot change reference space type while presenting.`)},this.getReferenceSpace=function(){return a},this.getSession=function(){return r},this.setSession=function(e){if(r=e,r!==null){r.addEventListener(`select`,g),r.addEventListener(`selectstart`,g),r.addEventListener(`selectend`,g),r.addEventListener(`squeeze`,g),r.addEventListener(`squeezestart`,g),r.addEventListener(`squeezeend`,g),r.addEventListener(`end`,_);var n=t.getContextAttributes();n.xrCompatible!==!0&&t.makeXRCompatible();var a={antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:i},s=new XRWebGLLayer(r,t,a);r.updateRenderState({baseLayer:s}),r.requestReferenceSpace(o).then(v),r.addEventListener(`inputsourceschange`,y)}};function y(e){for(var t=r.inputSources,n=0;n<c.length;n++)l.set(t[n],c[n]);for(var n=0;n<e.removed.length;n++){var i=e.removed[n],a=l.get(i);a&&(a.dispatchEvent({type:`disconnected`,data:i}),l.delete(i))}for(var n=0;n<e.added.length;n++){var i=e.added[n],a=l.get(i);a&&a.dispatchEvent({type:`connected`,data:i})}}var b=new D,x=new D;function S(e,t,n){b.setFromMatrixPosition(t.matrixWorld),x.setFromMatrixPosition(n.matrixWorld);var r=b.distanceTo(x),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var g=o+m,_=s+m,v=f-h,y=p+(r-h),S=c*s/_*g,C=l*s/_*g;e.projectionMatrix.makePerspective(v,y,S,C,g,_)}function w(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){p.near=d.near=u.near=e.near,p.far=d.far=u.far=e.far,(m!==p.near||h!==p.far)&&(r.updateRenderState({depthNear:p.near,depthFar:p.far}),m=p.near,h=p.far);var t=e.parent,n=p.cameras;w(p,t);for(var i=0;i<n.length;i++)w(n[i],t);e.matrixWorld.copy(p.matrixWorld);for(var a=e.children,i=0,o=a.length;i<o;i++)a[i].updateMatrixWorld(!0);return n.length===2?S(p,u,d):p.projectionMatrix.copy(u.projectionMatrix),p};var T=null;function E(t,n){if(s=n.getViewerPose(a),s!==null){var i=s.views,o=r.renderState.baseLayer;e.setFramebuffer(o.framebuffer);var l=!1;i.length!==p.cameras.length&&(p.cameras.length=0,l=!0);for(var u=0;u<i.length;u++){var d=i[u],m=o.getViewport(d),h=f[u];h.matrix.fromArray(d.transform.matrix),h.projectionMatrix.fromArray(d.projectionMatrix),h.viewport.set(m.x,m.y,m.width,m.height),u===0&&p.matrix.copy(h.matrix),l===!0&&p.cameras.push(h)}}for(var g=r.inputSources,u=0;u<c.length;u++){var _=c[u],v=g[u];_.update(v,n,a)}T&&T(t,n)}var O=new Ce;O.setAnimationLoop(E),this.setAnimationLoop=function(e){T=e},this.dispose=function(){}}function xn(e){function t(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}function n(e,t,n,_,v){t.isMeshBasicMaterial?r(e,t):t.isMeshLambertMaterial?(r(e,t),c(e,t)):t.isMeshToonMaterial?(r(e,t),u(e,t)):t.isMeshPhongMaterial?(r(e,t),l(e,t)):t.isMeshStandardMaterial?(r(e,t,n),t.isMeshPhysicalMaterial?f(e,t,n):d(e,t,n)):t.isMeshMatcapMaterial?(r(e,t),p(e,t)):t.isMeshDepthMaterial?(r(e,t),m(e,t)):t.isMeshDistanceMaterial?(r(e,t),h(e,t)):t.isMeshNormalMaterial?(r(e,t),g(e,t)):t.isLineBasicMaterial?(i(e,t),t.isLineDashedMaterial&&a(e,t)):t.isPointsMaterial?o(e,t,_,v):t.isSpriteMaterial?s(e,t):t.isShadowMaterial?(e.color.value.copy(t.color),e.opacity.value=t.opacity):t.isShaderMaterial&&(t.uniformsNeedUpdate=!1)}function r(t,n,r){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map),n.alphaMap&&(t.alphaMap.value=n.alphaMap),n.specularMap&&(t.specularMap.value=n.specularMap);var i=n.envMap||r;i&&(t.envMap.value=i,t.flipEnvMap.value=i.isCubeTexture?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio,t.maxMipLevel.value=e.get(i).__maxMipLevel),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity);var a;n.map?a=n.map:n.specularMap?a=n.specularMap:n.displacementMap?a=n.displacementMap:n.normalMap?a=n.normalMap:n.bumpMap?a=n.bumpMap:n.roughnessMap?a=n.roughnessMap:n.metalnessMap?a=n.metalnessMap:n.alphaMap?a=n.alphaMap:n.emissiveMap&&(a=n.emissiveMap),a!==void 0&&(a.isWebGLRenderTarget&&(a=a.texture),a.matrixAutoUpdate===!0&&a.updateMatrix(),t.uvTransform.value.copy(a.matrix));var o;n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),o!==void 0&&(o.isWebGLRenderTarget&&(o=o.texture),o.matrixAutoUpdate===!0&&o.updateMatrix(),t.uv2Transform.value.copy(o.matrix))}function i(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}function a(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function o(e,t,n,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=r*.5,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap);var i;t.map?i=t.map:t.alphaMap&&(i=t.alphaMap),i!==void 0&&(i.matrixAutoUpdate===!0&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}function s(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),n!==void 0&&(n.matrixAutoUpdate===!0&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}function c(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}function l(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function d(e,t,n){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||n)&&(e.envMapIntensity.value=t.envMapIntensity)}function f(e,t,n){d(e,t,n),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen),t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===1&&e.clearcoatNormalScale.value.negate()),e.transparency.value=t.transparency}function p(e,t){t.matcap&&(e.matcap.value=t.matcap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function m(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function h(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}function g(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}return{refreshFogUniforms:t,refreshMaterialUniforms:n}}function Sn(e){e=e||{};var t=e.canvas===void 0?document.createElementNS(`http://www.w3.org/1999/xhtml`,`canvas`):e.canvas,n=e.context===void 0?null:e.context,r=e.alpha===void 0?!1:e.alpha,i=e.depth===void 0?!0:e.depth,a=e.stencil===void 0?!0:e.stencil,o=e.antialias===void 0?!1:e.antialias,s=e.premultipliedAlpha===void 0?!0:e.premultipliedAlpha,c=e.preserveDrawingBuffer===void 0?!1:e.preserveDrawingBuffer,l=e.powerPreference===void 0?`default`:e.powerPreference,u=e.failIfMajorPerformanceCaveat===void 0?!1:e.failIfMajorPerformanceCaveat,d=null,f=null;this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=$s,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var p=this,m=!1,h=null,g=0,_=0,v=null,y=null,x=-1,S={geometry:null,program:null,wireframe:!1},w=null,T=null,E=new C,k=new C,A=null,j=t.width,N=t.height,P=1,F=null,I=null,L=new C(0,0,j,N),R=new C(0,0,j,N),z=!1,ee=new Se,te=new Ae,ne=!1,B=!1,V=new O,re=new D;function H(){return v===null?P:1}var U;try{var ie={alpha:r,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(t.addEventListener(`webglcontextlost`,Te,!1),t.addEventListener(`webglcontextrestored`,Ee,!1),U=n||t.getContext(`webgl`,ie)||t.getContext(`experimental-webgl`,ie),U===null)throw t.getContext(`webgl`)===null?Error(`Error creating WebGL context.`):Error(`Error creating WebGL context with your selected attributes.`);U.getShaderPrecisionFormat===void 0&&(U.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error(`THREE.WebGLRenderer: `+e.message),e}var W,ae,G,oe,se,K,ce,le,ue,q,de,fe,pe,J,me,he,ge,_e;function ve(){W=new je(U),ae=new ke(U,W,e),ae.isWebGL2===!1&&(W.get(`WEBGL_depth_texture`),W.get(`OES_texture_float`),W.get(`OES_texture_half_float`),W.get(`OES_texture_half_float_linear`),W.get(`OES_standard_derivatives`),W.get(`OES_element_index_uint`),W.get(`ANGLE_instanced_arrays`)),W.get(`OES_texture_float_linear`),_e=new gn(U,W,ae),G=new mn(U,W,ae),G.scissor(k.copy(R).multiplyScalar(P).floor()),G.viewport(E.copy(L).multiplyScalar(P).floor()),oe=new Pe(U),se=new $t,K=new hn(U,W,G,se,ae,_e,oe),ce=new we(U,ae),le=new Me(U,ce,oe),ue=new Le(U,le,ce,oe),me=new Ie(U),q=new Qt(p,W,ae),de=new xn(se),fe=new rn,pe=new un,J=new De(p,G,ue,s),he=new Oe(U,W,oe,ae),ge=new Ne(U,W,oe,ae),oe.programs=q.programs,p.capabilities=ae,p.extensions=W,p.properties=se,p.renderLists=fe,p.state=G,p.info=oe}ve();var ye=new bn(p,U);this.xr=ye;var be=new pn(p,ue,ae.maxTextureSize);this.shadowMap=be,this.getContext=function(){return U},this.getContextAttributes=function(){return U.getContextAttributes()},this.forceContextLoss=function(){var e=W.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){var e=W.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(e){e!==void 0&&(P=e,this.setSize(j,N,!1))},this.getSize=function(e){return e===void 0&&(console.warn(`WebGLRenderer: .getsize() now requires a Vector2 as an argument`),e=new b),e.set(j,N)},this.setSize=function(e,n,r){if(ye.isPresenting){console.warn(`THREE.WebGLRenderer: Can\'t change size while VR device is presenting.`);return}j=e,N=n,t.width=Math.floor(e*P),t.height=Math.floor(n*P),r!==!1&&(t.style.width=e+`px`,t.style.height=n+`px`),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e===void 0&&(console.warn(`WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument`),e=new b),e.set(j*P,N*P).floor()},this.setDrawingBufferSize=function(e,n,r){j=e,N=n,P=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e===void 0&&(console.warn(`WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument`),e=new C),e.copy(E)},this.getViewport=function(e){return e.copy(L)},this.setViewport=function(e,t,n,r){e.isVector4?L.set(e.x,e.y,e.z,e.w):L.set(e,t,n,r),G.viewport(E.copy(L).multiplyScalar(P).floor())},this.getScissor=function(e){return e.copy(R)},this.setScissor=function(e,t,n,r){e.isVector4?R.set(e.x,e.y,e.z,e.w):R.set(e,t,n,r),G.scissor(k.copy(R).multiplyScalar(P).floor())},this.getScissorTest=function(){return z},this.setScissorTest=function(e){G.setScissorTest(z=e)},this.setOpaqueSort=function(e){F=e},this.setTransparentSort=function(e){I=e},this.getClearColor=function(){return J.getClearColor()},this.setClearColor=function(){J.setClearColor.apply(J,arguments)},this.getClearAlpha=function(){return J.getClearAlpha()},this.setClearAlpha=function(){J.setClearAlpha.apply(J,arguments)},this.clear=function(e,t,n){var r=0;(e===void 0||e)&&(r|=16384),(t===void 0||t)&&(r|=256),(n===void 0||n)&&(r|=1024),U.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener(`webglcontextlost`,Te,!1),t.removeEventListener(`webglcontextrestored`,Ee,!1),fe.dispose(),pe.dispose(),se.dispose(),ue.dispose(),ye.dispose(),Ge.stop()};function Te(e){e.preventDefault(),console.log(`THREE.WebGLRenderer: Context Lost.`),m=!0}function Ee(){console.log(`THREE.WebGLRenderer: Context Restored.`),m=!1,ve()}function Fe(e){var t=e.target;t.removeEventListener(`dispose`,Fe),Re(t)}function Re(e){ze(e),se.remove(e)}function ze(e){var t=se.get(e).program;e.program=void 0,t!==void 0&&q.releaseProgram(t)}function Be(e,t){e.render(function(e){p.renderBufferImmediate(e,t)})}this.renderBufferImmediate=function(e,t){G.initAttributes();var n=se.get(e);e.hasPositions&&!n.position&&(n.position=U.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=U.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=U.createBuffer()),e.hasColors&&!n.color&&(n.color=U.createBuffer());var r=t.getAttributes();e.hasPositions&&(U.bindBuffer(34962,n.position),U.bufferData(34962,e.positionArray,35048),G.enableAttribute(r.position),U.vertexAttribPointer(r.position,3,5126,!1,0,0)),e.hasNormals&&(U.bindBuffer(34962,n.normal),U.bufferData(34962,e.normalArray,35048),G.enableAttribute(r.normal),U.vertexAttribPointer(r.normal,3,5126,!1,0,0)),e.hasUvs&&(U.bindBuffer(34962,n.uv),U.bufferData(34962,e.uvArray,35048),G.enableAttribute(r.uv),U.vertexAttribPointer(r.uv,2,5126,!1,0,0)),e.hasColors&&(U.bindBuffer(34962,n.color),U.bufferData(34962,e.colorArray,35048),G.enableAttribute(r.color),U.vertexAttribPointer(r.color,3,5126,!1,0,0)),G.disableUnusedAttributes(),U.drawArrays(4,0,e.count),e.count=0};var Ve=new M;this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=Ve);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=Xe(e,t,r,i);G.setMaterial(r,o);var c=!1;(S.geometry!==n.id||S.program!==s.id||S.wireframe!==(r.wireframe===!0))&&(S.geometry=n.id,S.program=s.id,S.wireframe=r.wireframe===!0,c=!0),(r.morphTargets||r.morphNormals)&&(me.update(i,n,r,s),c=!0),i.isInstancedMesh===!0&&(c=!0);var l=n.index,u=n.attributes.position;if(l===null){if(u===void 0||u.count===0)return}else if(l.count===0)return;var d=1;r.wireframe===!0&&(l=le.getWireframeAttribute(n),d=2);var f,p=he;l!==null&&(f=ce.get(l),p=ge,p.setIndex(f)),c&&(He(i,n,r,s),l!==null&&U.bindBuffer(34963,f.buffer));var m=l===null?u.count:l.count,h=n.drawRange.start*d,g=n.drawRange.count*d,_=a===null?0:a.start*d,v=a===null?1/0:a.count*d,y=Math.max(h,_),b=Math.min(m,h+g,_+v)-1,x=Math.max(0,b-y+1);if(x!==0){if(i.isMesh)r.wireframe===!0?(G.setLineWidth(r.wireframeLinewidth*H()),p.setMode(1)):p.setMode(4);else if(i.isLine){var C=r.linewidth;C===void 0&&(C=1),G.setLineWidth(C*H()),i.isLineSegments?p.setMode(1):i.isLineLoop?p.setMode(2):p.setMode(3)}else i.isPoints?p.setMode(0):i.isSprite&&p.setMode(4);if(i.isInstancedMesh)p.renderInstances(n,y,x,i.count);else if(n.isInstancedBufferGeometry){var w=Math.min(n.instanceCount,n._maxInstanceCount);p.renderInstances(n,y,x,w)}else p.render(y,x)}};function He(e,t,n,r){if(!(ae.isWebGL2===!1&&(e.isInstancedMesh||t.isInstancedBufferGeometry)&&W.get(`ANGLE_instanced_arrays`)===null)){G.initAttributes();var i=t.attributes,a=r.getAttributes(),o=n.defaultAttributeValues;for(var s in a){var c=a[s];if(c>=0){var l=i[s];if(l!==void 0){var u=l.normalized,d=l.itemSize,f=ce.get(l);if(f===void 0)continue;var p=f.buffer,m=f.type,h=f.bytesPerElement;if(l.isInterleavedBufferAttribute){var g=l.data,_=g.stride,v=l.offset;g&&g.isInstancedInterleavedBuffer?(G.enableAttributeAndDivisor(c,g.meshPerAttribute),t._maxInstanceCount===void 0&&(t._maxInstanceCount=g.meshPerAttribute*g.count)):G.enableAttribute(c),U.bindBuffer(34962,p),G.vertexAttribPointer(c,d,m,u,_*h,v*h)}else l.isInstancedBufferAttribute?(G.enableAttributeAndDivisor(c,l.meshPerAttribute),t._maxInstanceCount===void 0&&(t._maxInstanceCount=l.meshPerAttribute*l.count)):G.enableAttribute(c),U.bindBuffer(34962,p),G.vertexAttribPointer(c,d,m,u,0,0)}else if(s===`instanceMatrix`){var f=ce.get(e.instanceMatrix);if(f===void 0)continue;var p=f.buffer,m=f.type;G.enableAttributeAndDivisor(c+0,1),G.enableAttributeAndDivisor(c+1,1),G.enableAttributeAndDivisor(c+2,1),G.enableAttributeAndDivisor(c+3,1),U.bindBuffer(34962,p),U.vertexAttribPointer(c+0,4,m,!1,64,0),U.vertexAttribPointer(c+1,4,m,!1,64,16),U.vertexAttribPointer(c+2,4,m,!1,64,32),U.vertexAttribPointer(c+3,4,m,!1,64,48)}else if(o!==void 0){var y=o[s];if(y!==void 0)switch(y.length){case 2:U.vertexAttrib2fv(c,y);break;case 3:U.vertexAttrib3fv(c,y);break;case 4:U.vertexAttrib4fv(c,y);break;default:U.vertexAttrib1fv(c,y)}}}}G.disableUnusedAttributes()}}this.compile=function(e,t){f=pe.get(e,t),f.init(),e.traverse(function(e){e.isLight&&(f.pushLight(e),e.castShadow&&f.pushShadow(e))}),f.setupLights(t);let n={};e.traverse(function(t){let r=t.material;if(r)if(Array.isArray(r))for(let i=0;i<r.length;i++){let a=r[i];a.uuid in n||(Ye(a,e,t),n[a.uuid]=!0)}else r.uuid in n||(Ye(r,e,t),n[r.uuid]=!0)})};var Ue=null;function We(e){ye.isPresenting||Ue&&Ue(e)}var Ge=new Ce;Ge.setAnimationLoop(We),typeof window<`u`&&Ge.setContext(window),this.setAnimationLoop=function(e){Ue=e,ye.setAnimationLoop(e),Ge.start()},this.render=function(e,t){var n,r;if(arguments[2]!==void 0&&(console.warn(`THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.`),n=arguments[2]),arguments[3]!==void 0&&(console.warn(`THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead.`),r=arguments[3]),!(t&&t.isCamera)){console.error(`THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(!m){S.geometry=null,S.program=null,S.wireframe=!1,x=-1,w=null,e.autoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.updateMatrixWorld(),ye.enabled&&ye.isPresenting&&(t=ye.getCamera(t)),e.onBeforeRender(p,e,t,n||v),f=pe.get(e,t),f.init(),V.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ee.setFromProjectionMatrix(V),B=this.localClippingEnabled,ne=te.init(this.clippingPlanes,B,t),d=fe.get(e,t),d.init(),Ke(e,t,0,p.sortObjects),d.finish(),p.sortObjects===!0&&d.sort(F,I),ne&&te.beginShadows();var i=f.state.shadowsArray;be.render(i,e,t),f.setupLights(t),ne&&te.endShadows(),this.info.autoReset&&this.info.reset(),n!==void 0&&this.setRenderTarget(n),J.render(d,e,t,r);var a=d.opaque,o=d.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&qe(a,e,t,s),o.length&&qe(o,e,t,s)}else a.length&&qe(a,e,t),o.length&&qe(o,e,t);e.onAfterRender(p,e,t),v!==null&&(K.updateRenderTargetMipmap(v),K.updateMultisampleRenderTarget(v)),G.buffers.depth.setTest(!0),G.buffers.depth.setMask(!0),G.buffers.color.setMask(!0),G.setPolygonOffset(!1),d=null,f=null}};function Ke(e,t,n,r){if(e.visible!==!1){if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)f.pushLight(e),e.castShadow&&f.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ee.intersectsSprite(e)){r&&re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V);var i=ue.update(e),a=e.material;a.visible&&d.push(e,i,a,n,re.z,null)}}else if(e.isImmediateRenderObject)r&&re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V),d.push(e,null,e.material,n,re.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==oe.render.frame&&(e.skeleton.update(),e.skeleton.frame=oe.render.frame),!e.frustumCulled||ee.intersectsObject(e))){r&&re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V);var i=ue.update(e),a=e.material;if(Array.isArray(a))for(var o=i.groups,s=0,c=o.length;s<c;s++){var l=o[s],u=a[l.materialIndex];u&&u.visible&&d.push(e,i,u,n,re.z,l)}else a.visible&&d.push(e,i,a,n,re.z,null)}}for(var p=e.children,s=0,c=p.length;s<c;s++)Ke(p[s],t,n,r)}}function qe(e,t,n,r){for(var i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,c=o.geometry,l=r===void 0?o.material:r,u=o.group;if(n.isArrayCamera){T=n;for(var d=n.cameras,p=0,m=d.length;p<m;p++){var h=d[p];s.layers.test(h.layers)&&(G.viewport(E.copy(h.viewport)),f.setupLights(h),Je(s,t,h,c,l,u))}}else T=null,Je(s,t,n,c,l,u)}}function Je(e,t,n,r,i,a){if(e.onBeforeRender(p,t,n,r,i,a),f=pe.get(t,T||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var o=Xe(n,t,i,e);G.setMaterial(i),S.geometry=null,S.program=null,S.wireframe=!1,Be(e,o)}else p.renderBufferDirect(n,t,r,i,e,a);e.onAfterRender(p,t,n,r,i,a),f=pe.get(t,T||n)}function Ye(e,t,n){var r=se.get(e),i=f.state.lights,a=f.state.shadowsArray,o=i.state.version,s=q.getParameters(e,i.state,a,t,te.numPlanes,te.numIntersection,n),c=q.getProgramCacheKey(s),l=r.program,u=!0;if(l===void 0)e.addEventListener(`dispose`,Fe);else if(l.cacheKey!==c)ze(e);else if(r.lightsStateVersion!==o)r.lightsStateVersion=o,u=!1;else if(s.shaderID!==void 0)return;else u=!1;u&&(l=q.acquireProgram(s,c),r.program=l,r.uniforms=s.uniforms,r.outputEncoding=s.outputEncoding,e.program=l);var d=l.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var m=0;m<p.maxMorphTargets;m++)d[`morphTarget`+m]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var m=0;m<p.maxMorphNormals;m++)d[`morphNormal`+m]>=0&&e.numSupportedMorphNormals++}var h=r.uniforms;(!e.isShaderMaterial&&!e.isRawShaderMaterial||e.clipping===!0)&&(r.numClippingPlanes=te.numPlanes,r.numIntersection=te.numIntersection,h.clippingPlanes=te.uniform),r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.needsLights=Qe(e),r.lightsStateVersion=o,r.needsLights&&(h.ambientLightColor.value=i.state.ambient,h.lightProbe.value=i.state.probe,h.directionalLights.value=i.state.directional,h.directionalLightShadows.value=i.state.directionalShadow,h.spotLights.value=i.state.spot,h.spotLightShadows.value=i.state.spotShadow,h.rectAreaLights.value=i.state.rectArea,h.pointLights.value=i.state.point,h.pointLightShadows.value=i.state.pointShadow,h.hemisphereLights.value=i.state.hemi,h.directionalShadowMap.value=i.state.directionalShadowMap,h.directionalShadowMatrix.value=i.state.directionalShadowMatrix,h.spotShadowMap.value=i.state.spotShadowMap,h.spotShadowMatrix.value=i.state.spotShadowMatrix,h.pointShadowMap.value=i.state.pointShadowMap,h.pointShadowMatrix.value=i.state.pointShadowMatrix);var g=r.program.getUniforms();r.uniformsList=Dt.seqWithValue(g.seq,h)}function Xe(e,t,n,r){K.resetTextureUnits();var i=t.fog,a=n.isMeshStandardMaterial?t.environment:null,o=v===null?p.outputEncoding:v.texture.encoding,s=se.get(n),c=f.state.lights;if(ne&&(B||e!==w)){var l=e===w&&n.id===x;te.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,s,l)}n.version===s.__version?s.program===void 0||n.fog&&s.fog!==i?Ye(n,t,r):s.environment===a?(s.needsLights&&s.lightsStateVersion!==c.state.version||s.numClippingPlanes!==void 0&&(s.numClippingPlanes!==te.numPlanes||s.numIntersection!==te.numIntersection)||s.outputEncoding!==o)&&Ye(n,t,r):Ye(n,t,r):(Ye(n,t,r),s.__version=n.version);var u=!1,d=!1,m=!1,h=s.program,g=h.getUniforms(),_=s.uniforms;if(G.useProgram(h.program)&&(u=!0,d=!0,m=!0),n.id!==x&&(x=n.id,d=!0),u||w!==e){if(g.setValue(U,`projectionMatrix`,e.projectionMatrix),ae.logarithmicDepthBuffer&&g.setValue(U,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),w!==e&&(w=e,d=!0,m=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var y=g.map.cameraPosition;y!==void 0&&y.setValue(U,re.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&g.setValue(U,`isOrthographic`,e.isOrthographicCamera===!0),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&g.setValue(U,`viewMatrix`,e.matrixWorldInverse)}if(n.skinning){g.setOptional(U,r,`bindMatrix`),g.setOptional(U,r,`bindMatrixInverse`);var b=r.skeleton;if(b){var S=b.bones;if(ae.floatVertexTextures){if(b.boneTexture===void 0){var C=Math.sqrt(S.length*4);C=X.ceilPowerOfTwo(C),C=Math.max(C,4);var T=new Float32Array(C*C*4);T.set(b.boneMatrices);var E=new xe(T,C,C,es,Zo);b.boneMatrices=T,b.boneTexture=E,b.boneTextureSize=C}g.setValue(U,`boneTexture`,b.boneTexture,K),g.setValue(U,`boneTextureSize`,b.boneTextureSize)}else g.setOptional(U,b,`boneMatrices`)}}return(d||s.receiveShadow!==r.receiveShadow)&&(s.receiveShadow=r.receiveShadow,g.setValue(U,`receiveShadow`,r.receiveShadow)),d&&(g.setValue(U,`toneMappingExposure`,p.toneMappingExposure),g.setValue(U,`toneMappingWhitePoint`,p.toneMappingWhitePoint),s.needsLights&&Ze(_,m),i&&n.fog&&de.refreshFogUniforms(_,i),de.refreshMaterialUniforms(_,n,a,P,N),_.ltc_1!==void 0&&(_.ltc_1.value=Z.LTC_1),_.ltc_2!==void 0&&(_.ltc_2.value=Z.LTC_2),Dt.upload(U,s.uniformsList,_,K)),n.isShaderMaterial&&n.uniformsNeedUpdate===!0&&(Dt.upload(U,s.uniformsList,_,K),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&g.setValue(U,`center`,r.center),g.setValue(U,`modelViewMatrix`,r.modelViewMatrix),g.setValue(U,`normalMatrix`,r.normalMatrix),g.setValue(U,`modelMatrix`,r.matrixWorld),h}function Ze(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function Qe(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&e.lights===!0}this.setFramebuffer=function(e){h!==e&&v===null&&U.bindFramebuffer(36160,e),h=e},this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return v},this.setRenderTarget=function(e,t,n){v=e,g=t,_=n,e&&se.get(e).__webglFramebuffer===void 0&&K.setupRenderTarget(e);var r=h,i=!1;if(e){var a=se.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=a[t||0],i=!0):r=e.isWebGLMultisampleRenderTarget?se.get(e).__webglMultisampledFramebuffer:a,E.copy(e.viewport),k.copy(e.scissor),A=e.scissorTest}else E.copy(L).multiplyScalar(P).floor(),k.copy(R).multiplyScalar(P).floor(),A=z;if(y!==r&&(U.bindFramebuffer(36160,r),y=r),G.viewport(E),G.scissor(k),G.setScissorTest(A),i){var o=se.get(e.texture);U.framebufferTexture2D(36160,36064,34069+(t||0),o.__webglTexture,n||0)}},this.readRenderTargetPixels=function(e,t,n,r,i,a,o){if(!(e&&e.isWebGLRenderTarget)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}var s=se.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(s=s[o]),s){var c=!1;s!==y&&(U.bindFramebuffer(36160,s),c=!0);try{var l=e.texture,u=l.format,d=l.type;if(u!==1023&&_e.convert(u)!==U.getParameter(35739)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(d!==1009&&_e.convert(d)!==U.getParameter(35738)&&!(d===1015&&(ae.isWebGL2||W.get(`OES_texture_float`)||W.get(`WEBGL_color_buffer_float`)))&&!(d===1016&&(ae.isWebGL2?W.get(`EXT_color_buffer_float`):W.get(`EXT_color_buffer_half_float`)))){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}U.checkFramebufferStatus(36160)===36053?t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&U.readPixels(t,n,r,i,_e.convert(u),_e.convert(d),a):console.error(`THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.`)}finally{c&&U.bindFramebuffer(36160,y)}}},this.copyFramebufferToTexture=function(e,t,n){n===void 0&&(n=0);var r=Math.pow(2,-n),i=Math.floor(t.image.width*r),a=Math.floor(t.image.height*r),o=_e.convert(t.format);K.setTexture2D(t,0),U.copyTexImage2D(3553,n,o,e.x,e.y,i,a,0),G.unbindTexture()},this.copyTextureToTexture=function(e,t,n,r){r===void 0&&(r=0);var i=t.image.width,a=t.image.height,o=_e.convert(n.format),s=_e.convert(n.type);K.setTexture2D(n,0),t.isDataTexture?U.texSubImage2D(3553,r,e.x,e.y,i,a,o,s,t.image.data):t.isCompressedTexture?U.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):U.texSubImage2D(3553,r,e.x,e.y,o,s,t.image),r===0&&n.generateMipmaps&&U.generateMipmap(3553),G.unbindTexture()},this.initTexture=function(e){K.setTexture2D(e,0),G.unbindTexture()},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}function Cn(e,t){this.name=``,this.color=new z(e),this.density=t===void 0?25e-5:t}function wn(e,t,n){this.name=``,this.color=new z(e),this.near=t===void 0?1:t,this.far=n===void 0?1e3:n}function Tn(e,t){this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=uc,this.updateRange={offset:0,count:-1},this.version=0}function En(e,t,n,r){this.name=``,this.data=e,this.itemSize=t,this.offset=n,this.normalized=r===!0}function Dn(e){V.call(this),this.type=`SpriteMaterial`,this.color=new z(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}function On(e){if(j.call(this),this.type=`Sprite`,Ou===void 0){Ou=new q;var t=new Tn(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Ou.setIndex([0,1,2,0,2,3]),Ou.setAttribute(`position`,new En(t,3,0,!1)),Ou.setAttribute(`uv`,new En(t,2,3,!1))}this.geometry=Ou,this.material=e===void 0?new Dn:e,this.center=new b(.5,.5)}function kn(e,t,n,r,i,a){Mu.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?Nu.copy(Mu):(Nu.x=a*Mu.x-i*Mu.y,Nu.y=i*Mu.x+a*Mu.y),e.copy(t),e.x+=Nu.x,e.y+=Nu.y,e.applyMatrix4(Pu)}function An(){j.call(this),this._currentLevel=0,this.type=`LOD`,Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function jn(e,t){e&&e.isGeometry&&console.error(`THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`),de.call(this,e,t),this.type=`SkinnedMesh`,this.bindMode=`attached`,this.bindMatrix=new O,this.bindMatrixInverse=new O}function Mn(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(this.bones.length*16),this.frame=-1,t===void 0)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn(`THREE.Skeleton boneInverses is the wrong length.`),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new O)}}function Nn(){j.call(this),this.type=`Bone`}function Pn(e,t,n){de.call(this,e,t),this.instanceMatrix=new H(new Float32Array(n*16),16),this.count=n,this.frustumCulled=!1}function Fn(e){V.call(this),this.type=`LineBasicMaterial`,this.color=new z(16777215),this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.morphTargets=!1,this.setValues(e)}function In(e,t,n){n===1&&console.error(`THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead.`),j.call(this),this.type=`Line`,this.geometry=e===void 0?new q:e,this.material=t===void 0?new Fn:t,this.updateMorphTargets()}function Ln(e,t){In.call(this,e,t),this.type=`LineSegments`}function Rn(e,t){In.call(this,e,t),this.type=`LineLoop`}function zn(e){V.call(this),this.type=`PointsMaterial`,this.color=new z(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}function Bn(e,t){j.call(this),this.type=`Points`,this.geometry=e===void 0?new q:e,this.material=t===void 0?new zn:t,this.updateMorphTargets()}function Vn(e,t,n,r,i,a,o){var s=rd.distanceSqToPoint(e);if(s<n){var c=new D;rd.closestPointToPoint(e,c),c.applyMatrix4(r);var l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:c,index:t,face:null,object:o})}}function Hn(e,t,n,r,i,a,o,s,c){S.call(this,e,t,n,r,i,a,o,s,c),this.format=o===void 0?$o:o,this.minFilter=a===void 0?Ko:a,this.magFilter=i===void 0?Ko:i,this.generateMipmaps=!1}function Un(e,t,n,r,i,a,o,s,c,l,u,d){S.call(this,null,a,o,s,c,l,r,i,u,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Wn(e,t,n,r,i,a,o,s,c){S.call(this,e,t,n,r,i,a,o,s,c),this.needsUpdate=!0}function Gn(e,t,n,r,i,a,o,s,c,l){if(l=l===void 0?ns:l,l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);n===void 0&&l===1026&&(n=Xo),n===void 0&&l===1027&&(n=Qo),S.call(this,null,r,i,a,o,s,l,n,c),this.image={width:e,height:t},this.magFilter=o===void 0?Uo:o,this.minFilter=s===void 0?Uo:s,this.flipY=!1,this.generateMipmaps=!1}function Kn(e){q.call(this),this.type=`WireframeGeometry`;var t=[],n,r,i,a,o,s=[0,0],c={},l,u,d,f,p=[`a`,`b`,`c`],m;if(e&&e.isGeometry){var h=e.faces;for(n=0,i=h.length;n<i;n++){var g=h[n];for(r=0;r<3;r++)u=g[p[r]],d=g[p[(r+1)%3]],s[0]=Math.min(u,d),s[1]=Math.max(u,d),f=s[0]+`,`+s[1],c[f]===void 0&&(c[f]={index1:s[0],index2:s[1]})}for(f in c)l=c[f],m=e.vertices[l.index1],t.push(m.x,m.y,m.z),m=e.vertices[l.index2],t.push(m.x,m.y,m.z)}else if(e&&e.isBufferGeometry){var _,v,y,b,x,S,C,w;if(m=new D,e.index!==null){for(_=e.attributes.position,v=e.index,y=e.groups,y.length===0&&(y=[{start:0,count:v.count,materialIndex:0}]),a=0,o=y.length;a<o;++a)for(b=y[a],x=b.start,S=b.count,n=x,i=x+S;n<i;n+=3)for(r=0;r<3;r++)u=v.getX(n+r),d=v.getX(n+(r+1)%3),s[0]=Math.min(u,d),s[1]=Math.max(u,d),f=s[0]+`,`+s[1],c[f]===void 0&&(c[f]={index1:s[0],index2:s[1]});for(f in c)l=c[f],m.fromBufferAttribute(_,l.index1),t.push(m.x,m.y,m.z),m.fromBufferAttribute(_,l.index2),t.push(m.x,m.y,m.z)}else for(_=e.attributes.position,n=0,i=_.count/3;n<i;n++)for(r=0;r<3;r++)C=3*n+r,m.fromBufferAttribute(_,C),t.push(m.x,m.y,m.z),w=3*n+(r+1)%3,m.fromBufferAttribute(_,w),t.push(m.x,m.y,m.z)}this.setAttribute(`position`,new K(t,3))}function qn(e,t,n){J.call(this),this.type=`ParametricGeometry`,this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new Jn(e,t,n)),this.mergeVertices()}function Jn(e,t,n){q.call(this),this.type=`ParametricBufferGeometry`,this.parameters={func:e,slices:t,stacks:n};var r=[],i=[],a=[],o=[],s=1e-5,c=new D,l=new D,u=new D,d=new D,f=new D,p,m;e.length<3&&console.error(`THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.`);var h=t+1;for(p=0;p<=n;p++){var g=p/n;for(m=0;m<=t;m++){var _=m/t;e(_,g,l),i.push(l.x,l.y,l.z),_-s>=0?(e(_-s,g,u),d.subVectors(l,u)):(e(_+s,g,u),d.subVectors(u,l)),g-s>=0?(e(_,g-s,u),f.subVectors(l,u)):(e(_,g+s,u),f.subVectors(u,l)),c.crossVectors(d,f).normalize(),a.push(c.x,c.y,c.z),o.push(_,g)}}for(p=0;p<n;p++)for(m=0;m<t;m++){var v=p*h+m,y=p*h+m+1,b=(p+1)*h+m+1,x=(p+1)*h+m;r.push(v,y,x),r.push(y,b,x)}this.setIndex(r),this.setAttribute(`position`,new K(i,3)),this.setAttribute(`normal`,new K(a,3)),this.setAttribute(`uv`,new K(o,2))}function Yn(e,t,n,r){J.call(this),this.type=`PolyhedronGeometry`,this.parameters={vertices:e,indices:t,radius:n,detail:r},this.fromBufferGeometry(new Xn(e,t,n,r)),this.mergeVertices()}function Xn(e,t,n,r){q.call(this),this.type=`PolyhedronBufferGeometry`,this.parameters={vertices:e,indices:t,radius:n,detail:r},n=n||1,r=r||0;var i=[],a=[];o(r),c(n),l(),this.setAttribute(`position`,new K(i,3)),this.setAttribute(`normal`,new K(i.slice(),3)),this.setAttribute(`uv`,new K(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(e){for(var n=new D,r=new D,i=new D,a=0;a<t.length;a+=3)f(t[a+0],n),f(t[a+1],r),f(t[a+2],i),s(n,r,i,e)}function s(e,t,n,r){var i=Math.pow(2,r),a=[],o,s;for(o=0;o<=i;o++){a[o]=[];var c=e.clone().lerp(n,o/i),l=t.clone().lerp(n,o/i),u=i-o;for(s=0;s<=u;s++)s===0&&o===i?a[o][s]=c:a[o][s]=c.clone().lerp(l,s/u)}for(o=0;o<i;o++)for(s=0;s<2*(i-o)-1;s++){var f=Math.floor(s/2);s%2==0?(d(a[o][f+1]),d(a[o+1][f]),d(a[o][f])):(d(a[o][f+1]),d(a[o+1][f+1]),d(a[o+1][f]))}}function c(e){for(var t=new D,n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}function l(){for(var e=new D,t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];var n=h(e)/2/Math.PI+.5,r=g(e)/Math.PI+.5;a.push(n,1-r)}p(),u()}function u(){for(var e=0;e<a.length;e+=6){var t=a[e+0],n=a[e+2],r=a[e+4];Math.max(t,n,r)>.9&&Math.min(t,n,r)<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}function d(e){i.push(e.x,e.y,e.z)}function f(t,n){var r=t*3;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function p(){for(var e=new D,t=new D,n=new D,r=new D,o=new b,s=new b,c=new b,l=0,u=0;l<i.length;l+=9,u+=6){e.set(i[l+0],i[l+1],i[l+2]),t.set(i[l+3],i[l+4],i[l+5]),n.set(i[l+6],i[l+7],i[l+8]),o.set(a[u+0],a[u+1]),s.set(a[u+2],a[u+3]),c.set(a[u+4],a[u+5]),r.copy(e).add(t).add(n).divideScalar(3);var d=h(r);m(o,u+0,e,d),m(s,u+2,t,d),m(c,u+4,n,d)}}function m(e,t,n,r){r<0&&e.x===1&&(a[t]=e.x-1),n.x===0&&n.z===0&&(a[t]=r/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}function g(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}}function Zn(e,t){J.call(this),this.type=`TetrahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Qn(e,t)),this.mergeVertices()}function Qn(e,t){Xn.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type=`TetrahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function $n(e,t){J.call(this),this.type=`OctahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new er(e,t)),this.mergeVertices()}function er(e,t){Xn.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type=`OctahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function tr(e,t){J.call(this),this.type=`IcosahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new nr(e,t)),this.mergeVertices()}function nr(e,t){var n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];Xn.call(this,r,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type=`IcosahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function rr(e,t){J.call(this),this.type=`DodecahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ir(e,t)),this.mergeVertices()}function ir(e,t){var n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r];Xn.call(this,i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type=`DodecahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function ar(e,t,n,r,i,a){J.call(this),this.type=`TubeGeometry`,this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},a!==void 0&&console.warn(`THREE.TubeGeometry: taper has been removed.`);var o=new or(e,t,n,r,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function or(e,t,n,r,i){q.call(this),this.type=`TubeBufferGeometry`,this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},t=t||64,n=n||1,r=r||8,i=i||!1;var a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o=new D,s=new D,c=new b,l=new D,u,d,f=[],p=[],m=[],h=[];g(),this.setIndex(h),this.setAttribute(`position`,new K(f,3)),this.setAttribute(`normal`,new K(p,3)),this.setAttribute(`uv`,new K(m,2));function g(){for(u=0;u<t;u++)_(u);_(i===!1?t:0),y(),v()}function _(i){l=e.getPointAt(i/t,l);var c=a.normals[i],u=a.binormals[i];for(d=0;d<=r;d++){var m=d/r*Math.PI*2,h=Math.sin(m),g=-Math.cos(m);s.x=g*c.x+h*u.x,s.y=g*c.y+h*u.y,s.z=g*c.z+h*u.z,s.normalize(),p.push(s.x,s.y,s.z),o.x=l.x+n*s.x,o.y=l.y+n*s.y,o.z=l.z+n*s.z,f.push(o.x,o.y,o.z)}}function v(){for(d=1;d<=t;d++)for(u=1;u<=r;u++){var e=(r+1)*(d-1)+(u-1),n=(r+1)*d+(u-1),i=(r+1)*d+u,a=(r+1)*(d-1)+u;h.push(e,n,a),h.push(n,i,a)}}function y(){for(u=0;u<=t;u++)for(d=0;d<=r;d++)c.x=u/t,c.y=d/r,m.push(c.x,c.y)}}function sr(e,t,n,r,i,a,o){J.call(this),this.type=`TorusKnotGeometry`,this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},o!==void 0&&console.warn(`THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.`),this.fromBufferGeometry(new cr(e,t,n,r,i,a)),this.mergeVertices()}function cr(e,t,n,r,i,a){q.call(this),this.type=`TorusKnotBufferGeometry`,this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,a=a||3;var o=[],s=[],c=[],l=[],u,d,f=new D,p=new D,m=new D,h=new D,g=new D,_=new D,v=new D;for(u=0;u<=n;++u){var y=u/n*i*Math.PI*2;for(O(y,i,a,e,m),O(y+.01,i,a,e,h),_.subVectors(h,m),v.addVectors(h,m),g.crossVectors(_,v),v.crossVectors(g,_),g.normalize(),v.normalize(),d=0;d<=r;++d){var b=d/r*Math.PI*2,x=-t*Math.cos(b),S=t*Math.sin(b);f.x=m.x+(x*v.x+S*g.x),f.y=m.y+(x*v.y+S*g.y),f.z=m.z+(x*v.z+S*g.z),s.push(f.x,f.y,f.z),p.subVectors(f,m).normalize(),c.push(p.x,p.y,p.z),l.push(u/n),l.push(d/r)}}for(d=1;d<=n;d++)for(u=1;u<=r;u++){var C=(r+1)*(d-1)+(u-1),w=(r+1)*d+(u-1),T=(r+1)*d+u,E=(r+1)*(d-1)+u;o.push(C,w,E),o.push(w,T,E)}this.setIndex(o),this.setAttribute(`position`,new K(s,3)),this.setAttribute(`normal`,new K(c,3)),this.setAttribute(`uv`,new K(l,2));function O(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,c=Math.cos(s);i.x=r*(2+c)*.5*a,i.y=r*(2+c)*o*.5,i.z=r*Math.sin(s)*.5}}function lr(e,t,n,r,i){J.call(this),this.type=`TorusGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new ur(e,t,n,r,i)),this.mergeVertices()}function ur(e,t,n,r,i){q.call(this),this.type=`TorusBufferGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},e=e||1,t=t||.4,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||Math.PI*2;var a=[],o=[],s=[],c=[],l=new D,u=new D,d=new D,f,p;for(f=0;f<=n;f++)for(p=0;p<=r;p++){var m=p/r*i,h=f/n*Math.PI*2;u.x=(e+t*Math.cos(h))*Math.cos(m),u.y=(e+t*Math.cos(h))*Math.sin(m),u.z=t*Math.sin(h),o.push(u.x,u.y,u.z),l.x=e*Math.cos(m),l.y=e*Math.sin(m),d.subVectors(u,l).normalize(),s.push(d.x,d.y,d.z),c.push(p/r),c.push(f/n)}for(f=1;f<=n;f++)for(p=1;p<=r;p++){var g=(r+1)*f+p-1,_=(r+1)*(f-1)+p-1,v=(r+1)*(f-1)+p,y=(r+1)*f+p;a.push(g,_,y),a.push(_,v,y)}this.setIndex(a),this.setAttribute(`position`,new K(o,3)),this.setAttribute(`normal`,new K(s,3)),this.setAttribute(`uv`,new K(c,2))}function dr(e,t,n,r,i){var a,o;if(i===Vr(e,t,n,r)>0)for(a=t;a<n;a+=r)o=Rr(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=Rr(a,e[a],e[a+1],o);return o&&Ar(o,o.next)&&(zr(o),o=o.next),o}function fr(e,t){if(!e)return e;t||(t=e);var n=e,r;do if(r=!1,!n.steiner&&(Ar(n,n.next)||kr(n.prev,n,n.next)===0)){if(zr(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function pr(e,t,n,r,i,a,o){if(e){!o&&a&&Cr(e,r,i,a);for(var s=e,c,l;e.prev!==e.next;){if(c=e.prev,l=e.next,a?hr(e,r,i,a):mr(e)){t.push(c.i/n),t.push(e.i/n),t.push(l.i/n),zr(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=gr(fr(e),t,n),pr(e,t,n,r,i,a,2)):o===2&&_r(e,t,n,r,i,a):pr(fr(e),t,n,r,i,a,1);break}}}}function mr(e){var t=e.prev,n=e,r=e.next;if(kr(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(Dr(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&kr(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function hr(e,t,n,r){var i=e.prev,a=e,o=e.next;if(kr(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,c=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,l=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,d=Tr(s,c,t,n,r),f=Tr(l,u,t,n,r),p=e.prevZ,m=e.nextZ;p&&p.z>=d&&m&&m.z<=f;){if(p!==e.prev&&p!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&kr(p.prev,p,p.next)>=0||(p=p.prevZ,m!==e.prev&&m!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&kr(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;p&&p.z>=d;){if(p!==e.prev&&p!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&kr(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;m&&m.z<=f;){if(m!==e.prev&&m!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&kr(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function gr(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!Ar(i,a)&&jr(i,r,r.next,a)&&Fr(i,a)&&Fr(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),zr(r),zr(r.next),r=e=a),r=r.next}while(r!==e);return fr(r)}function _r(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Or(o,s)){var c=Lr(o,s);o=fr(o,o.next),c=fr(c,c.next),pr(o,t,n,r,i,a),pr(c,t,n,r,i,a);return}s=s.next}o=o.next}while(o!==e)}function vr(e,t,n,r){var i=[],a,o,s,c,l;for(a=0,o=t.length;a<o;a++)s=t[a]*r,c=a<o-1?t[a+1]*r:e.length,l=dr(e,s,c,r,!1),l===l.next&&(l.steiner=!0),i.push(Er(l));for(i.sort(yr),a=0;a<i.length;a++)br(i[a],n),n=fr(n,n.next);return n}function yr(e,t){return e.x-t.x}function br(e,t){if(t=xr(e,t),t){var n=Lr(t,e);fr(t,t.next),fr(n,n.next)}}function xr(e,t){var n=t,r=e.x,i=e.y,a=-1/0,o;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a){if(a=s,s===r){if(i===n.y)return n;if(i===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!o)return null;if(r===a)return o;var c=o,l=o.x,u=o.y,d=1/0,f;n=o;do r>=n.x&&n.x>=l&&r!==n.x&&Dr(i<u?r:a,i,l,u,i<u?a:r,i,n.x,n.y)&&(f=Math.abs(i-n.y)/(r-n.x),Fr(n,e)&&(f<d||f===d&&(n.x>o.x||n.x===o.x&&Sr(o,n)))&&(o=n,d=f)),n=n.next;while(n!==c);return o}function Sr(e,t){return kr(e.prev,e,t.prev)<0&&kr(t.next,e,e.next)<0}function Cr(e,t,n,r){var i=e;do i.z===null&&(i.z=Tr(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,wr(i)}function wr(e){var t,n,r,i,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<l&&(s++,r=r.nextZ,r);t++);for(c=l;s>0||c>0&&r;)s!==0&&(c===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1);return e}function Tr(e,t,n,r,i){return e=32767*(e-n)*i,t=32767*(t-r)*i,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Er(e){var t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Dr(e,t,n,r,i,a,o,s){return(i-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function Or(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Pr(e,t)&&(Fr(e,t)&&Fr(t,e)&&Ir(e,t)&&(kr(e.prev,e,t.prev)||kr(e,t.prev,t))||Ar(e,t)&&kr(e.prev,e,e.next)>0&&kr(t.prev,t,t.next)>0)}function kr(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ar(e,t){return e.x===t.x&&e.y===t.y}function jr(e,t,n,r){var i=Nr(kr(e,t,n)),a=Nr(kr(e,t,r)),o=Nr(kr(n,r,e)),s=Nr(kr(n,r,t));return!!(i!==a&&o!==s||i===0&&Mr(e,n,t)||a===0&&Mr(e,r,t)||o===0&&Mr(n,e,r)||s===0&&Mr(n,t,r))}function Mr(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Nr(e){return e>0?1:e<0?-1:0}function Pr(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&jr(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Fr(e,t){return kr(e.prev,e,e.next)<0?kr(e,t,e.next)>=0&&kr(e,e.prev,t)>=0:kr(e,t,e.prev)<0||kr(e,e.next,t)<0}function Ir(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Lr(e,t){var n=new Br(e.i,e.x,e.y),r=new Br(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Rr(e,t,n,r){var i=new Br(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function zr(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Br(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Vr(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}function Hr(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Ur(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function Wr(e,t){J.call(this),this.type=`ExtrudeGeometry`,this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Gr(e,t)),this.mergeVertices()}function Gr(e,t){q.call(this),this.type=`ExtrudeBufferGeometry`,this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var n=this,r=[],i=[],a=0,o=e.length;a<o;a++){var s=e[a];c(s)}this.setAttribute(`position`,new K(r,3)),this.setAttribute(`uv`,new K(i,2)),this.computeVertexNormals();function c(e){var a=[],o=t.curveSegments===void 0?12:t.curveSegments,s=t.steps===void 0?1:t.steps,c=t.depth===void 0?100:t.depth,l=t.bevelEnabled===void 0?!0:t.bevelEnabled,u=t.bevelThickness===void 0?6:t.bevelThickness,d=t.bevelSize===void 0?u-2:t.bevelSize,f=t.bevelOffset===void 0?0:t.bevelOffset,p=t.bevelSegments===void 0?3:t.bevelSegments,m=t.extrudePath,h=t.UVGenerator===void 0?cd:t.UVGenerator;t.amount!==void 0&&(console.warn(`THREE.ExtrudeBufferGeometry: amount has been renamed to depth.`),c=t.amount);var g,_=!1,v,y,x,S;m&&(g=m.getSpacedPoints(s),_=!0,l=!1,v=m.computeFrenetFrames(s,!1),y=new D,x=new D,S=new D),l||(p=0,u=0,d=0,f=0);var C,w,T,E=e.extractPoints(o),O=E.shape,k=E.holes;if(!sd.isClockWise(O))for(O=O.reverse(),w=0,T=k.length;w<T;w++)C=k[w],sd.isClockWise(C)&&(k[w]=C.reverse());var A=sd.triangulateShape(O,k),j=O;for(w=0,T=k.length;w<T;w++)C=k[w],O=O.concat(C);function M(e,t,n){return t||console.error(`THREE.ExtrudeGeometry: vec does not exist`),t.clone().multiplyScalar(n).add(e)}var N,P,F,I,L,R=O.length,z,ee=A.length;function te(e,t,n){var r,i,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,d=o*l-s*c;if(Math.abs(d)>Number.EPSILON){var f=Math.sqrt(u),p=Math.sqrt(c*c+l*l),m=t.x-s/f,h=t.y+o/f,g=n.x-l/p,_=n.y+c/p,v=((g-m)*l-(_-h)*c)/(o*l-s*c);r=m+o*v-e.x,i=h+s*v-e.y;var y=r*r+i*i;if(y<=2)return new b(r,i);a=Math.sqrt(y/2)}else{var x=!1;o>Number.EPSILON?c>Number.EPSILON&&(x=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(x=!0):Math.sign(s)===Math.sign(l)&&(x=!0),x?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new b(r/a,i/a)}for(var ne=[],B=0,V=j.length,re=V-1,H=B+1;B<V;B++,re++,H++)re===V&&(re=0),H===V&&(H=0),ne[B]=te(j[B],j[re],j[H]);var U=[],ie,W=ne.concat();for(w=0,T=k.length;w<T;w++){for(C=k[w],ie=[],B=0,V=C.length,re=V-1,H=B+1;B<V;B++,re++,H++)re===V&&(re=0),H===V&&(H=0),ie[B]=te(C[B],C[re],C[H]);U.push(ie),W=W.concat(ie)}for(N=0;N<p;N++){for(F=N/p,I=u*Math.cos(F*Math.PI/2),P=d*Math.sin(F*Math.PI/2)+f,B=0,V=j.length;B<V;B++)L=M(j[B],ne[B],P),K(L.x,L.y,-I);for(w=0,T=k.length;w<T;w++)for(C=k[w],ie=U[w],B=0,V=C.length;B<V;B++)L=M(C[B],ie[B],P),K(L.x,L.y,-I)}for(P=d+f,B=0;B<R;B++)L=l?M(O[B],W[B],P):O[B],_?(x.copy(v.normals[0]).multiplyScalar(L.x),y.copy(v.binormals[0]).multiplyScalar(L.y),S.copy(g[0]).add(x).add(y),K(S.x,S.y,S.z)):K(L.x,L.y,0);var ae;for(ae=1;ae<=s;ae++)for(B=0;B<R;B++)L=l?M(O[B],W[B],P):O[B],_?(x.copy(v.normals[ae]).multiplyScalar(L.x),y.copy(v.binormals[ae]).multiplyScalar(L.y),S.copy(g[ae]).add(x).add(y),K(S.x,S.y,S.z)):K(L.x,L.y,c/s*ae);for(N=p-1;N>=0;N--){for(F=N/p,I=u*Math.cos(F*Math.PI/2),P=d*Math.sin(F*Math.PI/2)+f,B=0,V=j.length;B<V;B++)L=M(j[B],ne[B],P),K(L.x,L.y,c+I);for(w=0,T=k.length;w<T;w++)for(C=k[w],ie=U[w],B=0,V=C.length;B<V;B++)L=M(C[B],ie[B],P),_?K(L.x,L.y+g[s-1].y,g[s-1].x+I):K(L.x,L.y,c+I)}G(),oe();function G(){var e=r.length/3;if(l){var t=0,i=R*t;for(B=0;B<ee;B++)z=A[B],ce(z[2]+i,z[1]+i,z[0]+i);for(t=s+p*2,i=R*t,B=0;B<ee;B++)z=A[B],ce(z[0]+i,z[1]+i,z[2]+i)}else{for(B=0;B<ee;B++)z=A[B],ce(z[2],z[1],z[0]);for(B=0;B<ee;B++)z=A[B],ce(z[0]+R*s,z[1]+R*s,z[2]+R*s)}n.addGroup(e,r.length/3-e,0)}function oe(){var e=r.length/3,t=0;for(se(j,t),t+=j.length,w=0,T=k.length;w<T;w++)C=k[w],se(C,t),t+=C.length;n.addGroup(e,r.length/3-e,1)}function se(e,t){var n,r;for(B=e.length;--B>=0;){n=B,r=B-1,r<0&&(r=e.length-1);var i=0,a=s+p*2;for(i=0;i<a;i++){var o=R*i,c=R*(i+1);le(t+n+o,t+r+o,t+r+c,t+n+c)}}}function K(e,t,n){a.push(e),a.push(t),a.push(n)}function ce(e,t,i){ue(e),ue(t),ue(i);var a=r.length/3,o=h.generateTopUV(n,r,a-3,a-2,a-1);q(o[0]),q(o[1]),q(o[2])}function le(e,t,i,a){ue(e),ue(t),ue(a),ue(t),ue(i),ue(a);var o=r.length/3,s=h.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);q(s[0]),q(s[1]),q(s[3]),q(s[1]),q(s[2]),q(s[3])}function ue(e){r.push(a[e*3+0]),r.push(a[e*3+1]),r.push(a[e*3+2])}function q(e){i.push(e.x),i.push(e.y)}}}function Kr(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function qr(e,t){J.call(this),this.type=`TextGeometry`,this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Jr(e,t)),this.mergeVertices()}function Jr(e,t){t=t||{};var n=t.font;if(!(n&&n.isFont))return console.error(`THREE.TextGeometry: font parameter is not an instance of THREE.Font.`),new J;var r=n.generateShapes(e,t.size);t.depth=t.height===void 0?50:t.height,t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),Gr.call(this,r,t),this.type=`TextBufferGeometry`}function Yr(e,t,n,r,i,a,o){J.call(this),this.type=`SphereGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Xr(e,t,n,r,i,a,o)),this.mergeVertices()}function Xr(e,t,n,r,i,a,o){q.call(this),this.type=`SphereBufferGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),r=r===void 0?0:r,i=i===void 0?Math.PI*2:i,a=a===void 0?0:a,o=o===void 0?Math.PI:o;var s=Math.min(a+o,Math.PI),c,l,u=0,d=[],f=new D,p=new D,m=[],h=[],g=[],_=[];for(l=0;l<=n;l++){var v=[],y=l/n,b=0;for(l==0&&a==0?b=.5/t:l==n&&s==Math.PI&&(b=-.5/t),c=0;c<=t;c++){var x=c/t;f.x=-e*Math.cos(r+x*i)*Math.sin(a+y*o),f.y=e*Math.cos(a+y*o),f.z=e*Math.sin(r+x*i)*Math.sin(a+y*o),h.push(f.x,f.y,f.z),p.copy(f).normalize(),g.push(p.x,p.y,p.z),_.push(x+b,1-y),v.push(u++)}d.push(v)}for(l=0;l<n;l++)for(c=0;c<t;c++){var S=d[l][c+1],C=d[l][c],w=d[l+1][c],T=d[l+1][c+1];(l!==0||a>0)&&m.push(S,C,T),(l!==n-1||s<Math.PI)&&m.push(C,w,T)}this.setIndex(m),this.setAttribute(`position`,new K(h,3)),this.setAttribute(`normal`,new K(g,3)),this.setAttribute(`uv`,new K(_,2))}function Zr(e,t,n,r,i,a){J.call(this),this.type=`RingGeometry`,this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new Qr(e,t,n,r,i,a)),this.mergeVertices()}function Qr(e,t,n,r,i,a){q.call(this),this.type=`RingBufferGeometry`,this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},e=e||.5,t=t||1,i=i===void 0?0:i,a=a===void 0?Math.PI*2:a,n=n===void 0?8:Math.max(3,n),r=r===void 0?1:Math.max(1,r);var o=[],s=[],c=[],l=[],u,d=e,f=(t-e)/r,p=new D,m=new b,h,g;for(h=0;h<=r;h++){for(g=0;g<=n;g++)u=i+g/n*a,p.x=d*Math.cos(u),p.y=d*Math.sin(u),s.push(p.x,p.y,p.z),c.push(0,0,1),m.x=(p.x/t+1)/2,m.y=(p.y/t+1)/2,l.push(m.x,m.y);d+=f}for(h=0;h<r;h++){var _=h*(n+1);for(g=0;g<n;g++){u=g+_;var v=u,y=u+n+1,x=u+n+2,S=u+1;o.push(v,y,S),o.push(y,x,S)}}this.setIndex(o),this.setAttribute(`position`,new K(s,3)),this.setAttribute(`normal`,new K(c,3)),this.setAttribute(`uv`,new K(l,2))}function $r(e,t,n,r){J.call(this),this.type=`LatheGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new ei(e,t,n,r)),this.mergeVertices()}function ei(e,t,n,r){q.call(this),this.type=`LatheBufferGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t)||12,n=n||0,r=r||Math.PI*2,r=X.clamp(r,0,Math.PI*2);var i=[],a=[],o=[],s,c=1/t,l=new D,u=new b,d,f;for(d=0;d<=t;d++){var p=n+d*c*r,m=Math.sin(p),h=Math.cos(p);for(f=0;f<=e.length-1;f++)l.x=e[f].x*m,l.y=e[f].y,l.z=e[f].x*h,a.push(l.x,l.y,l.z),u.x=d/t,u.y=f/(e.length-1),o.push(u.x,u.y)}for(d=0;d<t;d++)for(f=0;f<e.length-1;f++){s=f+d*e.length;var g=s,_=s+e.length,v=s+e.length+1,y=s+1;i.push(g,_,y),i.push(_,v,y)}if(this.setIndex(i),this.setAttribute(`position`,new K(a,3)),this.setAttribute(`uv`,new K(o,2)),this.computeVertexNormals(),r===Math.PI*2){var x=this.attributes.normal.array,S=new D,C=new D,w=new D;for(s=t*e.length*3,d=0,f=0;d<e.length;d++,f+=3)S.x=x[f+0],S.y=x[f+1],S.z=x[f+2],C.x=x[s+f+0],C.y=x[s+f+1],C.z=x[s+f+2],w.addVectors(S,C).normalize(),x[f+0]=x[s+f+0]=w.x,x[f+1]=x[s+f+1]=w.y,x[f+2]=x[s+f+2]=w.z}}function ti(e,t){J.call(this),this.type=`ShapeGeometry`,typeof t==`object`&&(console.warn(`THREE.ShapeGeometry: Options parameter has been removed.`),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new ni(e,t)),this.mergeVertices()}function ni(e,t){q.call(this),this.type=`ShapeBufferGeometry`,this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],r=[],i=[],a=[],o=0,s=0;if(Array.isArray(e)===!1)l(e);else for(var c=0;c<e.length;c++)l(e[c]),this.addGroup(o,s,c),o+=s,s=0;this.setIndex(n),this.setAttribute(`position`,new K(r,3)),this.setAttribute(`normal`,new K(i,3)),this.setAttribute(`uv`,new K(a,2));function l(e){var o,c,l,u=r.length/3,d=e.extractPoints(t),f=d.shape,p=d.holes;for(sd.isClockWise(f)===!1&&(f=f.reverse()),o=0,c=p.length;o<c;o++)l=p[o],sd.isClockWise(l)===!0&&(p[o]=l.reverse());var m=sd.triangulateShape(f,p);for(o=0,c=p.length;o<c;o++)l=p[o],f=f.concat(l);for(o=0,c=f.length;o<c;o++){var h=f[o];r.push(h.x,h.y,0),i.push(0,0,1),a.push(h.x,h.y)}for(o=0,c=m.length;o<c;o++){var g=m[o],_=g[0]+u,v=g[1]+u,y=g[2]+u;n.push(_,v,y),s+=3}}}function ri(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}function ii(e,t){q.call(this),this.type=`EdgesGeometry`,this.parameters={thresholdAngle:t},t=t===void 0?1:t;var n=[],r=Math.cos(X.DEG2RAD*t),i=[0,0],a={},o,s,c,l=[`a`,`b`,`c`],u;e.isBufferGeometry?(u=new J,u.fromBufferGeometry(e)):u=e.clone(),u.mergeVertices(),u.computeFaceNormals();for(var d=u.vertices,f=u.faces,p=0,m=f.length;p<m;p++)for(var h=f[p],g=0;g<3;g++)o=h[l[g]],s=h[l[(g+1)%3]],i[0]=Math.min(o,s),i[1]=Math.max(o,s),c=i[0]+`,`+i[1],a[c]===void 0?a[c]={index1:i[0],index2:i[1],face1:p,face2:void 0}:a[c].face2=p;for(c in a){var _=a[c];if(_.face2===void 0||f[_.face1].normal.dot(f[_.face2].normal)<=r){var v=d[_.index1];n.push(v.x,v.y,v.z),v=d[_.index2],n.push(v.x,v.y,v.z)}}this.setAttribute(`position`,new K(n,3))}function ai(e,t,n,r,i,a,o,s){J.call(this),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new oi(e,t,n,r,i,a,o,s)),this.mergeVertices()}function oi(e,t,n,r,i,a,o,s){q.call(this),this.type=`CylinderBufferGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};var c=this;e=e===void 0?1:e,t=t===void 0?1:t,n=n||1,r=Math.floor(r)||8,i=Math.floor(i)||1,a=a===void 0?!1:a,o=o===void 0?0:o,s=s===void 0?Math.PI*2:s;var l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new K(u,3)),this.setAttribute(`normal`,new K(d,3)),this.setAttribute(`uv`,new K(f,2));function _(){var a,_,v=new D,y=new D,b=0,x=(t-e)/n;for(_=0;_<=i;_++){var S=[],C=_/i,w=C*(t-e)+e;for(a=0;a<=r;a++){var T=a/r,E=T*s+o,O=Math.sin(E),k=Math.cos(E);y.x=w*O,y.y=-C*n+h,y.z=w*k,u.push(y.x,y.y,y.z),v.set(O,x,k).normalize(),d.push(v.x,v.y,v.z),f.push(T,1-C),S.push(p++)}m.push(S)}for(a=0;a<r;a++)for(_=0;_<i;_++){var A=m[_][a],j=m[_+1][a],M=m[_+1][a+1],N=m[_][a+1];l.push(A,j,N),l.push(j,M,N),b+=6}c.addGroup(g,b,0),g+=b}function v(n){var i,a,m,_=new b,v=new D,y=0,x=n===!0?e:t,S=n===!0?1:-1;for(a=p,i=1;i<=r;i++)u.push(0,h*S,0),d.push(0,S,0),f.push(.5,.5),p++;for(m=p,i=0;i<=r;i++){var C=i/r*s+o,w=Math.cos(C),T=Math.sin(C);v.x=x*T,v.y=h*S,v.z=x*w,u.push(v.x,v.y,v.z),d.push(0,S,0),_.x=w*.5+.5,_.y=T*.5*S+.5,f.push(_.x,_.y),p++}for(i=0;i<r;i++){var E=a+i,O=m+i;n===!0?l.push(O,O+1,E):l.push(O+1,O,E),y+=3}c.addGroup(g,y,n===!0?1:2),g+=y}}function si(e,t,n,r,i,a,o){ai.call(this,0,e,t,n,r,i,a,o),this.type=`ConeGeometry`,this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function ci(e,t,n,r,i,a,o){oi.call(this,0,e,t,n,r,i,a,o),this.type=`ConeBufferGeometry`,this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function li(e,t,n,r){J.call(this),this.type=`CircleGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new ui(e,t,n,r)),this.mergeVertices()}function ui(e,t,n,r){q.call(this),this.type=`CircleBufferGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||1,t=t===void 0?8:Math.max(3,t),n=n===void 0?0:n,r=r===void 0?Math.PI*2:r;var i=[],a=[],o=[],s=[],c,l,u=new D,d=new b;for(a.push(0,0,0),o.push(0,0,1),s.push(.5,.5),l=0,c=3;l<=t;l++,c+=3){var f=n+l/t*r;u.x=e*Math.cos(f),u.y=e*Math.sin(f),a.push(u.x,u.y,u.z),o.push(0,0,1),d.x=(a[c]/e+1)/2,d.y=(a[c+1]/e+1)/2,s.push(d.x,d.y)}for(c=1;c<=t;c++)i.push(c,c+1,0);this.setIndex(i),this.setAttribute(`position`,new K(a,3)),this.setAttribute(`normal`,new K(o,3)),this.setAttribute(`uv`,new K(s,2))}function di(e){V.call(this),this.type=`ShadowMaterial`,this.color=new z(0),this.transparent=!0,this.setValues(e)}function fi(e){ge.call(this,e),this.type=`RawShaderMaterial`}function pi(e){V.call(this),this.defines={STANDARD:``},this.type=`MeshStandardMaterial`,this.color=new z(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function mi(e){pi.call(this),this.defines={STANDARD:``,PHYSICAL:``},this.type=`MeshPhysicalMaterial`,this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new b(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function hi(e){V.call(this),this.type=`MeshPhongMaterial`,this.color=new z(16777215),this.specular=new z(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function gi(e){V.call(this),this.defines={TOON:``},this.type=`MeshToonMaterial`,this.color=new z(16777215),this.specular=new z(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function _i(e){V.call(this),this.type=`MeshNormalMaterial`,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function vi(e){V.call(this),this.type=`MeshLambertMaterial`,this.color=new z(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function yi(e){V.call(this),this.defines={MATCAP:``},this.type=`MeshMatcapMaterial`,this.color=new z(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function bi(e){Fn.call(this),this.type=`LineDashedMaterial`,this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}function xi(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n}function Si(e,t,n,r){xi.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Ci(e,t,n,r){xi.call(this,e,t,n,r)}function wi(e,t,n,r){xi.call(this,e,t,n,r)}function Ti(e,t,n,r){if(e===void 0)throw Error(`THREE.KeyframeTrack: track name is undefined`);if(t===void 0||t.length===0)throw Error(`THREE.KeyframeTrack: no keyframes in track named `+e);this.name=e,this.times=dd.convertArray(t,this.TimeBufferType),this.values=dd.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function Ei(e,t,n){Ti.call(this,e,t,n)}function Di(e,t,n,r){Ti.call(this,e,t,n,r)}function Oi(e,t,n,r){Ti.call(this,e,t,n,r)}function ki(e,t,n,r){xi.call(this,e,t,n,r)}function Ai(e,t,n,r){Ti.call(this,e,t,n,r)}function ji(e,t,n,r){Ti.call(this,e,t,n,r)}function Mi(e,t,n,r){Ti.call(this,e,t,n,r)}function Ni(e,t,n,r){this.name=e,this.tracks=n,this.duration=t===void 0?-1:t,this.blendMode=r===void 0?Zs:r,this.uuid=X.generateUUID(),this.duration<0&&this.resetDuration()}function Pi(e){switch(e.toLowerCase()){case`scalar`:case`double`:case`float`:case`number`:case`integer`:return Oi;case`vector`:case`vector2`:case`vector3`:case`vector4`:return Mi;case`color`:return Di;case`quaternion`:return Ai;case`bool`:case`boolean`:return Ei;case`string`:return ji}throw Error(`THREE.KeyframeTrack: Unsupported typeName: `+e)}function Fi(e){if(e.type===void 0)throw Error(`THREE.KeyframeTrack: track type undefined, can not parse`);var t=Pi(e.type);if(e.times===void 0){var n=[],r=[];dd.flattenJSON(e.keys,n,r,`value`),e.times=n,e.values=r}return t.parse===void 0?new t(e.name,e.times,e.values,e.interpolation):t.parse(e)}function Ii(e,t,n){var r=this,i=!1,a=0,o=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,i===!1&&r.onStart!==void 0&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,r.onProgress!==void 0&&r.onProgress(e,a,o),a===o&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(e){r.onError!==void 0&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){var t=c.indexOf(e);return t!==-1&&c.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=c.length;t<n;t+=2){var r=c[t],i=c[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}}function Li(e){this.manager=e===void 0?pd:e,this.crossOrigin=`anonymous`,this.path=``,this.resourcePath=``,this.requestHeader={}}function Ri(e){Li.call(this,e)}function zi(e){Li.call(this,e)}function Bi(e){Li.call(this,e)}function Vi(e){Li.call(this,e)}function Hi(e){Li.call(this,e)}function Ui(e){Li.call(this,e)}function Wi(e){Li.call(this,e)}function Y(){this.type=`Curve`,this.arcLengthDivisions=200}function Gi(e,t,n,r,i,a,o,s){Y.call(this),this.type=`EllipseCurve`,this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function Ki(e,t,n,r,i,a){Gi.call(this,e,t,n,n,r,i,a),this.type=`ArcCurve`}function qi(){var e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){var c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;c*=o,l*=o,i(t,n,c,l)},calc:function(i){var a=i*i,o=a*i;return e+t*i+n*a+r*o}}}function Ji(e,t,n,r){Y.call(this),this.type=`CatmullRomCurve3`,this.points=e||[],this.closed=t||!1,this.curveType=n||`centripetal`,this.tension=r||.5}function Yi(e,t,n,r,i){var a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function Xi(e,t){var n=1-e;return n*n*t}function Zi(e,t){return 2*(1-e)*e*t}function Qi(e,t){return e*e*t}function $i(e,t,n,r){return Xi(e,t)+Zi(e,n)+Qi(e,r)}function ea(e,t){var n=1-e;return n*n*n*t}function ta(e,t){var n=1-e;return 3*n*n*e*t}function na(e,t){return 3*(1-e)*e*e*t}function ra(e,t){return e*e*e*t}function ia(e,t,n,r,i){return ea(e,t)+ta(e,n)+na(e,r)+ra(e,i)}function aa(e,t,n,r){Y.call(this),this.type=`CubicBezierCurve`,this.v0=e||new b,this.v1=t||new b,this.v2=n||new b,this.v3=r||new b}function oa(e,t,n,r){Y.call(this),this.type=`CubicBezierCurve3`,this.v0=e||new D,this.v1=t||new D,this.v2=n||new D,this.v3=r||new D}function sa(e,t){Y.call(this),this.type=`LineCurve`,this.v1=e||new b,this.v2=t||new b}function ca(e,t){Y.call(this),this.type=`LineCurve3`,this.v1=e||new D,this.v2=t||new D}function la(e,t,n){Y.call(this),this.type=`QuadraticBezierCurve`,this.v0=e||new b,this.v1=t||new b,this.v2=n||new b}function ua(e,t,n){Y.call(this),this.type=`QuadraticBezierCurve3`,this.v0=e||new D,this.v1=t||new D,this.v2=n||new D}function da(e){Y.call(this),this.type=`SplineCurve`,this.points=e||[]}function fa(){Y.call(this),this.type=`CurvePath`,this.curves=[],this.autoClose=!1}function pa(e){fa.call(this),this.type=`Path`,this.currentPoint=new b,e&&this.setFromPoints(e)}function ma(e){pa.call(this,e),this.uuid=X.generateUUID(),this.type=`Shape`,this.holes=[]}function ha(e,t){j.call(this),this.type=`Light`,this.color=new z(e),this.intensity=t===void 0?1:t,this.receiveShadow=void 0}function ga(e,t,n){ha.call(this,e,n),this.type=`HemisphereLight`,this.castShadow=void 0,this.position.copy(j.DefaultUp),this.updateMatrix(),this.groundColor=new z(t)}function _a(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new b(512,512),this.map=null,this.mapPass=null,this.matrix=new O,this._frustum=new Se,this._frameExtents=new b(1,1),this._viewportCount=1,this._viewports=[new C(0,0,1,1)]}function va(){_a.call(this,new ve(50,1,.5,500))}function ya(e,t,n,r,i,a){ha.call(this,e,t),this.type=`SpotLight`,this.position.copy(j.DefaultUp),this.updateMatrix(),this.target=new j,Object.defineProperty(this,`power`,{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=n===void 0?0:n,this.angle=r===void 0?Math.PI/3:r,this.penumbra=i===void 0?0:i,this.decay=a===void 0?1:a,this.shadow=new va}function ba(){_a.call(this,new ve(90,1,.5,500)),this._frameExtents=new b(4,2),this._viewportCount=6,this._viewports=[new C(2,1,1,1),new C(0,1,1,1),new C(3,1,1,1),new C(1,1,1,1),new C(3,0,1,1),new C(1,0,1,1)],this._cubeDirections=[new D(1,0,0),new D(-1,0,0),new D(0,0,1),new D(0,0,-1),new D(0,1,0),new D(0,-1,0)],this._cubeUps=[new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,0,1),new D(0,0,-1)]}function xa(e,t,n,r){ha.call(this,e,t),this.type=`PointLight`,Object.defineProperty(this,`power`,{get:function(){return this.intensity*4*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=n===void 0?0:n,this.decay=r===void 0?1:r,this.shadow=new ba}function Sa(e,t,n,r,i,a){_e.call(this),this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e===void 0?-1:e,this.right=t===void 0?1:t,this.top=n===void 0?1:n,this.bottom=r===void 0?-1:r,this.near=i===void 0?.1:i,this.far=a===void 0?2e3:a,this.updateProjectionMatrix()}function Ca(){_a.call(this,new Sa(-5,5,5,-5,.5,500))}function wa(e,t){ha.call(this,e,t),this.type=`DirectionalLight`,this.position.copy(j.DefaultUp),this.updateMatrix(),this.target=new j,this.shadow=new Ca}function Ta(e,t){ha.call(this,e,t),this.type=`AmbientLight`,this.castShadow=void 0}function Ea(e,t,n,r){ha.call(this,e,t),this.type=`RectAreaLight`,this.width=n===void 0?10:n,this.height=r===void 0?10:r}function Da(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new D)}function Oa(e,t){ha.call(this,void 0,t),this.type=`LightProbe`,this.sh=e===void 0?new Da:e}function ka(e){Li.call(this,e),this.textures={}}function Aa(){q.call(this),this.type=`InstancedBufferGeometry`,this.instanceCount=1/0}function ja(e,t,n,r){typeof n==`number`&&(r=n,n=!1,console.error(`THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.`)),H.call(this,e,t,n),this.meshPerAttribute=r||1}function Ma(e){Li.call(this,e)}function Na(e){Li.call(this,e)}function Pa(e){typeof createImageBitmap>`u`&&console.warn(`THREE.ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&console.warn(`THREE.ImageBitmapLoader: fetch() not supported.`),Li.call(this,e),this.options=void 0}function Fa(){this.type=`ShapePath`,this.color=new z,this.subPaths=[],this.currentPath=null}function Ia(e){this.type=`Font`,this.data=e}function La(e,t,n){for(var r=Array.from?Array.from(e):String(e).split(``),i=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,c=0,l=0;l<r.length;l++){var u=r[l];if(u===`\n`)s=0,c-=a;else{var d=Ra(u,i,s,c,n);s+=d.offsetX,o.push(d.path)}}return o}function Ra(e,t,n,r,i){var a=i.glyphs[e]||i.glyphs[`?`];if(!a){console.error(`THREE.Font: character "`+e+`" does not exists in font family `+i.familyName+`.`);return}var o=new Fa,s,c,l,u,d,f,p,m;if(a.o)for(var h=a._cachedOutline||(a._cachedOutline=a.o.split(` `)),g=0,_=h.length;g<_;)switch(h[g++]){case`m`:s=h[g++]*t+n,c=h[g++]*t+r,o.moveTo(s,c);break;case`l`:s=h[g++]*t+n,c=h[g++]*t+r,o.lineTo(s,c);break;case`q`:l=h[g++]*t+n,u=h[g++]*t+r,d=h[g++]*t+n,f=h[g++]*t+r,o.quadraticCurveTo(d,f,l,u);break;case`b`:l=h[g++]*t+n,u=h[g++]*t+r,d=h[g++]*t+n,f=h[g++]*t+r,p=h[g++]*t+n,m=h[g++]*t+r,o.bezierCurveTo(d,f,p,m,l,u);break}return{offsetX:a.ha*t,path:o}}function za(e){Li.call(this,e)}function Ba(e){Li.call(this,e)}function Va(e,t,n){Oa.call(this,void 0,n);var r=new z().set(e),i=new z().set(t),a=new D(r.r,r.g,r.b),o=new D(i.r,i.g,i.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}function Ha(e,t){Oa.call(this,void 0,t);var n=new z().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}function Ua(){this.type=`StereoCamera`,this.aspect=1,this.eyeSep=.064,this.cameraL=new ve,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ve,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function Wa(e){this.autoStart=e===void 0?!0:e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Ga(){j.call(this),this.type=`AudioListener`,this.context=Ed.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Wa}function Ka(e){j.call(this),this.type=`Audio`,this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType=`empty`,this._startedAt=0,this._progress=0,this.filters=[]}function qa(e){Ka.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel=`HRTF`,this.panner.connect(this.gain)}function Ja(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t===void 0?2048:t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function Ya(e,t,n){this.binding=e,this.valueSize=n;var r,i,a;switch(t){case`quaternion`:r=this._slerp,i=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case`string`:case`bool`:r=this._select,i=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(n*5);break;default:r=this._lerp,i=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}function Xa(e,t,n){var r=n||Za.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function Za(e,t,n){this.path=t,this.parsedPath=n||Za.parseTrackName(t),this.node=Za.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function Qa(){this.uuid=X.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function $a(e,t,n,r){this._mixer=e,this._clip=t,this._localRoot=n||null,this.blendMode=r||t.blendMode;for(var i=t.tracks,a=i.length,o=Array(a),s={endingStart:Js,endingEnd:Js},c=0;c!==a;++c){var l=i[c].createInterpolant(null);o[c]=l,l.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Us,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function eo(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function to(e){typeof e==`string`&&(console.warn(`THREE.Uniform: Type parameter is no longer needed.`),e=arguments[1]),this.value=e}function no(e,t,n){Tn.call(this,e,t),this.meshPerAttribute=n||1}function ro(e,t,n,r){this.ray=new I(e,t),this.near=n||0,this.far=r||1/0,this.camera=null,this.layers=new A,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn(`THREE.Raycaster: params.PointCloud has been renamed to params.Points.`),this.Points}}})}function io(e,t){return e.distance-t.distance}function ao(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),r===!0)for(var i=e.children,a=0,o=i.length;a<o;a++)ao(i[a],t,n,!0)}function oo(e,t,n){return this.radius=e===void 0?1:e,this.phi=t===void 0?0:t,this.theta=n===void 0?0:n,this}function so(e,t,n){return this.radius=e===void 0?1:e,this.theta=t===void 0?0:t,this.y=n===void 0?0:n,this}function co(e,t){this.min=e===void 0?new b(1/0,1/0):e,this.max=t===void 0?new b(-1/0,-1/0):t}function lo(e,t){this.start=e===void 0?new D:e,this.end=t===void 0?new D:t}function uo(e){j.call(this),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}function fo(e,t){j.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new q,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],i=0,a=1,o=32;i<o;i++,a++){var s=i/o*Math.PI*2,c=a/o*Math.PI*2;r.push(Math.cos(s),Math.sin(s),1,Math.cos(c),Math.sin(c),1)}n.setAttribute(`position`,new K(r,3));var l=new Fn({fog:!1,toneMapped:!1});this.cone=new Ln(n,l),this.add(this.cone),this.update()}function po(e){var t=[];e&&e.isBone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,po(e.children[n]));return t}function mo(e){for(var t=po(e),n=new q,r=[],i=[],a=new z(0,0,1),o=new z(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}n.setAttribute(`position`,new K(r,3)),n.setAttribute(`color`,new K(i,3));var l=new Fn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});Ln.call(this,n,l),this.type=`SkeletonHelper`,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function ho(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var r=new Xr(t,4,2),i=new re({wireframe:!0,fog:!1,toneMapped:!1});de.call(this,r,i),this.type=`PointLightHelper`,this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function go(e,t,n){j.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var r=new er(t);r.rotateY(Math.PI*.5),this.material=new re({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);var i=r.getAttribute(`position`),a=new Float32Array(i.count*3);r.setAttribute(`color`,new H(a,3)),this.add(new de(r,this.material)),this.update()}function _o(e,t,n,r){e=e||10,t=t||10,n=new z(n===void 0?4473924:n),r=new z(r===void 0?8947848:r);for(var i=t/2,a=e/t,o=e/2,s=[],c=[],l=0,u=0,d=-o;l<=t;l++,d+=a){s.push(-o,0,d,o,0,d),s.push(d,0,-o,d,0,o);var f=l===i?n:r;f.toArray(c,u),u+=3,f.toArray(c,u),u+=3,f.toArray(c,u),u+=3,f.toArray(c,u),u+=3}var p=new q;p.setAttribute(`position`,new K(s,3)),p.setAttribute(`color`,new K(c,3));var m=new Fn({vertexColors:!0,toneMapped:!1});Ln.call(this,p,m),this.type=`GridHelper`}function vo(e,t,n,r,i,a){e=e||10,t=t||16,n=n||8,r=r||64,i=new z(i===void 0?4473924:i),a=new z(a===void 0?8947848:a);var o=[],s=[],c,l,u,d,f,p,m;for(d=0;d<=t;d++)u=d/t*(Math.PI*2),c=Math.sin(u)*e,l=Math.cos(u)*e,o.push(0,0,0),o.push(c,0,l),m=d&1?i:a,s.push(m.r,m.g,m.b),s.push(m.r,m.g,m.b);for(d=0;d<=n;d++)for(m=d&1?i:a,p=e-e/n*d,f=0;f<r;f++)u=f/r*(Math.PI*2),c=Math.sin(u)*p,l=Math.cos(u)*p,o.push(c,0,l),s.push(m.r,m.g,m.b),u=(f+1)/r*(Math.PI*2),c=Math.sin(u)*p,l=Math.cos(u)*p,o.push(c,0,l),s.push(m.r,m.g,m.b);var h=new q;h.setAttribute(`position`,new K(o,3)),h.setAttribute(`color`,new K(s,3));var g=new Fn({vertexColors:!0,toneMapped:!1});Ln.call(this,h,g),this.type=`PolarGridHelper`}function yo(e,t,n){j.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);var r=new q;r.setAttribute(`position`,new K([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var i=new Fn({fog:!1,toneMapped:!1});this.lightPlane=new In(r,i),this.add(this.lightPlane),r=new q,r.setAttribute(`position`,new K([0,0,0,0,0,1],3)),this.targetLine=new In(r,i),this.add(this.targetLine),this.update()}function bo(e){var t=new q,n=new Fn({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],a={},o=new z(16755200),s=new z(16711680),c=new z(43775),l=new z(16777215),u=new z(3355443);d(`n1`,`n2`,o),d(`n2`,`n4`,o),d(`n4`,`n3`,o),d(`n3`,`n1`,o),d(`f1`,`f2`,o),d(`f2`,`f4`,o),d(`f4`,`f3`,o),d(`f3`,`f1`,o),d(`n1`,`f1`,o),d(`n2`,`f2`,o),d(`n3`,`f3`,o),d(`n4`,`f4`,o),d(`p`,`n1`,s),d(`p`,`n2`,s),d(`p`,`n3`,s),d(`p`,`n4`,s),d(`u1`,`u2`,c),d(`u2`,`u3`,c),d(`u3`,`u1`,c),d(`c`,`t`,l),d(`p`,`c`,u),d(`cn1`,`cn2`,u),d(`cn3`,`cn4`,u),d(`cf1`,`cf2`,u),d(`cf3`,`cf4`,u);function d(e,t,n){f(e,n),f(t,n)}function f(e,t){r.push(0,0,0),i.push(t.r,t.g,t.b),a[e]===void 0&&(a[e]=[]),a[e].push(r.length/3-1)}t.setAttribute(`position`,new K(r,3)),t.setAttribute(`color`,new K(i,3)),Ln.call(this,t,n),this.type=`CameraHelper`,this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function xo(e,t,n,r,i,a,o){sf.set(i,a,o).unproject(r);var s=t[e];if(s!==void 0)for(var c=n.getAttribute(`position`),l=0,u=s.length;l<u;l++)c.setXYZ(s[l],sf.x,sf.y,sf.z)}function So(e,t){this.object=e,t===void 0&&(t=16776960);var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new q;i.setIndex(new H(n,1)),i.setAttribute(`position`,new H(r,3)),Ln.call(this,i,new Fn({color:t,toneMapped:!1})),this.type=`BoxHelper`,this.matrixAutoUpdate=!1,this.update()}function Co(e,t){this.type=`Box3Helper`,this.box=e,t=t||16776960;var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],i=new q;i.setIndex(new H(n,1)),i.setAttribute(`position`,new K(r,3)),Ln.call(this,i,new Fn({color:t,toneMapped:!1})),this.type=`Box3Helper`,this.geometry.computeBoundingSphere()}function wo(e,t,n){this.plane=e,this.size=t===void 0?1:t;var r=n===void 0?16776960:n,i=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],a=new q;a.setAttribute(`position`,new K(i,3)),a.computeBoundingSphere(),In.call(this,a,new Fn({color:r,toneMapped:!1})),this.type=`PlaneHelper`;var o=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],s=new q;s.setAttribute(`position`,new K(o,3)),s.computeBoundingSphere(),this.add(new de(s,new re({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}function To(e,t,n,r,i,a){j.call(this),this.type=`ArrowHelper`,e===void 0&&(e=new D(0,0,1)),t===void 0&&(t=new D(0,0,0)),n===void 0&&(n=1),r===void 0&&(r=16776960),i===void 0&&(i=.2*n),a===void 0&&(a=.2*i),df===void 0&&(df=new q,df.setAttribute(`position`,new K([0,0,0,0,1,0],3)),ff=new oi(0,.5,1,5,1),ff.translate(0,-.5,0)),this.position.copy(t),this.line=new In(df,new Fn({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new de(ff,new re({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,a)}function Eo(e){e=e||1;var t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new q;r.setAttribute(`position`,new K(t,3)),r.setAttribute(`color`,new K(n,3));var i=new Fn({vertexColors:!0,toneMapped:!1});Ln.call(this,r,i),this.type=`AxesHelper`}function Do(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=Mo(vf),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}function Oo(e){return e===void 0||e.type!==1009?!1:e.encoding===3e3||e.encoding===3001||e.encoding===3007}function ko(){for(var e=[],t=[],n=[],r=mf,i=0;i<_f;i++){var a=Math.pow(2,r);t.push(a);var o=1/a;i>mf-pf?o=gf[i-mf+pf-1]:i==0&&(o=0),n.push(o);for(var s=1/(a-1),c=-s/2,l=1+s/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],d=6,f=6,p=3,m=2,h=1,g=new Float32Array(p*f*d),_=new Float32Array(m*f*d),v=new Float32Array(h*f*d),y=0;y<d;y++){var b=y%3*2/3-1,x=y>2?0:-1,S=[b,x,0,b+2/3,x,0,b+2/3,x+1,0,b,x,0,b+2/3,x+1,0,b,x+1,0];g.set(S,p*f*y),_.set(u,m*f*y);var C=[y,y,y,y,y,y];v.set(C,h*f*y)}var w=new q;w.setAttribute(`position`,new H(g,p)),w.setAttribute(`uv`,new H(_,m)),w.setAttribute(`faceIndex`,new H(v,h)),e.push(w),r>pf&&r--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}function Ao(e){var t=new w(3*hf,3*hf,e);return t.texture.mapping=306,t.texture.name=`PMREM.cubeUv`,t.scissorTest=!0,t}function jo(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function Mo(e){var t=new Float32Array(e),n=new D(0,1,0),r=new fi({defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:yf[$s]},outputEncoding:{value:yf[$s]}},vertexShader:Fo(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n${Io()}\n\n#define ENVMAP_TYPE_CUBE_UV\n#include <cube_uv_reflection_fragment>\n\nvec3 getSample(float theta, vec3 axis) {\n float cosTheta = cos(theta);\n // Rodrigues\' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross(axis, vOutputDirection) * sin(theta)\n + axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n return bilinearCubeUV(envMap, sampleDirection, mipInt);\n}\n\nvoid main() {\n vec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n if (all(equal(axis, vec3(0.0))))\n axis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);\n axis = normalize(axis);\n gl_FragColor = vec4(0.0);\n gl_FragColor.rgb += weights[0] * getSample(0.0, axis);\n for (int i = 1; i < n; i++) {\n if (i >= samples)\n break;\n float theta = dTheta * float(i);\n gl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);\n gl_FragColor.rgb += weights[i] * getSample(theta, axis);\n }\n gl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n `,blending:0,depthTest:!1,depthWrite:!1});return r.type=`SphericalGaussianBlur`,r}function No(){var e=new fi({uniforms:{envMap:{value:null},texelSize:{value:new b(1,1)},inputEncoding:{value:yf[$s]},outputEncoding:{value:yf[$s]}},vertexShader:Fo(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n${Io()}\n\n#include <common>\n\nvoid main() {\n gl_FragColor = vec4(0.0);\n vec3 outputDirection = normalize(vOutputDirection);\n vec2 uv = equirectUv( outputDirection );\n vec2 f = fract(uv / texelSize - 0.5);\n uv -= f * texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize.x;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize.y;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize.x;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n gl_FragColor.rgb = mix(tm, bm, f.y);\n gl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n `,blending:0,depthTest:!1,depthWrite:!1});return e.type=`EquirectangularToCubeUV`,e}function Po(){var e=new fi({uniforms:{envMap:{value:null},inputEncoding:{value:yf[$s]},outputEncoding:{value:yf[$s]}},vertexShader:Fo(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n${Io()}\n\nvoid main() {\n gl_FragColor = vec4(0.0);\n gl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n gl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n `,blending:0,depthTest:!1,depthWrite:!1});return e.type=`CubemapToCubeUV`,e}function Fo(){return`\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection(vec2 uv, float face) {\n uv = 2.0 * uv - 1.0;\n vec3 direction = vec3(uv, 1.0);\n if (face == 0.0) {\n direction = direction.zyx; // ( 1, v, u ) pos x\n } else if (face == 1.0) {\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n } else if (face == 2.0) {\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n } else if (face == 3.0) {\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n } else if (face == 4.0) {\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n } else if (face == 5.0) {\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n }\n return direction;\n}\n\nvoid main() {\n vOutputDirection = getDirection(uv, faceIndex);\n gl_Position = vec4( position, 1.0 );\n}\n `}function Io(){return`\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include <encodings_pars_fragment>\n\nvec4 inputTexelToLinear(vec4 value){\n if(inputEncoding == 0){\n return value;\n }else if(inputEncoding == 1){\n return sRGBToLinear(value);\n }else if(inputEncoding == 2){\n return RGBEToLinear(value);\n }else if(inputEncoding == 3){\n return RGBMToLinear(value, 7.0);\n }else if(inputEncoding == 4){\n return RGBMToLinear(value, 16.0);\n }else if(inputEncoding == 5){\n return RGBDToLinear(value, 256.0);\n }else{\n return GammaToLinear(value, 2.2);\n }\n}\n\nvec4 linearToOutputTexel(vec4 value){\n if(outputEncoding == 0){\n return value;\n }else if(outputEncoding == 1){\n return LinearTosRGB(value);\n }else if(outputEncoding == 2){\n return LinearToRGBE(value);\n }else if(outputEncoding == 3){\n return LinearToRGBM(value, 7.0);\n }else if(outputEncoding == 4){\n return LinearToRGBM(value, 16.0);\n }else if(outputEncoding == 5){\n return LinearToRGBD(value, 256.0);\n }else{\n return LinearToGamma(value, 2.2);\n }\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n return inputTexelToLinear(color);\n}\n `}function Lo(e){console.warn(`THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.`),Ji.call(this,e),this.type=`catmullrom`,this.closed=!0}function Ro(e){console.warn(`THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.`),Ji.call(this,e),this.type=`catmullrom`}function zo(e){console.warn(`THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.`),Ji.call(this,e),this.type=`catmullrom`}var Bo,Vo,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs,gs,_s,vs,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds,Os,ks,As,js,Ms,Ns,Ps,Fs,Is,Ls,Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,Ks,qs,Js,Ys,Xs,Zs,Qs,$s,ec,tc,nc,rc,ic,ac,oc,sc,cc,lc,uc,dc,fc,pc,X,mc,hc,gc,_c,vc,yc,bc,xc,Sc,Cc,wc,Tc,Ec,Dc,Oc,kc,Ac,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc,zc,Bc,Vc,Hc,Uc,Wc,Gc,Kc,qc,Jc,Yc,Xc,Zc,Qc,$c,el,tl,nl,rl,il,al,ol,sl,cl,ll,ul,dl,fl,pl,ml,hl,gl,_l,vl,yl,bl,xl,Sl,Cl,wl,Tl,El,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Fl,Il,Ll,Rl,zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l,eu,tu,nu,ru,iu,au,ou,su,cu,Z,Q,lu,uu,du,fu,pu,mu,hu,gu,_u,vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au,ju,Mu,Nu,Pu,Fu,Iu,Lu,Ru,zu,Bu,Vu,Hu,Uu,Wu,Gu,Ku,qu,Ju,Yu,Xu,Zu,Qu,$u,ed,td,nd,rd,id,ad,od,sd,cd,ld,ud,dd,fd,pd,md,hd,gd,_d,vd,yd,bd,xd,Sd,Cd,wd,Td,Ed,Dd,Od,kd,Ad,jd,Md,Nd,Pd,Fd,Id,Ld,Rd,zd,Bd,Vd,Hd,Ud,Wd,Gd,Kd,qd,Jd,Yd,Xd,Zd,Qd,$d,ef,tf,nf,rf,af,of,sf,cf,lf,uf,df,ff,pf,mf,hf,gf,_f,vf,yf,bf,xf,Sf,Cf,wf,Tf,Ef,Df,Of=e((()=>{for(Number.EPSILON===void 0&&(Number.EPSILON=Math.pow(2,-52)),Number.isInteger===void 0&&(Number.isInteger=function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e}),Math.sign===void 0&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),(`name`in Function.prototype)||Object.defineProperty(Function.prototype,`name`,{get:function(){return this.toString().match(/^\\s*function\\s*([^\\(\\s]*)/)[1]}}),Object.assign===void 0&&(Object.assign=function(e){if(e==null)throw TypeError(`Cannot convert undefined or null to object`);let t=Object(e);for(let e=1;e<arguments.length;e++){let n=arguments[e];if(n!=null)for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t}),Bo=1e3,Vo=1001,Ho=1002,Uo=1003,Wo=1004,Go=1005,Ko=1006,qo=1007,Jo=1008,Yo=1009,Xo=1012,Zo=1015,Qo=1020,$o=1022,es=1023,ts=es,ns=1026,rs=33776,is=33777,as=33778,os=33779,ss=35840,cs=35841,ls=35842,us=35843,ds=36196,fs=37492,ps=37496,ms=37808,hs=37809,gs=37810,_s=37811,vs=37812,ys=37813,bs=37814,xs=37815,Ss=37816,Cs=37817,ws=37818,Ts=37819,Es=37820,Ds=37821,Os=36492,ks=37840,As=37841,js=37842,Ms=37843,Ns=37844,Ps=37845,Fs=37846,Is=37847,Ls=37848,Rs=37849,zs=37850,Bs=37851,Vs=37852,Hs=37853,Us=2201,Ws=2202,Gs=2300,Ks=2301,qs=2302,Js=2400,Ys=2401,Xs=2402,Zs=2500,Qs=2501,$s=3e3,ec=3001,tc=3007,nc=3002,rc=3003,ic=3004,ac=3005,oc=3006,sc=3200,cc=3201,lc=7680,uc=35044,dc=35048,Object.assign(y.prototype,{addEventListener:function(e,t){this._listeners===void 0&&(this._listeners={});var n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)},hasEventListener:function(e,t){if(this._listeners===void 0)return!1;var n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1},removeEventListener:function(e,t){if(this._listeners!==void 0){var n=this._listeners[e];if(n!==void 0){var r=n.indexOf(t);r!==-1&&n.splice(r,1)}}},dispatchEvent:function(e){if(this._listeners!==void 0){var t=this._listeners[e.type];if(t!==void 0){e.target=this;for(var n=t.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,e)}}}}),fc=[],pc=0;pc<256;pc++)fc[pc]=(pc<16?`0`:``)+pc.toString(16);X={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(fc[e&255]+fc[e>>8&255]+fc[e>>16&255]+fc[e>>24&255]+`-`+fc[t&255]+fc[t>>8&255]+`-`+fc[t>>16&15|64]+fc[t>>24&255]+`-`+fc[n&63|128]+fc[n>>8&255]+`-`+fc[n>>16&255]+fc[n>>24&255]+fc[r&255]+fc[r>>8&255]+fc[r>>16&255]+fc[r>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*X.DEG2RAD},radToDeg:function(e){return e*X.RAD2DEG},isPowerOfTwo:function(e){return(e&e-1)==0&&e!==0},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:console.warn(`THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}},Object.defineProperties(b.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(b.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return t===void 0?(this.x+=e.x,this.y+=e.y,this):(console.warn(`THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.`),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return t===void 0?(this.x-=e.x,this.y-=e.y,this):(console.warn(`THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.`),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn(`THREE.Vector2: offset has been removed from .fromBufferAttribute().`),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}}),Object.assign(x.prototype,{isMatrix3:!0,set:function(e,t,n,r,i,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return new this.constructor().fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},extractBasis:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s},getInverse:function(e,t){t!==void 0&&console.warn(`THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.`);var n=e.elements,r=this.elements,i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],d=n[7],f=n[8],p=f*c-l*d,m=l*u-f*s,h=d*s-c*u,g=i*p+a*m+o*h;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);var _=1/g;return r[0]=p*_,r[1]=(o*d-f*a)*_,r[2]=(l*a-o*c)*_,r[3]=m*_,r[4]=(f*i-o*u)*_,r[5]=(o*s-l*i)*_,r[6]=h*_,r[7]=(a*u-d*i)*_,r[8]=(c*i-a*s)*_,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,r,i,a,o){var s=Math.cos(i),c=Math.sin(i);this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],c=r[4],l=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*c,r[6]=t*o+n*l,r[1]=-n*i+t*s,r[4]=-n*a+t*c,r[7]=-n*o+t*l,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}}),hc={getDataURL:function(e){var t;if(typeof HTMLCanvasElement>`u`)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{mc===void 0&&(mc=document.createElementNS(`http://www.w3.org/1999/xhtml`,`canvas`)),mc.width=e.width,mc.height=e.height;var n=mc.getContext(`2d`);e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=mc}return t.width>2048||t.height>2048?t.toDataURL(`image/jpeg`,.6):t.toDataURL(`image/png`)}},gc=0,S.DEFAULT_IMAGE=void 0,S.DEFAULT_MAPPING=300,S.prototype=Object.assign(Object.create(y.prototype),{constructor:S,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];var n={metadata:{version:4.5,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,mapping:this.mapping,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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){var r=this.image;if(r.uuid===void 0&&(r.uuid=X.generateUUID()),!t&&e.images[r.uuid]===void 0){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)i.push(hc.getDataURL(r[a]))}else i=hc.getDataURL(r);e.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:`dispose`})},transformUv:function(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Bo:e.x-=Math.floor(e.x);break;case Vo:e.x=e.x<0?0:1;break;case Ho:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Bo:e.y-=Math.floor(e.y);break;case Vo:e.y=e.y<0?0:1;break;case Ho:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(S.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),Object.defineProperties(C.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(C.prototype,{isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this},add:function(e,t){return t===void 0?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this):(console.warn(`THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.`),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return t===void 0?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this):(console.warn(`THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.`),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var _=(c+1)/2,v=(f+1)/2,y=(g+1)/2,b=(l+d)/4,x=(u+m)/4,S=(p+h)/4;return _>v&&_>y?_<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(_),r=b/n,i=x/n):v>y?v<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(v),n=b/r,i=S/r):y<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(y),n=x/i,r=S/i),this.set(n,r,i,t),this}var C=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(C)<.001&&(C=1),this.x=(h-p)/C,this.y=(u-m)/C,this.z=(d-l)/C,this.w=Math.acos((c+f+g-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn(`THREE.Vector4: offset has been removed from .fromBufferAttribute().`),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}),w.prototype=Object.assign(Object.create(y.prototype),{constructor:w,isWebGLRenderTarget:!0,setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),T.prototype=Object.assign(Object.create(w.prototype),{constructor:T,isWebGLMultisampleRenderTarget:!0,copy:function(e){return w.prototype.copy.call(this,e),this.samples=e.samples,this}}),Object.assign(E,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,a,o){var s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){var h=1-o,g=s*d+c*f+l*p+u*m,_=g>=0?1:-1,v=1-g*g;if(v>Number.EPSILON){var y=Math.sqrt(v),b=Math.atan2(y,g*_);h=Math.sin(h*b)/y,o=Math.sin(o*b)/y}var x=o*_;if(s=s*h+d*x,c=c*h+f*x,l=l*h+p*x,u=u*h+m*x,h===1-o){var S=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=S,c*=S,l*=S,u*=S}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u},multiplyQuaternionsFlat:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}}),Object.defineProperties(E.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(E.prototype,{isQuaternion:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!(e&&e.isEuler))throw Error(`THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.`);var n=e._x,r=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:console.warn(`THREE.Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t!==!1&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u,f;return d>0?(f=.5/Math.sqrt(d+1),this._w=.25/f,this._x=(l-s)*f,this._y=(i-c)*f,this._z=(a-r)*f):n>o&&n>u?(f=2*Math.sqrt(1+n-o-u),this._w=(l-s)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(i+c)/f):o>u?(f=2*Math.sqrt(1+o-n-u),this._w=(i-c)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(s+l)/f):(f=2*Math.sqrt(1+u-n-o),this._w=(a-r)/f,this._x=(i+c)/f,this._y=(s+l)/f,this._z=.25*f),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=1e-6,r=e.dot(t)+1;return r<n?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(X.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(n===0)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this},multiply:function(e,t){return t===void 0?this.multiplyQuaternions(this,e):(console.warn(`THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.`),this.multiplyQuaternions(e,t))},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this},slerp:function(e,t){if(t===0)return this;if(t===1)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*n+t*this._x,this._y=c*r+t*this._y,this._z=c*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),u=Math.atan2(l,o),d=Math.sin((1-t)*u)/l,f=Math.sin(t*u)/l;return this._w=a*d+this._w*f,this._x=n*d+this._x*f,this._y=r*d+this._y*f,this._z=i*d+this._z*f,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return t===void 0&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),_c=new D,vc=new E,Object.assign(D.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return t===void 0?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this):(console.warn(`THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.`),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return t===void 0?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this):(console.warn(`THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.`),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return t===void 0?(this.x*=e.x,this.y*=e.y,this.z*=e.z,this):(console.warn(`THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.`),this.multiplyVectors(e,t))},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error(`THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.`),this.applyQuaternion(vc.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(vc.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*r-o*n,l=s*n+o*t-i*r,u=s*r+i*n-a*t,d=-i*t-a*n-o*r;return this.x=c*s+d*-i+l*-o-u*-a,this.y=l*s+d*-a+u*-i-c*-o,this.z=u*s+d*-o+c*-a-l*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this},cross:function(e,t){return t===void 0?this.crossVectors(this,e):(console.warn(`THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.`),this.crossVectors(e,t))},crossVectors:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},projectOnVector:function(e){var t=e.lengthSq();if(t===0)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return _c.copy(this).projectOnVector(e),this.sub(_c)},reflect:function(e){return this.sub(_c.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(X.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,t*4)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,t*3)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn(`THREE.Vector3: offset has been removed from .fromBufferAttribute().`),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}),yc=new D,bc=new O,xc=new D(0,0,0),Sc=new D(1,1,1),Cc=new D,wc=new D,Tc=new D,Object.assign(O.prototype,{isMatrix4:!0,set:function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return new O().fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,n=e.elements,r=1/yc.setFromMatrixColumn(e,0).length(),i=1/yc.setFromMatrixColumn(e,1).length(),a=1/yc.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error(`THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.`);var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){var d=a*l,f=a*u,p=o*l,m=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=f+p*c,t[5]=d-m*c,t[9]=-o*s,t[2]=m-d*c,t[6]=p+f*c,t[10]=a*s}else if(e.order===`YXZ`){var h=s*l,g=s*u,_=c*l,v=c*u;t[0]=h+v*o,t[4]=_*o-g,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=g*o-_,t[6]=v+h*o,t[10]=a*s}else if(e.order===`ZXY`){var h=s*l,g=s*u,_=c*l,v=c*u;t[0]=h-v*o,t[4]=-a*u,t[8]=_+g*o,t[1]=g+_*o,t[5]=a*l,t[9]=v-h*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){var d=a*l,f=a*u,p=o*l,m=o*u;t[0]=s*l,t[4]=p*c-f,t[8]=d*c+m,t[1]=s*u,t[5]=m*c+d,t[9]=f*c-p,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){var y=a*s,b=a*c,x=o*s,S=o*c;t[0]=s*l,t[4]=S-y*u,t[8]=x*u+b,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=b*u+x,t[10]=y-S*u}else if(e.order===`XZY`){var y=a*s,b=a*c,x=o*s,S=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=y*u+S,t[5]=a*l,t[9]=b*u-x,t[2]=x*u-b,t[6]=o*l,t[10]=S*u+y}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(xc,e,Sc)},lookAt:function(e,t,n){var r=this.elements;return Tc.subVectors(e,t),Tc.lengthSq()===0&&(Tc.z=1),Tc.normalize(),Cc.crossVectors(n,Tc),Cc.lengthSq()===0&&(Math.abs(n.z)===1?Tc.x+=1e-4:Tc.z+=1e-4,Tc.normalize(),Cc.crossVectors(n,Tc)),Cc.normalize(),wc.crossVectors(Tc,Cc),r[0]=Cc.x,r[4]=wc.x,r[8]=Tc.x,r[1]=Cc.y,r[5]=wc.y,r[9]=Tc.y,r[2]=Cc.z,r[6]=wc.z,r[10]=Tc.z,this},multiply:function(e,t){return t===void 0?this.multiplyMatrices(this,e):(console.warn(`THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.`),this.multiplyMatrices(e,t))},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],I=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*I,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*I,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*I,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*I,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15];return p*(+i*s*u-r*c*u-i*o*d+n*c*d+r*o*f-n*s*f)+m*(+t*s*f-t*c*d+i*a*d-r*a*f+r*c*l-i*s*l)+h*(+t*c*u-t*o*f-i*a*u+n*a*f+i*o*l-n*c*l)+g*(-r*o*l-t*s*u+t*o*d+r*a*u-n*a*d+n*s*l)},transpose:function(){var e=this.elements,t=e[1];return e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this},getInverse:function(e,t){t!==void 0&&console.warn(`THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.`);var n=this.elements,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=r[8],p=r[9],m=r[10],h=r[11],g=r[12],_=r[13],v=r[14],y=r[15],b=p*v*d-_*m*d+_*u*h-l*v*h-p*u*y+l*m*y,x=g*m*d-f*v*d-g*u*h+c*v*h+f*u*y-c*m*y,S=f*_*d-g*p*d+g*l*h-c*_*h-f*l*y+c*p*y,C=g*p*u-f*_*u-g*l*m+c*_*m+f*l*v-c*p*v,w=i*b+a*x+o*S+s*C;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var T=1/w;return n[0]=b*T,n[1]=(_*m*s-p*v*s-_*o*h+a*v*h+p*o*y-a*m*y)*T,n[2]=(l*v*s-_*u*s+_*o*d-a*v*d-l*o*y+a*u*y)*T,n[3]=(p*u*s-l*m*s-p*o*d+a*m*d+l*o*h-a*u*h)*T,n[4]=x*T,n[5]=(f*v*s-g*m*s+g*o*h-i*v*h-f*o*y+i*m*y)*T,n[6]=(g*u*s-c*v*s-g*o*d+i*v*d+c*o*y-i*u*y)*T,n[7]=(c*m*s-f*u*s+f*o*d-i*m*d-c*o*h+i*u*h)*T,n[8]=S*T,n[9]=(g*p*s-f*_*s-g*a*h+i*_*h+f*a*y-i*p*y)*T,n[10]=(c*_*s-g*l*s+g*a*d-i*_*d-c*a*y+i*l*y)*T,n[11]=(f*l*s-c*p*s-f*a*d+i*p*d+c*a*h-i*l*h)*T,n[12]=C*T,n[13]=(f*_*o-g*p*o+g*a*m-i*_*m-f*a*v+i*p*v)*T,n[14]=(g*l*o-c*_*o-g*a*u+i*_*u+c*a*v-i*l*v)*T,n[15]=(c*p*o-f*l*o+f*a*u-i*p*u-c*a*m+i*l*m)*T,this},scale:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this},decompose:function(e,t,n){var r=this.elements,i=yc.set(r[0],r[1],r[2]).length(),a=yc.set(r[4],r[5],r[6]).length(),o=yc.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],bc.copy(this);var s=1/i,c=1/a,l=1/o;return bc.elements[0]*=s,bc.elements[1]*=s,bc.elements[2]*=s,bc.elements[4]*=c,bc.elements[5]*=c,bc.elements[6]*=c,bc.elements[8]*=l,bc.elements[9]*=l,bc.elements[10]*=l,t.setFromRotationMatrix(bc),n.x=i,n.y=a,n.z=o,this},makePerspective:function(e,t,n,r,i,a){a===void 0&&console.warn(`THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.`);var o=this.elements,s=2*i/(t-e),c=2*i/(n-r),l=(t+e)/(t-e),u=(n+r)/(n-r),d=-(a+i)/(a-i),f=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=f,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),c=1/(n-r),l=1/(a-i),u=(t+e)*s,d=(n+r)*c,f=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-f,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}),Ec=new O,Dc=new E,k.RotationOrders=[`XYZ`,`YZX`,`ZXY`,`XZY`,`YXZ`,`ZYX`],k.DefaultOrder=`XYZ`,Object.defineProperties(k.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(k.prototype,{isEuler:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=X.clamp,i=e.elements,a=i[0],o=i[4],s=i[8],c=i[1],l=i[5],u=i[9],d=i[2],f=i[6],p=i[10];switch(t=t||this._order,t){case`XYZ`:this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(f,l),this._z=0);break;case`YXZ`:this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-d,a),this._z=0);break;case`ZXY`:this._x=Math.asin(r(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a));break;case`ZYX`:this._y=Math.asin(-r(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l));break;case`YZX`:this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-d,a)):(this._x=0,this._y=Math.atan2(s,p));break;case`XZY`:this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn(`THREE.Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n!==!1&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return Ec.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ec,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return Dc.setFromEuler(this),this.setFromQuaternion(Dc,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new D(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(A.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return(this.mask&e.mask)!==0}}),Oc=0,kc=new D,Ac=new E,jc=new O,Mc=new D,Nc=new D,Pc=new D,Fc=new E,Ic=new D(1,0,0),Lc=new D(0,1,0),Rc=new D(0,0,1),zc={type:`added`},Bc={type:`removed`},j.DefaultUp=new D(0,1,0),j.DefaultMatrixAutoUpdate=!0,j.prototype=Object.assign(Object.create(y.prototype),{constructor:j,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return Ac.setFromAxisAngle(e,t),this.quaternion.multiply(Ac),this},rotateOnWorldAxis:function(e,t){return Ac.setFromAxisAngle(e,t),this.quaternion.premultiply(Ac),this},rotateX:function(e){return this.rotateOnAxis(Ic,e)},rotateY:function(e){return this.rotateOnAxis(Lc,e)},rotateZ:function(e){return this.rotateOnAxis(Rc,e)},translateOnAxis:function(e,t){return kc.copy(e).applyQuaternion(this.quaternion),this.position.add(kc.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(Ic,e)},translateY:function(e){return this.translateOnAxis(Lc,e)},translateZ:function(e){return this.translateOnAxis(Rc,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(jc.getInverse(this.matrixWorld))},lookAt:function(e,t,n){e.isVector3?Mc.copy(e):Mc.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),Nc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?jc.lookAt(Nc,Mc,this.up):jc.lookAt(Mc,Nc,this.up),this.quaternion.setFromRotationMatrix(jc),r&&(jc.extractRotation(r.matrixWorld),Ac.setFromRotationMatrix(jc),this.quaternion.premultiply(Ac.inverse()))},add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error(`THREE.Object3D.add: object can\'t be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(zc)):console.error(`THREE.Object3D.add: object not an instance of THREE.Object3D.`,e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Bc)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),jc.getInverse(this.matrixWorld),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),jc.multiply(e.parent.matrixWorld)),e.applyMatrix4(jc),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty(`id`,e)},getObjectByName:function(e){return this.getObjectByProperty(`name`,e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(e,t);if(i!==void 0)return i}},getWorldPosition:function(e){return e===void 0&&(console.warn(`THREE.Object3D: .getWorldPosition() target is now required`),e=new D),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return e===void 0&&(console.warn(`THREE.Object3D: .getWorldQuaternion() target is now required`),e=new E),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Nc,e,Pc),e},getWorldScale:function(e){return e===void 0&&(console.warn(`THREE.Object3D: .getWorldScale() target is now required`),e=new D),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Nc,Fc,e),e},getWorldDirection:function(e){e===void 0&&(console.warn(`THREE.Object3D: .getWorldDirection() target is now required`),e=new D),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:`Object`,generator:`Object3D.toJSON`});var r={};r.uuid=this.uuid,r.type=this.type,this.name!==``&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),JSON.stringify(this.userData)!==`{}`&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON());function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);var a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){var o=a.shapes;if(Array.isArray(o))for(var s=0,c=o.length;s<c;s++){var l=o[s];i(e.shapes,l)}else i(e.shapes,o)}}if(this.material!==void 0)if(Array.isArray(this.material)){for(var u=[],s=0,c=this.material.length;s<c;s++)u.push(i(e.materials,this.material[s]));r.material=u}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(var s=0;s<this.children.length;s++)r.children.push(this.children[s].toJSON(e).object)}if(t){var d=h(e.geometries),f=h(e.materials),p=h(e.textures),m=h(e.images),o=h(e.shapes);d.length>0&&(n.geometries=d),f.length>0&&(n.materials=f),p.length>0&&(n.textures=p),m.length>0&&(n.images=m),o.length>0&&(n.shapes=o)}return n.object=r,n;function h(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}},clone:function(e){return new this.constructor().copy(this,e)},copy:function(e,t){if(t===void 0&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(var n=0;n<e.children.length;n++){var r=e.children[n];this.add(r.clone())}return this}}),M.prototype=Object.assign(Object.create(j.prototype),{constructor:M,isScene:!0,copy:function(e,t){return j.prototype.copy.call(this,e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return this.background!==null&&(t.object.background=this.background.toJSON(e)),this.environment!==null&&(t.object.environment=this.environment.toJSON(e)),this.fog!==null&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:`dispose`})}}),Vc=[new D,new D,new D,new D,new D,new D,new D,new D],Hc=new D,Uc=new N,Wc=new D,Gc=new D,Kc=new D,qc=new D,Jc=new D,Yc=new D,Xc=new D,Zc=new D,Qc=new D,$c=new D,Object.assign(N.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.length;s<c;s+=3){var l=e[s],u=e[s+1],d=e[s+2];l<t&&(t=l),u<n&&(n=u),d<r&&(r=d),l>i&&(i=l),u>a&&(a=u),d>o&&(o=d)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),u=e.getY(s),d=e.getZ(s);l<t&&(t=l),u<n&&(n=u),d<r&&(r=d),l>i&&(i=l),u>a&&(a=u),d>o&&(o=d)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=Hc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return e===void 0&&(console.warn(`THREE.Box3: .getCenter() target is now required`),e=new D),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return e===void 0&&(console.warn(`THREE.Box3: .getSize() target is now required`),e=new D),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;t!==void 0&&(t.boundingBox===null&&t.computeBoundingBox(),Uc.copy(t.boundingBox),Uc.applyMatrix4(e.matrixWorld),this.union(Uc));for(var n=e.children,r=0,i=n.length;r<i;r++)this.expandByObject(n[r]);return this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return t===void 0&&(console.warn(`THREE.Box3: .getParameter() target is now required`),t=new D),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,Hc),Hc.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(Xc),Zc.subVectors(this.max,Xc),Wc.subVectors(e.a,Xc),Gc.subVectors(e.b,Xc),Kc.subVectors(e.c,Xc),qc.subVectors(Gc,Wc),Jc.subVectors(Kc,Gc),Yc.subVectors(Wc,Kc);var t=[0,-qc.z,qc.y,0,-Jc.z,Jc.y,0,-Yc.z,Yc.y,qc.z,0,-qc.x,Jc.z,0,-Jc.x,Yc.z,0,-Yc.x,-qc.y,qc.x,0,-Jc.y,Jc.x,0,-Yc.y,Yc.x,0];return!P(t,Wc,Gc,Kc,Zc)||(t=[1,0,0,0,1,0,0,0,1],!P(t,Wc,Gc,Kc,Zc))?!1:(Qc.crossVectors(qc,Jc),t=[Qc.x,Qc.y,Qc.z],P(t,Wc,Gc,Kc,Zc))},clampPoint:function(e,t){return t===void 0&&(console.warn(`THREE.Box3: .clampPoint() target is now required`),t=new D),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Hc.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return e===void 0&&console.error(`THREE.Box3: .getBoundingSphere() target is now required`),this.getCenter(e.center),e.radius=this.getSize(Hc).length()*.5,e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()?this:(Vc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Vc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Vc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Vc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Vc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Vc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Vc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Vc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Vc),this)},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),el=new N,Object.assign(F.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;t===void 0?el.setFromPoints(e).getCenter(n):n.copy(t);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},isEmpty:function(){return this.radius<0},makeEmpty:function(){return this.center.set(0,0,0),this.radius=-1,this},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return t===void 0&&(console.warn(`THREE.Sphere: .clampPoint() target is now required`),t=new D),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return e===void 0&&(console.warn(`THREE.Sphere: .getBoundingBox() target is now required`),e=new N),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),tl=new D,nl=new D,rl=new D,il=new D,al=new D,ol=new D,sl=new D,Object.assign(I.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return t===void 0&&(console.warn(`THREE.Ray: .at() target is now required`),t=new D),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,tl)),this},closestPointToPoint:function(e,t){t===void 0&&(console.warn(`THREE.Ray: .closestPointToPoint() target is now required`),t=new D),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=tl.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(tl.copy(this.direction).multiplyScalar(t).add(this.origin),tl.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,r){nl.copy(e).add(t).multiplyScalar(.5),rl.copy(t).sub(e).normalize(),il.copy(this.origin).sub(nl);var i=e.distanceTo(t)*.5,a=-this.direction.dot(rl),o=il.dot(this.direction),s=-il.dot(rl),c=il.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){var m=1/l;u*=m,d*=m,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(rl).multiplyScalar(d).add(nl),f},intersectSphere:function(e,t){tl.subVectors(e.center,this.origin);var n=tl.dot(this.direction),r=tl.dot(tl)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return n===null?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||n!==n)&&(n=i),(a<r||r!==r)&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)},intersectsBox:function(e){return this.intersectBox(e,tl)!==null},intersectTriangle:function(e,t,n,r,i){al.subVectors(t,e),ol.subVectors(n,e),sl.crossVectors(al,ol);var a=this.direction.dot(sl),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;il.subVectors(this.origin,e);var s=o*this.direction.dot(ol.crossVectors(il,ol));if(s<0)return null;var c=o*this.direction.dot(al.cross(il));if(c<0||s+c>a)return null;var l=-o*il.dot(sl);return l<0?null:this.at(l/a,i)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),cl=new D,ll=new D,ul=new x,Object.assign(L.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var r=cl.subVectors(n,t).cross(ll.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return t===void 0&&(console.warn(`THREE.Plane: .projectPoint() target is now required`),t=new D),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){t===void 0&&(console.warn(`THREE.Plane: .intersectLine() target is now required`),t=new D);var n=e.delta(cl),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):void 0;var i=-(e.start.dot(this.normal)+this.constant)/r;if(!(i<0||i>1))return t.copy(n).multiplyScalar(i).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return e===void 0&&(console.warn(`THREE.Plane: .coplanarPoint() target is now required`),e=new D),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||ul.getNormalMatrix(e),r=this.coplanarPoint(cl).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),dl=new D,fl=new D,pl=new D,ml=new D,hl=new D,gl=new D,_l=new D,vl=new D,yl=new D,bl=new D,Object.assign(R,{getNormal:function(e,t,n,r){r===void 0&&(console.warn(`THREE.Triangle: .getNormal() target is now required`),r=new D),r.subVectors(n,t),dl.subVectors(e,t),r.cross(dl);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)},getBarycoord:function(e,t,n,r,i){dl.subVectors(r,t),fl.subVectors(n,t),pl.subVectors(e,t);var a=dl.dot(dl),o=dl.dot(fl),s=dl.dot(pl),c=fl.dot(fl),l=fl.dot(pl),u=a*c-o*o;if(i===void 0&&(console.warn(`THREE.Triangle: .getBarycoord() target is now required`),i=new D),u===0)return i.set(-2,-1,-1);var d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)},containsPoint:function(e,t,n,r){return R.getBarycoord(e,t,n,r,ml),ml.x>=0&&ml.y>=0&&ml.x+ml.y<=1},getUV:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,ml),s.set(0,0),s.addScaledVector(i,ml.x),s.addScaledVector(a,ml.y),s.addScaledVector(o,ml.z),s},isFrontFacing:function(e,t,n,r){return dl.subVectors(n,t),fl.subVectors(e,t),dl.cross(fl).dot(r)<0}}),Object.assign(R.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return dl.subVectors(this.c,this.b),fl.subVectors(this.a,this.b),dl.cross(fl).length()*.5},getMidpoint:function(e){return e===void 0&&(console.warn(`THREE.Triangle: .getMidpoint() target is now required`),e=new D),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return R.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return e===void 0&&(console.warn(`THREE.Triangle: .getPlane() target is now required`),e=new L),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return R.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,r,i){return R.getUV(e,this.a,this.b,this.c,t,n,r,i)},containsPoint:function(e){return R.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return R.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){t===void 0&&(console.warn(`THREE.Triangle: .closestPointToPoint() target is now required`),t=new D);var n=this.a,r=this.b,i=this.c,a,o;hl.subVectors(r,n),gl.subVectors(i,n),vl.subVectors(e,n);var s=hl.dot(vl),c=gl.dot(vl);if(s<=0&&c<=0)return t.copy(n);yl.subVectors(e,r);var l=hl.dot(yl),u=gl.dot(yl);if(l>=0&&u<=l)return t.copy(r);var d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(hl,a);bl.subVectors(e,i);var f=hl.dot(bl),p=gl.dot(bl);if(p>=0&&f<=p)return t.copy(i);var m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(gl,o);var h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return _l.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(_l,o);var g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(hl,a).addScaledVector(gl,o)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}),xl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Sl={h:0,s:0,l:0},Cl={h:0,s:0,l:0},Object.assign(z.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):typeof e==`number`?this.setHex(e):typeof e==`string`&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=X.euclideanModulo(e,1),t=X.clamp(t,0,1),n=X.clamp(n,0,1),t===0)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=ee(i,r,e+1/3),this.g=ee(i,r,e),this.b=ee(i,r,e-1/3)}return this},setStyle:function(e){function t(t){t!==void 0&&parseFloat(t)<1&&console.warn(`THREE.Color: Alpha component of `+e+` will be ignored.`)}var n;if(n=/^((?:rgb|hsl)a?)\\(\\s*([^\\)]*)\\)/.exec(e)){var r,i=n[1],a=n[2];switch(i){case`rgb`:case`rgba`:if(r=/^(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case`hsl`:case`hsla`:if(r=/^([0-9]*\\.?[0-9]+)\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(o,s,c)}break}}else if(n=/^\\#([A-Fa-f0-9]+)$/.exec(e)){var l=n[1],u=l.length;if(u===3)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(u===6)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=xl[e];return t===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(t),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return t===void 0&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){t===void 0&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=te(e.r),this.g=te(e.g),this.b=te(e.b),this},copyLinearToSRGB:function(e){return this.r=ne(e.r),this.g=ne(e.g),this.b=ne(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return this.r*255<<16^this.g*255<<8^this.b*255<<0},getHexString:function(){return(`000000`+this.getHex().toString(16)).slice(-6)},getHSL:function(e){e===void 0&&(console.warn(`THREE.Color: .getHSL() target is now required`),e={h:0,s:0,l:0});var t=this.r,n=this.g,r=this.b,i=Math.max(t,n,r),a=Math.min(t,n,r),o,s,c=(a+i)/2;if(a===i)o=0,s=0;else{var l=i-a;switch(s=c<=.5?l/(i+a):l/(2-i-a),i){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;case r:o=(t-n)/l+4;break}o/=6}return e.h=o,e.s=s,e.l=c,e},getStyle:function(){return`rgb(`+(this.r*255|0)+`,`+(this.g*255|0)+`,`+(this.b*255|0)+`)`},offsetHSL:function(e,t,n){return this.getHSL(Sl),Sl.h+=e,Sl.s+=t,Sl.l+=n,this.setHSL(Sl.h,Sl.s,Sl.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:function(e,t){this.getHSL(Sl),e.getHSL(Cl);var n=X.lerp(Sl.h,Cl.h,t),r=X.lerp(Sl.s,Cl.s,t),i=X.lerp(Sl.l,Cl.l,t);return this.setHSL(n,r,i),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return t===void 0&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),z.NAMES=xl,Object.assign(B.prototype,{clone:function(){return new this.constructor().copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}}),wl=0,V.prototype=Object.assign(Object.create(y.prototype),{constructor:V,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(e!==void 0)for(var t in e){var n=e[t];if(n===void 0){console.warn(`THREE.Material: \'`+t+`\' parameter is undefined.`);continue}if(t===`shading`){console.warn(`THREE.`+this.type+`: .shading has been removed. Use the boolean .flatShading instead.`),this.flatShading=n===1;continue}var r=this[t];if(r===void 0){console.warn(`THREE.`+this.type+`: \'`+t+`\' is not a property of this material.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}},toJSON:function(e){var t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,this.combine!==void 0&&(n.combine=this.combine),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.flatShading===!0&&(n.flatShading=this.flatShading),this.side!==0&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.morphTargets===!0&&(n.morphTargets=!0),this.morphNormals===!0&&(n.morphNormals=!0),this.skinning===!0&&(n.skinning=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),JSON.stringify(this.userData)!==`{}`&&(n.userData=this.userData);function r(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}if(t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n},clone:function(){return new this.constructor().copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(t!==null){var r=t.length;n=Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),Object.defineProperty(V.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),re.prototype=Object.create(V.prototype),re.prototype.constructor=re,re.prototype.isMeshBasicMaterial=!0,re.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},Tl=new D,Object.defineProperty(H.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),Object.assign(H.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyColorsArray(): color is undefined`,r),a=new z),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyVector2sArray(): vector is undefined`,r),a=new b),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyVector3sArray(): vector is undefined`,r),a=new D),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyVector4sArray(): vector is undefined`,r),a=new C),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},applyMatrix3:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.applyMatrix3(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},applyMatrix4:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.applyMatrix4(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},applyNormalMatrix:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.applyNormalMatrix(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},transformDirection:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.transformDirection(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},set:function(e,t){return t===void 0&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),U.prototype=Object.create(H.prototype),U.prototype.constructor=U,ie.prototype=Object.create(H.prototype),ie.prototype.constructor=ie,W.prototype=Object.create(H.prototype),W.prototype.constructor=W,ae.prototype=Object.create(H.prototype),ae.prototype.constructor=ae,G.prototype=Object.create(H.prototype),G.prototype.constructor=G,oe.prototype=Object.create(H.prototype),oe.prototype.constructor=oe,se.prototype=Object.create(H.prototype),se.prototype.constructor=se,K.prototype=Object.create(H.prototype),K.prototype.constructor=K,ce.prototype=Object.create(H.prototype),ce.prototype.constructor=ce,Object.assign(le.prototype,{computeGroups:function(e){for(var t,n=[],r=void 0,i=e.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==r&&(r=o.materialIndex,t!==void 0&&(t.count=a*3-t.start,n.push(t)),t={start:a*3,materialIndex:r})}t!==void 0&&(t.count=a*3-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t=e.faces,n=e.vertices,r=e.faceVertexUvs,i=r[0]&&r[0].length>0,a=r[1]&&r[1].length>0,o=e.morphTargets,s=o.length,c;if(s>0){c=[];for(var l=0;l<s;l++)c[l]={name:o[l].name,data:[]};this.morphTargets.position=c}var u=e.morphNormals,d=u.length,f;if(d>0){f=[];for(var l=0;l<d;l++)f[l]={name:u[l].name,data:[]};this.morphTargets.normal=f}var p=e.skinIndices,m=e.skinWeights,h=p.length===n.length,g=m.length===n.length;n.length>0&&t.length===0&&console.error(`THREE.DirectGeometry: Faceless geometries are not supported.`);for(var l=0;l<t.length;l++){var _=t[l];this.vertices.push(n[_.a],n[_.b],n[_.c]);var v=_.vertexNormals;if(v.length===3)this.normals.push(v[0],v[1],v[2]);else{var y=_.normal;this.normals.push(y,y,y)}var x=_.vertexColors;if(x.length===3)this.colors.push(x[0],x[1],x[2]);else{var S=_.color;this.colors.push(S,S,S)}if(i===!0){var C=r[0][l];C===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv `,l),this.uvs.push(new b,new b,new b)):this.uvs.push(C[0],C[1],C[2])}if(a===!0){var C=r[1][l];C===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 `,l),this.uvs2.push(new b,new b,new b)):this.uvs2.push(C[0],C[1],C[2])}for(var w=0;w<s;w++){var T=o[w].vertices;c[w].data.push(T[_.a],T[_.b],T[_.c])}for(var w=0;w<d;w++){var E=u[w].vertexNormals[l];f[w].data.push(E.a,E.b,E.c)}h&&this.skinIndices.push(p[_.a],p[_.b],p[_.c]),g&&this.skinWeights.push(m[_.a],m[_.b],m[_.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}}),El=1,Dl=new O,Ol=new j,kl=new D,Al=new N,jl=new N,Ml=new D,q.prototype=Object.assign(Object.create(y.prototype),{constructor:q,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(ue(e)>65535?se:G)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:n===void 0?0:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(n!==void 0){var r=new x().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},rotateX:function(e){return Dl.makeRotationX(e),this.applyMatrix4(Dl),this},rotateY:function(e){return Dl.makeRotationY(e),this.applyMatrix4(Dl),this},rotateZ:function(e){return Dl.makeRotationZ(e),this.applyMatrix4(Dl),this},translate:function(e,t,n){return Dl.makeTranslation(e,t,n),this.applyMatrix4(Dl),this},scale:function(e,t,n){return Dl.makeScale(e,t,n),this.applyMatrix4(Dl),this},lookAt:function(e){return Ol.lookAt(e),Ol.updateMatrix(),this.applyMatrix4(Ol.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(kl).negate(),this.translate(kl.x,kl.y,kl.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new K(t.vertices.length*3,3),r=new K(t.colors.length*3,3);if(this.setAttribute(`position`,n.copyVector3sArray(t.vertices)),this.setAttribute(`color`,r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new K(t.lineDistances.length,1);this.setAttribute(`lineDistance`,i.copyArray(t.lineDistances))}t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute(`position`,new K(t,3)),this},updateFromObject:function(e){var t=e.geometry;if(e.isMesh){var n=t.__directGeometry;if(t.elementsNeedUpdate===!0&&(n=void 0,t.elementsNeedUpdate=!1),n===void 0)return this.fromGeometry(t);n.verticesNeedUpdate=t.verticesNeedUpdate,n.normalsNeedUpdate=t.normalsNeedUpdate,n.colorsNeedUpdate=t.colorsNeedUpdate,n.uvsNeedUpdate=t.uvsNeedUpdate,n.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=n}var r;return t.verticesNeedUpdate===!0&&(r=this.attributes.position,r!==void 0&&(r.copyVector3sArray(t.vertices),r.needsUpdate=!0),t.verticesNeedUpdate=!1),t.normalsNeedUpdate===!0&&(r=this.attributes.normal,r!==void 0&&(r.copyVector3sArray(t.normals),r.needsUpdate=!0),t.normalsNeedUpdate=!1),t.colorsNeedUpdate===!0&&(r=this.attributes.color,r!==void 0&&(r.copyColorsArray(t.colors),r.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(r=this.attributes.uv,r!==void 0&&(r.copyVector2sArray(t.uvs),r.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(r=this.attributes.lineDistance,r!==void 0&&(r.copyArray(t.lineDistances),r.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=new le().fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(e.vertices.length*3);if(this.setAttribute(`position`,new H(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(e.normals.length*3);this.setAttribute(`normal`,new H(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(e.colors.length*3);this.setAttribute(`color`,new H(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(e.uvs.length*2);this.setAttribute(`uv`,new H(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(e.uvs2.length*2);this.setAttribute(`uv2`,new H(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],c=e.morphTargets[o],l=0,u=c.length;l<u;l++){var d=c[l],f=new K(d.data.length*3,3);f.name=d.name,s.push(f.copyVector3sArray(d.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var p=new K(e.skinIndices.length*4,4);this.setAttribute(`skinIndex`,p.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var m=new K(e.skinWeights.length*4,4);this.setAttribute(`skinWeight`,m.copyVector4sArray(e.skinWeights))}return e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new N);var e=this.attributes.position,t=this.morphAttributes.position;if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var i=t[n];Al.setFromBufferAttribute(i),this.morphTargetsRelative?(Ml.addVectors(this.boundingBox.min,Al.min),this.boundingBox.expandByPoint(Ml),Ml.addVectors(this.boundingBox.max,Al.max),this.boundingBox.expandByPoint(Ml)):(this.boundingBox.expandByPoint(Al.min),this.boundingBox.expandByPoint(Al.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error(`THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new F);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(Al.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];jl.setFromBufferAttribute(a),this.morphTargetsRelative?(Ml.addVectors(Al.min,jl.min),Al.expandByPoint(Ml),Ml.addVectors(Al.max,jl.max),Al.expandByPoint(Ml)):(Al.expandByPoint(jl.min),Al.expandByPoint(jl.max))}Al.getCenter(n);for(var o=0,r=0,i=e.count;r<i;r++)Ml.fromBufferAttribute(e,r),o=Math.max(o,n.distanceToSquared(Ml));if(t)for(var r=0,i=t.length;r<i;r++)for(var a=t[r],s=this.morphTargetsRelative,c=0,l=a.count;c<l;c++)Ml.fromBufferAttribute(a,c),s&&(kl.fromBufferAttribute(e,c),Ml.add(kl)),o=Math.max(o,n.distanceToSquared(Ml));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error(`THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(t.normal===void 0)this.setAttribute(`normal`,new H(new Float32Array(n.length),3));else for(var r=t.normal.array,i=0,a=r.length;i<a;i++)r[i]=0;var o=t.normal.array,s,c,l,u=new D,d=new D,f=new D,p=new D,m=new D;if(e)for(var h=e.array,i=0,a=e.count;i<a;i+=3)s=h[i+0]*3,c=h[i+1]*3,l=h[i+2]*3,u.fromArray(n,s),d.fromArray(n,c),f.fromArray(n,l),p.subVectors(f,d),m.subVectors(u,d),p.cross(m),o[s]+=p.x,o[s+1]+=p.y,o[s+2]+=p.z,o[c]+=p.x,o[c+1]+=p.y,o[c+2]+=p.z,o[l]+=p.x,o[l+1]+=p.y,o[l+2]+=p.z;else for(var i=0,a=n.length;i<a;i+=9)u.fromArray(n,i),d.fromArray(n,i+3),f.fromArray(n,i+6),p.subVectors(f,d),m.subVectors(u,d),p.cross(m),o[i]=p.x,o[i+1]=p.y,o[i+2]=p.z,o[i+3]=p.x,o[i+4]=p.y,o[i+5]=p.z,o[i+6]=p.x,o[i+7]=p.y,o[i+8]=p.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(!(e&&e.isBufferGeometry)){console.error(`THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.`,e);return}t===void 0&&(t=0,console.warn(`THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.`));var n=this.attributes;for(var r in n)if(e.attributes[r]!==void 0)for(var i=n[r].array,a=e.attributes[r],o=a.array,s=a.itemSize*t,c=Math.min(o.length,i.length-s),l=0,u=s;l<c;l++,u++)i[u]=o[l];return this},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Ml.x=e.getX(t),Ml.y=e.getY(t),Ml.z=e.getZ(t),Ml.normalize(),e.setXYZ(t,Ml.x,Ml.y,Ml.z)},toNonIndexed:function(){function e(e,t){for(var n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0,c=0,l=t.length;c<l;c++){o=t[c]*r;for(var u=0;u<r;u++)a[s++]=n[o++]}return new H(a,r,i)}if(this.index===null)return console.warn(`THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed.`),this;var t=new q,n=this.index.array,r=this.attributes;for(var i in r){var a=r[i],o=e(a,n);t.setAttribute(i,o)}var s=this.morphAttributes;for(i in s){for(var c=[],l=s[i],u=0,d=l.length;u<d;u++){var a=l[u],o=e(a,n);c.push(o)}t.morphAttributes[i]=c}t.morphTargetsRelative=this.morphTargetsRelative;for(var f=this.groups,u=0,p=f.length;u<p;u++){var m=f[u];t.addGroup(m.start,m.count,m.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){var t=this.parameters;for(var n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;r!==null&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var n in i){var a=i[n],o=a.toJSON();a.name!==``&&(o.name=a.name),e.data.attributes[n]=o}var s={},c=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],u=[],d=0,f=l.length;d<f;d++){var a=l[d],o=a.toJSON();a.name!==``&&(o.name=a.name),u.push(o)}u.length>0&&(s[n]=u,c=!0)}c&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var p=this.groups;p.length>0&&(e.data.groups=JSON.parse(JSON.stringify(p)));var m=this.boundingSphere;return m!==null&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e},clone:function(){return new q().copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;i!==null&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,r=l.length;n<r;n++)c.push(l[n].clone());this.morphAttributes[t]=c}this.morphTargetsRelative=e.morphTargetsRelative;var u=e.groups;for(n=0,r=u.length;n<r;n++){var d=u[n];this.addGroup(d.start,d.count,d.materialIndex)}var f=e.boundingBox;f!==null&&(this.boundingBox=f.clone());var p=e.boundingSphere;return p!==null&&(this.boundingSphere=p.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),Nl=new O,Pl=new I,Fl=new F,Il=new D,Ll=new D,Rl=new D,zl=new D,Bl=new D,Vl=new D,Hl=new D,Ul=new D,Wl=new D,Gl=new b,Kl=new b,ql=new b,Jl=new D,Yl=new D,de.prototype=Object.assign(Object.create(j.prototype),{constructor:de,isMesh:!0,copy:function(e){return j.prototype.copy.call(this,e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error(`THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`)}},raycast:function(e,t){var n=this.geometry,r=this.material,i=this.matrixWorld;if(r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Fl.copy(n.boundingSphere),Fl.applyMatrix4(i),e.ray.intersectsSphere(Fl)!==!1&&(Nl.getInverse(i),Pl.copy(e.ray).applyMatrix4(Nl),!(n.boundingBox!==null&&Pl.intersectsBox(n.boundingBox)===!1)))){var a;if(n.isBufferGeometry){var o,s,c,l=n.index,u=n.attributes.position,d=n.morphAttributes.position,f=n.morphTargetsRelative,p=n.attributes.uv,m=n.attributes.uv2,h=n.groups,g=n.drawRange,_,v,y,x,S,C,w,T;if(l!==null)if(Array.isArray(r))for(_=0,y=h.length;_<y;_++)for(S=h[_],C=r[S.materialIndex],w=Math.max(S.start,g.start),T=Math.min(S.start+S.count,g.start+g.count),v=w,x=T;v<x;v+=3)o=l.getX(v),s=l.getX(v+1),c=l.getX(v+2),a=pe(this,C,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(v/3),a.face.materialIndex=S.materialIndex,t.push(a));else for(w=Math.max(0,g.start),T=Math.min(l.count,g.start+g.count),_=w,y=T;_<y;_+=3)o=l.getX(_),s=l.getX(_+1),c=l.getX(_+2),a=pe(this,r,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(_/3),t.push(a));else if(u!==void 0)if(Array.isArray(r))for(_=0,y=h.length;_<y;_++)for(S=h[_],C=r[S.materialIndex],w=Math.max(S.start,g.start),T=Math.min(S.start+S.count,g.start+g.count),v=w,x=T;v<x;v+=3)o=v,s=v+1,c=v+2,a=pe(this,C,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(v/3),a.face.materialIndex=S.materialIndex,t.push(a));else for(w=Math.max(0,g.start),T=Math.min(u.count,g.start+g.count),_=w,y=T;_<y;_+=3)o=_,s=_+1,c=_+2,a=pe(this,r,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(_/3),t.push(a))}else if(n.isGeometry){var E,D,O,k=Array.isArray(r),A=n.vertices,j=n.faces,M,N=n.faceVertexUvs[0];N.length>0&&(M=N);for(var P=0,F=j.length;P<F;P++){var I=j[P],L=k?r[I.materialIndex]:r;if(L!==void 0&&(E=A[I.a],D=A[I.b],O=A[I.c],a=fe(this,L,e,Pl,E,D,O,Jl),a)){if(M&&M[P]){var z=M[P];Gl.copy(z[0]),Kl.copy(z[1]),ql.copy(z[2]),a.uv=R.getUV(Jl,E,D,O,Gl,Kl,ql,new b)}a.face=I,a.faceIndex=P,t.push(a)}}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Xl=0,Zl=new O,Ql=new j,$l=new D,J.prototype=Object.assign(Object.create(y.prototype),{constructor:J,isGeometry:!0,applyMatrix4:function(e){for(var t=new x().getNormalMatrix(e),n=0,r=this.vertices.length;n<r;n++)this.vertices[n].applyMatrix4(e);for(var n=0,r=this.faces.length;n<r;n++){var i=this.faces[n];i.normal.applyMatrix3(t).normalize();for(var a=0,o=i.vertexNormals.length;a<o;a++)i.vertexNormals[a].applyMatrix3(t).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return Zl.makeRotationX(e),this.applyMatrix4(Zl),this},rotateY:function(e){return Zl.makeRotationY(e),this.applyMatrix4(Zl),this},rotateZ:function(e){return Zl.makeRotationZ(e),this.applyMatrix4(Zl),this},translate:function(e,t,n){return Zl.makeTranslation(e,t,n),this.applyMatrix4(Zl),this},scale:function(e,t,n){return Zl.makeScale(e,t,n),this.applyMatrix4(Zl),this},lookAt:function(e){return Ql.lookAt(e),Ql.updateMatrix(),this.applyMatrix4(Ql.matrix),this},fromBufferGeometry:function(e){var t=this,n=e.index===null?void 0:e.index.array,r=e.attributes;if(r.position===void 0)return console.error(`THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.`),this;var i=r.position.array,a=r.normal===void 0?void 0:r.normal.array,o=r.color===void 0?void 0:r.color.array,s=r.uv===void 0?void 0:r.uv.array,c=r.uv2===void 0?void 0:r.uv2.array;c!==void 0&&(this.faceVertexUvs[1]=[]);for(var l=0;l<i.length;l+=3)t.vertices.push(new D().fromArray(i,l)),o!==void 0&&t.colors.push(new z().fromArray(o,l));function u(e,n,r,i){var l=o===void 0?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[r].clone()],u=new B(e,n,r,a===void 0?[]:[new D().fromArray(a,e*3),new D().fromArray(a,n*3),new D().fromArray(a,r*3)],l,i);t.faces.push(u),s!==void 0&&t.faceVertexUvs[0].push([new b().fromArray(s,e*2),new b().fromArray(s,n*2),new b().fromArray(s,r*2)]),c!==void 0&&t.faceVertexUvs[1].push([new b().fromArray(c,e*2),new b().fromArray(c,n*2),new b().fromArray(c,r*2)])}var d=e.groups;if(d.length>0)for(var l=0;l<d.length;l++)for(var f=d[l],p=f.start,m=f.count,h=p,g=p+m;h<g;h+=3)n===void 0?u(h,h+1,h+2,f.materialIndex):u(n[h],n[h+1],n[h+2],f.materialIndex);else if(n!==void 0)for(var l=0;l<n.length;l+=3)u(n[l],n[l+1],n[l+2]);else for(var l=0;l<i.length/3;l+=3)u(l,l+1,l+2);return this.computeFaceNormals(),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter($l).negate(),this.translate($l.x,$l.y,$l.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=t===0?1:1/t,r=new O;return r.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(r),this},computeFaceNormals:function(){for(var e=new D,t=new D,n=0,r=this.faces.length;n<r;n++){var i=this.faces[n],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){e===void 0&&(e=!0);var t,n,r,i,a,o=Array(this.vertices.length);for(t=0,n=this.vertices.length;t<n;t++)o[t]=new D;if(e){var s,c,l,u=new D,d=new D;for(r=0,i=this.faces.length;r<i;r++)a=this.faces[r],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,c),d.subVectors(s,c),u.cross(d),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),r=0,i=this.faces.length;r<i;r++)a=this.faces[r],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(r=0,i=this.faces.length;r<i;r++){a=this.faces[r];var f=a.vertexNormals;f.length===3?(f[0].copy(o[a.a]),f[1].copy(o[a.b]),f[2].copy(o[a.c])):(f[0]=o[a.a].clone(),f[1]=o[a.b].clone(),f[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){n=this.faces[e];var r=n.vertexNormals;r.length===3?(r[0].copy(n.normal),r[1].copy(n.normal),r[2].copy(n.normal)):(r[0]=n.normal.clone(),r[1]=n.normal.clone(),r[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n<r;n++)for(i=this.faces[n],i.__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),e=0,t=i.vertexNormals.length;e<t;e++)i.__originalVertexNormals[e]?i.__originalVertexNormals[e].copy(i.vertexNormals[e]):i.__originalVertexNormals[e]=i.vertexNormals[e].clone();var a=new J;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals,c,l;for(n=0,r=this.faces.length;n<r;n++)c=new D,l={a:new D,b:new D,c:new D},o.push(c),s.push(l)}var u=this.morphNormals[e];a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals();var c,l;for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],c=u.faceNormals[n],l=u.vertexNormals[n],c.copy(i.normal),l.a.copy(i.vertexNormals[0]),l.b.copy(i.vertexNormals[1]),l.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],i.normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new N),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new F),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(!(e&&e.isGeometry)){console.error(`THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.`,e);return}var r,i=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.colors,u=e.colors;n===void 0&&(n=0),t!==void 0&&(r=new x().getNormalMatrix(t));for(var d=0,f=o.length;d<f;d++){var p=o[d].clone();t!==void 0&&p.applyMatrix4(t),a.push(p)}for(var d=0,f=u.length;d<f;d++)l.push(u[d].clone());for(d=0,f=c.length;d<f;d++){var m=c[d],h,g,_,v=m.vertexNormals,y=m.vertexColors;h=new B(m.a+i,m.b+i,m.c+i),h.normal.copy(m.normal),r!==void 0&&h.normal.applyMatrix3(r).normalize();for(var b=0,S=v.length;b<S;b++)g=v[b].clone(),r!==void 0&&g.applyMatrix3(r).normalize(),h.vertexNormals.push(g);h.color.copy(m.color);for(var b=0,S=y.length;b<S;b++)_=y[b],h.vertexColors.push(_.clone());h.materialIndex=m.materialIndex+n,s.push(h)}for(var d=0,f=e.faceVertexUvs.length;d<f;d++){var C=e.faceVertexUvs[d];this.faceVertexUvs[d]===void 0&&(this.faceVertexUvs[d]=[]);for(var b=0,S=C.length;b<S;b++){for(var w=C[b],T=[],E=0,D=w.length;E<D;E++)T.push(w[E].clone());this.faceVertexUvs[d].push(T)}}},mergeMesh:function(e){if(!(e&&e.isMesh)){console.error(`THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.`,e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)},mergeVertices:function(){var e={},t=[],n=[],r,i,a=Math.pow(10,4),o,s,c,l,u,d;for(o=0,s=this.vertices.length;o<s;o++)r=this.vertices[o],i=Math.round(r.x*a)+`_`+Math.round(r.y*a)+`_`+Math.round(r.z*a),e[i]===void 0?(e[i]=o,t.push(this.vertices[o]),n[o]=t.length-1):n[o]=n[e[i]];var f=[];for(o=0,s=this.faces.length;o<s;o++){c=this.faces[o],c.a=n[c.a],c.b=n[c.b],c.c=n[c.c],l=[c.a,c.b,c.c];for(var p=0;p<3;p++)if(l[p]===l[(p+1)%3]){f.push(o);break}}for(o=f.length-1;o>=0;o--){var m=f[o];for(this.faces.splice(m,1),u=0,d=this.faceVertexUvs.length;u<d;u++)this.faceVertexUvs[u].splice(m,1)}var h=this.vertices.length-t.length;return this.vertices=t,h},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];this.vertices.push(new D(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;function r(e,t){return e.materialIndex-t.materialIndex}e.sort(r);var i=this.faceVertexUvs[0],a=this.faceVertexUvs[1],o,s;i&&i.length===t&&(o=[]),a&&a.length===t&&(s=[]);for(var n=0;n<t;n++){var c=e[n]._id;o&&o.push(i[c]),s&&s.push(a[c])}o&&(this.faceVertexUvs[0]=o),s&&(this.faceVertexUvs[1]=s)},toJSON:function(){var e={metadata:{version:4.5,type:`Geometry`,generator:`Geometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),this.parameters!==void 0){var t=this.parameters;for(var n in t)t[n]!==void 0&&(e[n]=t[n]);return e}for(var r=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];r.push(a.x,a.y,a.z)}for(var o=[],s=[],c={},l=[],u={},d=[],f={},i=0;i<this.faces.length;i++){var p=this.faces[i],m=!0,h=!1,g=this.faceVertexUvs[0][i]!==void 0,_=p.normal.length()>0,v=p.vertexNormals.length>0,y=p.color.r!==1||p.color.g!==1||p.color.b!==1,b=p.vertexColors.length>0,x=0;if(x=T(x,0,0),x=T(x,1,m),x=T(x,2,h),x=T(x,3,g),x=T(x,4,_),x=T(x,5,v),x=T(x,6,y),x=T(x,7,b),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),g){var S=this.faceVertexUvs[0][i];o.push(O(S[0]),O(S[1]),O(S[2]))}if(_&&o.push(E(p.normal)),v){var C=p.vertexNormals;o.push(E(C[0]),E(C[1]),E(C[2]))}if(y&&o.push(D(p.color)),b){var w=p.vertexColors;o.push(D(w[0]),D(w[1]),D(w[2]))}}function T(e,t,n){return n?e|1<<t:e&~(1<<t)}function E(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return c[t]===void 0?(c[t]=s.length/3,s.push(e.x,e.y,e.z),c[t]):c[t]}function D(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return u[t]===void 0?(u[t]=l.length,l.push(e.getHex()),u[t]):u[t]}function O(e){var t=e.x.toString()+e.y.toString();return f[t]===void 0?(f[t]=d.length/2,d.push(e.x,e.y),f[t]):f[t]}return e.data={},e.data.vertices=r,e.data.normals=s,l.length>0&&(e.data.colors=l),d.length>0&&(e.data.uvs=[d]),e.data.faces=o,e},clone:function(){return new J().copy(this)},copy:function(e){var t,n,r,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var c=e.colors;for(t=0,n=c.length;t<n;t++)this.colors.push(c[t].clone());var l=e.faces;for(t=0,n=l.length;t<n;t++)this.faces.push(l[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var u=e.faceVertexUvs[t];for(this.faceVertexUvs[t]===void 0&&(this.faceVertexUvs[t]=[]),r=0,i=u.length;r<i;r++){var d=u[r],f=[];for(a=0,o=d.length;a<o;a++){var p=d[a];f.push(p.clone())}this.faceVertexUvs[t].push(f)}}var m=e.morphTargets;for(t=0,n=m.length;t<n;t++){var h={};if(h.name=m[t].name,m[t].vertices!==void 0)for(h.vertices=[],r=0,i=m[t].vertices.length;r<i;r++)h.vertices.push(m[t].vertices[r].clone());if(m[t].normals!==void 0)for(h.normals=[],r=0,i=m[t].normals.length;r<i;r++)h.normals.push(m[t].normals[r].clone());this.morphTargets.push(h)}var g=e.morphNormals;for(t=0,n=g.length;t<n;t++){var _={};if(g[t].vertexNormals!==void 0)for(_.vertexNormals=[],r=0,i=g[t].vertexNormals.length;r<i;r++){var v=g[t].vertexNormals[r],y={};y.a=v.a.clone(),y.b=v.b.clone(),y.c=v.c.clone(),_.vertexNormals.push(y)}if(g[t].faceNormals!==void 0)for(_.faceNormals=[],r=0,i=g[t].faceNormals.length;r<i;r++)_.faceNormals.push(g[t].faceNormals[r].clone());this.morphNormals.push(_)}var b=e.skinWeights;for(t=0,n=b.length;t<n;t++)this.skinWeights.push(b[t].clone());var x=e.skinIndices;for(t=0,n=x.length;t<n;t++)this.skinIndices.push(x[t].clone());var S=e.lineDistances;for(t=0,n=S.length;t<n;t++)this.lineDistances.push(S[t]);var C=e.boundingBox;C!==null&&(this.boundingBox=C.clone());var w=e.boundingSphere;return w!==null&&(this.boundingSphere=w.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),eu=class extends J{constructor(e,t,n,r,i,a){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new tu(e,t,n,r,i,a)),this.mergeVertices()}},tu=class extends q{constructor(e,t,n,r,i,a){super(),this.type=`BoxBufferGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;e=e||1,t=t||1,n=n||1,r=Math.floor(r)||1,i=Math.floor(i)||1,a=Math.floor(a)||1;let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new K(c,3)),this.setAttribute(`normal`,new K(l,3)),this.setAttribute(`uv`,new K(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,O=new D;for(let a=0;a<w;a++){let o=a*y-x;for(let s=0;s<C;s++)O[e]=(s*v-b)*r,O[t]=o*i,O[n]=S,c.push(O.x,O.y,O.z),O[e]=0,O[t]=0,O[n]=m>0?1:-1,l.push(O.x,O.y,O.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(f,E,_),f+=E,d+=T}}},nu={clone:me,merge:he},ru=`void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}`,iu=`void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}`,ge.prototype=Object.create(V.prototype),ge.prototype.constructor=ge,ge.prototype.isShaderMaterial=!0,ge.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=me(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this},ge.prototype.toJSON=function(e){var t=V.prototype.toJSON.call(this,e);for(var n in t.uniforms={},this.uniforms){var r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:`t`,value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:`c`,value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:`v2`,value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:`v3`,value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:`v4`,value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:`m3`,value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:`m4`,value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var i={};for(var a in this.extensions)this.extensions[a]===!0&&(i[a]=!0);return Object.keys(i).length>0&&(t.extensions=i),t},_e.prototype=Object.assign(Object.create(j.prototype),{constructor:_e,isCamera:!0,copy:function(e,t){return j.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){e===void 0&&(console.warn(`THREE.Camera: .getWorldDirection() target is now required`),e=new D),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){j.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){j.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return new this.constructor().copy(this)}}),ve.prototype=Object.assign(Object.create(_e.prototype),{constructor:ve,isPerspectiveCamera:!0,copy:function(e,t){return _e.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=X.RAD2DEG*2*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(X.DEG2RAD*.5*this.fov);return .5*this.getFilmHeight()/e},getEffectiveFOV:function(){return X.RAD2DEG*2*Math.atan(Math.tan(X.DEG2RAD*.5*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(X.DEG2RAD*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var c=this.filmOffset;c!==0&&(i+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),au=90,ou=1,ye.prototype=Object.create(j.prototype),ye.prototype.constructor=ye,be.prototype=Object.create(w.prototype),be.prototype.constructor=be,be.prototype.isWebGLCubeRenderTarget=!0,be.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new M,r={uniforms:{tEquirect:{value:null}},vertexShader:[`varying vec3 vWorldDirection;`,`vec3 transformDirection( in vec3 dir, in mat4 matrix ) {`,` return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );`,`}`,`void main() {`,` vWorldDirection = transformDirection( position, modelMatrix );`,` #include <begin_vertex>`,` #include <project_vertex>`,`}`].join(`\n`),fragmentShader:[`uniform sampler2D tEquirect;`,`varying vec3 vWorldDirection;`,`#include <common>`,`void main() {`,` vec3 direction = normalize( vWorldDirection );`,` vec2 sampleUV = equirectUv( direction );`,` gl_FragColor = texture2D( tEquirect, sampleUV );`,`}`].join(`\n`)},i=new ge({type:`CubemapFromEquirect`,uniforms:me(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;var a=new de(new tu(5,5,5),i);return n.add(a),new ye(1,10,this).update(e,n),a.geometry.dispose(),a.material.dispose(),this},xe.prototype=Object.create(S.prototype),xe.prototype.constructor=xe,xe.prototype.isDataTexture=!0,su=new F,cu=new D,Object.assign(Se.prototype,{set:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],d=n[8],f=n[9],p=n[10],m=n[11],h=n[12],g=n[13],_=n[14],v=n[15];return t[0].setComponents(o-r,u-s,m-d,v-h).normalize(),t[1].setComponents(o+r,u+s,m+d,v+h).normalize(),t[2].setComponents(o+i,u+c,m+f,v+g).normalize(),t[3].setComponents(o-i,u-c,m-f,v-g).normalize(),t[4].setComponents(o-a,u-l,m-p,v-_).normalize(),t[5].setComponents(o+a,u+l,m+p,v+_).normalize(),this},intersectsObject:function(e){var t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),su.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(su)},intersectsSprite:function(e){return su.center.set(0,0,0),su.radius=.7071067811865476,su.applyMatrix4(e.matrixWorld),this.intersectsSphere(su)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++)if(t[i].distanceToPoint(n)<r)return!1;return!0},intersectsBox:function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(cu.x=r.normal.x>0?e.max.x:e.min.x,cu.y=r.normal.y>0?e.max.y:e.min.y,cu.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(cu)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}}),Z={common:{diffuse:{value:new z(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new x},uv2Transform:{value:new x},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new b(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new z(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new z(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new x}},sprite:{diffuse:{value:new z(15658734)},opacity:{value:1},center:{value:new b(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new x}}},Te.prototype=Object.create(J.prototype),Te.prototype.constructor=Te,Ee.prototype=Object.create(q.prototype),Ee.prototype.constructor=Ee,Q={alphamap_fragment:`#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif`,alphamap_pars_fragment:`#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,alphatest_fragment:`#ifdef ALPHATEST\n if ( diffuseColor.a < ALPHATEST ) discard;\n#endif`,aomap_fragment:`#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n #endif\n#endif`,aomap_pars_fragment:`#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif`,begin_vertex:`vec3 transformed = vec3( position );`,beginnormal_vertex:`vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif`,bsdfs:`vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n return vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n#else\n if( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n return ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n return Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n return 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( incidentLight.direction + viewDir );\n float dotNL = saturate( dot( normal, incidentLight.direction ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n return specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n vec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n vec3 FssEss = F * brdf.x + brdf.y;\n float Ess = brdf.x + brdf.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n float dotNH = saturate( dot( geometry.normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n return sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n float invAlpha = 1.0 / roughness;\n float cos2h = NoH * NoH;\n float sin2h = max(1.0 - cos2h, 0.0078125); return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n vec3 N = geometry.normal;\n vec3 V = geometry.viewDir;\n vec3 H = normalize( V + L );\n float dotNH = saturate( dot( N, H ) );\n return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif`,bumpmap_pars_fragment:`#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 );\n fDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif`,clipping_planes_fragment:`#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif`,color_fragment:`#ifdef USE_COLOR\n diffuseColor.rgb *= vColor;\n#endif`,color_pars_fragment:`#ifdef USE_COLOR\n varying vec3 vColor;\n#endif`,color_pars_vertex:`#ifdef USE_COLOR\n varying vec3 vColor;\n#endif`,color_vertex:`#ifdef USE_COLOR\n vColor.xyz = color.xyz;\n#endif`,common:`#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n#ifdef CLEARCOAT\n vec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n float distance = dot( planeNormal, point - pointOnPlane );\n return - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n return dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x); } else if (face == 1.0) {\n uv = vec2(-direction.x, -direction.z) / abs(direction.y); } else if (face == 2.0) {\n uv = vec2(-direction.x, direction.y) / abs(direction.z); } else if (face == 3.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x); } else if (face == 4.0) {\n uv = vec2(-direction.x, direction.z) / abs(direction.y); } else {\n uv = vec2(direction.x, direction.y) / abs(direction.z); }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n mat3 m = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vUv );\n emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif`,encodings_fragment:`gl_FragColor = linearToOutputTexel( gl_FragColor );`,encodings_pars_fragment:`\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.r, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.r, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract( Le );\n vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n return vec4( max( vRGB, 0.0 ), 1.0 );\n}`,envmap_fragment:`#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n \n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n #elif defined( ENVMAP_TYPE_EQUIREC )\n reflectVec = normalize( reflectVec );\n vec2 sampleUV = equirectUv( reflectVec );\n vec4 envColor = texture2D( envMap, sampleUV );\n #elif defined( ENVMAP_TYPE_SPHERE )\n reflectVec = normalize( reflectVec );\n vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifndef ENVMAP_TYPE_CUBE_UV\n envColor = envMapTexelToLinear( envColor );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform int maxMipLevel;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif`,envmap_physical_pars_fragment:`#if defined( USE_ENVMAP )\n #ifdef ENVMAP_MODE_REFRACTION\n uniform float refractionRatio;\n #endif\n vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n #else\n vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n #else\n vec4 envMapColor = vec4( 0.0 );\n #endif\n return PI * envMapColor.rgb * envMapIntensity;\n }\n float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n float maxMIPLevelScalar = float( maxMIPLevel );\n float sigma = PI * roughness * roughness / ( 1.0 + roughness );\n float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n }\n vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( -viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n #else\n vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n #endif\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n #else\n vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV = equirectUv( reflectVec );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #endif\n return envMapColor.rgb * envMapIntensity;\n }\n#endif`,envmap_vertex:`#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) { \n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif`,fog_vertex:`#ifdef USE_FOG\n fogDepth = -mvPosition.z;\n#endif`,fog_pars_vertex:`#ifdef USE_FOG\n varying float fogDepth;\n#endif`,fog_fragment:`#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif`,fog_pars_fragment:`#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float fogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return texture2D( gradientMap, coord ).rgb;\n #else\n return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n #endif\n}`,lightmap_fragment:`#ifdef USE_LIGHTMAP\n vec4 lightMapTexel= texture2D( lightMap, vUv2 );\n reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif`,lights_lambert_vertex:`vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n vLightBack = vec3( 0.0 );\n vIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n vIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n #pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n #pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n #pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n #ifdef DOUBLE_SIDED\n vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n #endif\n }\n #pragma unroll_loop_end\n#endif`,lights_pars_begin:`uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n directLight.color = directionalLight.color;\n directLight.direction = directionalLight.direction;\n directLight.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n struct PointLightShadow {\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = pointLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n directLight.color = pointLight.color;\n directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n directLight.visible = ( directLight.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = spotLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n float angleCos = dot( directLight.direction, spotLight.direction );\n if ( angleCos > spotLight.coneCos ) {\n float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n directLight.color = spotLight.color;\n directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n directLight.visible = true;\n } else {\n directLight.color = vec3( 0.0 );\n directLight.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n float dotNL = dot( geometry.normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n }\n#endif`,lights_toon_fragment:`ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,lights_toon_pars_fragment:`varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material ) (0)`,lights_phong_fragment:`BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material ) (0)`,lights_physical_fragment:`PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheen;\n#endif`,lights_physical_pars_fragment:`struct PhysicalMaterial {\n vec3 diffuseColor;\n float specularRoughness;\n vec3 specularColor;\n#ifdef CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n vec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometry.normal;\n vec3 viewDir = geometry.viewDir;\n vec3 position = geometry.position;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.specularRoughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n #ifdef CLEARCOAT\n float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = ccDotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n ccIrradiance *= PI;\n #endif\n float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n #else\n float clearcoatDHR = 0.0;\n #endif\n #ifdef USE_SHEEN\n reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n material.specularRoughness,\n directLight.direction,\n geometry,\n material.sheenColor\n );\n #else\n reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n #endif\n reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef CLEARCOAT\n float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n float ccDotNL = ccDotNV;\n float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n #else\n float clearcoatDHR = 0.0;\n #endif\n float clearcoatInv = 1.0 - clearcoatDHR;\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}`,lights_fragment_begin:`\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n geometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointDirectLightIrradiance( pointLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotDirectLightIrradiance( spotLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n irradiance += getLightProbeIrradiance( lightProbe, geometry );\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel= texture2D( lightMap, vUv2 );\n vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n lightMapIrradiance *= PI;\n #endif\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n #ifdef CLEARCOAT\n clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n #endif\n#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif`,logdepthbuf_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n varying float vIsPerspective;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif`,logdepthbuf_vertex:`#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n #else\n if ( isPerspectiveMatrix( projectionMatrix ) ) {\n gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n }\n #endif\n#endif`,map_fragment:`#ifdef USE_MAP\n vec4 texelColor = texture2D( map, vUv );\n texelColor = mapTexelToLinear( texelColor );\n diffuseColor *= texelColor;\n#endif`,map_pars_fragment:`#ifdef USE_MAP\n uniform sampler2D map;\n#endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n vec4 mapTexel = texture2D( map, uv );\n diffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif`,map_particle_pars_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,metalnessmap_fragment:`float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vUv );\n metalnessFactor *= texelMetalness.b;\n#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS\n uniform float morphTargetBaseInfluence;\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n #endif\n#endif`,normal_fragment_begin:`#ifdef FLAT_SHADED\n vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #endif\n #ifdef USE_TANGENT\n vec3 tangent = normalize( vTangent );\n vec3 bitangent = normalize( vBitangent );\n #ifdef DOUBLE_SIDED\n tangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n bitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #endif\n #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n mat3 vTBN = mat3( tangent, bitangent, normal );\n #endif\n #endif\n#endif\nvec3 geometryNormal = normal;`,normal_fragment_maps:`#ifdef OBJECTSPACE_NORMALMAP\n normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n #ifdef USE_TANGENT\n normal = normalize( vTBN * mapN );\n #else\n normal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n #endif\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n float scale = sign( st1.t * st0.s - st0.t * st1.s );\n vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n vec3 N = normalize( surf_norm );\n mat3 tsn = mat3( S, T, N );\n mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n return normalize( tsn * mapN );\n }\n#endif`,clearcoat_normal_fragment_begin:`#ifdef CLEARCOAT\n vec3 clearcoatNormal = geometryNormal;\n#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n #ifdef USE_TANGENT\n clearcoatNormal = normalize( vTBN * clearcoatMapN );\n #else\n clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n #endif\n#endif`,clearcoat_pars_fragment:`#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif`,packing:`vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif`,dithering_pars_fragment:`#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif`,roughnessmap_fragment:`float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n roughnessFactor *= texelRoughness.g;\n#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif`,shadowmap_pars_fragment:`#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n bool frustumTest = all( frustumTestVec );\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif`,shadowmap_pars_vertex:`#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif`,shadowmap_vertex:`#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif`,shadowmask_pars_fragment:`float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}`,skinbase_vertex:`#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n #ifdef BONE_TEXTURE\n uniform highp sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureSize ) );\n float y = floor( j / float( boneTextureSize ) );\n float dx = 1.0 / float( boneTextureSize );\n float dy = 1.0 / float( boneTextureSize );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n #else\n uniform mat4 boneMatrices[ MAX_BONES ];\n mat4 getBoneMatrix( const in float i ) {\n mat4 bone = boneMatrices[ int(i) ];\n return bone;\n }\n #endif\n#endif`,skinning_vertex:`#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif`,skinnormal_vertex:`#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif`,specularmap_fragment:`float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif`,tonemapping_pars_fragment:`#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}`,uv_pars_fragment:`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n varying vec2 vUv;\n#endif`,uv_pars_vertex:`#ifdef USE_UV\n #ifdef UVS_VERTEX_ONLY\n vec2 vUv;\n #else\n varying vec2 vUv;\n #endif\n uniform mat3 uvTransform;\n#endif`,uv_vertex:`#ifdef USE_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif`,uv2_pars_fragment:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n varying vec2 vUv2;\n#endif`,uv2_pars_vertex:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n attribute vec2 uv2;\n varying vec2 vUv2;\n uniform mat3 uv2Transform;\n#endif`,uv2_vertex:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif`,background_frag:`uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n gl_FragColor = mapTexelToLinear( texColor );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}`,background_vert:`varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}`,cube_frag:`#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n vec3 vReflect = vWorldDirection;\n #include <envmap_fragment>\n gl_FragColor = envColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}`,cube_vert:`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}`,depth_frag:`#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <logdepthbuf_fragment>\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}`,depth_vert:`#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}`,distanceRGBA_frag:`#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}`,distanceRGBA_vert:`#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}`,equirect_frag:`uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n vec4 texColor = texture2D( tEquirect, sampleUV );\n gl_FragColor = mapTexelToLinear( texColor );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}`,equirect_vert:`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}`,linedashed_frag:`uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}`,linedashed_vert:`uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <color_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}`,meshbasic_frag:`uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n \n vec4 lightMapTexel= texture2D( lightMap, vUv2 );\n reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshbasic_vert:`#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <skinbase_vertex>\n #ifdef USE_ENVMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}`,meshlambert_frag:`uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n varying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <emissivemap_fragment>\n #ifdef DOUBLE_SIDED\n reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n #else\n reflectedLight.indirectDiffuse += vIndirectFront;\n #endif\n #include <lightmap_fragment>\n reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n #ifdef DOUBLE_SIDED\n reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n #else\n reflectedLight.directDiffuse = vLightFront;\n #endif\n reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshlambert_vert:`#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n varying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <lights_lambert_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,meshmatcap_frag:`#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n matcapColor = matcapTexelToLinear( matcapColor );\n #else\n vec4 matcapColor = vec4( 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshmatcap_vert:`#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}`,meshtoon_frag:`#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshtoon_vert:`#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,meshphong_frag:`#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshphong_vert:`#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,meshphysical_frag:`#define STANDARD\n#ifdef PHYSICAL\n #define REFLECTIVITY\n #define CLEARCOAT\n #define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n uniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n uniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #ifdef TRANSPARENCY\n diffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n #endif\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshphysical_vert:`#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,normal_frag:`#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}`,normal_vert:`#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n vViewPosition = - mvPosition.xyz;\n#endif\n}`,points_frag:`uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}`,points_vert:`uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}`,shadow_frag:`uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}`,shadow_vert:`#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <begin_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,sprite_frag:`uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}`,sprite_vert:`uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}`},lu={basic:{uniforms:he([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.fog]),vertexShader:Q.meshbasic_vert,fragmentShader:Q.meshbasic_frag},lambert:{uniforms:he([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.fog,Z.lights,{emissive:{value:new z(0)}}]),vertexShader:Q.meshlambert_vert,fragmentShader:Q.meshlambert_frag},phong:{uniforms:he([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new z(0)},specular:{value:new z(1118481)},shininess:{value:30}}]),vertexShader:Q.meshphong_vert,fragmentShader:Q.meshphong_frag},standard:{uniforms:he([Z.common,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.roughnessmap,Z.metalnessmap,Z.fog,Z.lights,{emissive:{value:new z(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag},toon:{uniforms:he([Z.common,Z.specularmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.gradientmap,Z.fog,Z.lights,{emissive:{value:new z(0)},specular:{value:new z(1118481)},shininess:{value:30}}]),vertexShader:Q.meshtoon_vert,fragmentShader:Q.meshtoon_frag},matcap:{uniforms:he([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,{matcap:{value:null}}]),vertexShader:Q.meshmatcap_vert,fragmentShader:Q.meshmatcap_frag},points:{uniforms:he([Z.points,Z.fog]),vertexShader:Q.points_vert,fragmentShader:Q.points_frag},dashed:{uniforms:he([Z.common,Z.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Q.linedashed_vert,fragmentShader:Q.linedashed_frag},depth:{uniforms:he([Z.common,Z.displacementmap]),vertexShader:Q.depth_vert,fragmentShader:Q.depth_frag},normal:{uniforms:he([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,{opacity:{value:1}}]),vertexShader:Q.normal_vert,fragmentShader:Q.normal_frag},sprite:{uniforms:he([Z.sprite,Z.fog]),vertexShader:Q.sprite_vert,fragmentShader:Q.sprite_frag},background:{uniforms:{uvTransform:{value:new x},t2D:{value:null}},vertexShader:Q.background_vert,fragmentShader:Q.background_frag},cube:{uniforms:he([Z.envmap,{opacity:{value:1}}]),vertexShader:Q.cube_vert,fragmentShader:Q.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Q.equirect_vert,fragmentShader:Q.equirect_frag},distanceRGBA:{uniforms:he([Z.common,Z.displacementmap,{referencePosition:{value:new D},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Q.distanceRGBA_vert,fragmentShader:Q.distanceRGBA_frag},shadow:{uniforms:he([Z.lights,Z.fog,{color:{value:new z(0)},opacity:{value:1}}]),vertexShader:Q.shadow_vert,fragmentShader:Q.shadow_frag}},lu.physical={uniforms:he([lu.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new b(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new z(0)},transparency:{value:0}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag},Re.prototype=Object.create(S.prototype),Re.prototype.constructor=Re,Re.prototype.isCubeTexture=!0,Object.defineProperty(Re.prototype,`images`,{get:function(){return this.image},set:function(e){this.image=e}}),ze.prototype=Object.create(S.prototype),ze.prototype.constructor=ze,ze.prototype.isDataTexture2DArray=!0,Be.prototype=Object.create(S.prototype),Be.prototype.constructor=Be,Be.prototype.isDataTexture3D=!0,uu=new S,du=new ze,fu=new Be,pu=new Re,mu=[],hu=[],gu=new Float32Array(16),_u=new Float32Array(9),vu=new Float32Array(4),Ct.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Ue(t,e)},wt.prototype.setValue=function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}},yu=/([\\w\\d_]+)(\\])?(\\[|\\.)?/g,Dt.prototype.setValue=function(e,t,n,r){var i=this.map[t];i!==void 0&&i.setValue(e,n,r)},Dt.prototype.setOptional=function(e,t,n){var r=t[n];r!==void 0&&this.setValue(e,n,r)},Dt.upload=function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];s.needsUpdate!==!1&&o.setValue(e,s.value,r)}},Dt.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n},bu=0,xu=/^[ \\t]*#include +<([\\w\\d./]+)>/gm,Su=/#pragma unroll_loop[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}/g,Cu=/#pragma unroll_loop_start[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}[\\s]+?#pragma unroll_loop_end/g,wu=0,dn.prototype=Object.create(V.prototype),dn.prototype.constructor=dn,dn.prototype.isMeshDepthMaterial=!0,dn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},fn.prototype=Object.create(V.prototype),fn.prototype.constructor=fn,fn.prototype.isMeshDistanceMaterial=!0,fn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},Tu=`uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}`,Eu=`void main() {\n gl_Position = vec4( position, 1.0 );\n}`,_n.prototype=Object.assign(Object.create(ve.prototype),{constructor:_n,isArrayCamera:!0}),vn.prototype=Object.assign(Object.create(j.prototype),{constructor:vn,isGroup:!0}),Object.assign(yn.prototype,{constructor:yn,getTargetRaySpace:function(){return this._targetRay===null&&(this._targetRay=new vn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return this._grip===null&&(this._grip=new vn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this},update:function(e,t,n){var r=null,i=null,a=this._targetRay,o=this._grip;return e&&(a!==null&&(r=t.getPose(e.targetRaySpace,n),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale))),o!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)))),a!==null&&(a.visible=r!==null),o!==null&&(o.visible=i!==null),this}}),Object.assign(bn.prototype,y.prototype),Object.assign(Cn.prototype,{isFogExp2:!0,clone:function(){return new Cn(this.color,this.density)},toJSON:function(){return{type:`FogExp2`,color:this.color.getHex(),density:this.density}}}),Object.assign(wn.prototype,{isFog:!0,clone:function(){return new wn(this.color,this.near,this.far)},toJSON:function(){return{type:`Fog`,color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Tn.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),Object.assign(Tn.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t){return t===void 0&&(t=0),this.array.set(e,t),this},clone:function(){return new this.constructor().copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}}),Du=new D,Object.defineProperties(En.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(En.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)Du.x=this.getX(t),Du.y=this.getY(t),Du.z=this.getZ(t),Du.applyMatrix4(e),this.setXYZ(t,Du.x,Du.y,Du.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this},clone:function(){console.log(`THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.`);for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return new H(new this.array.constructor(e),this.itemSize,this.normalized)},toJSON:function(){console.log(`THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.`);for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}),Dn.prototype=Object.create(V.prototype),Dn.prototype.constructor=Dn,Dn.prototype.isSpriteMaterial=!0,Dn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this},ku=new D,Au=new D,ju=new D,Mu=new b,Nu=new b,Pu=new O,Fu=new D,Iu=new D,Lu=new D,Ru=new b,zu=new b,Bu=new b,On.prototype=Object.assign(Object.create(j.prototype),{constructor:On,isSprite:!0,raycast:function(e,t){e.camera===null&&console.error(`THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.`),Au.setFromMatrixScale(this.matrixWorld),Pu.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),ju.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Au.multiplyScalar(-ju.z);var n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));var a=this.center;kn(Fu.set(-.5,-.5,0),ju,a,Au,r,i),kn(Iu.set(.5,-.5,0),ju,a,Au,r,i),kn(Lu.set(.5,.5,0),ju,a,Au,r,i),Ru.set(0,0),zu.set(1,0),Bu.set(1,1);var o=e.ray.intersectTriangle(Fu,Iu,Lu,!1,ku);if(!(o===null&&(kn(Iu.set(-.5,.5,0),ju,a,Au,r,i),zu.set(0,1),o=e.ray.intersectTriangle(Fu,Lu,Iu,!1,ku),o===null))){var s=e.ray.origin.distanceTo(ku);s<e.near||s>e.far||t.push({distance:s,point:ku.clone(),uv:R.getUV(ku,Fu,Iu,Lu,Ru,zu,Bu,new b),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return j.prototype.copy.call(this,e),e.center!==void 0&&this.center.copy(e.center),this}}),Vu=new D,Hu=new D,An.prototype=Object.assign(Object.create(j.prototype),{constructor:An,isLOD:!0,copy:function(e){j.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n<r;n++){var i=t[n];this.addLevel(i.object.clone(),i.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){t===void 0&&(t=0),t=Math.abs(t);for(var n=this.levels,r=0;r<n.length&&!(t<n[r].distance);r++);return n.splice(r,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){if(this.levels.length>0){Vu.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(Vu);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){Vu.setFromMatrixPosition(e.matrixWorld),Hu.setFromMatrixPosition(this.matrixWorld);var n=Vu.distanceTo(Hu)/e.zoom;t[0].object.visible=!0;for(var r=1,i=t.length;r<i&&n>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var a=n[r];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),jn.prototype=Object.assign(Object.create(de.prototype),{constructor:jn,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new C,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var i=1/e.manhattanLength();i===1/0?e.set(1,0,0,0):e.multiplyScalar(i),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){de.prototype.updateMatrixWorld.call(this,e),this.bindMode===`attached`?this.bindMatrixInverse.getInverse(this.matrixWorld):this.bindMode===`detached`?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn(`THREE.SkinnedMesh: Unrecognized bindMode: `+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},boneTransform:function(){var e=new D,t=new C,n=new C,r=new D,i=new O;return function(a,o){var s=this.skeleton,c=this.geometry;t.fromBufferAttribute(c.attributes.skinIndex,a),n.fromBufferAttribute(c.attributes.skinWeight,a),e.fromBufferAttribute(c.attributes.position,a).applyMatrix4(this.bindMatrix),o.set(0,0,0);for(var l=0;l<4;l++){var u=n.getComponent(l);if(u!==0){var d=t.getComponent(l);i.multiplyMatrices(s.bones[d].matrixWorld,s.boneInverses[d]),o.addScaledVector(r.copy(e).applyMatrix4(i),u)}}return o.applyMatrix4(this.bindMatrixInverse)}}()}),Uu=new O,Wu=new O,Object.assign(Mn.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new O;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)e=this.bones[t],e&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:Wu;Uu.multiplyMatrices(o,t[i]),Uu.toArray(n,i*16)}r!==void 0&&(r.needsUpdate=!0)},clone:function(){return new Mn(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),Nn.prototype=Object.assign(Object.create(j.prototype),{constructor:Nn,isBone:!0}),Gu=new O,Ku=new O,qu=[],Ju=new de,Pn.prototype=Object.assign(Object.create(de.prototype),{constructor:Pn,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,e*16)},raycast:function(e,t){var n=this.matrixWorld,r=this.count;if(Ju.geometry=this.geometry,Ju.material=this.material,Ju.material!==void 0)for(var i=0;i<r;i++){this.getMatrixAt(i,Gu),Ku.multiplyMatrices(n,Gu),Ju.matrixWorld=Ku,Ju.raycast(e,qu);for(var a=0,o=qu.length;a<o;a++){var s=qu[a];s.instanceId=i,s.object=this,t.push(s)}qu.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,e*16)},updateMorphTargets:function(){}}),Fn.prototype=Object.create(V.prototype),Fn.prototype.constructor=Fn,Fn.prototype.isLineBasicMaterial=!0,Fn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this},Yu=new D,Xu=new D,Zu=new O,Qu=new I,$u=new F,In.prototype=Object.assign(Object.create(j.prototype),{constructor:In,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(e.index===null){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)Yu.fromBufferAttribute(t,r-1),Xu.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Yu.distanceTo(Xu);e.setAttribute(`lineDistance`,new K(n,1))}else console.warn(`THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);else if(e.isGeometry){var a=e.vertices,n=e.lineDistances;n[0]=0;for(var r=1,i=a.length;r<i;r++)n[r]=n[r-1],n[r]+=a[r-1].distanceTo(a[r])}return this},raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold;if(n.boundingSphere===null&&n.computeBoundingSphere(),$u.copy(n.boundingSphere),$u.applyMatrix4(r),$u.radius+=i,e.ray.intersectsSphere($u)!==!1){Zu.getInverse(r),Qu.copy(e.ray).applyMatrix4(Zu);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new D,c=new D,l=new D,u=new D,d=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var f=n.index,p=n.attributes.position.array;if(f!==null)for(var m=f.array,h=0,g=m.length-1;h<g;h+=d){var _=m[h],v=m[h+1];s.fromArray(p,_*3),c.fromArray(p,v*3);var y=Qu.distanceSqToSegment(s,c,u,l);if(!(y>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this})}}else for(var h=0,g=p.length/3-1;h<g;h+=d){s.fromArray(p,3*h),c.fromArray(p,3*h+3);var y=Qu.distanceSqToSegment(s,c,u,l);if(!(y>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this})}}}else if(n.isGeometry)for(var x=n.vertices,S=x.length,h=0;h<S-1;h+=d){var y=Qu.distanceSqToSegment(x[h],x[h+1],u,l);if(!(y>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this})}}}},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error(`THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),ed=new D,td=new D,Ln.prototype=Object.assign(Object.create(In.prototype),{constructor:Ln,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(e.index===null){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)ed.fromBufferAttribute(t,r),td.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+ed.distanceTo(td);e.setAttribute(`lineDistance`,new K(n,1))}else console.warn(`THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);else if(e.isGeometry)for(var a=e.vertices,n=e.lineDistances,r=0,i=a.length;r<i;r+=2)ed.copy(a[r]),td.copy(a[r+1]),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+ed.distanceTo(td);return this}}),Rn.prototype=Object.assign(Object.create(In.prototype),{constructor:Rn,isLineLoop:!0}),zn.prototype=Object.create(V.prototype),zn.prototype.constructor=zn,zn.prototype.isPointsMaterial=!0,zn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this},nd=new O,rd=new I,id=new F,ad=new D,Bn.prototype=Object.assign(Object.create(j.prototype),{constructor:Bn,isPoints:!0,raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold;if(n.boundingSphere===null&&n.computeBoundingSphere(),id.copy(n.boundingSphere),id.applyMatrix4(r),id.radius+=i,e.ray.intersectsSphere(id)!==!1){nd.getInverse(r),rd.copy(e.ray).applyMatrix4(nd);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,c=n.attributes.position.array;if(s!==null)for(var l=s.array,u=0,d=l.length;u<d;u++){var f=l[u];ad.fromArray(c,f*3),Vn(ad,f,o,r,e,t,this)}else for(var u=0,p=c.length/3;u<p;u++)ad.fromArray(c,u*3),Vn(ad,u,o,r,e,t,this)}else for(var m=n.vertices,u=0,p=m.length;u<p;u++)Vn(m[u],u,o,r,e,t,this)}},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error(`THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Hn.prototype=Object.assign(Object.create(S.prototype),{constructor:Hn,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Un.prototype=Object.create(S.prototype),Un.prototype.constructor=Un,Un.prototype.isCompressedTexture=!0,Wn.prototype=Object.create(S.prototype),Wn.prototype.constructor=Wn,Wn.prototype.isCanvasTexture=!0,Gn.prototype=Object.create(S.prototype),Gn.prototype.constructor=Gn,Gn.prototype.isDepthTexture=!0,Kn.prototype=Object.create(q.prototype),Kn.prototype.constructor=Kn,qn.prototype=Object.create(J.prototype),qn.prototype.constructor=qn,Jn.prototype=Object.create(q.prototype),Jn.prototype.constructor=Jn,Yn.prototype=Object.create(J.prototype),Yn.prototype.constructor=Yn,Xn.prototype=Object.create(q.prototype),Xn.prototype.constructor=Xn,Zn.prototype=Object.create(J.prototype),Zn.prototype.constructor=Zn,Qn.prototype=Object.create(Xn.prototype),Qn.prototype.constructor=Qn,$n.prototype=Object.create(J.prototype),$n.prototype.constructor=$n,er.prototype=Object.create(Xn.prototype),er.prototype.constructor=er,tr.prototype=Object.create(J.prototype),tr.prototype.constructor=tr,nr.prototype=Object.create(Xn.prototype),nr.prototype.constructor=nr,rr.prototype=Object.create(J.prototype),rr.prototype.constructor=rr,ir.prototype=Object.create(Xn.prototype),ir.prototype.constructor=ir,ar.prototype=Object.create(J.prototype),ar.prototype.constructor=ar,or.prototype=Object.create(q.prototype),or.prototype.constructor=or,or.prototype.toJSON=function(){var e=q.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},sr.prototype=Object.create(J.prototype),sr.prototype.constructor=sr,cr.prototype=Object.create(q.prototype),cr.prototype.constructor=cr,lr.prototype=Object.create(J.prototype),lr.prototype.constructor=lr,ur.prototype=Object.create(q.prototype),ur.prototype.constructor=ur,od={triangulate:function(e,t,n){n=n||2;var r=t&&t.length,i=r?t[0]*n:e.length,a=dr(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;var s,c,l,u,d,f,p;if(r&&(a=vr(e,t,a,n)),e.length>80*n){s=l=e[0],c=u=e[1];for(var m=n;m<i;m+=n)d=e[m],f=e[m+1],d<s&&(s=d),f<c&&(c=f),d>l&&(l=d),f>u&&(u=f);p=Math.max(l-s,u-c),p=p===0?0:1/p}return pr(a,o,n,s,c,p),o}},sd={area:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5},isClockWise:function(e){return sd.area(e)<0},triangulateShape:function(e,t){var n=[],r=[],i=[];Hr(e),Ur(n,e);var a=e.length;t.forEach(Hr);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Ur(n,t[o]);for(var s=od.triangulate(n,r),o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}},Wr.prototype=Object.create(J.prototype),Wr.prototype.constructor=Wr,Wr.prototype.toJSON=function(){var e=J.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return Kr(t,n,e)},Gr.prototype=Object.create(q.prototype),Gr.prototype.constructor=Gr,Gr.prototype.toJSON=function(){var e=q.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return Kr(t,n,e)},cd={generateTopUV:function(e,t,n,r,i){var a=t[n*3],o=t[n*3+1],s=t[r*3],c=t[r*3+1],l=t[i*3],u=t[i*3+1];return[new b(a,o),new b(s,c),new b(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[n*3],s=t[n*3+1],c=t[n*3+2],l=t[r*3],u=t[r*3+1],d=t[r*3+2],f=t[i*3],p=t[i*3+1],m=t[i*3+2],h=t[a*3],g=t[a*3+1],_=t[a*3+2];return Math.abs(s-u)<.01?[new b(o,1-c),new b(l,1-d),new b(f,1-m),new b(h,1-_)]:[new b(s,1-c),new b(u,1-d),new b(p,1-m),new b(g,1-_)]}},qr.prototype=Object.create(J.prototype),qr.prototype.constructor=qr,Jr.prototype=Object.create(Gr.prototype),Jr.prototype.constructor=Jr,Yr.prototype=Object.create(J.prototype),Yr.prototype.constructor=Yr,Xr.prototype=Object.create(q.prototype),Xr.prototype.constructor=Xr,Zr.prototype=Object.create(J.prototype),Zr.prototype.constructor=Zr,Qr.prototype=Object.create(q.prototype),Qr.prototype.constructor=Qr,$r.prototype=Object.create(J.prototype),$r.prototype.constructor=$r,ei.prototype=Object.create(q.prototype),ei.prototype.constructor=ei,ti.prototype=Object.create(J.prototype),ti.prototype.constructor=ti,ti.prototype.toJSON=function(){var e=J.prototype.toJSON.call(this),t=this.parameters.shapes;return ri(t,e)},ni.prototype=Object.create(q.prototype),ni.prototype.constructor=ni,ni.prototype.toJSON=function(){var e=q.prototype.toJSON.call(this),t=this.parameters.shapes;return ri(t,e)},ii.prototype=Object.create(q.prototype),ii.prototype.constructor=ii,ai.prototype=Object.create(J.prototype),ai.prototype.constructor=ai,oi.prototype=Object.create(q.prototype),oi.prototype.constructor=oi,si.prototype=Object.create(ai.prototype),si.prototype.constructor=si,ci.prototype=Object.create(oi.prototype),ci.prototype.constructor=ci,li.prototype=Object.create(J.prototype),li.prototype.constructor=li,ui.prototype=Object.create(q.prototype),ui.prototype.constructor=ui,ld=Object.freeze({__proto__:null,WireframeGeometry:Kn,ParametricGeometry:qn,ParametricBufferGeometry:Jn,TetrahedronGeometry:Zn,TetrahedronBufferGeometry:Qn,OctahedronGeometry:$n,OctahedronBufferGeometry:er,IcosahedronGeometry:tr,IcosahedronBufferGeometry:nr,DodecahedronGeometry:rr,DodecahedronBufferGeometry:ir,PolyhedronGeometry:Yn,PolyhedronBufferGeometry:Xn,TubeGeometry:ar,TubeBufferGeometry:or,TorusKnotGeometry:sr,TorusKnotBufferGeometry:cr,TorusGeometry:lr,TorusBufferGeometry:ur,TextGeometry:qr,TextBufferGeometry:Jr,SphereGeometry:Yr,SphereBufferGeometry:Xr,RingGeometry:Zr,RingBufferGeometry:Qr,PlaneGeometry:Te,PlaneBufferGeometry:Ee,LatheGeometry:$r,LatheBufferGeometry:ei,ShapeGeometry:ti,ShapeBufferGeometry:ni,ExtrudeGeometry:Wr,ExtrudeBufferGeometry:Gr,EdgesGeometry:ii,ConeGeometry:si,ConeBufferGeometry:ci,CylinderGeometry:ai,CylinderBufferGeometry:oi,CircleGeometry:li,CircleBufferGeometry:ui,BoxGeometry:eu,BoxBufferGeometry:tu}),di.prototype=Object.create(V.prototype),di.prototype.constructor=di,di.prototype.isShadowMaterial=!0,di.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this},fi.prototype=Object.create(ge.prototype),fi.prototype.constructor=fi,fi.prototype.isRawShaderMaterial=!0,pi.prototype=Object.create(V.prototype),pi.prototype.constructor=pi,pi.prototype.isMeshStandardMaterial=!0,pi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.defines={STANDARD:``},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},mi.prototype=Object.create(pi.prototype),mi.prototype.constructor=mi,mi.prototype.isMeshPhysicalMaterial=!0,mi.prototype.copy=function(e){return pi.prototype.copy.call(this,e),this.defines={STANDARD:``,PHYSICAL:``},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new z).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this},hi.prototype=Object.create(V.prototype),hi.prototype.constructor=hi,hi.prototype.isMeshPhongMaterial=!0,hi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},gi.prototype=Object.create(V.prototype),gi.prototype.constructor=gi,gi.prototype.isMeshToonMaterial=!0,gi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},_i.prototype=Object.create(V.prototype),_i.prototype.constructor=_i,_i.prototype.isMeshNormalMaterial=!0,_i.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},vi.prototype=Object.create(V.prototype),vi.prototype.constructor=vi,vi.prototype.isMeshLambertMaterial=!0,vi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},yi.prototype=Object.create(V.prototype),yi.prototype.constructor=yi,yi.prototype.isMeshMatcapMaterial=!0,yi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.defines={MATCAP:``},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},bi.prototype=Object.create(Fn.prototype),bi.prototype.constructor=bi,bi.prototype.isLineDashedMaterial=!0,bi.prototype.copy=function(e){return Fn.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this},ud=Object.freeze({__proto__:null,ShadowMaterial:di,SpriteMaterial:Dn,RawShaderMaterial:fi,ShaderMaterial:ge,PointsMaterial:zn,MeshPhysicalMaterial:mi,MeshStandardMaterial:pi,MeshPhongMaterial:hi,MeshToonMaterial:gi,MeshNormalMaterial:_i,MeshLambertMaterial:vi,MeshDepthMaterial:dn,MeshDistanceMaterial:fn,MeshBasicMaterial:re,MeshMatcapMaterial:yi,LineDashedMaterial:bi,LineBasicMaterial:Fn,Material:V}),dd={arraySlice:function(e,t,n){return dd.isTypedArray(e)?new e.constructor(e.subarray(t,n===void 0?e.length:n)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(t,n){return e[t]-e[n]}for(var n=e.length,r=Array(n),i=0;i!==n;++i)r[i]=i;return r.sort(t),r},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,c=0;c!==t;++c)i[o++]=e[s+c];return i},flattenJSON:function(e,t,n,r){for(var i=1,a=e[0];a!==void 0&&a[r]===void 0;)a=e[i++];if(a!==void 0){var o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push.apply(n,o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}},subclip:function(e,t,n,r,i){i=i||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var c=a.tracks[s],l=c.getValueSize(),u=[],d=[],f=0;f<c.times.length;++f){var p=c.times[f]*i;if(!(p<n||p>=r)){u.push(c.times[f]);for(var m=0;m<l;++m)d.push(c.values[f*l+m])}}u.length!==0&&(c.times=dd.convertArray(u,c.times.constructor),c.values=dd.convertArray(d,c.values.constructor),o.push(c))}a.tracks=o;for(var h=1/0,s=0;s<a.tracks.length;++s)h>a.tracks[s].times[0]&&(h=a.tracks[s].times[0]);for(var s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*h);return a.resetDuration(),a},makeClipAdditive:function(e,t,n,r){t===void 0&&(t=0),n===void 0&&(n=e),(r===void 0||r<=0)&&(r=30);for(var i=e.tracks.length,a=t/r,o=0;o<i;++o){var s=n.tracks[o],c=s.ValueTypeName;if(!(c===`bool`||c===`string`)){var l=e.tracks.find(function(e){return e.name===s.name&&e.ValueTypeName===c});if(l!==void 0){var u=s.getValueSize(),d=s.times.length-1,f;if(a<=s.times[0])f=dd.arraySlice(s.values,0,s.valueSize);else if(a>=s.times[d]){var p=d*u;f=dd.arraySlice(s.values,p)}else{var m=s.createInterpolant();m.evaluate(a),f=m.resultBuffer}c===`quaternion`&&new E(f[0],f[1],f[2],f[3]).normalize().conjugate().toArray(f);for(var h=l.times.length,g=0;g<h;++g){var _=g*u;if(c===`quaternion`)E.multiplyQuaternionsFlat(l.values,_,f,0,l.values,_);else for(var v=0;v<u;++v)l.values[_+v]-=f[v]}}}}return e.blendMode=Qs,e}},Object.assign(xi.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{var a;linear_scan:{forward_scan:if(!(e<r)){for(var o=n+2;;){if(r===void 0){if(e<i)break forward_scan;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,r=t[++n],e<r)break seek}a=t.length;break linear_scan}if(!(e>=i)){var s=t[1];e<s&&(n=2,i=s);for(var o=n-2;;){if(i===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,i=t[--n-1],e>=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n<a;){var c=n+a>>>1;e<t[c]?a=c:n=c+1}if(r=t[n],i=t[n-1],i===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(r===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,i,e)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t},interpolate_:function(){throw Error(`call to abstract method`)},intervalChanged_:function(){}}),Object.assign(xi.prototype,{beforeStart_:xi.prototype.copySampleValue_,afterEnd_:xi.prototype.copySampleValue_}),Si.prototype=Object.assign(Object.create(xi.prototype),{constructor:Si,DefaultSettings_:{endingStart:Js,endingEnd:Js},intervalChanged_:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case Ys:i=e,o=2*t-n;break;case Xs:i=r.length-2,o=t+r[i]-r[i+1];break;default:i=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case Ys:a=e,s=2*n-t;break;case Xs:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}var c=(n-t)*.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l},interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(r-t),m=p*p,h=m*p,g=-d*h+2*d*m-d*p,_=(1+d)*h+(-1.5-2*d)*m+(-.5+d)*p+1,v=(-1-f)*h+(1.5+f)*m+.5*p,y=f*h-f*m,b=0;b!==o;++b)i[b]=g*a[l+b]+_*a[c+b]+v*a[s+b]+y*a[u+b];return i}}),Ci.prototype=Object.assign(Object.create(xi.prototype),{constructor:Ci,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l,d=0;d!==o;++d)i[d]=a[c+d]*u+a[s+d]*l;return i}}),wi.prototype=Object.assign(Object.create(xi.prototype),{constructor:wi,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(Ti,{toJSON:function(e){var t=e.constructor,n;if(t.toJSON!==void 0)n=t.toJSON(e);else{n={name:e.name,times:dd.convertArray(e.times,Array),values:dd.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}}),Object.assign(Ti.prototype,{constructor:Ti,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Ks,InterpolantFactoryMethodDiscrete:function(e){return new wi(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Ci(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Si(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case Gs:t=this.InterpolantFactoryMethodDiscrete;break;case Ks:t=this.InterpolantFactoryMethodLinear;break;case qs:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){var n=`unsupported interpolation for `+this.ValueTypeName+` keyframe track named `+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(n);return console.warn(`THREE.KeyframeTrack:`,n),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Gs;case this.InterpolantFactoryMethodLinear:return Ks;case this.InterpolantFactoryMethodSmooth:return qs}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(e!==0)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this},scale:function(e){if(e!==1)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;a!==-1&&n[a]>t;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);var o=this.getValueSize();this.times=dd.arraySlice(n,i,a),this.values=dd.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error(`THREE.KeyframeTrack: Invalid value size in track.`,this),e=!1);var n=this.times,r=this.values,i=n.length;i===0&&(console.error(`THREE.KeyframeTrack: Track is empty.`,this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if(typeof s==`number`&&isNaN(s)){console.error(`THREE.KeyframeTrack: Time is not a valid number.`,this,o,s),e=!1;break}if(a!==null&&a>s){console.error(`THREE.KeyframeTrack: Out of order keys.`,this,o,s,a),e=!1;break}a=s}if(r!==void 0&&dd.isTypedArray(r))for(var o=0,c=r.length;o!==c;++o){var l=r[o];if(isNaN(l)){console.error(`THREE.KeyframeTrack: Value is not a valid number.`,this,o,l),e=!1;break}}return e},optimize:function(){for(var e=dd.arraySlice(this.times),t=dd.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===qs,i=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o];if(c!==e[o+1]&&(o!==1||c!==c[0]))if(r)s=!0;else for(var l=o*n,u=l-n,d=l+n,f=0;f!==n;++f){var p=t[l+f];if(p!==t[u+f]||p!==t[d+f]){s=!0;break}}if(s){if(o!==i){e[i]=e[o];for(var m=o*n,h=i*n,f=0;f!==n;++f)t[h+f]=t[m+f]}++i}}if(a>0){e[i]=e[a];for(var m=a*n,h=i*n,f=0;f!==n;++f)t[h+f]=t[m+f];++i}return i===e.length?(this.times=e,this.values=t):(this.times=dd.arraySlice(e,0,i),this.values=dd.arraySlice(t,0,i*n)),this},clone:function(){var e=dd.arraySlice(this.times,0),t=dd.arraySlice(this.values,0),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}),Ei.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Ei,ValueTypeName:`bool`,ValueBufferType:Array,DefaultInterpolation:Gs,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Di.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Di,ValueTypeName:`color`}),Oi.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Oi,ValueTypeName:`number`}),ki.prototype=Object.assign(Object.create(xi.prototype),{constructor:ki,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(n-t)/(r-t),l=s+o;s!==l;s+=4)E.slerpFlat(i,0,a,s-o,a,s,c);return i}}),Ai.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Ai,ValueTypeName:`quaternion`,DefaultInterpolation:Ks,InterpolantFactoryMethodLinear:function(e){return new ki(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),ji.prototype=Object.assign(Object.create(Ti.prototype),{constructor:ji,ValueTypeName:`string`,ValueBufferType:Array,DefaultInterpolation:Gs,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Mi.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Mi,ValueTypeName:`vector`}),Object.assign(Ni,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(Fi(n[i]).scale(r));return new Ni(e.name,e.duration,t,e.blendMode)},toJSON:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},i=0,a=n.length;i!==a;++i)t.push(Ti.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],c=[];s.push((o+i-1)%i,o,(o+1)%i),c.push(0,1,0);var l=dd.getKeyframeOrder(s);s=dd.sortedArray(s,1,l),c=dd.sortedArray(c,1,l),!r&&s[0]===0&&(s.push(i),c.push(c[0])),a.push(new Oi(`.morphTargetInfluences[`+t[o].name+`]`,s,c).scale(1/n))}return new Ni(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var r={},i=/^([\\w-]*?)([\\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(i);if(c&&c.length>1){var l=c[1],u=r[l];u||(r[l]=u=[]),u.push(s)}}var d=[];for(var l in r)d.push(Ni.CreateFromMorphTargetSequence(l,r[l],t,n));return d},parseAnimation:function(e,t){if(!e)return console.error(`THREE.AnimationClip: No animation in JSONLoader data.`),null;for(var n=function(e,t,n,r,i){if(n.length!==0){var a=[],o=[];dd.flattenJSON(n,a,o,r),a.length!==0&&i.push(new e(t,a,o))}},r=[],i=e.name||`default`,a=e.length||-1,o=e.fps||30,s=e.blendMode,c=e.hierarchy||[],l=0;l<c.length;l++){var u=c[l].keys;if(!(!u||u.length===0))if(u[0].morphTargets){for(var d={},f=0;f<u.length;f++)if(u[f].morphTargets)for(var p=0;p<u[f].morphTargets.length;p++)d[u[f].morphTargets[p]]=-1;for(var m in d){for(var h=[],g=[],p=0;p!==u[f].morphTargets.length;++p){var _=u[f];h.push(_.time),g.push(+(_.morphTarget===m))}r.push(new Oi(`.morphTargetInfluence[`+m+`]`,h,g))}a=d.length*(o||1)}else{var v=`.bones[`+t[l].name+`]`;n(Mi,v+`.position`,u,`pos`,r),n(Ai,v+`.quaternion`,u,`rot`,r),n(Mi,v+`.scale`,u,`scl`,r)}}return r.length===0?null:new Ni(i,a,r,s)}}),Object.assign(Ni.prototype,{resetDuration:function(){for(var e=this.tracks,t=0,n=0,r=e.length;n!==r;++n){var i=this.tracks[n];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new Ni(this.name,this.duration,e,this.blendMode)}}),fd={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){if(this.enabled!==!1)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},pd=new Ii,Object.assign(Li.prototype,{load:function(){},loadAsync:function(e,t){var n=this;return new Promise(function(r,i){n.load(e,r,t,i)})},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),md={},Ri.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ri,load:function(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=fd.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;if(md[e]!==void 0){md[e].push({onLoad:t,onProgress:n,onError:r});return}var o=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],c=!!o[2],l=o[3];l=decodeURIComponent(l),c&&(l=atob(l));try{var u,d=(this.responseType||``).toLowerCase();switch(d){case`arraybuffer`:case`blob`:for(var f=new Uint8Array(l.length),p=0;p<l.length;p++)f[p]=l.charCodeAt(p);u=d===`blob`?new Blob([f.buffer],{type:s}):f.buffer;break;case`document`:u=new DOMParser().parseFromString(l,s);break;case`json`:u=JSON.parse(l);break;default:u=l;break}setTimeout(function(){t&&t(u),i.manager.itemEnd(e)},0)}catch(t){setTimeout(function(){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)},0)}}else{md[e]=[],md[e].push({onLoad:t,onProgress:n,onError:r});var m=new XMLHttpRequest;for(var h in m.open(`GET`,e,!0),m.addEventListener(`load`,function(t){var n=this.response,r=md[e];if(delete md[e],this.status===200||this.status===0){this.status===0&&console.warn(`THREE.FileLoader: HTTP Status 0 received.`),fd.add(e,n);for(var a=0,o=r.length;a<o;a++){var s=r[a];s.onLoad&&s.onLoad(n)}i.manager.itemEnd(e)}else{for(var a=0,o=r.length;a<o;a++){var s=r[a];s.onError&&s.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}},!1),m.addEventListener(`progress`,function(t){for(var n=md[e],r=0,i=n.length;r<i;r++){var a=n[r];a.onProgress&&a.onProgress(t)}},!1),m.addEventListener(`error`,function(t){var n=md[e];delete md[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),m.addEventListener(`abort`,function(t){var n=md[e];delete md[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),this.responseType!==void 0&&(m.responseType=this.responseType),this.withCredentials!==void 0&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(this.mimeType===void 0?`text/plain`:this.mimeType),this.requestHeader)m.setRequestHeader(h,this.requestHeader[h]);m.send(null)}return i.manager.itemStart(e),m},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this}}),zi.prototype=Object.assign(Object.create(Li.prototype),{constructor:zi,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setPath(i.path),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var r=Ni.parse(e[n]);t.push(r)}return t}}),Bi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Bi,load:function(e,t,n,r){var i=this,a=[],o=new Un;o.image=a;var s=new Ri(this.manager);s.setPath(this.path),s.setResponseType(`arraybuffer`);function c(c){s.load(e[c],function(e){var n=i.parse(e,!0);a[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,l===6&&(n.mipmapCount===1&&(o.minFilter=Ko),o.format=n.format,o.needsUpdate=!0,t&&t(o))},n,r)}if(Array.isArray(e))for(var l=0,u=0,d=e.length;u<d;++u)c(u);else s.load(e,function(e){var n=i.parse(e,!0);if(n.isCubemap)for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;s++){a[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;n.mipmapCount===1&&(o.minFilter=Ko),o.format=n.format,o.needsUpdate=!0,t&&t(o)},n,r);return o}}),Vi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Vi,load:function(e,t,n,r){var i=this,a=new xe,o=new Ri(this.manager);return o.setResponseType(`arraybuffer`),o.setPath(this.path),o.load(e,function(e){var n=i.parse(e);n&&(n.image===void 0?n.data!==void 0&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data):a.image=n.image,a.wrapS=n.wrapS===void 0?Vo:n.wrapS,a.wrapT=n.wrapT===void 0?Vo:n.wrapT,a.magFilter=n.magFilter===void 0?Ko:n.magFilter,a.minFilter=n.minFilter===void 0?Ko:n.minFilter,a.anisotropy=n.anisotropy===void 0?1:n.anisotropy,n.format!==void 0&&(a.format=n.format),n.type!==void 0&&(a.type=n.type),n.mipmaps!==void 0&&(a.mipmaps=n.mipmaps,a.minFilter=Jo),n.mipmapCount===1&&(a.minFilter=Ko),a.needsUpdate=!0,t&&t(a,n))},n,r),a}}),Hi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Hi,load:function(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=fd.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;var o=document.createElementNS(`http://www.w3.org/1999/xhtml`,`img`);function s(){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1),fd.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}return o.addEventListener(`load`,s,!1),o.addEventListener(`error`,c,!1),e.substr(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}}),Ui.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ui,load:function(e,t,n,r){var i=new Re,a=new Hi(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],function(e){i.images[n]=e,o++,o===6&&(i.needsUpdate=!0,t&&t(i))},void 0,r)}for(var c=0;c<e.length;++c)s(c);return i}}),Wi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Wi,load:function(e,t,n,r){var i=new S,a=new Hi(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(n){i.image=n,i.format=e.search(/\\.jpe?g($|\\?)/i)>0||e.search(/^data\\:image\\/jpeg/)===0?$o:es,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}}),Object.assign(Y.prototype,{getPoint:function(){return console.warn(`THREE.Curve: .getPoint() not implemented.`),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){e===void 0&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){e===void 0&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e===void 0&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t=[],n,r=this.getPoint(0),i,a=0;for(t.push(0),i=1;i<=e;i++)n=this.getPoint(i/e),a+=n.distanceTo(r),t.push(a),r=n;return this.cacheArcLengths=t,t},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){for(var n=this.getLengths(),r=0,i=n.length,a=t||e*n[i-1],o=0,s=i-1,c;o<=s;)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);var l=n[r],u=n[r+1]-l,d=(a-l)/u;return(r+d)/(i-1)},getTangent:function(e,t){var n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);var a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new b:new D);return s.copy(o).sub(a).normalize(),s},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){var n=new D,r=[],i=[],a=[],o=new D,s=new O,c,l,u;for(c=0;c<=e;c++)l=c/e,r[c]=this.getTangentAt(l,new D),r[c].normalize();i[0]=new D,a[0]=new D;var d=Number.MAX_VALUE,f=Math.abs(r[0].x),p=Math.abs(r[0].y),m=Math.abs(r[0].z);for(f<=d&&(d=f,n.set(1,0,0)),p<=d&&(d=p,n.set(0,1,0)),m<=d&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]),c=1;c<=e;c++)i[c]=i[c-1].clone(),a[c]=a[c-1].clone(),o.crossVectors(r[c-1],r[c]),o.length()>Number.EPSILON&&(o.normalize(),u=Math.acos(X.clamp(r[c-1].dot(r[c]),-1,1)),i[c].applyMatrix4(s.makeRotationAxis(o,u))),a[c].crossVectors(r[c],i[c]);if(t===!0)for(u=Math.acos(X.clamp(i[0].dot(i[e]),-1,1)),u/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(u=-u),c=1;c<=e;c++)i[c].applyMatrix4(s.makeRotationAxis(r[c],u*c)),a[c].crossVectors(r[c],i[c]);return{tangents:r,normals:i,binormals:a}},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:`Curve`,generator:`Curve.toJSON`}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),Gi.prototype=Object.create(Y.prototype),Gi.prototype.constructor=Gi,Gi.prototype.isEllipseCurve=!0,Gi.prototype.getPoint=function(e,t){for(var n=t||new b,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),this.aClockwise===!0&&!a&&(i===r?i=-r:i-=r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){var l=Math.cos(this.aRotation),u=Math.sin(this.aRotation),d=s-this.aX,f=c-this.aY;s=d*l-f*u+this.aX,c=d*u+f*l+this.aY}return n.set(s,c)},Gi.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Gi.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},Gi.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Ki.prototype=Object.create(Gi.prototype),Ki.prototype.constructor=Ki,Ki.prototype.isArcCurve=!0,hd=new D,gd=new qi,_d=new qi,vd=new qi,Ji.prototype=Object.create(Y.prototype),Ji.prototype.constructor=Ji,Ji.prototype.isCatmullRomCurve3=!0,Ji.prototype.getPoint=function(e,t){var n=t||new D,r=this.points,i=r.length,a=(i-+!this.closed)*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);var c,l,u,d;if(this.closed||o>0?c=r[(o-1)%i]:(hd.subVectors(r[0],r[1]).add(r[0]),c=hd),l=r[o%i],u=r[(o+1)%i],this.closed||o+2<i?d=r[(o+2)%i]:(hd.subVectors(r[i-1],r[i-2]).add(r[i-1]),d=hd),this.curveType===`centripetal`||this.curveType===`chordal`){var f=this.curveType===`chordal`?.5:.25,p=Math.pow(c.distanceToSquared(l),f),m=Math.pow(l.distanceToSquared(u),f),h=Math.pow(u.distanceToSquared(d),f);m<1e-4&&(m=1),p<1e-4&&(p=m),h<1e-4&&(h=m),gd.initNonuniformCatmullRom(c.x,l.x,u.x,d.x,p,m,h),_d.initNonuniformCatmullRom(c.y,l.y,u.y,d.y,p,m,h),vd.initNonuniformCatmullRom(c.z,l.z,u.z,d.z,p,m,h)}else this.curveType===`catmullrom`&&(gd.initCatmullRom(c.x,l.x,u.x,d.x,this.tension),_d.initCatmullRom(c.y,l.y,u.y,d.y,this.tension),vd.initCatmullRom(c.z,l.z,u.z,d.z,this.tension));return n.set(gd.calc(s),_d.calc(s),vd.calc(s)),n},Ji.prototype.copy=function(e){Y.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Ji.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Ji.prototype.fromJSON=function(e){Y.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(new D().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},aa.prototype=Object.create(Y.prototype),aa.prototype.constructor=aa,aa.prototype.isCubicBezierCurve=!0,aa.prototype.getPoint=function(e,t){var n=t||new b,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ia(e,r.x,i.x,a.x,o.x),ia(e,r.y,i.y,a.y,o.y)),n},aa.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},aa.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},aa.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},oa.prototype=Object.create(Y.prototype),oa.prototype.constructor=oa,oa.prototype.isCubicBezierCurve3=!0,oa.prototype.getPoint=function(e,t){var n=t||new D,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ia(e,r.x,i.x,a.x,o.x),ia(e,r.y,i.y,a.y,o.y),ia(e,r.z,i.z,a.z,o.z)),n},oa.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},oa.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},oa.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},sa.prototype=Object.create(Y.prototype),sa.prototype.constructor=sa,sa.prototype.isLineCurve=!0,sa.prototype.getPoint=function(e,t){var n=t||new b;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},sa.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},sa.prototype.getTangent=function(e,t){var n=t||new b,n=n.copy(this.v2).sub(this.v1).normalize();return n},sa.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},sa.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},sa.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ca.prototype=Object.create(Y.prototype),ca.prototype.constructor=ca,ca.prototype.isLineCurve3=!0,ca.prototype.getPoint=function(e,t){var n=t||new D;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},ca.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},ca.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ca.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ca.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},la.prototype=Object.create(Y.prototype),la.prototype.constructor=la,la.prototype.isQuadraticBezierCurve=!0,la.prototype.getPoint=function(e,t){var n=t||new b,r=this.v0,i=this.v1,a=this.v2;return n.set($i(e,r.x,i.x,a.x),$i(e,r.y,i.y,a.y)),n},la.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},la.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},la.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ua.prototype=Object.create(Y.prototype),ua.prototype.constructor=ua,ua.prototype.isQuadraticBezierCurve3=!0,ua.prototype.getPoint=function(e,t){var n=t||new D,r=this.v0,i=this.v1,a=this.v2;return n.set($i(e,r.x,i.x,a.x),$i(e,r.y,i.y,a.y),$i(e,r.z,i.z,a.z)),n},ua.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ua.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ua.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},da.prototype=Object.create(Y.prototype),da.prototype.constructor=da,da.prototype.isSplineCurve=!0,da.prototype.getPoint=function(e,t){var n=t||new b,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Yi(o,s.x,c.x,l.x,u.x),Yi(o,s.y,c.y,l.y,u.y)),n},da.prototype.copy=function(e){Y.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this},da.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e},da.prototype.fromJSON=function(e){Y.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(new b().fromArray(r))}return this},yd=Object.freeze({__proto__:null,ArcCurve:Ki,CatmullRomCurve3:Ji,CubicBezierCurve:aa,CubicBezierCurve3:oa,EllipseCurve:Gi,LineCurve:sa,LineCurve3:ca,QuadraticBezierCurve:la,QuadraticBezierCurve3:ua,SplineCurve:da}),fa.prototype=Object.assign(Object.create(Y.prototype),{constructor:fa,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new sa(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=t){var i=n[r]-t,a=this.curves[r],o=a.getLength(),s=o===0?0:1-i/o;return a.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){e===void 0&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t=[],n,r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?e*2:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];n&&n.equals(l)||(t.push(l),n=l)}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t},copy:function(e){Y.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=Y.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var r=this.curves[t];e.curves.push(r.toJSON())}return e},fromJSON:function(e){Y.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(new yd[r.type]().fromJSON(r))}return this}}),pa.prototype=Object.assign(Object.create(fa.prototype),{constructor:pa,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var n=new sa(this.currentPoint.clone(),new b(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,r){var i=new la(this.currentPoint.clone(),new b(e,t),new b(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this},bezierCurveTo:function(e,t,n,r,i,a){var o=new aa(this.currentPoint.clone(),new b(e,t),new b(n,r),new b(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this},splineThru:function(e){var t=new da([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this},absarc:function(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this},ellipse:function(e,t,n,r,i,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this},absellipse:function(e,t,n,r,i,a,o,s){var c=new Gi(e,t,n,r,i,a,o,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);return this.currentPoint.copy(u),this},copy:function(e){return fa.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=fa.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return fa.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),ma.prototype=Object.assign(Object.create(pa.prototype),{constructor:ma,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){pa.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(r.clone())}return this},toJSON:function(){var e=pa.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var r=this.holes[t];e.holes.push(r.toJSON())}return e},fromJSON:function(e){pa.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(new pa().fromJSON(r))}return this}}),ha.prototype=Object.assign(Object.create(j.prototype),{constructor:ha,isLight:!0,copy:function(e){return j.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}),ga.prototype=Object.assign(Object.create(ha.prototype),{constructor:ga,isHemisphereLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(_a.prototype,{_projScreenMatrix:new O,_lightPositionWorld:new D,_lookTarget:new D,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,n=this.matrix,r=this._projScreenMatrix,i=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),i.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(i),t.updateMatrixWorld(),r.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(r),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var e={};return this.bias!==0&&(e.bias=this.bias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),va.prototype=Object.assign(Object.create(_a.prototype),{constructor:va,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=X.RAD2DEG*2*e.angle,r=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),_a.prototype.updateMatrices.call(this,e)}}),ya.prototype=Object.assign(Object.create(ha.prototype),{constructor:ya,isSpotLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),ba.prototype=Object.assign(Object.create(_a.prototype),{constructor:ba,isPointLightShadow:!0,updateMatrices:function(e,t){t===void 0&&(t=0);var n=this.camera,r=this.matrix,i=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;i.setFromMatrixPosition(e.matrixWorld),n.position.copy(i),a.copy(n.position),a.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(a),n.updateMatrixWorld(),r.makeTranslation(-i.x,-i.y,-i.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}}),xa.prototype=Object.assign(Object.create(ha.prototype),{constructor:xa,isPointLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Sa.prototype=Object.assign(Object.create(_e.prototype),{constructor:Sa,isOrthographicCamera:!0,copy:function(e,t){return _e.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){var c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=c*this.view.offsetX,a=i+c*this.view.width,o-=l*this.view.offsetY,s=o-l*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}),Ca.prototype=Object.assign(Object.create(_a.prototype),{constructor:Ca,isDirectionalLightShadow:!0,updateMatrices:function(e){_a.prototype.updateMatrices.call(this,e)}}),wa.prototype=Object.assign(Object.create(ha.prototype),{constructor:wa,isDirectionalLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Ta.prototype=Object.assign(Object.create(ha.prototype),{constructor:Ta,isAmbientLight:!0}),Ea.prototype=Object.assign(Object.create(ha.prototype),{constructor:Ea,isRectAreaLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=ha.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Object.assign(Da.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*r*1.092548),t.addScaledVector(a[5],r*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],n*i*1.092548),t.addScaledVector(a[8],.546274*(n*n-r*r)),t},getIrradianceAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*r),t.addScaledVector(a[2],2*.511664*i),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*r),t.addScaledVector(a[5],2*.429043*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],2*.429043*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return new this.constructor().copy(this)},fromArray:function(e,t){t===void 0&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}}),Object.assign(Da,{getBasisAt:function(e,t){var n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}),Oa.prototype=Object.assign(Object.create(ha.prototype),{constructor:Oa,isLightProbe:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){var t=ha.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),ka.prototype=Object.assign(Object.create(Li.prototype),{constructor:ka,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setPath(i.path),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)},parse:function(e){var t=this.textures;function n(e){return t[e]===void 0&&console.warn(`THREE.MaterialLoader: Undefined texture`,e),t[e]}var r=new ud[e.type];if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=new z().setHex(e.sheen)),e.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular.setHex(e.specular),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==1&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.skinning!==void 0&&(r.skinning=e.skinning),e.morphTargets!==void 0&&(r.morphTargets=e.morphTargets),e.morphNormals!==void 0&&(r.morphNormals=e.morphNormals),e.dithering!==void 0&&(r.dithering=e.dithering),e.vertexTangents!==void 0&&(r.vertexTangents=e.vertexTangents),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors==`number`?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(var i in e.uniforms){var a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case`t`:r.uniforms[i].value=n(a.value);break;case`c`:r.uniforms[i].value=new z().setHex(a.value);break;case`v2`:r.uniforms[i].value=new b().fromArray(a.value);break;case`v3`:r.uniforms[i].value=new D().fromArray(a.value);break;case`v4`:r.uniforms[i].value=new C().fromArray(a.value);break;case`m3`:r.uniforms[i].value=new x().fromArray(a.value);case`m4`:r.uniforms[i].value=new O().fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(var o in e.extensions)r.extensions[o]=e.extensions[o];if(e.shading!==void 0&&(r.flatShading=e.shading===1),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=n(e.map)),e.matcap!==void 0&&(r.matcap=n(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){var s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new b().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=n(e.specularMap)),e.envMap!==void 0&&(r.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new b().fromArray(e.clearcoatNormalScale)),r},setTextures:function(e){return this.textures=e,this}}),bd={decodeText:function(e){if(typeof TextDecoder<`u`)return new TextDecoder().decode(e);for(var t=``,n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}},extractUrlBase:function(e){var t=e.lastIndexOf(`/`);return t===-1?`./`:e.substr(0,t+1)}},Aa.prototype=Object.assign(Object.create(q.prototype),{constructor:Aa,isInstancedBufferGeometry:!0,copy:function(e){return q.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var e=q.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}),ja.prototype=Object.assign(Object.create(H.prototype),{constructor:ja,isInstancedBufferAttribute:!0,copy:function(e){return H.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=H.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),Ma.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ma,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setPath(i.path),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)},parse:function(e){var t=e.isInstancedBufferGeometry?new Aa:new q,n=e.data.index;if(n!==void 0){var r=new xd[n.type](n.array);t.setIndex(new H(r,1))}var i=e.data.attributes;for(var a in i){var o=i[a],r=new xd[o.type](o.array),s=new(o.isInstancedBufferAttribute?ja:H)(r,o.itemSize,o.normalized);o.name!==void 0&&(s.name=o.name),t.setAttribute(a,s)}var c=e.data.morphAttributes;if(c)for(var a in c){for(var l=c[a],u=[],d=0,f=l.length;d<f;d++){var o=l[d],r=new xd[o.type](o.array),s=new H(r,o.itemSize,o.normalized);o.name!==void 0&&(s.name=o.name),u.push(s)}t.morphAttributes[a]=u}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var p=e.data.groups||e.data.drawcalls||e.data.offsets;if(p!==void 0)for(var d=0,m=p.length;d!==m;++d){var h=p[d];t.addGroup(h.start,h.count,h.materialIndex)}var g=e.data.boundingSphere;if(g!==void 0){var _=new D;g.center!==void 0&&_.fromArray(g.center),t.boundingSphere=new F(_,g.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}}),xd={Int8Array,Uint8Array,Uint8ClampedArray:typeof Uint8ClampedArray<`u`?Uint8ClampedArray:Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array},Na.prototype=Object.assign(Object.create(Li.prototype),{constructor:Na,load:function(e,t,n,r){var i=this,a=this.path===``?bd.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new Ri(i.manager);o.setPath(this.path),o.load(e,function(n){var a=null;try{a=JSON.parse(n)}catch(t){r!==void 0&&r(t),console.error(`THREE:ObjectLoader: Can\'t parse `+e+`.`,t.message);return}var o=a.metadata;if(o===void 0||o.type===void 0||o.type.toLowerCase()===`geometry`){console.error(`THREE.ObjectLoader: Can\'t load `+e);return}i.parse(a,t)},n,r)},parse:function(e,t){var n=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,n),i=this.parseImages(e.images,function(){t!==void 0&&t(s)}),a=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,r,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),(e.images===void 0||e.images.length===0)&&t!==void 0&&t(s),s},parseShape:function(e){var t={};if(e!==void 0)for(var n=0,r=e.length;n<r;n++){var i=new ma().fromJSON(e[n]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var n={};if(e!==void 0)for(var r=new Ma,i=0,a=e.length;i<a;i++){var o,s=e[i];switch(s.type){case`PlaneGeometry`:case`PlaneBufferGeometry`:o=new ld[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case`BoxGeometry`:case`BoxBufferGeometry`:case`CubeGeometry`:o=new ld[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case`CircleGeometry`:case`CircleBufferGeometry`:o=new ld[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case`CylinderGeometry`:case`CylinderBufferGeometry`:o=new ld[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case`ConeGeometry`:case`ConeBufferGeometry`:o=new ld[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case`SphereGeometry`:case`SphereBufferGeometry`:o=new ld[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case`DodecahedronGeometry`:case`DodecahedronBufferGeometry`:case`IcosahedronGeometry`:case`IcosahedronBufferGeometry`:case`OctahedronGeometry`:case`OctahedronBufferGeometry`:case`TetrahedronGeometry`:case`TetrahedronBufferGeometry`:o=new ld[s.type](s.radius,s.detail);break;case`RingGeometry`:case`RingBufferGeometry`:o=new ld[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case`TorusGeometry`:case`TorusBufferGeometry`:o=new ld[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case`TorusKnotGeometry`:case`TorusKnotBufferGeometry`:o=new ld[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case`TubeGeometry`:case`TubeBufferGeometry`:o=new ld[s.type](new yd[s.path.type]().fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case`LatheGeometry`:case`LatheBufferGeometry`:o=new ld[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case`PolyhedronGeometry`:case`PolyhedronBufferGeometry`:o=new ld[s.type](s.vertices,s.indices,s.radius,s.details);break;case`ShapeGeometry`:case`ShapeBufferGeometry`:for(var c=[],l=0,u=s.shapes.length;l<u;l++){var d=t[s.shapes[l]];c.push(d)}o=new ld[s.type](c,s.curveSegments);break;case`ExtrudeGeometry`:case`ExtrudeBufferGeometry`:for(var c=[],l=0,u=s.shapes.length;l<u;l++){var d=t[s.shapes[l]];c.push(d)}var f=s.options.extrudePath;f!==void 0&&(s.options.extrudePath=new yd[f.type]().fromJSON(f)),o=new ld[s.type](c,s.options);break;case`BufferGeometry`:case`InstancedBufferGeometry`:o=r.parse(s);break;case`Geometry`:console.error(`THREE.ObjectLoader: Loading "Geometry" is not supported anymore.`);break;default:console.warn(`THREE.ObjectLoader: Unsupported geometry type "`+s.type+`"`);continue}o.uuid=s.uuid,s.name!==void 0&&(o.name=s.name),o.isBufferGeometry===!0&&s.userData!==void 0&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(e,t){var n={},r={};if(e!==void 0){var i=new ka;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if(s.type===`MultiMaterial`){for(var c=[],l=0;l<s.materials.length;l++){var u=s.materials[l];n[u.uuid]===void 0&&(n[u.uuid]=i.parse(u)),c.push(n[u.uuid])}r[s.uuid]=c}else n[s.uuid]===void 0&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=Ni.parse(r);r.uuid!==void 0&&(i.uuid=r.uuid),t.push(i)}return t},parseImages:function(e,t){var n=this,r={};function i(e){return n.manager.itemStart(e),a.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e),n.manager.itemEnd(e)})}if(e!==void 0&&e.length>0){var a=new Hi(new Ii(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var c=e[o],l=c.url;if(Array.isArray(l)){r[c.uuid]=[];for(var u=0,d=l.length;u<d;u++){var f=l[u],p=/^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test(f)?f:n.resourcePath+f;r[c.uuid].push(i(p))}}else{var p=/^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test(c.url)?c.url:n.resourcePath+c.url;r[c.uuid]=i(p)}}}return r},parseTextures:function(e,t){function n(e,t){return typeof e==`number`?e:(console.warn(`THREE.ObjectLoader.parseTexture: Constant should be in numeric form.`,e),t[e])}var r={};if(e!==void 0)for(var i=0,a=e.length;i<a;i++){var o=e[i];o.image===void 0&&console.warn(`THREE.ObjectLoader: No "image" specified for`,o.uuid),t[o.image]===void 0&&console.warn(`THREE.ObjectLoader: Undefined image`,o.image);var s=Array.isArray(t[o.image])?new Re(t[o.image]):new S(t[o.image]);s.needsUpdate=!0,s.uuid=o.uuid,o.name!==void 0&&(s.name=o.name),o.mapping!==void 0&&(s.mapping=n(o.mapping,Sd)),o.offset!==void 0&&s.offset.fromArray(o.offset),o.repeat!==void 0&&s.repeat.fromArray(o.repeat),o.center!==void 0&&s.center.fromArray(o.center),o.rotation!==void 0&&(s.rotation=o.rotation),o.wrap!==void 0&&(s.wrapS=n(o.wrap[0],Cd),s.wrapT=n(o.wrap[1],Cd)),o.format!==void 0&&(s.format=o.format),o.type!==void 0&&(s.type=o.type),o.encoding!==void 0&&(s.encoding=o.encoding),o.minFilter!==void 0&&(s.minFilter=n(o.minFilter,wd)),o.magFilter!==void 0&&(s.magFilter=n(o.magFilter,wd)),o.anisotropy!==void 0&&(s.anisotropy=o.anisotropy),o.flipY!==void 0&&(s.flipY=o.flipY),o.premultiplyAlpha!==void 0&&(s.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(s.unpackAlignment=o.unpackAlignment),r[o.uuid]=s}return r},parseObject:function(e,t,n){var r;function i(e){return t[e]===void 0&&console.warn(`THREE.ObjectLoader: Undefined geometry`,e),t[e]}function a(e){if(e!==void 0){if(Array.isArray(e)){for(var t=[],r=0,i=e.length;r<i;r++){var a=e[r];n[a]===void 0&&console.warn(`THREE.ObjectLoader: Undefined material`,a),t.push(n[a])}return t}return n[e]===void 0&&console.warn(`THREE.ObjectLoader: Undefined material`,e),n[e]}}switch(e.type){case`Scene`:r=new M,e.background!==void 0&&Number.isInteger(e.background)&&(r.background=new z(e.background)),e.fog!==void 0&&(e.fog.type===`Fog`?r.fog=new wn(e.fog.color,e.fog.near,e.fog.far):e.fog.type===`FogExp2`&&(r.fog=new Cn(e.fog.color,e.fog.density)));break;case`PerspectiveCamera`:r=new ve(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(r.focus=e.focus),e.zoom!==void 0&&(r.zoom=e.zoom),e.filmGauge!==void 0&&(r.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(r.filmOffset=e.filmOffset),e.view!==void 0&&(r.view=Object.assign({},e.view));break;case`OrthographicCamera`:r=new Sa(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(r.zoom=e.zoom),e.view!==void 0&&(r.view=Object.assign({},e.view));break;case`AmbientLight`:r=new Ta(e.color,e.intensity);break;case`DirectionalLight`:r=new wa(e.color,e.intensity);break;case`PointLight`:r=new xa(e.color,e.intensity,e.distance,e.decay);break;case`RectAreaLight`:r=new Ea(e.color,e.intensity,e.width,e.height);break;case`SpotLight`:r=new ya(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case`HemisphereLight`:r=new ga(e.color,e.groundColor,e.intensity);break;case`LightProbe`:r=new Oa().fromJSON(e);break;case`SkinnedMesh`:console.warn(`THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.`);case`Mesh`:var o=i(e.geometry),s=a(e.material);r=new de(o,s);break;case`InstancedMesh`:var o=i(e.geometry),s=a(e.material),c=e.count,l=e.instanceMatrix;r=new Pn(o,s,c),r.instanceMatrix=new H(new Float32Array(l.array),16);break;case`LOD`:r=new An;break;case`Line`:r=new In(i(e.geometry),a(e.material),e.mode);break;case`LineLoop`:r=new Rn(i(e.geometry),a(e.material));break;case`LineSegments`:r=new Ln(i(e.geometry),a(e.material));break;case`PointCloud`:case`Points`:r=new Bn(i(e.geometry),a(e.material));break;case`Sprite`:r=new On(a(e.material));break;case`Group`:r=new vn;break;default:r=new j}if(r.uuid=e.uuid,e.name!==void 0&&(r.name=e.name),e.matrix===void 0?(e.position!==void 0&&r.position.fromArray(e.position),e.rotation!==void 0&&r.rotation.fromArray(e.rotation),e.quaternion!==void 0&&r.quaternion.fromArray(e.quaternion),e.scale!==void 0&&r.scale.fromArray(e.scale)):(r.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(r.matrixAutoUpdate=e.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)),e.castShadow!==void 0&&(r.castShadow=e.castShadow),e.receiveShadow!==void 0&&(r.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(r.shadow.bias=e.shadow.bias),e.shadow.radius!==void 0&&(r.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&r.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(r.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(r.visible=e.visible),e.frustumCulled!==void 0&&(r.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(r.renderOrder=e.renderOrder),e.userData!==void 0&&(r.userData=e.userData),e.layers!==void 0&&(r.layers.mask=e.layers),e.children!==void 0)for(var u=e.children,d=0;d<u.length;d++)r.add(this.parseObject(u[d],t,n));if(e.type===`LOD`){e.autoUpdate!==void 0&&(r.autoUpdate=e.autoUpdate);for(var f=e.levels,p=0;p<f.length;p++){var m=f[p],h=r.getObjectByProperty(`uuid`,m.object);h!==void 0&&r.addLevel(h,m.distance)}}return r}}),Sd={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},Cd={RepeatWrapping:Bo,ClampToEdgeWrapping:Vo,MirroredRepeatWrapping:Ho},wd={NearestFilter:Uo,NearestMipmapNearestFilter:Wo,NearestMipmapLinearFilter:Go,LinearFilter:Ko,LinearMipmapNearestFilter:qo,LinearMipmapLinearFilter:Jo},Pa.prototype=Object.assign(Object.create(Li.prototype),{constructor:Pa,setOptions:function(e){return this.options=e,this},load:function(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=fd.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;fetch(e).then(function(e){return e.blob()}).then(function(e){return i.options===void 0?createImageBitmap(e):createImageBitmap(e,i.options)}).then(function(n){fd.add(e,n),t&&t(n),i.manager.itemEnd(e)}).catch(function(t){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}),i.manager.itemStart(e)}}),Object.assign(Fa.prototype,{moveTo:function(e,t){return this.currentPath=new pa,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this},bezierCurveTo:function(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n],a=new ma;a.curves=i.curves,t.push(a)}return t}function r(e,t){for(var n=t.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=t[i],s=t[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],c=-c,s=t[i],l=-l),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var u=l*(e.x-o.x)-c*(e.y-o.y);if(u===0)return!0;if(u<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var i=sd.isClockWise,a=this.subPaths;if(a.length===0)return[];if(t===!0)return n(a);var o,s,c,l=[];if(a.length===1)return s=a[0],c=new ma,c.curves=s.curves,l.push(c),l;var u=!i(a[0].getPoints());u=e?!u:u;var d=[],f=[],p=[],m=0,h;f[m]=void 0,p[m]=[];for(var g=0,_=a.length;g<_;g++)s=a[g],h=s.getPoints(),o=i(h),o=e?!o:o,o?(!u&&f[m]&&m++,f[m]={s:new ma,p:h},f[m].s.curves=s.curves,u&&m++,p[m]=[]):p[m].push({h:s,p:h[0]});if(!f[0])return n(a);if(f.length>1){for(var v=!1,y=[],b=0,x=f.length;b<x;b++)d[b]=[];for(var b=0,x=f.length;b<x;b++)for(var S=p[b],C=0;C<S.length;C++){for(var w=S[C],T=!0,E=0;E<f.length;E++)r(w.p,f[E].p)&&(b!==E&&y.push({froms:b,tos:E,hole:C}),T?(T=!1,d[E].push(w)):v=!0);T&&d[b].push(w)}y.length>0&&(v||(p=d))}for(var D,g=0,O=f.length;g<O;g++){c=f[g].s,l.push(c),D=p[g];for(var k=0,A=D.length;k<A;k++)c.holes.push(D[k].h)}return l}}),Object.assign(Ia.prototype,{isFont:!0,generateShapes:function(e,t){t===void 0&&(t=100);for(var n=[],r=La(e,t,this.data),i=0,a=r.length;i<a;i++)Array.prototype.push.apply(n,r[i].toShapes());return n}}),za.prototype=Object.assign(Object.create(Li.prototype),{constructor:za,load:function(e,t,n,r){var i=this,a=new Ri(this.manager);a.setPath(this.path),a.load(e,function(e){var n;try{n=JSON.parse(e)}catch(t){console.warn(`THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead.`),n=JSON.parse(e.substring(65,e.length-2))}var r=i.parse(n);t&&t(r)},n,r)},parse:function(e){return new Ia(e)}}),Ed={getContext:function(){return Td===void 0&&(Td=new(window.AudioContext||window.webkitAudioContext)),Td},setContext:function(e){Td=e}},Ba.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ba,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setResponseType(`arraybuffer`),a.setPath(i.path),a.load(e,function(n){try{var a=n.slice(0);Ed.getContext().decodeAudioData(a,function(e){t(e)})}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}}),Va.prototype=Object.assign(Object.create(Oa.prototype),{constructor:Va,isHemisphereLightProbe:!0,copy:function(e){return Oa.prototype.copy.call(this,e),this},toJSON:function(e){return Oa.prototype.toJSON.call(this,e)}}),Ha.prototype=Object.assign(Object.create(Oa.prototype),{constructor:Ha,isAmbientLightProbe:!0,copy:function(e){return Oa.prototype.copy.call(this,e),this},toJSON:function(e){return Oa.prototype.toJSON.call(this,e)}}),Dd=new O,Od=new O,Object.assign(Ua.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;var n=e.projectionMatrix.clone(),r=t.eyeSep/2,i=r*t.near/t.focus,a=t.near*Math.tan(X.DEG2RAD*t.fov*.5)/t.zoom,o,s;Od.elements[12]=-r,Dd.elements[12]=r,o=-a*t.aspect+i,s=a*t.aspect+i,n.elements[0]=2*t.near/(s-o),n.elements[8]=(s+o)/(s-o),this.cameraL.projectionMatrix.copy(n),o=-a*t.aspect-i,s=a*t.aspect-i,n.elements[0]=2*t.near/(s-o),n.elements[8]=(s+o)/(s-o),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Od),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Dd)}}),Object.assign(Wa.prototype,{start:function(){this.startTime=(typeof performance>`u`?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=(typeof performance>`u`?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}),kd=new D,Ad=new E,jd=new D,Md=new D,Ga.prototype=Object.assign(Object.create(j.prototype),{constructor:Ga,getInput:function(){return this.gain},removeFilter:function(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return this.filter===null?this.gain.disconnect(this.context.destination):(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){j.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(kd,Ad,jd),Md.set(0,0,-1).applyQuaternion(Ad),t.positionX){var r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(kd.x,r),t.positionY.linearRampToValueAtTime(kd.y,r),t.positionZ.linearRampToValueAtTime(kd.z,r),t.forwardX.linearRampToValueAtTime(Md.x,r),t.forwardY.linearRampToValueAtTime(Md.y,r),t.forwardZ.linearRampToValueAtTime(Md.z,r),t.upX.linearRampToValueAtTime(n.x,r),t.upY.linearRampToValueAtTime(n.y,r),t.upZ.linearRampToValueAtTime(n.z,r)}else t.setPosition(kd.x,kd.y,kd.z),t.setOrientation(Md.x,Md.y,Md.z,n.x,n.y,n.z)}}),Ka.prototype=Object.assign(Object.create(j.prototype),{constructor:Ka,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=`audioNode`,this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=`mediaNode`,this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=`mediaStreamNode`,this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType=`buffer`,this.autoplay&&this.play(),this},play:function(e){if(e===void 0&&(e=0),this.isPlaying===!0){console.warn(`THREE.Audio: Audio is already playing.`);return}if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()},pause:function(){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress%=this.duration||this.buffer.duration),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this},stop:function(){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),this.isPlaying===!0?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return this.hasPlaybackControl===!1?(console.warn(`THREE.Audio: this Audio has no playback control.`),!1):this.loop},setLoop:function(e){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}),Nd=new D,Pd=new E,Fd=new D,Id=new D,qa.prototype=Object.assign(Object.create(Ka.prototype),{constructor:qa,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(e){if(j.prototype.updateMatrixWorld.call(this,e),!(this.hasPlaybackControl===!0&&this.isPlaying===!1)){this.matrixWorld.decompose(Nd,Pd,Fd),Id.set(0,0,1).applyQuaternion(Pd);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Nd.x,n),t.positionY.linearRampToValueAtTime(Nd.y,n),t.positionZ.linearRampToValueAtTime(Nd.z,n),t.orientationX.linearRampToValueAtTime(Id.x,n),t.orientationY.linearRampToValueAtTime(Id.y,n),t.orientationZ.linearRampToValueAtTime(Id.z,n)}else t.setPosition(Nd.x,Nd.y,Nd.z),t.setOrientation(Id.x,Id.y,Id.z)}}}),Object.assign(Ja.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),Object.assign(Ya.prototype,{accumulate:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(a===0){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{a+=t;var s=t/a;this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},accumulateAdditive:function(e){var t=this.buffer,n=this.valueSize,r=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=this.valueSize*3;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*4+3]=1},_setAdditiveIdentityOther:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]},_select:function(e,t,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,r){E.slerpFlat(e,t,e,t,e,n,r)},_slerpAdditive:function(e,t,n,r,i){var a=this._workIndex*i;E.multiplyQuaternionsFlat(e,a,e,t,e,n),E.slerpFlat(e,t,e,t,e,a,r)},_lerp:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}},_lerpAdditive:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}}),Ld=`\\\\[\\\\]\\\\.:\\\\/`,Rd=RegExp(`[`+Ld+`]`,`g`),zd=`[^`+Ld+`]`,Bd=`[^`+Ld.replace(`\\\\.`,``)+`]`,Vd=`((?:WC+[\\\\/:])*)`.replace(`WC`,zd),Hd=`(WCOD+)?`.replace(`WCOD`,Bd),Ud=`(?:\\\\.(WC+)(?:\\\\[(.+)\\\\])?)?`.replace(`WC`,zd),Wd=`\\\\.(WC+)(?:\\\\[(.+)\\\\])?`.replace(`WC`,zd),Gd=RegExp(`^`+Vd+Hd+Ud+Wd+`$`),Kd=[`material`,`materials`,`bones`],Object.assign(Xa.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(Za,{Composite:Xa,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Za.Composite(e,t,n):new Za(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\\s/g,`_`).replace(Rd,``)},parseTrackName:function(e){var t=Gd.exec(e);if(!t)throw Error(`PropertyBinding: Cannot parse trackName: `+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){var i=n.nodeName.substring(r+1);Kd.indexOf(i)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`PropertyBinding: can not parse propertyName from trackName: `+e);return n},findNode:function(e,t){if(!t||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){var r=function(e){for(var n=0;n<e.length;n++){var i=e[n];if(i.name===t||i.uuid===t)return i;var a=r(i.children);if(a)return a}return null},i=r(e.children);if(i)return i}return null}}),Object.assign(Za.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,i=t.propertyIndex;if(e||(e=Za.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error(`THREE.PropertyBinding: Trying to update node for track: `+this.path+` but it wasn\'t found.`);return}if(n){var a=t.objectIndex;switch(n){case`materials`:if(!e.material){console.error(`THREE.PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!e.material.materials){console.error(`THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.`,this);return}e=e.material.materials;break;case`bones`:if(!e.skeleton){console.error(`THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.`,this);return}e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(e[n]===void 0){console.error(`THREE.PropertyBinding: Can not bind to objectName of node undefined.`,this);return}e=e[n]}if(a!==void 0){if(e[a]===void 0){console.error(`THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.`,this,e);return}e=e[a]}}var s=e[r];if(s===void 0){var c=t.nodeName;console.error(`THREE.PropertyBinding: Trying to update property for track: `+c+`.`+r+` but it wasn\'t found.`,e);return}var l=this.Versioning.None;this.targetObject=e,e.needsUpdate===void 0?e.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate):l=this.Versioning.NeedsUpdate;var u=this.BindingType.Direct;if(i!==void 0){if(r===`morphTargetInfluences`){if(!e.geometry){console.error(`THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.`,this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error(`THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.`,this);return}e.morphTargetDictionary[i]!==void 0&&(i=e.morphTargetDictionary[i])}else{console.error(`THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.`,this);return}}u=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else s.fromArray!==void 0&&s.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(u=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Za.prototype,{_getValue_unbound:Za.prototype.getValue,_setValue_unbound:Za.prototype.setValue}),Object.assign(Qa.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,l=0,u=arguments.length;l!==u;++l){var d=arguments[l],f=d.uuid,p=r[f];if(p===void 0){p=t++,r[f]=p,e.push(d);for(var m=0,h=s;m!==h;++m)o[m].push(new Za(d,i[m],a[m]))}else if(p<n){c=e[p];var g=--n,_=e[g];r[_.uuid]=p,e[p]=_,r[f]=g,e[g]=d;for(var m=0,h=s;m!==h;++m){var v=o[m],y=v[g],b=v[p];v[p]=y,b===void 0&&(b=new Za(d,i[m],a[m])),v[g]=b}}else e[p]!==c&&console.error(`THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.`)}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,i=r.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=n[c];if(l!==void 0&&l>=t){var u=t++,d=e[u];n[d.uuid]=l,e[l]=d,n[c]=u,e[u]=s;for(var f=0,p=i;f!==p;++f){var m=r[f],h=m[u],g=m[l];m[l]=h,m[u]=g}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o].uuid,l=r[c];if(l!==void 0)if(delete r[c],l<n){var u=--n,d=e[u],f=--t,p=e[f];r[d.uuid]=l,e[l]=d,r[p.uuid]=u,e[u]=p,e.pop();for(var m=0,h=a;m!==h;++m){var g=i[m],_=g[u],v=g[f];g[l]=_,g[u]=v,g.pop()}}else{var f=--t,p=e[f];r[p.uuid]=l,e[l]=p,e.pop();for(var m=0,h=a;m!==h;++m){var g=i[m];g[l]=g[f],g.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(r!==void 0)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,u=Array(c);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(u);for(var d=l,f=s.length;d!==f;++d){var p=s[d];u[d]=new Za(p,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c=e[o];t[c]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}),Object.assign($a.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var r=this._mixer,i=r.time,a=this._timeScaleInterpolant,o=this.timeScale;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=i,s[1]=i+n,c[0]=e/o,c[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,r){if(!this.enabled){this._updateWeight(e);return}var i=this._startTime;if(i!==null){var a=(e-i)*n;if(a<0||n===0)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case Qs:for(var u=0,d=c.length;u!==d;++u)c[u].evaluate(o),l[u].accumulateAdditive(s);break;case Zs:default:for(var u=0,d=c.length;u!==d;++u)c[u].evaluate(o),l[u].accumulate(r,s)}}},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(n!==null){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(n!==null){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,r=this.loop,i=this._loopCount,a=r===Ws;if(e===0)return i===-1?t:a&&(i&1)==1?n-t:t;if(r===2200){i===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));handle_stop:{if(t>=n)t=n;else if(t<0)t=0;else{this.time=t;break handle_stop}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:`finished`,action:this,direction:e<0?-1:1})}}else{if(i===-1&&(e>=0?(i=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:`finished`,action:this,direction:e>0?1:-1});else{if(s===1){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=t,this._mixer.dispatchEvent({type:`loop`,action:this,loopDelta:o})}}else this.time=t;if(a&&(i&1)==1)return n-t}return t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=Ys,r.endingEnd=Ys):(e?r.endingStart=this.zeroSlopeAtStart?Ys:Js:r.endingStart=Xs,t?r.endingEnd=this.zeroSlopeAtEnd?Ys:Js:r.endingEnd=Xs)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}),eo.prototype=Object.assign(Object.create(y.prototype),{constructor:eo,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];l===void 0&&(l={},c[s]=l);for(var u=0;u!==i;++u){var d=r[u],f=d.name,p=l[f];if(p!==void 0)a[u]=p;else{if(p=a[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,s,f));continue}var m=t&&t._propertyBindings[u].binding.parsedPath;p=new Ya(Za.create(n,f,m),d.ValueTypeName,d.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,f),a[u]=p}o[u].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];--i.useCount===0&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return t!==null&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),e._byClipCacheIndex=null;var u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],s.length===0&&delete a[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];--i.referenceCount===0&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_addInactiveBinding:function(e,t,n){var r=this._bindingsByRootAndName,i=r[t],a=this._bindings;i===void 0&&(i={},r[t]=i),i[n]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[i],Object.keys(o).length===0&&delete a[r]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return n===void 0&&(n=new Ci(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){var r=t||this._root,i=r.uuid,a=typeof e==`string`?Ni.findByName(r,e):e,o=a===null?e:a.uuid,s=this._actionsByClip[o],c=null;if(n===void 0&&(n=a===null?Zs:a.blendMode),s!==void 0){var l=s.actionByRoot[i];if(l!==void 0&&l.blendMode===n)return l;c=s.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;var u=new $a(this,a,t,n);return this._bindAction(u,c),this._addInactiveAction(u,o,i),u},existingAction:function(e,t){var n=t||this._root,r=n.uuid,i=typeof e==`string`?Ni.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return o===void 0?null:o.actionByRoot[r]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o)t[o]._update(r,e,i,a);for(var s=this._bindings,c=this._nActiveBindings,o=0;o!==c;++o)s[o].apply(a);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(i!==void 0){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,t[l]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[t];i!==void 0&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[t];if(a!==void 0)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),to.prototype.clone=function(){return new to(this.value.clone===void 0?this.value:this.value.clone())},no.prototype=Object.assign(Object.create(Tn.prototype),{constructor:no,isInstancedInterleavedBuffer:!0,copy:function(e){return Tn.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(ro.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error(`THREE.Raycaster: Unsupported camera type.`)},intersectObject:function(e,t,n){var r=n||[];return ao(e,this,r,t),r.sort(io),r},intersectObjects:function(e,t,n){var r=n||[];if(Array.isArray(e)===!1)return console.warn(`THREE.Raycaster.intersectObjects: objects is not an Array.`),r;for(var i=0,a=e.length;i<a;i++)ao(e[i],this,r,t);return r.sort(io),r}}),Object.assign(oo.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(X.clamp(t/this.radius,-1,1))),this}}),Object.assign(so.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}}),qd=new b,Object.assign(co.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=qd.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return e===void 0&&(console.warn(`THREE.Box2: .getCenter() target is now required`),e=new b),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return e===void 0&&(console.warn(`THREE.Box2: .getSize() target is now required`),e=new b),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return t===void 0&&(console.warn(`THREE.Box2: .getParameter() target is now required`),t=new b),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return t===void 0&&(console.warn(`THREE.Box2: .clampPoint() target is now required`),t=new b),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return qd.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Jd=new D,Yd=new D,Object.assign(lo.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return e===void 0&&(console.warn(`THREE.Line3: .getCenter() target is now required`),e=new D),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return e===void 0&&(console.warn(`THREE.Line3: .delta() target is now required`),e=new D),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return t===void 0&&(console.warn(`THREE.Line3: .at() target is now required`),t=new D),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){Jd.subVectors(e,this.start),Yd.subVectors(this.end,this.start);var n=Yd.dot(Yd),r=Yd.dot(Jd)/n;return t&&(r=X.clamp(r,0,1)),r},closestPointToPoint:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return n===void 0&&(console.warn(`THREE.Line3: .closestPointToPoint() target is now required`),n=new D),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),uo.prototype=Object.create(j.prototype),uo.prototype.constructor=uo,uo.prototype.isImmediateRenderObject=!0,Xd=new D,fo.prototype=Object.create(j.prototype),fo.prototype.constructor=fo,fo.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},fo.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Xd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Xd),this.color===void 0?this.cone.material.color.copy(this.light.color):this.cone.material.color.set(this.color)},Zd=new D,Qd=new O,$d=new O,mo.prototype=Object.create(Ln.prototype),mo.prototype.constructor=mo,mo.prototype.isSkeletonHelper=!0,mo.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,r=n.getAttribute(`position`);$d.getInverse(this.root.matrixWorld);for(var i=0,a=0;i<t.length;i++){var o=t[i];o.parent&&o.parent.isBone&&(Qd.multiplyMatrices($d,o.matrixWorld),Zd.setFromMatrixPosition(Qd),r.setXYZ(a,Zd.x,Zd.y,Zd.z),Qd.multiplyMatrices($d,o.parent.matrixWorld),Zd.setFromMatrixPosition(Qd),r.setXYZ(a+1,Zd.x,Zd.y,Zd.z),a+=2)}n.getAttribute(`position`).needsUpdate=!0,j.prototype.updateMatrixWorld.call(this,e)},ho.prototype=Object.create(de.prototype),ho.prototype.constructor=ho,ho.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},ho.prototype.update=function(){this.color===void 0?this.material.color.copy(this.light.color):this.material.color.set(this.color)},ef=new D,tf=new z,nf=new z,go.prototype=Object.create(j.prototype),go.prototype.constructor=go,go.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},go.prototype.update=function(){var e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{var t=e.geometry.getAttribute(`color`);tf.copy(this.light.color),nf.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?tf:nf;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(ef.setFromMatrixPosition(this.light.matrixWorld).negate())},_o.prototype=Object.assign(Object.create(Ln.prototype),{constructor:_o,copy:function(e){return Ln.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return new this.constructor().copy(this)}}),vo.prototype=Object.create(Ln.prototype),vo.prototype.constructor=vo,rf=new D,af=new D,of=new D,yo.prototype=Object.create(j.prototype),yo.prototype.constructor=yo,yo.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},yo.prototype.update=function(){rf.setFromMatrixPosition(this.light.matrixWorld),af.setFromMatrixPosition(this.light.target.matrixWorld),of.subVectors(af,rf),this.lightPlane.lookAt(af),this.color===void 0?(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)):(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)),this.targetLine.lookAt(af),this.targetLine.scale.z=of.length()},sf=new D,cf=new _e,bo.prototype=Object.create(Ln.prototype),bo.prototype.constructor=bo,bo.prototype.update=function(){var e=this.geometry,t=this.pointMap,n=1,r=1;cf.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),xo(`c`,t,e,cf,0,0,-1),xo(`t`,t,e,cf,0,0,1),xo(`n1`,t,e,cf,-n,-r,-1),xo(`n2`,t,e,cf,n,-r,-1),xo(`n3`,t,e,cf,-n,r,-1),xo(`n4`,t,e,cf,n,r,-1),xo(`f1`,t,e,cf,-n,-r,1),xo(`f2`,t,e,cf,n,-r,1),xo(`f3`,t,e,cf,-n,r,1),xo(`f4`,t,e,cf,n,r,1),xo(`u1`,t,e,cf,n*.7,r*1.1,-1),xo(`u2`,t,e,cf,-n*.7,r*1.1,-1),xo(`u3`,t,e,cf,0,r*2,-1),xo(`cf1`,t,e,cf,-n,0,1),xo(`cf2`,t,e,cf,n,0,1),xo(`cf3`,t,e,cf,0,-r,1),xo(`cf4`,t,e,cf,0,r,1),xo(`cn1`,t,e,cf,-n,0,-1),xo(`cn2`,t,e,cf,n,0,-1),xo(`cn3`,t,e,cf,0,-r,-1),xo(`cn4`,t,e,cf,0,r,-1),e.getAttribute(`position`).needsUpdate=!0},lf=new N,So.prototype=Object.create(Ln.prototype),So.prototype.constructor=So,So.prototype.update=function(e){if(e!==void 0&&console.warn(`THREE.BoxHelper: .update() has no longer arguments.`),this.object!==void 0&&lf.setFromObject(this.object),!lf.isEmpty()){var t=lf.min,n=lf.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}},So.prototype.setFromObject=function(e){return this.object=e,this.update(),this},So.prototype.copy=function(e){return Ln.prototype.copy.call(this,e),this.object=e.object,this},So.prototype.clone=function(){return new this.constructor().copy(this)},Co.prototype=Object.create(Ln.prototype),Co.prototype.constructor=Co,Co.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),j.prototype.updateMatrixWorld.call(this,e))},wo.prototype=Object.create(In.prototype),wo.prototype.constructor=wo,wo.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=+(t<0),this.lookAt(this.plane.normal),j.prototype.updateMatrixWorld.call(this,e)},uf=new D,To.prototype=Object.create(j.prototype),To.prototype.constructor=To,To.prototype.setDirection=function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{uf.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(uf,t)}},To.prototype.setLength=function(e,t,n){t===void 0&&(t=.2*e),n===void 0&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},To.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},To.prototype.copy=function(e){return j.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},To.prototype.clone=function(){return new this.constructor().copy(this)},Eo.prototype=Object.create(Ln.prototype),Eo.prototype.constructor=Eo,pf=4,mf=8,hf=Math.pow(2,mf),gf=[.125,.215,.35,.446,.526,.582],_f=mf-pf+1+gf.length,vf=20,yf={[$s]:0,[ec]:1,[nc]:2,[ic]:3,[ac]:4,[oc]:5,[tc]:6},bf=new Sa,{_lodPlanes:xf,_sizeLods:Sf,_sigmas:Cf}=ko(),wf=null,Tf=(1+Math.sqrt(5))/2,Ef=1/Tf,Df=[new D(1,1,1),new D(-1,1,1),new D(1,1,-1),new D(-1,1,-1),new D(0,Tf,Ef),new D(0,Tf,-Ef),new D(Ef,0,Tf),new D(-Ef,0,Tf),new D(Tf,Ef,0),new D(-Tf,Ef,0)],Do.prototype={constructor:Do,fromScene:function(e,t=0,n=.1,r=100){wf=this._renderer.getRenderTarget();var i=this._allocateTargets();return this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i},fromEquirectangular:function(e){return e.magFilter=Uo,e.minFilter=Uo,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){wf=this._renderer.getRenderTarget();var t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t},compileCubemapShader:function(){this._cubemapShader===null&&(this._cubemapShader=Po(),this._compileMaterial(this._cubemapShader))},compileEquirectangularShader:function(){this._equirectShader===null&&(this._equirectShader=No(),this._compileMaterial(this._equirectShader))},dispose:function(){this._blurMaterial.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(var e=0;e<xf.length;e++)xf[e].dispose()},_cleanup:function(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(wf),e.scissorTest=!1,e.setSize(e.width,e.height)},_allocateTargets:function(e){var t={magFilter:Uo,minFilter:Uo,generateMipmaps:!1,type:Yo,format:ts,encoding:Oo(e)?e.encoding:nc,depthBuffer:!1,stencilBuffer:!1},n=Ao(t);return n.depthBuffer=!e,this._pingPongRenderTarget=Ao(t),n},_compileMaterial:function(e){var t=new de(xf[0],e);this._renderer.compile(t,bf)},_sceneToCubeUV:function(e,t,n,r){var i=new ve(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,c=s.outputEncoding,l=s.toneMapping,u=s.toneMappingExposure,d=s.getClearColor(),f=s.getClearAlpha();s.toneMapping=1,s.toneMappingExposure=1,s.outputEncoding=$s;var p=e.background;if(p&&p.isColor){p.convertSRGBToLinear();var m=Math.max(p.r,p.g,p.b),h=Math.min(Math.max(Math.ceil(Math.log2(m)),-128),127);p=p.multiplyScalar(Math.pow(2,-h));var g=(h+128)/255;s.setClearColor(p,g),e.background=null}for(var _=0;_<6;_++){var v=_%3;v==0?(i.up.set(0,a[_],0),i.lookAt(o[_],0,0)):v==1?(i.up.set(0,0,a[_]),i.lookAt(0,o[_],0)):(i.up.set(0,a[_],0),i.lookAt(0,0,o[_])),jo(r,v*hf,_>2?hf:0,hf,hf),s.setRenderTarget(r),s.render(e,i)}s.toneMapping=l,s.toneMappingExposure=u,s.outputEncoding=c,s.setClearColor(d,f)},_textureToCubeUV:function(e,t){var n=this._renderer;e.isCubeTexture?this._cubemapShader==null&&(this._cubemapShader=Po()):this._equirectShader==null&&(this._equirectShader=No());var r=e.isCubeTexture?this._cubemapShader:this._equirectShader,i=new de(xf[0],r),a=r.uniforms;a.envMap.value=e,e.isCubeTexture||a.texelSize.value.set(1/e.image.width,1/e.image.height),a.inputEncoding.value=yf[e.encoding],a.outputEncoding.value=yf[t.texture.encoding],jo(t,0,0,3*hf,2*hf),n.setRenderTarget(t),n.render(i,bf)},_applyPMREM:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;r<_f;r++){var i=Math.sqrt(Cf[r]*Cf[r]-Cf[r-1]*Cf[r-1]),a=Df[(r-1)%Df.length];this._blur(e,r-1,r,i,a)}t.autoClear=n},_blur:function(e,t,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,`latitudinal`,i),this._halfBlur(a,e,n,n,r,`longitudinal`,i)},_halfBlur:function(e,t,n,r,i,a,o){var s=this._renderer,c=this._blurMaterial;a!==`latitudinal`&&a!==`longitudinal`&&console.error(`blur direction must be either latitudinal or longitudinal!`);var l=3,u=new de(xf[r],c),d=c.uniforms,f=Sf[n]-1,p=isFinite(i)?Math.PI/(2*f):2*Math.PI/(2*vf-1),m=i/p,h=isFinite(i)?1+Math.floor(l*m):vf;h>vf&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${h} samples when the maximum is set to ${vf}`);for(var g=[],_=0,v=0;v<vf;++v){var y=v/m,b=Math.exp(-y*y/2);g.push(b),v==0?_+=b:v<h&&(_+=2*b)}for(var v=0;v<g.length;v++)g[v]=g[v]/_;d.envMap.value=e.texture,d.samples.value=h,d.weights.value=g,d.latitudinal.value=a===`latitudinal`,o&&(d.poleAxis.value=o),d.dTheta.value=p,d.mipInt.value=mf-n,d.inputEncoding.value=yf[e.texture.encoding],d.outputEncoding.value=yf[e.texture.encoding];var x=Sf[r],y=3*Math.max(0,hf-2*x);jo(t,y,(r===0?0:2*hf)+2*x*(r>mf-pf?r-mf+pf:0),3*x,2*x),s.setRenderTarget(t),s.render(u,bf)}},Y.create=function(e,t){return console.log(`THREE.Curve.create() has been deprecated`),e.prototype=Object.create(Y.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(fa.prototype,{createPointsGeometry:function(e){console.warn(`THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.`);var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn(`THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.`);var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn(`THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.`);for(var t=new J,n=0,r=e.length;n<r;n++){var i=e[n];t.vertices.push(new D(i.x,i.y,i.z||0))}return t}}),Object.assign(pa.prototype,{fromPoints:function(e){return console.warn(`THREE.Path: .fromPoints() has been renamed to .setFromPoints().`),this.setFromPoints(e)}}),Lo.prototype=Object.create(Ji.prototype),Ro.prototype=Object.create(Ji.prototype),zo.prototype=Object.create(Ji.prototype),Object.assign(zo.prototype,{initFromArray:function(){console.error(`THREE.Spline: .initFromArray() has been removed.`)},getControlPointsArray:function(){console.error(`THREE.Spline: .getControlPointsArray() has been removed.`)},reparametrizeByArcLength:function(){console.error(`THREE.Spline: .reparametrizeByArcLength() has been removed.`)}}),_o.prototype.setColors=function(){console.error(`THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.`)},mo.prototype.update=function(){console.error(`THREE.SkeletonHelper: update() no longer needs to be called.`)},Object.assign(Li.prototype,{extractUrlBase:function(e){return console.warn(`THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.`),bd.extractUrlBase(e)}}),Li.Handlers={add:function(){console.error(`THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.`)},get:function(){console.error(`THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.`)}},Object.assign(Na.prototype,{setTexturePath:function(e){return console.warn(`THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().`),this.setResourcePath(e)}}),Object.assign(co.prototype,{center:function(e){return console.warn(`THREE.Box2: .center() has been renamed to .getCenter().`),this.getCenter(e)},empty:function(){return console.warn(`THREE.Box2: .empty() has been renamed to .isEmpty().`),this.isEmpty()},isIntersectionBox:function(e){return console.warn(`THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().`),this.intersectsBox(e)},size:function(e){return console.warn(`THREE.Box2: .size() has been renamed to .getSize().`),this.getSize(e)}}),Object.assign(N.prototype,{center:function(e){return console.warn(`THREE.Box3: .center() has been renamed to .getCenter().`),this.getCenter(e)},empty:function(){return console.warn(`THREE.Box3: .empty() has been renamed to .isEmpty().`),this.isEmpty()},isIntersectionBox:function(e){return console.warn(`THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().`),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn(`THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().`),this.intersectsSphere(e)},size:function(e){return console.warn(`THREE.Box3: .size() has been renamed to .getSize().`),this.getSize(e)}}),Object.assign(F.prototype,{empty:function(){return console.warn(`THREE.Sphere: .empty() has been renamed to .isEmpty().`),this.isEmpty()}}),Se.prototype.setFromMatrix=function(e){return console.warn(`THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix().`),this.setFromProjectionMatrix(e)},lo.prototype.center=function(e){return console.warn(`THREE.Line3: .center() has been renamed to .getCenter().`),this.getCenter(e)},Object.assign(X,{random16:function(){return console.warn(`THREE.Math: .random16() has been deprecated. Use Math.random() instead.`),Math.random()},nearestPowerOfTwo:function(e){return console.warn(`THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo().`),X.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn(`THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo().`),X.ceilPowerOfTwo(e)}}),Object.assign(x.prototype,{flattenToArrayOffset:function(e,t){return console.warn(`THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.`),this.toArray(e,t)},multiplyVector3:function(e){return console.warn(`THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.`),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error(`THREE.Matrix3: .multiplyVector3Array() has been removed.`)},applyToBufferAttribute:function(e){return console.warn(`THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead.`),e.applyMatrix3(this)},applyToVector3Array:function(){console.error(`THREE.Matrix3: .applyToVector3Array() has been removed.`)}}),Object.assign(O.prototype,{extractPosition:function(e){return console.warn(`THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().`),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn(`THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.`),this.toArray(e,t)},getPosition:function(){return console.warn(`THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.`),new D().setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn(`THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().`),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn(`THREE.Matrix4: .multiplyToArray() has been removed.`)},multiplyVector3:function(e){return console.warn(`THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn(`THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error(`THREE.Matrix4: .multiplyVector3Array() has been removed.`)},rotateAxis:function(e){console.warn(`THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.`),e.transformDirection(this)},crossVector:function(e){return console.warn(`THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},translate:function(){console.error(`THREE.Matrix4: .translate() has been removed.`)},rotateX:function(){console.error(`THREE.Matrix4: .rotateX() has been removed.`)},rotateY:function(){console.error(`THREE.Matrix4: .rotateY() has been removed.`)},rotateZ:function(){console.error(`THREE.Matrix4: .rotateZ() has been removed.`)},rotateByAxis:function(){console.error(`THREE.Matrix4: .rotateByAxis() has been removed.`)},applyToBufferAttribute:function(e){return console.warn(`THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},applyToVector3Array:function(){console.error(`THREE.Matrix4: .applyToVector3Array() has been removed.`)},makeFrustum:function(e,t,n,r,i,a){return console.warn(`THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.`),this.makePerspective(e,t,r,n,i,a)}}),L.prototype.isIntersectionLine=function(e){return console.warn(`THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().`),this.intersectsLine(e)},E.prototype.multiplyVector3=function(e){return console.warn(`THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.`),e.applyQuaternion(this)},Object.assign(I.prototype,{isIntersectionBox:function(e){return console.warn(`THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().`),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn(`THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().`),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn(`THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().`),this.intersectsSphere(e)}}),Object.assign(R.prototype,{area:function(){return console.warn(`THREE.Triangle: .area() has been renamed to .getArea().`),this.getArea()},barycoordFromPoint:function(e,t){return console.warn(`THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().`),this.getBarycoord(e,t)},midpoint:function(e){return console.warn(`THREE.Triangle: .midpoint() has been renamed to .getMidpoint().`),this.getMidpoint(e)},normal:function(e){return console.warn(`THREE.Triangle: .normal() has been renamed to .getNormal().`),this.getNormal(e)},plane:function(e){return console.warn(`THREE.Triangle: .plane() has been renamed to .getPlane().`),this.getPlane(e)}}),Object.assign(R,{barycoordFromPoint:function(e,t,n,r,i){return console.warn(`THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().`),R.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn(`THREE.Triangle: .normal() has been renamed to .getNormal().`),R.getNormal(e,t,n,r)}}),Object.assign(ma.prototype,{extractAllPoints:function(e){return console.warn(`THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.`),this.extractPoints(e)},extrude:function(e){return console.warn(`THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.`),new Wr(this,e)},makeGeometry:function(e){return console.warn(`THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.`),new ti(this,e)}}),Object.assign(b.prototype,{fromAttribute:function(e,t,n){return console.warn(`THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().`),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn(`THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().`),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn(`THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().`),this.manhattanLength()}}),Object.assign(D.prototype,{setEulerFromRotationMatrix:function(){console.error(`THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.`)},setEulerFromQuaternion:function(){console.error(`THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.`)},getPositionFromMatrix:function(e){return console.warn(`THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().`),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn(`THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().`),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn(`THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().`),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn(`THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.`),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn(`THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().`),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn(`THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().`),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn(`THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().`),this.manhattanLength()}}),Object.assign(C.prototype,{fromAttribute:function(e,t,n){return console.warn(`THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().`),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn(`THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().`),this.manhattanLength()}}),Object.assign(J.prototype,{computeTangents:function(){console.error(`THREE.Geometry: .computeTangents() has been removed.`)},computeLineDistances:function(){console.error(`THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.`)},applyMatrix:function(e){return console.warn(`THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)}}),Object.assign(j.prototype,{getChildByName:function(e){return console.warn(`THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().`),this.getObjectByName(e)},renderDepth:function(){console.warn(`THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.`)},translate:function(e,t){return console.warn(`THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.`),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error(`THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.`)},applyMatrix:function(e){return console.warn(`THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)}}),Object.defineProperties(j.prototype,{eulerOrder:{get:function(){return console.warn(`THREE.Object3D: .eulerOrder is now .rotation.order.`),this.rotation.order},set:function(e){console.warn(`THREE.Object3D: .eulerOrder is now .rotation.order.`),this.rotation.order=e}},useQuaternion:{get:function(){console.warn(`THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.`)},set:function(){console.warn(`THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.`)}}}),Object.assign(de.prototype,{setDrawMode:function(){console.error(`THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.`)}}),Object.defineProperties(de.prototype,{drawMode:{get:function(){return console.error(`THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode.`),0},set:function(){console.error(`THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.`)}}}),Object.defineProperties(An.prototype,{objects:{get:function(){return console.warn(`THREE.LOD: .objects has been renamed to .levels.`),this.levels}}}),Object.defineProperty(Mn.prototype,`useVertexTexture`,{get:function(){console.warn(`THREE.Skeleton: useVertexTexture has been removed.`)},set:function(){console.warn(`THREE.Skeleton: useVertexTexture has been removed.`)}}),jn.prototype.initBones=function(){console.error(`THREE.SkinnedMesh: initBones() has been removed.`)},Object.defineProperty(Y.prototype,`__arcLengthDivisions`,{get:function(){return console.warn(`THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.`),this.arcLengthDivisions},set:function(e){console.warn(`THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.`),this.arcLengthDivisions=e}}),ve.prototype.setLens=function(e,t){console.warn(`THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup.`),t!==void 0&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(ha.prototype,{onlyShadow:{set:function(){console.warn(`THREE.Light: .onlyShadow has been removed.`)}},shadowCameraFov:{set:function(e){console.warn(`THREE.Light: .shadowCameraFov is now .shadow.camera.fov.`),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn(`THREE.Light: .shadowCameraLeft is now .shadow.camera.left.`),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn(`THREE.Light: .shadowCameraRight is now .shadow.camera.right.`),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn(`THREE.Light: .shadowCameraTop is now .shadow.camera.top.`),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn(`THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.`),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn(`THREE.Light: .shadowCameraNear is now .shadow.camera.near.`),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn(`THREE.Light: .shadowCameraFar is now .shadow.camera.far.`),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn(`THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.`)}},shadowBias:{set:function(e){console.warn(`THREE.Light: .shadowBias is now .shadow.bias.`),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn(`THREE.Light: .shadowDarkness has been removed.`)}},shadowMapWidth:{set:function(e){console.warn(`THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.`),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn(`THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.`),this.shadow.mapSize.height=e}}}),Object.defineProperties(H.prototype,{length:{get:function(){return console.warn(`THREE.BufferAttribute: .length has been deprecated. Use .count instead.`),this.array.length}},dynamic:{get:function(){return console.warn(`THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.`),this.usage===dc},set:function(){console.warn(`THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.`),this.setUsage(dc)}}}),Object.assign(H.prototype,{setDynamic:function(e){return console.warn(`THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.`),this.setUsage(e===!0?dc:uc),this},copyIndicesArray:function(){console.error(`THREE.BufferAttribute: .copyIndicesArray() has been removed.`)},setArray:function(){console.error(`THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers`)}}),Object.assign(q.prototype,{addIndex:function(e){console.warn(`THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().`),this.setIndex(e)},addAttribute:function(e,t){return console.warn(`THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().`),!(t&&t.isBufferAttribute)&&!(t&&t.isInterleavedBufferAttribute)?(console.warn(`THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).`),this.setAttribute(e,new H(arguments[1],arguments[2]))):e===`index`?(console.warn(`THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.`),this.setIndex(t),this):this.setAttribute(e,t)},addDrawCall:function(e,t,n){n!==void 0&&console.warn(`THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.`),console.warn(`THREE.BufferGeometry: .addDrawCall() is now .addGroup().`),this.addGroup(e,t)},clearDrawCalls:function(){console.warn(`THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().`),this.clearGroups()},computeTangents:function(){console.warn(`THREE.BufferGeometry: .computeTangents() has been removed.`)},computeOffsets:function(){console.warn(`THREE.BufferGeometry: .computeOffsets() has been removed.`)},removeAttribute:function(e){return console.warn(`THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute().`),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn(`THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)}}),Object.defineProperties(q.prototype,{drawcalls:{get:function(){return console.error(`THREE.BufferGeometry: .drawcalls has been renamed to .groups.`),this.groups}},offsets:{get:function(){return console.warn(`THREE.BufferGeometry: .offsets has been renamed to .groups.`),this.groups}}}),Object.defineProperties(Aa.prototype,{maxInstancedCount:{get:function(){return console.warn(`THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.`),this.instanceCount},set:function(e){console.warn(`THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.`),this.instanceCount=e}}}),Object.defineProperties(ro.prototype,{linePrecision:{get:function(){return console.warn(`THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.`),this.params.Line.threshold},set:function(e){console.warn(`THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.`),this.params.Line.threshold=e}}}),Object.defineProperties(Tn.prototype,{dynamic:{get:function(){return console.warn(`THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.`),this.usage===dc},set:function(e){console.warn(`THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.`),this.setUsage(e)}}}),Object.assign(Tn.prototype,{setDynamic:function(e){return console.warn(`THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead.`),this.setUsage(e===!0?dc:uc),this},setArray:function(){console.error(`THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers`)}}),Object.assign(Gr.prototype,{getArrays:function(){console.error(`THREE.ExtrudeBufferGeometry: .getArrays() has been removed.`)},addShapeList:function(){console.error(`THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.`)},addShape:function(){console.error(`THREE.ExtrudeBufferGeometry: .addShape() has been removed.`)}}),Object.defineProperties(to.prototype,{dynamic:{set:function(){console.warn(`THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.`)}},onUpdate:{value:function(){return console.warn(`THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.`),this}}}),Object.defineProperties(V.prototype,{wrapAround:{get:function(){console.warn(`THREE.Material: .wrapAround has been removed.`)},set:function(){console.warn(`THREE.Material: .wrapAround has been removed.`)}},overdraw:{get:function(){console.warn(`THREE.Material: .overdraw has been removed.`)},set:function(){console.warn(`THREE.Material: .overdraw has been removed.`)}},wrapRGB:{get:function(){return console.warn(`THREE.Material: .wrapRGB has been removed.`),new z}},shading:{get:function(){console.error(`THREE.`+this.type+`: .shading has been removed. Use the boolean .flatShading instead.`)},set:function(e){console.warn(`THREE.`+this.type+`: .shading has been removed. Use the boolean .flatShading instead.`),this.flatShading=e===1}},stencilMask:{get:function(){return console.warn(`THREE.`+this.type+`: .stencilMask has been removed. Use .stencilFuncMask instead.`),this.stencilFuncMask},set:function(e){console.warn(`THREE.`+this.type+`: .stencilMask has been removed. Use .stencilFuncMask instead.`),this.stencilFuncMask=e}}}),Object.defineProperties(hi.prototype,{metal:{get:function(){return console.warn(`THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.`),!1},set:function(){console.warn(`THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead`)}}}),Object.defineProperties(ge.prototype,{derivatives:{get:function(){return console.warn(`THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.`),this.extensions.derivatives},set:function(e){console.warn(`THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.`),this.extensions.derivatives=e}}}),Object.assign(Sn.prototype,{clearTarget:function(e,t,n,r){console.warn(`THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.`),this.setRenderTarget(e),this.clear(t,n,r)},animate:function(e){console.warn(`THREE.WebGLRenderer: .animate() is now .setAnimationLoop().`),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn(`THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().`),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn(`THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().`),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn(`THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.`),this.capabilities.precision},resetGLState:function(){return console.warn(`THREE.WebGLRenderer: .resetGLState() is now .state.reset().`),this.state.reset()},supportsFloatTextures:function(){return console.warn(`THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).`),this.extensions.get(`OES_texture_float`)},supportsHalfFloatTextures:function(){return console.warn(`THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).`),this.extensions.get(`OES_texture_half_float`)},supportsStandardDerivatives:function(){return console.warn(`THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).`),this.extensions.get(`OES_standard_derivatives`)},supportsCompressedTextureS3TC:function(){return console.warn(`THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).`),this.extensions.get(`WEBGL_compressed_texture_s3tc`)},supportsCompressedTexturePVRTC:function(){return console.warn(`THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).`),this.extensions.get(`WEBGL_compressed_texture_pvrtc`)},supportsBlendMinMax:function(){return console.warn(`THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).`),this.extensions.get(`EXT_blend_minmax`)},supportsVertexTextures:function(){return console.warn(`THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.`),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn(`THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).`),this.extensions.get(`ANGLE_instanced_arrays`)},enableScissorTest:function(e){console.warn(`THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().`),this.setScissorTest(e)},initMaterial:function(){console.warn(`THREE.WebGLRenderer: .initMaterial() has been removed.`)},addPrePlugin:function(){console.warn(`THREE.WebGLRenderer: .addPrePlugin() has been removed.`)},addPostPlugin:function(){console.warn(`THREE.WebGLRenderer: .addPostPlugin() has been removed.`)},updateShadowMap:function(){console.warn(`THREE.WebGLRenderer: .updateShadowMap() has been removed.`)},setFaceCulling:function(){console.warn(`THREE.WebGLRenderer: .setFaceCulling() has been removed.`)},allocTextureUnit:function(){console.warn(`THREE.WebGLRenderer: .allocTextureUnit() has been removed.`)},setTexture:function(){console.warn(`THREE.WebGLRenderer: .setTexture() has been removed.`)},setTexture2D:function(){console.warn(`THREE.WebGLRenderer: .setTexture2D() has been removed.`)},setTextureCube:function(){console.warn(`THREE.WebGLRenderer: .setTextureCube() has been removed.`)},getActiveMipMapLevel:function(){return console.warn(`THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().`),this.getActiveMipmapLevel()}}),Object.defineProperties(Sn.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn(`THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.`),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn(`THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.`),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.`)}},context:{get:function(){return console.warn(`THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.`),this.getContext()}},vr:{get:function(){return console.warn(`THREE.WebGLRenderer: .vr has been renamed to .xr`),this.xr}},gammaInput:{get:function(){return console.warn(`THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.`),!1},set:function(){console.warn(`THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.`)}},gammaOutput:{get:function(){return console.warn(`THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.`),!1},set:function(e){console.warn(`THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.`),this.outputEncoding=e===!0?ec:$s}}}),Object.defineProperties(pn.prototype,{cullFace:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.`)}},renderReverseSided:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.`)}},renderSingleSided:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.`)}}}),Object.defineProperties(w.prototype,{wrapS:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.`),this.texture.wrapS},set:function(e){console.warn(`THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.`),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.`),this.texture.wrapT},set:function(e){console.warn(`THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.`),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.`),this.texture.magFilter},set:function(e){console.warn(`THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.`),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.`),this.texture.minFilter},set:function(e){console.warn(`THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.`),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.`),this.texture.anisotropy},set:function(e){console.warn(`THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.`),this.texture.anisotropy=e}},offset:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .offset is now .texture.offset.`),this.texture.offset},set:function(e){console.warn(`THREE.WebGLRenderTarget: .offset is now .texture.offset.`),this.texture.offset=e}},repeat:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .repeat is now .texture.repeat.`),this.texture.repeat},set:function(e){console.warn(`THREE.WebGLRenderTarget: .repeat is now .texture.repeat.`),this.texture.repeat=e}},format:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .format is now .texture.format.`),this.texture.format},set:function(e){console.warn(`THREE.WebGLRenderTarget: .format is now .texture.format.`),this.texture.format=e}},type:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .type is now .texture.type.`),this.texture.type},set:function(e){console.warn(`THREE.WebGLRenderTarget: .type is now .texture.type.`),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.`),this.texture.generateMipmaps},set:function(e){console.warn(`THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.`),this.texture.generateMipmaps=e}}}),Object.defineProperties(Ka.prototype,{load:{value:function(e){console.warn(`THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.`);var t=this;return new Ba().load(e,function(e){t.setBuffer(e)}),this}},startTime:{set:function(){console.warn(`THREE.Audio: .startTime is now .play( delay ).`)}}}),Ja.prototype.getData=function(){return console.warn(`THREE.AudioAnalyser: .getData() is now .getFrequencyData().`),this.getFrequencyData()},ye.prototype.updateCubeMap=function(e,t){return console.warn(`THREE.CubeCamera: .updateCubeMap() is now .update().`),this.update(e,t)},hc.crossOrigin=void 0,hc.loadTexture=function(e,t,n,r){console.warn(`THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.`);var i=new Wi;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},hc.loadTextureCube=function(e,t,n,r){console.warn(`THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.`);var i=new Ui;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},hc.loadCompressedTexture=function(){console.error(`THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.`)},hc.loadCompressedTextureCube=function(){console.error(`THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.`)},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`register`,{detail:{revision:`117`}}))})),kf=e((()=>{Of()}));Of(),kf();function $(e,t,n){return function(r,i,a){return((r+e-1)/e|0)*((i+t-1)/t|0)*n*a}}function Af(e,t,n){return function(r,i,a){return(Math.max(r,e)*Math.max(i,t)/n|0)*a}}new Map([[rs,$(4,4,8)],[is,$(4,4,8)],[as,$(4,4,16)],[os,$(4,4,16)],[ds,$(4,4,8)],[ss,Af(8,8,2)],[ls,Af(8,8,2)],[cs,Af(16,8,4)],[us,Af(16,8,4)],[fs,$(4,4,8)],[ps,$(4,4,16)],[ms,$(4,4,16)],[ks,$(4,4,16)],[hs,$(5,4,16)],[As,$(5,4,16)],[gs,$(5,5,16)],[js,$(5,5,16)],[_s,$(6,5,16)],[Ms,$(6,5,16)],[vs,$(6,6,16)],[Ns,$(6,6,16)],[ys,$(8,5,16)],[Ps,$(8,5,16)],[bs,$(8,6,16)],[Fs,$(8,6,16)],[xs,$(8,8,16)],[Is,$(8,8,16)],[Ss,$(10,5,16)],[Ls,$(10,5,16)],[Cs,$(10,6,16)],[Rs,$(10,6,16)],[ws,$(10,8,16)],[zs,$(10,8,16)],[Ts,$(10,10,16)],[Bs,$(10,10,16)],[Es,$(12,10,16)],[Vs,$(12,10,16)],[Ds,$(12,12,16)],[Hs,$(12,12,16)],[Os,$(4,4,16)]]),Of();let jf=new O().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);new O().getInverse(jf);function Mf(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function Nf(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){Mf(a,r,i,o,s,`next`,e)}function s(e){Mf(a,r,i,o,s,`throw`,e)}o(void 0)})}}function Pf(){return Ff.apply(this,arguments)}function Ff(){return Ff=Nf(function*(e={}){var t,n=e,r=!1,i=!0,a=self.location.href;if(r||i){try{new URL(`.`,a).href}catch(e){}(function(){var e=Nf(function*(e){var t=yield fetch(e,{credentials:`same-origin`});if(t.ok)return t.arrayBuffer();throw Error(t.status+` : `+t.url)});return function(t){return e.apply(this,arguments)}})()}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==`function`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,I.c()}function m(){if(n.postRun)for(typeof n.postRun==`function`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(`\\0asm\\0\\0\\0&\\`\\`}}\\`}\\`\\0\\`\\v\\0\\`\\0\\0\\x07aa\\0\\0\\b\\x07\\0\\0\\x07\\bA\\v\\x07b\\0c\\0\\x07d\\0e\\0f\\0\\f\n;\\x07T~@A\\b(\\0" \\0B\\x07|Bøÿÿÿ|"BÿÿÿÿX@ §"\\0?\\0AtM\\r \\0\\0\\r\\vA\\bA06\\0A\\vA\\b \\x006\\0 \\v\\0 \\0 Atr\\vr \\0¼"Aÿÿÿq!@ AvAÿq"E\\r\\0 Að\\0M@ ArAñ\\0 kv!\\f\\v AK@Aø!A\\0!\\f\\v A\ntA\\x07k!\\v AvAqr A\\rvr\\vß\\v\\b@ \\0E\\r\\0 \\0A\\bk" \\0Ak(\\0"Axq"\\0j!@ Aq\\r\\0 AqE\\r (\\0"k"A\\b(\\0I\\r \\0 j!\\0@@@A\\b(\\0 G@ (\\f! AÿM@ (\\b"G\\rA\\bA\\b(\\0A~ Avwq6\\0\\f\\v (!\\x07 G@ (\\b" 6\\f 6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v ("AqAG\\rA\\b \\x006\\0 A~q6 \\0Ar6 \\x006\\0\\v 6\\f 6\\b\\f\\vA\\0!\\v \\x07E\\r\\0@ ("At"(¸\n F@ A¸\nj 6\\0 \\rA\\bA\\b(\\0A~ wq6\\0\\f\\v@ \\x07(F@ \\x07 6\\f\\v \\x07 6\\v E\\r\\v \\x076 ("@ 6 6\\v ("E\\r\\0 6 6\\v O\\r\\0 ("AqE\\r\\0@@@@ AqE@A\\xA0\\b(\\0 F@A\\xA0\\b 6\\0A\\bA\\b(\\0 \\0j"\\x006\\0 \\0Ar6 A\\b(\\0G\\rA\\bA\\x006\\0A\\bA\\x006\\0\\vA\\b(\\0"\\x07 F@A\\b 6\\0A\\bA\\b(\\0 \\0j"\\x006\\0 \\0Ar6 \\0 j \\x006\\0\\v Axq \\0j!\\0 (\\f! AÿM@ (\\b" F@A\\bA\\b(\\0A~ Avwq6\\0\\f\\v 6\\f 6\\b\\f\\v (!\\b G@ (\\b" 6\\f 6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v A~q6 \\0Ar6 \\0 j \\x006\\0\\f\\vA\\0!\\v \\bE\\r\\0@ ("At"(¸\n F@ A¸\nj 6\\0 \\rA\\bA\\b(\\0A~ wq6\\0\\f\\v@ \\b(F@ \\b 6\\f\\v \\b 6\\v E\\r\\v \\b6 ("@ 6 6\\v ("E\\r\\0 6 6\\v \\0Ar6 \\0 j \\x006\\0 \\x07G\\r\\0A\\b \\x006\\0\\v \\0AÿM@ \\0AøqA°\\bj!A\\b(\\0"A \\0Avt"\\0qE@A\\b \\0 r6\\0 \\f\\v (\\b\\v!\\0 6\\b \\0 6\\f 6\\f \\x006\\b\\vA! \\0Aÿÿÿ\\x07M@ \\0A& \\0A\\bvg"kvAq AtrA>s!\\v 6 B\\x007 AtA¸\nj!@A\\b(\\0"A t"qE@A\\b r6\\0 6\\0A!A\\b\\f\\v \\0A AvkA\\0 AG\\x1Bt! (\\0!@ "(Axq \\0F\\r Av! At! Aqj"("\\r\\0\\v 6A! !A\\b\\v!\\0 "\\f\\v (\\b" 6\\f 6\\bA!\\0A\\b!A\\0\\v! j 6\\0 6\\f \\0 j 6\\0A¨\\bA¨\\b(\\0Ak"\\0A \\0\\x1B6\\0\\v\\v¸\'\\v#\\0Ak"\n$\\0@@@@@@@@@@ \\0AôM@A\\b(\\0"A \\0A\\vjAøq \\0A\\vI\\x1B"Av"\\0v"Aq@@ AsAq \\0j"At"A°\\bj"\\0 (¸\\b"(\\b"F@A\\b A~ wq6\\0\\f\\v \\x006\\f \\0 6\\b\\v A\\bj!\\0 Ar6 j" (Ar6\\f\\v\\v A\\b(\\0"\\bM\\r @@A \\0t"A\\0 kr \\0tqh"At"A°\\bj" (¸\\b"\\0(\\b"F@A\\b A~ wq"6\\0\\f\\v 6\\f 6\\b\\v \\0 Ar6 \\0 j"\\x07 k"Ar6 \\0 j 6\\0 \\b@ \\bAxqA°\\bj!A\\b(\\0! A \\bAvt"qE@A\\b r6\\0 \\f\\v (\\b\\v! 6\\b 6\\f 6\\f 6\\b\\v \\0A\\bj!\\0A\\b \\x076\\0A\\b 6\\0\\f\\v\\vA\\b(\\0"\\vE\\r \\vhAt(¸\n"(Axq k! !@@ ("\\0E@ ("\\0E\\r\\v \\0(Axq k" I"\\x1B! \\0 \\x1B! \\0!\\f\\v\\v (! (\\f"\\0G@ (\\b" \\x006\\f \\0 6\\b\\f\n\\v (" Aj ("E\\r Aj\\v!@ !\\x07 "\\0Aj! \\0("\\r\\0 \\0Aj! \\0("\\r\\0\\v \\x07A\\x006\\0\\f \\vA! \\0A¿K\\r\\0 \\0A\\vj"Axq!A\\b(\\0"\\x07E\\r\\0A!\\bA\\0 k! \\0Aôÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtkA>j!\\b\\v@@@ \\bAt(¸\n"E@A\\0!\\0\\f\\vA\\0!\\0 A \\bAvkA\\0 \\bAG\\x1Bt!@@ (Axq k" O\\r\\0 ! "\\r\\0A\\0! !\\0\\f\\v \\0 (" AvAqj("F\\x1B \\0 \\x1B!\\0 At! \\r\\0\\v\\v \\0 rE@A\\0!A \\bt"\\0A\\0 \\0kr \\x07q"\\0E\\r \\0hAt(¸\n!\\0\\v \\0E\\r\\v@ \\0(Axq k" I! \\x1B! \\0 \\x1B! \\0(" \\0(\\v"\\0\\r\\0\\v\\v E\\r\\0 A\\b(\\0 kO\\r\\0 (!\\b (\\f"\\0G@ (\\b" \\x006\\f \\0 6\\b\\f\\b\\v (" Aj ("E\\r Aj\\v!@ ! "\\0Aj! \\0("\\r\\0 \\0Aj! \\0("\\r\\0\\v A\\x006\\0\\f\\x07\\v A\\b(\\0"M@A\\b(\\0!\\0@ k"AO@ \\0 j" Ar6 \\0 j 6\\0 \\0 Ar6\\f\\v \\0 Ar6 \\0 j" (Ar6A\\0!A\\0!\\vA\\b 6\\0A\\b 6\\0 \\0A\\bj!\\0\\f \\v A\\b(\\0"I@A\\b k"6\\0A\\xA0\\bA\\xA0\\b(\\0"\\0 j"6\\0 Ar6 \\0 Ar6 \\0A\\bj!\\0\\f \\vA\\0!\\0 A/j"Aà\\v(\\0@Aè\\v(\\0\\f\\vAì\\vB7\\0Aä\\vB\\xA07\\0Aà\\v \nA\\fjApqAتժs6\\0Aô\\vA\\x006\\0AÄ\\vA\\x006\\0A \\v"j"A\\0 k"\\x07q" M\\r\\bAÀ\\v(\\0"@A¸\\v(\\0"\\b j" \\bM Ir\\r \\v@AÄ\\v-\\0\\0AqE@@@@@A\\xA0\\b(\\0"@AÈ\\v!\\0@ \\0(\\0"\\b M@ \\b \\0(jI\\r\\v \\0(\\b"\\0\\r\\0\\v\\vA\\0"AF\\r !Aä\\v(\\0"\\0Ak" q@ k jA\\0 \\0kqj!\\v M\\rAÀ\\v(\\0"\\0@A¸\\v(\\0" j"\\x07 M \\0 \\x07Ir\\r\\v "\\0 G\\r\\f\\v k \\x07q"" \\0(\\0 \\0(jF\\r !\\0\\v \\0AF\\r A0j M@ \\0!\\f\\vAè\\v(\\0" kjA\\0 kq"AF\\r j! \\0!\\f\\v AG\\r\\vAÄ\\vAÄ\\v(\\0Ar6\\0\\v "AFA\\0"\\0AFr \\0 Mr\\r \\0 k" A(jM\\r\\vA¸\\vA¸\\v(\\0 j"\\x006\\0A¼\\v(\\0 \\0I@A¼\\v \\x006\\0\\v@A\\xA0\\b(\\0"@AÈ\\v!\\0@ \\0(\\0" \\0("jF\\r \\0(\\b"\\0\\r\\0\\v\\f\\vA\\b(\\0"\\0A\\0 \\0 M\\x1BE@A\\b 6\\0\\vA\\0!\\0AÌ\\v 6\\0AÈ\\v 6\\0A¨\\bA6\\0A¬\\bAà\\v(\\x006\\0AÔ\\vA\\x006\\0@ \\0At" A°\\bj"6¸\\b 6¼\\b \\0Aj"\\0A G\\r\\0\\vA\\b A(k"\\0Ax kA\\x07q"k"6\\0A\\xA0\\b j"6\\0 Ar6 \\0 jA(6A¤\\bAð\\v(\\x006\\0\\f\\v M Kr\\r \\0(\\fA\\bq\\r \\0 j6A\\xA0\\b Ax kA\\x07q"\\0j"6\\0A\\bA\\b(\\0 j" \\0k"\\x006\\0 \\0Ar6 jA(6A¤\\bAð\\v(\\x006\\0\\f\\vA\\0!\\0\\f\\vA\\0!\\0\\f\\vA\\b(\\0 K@A\\b 6\\0\\v j!AÈ\\v!\\0@@ \\0(\\0"G@ \\0(\\b"\\0\\r\\f\\v\\v \\0-\\0\\fA\\bqE\\r\\vAÈ\\v!\\0@@ \\0(\\0" M@ \\0(j"I\\r\\v \\0(\\b!\\0\\f\\v\\vA\\b A(k"\\0Ax kA\\x07q"k"\\x076\\0A\\xA0\\b j"6\\0 \\x07Ar6 \\0 jA(6A¤\\bAð\\v(\\x006\\0 A\' kA\\x07qjA/k"\\0 \\0 AjI\\x1B"A\\x1B6 AÐ\\v)\\x007 AÈ\\v)\\x007\\bAÐ\\v A\\bj6\\0AÌ\\v 6\\0AÈ\\v 6\\0AÔ\\vA\\x006\\0 Aj!\\0@ \\0A\\x076 \\0A\\bj \\0Aj!\\0 I\\r\\0\\v F\\r\\0 (A~q6 k"Ar6 6\\0 AÿM@ AøqA°\\bj!\\0A\\b(\\0"A Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\fA\\f!A\\b\\f\\vA!\\0 Aÿÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtrA>s!\\0\\v \\x006 B\\x007 \\0AtA¸\nj!@@A\\b(\\0"A \\0t"qE@A\\b r6\\0 6\\0\\f\\v A \\0AvkA\\0 \\0AG\\x1Bt!\\0 (\\0!@ "(Axq F\\r \\0Av! \\0At!\\0 Aqj"("\\r\\0\\v 6\\v 6A\\b! "!\\0A\\f\\f\\v (\\b"\\0 6\\f 6\\b \\x006\\bA\\0!\\0A!A\\f\\v j 6\\0 j \\x006\\0\\vA\\b(\\0"\\0 M\\r\\0A\\b \\0 k"6\\0A\\xA0\\bA\\xA0\\b(\\0"\\0 j"6\\0 Ar6 \\0 Ar6 \\0A\\bj!\\0\\f\\vA\\bA06\\0A\\0!\\0\\f\\v \\0 6\\0 \\0 \\0( j6 Ax kA\\x07qj"\\b Ar6 Ax kA\\x07qj" \\bj"k!\\x07@A\\xA0\\b(\\0 F@A\\xA0\\b 6\\0A\\bA\\b(\\0 \\x07j"\\x006\\0 \\0Ar6\\f\\vA\\b(\\0 F@A\\b 6\\0A\\bA\\b(\\0 \\x07j"\\x006\\0 \\0Ar6 \\0 j \\x006\\0\\f\\v ("\\0AqAF@ \\0Axq! (\\f!@ \\0AÿM@ (\\b" F@A\\bA\\b(\\0A~ \\0Avwq6\\0\\f\\v 6\\f 6\\b\\f\\v (!@ G@ (\\b"\\0 6\\f \\x006\\b\\f\\v@ ("\\0 Aj ("\\0E\\r Aj\\v!@ ! \\0"Aj! \\0("\\0\\r\\0 Aj! ("\\0\\r\\0\\v A\\x006\\0\\f\\vA\\0!\\v E\\r\\0@ ("\\0At"(¸\n F@ A¸\nj 6\\0 \\rA\\bA\\b(\\0A~ \\0wq6\\0\\f\\v@ (F@ 6\\f\\v 6\\v E\\r\\v 6 ("\\0@ \\x006 \\0 6\\v ("\\0E\\r\\0 \\x006 \\0 6\\v \\x07 j!\\x07 j"(!\\0\\v \\0A~q6 \\x07Ar6 \\x07j \\x076\\0 \\x07AÿM@ \\x07AøqA°\\bj!\\0A\\b(\\0"A \\x07Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\f\\vA! \\x07Aÿÿÿ\\x07M@ \\x07A& \\x07A\\bvg"\\0kvAq \\0AtrA>s!\\v 6 B\\x007 AtA¸\nj!\\0@@A\\b(\\0"A t"qE@A\\b r6\\0 \\0 6\\0\\f\\v \\x07A AvkA\\0 AG\\x1Bt! \\0(\\0!@ "\\0(Axq \\x07F\\r Av! At! \\0 Aqj"("\\r\\0\\v 6\\v \\x006 6\\f 6\\b\\f\\v \\0(\\b" 6\\f \\0 6\\b A\\x006 \\x006\\f 6\\b\\v \\bA\\bj!\\0\\f\\v@ \\bE\\r\\0@ ("At"(¸\n F@ A¸\nj \\x006\\0 \\0\\rA\\b \\x07A~ wq"\\x076\\0\\f\\v@ \\b(F@ \\b \\x006\\f\\v \\b \\x006\\v \\0E\\r\\v \\0 \\b6 ("@ \\0 6 \\x006\\v ("E\\r\\0 \\0 6 \\x006\\v@ AM@ j"\\0Ar6 \\0 j"\\0 \\0(Ar6\\f\\v Ar6 j" Ar6 j 6\\0 AÿM@ AøqA°\\bj!\\0A\\b(\\0"A Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\f\\vA!\\0 Aÿÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtrA>s!\\0\\v \\x006 B\\x007 \\0AtA¸\nj!@@ \\x07A \\0t"qE@A\\b \\x07r6\\0 6\\0 6\\f\\v A \\0AvkA\\0 \\0AG\\x1Bt!\\0 (\\0!@ "(Axq F\\r \\0Av! \\0At!\\0 Aqj"\\x07("\\r\\0\\v \\x07 6 6\\v 6\\f 6\\b\\f\\v (\\b"\\0 6\\f 6\\b A\\x006 6\\f \\x006\\b\\v A\\bj!\\0\\f\\v@ E\\r\\0@ ("At"(¸\n F@ A¸\nj \\x006\\0 \\0\\rA\\b \\vA~ wq6\\0\\f\\v@ (F@ \\x006\\f\\v \\x006\\v \\0E\\r\\v \\0 6 ("@ \\0 6 \\x006\\v ("E\\r\\0 \\0 6 \\x006\\v@ AM@ j"\\0Ar6 \\0 j"\\0 \\0(Ar6\\f\\v Ar6 j" Ar6 j 6\\0 \\b@ \\bAxqA°\\bj!\\0A\\b(\\0!A \\bAvt"\\x07 qE@A\\b \\x07r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\vA\\b 6\\0A\\b 6\\0\\v A\\bj!\\0\\v \nAj$\\0 \\0\\v}\\vA\\0!\\0@ \\0 FE@ \\0A\\fl"Aj"j*\\0!\\f A\\bj"j*\\0!\\v \\bj j*\\0"\\r8\\0 \\b j \\v8\\0 \\b j \\f8\\0 \\0At"j j"#*\\x008\\0 \\0At"Ar"$At" j j" *\\x008\\0 Ar"%At"!j !j"!*\\x008\\0 Ar"&At""j "j""*\\x008\\0 \nj j"\'*\\x008\\0 \n j j"*\\x008\\0 \n j j*\\0"8\\0 \\x07 \\0Atj" \\v8\\b \\f8 \\r8\\0 j-\\0\\0 $j-\\0\\0A\\btr %j-\\0\\0Atr &j-\\0\\0Atr6\\f *\\0! \'*\\0! "*\\0"\\f \\f !*\\0"\\v \\v #*\\0" *\\0"\\r \\r"C\\0\\0\\0\\0^@ \\f "!\\f \\r !\\r ! \\v !\\v\\v \\r \\f" \\v "" " C\\0\\0? \\v \\v" \\f \\f"" " \\r \\v" \\f "" " C\\0\\0@ \\v \\f"\\x1B \\r ""\\f \\f"\\f "\\v \\v"\\v C\\0\\0? \\r \\r" "\\r \\r"\\r C\\0\\0@6 C\\0\\0? " " " " \\x1B " "C\\0\\0@ \\f \\f \\v \\v \\r \\rC\\0\\0@6 A\\x006 \\f \\v \\r C\\0\\0@ C\\0\\0@6 \\0Aj!\\0\\f\\v\\v\\v\\0\\v\\v \\0A\\b\\v`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:P}}function b(){function e(e,t){return I=e.exports,N(I),d(),I}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h!=null||(h=g()),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch(e){}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==`function`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._pack=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var P={a:k};function F(){f();function e(){var e;n.calledRun=!0,!o&&(p(),c==null||c(n),(e=n.onRuntimeInitialized)==null||e.call(n),m())}n.setStatus?(n.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>n.setStatus(``),1),e()},1)):e()}var I=b();return F(),t=u?n:new Promise((e,t)=>{c=e}),t}),Ff.apply(this,arguments)}let If=new Float32Array(1),Lf=new Uint32Array(If.buffer),Rf=typeof Float16Array<`u`,zf=Rf?new Float16Array(1):null,Bf=Rf?new Uint16Array(zf.buffer):new Uint16Array(1);function Vf(e){if(Rf&&zf)return Bf[0]=e,zf[0];let t=e>>15&1,n=e>>10&31,r=e&1023,i;if(n===0)if(r===0)i=t<<31;else{let e=r,n=-14;for(;!(e&1024);)e<<=1,n--;e&=1023;let a=n+127,o=e<<13;i=t<<31|a<<23|o}else if(n===31)i=r===0?t<<31|2139095040:t<<31|2143289344;else{let e=n-15+127,a=r<<13;i=t<<31|e<<23|a}return Lf[0]=i,If[0]}var Hf=class{constructor({fileBytes:e}){this.fileBytes=e,this.chunks=[],this.totalBytes=0;let t=new DecompressionStream(`gzip`),n=new Blob([e]).stream().pipeThrough(t);this.reader=n.getReader()}read(e){return t(this,void 0,void 0,function*(){for(;this.totalBytes<e;){let{value:e,done:t}=yield this.reader.read();if(t)break;this.chunks.push(e),this.totalBytes+=e.length}if(this.totalBytes<e)throw Error(`Unexpected EOF: needed ${e}, got ${this.totalBytes}`);let t=new Uint8Array(this.totalBytes),n=0;for(let e of this.chunks)t.set(e,n),n+=e.length;let r=t.subarray(0,e);return this.chunks=[t.subarray(e)],this.totalBytes-=e,r})}},Uf=class{constructor({fileBytes:e}){this.version=-1,this.numSplats=0,this.shDegree=0,this.fractionalBits=0,this.flags=0,this.flagAntiAlias=!1,this.reserved=0,this.headerParsed=!1,this.parsed=!1,this.fileBytes=e instanceof ArrayBuffer?new Uint8Array(e):e,this.reader=new Hf({fileBytes:this.fileBytes})}parseHeader(){return t(this,void 0,void 0,function*(){if(this.headerParsed)throw Error(`SPZ file header already parsed`);let e=new DataView((yield this.reader.read(16)).buffer);if(e.getUint32(0,!0)!==1347635022)throw Error(`Invalid SPZ file`);if(this.version=e.getUint32(4,!0),this.version<1||this.version>3)throw Error(`Unsupported SPZ version: ${this.version}`);this.numSplats=e.getUint32(8,!0),this.shDegree=e.getUint8(12),this.fractionalBits=e.getUint8(13),this.flags=e.getUint8(14),this.flagAntiAlias=(this.flags&1)!=0,this.reserved=e.getUint8(15),this.headerParsed=!0,this.parsed=!1})}parseSplats(e,n,r,i,a,o){return t(this,void 0,void 0,function*(){if(!this.headerParsed)throw Error(`SPZ file header must be parsed first`);if(this.parsed)throw Error(`SPZ file already parsed`);if(this.parsed=!0,this.version===1){let t=yield this.reader.read(this.numSplats*3*2),n=new Uint16Array(t.buffer);for(let t=0;t<this.numSplats;t++){let r=t*3;e==null||e(t,Vf(n[r]),Vf(n[r+1]),Vf(n[r+2]))}}else if(this.version===2||this.version===3){let t=1<<this.fractionalBits,n=yield this.reader.read(this.numSplats*3*3);for(let r=0;r<this.numSplats;r++){let i=r*9,a=((n[i+2]<<24|n[i+1]<<16|n[i]<<8)>>8)/t,o=((n[i+5]<<24|n[i+4]<<16|n[i+3]<<8)>>8)/t,s=((n[i+8]<<24|n[i+7]<<16|n[i+6]<<8)>>8)/t;e==null||e(r,a,o,s)}}{let e=yield this.reader.read(this.numSplats);for(let t=0;t<this.numSplats;t++)n==null||n(t,e[t]/255)}{let e=yield this.reader.read(this.numSplats*3),t=.28209479177387814/.15;for(let n=0;n<this.numSplats;n++){let i=n*3;r==null||r(n,(e[i]/255-.5)*t+.5,(e[i+1]/255-.5)*t+.5,(e[i+2]/255-.5)*t+.5)}}{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3;i==null||i(t,Math.exp(e[n]/16-10),Math.exp(e[n+1]/16-10),Math.exp(e[n+2]/16-10))}}if(this.version===3){let e=1/Math.sqrt(2),t=yield this.reader.read(this.numSplats*4);for(let n=0;n<this.numSplats;n++){let r=n*4,i=[0,0,0,0],o=[t[r],t[r+1],t[r+2],t[r+3]],s=o[0]+(o[1]<<8)+(o[2]<<16)+(o[3]<<24),c=s>>>30,l=s,u=0;for(let t=3;t>=0;--t)if(t!==c){let n=l&511,r=l>>>9&1;l>>>=10,i[t]=n/511*e,i[t]=r===0?i[t]:-i[t],u+=i[t]*i[t]}i[c]=Math.sqrt(Math.max(1-u,0)),a==null||a(n,i[0],i[1],i[2],i[3])}}else{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3,r=e[n]/127.5-1,i=e[n+1]/127.5-1,o=e[n+2]/127.5-1,s=Math.sqrt(Math.max(0,1-r*r-i*i-o*o));a==null||a(t,r,i,o,s)}}if(o&&this.shDegree>=1){let e={1:3,2:8,3:15}[this.shDegree]||0,t=yield this.reader.read(this.numSplats*e*3),n=new Float32Array(9),r=this.shDegree>=2?new Float32Array(15):void 0,i=this.shDegree>=3?new Float32Array(21):void 0,a=0;for(let e=0;e<this.numSplats;e++){for(let e=0;e<9;++e)n[e]=(t[a+e]-128)/128;if(a+=9,r){for(let e=0;e<15;++e)r[e]=(t[a+e]-128)/128;a+=15}if(i){for(let e=0;e<21;++e)i[e]=(t[a+e]-128)/128;a+=21}o==null||o(e,new Float32Array(n),r?new Float32Array(r):void 0,i?new Float32Array(i):void 0)}}})}};function Wf(e){return t(this,void 0,void 0,function*(){let t=new Uf({fileBytes:e});yield t.parseHeader();let n=t.numSplats,r=new Float32Array(n*3),i=new Uint8Array(n*4),a=new Float32Array(n*3),o=new Float32Array(n*4),s,c,l;return t.shDegree>=1&&(s=new Float32Array(n*9)),t.shDegree>=2&&(c=new Float32Array(n*15)),t.shDegree>=3&&(l=new Float32Array(n*21)),yield t.parseSplats((e,t,n,i)=>{r[e*3]=t,r[e*3+1]=n,r[e*3+2]=i},(e,t)=>{i[e*4+3]=Math.round(t*255)},(e,t,n,r)=>{i[e*4]=Math.round(Math.max(0,Math.min(1,t))*255),i[e*4+1]=Math.round(Math.max(0,Math.min(1,n))*255),i[e*4+2]=Math.round(Math.max(0,Math.min(1,r))*255)},(e,t,n,r)=>{a[e*3]=t,a[e*3+1]=n,a[e*3+2]=r},(e,t,n,r,i)=>{o[e*4]=i,o[e*4+1]=t,o[e*4+2]=n,o[e*4+3]=r},(e,t,n,r)=>{s&&t&&s.set(t,e*9),c&&n&&c.set(n,e*15),l&&r&&l.set(r,e*21)}),{numPoints:n,shDegree:t.shDegree,positions:r,colors:i,scales:a,rotations:o,sh1:s,sh2:c,sh3:l}})}let Gf,Kf=!1;function qf(){return t(this,void 0,void 0,function*(){if(!Gf){for(;Kf;)yield new Promise(e=>setTimeout(e,0));Gf||(Kf=!0,Gf=yield Pf(),Kf=!1)}})}let Jf=0,Yf=0,Xf=0,Zf=0,Qf=0,$f=0,ep=0,tp=0,np=0,rp=0;function ip(e){let t=Math.pow(2,Math.ceil(Math.log2(Math.max(1,e))));t<=Jf||(Jf>0&&(Gf._free(Yf),Gf._free(Xf),Gf._free(Zf),Gf._free(Qf),Gf._free($f),Gf._free(ep),Gf._free(tp),Gf._free(np),Gf._free(rp)),Jf=t,Yf=Gf._malloc(3*t*4),Xf=Gf._malloc(4*t*4),Zf=Gf._malloc(3*t*4),Qf=Gf._malloc(4*t),$f=Gf._malloc(t),ep=Gf._malloc(8*t*4),tp=Gf._malloc(3*t*4),np=Gf._malloc(4*t*4),rp=Gf._malloc(3*t*4))}function ap(e,t,n,r,i){ip(e);let a=new Uint8Array(e);Gf.HEAPF32.set(t,Yf/4),Gf.HEAPF32.set(n,Xf/4),Gf.HEAPF32.set(r,Zf/4),Gf.HEAPU8.set(i,Qf),Gf.HEAPU8.set(a,$f),Gf._pack(!1,e,Yf,Xf,Zf,Qf,$f,ep,tp,np,rp);let o=new Uint32Array(Gf.HEAPU32.buffer,ep,e*8);return new Uint32Array(o.slice().buffer)}typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope&&(self.onmessage=e=>t(void 0,void 0,void 0,function*(){var t;let{requestId:n,fileBytes:r}=e.data;if(!(r===void 0||n===void 0))try{let e=yield Wf(new Uint8Array(r));yield qf();let t=ap(e.numPoints,e.positions,e.rotations,e.scales,e.colors),i=Object.assign(Object.assign({},e),{packedData:t}),a=[t.buffer,e.positions.buffer,e.colors.buffer,e.scales.buffer,e.rotations.buffer];e.sh1&&a.push(e.sh1.buffer),e.sh2&&a.push(e.sh2.buffer),e.sh3&&a.push(e.sh3.buffer),self.postMessage({requestId:n,decoded:i},a)}catch(e){self.postMessage({requestId:n,error:(t=e==null?void 0:e.message)==null?String(e):t})}}))})();',is=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,rs],{type:`text/javascript;charset=utf-8`});function as(e){let t;try{if(t=is&&(self.URL||self.webkitURL).createObjectURL(is),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(rs),{name:e==null?void 0:e.name})}}var os=new Float32Array(1),ss=new Uint32Array(os.buffer),cs=typeof Float16Array<`u`,ls=cs?new Float16Array(1):null,us=cs?new Uint16Array(ls.buffer):new Uint16Array(1);function ds(e){if(cs&&ls)return us[0]=e,ls[0];let t=e>>15&1,n=e>>10&31,r=e&1023,i;if(n===0)if(r===0)i=t<<31;else{let e=r,n=-14;for(;!(e&1024);)e<<=1,n--;e&=1023;let a=n+127,o=e<<13;i=t<<31|a<<23|o}else if(n===31)i=r===0?t<<31|2139095040:t<<31|2143289344;else{let e=n-15+127,a=r<<13;i=t<<31|e<<23|a}return ss[0]=i,os[0]}var fs=class{constructor({fileBytes:e}){this.fileBytes=e,this.chunks=[],this.totalBytes=0;let t=new DecompressionStream(`gzip`),n=new Blob([e]).stream().pipeThrough(t);this.reader=n.getReader()}read(e){return Xo(this,void 0,void 0,function*(){for(;this.totalBytes<e;){let{value:e,done:t}=yield this.reader.read();if(t)break;this.chunks.push(e),this.totalBytes+=e.length}if(this.totalBytes<e)throw Error(`Unexpected EOF: needed ${e}, got ${this.totalBytes}`);let t=new Uint8Array(this.totalBytes),n=0;for(let e of this.chunks)t.set(e,n),n+=e.length;let r=t.subarray(0,e);return this.chunks=[t.subarray(e)],this.totalBytes-=e,r})}},ps=.28209479177387814,ms=class{constructor({fileBytes:e}){this.version=-1,this.numSplats=0,this.shDegree=0,this.fractionalBits=0,this.flags=0,this.flagAntiAlias=!1,this.reserved=0,this.headerParsed=!1,this.parsed=!1,this.fileBytes=e instanceof ArrayBuffer?new Uint8Array(e):e,this.reader=new fs({fileBytes:this.fileBytes})}parseHeader(){return Xo(this,void 0,void 0,function*(){if(this.headerParsed)throw Error(`SPZ file header already parsed`);let e=new DataView((yield this.reader.read(16)).buffer);if(e.getUint32(0,!0)!==1347635022)throw Error(`Invalid SPZ file`);if(this.version=e.getUint32(4,!0),this.version<1||this.version>3)throw Error(`Unsupported SPZ version: ${this.version}`);this.numSplats=e.getUint32(8,!0),this.shDegree=e.getUint8(12),this.fractionalBits=e.getUint8(13),this.flags=e.getUint8(14),this.flagAntiAlias=(this.flags&1)!=0,this.reserved=e.getUint8(15),this.headerParsed=!0,this.parsed=!1})}parseSplats(e,t,n,r,i,a){return Xo(this,void 0,void 0,function*(){if(!this.headerParsed)throw Error(`SPZ file header must be parsed first`);if(this.parsed)throw Error(`SPZ file already parsed`);if(this.parsed=!0,this.version===1){let t=yield this.reader.read(this.numSplats*3*2),n=new Uint16Array(t.buffer);for(let t=0;t<this.numSplats;t++){let r=t*3;e==null||e(t,ds(n[r]),ds(n[r+1]),ds(n[r+2]))}}else if(this.version===2||this.version===3){let t=1<<this.fractionalBits,n=yield this.reader.read(this.numSplats*3*3);for(let r=0;r<this.numSplats;r++){let i=r*9,a=((n[i+2]<<24|n[i+1]<<16|n[i]<<8)>>8)/t,o=((n[i+5]<<24|n[i+4]<<16|n[i+3]<<8)>>8)/t,s=((n[i+8]<<24|n[i+7]<<16|n[i+6]<<8)>>8)/t;e==null||e(r,a,o,s)}}{let e=yield this.reader.read(this.numSplats);for(let n=0;n<this.numSplats;n++)t==null||t(n,e[n]/255)}{let e=yield this.reader.read(this.numSplats*3),t=ps/.15;for(let r=0;r<this.numSplats;r++){let i=r*3;n==null||n(r,(e[i]/255-.5)*t+.5,(e[i+1]/255-.5)*t+.5,(e[i+2]/255-.5)*t+.5)}}{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3;r==null||r(t,Math.exp(e[n]/16-10),Math.exp(e[n+1]/16-10),Math.exp(e[n+2]/16-10))}}if(this.version===3){let e=1/Math.sqrt(2),t=yield this.reader.read(this.numSplats*4);for(let n=0;n<this.numSplats;n++){let r=n*4,a=[0,0,0,0],o=[t[r],t[r+1],t[r+2],t[r+3]],s=o[0]+(o[1]<<8)+(o[2]<<16)+(o[3]<<24),c=s>>>30,l=s,u=0;for(let t=3;t>=0;--t)if(t!==c){let n=l&511,r=l>>>9&1;l>>>=10,a[t]=n/511*e,a[t]=r===0?a[t]:-a[t],u+=a[t]*a[t]}a[c]=Math.sqrt(Math.max(1-u,0)),i==null||i(n,a[0],a[1],a[2],a[3])}}else{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3,r=e[n]/127.5-1,a=e[n+1]/127.5-1,o=e[n+2]/127.5-1,s=Math.sqrt(Math.max(0,1-r*r-a*a-o*o));i==null||i(t,r,a,o,s)}}if(a&&this.shDegree>=1){let e={1:3,2:8,3:15}[this.shDegree]||0,t=yield this.reader.read(this.numSplats*e*3),n=new Float32Array(9),r=this.shDegree>=2?new Float32Array(15):void 0,i=this.shDegree>=3?new Float32Array(21):void 0,o=0;for(let e=0;e<this.numSplats;e++){for(let e=0;e<9;++e)n[e]=(t[o+e]-128)/128;if(o+=9,r){for(let e=0;e<15;++e)r[e]=(t[o+e]-128)/128;o+=15}if(i){for(let e=0;e<21;++e)i[e]=(t[o+e]-128)/128;o+=21}a==null||a(e,new Float32Array(n),r?new Float32Array(r):void 0,i?new Float32Array(i):void 0)}}})}};function hs(e){return Xo(this,void 0,void 0,function*(){let t=new ms({fileBytes:e});yield t.parseHeader();let n=t.numSplats,r=new Float32Array(n*3),i=new Uint8Array(n*4),a=new Float32Array(n*3),o=new Float32Array(n*4),s,c,l;return t.shDegree>=1&&(s=new Float32Array(n*9)),t.shDegree>=2&&(c=new Float32Array(n*15)),t.shDegree>=3&&(l=new Float32Array(n*21)),yield t.parseSplats((e,t,n,i)=>{r[e*3]=t,r[e*3+1]=n,r[e*3+2]=i},(e,t)=>{i[e*4+3]=Math.round(t*255)},(e,t,n,r)=>{i[e*4]=Math.round(Math.max(0,Math.min(1,t))*255),i[e*4+1]=Math.round(Math.max(0,Math.min(1,n))*255),i[e*4+2]=Math.round(Math.max(0,Math.min(1,r))*255)},(e,t,n,r)=>{a[e*3]=t,a[e*3+1]=n,a[e*3+2]=r},(e,t,n,r,i)=>{o[e*4]=i,o[e*4+1]=t,o[e*4+2]=n,o[e*4+3]=r},(e,t,n,r)=>{s&&t&&s.set(t,e*9),c&&n&&c.set(n,e*15),l&&r&&l.set(r,e*21)}),{numPoints:n,shDegree:t.shDegree,positions:r,colors:i,scales:a,rotations:o,sh1:s,sh2:c,sh3:l}})}var J,gs=!1;function _s(){return Xo(this,void 0,void 0,function*(){if(!J){for(;gs;)yield new Promise(e=>setTimeout(e,0));J||(gs=!0,J=yield ts(),gs=!1)}})}var vs=0,ys=0,bs=0,xs=0,Ss=0,Cs=0,ws=0,Ts=0,Es=0,Ds=0;function Os(e){let t=Math.pow(2,Math.ceil(Math.log2(Math.max(1,e))));t<=vs||(vs>0&&(J._free(ys),J._free(bs),J._free(xs),J._free(Ss),J._free(Cs),J._free(ws),J._free(Ts),J._free(Es),J._free(Ds)),vs=t,ys=J._malloc(3*t*4),bs=J._malloc(4*t*4),xs=J._malloc(3*t*4),Ss=J._malloc(4*t),Cs=J._malloc(t),ws=J._malloc(8*t*4),Ts=J._malloc(3*t*4),Es=J._malloc(4*t*4),Ds=J._malloc(3*t*4))}function ks(e,t,n,r,i){Os(e);let a=new Uint8Array(e);J.HEAPF32.set(t,ys/4),J.HEAPF32.set(n,bs/4),J.HEAPF32.set(r,xs/4),J.HEAPU8.set(i,Ss),J.HEAPU8.set(a,Cs),J._pack(!1,e,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds);let o=new Uint32Array(J.HEAPU32.buffer,ws,e*8);return new Uint32Array(o.slice().buffer)}typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope&&(self.onmessage=e=>Xo(void 0,void 0,void 0,function*(){var t;let{requestId:n,fileBytes:r}=e.data;if(!(r===void 0||n===void 0))try{let e=yield hs(new Uint8Array(r));yield _s();let t=ks(e.numPoints,e.positions,e.rotations,e.scales,e.colors),i=Object.assign(Object.assign({},e),{packedData:t}),a=[t.buffer,e.positions.buffer,e.colors.buffer,e.scales.buffer,e.rotations.buffer];e.sh1&&a.push(e.sh1.buffer),e.sh2&&a.push(e.sh2.buffer),e.sh3&&a.push(e.sh3.buffer),self.postMessage({requestId:n,decoded:i},a)}catch(e){self.postMessage({requestId:n,error:(t=e==null?void 0:e.message)==null?String(e):t})}}));var As=null,js=1,Ms=new Map;function Ns(){return As||(As=new as,As.onmessage=e=>{var t;let{requestId:n,decoded:r,error:i}=(t=e.data)==null?{}:t,a=Ms.get(n);a&&(Ms.delete(n),i?a.reject(Error(i)):a.resolve(r))}),As}function Ps(e){let t=Ns(),n=js++,r=e.slice().buffer;return new Promise((e,i)=>{Ms.set(n,{resolve:e,reject:i}),t.postMessage({requestId:n,fileBytes:r},[r])})}function Fs(e){return Xo(this,void 0,void 0,function*(){let t=yield Ps(e instanceof ArrayBuffer?new Uint8Array(e):e),{PBMGaussianSplattingObject:n}=yield Promise.resolve().then(()=>require(`../pbmGaussianSplattingObject-C6i7CUTu.cjs`)).then(e=>e.n);return new n({numPoints:t.numPoints,packedData:t.packedData,sh1:t.sh1,sh2:t.sh2,sh3:t.sh3,shDegree:t.shDegree})})}function Is(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?ur:i,l=(a=t.onDownloadProgress)==null?G:a,u=0;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(u=e.body.byteLength,e.body)).then(e=>Fs(new Uint8Array(e))).then(t=>(o===`Z`&&(t.applyMatrix4(Jn),t.updateMatrix(),t.updateMatrixWorld(!0),t.transformChanged=!0),{type:`spz`,modelUpAxis:o,upAxis:s,uri:e,byteLength:u,memoryUsage:Di(t),scene:t,textures:[],animations:[],dispose:()=>t.dispose()}))}var Ls=new t.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),Rs=new t.Matrix4().getInverse(Ls),zs=class extends no{load(e,t){return Xo(this,void 0,void 0,function*(){let{bufferView:n}=e;return t.loadBufferView(n).then(e=>this.loadSpz(new Uint8Array(e)))})}loadSpz(e){return Xo(this,void 0,void 0,function*(){return Promise.resolve().then(()=>Fs(e)).then(e=>(e.applyMatrix4(Rs),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}},Bs=new t.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),Vs=new t.Matrix4().getInverse(Bs),Hs={KHR_binary_glTF:io,KHR_draco_mesh_compression:fo,KHR_texture_basisu:Co,KHR_texture_transform:To,KHR_mesh_quantization:Eo,KHR_materials_unlit:Oo,KHR_node_visibility:Ao,KHR_animation_pointer:jo,KHR_materials_clearcoat:No,KHR_materials_sheen:Fo,KHR_materials_transmission:Lo,KHR_materials_emissive_strength:zo,EXT_meshopt_compression:Ho,EXT_texture_webp:Wo,CESIUM_RTC:Ko,REALSEE_materials_lightmap:Jo,KHR_gaussian_splatting:Qo,KHR_gaussian_splatting_compression_spz:zs,KHR_gaussian_splatting_compression_spz_2:class extends no{constructor(){super()}load(e,t){return Xo(this,void 0,void 0,function*(){let{bufferView:n}=e;return t.loadBufferView(n).then(e=>this.loadSpz(new Uint8Array(e)))})}loadSpz(e){return Xo(this,void 0,void 0,function*(){return Promise.resolve().then(()=>Fs(e)).then(e=>(e.applyMatrix4(Vs),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}}};function Us(e,t){var n,r,i;let a={},o,s;if(typeof e==`string`)s=e;else if(Hs.KHR_binary_glTF.getMagic(e)===Hs.KHR_binary_glTF.HEADER_MAGIC){o=new Hs.KHR_binary_glTF;try{o.loadGlbBinary(e)}catch(e){return Promise.reject(e)}a.KHR_binary_glTF=o,s=o.content}else s=za(new Uint8Array(e));let c=JSON.parse(s);if(t.jsonModify&&(c=t.jsonModify(c)),c.asset===void 0||Number(c.asset.version[0])<2)return Promise.reject(Error(`glTF: Unsupported asset. glTF versions >=2.0 are supported.`));if(c.extensionsUsed){let e=c.extensionsRequired||[];for(var l=0;l<c.extensionsUsed.length;l++){let t=c.extensionsUsed[l];a[t]||(Hs[t]?a[t]=new Hs[t]:e.indexOf(t)>=0&&console.warn(`glTF: Unknown extension "`+t+`".`))}}return new Za(c,a,{copyUV2:(n=t.copyUV2)==null?!1:n,resourcePath:(r=t.resourcePath)==null?``:r,search:(i=t.search)==null?``:i,fetcher:t.fetcher}).parse().then(e=>(o&&o.clear(),e))}function Ws(e,n={}){var r,i,a,o;let s=(r=n.modelUpAxis)==null?`Y`:r,c=(i=n.upAxis)==null?`Z`:i,l=(a=n.fetcher)==null?ur:a,u=(o=n.onDownloadProgress)==null?G:o,d={uri:e,gltfUpAxis:s};return Promise.resolve().then(()=>l.ajax(e,{responseType:`arraybuffer`},void 0,void 0,u).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>xa(d,e,t)).then(t=>Na(d,e,t)).then(t=>Ra(d,e,t))).then(()=>{var r;return Us(d.gltfArrayBuffer,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,jsonModify(e){var t,r;if(n.light===!1){let n=`KHR_materials_unlit`;if(e.extensionsUsed=(t=e.extensionsUsed)==null?[]:t,e.extensionsUsed.indexOf(n)===-1&&e.extensionsUsed.push(n),e.materials)for(let t of e.materials)t.extensions=(r=t.extensions)==null?{}:r,t.extensions[n]={}}return e},fetcher:l}).then(e=>{let n=new t.Matrix4;s===`Y`&&n.premultiply(qn);let r;if(d.rtcCenter?r=new t.Vector3().fromArray(d.rtcCenter):e.CESIUM_RTC&&(r=new t.Vector3().copy(e.CESIUM_RTC.center)),r){let e=new t.Matrix4().setPosition(r);n.premultiply(e)}return c===`Y`&&n.premultiply(Jn),e.scene.applyMatrix4(n),d.featureTableBinary=void 0,d.batchTableBinary=void 0,d.gltfArrayBuffer=void 0,{type:`b3dm`,modelUpAxis:s,upAxis:`Z`,uri:d.uri,byteLength:d.byteLength,memoryUsage:Di(e.scene),scene:e.scene,textures:e.textures,animations:[],rtcCenter:r,dispose:()=>e.dispose()}})})}var Gs="(function(){function e(e){onmessage=t=>{Promise.resolve(t.data).then(t=>e(t)).then(({output:e,transfer:t})=>postMessage(e,t)).catch(e=>postMessage({$$error:e}))}}var t;(function(e){e[e.BYTE=5120]=`BYTE`,e[e.UNSIGNED_BYTE=5121]=`UNSIGNED_BYTE`,e[e.SHORT=5122]=`SHORT`,e[e.UNSIGNED_SHORT=5123]=`UNSIGNED_SHORT`,e[e.INT=5124]=`INT`,e[e.UNSIGNED_INT=5125]=`UNSIGNED_INT`,e[e.FLOAT=5126]=`FLOAT`,e[e.DOUBLE=5130]=`DOUBLE`})(t||(t={}));let n={[t.DOUBLE]:Float64Array,[t.FLOAT]:Float32Array,[t.UNSIGNED_SHORT]:Uint16Array,[t.UNSIGNED_INT]:Uint32Array,[t.UNSIGNED_BYTE]:Uint8Array,[t.BYTE]:Int8Array,[t.SHORT]:Int16Array,[t.INT]:Int32Array},r={DOUBLE:t.DOUBLE,FLOAT:t.FLOAT,UNSIGNED_SHORT:t.UNSIGNED_SHORT,UNSIGNED_INT:t.UNSIGNED_INT,UNSIGNED_BYTE:t.UNSIGNED_BYTE,BYTE:t.BYTE,SHORT:t.SHORT,INT:t.INT};function i(e){let t=n[e];if(!t)throw Error(`Failed to convert GL type`);return t}function a(e){return i(e).BYTES_PER_ELEMENT}function o(e,t,n=0,r){let o=i(e);return n%a(e)===0?new o(t,n,r==null?(t.byteLength-n)/a(e):r):new o(r?t.slice(n,n+r*a(e)):t.slice(n))}function s(e){let t=r[e];if(!t)throw Error(`Failed to convert GL type`);return t}var c=class{constructor(e,n){this.featuresLength=0,this.cachedTypedArrays={},this.json=e,this.buffer=n;let r=this.getGlobalProperty(`POINTS_LENGTH`,t.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return!!this.json[e]}getGlobalProperty(e,t,n){let r=this.json[e];return typeof r==`number`?new(i(t))([r]):Array.isArray(r)?new(i(t))(r):r&&Number.isFinite(r.byteOffset)?this.getTypedArrayFromBinary(e,t,n,1,r.byteOffset):null}getPropertyArray(e,t,n){let r=this.json[e];return r&&Number.isFinite(r.byteOffset)?(`componentType`in r&&(t=s(r.componentType)),this.getTypedArrayFromBinary(e,t,n,this.featuresLength,r.byteOffset)):this.getTypedArrayFromArray(e,t,r)}getProperty(e,t,n,r,i){if(!this.json[e])return null;let a=this.getPropertyArray(e,t,n);if(n===1)return i[0]=a[r],i;for(let e=0;e<n;++e)i[e]=a[n*r+e];return i}getTypedArrayFromBinary(e,t,n,r,i){let a=this.cachedTypedArrays,s=a[e];return s||(s=o(t,this.buffer.buffer,this.buffer.byteOffset+i,r*n),a[e]=s),s}getTypedArrayFromArray(e,t,n){let r=this.cachedTypedArrays,i=r[e];return i||(i=o(t,n),r[e]=i),i}};e(e=>Promise.resolve(e).then(e=>{let t=new c(e.featureTableJson,e.featureTableBinary),n=u(t),r=d(t),i=p(t),a=[];return n&&a.push(n.array.buffer),r&&a.push(r.array.buffer),i&&a.push(i.array.buffer),{output:{position:n,color:r,normal:i},transfer:a}}));let l=65535;function u(e){if(e.hasProperty(`POSITION`))return{array:e.getPropertyArray(`POSITION`,t.FLOAT,3),itemSize:3,normalized:!1};if(e.hasProperty(`POSITION_QUANTIZED`)){let n=e.getPropertyArray(`POSITION_QUANTIZED`,t.UNSIGNED_SHORT,3),r=e.getGlobalProperty(`QUANTIZED_VOLUME_SCALE`,t.FLOAT,3),i=e.getGlobalProperty(`QUANTIZED_VOLUME_OFFSET`,t.FLOAT,3);if(!r||!i)throw Error(`QUANTIZED_VOLUME_SCALE or QUANTIZED_VOLUME_OFFSET never found.`);let a=new Float32Array(n.length),o=n.length/3,s=r[0]/l,c=r[1]/l,u=r[2]/l,d=i[0],f=i[1],p=i[2];for(let e=0,t;e<o;e++)t=e*3,a[t]=n[t]*s+d,a[++t]=n[t]*c+f,a[++t]=n[t]*u+p;return{array:a,itemSize:3,normalized:!1}}return null}function d(e){if(e.hasProperty(`RGB`)){let n=e.getPropertyArray(`RGB`,t.UNSIGNED_BYTE,3),r=n.length/3,i=new Uint8Array(r*4);for(let e=0,t,a;e<r;e++)a=e*4,t=e*3,i[a]=n[t],i[++a]=n[++t],i[++a]=n[++t];return{array:i,itemSize:4,normalized:!0}}else if(e.hasProperty(`RGBA`))return{array:e.getPropertyArray(`RGBA`,t.UNSIGNED_BYTE,4),itemSize:4,normalized:!0};else if(e.hasProperty(`RGB565`)){let n=e.getPropertyArray(`RGB565`,t.UNSIGNED_SHORT,1),r=n.length,i=new Uint8Array(r*4);for(let e=0,t,a;e<r;e++)a=n[e],t=e*4,i[t]=(a>>11&31)<<3,i[++t]=(a>>5&63)<<2,i[++t]=(a&31)<<3;return{array:i,itemSize:4,normalized:!0}}return null}let f=2/255;function p(e){if(e.hasProperty(`NORMAL`)){let n=e.getPropertyArray(`NORMAL`,t.FLOAT,3),r=n.length/3,i=new Int8Array(r*4);for(let e=0,t,a;e<r;e++)a=e*4,t=e*3,i[a]=n[t]*127,i[++a]=n[++t]*127,i[++a]=n[++t]*127;return{array:i,itemSize:4,normalized:!0}}else if(e.hasProperty(`NORMAL_OCT16P`)){let n=e.getPropertyArray(`NORMAL_OCT16P`,t.UNSIGNED_BYTE,2),r=n.length/2,i=new Int8Array(r*4);for(let e=0,t,a,o,s,c,l,u;e<r;e++)t=e*2,a=n[t]*f-1,o=n[++t]*f-1,c=a<0?-a:a,l=o<0?-o:o,s=1-(c+l),s<0&&(a=(1-l)*(a<0?-1:1),o=(1-c)*(o<0?-1:1)),u=Math.sqrt(a*a+o*o+s*s),t=e*4,i[t]=a/u*127,i[++t]=o/u*127,i[++t]=s/u*127;return{array:i,itemSize:4,normalized:!0}}return null}})();",Ks=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,Gs],{type:`text/javascript;charset=utf-8`});function qs(e){let t;try{if(t=Ks&&(self.URL||self.webkitURL).createObjectURL(Ks),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(Gs),{name:e==null?void 0:e.name})}}var Js=new po(()=>new qs,2);function Ys(e,t,n){let r=new ka(e.featureTableJson,e.featureTableBinary);return Promise.resolve().then(()=>{let e=r.getExtension(`3DTILES_draco_point_compression`);return e?Xs(e,r):Js.postMessage({featureTableBinary:r.buffer,featureTableJson:r.json},[r.buffer.buffer])}).then(t=>(e.attributes=t,n))}function Xs(e,n){return Xo(this,void 0,void 0,function*(){let r=e.properties||{},i=e.byteOffset,a=e.byteLength;if(!r||!Number.isFinite(i)||!a)throw Error(`Draco properties, byteOffset, and byteLength must be defined`);let o=n.buffer.slice(i,i+a),s=e.properties;return co.decodeGeometry(o.buffer,{attributeIDs:s,attributeTypes:{POSITION:`Float32Array`,NORMAL:`Float32Array`,RGB:`Uint8Array`,RGBA:`Uint8Array`},useUniqueIDs:!0}).then(e=>{let n=e.getAttribute(`POSITION`),r=e.getAttribute(`RGB`),i=e.getAttribute(`RGBA`),a=e.getAttribute(`NORMAL`),o;if(i)o=i;else if(r){let e=r.count,n=r.array,i=new Uint8Array(e*4);for(let t=0,r,a;t<e;t++)a=t*4,r=t*3,i[a]=n[r],i[++a]=n[++r],i[++a]=n[++r];o=new t.BufferAttribute(i,4,r.normalized)}return{position:n?{array:n.array,itemSize:n.itemSize,normalized:n.normalized}:null,color:o?{array:o.array,itemSize:o.itemSize,normalized:o.normalized}:null,normal:a?{array:a.array,itemSize:a.itemSize,normalized:a.normalized}:null}})})}function Zs(e,n={}){var r,i,a;let o=(r=n.upAxis)==null?`Z`:r,s=(i=n.fetcher)==null?ur:i,c=(a=n.onDownloadProgress)==null?G:a,l={uri:e};return Promise.resolve().then(()=>s.ajax(e,{responseType:`arraybuffer`},void 0,void 0,c).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>xa(l,e,t)).then(t=>Na(l,e,t)).then(t=>Ys(l,e,t))).then(()=>{var e;return Qs(l.attributes,{computeBoundingBox:(e=n.computeBoundingBox)==null?!0:e})}).then(e=>{let n=new t.Matrix4,r;if(l.rtcCenter&&(r=new t.Vector3().fromArray(l.rtcCenter)),r){let e=new t.Matrix4().setPosition(r);n.premultiply(e)}return o===`Y`&&n.premultiply(Jn),e.object.applyMatrix4(n),l.gltfArrayBuffer=void 0,l.featureTableBinary=void 0,l.batchTableBinary=void 0,{type:`pnts`,modelUpAxis:`Z`,upAxis:o,uri:l.uri,byteLength:l.byteLength,memoryUsage:Di(e.object),scene:e.object,textures:[],animations:[],rtcCenter:r,dispose:()=>e.dispose()}})}function Qs(e,n){let r=new Set,i=new t.BufferGeometry;r.add(i);let a=new Cn;r.add(a),e.position&&i.setAttribute(`position`,new t.BufferAttribute(e.position.array,e.position.itemSize,e.position.normalized)),e.color&&i.setAttribute(`color`,new t.BufferAttribute(e.color.array,e.color.itemSize,e.color.normalized)),e.normal?i.setAttribute(`normal`,new t.BufferAttribute(e.normal.array,e.normal.itemSize,e.normal.normalized)):a.flatShading=!0,n.computeBoundingBox&&i.computeBoundingBox();let o=new wn(i,a);return o.matrix.compose(o.position,o.quaternion,o.scale),o.matrixAutoUpdate=!1,o.frustumCulled=!1,Promise.resolve({object:o,dispose:()=>{r.forEach(e=>{e.dispose()}),r.clear()}})}function $s(e,n={}){var r,i,a,o,s;let c=(r=n.modelUpAxis)==null?`Y`:r,l=(i=n.upAxis)==null?`Z`:i,u=(a=n.fetcher)==null?ur:a,d=(o=n.onDownloadProgress)==null?G:o,f=(s=n.jsonModify)==null?G:s,p=0;return Promise.resolve().then(()=>u.ajax(e,{responseType:`arraybuffer`},void 0,void 0,d).then(e=>(p=e.body.byteLength,e.body))).then(t=>{var r;return Us(t,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,jsonModify(e){var t,r,i;if(n.light===!1){let n=`KHR_materials_unlit`;if(e.extensionsUsed=(t=e.extensionsUsed)==null?[]:t,e.extensionsUsed.indexOf(n)===-1&&e.extensionsUsed.push(n),e.materials)for(let t of e.materials)t.extensions=(r=t.extensions)==null?{}:r,t.extensions[n]={}}return(i=f(e))==null?e:i},fetcher:u})}).then(n=>{var r;let i=new t.Matrix4;if(c===`Y`&&i.premultiply(qn),n.CESIUM_RTC){let e=new t.Matrix4().setPosition(n.CESIUM_RTC.center);i.premultiply(e)}return l===`Y`&&i.premultiply(Jn),n.scene.applyMatrix4(i),{type:`gltf`,modelUpAxis:c,upAxis:l,uri:e,byteLength:p,memoryUsage:Di(n.scene),scene:n.scene,textures:n.textures,animations:n.animations,rtcCenter:(r=n.CESIUM_RTC)==null?void 0:r.center,dispose:()=>n.dispose()}})}var ec=new t.Color;function tc(e,n={}){var r,i,a,o;let s=(r=n.modelUpAxis)==null?`Z`:r,c=(i=n.upAxis)==null?`Z`:i,l=(a=n.fetcher)==null?ur:a,u=(o=n.onDownloadProgress)==null?G:o,d=0;return Promise.resolve().then(()=>l.ajax(e,{responseType:`arraybuffer`},void 0,void 0,u).then(e=>(d=e.body.byteLength,e.body))).then(e=>{var t,r;return nc(e,{propertyNameMapping:(t=n.propertyNameMapping)==null?{}:t,customPropertyMapping:(r=n.customPropertyMapping)==null?{}:r})}).then(({geometry:r})=>{switch(n.type){case`geometry`:{let t=r;return s===`Y`&&t.applyMatrix4(qn),c===`Y`&&t.applyMatrix4(Jn),{type:`ply`,modelUpAxis:s,upAxis:c,uri:e,byteLength:d,memoryUsage:vi(t),scene:t,textures:[],animations:[],dispose:()=>{r.dispose()}}}case`line`:{let n=`color`in r.attributes,i=new t.LineBasicMaterial({vertexColors:n}),a=new t.Line(r,i);return a.computeLineDistances(),s===`Y`&&a.applyMatrix4(qn),c===`Y`&&a.applyMatrix4(Jn),{type:`ply`,modelUpAxis:s,upAxis:c,uri:e,byteLength:d,memoryUsage:Di(a),scene:a,textures:[],animations:[],dispose:()=>{r.dispose(),i.dispose()}}}case`pbmMesh`:{let i=new pn(n.light?`phong`:`basic`);i.vertexColors=`color`in r.attributes;let a=new t.Mesh(r,i);return s===`Y`&&a.applyMatrix4(qn),c===`Y`&&a.applyMatrix4(Jn),{type:`ply`,modelUpAxis:s,upAxis:c,uri:e,byteLength:d,memoryUsage:Di(a),scene:a,textures:[],animations:[],dispose:()=>{r.dispose(),i.dispose()}}}case`pbmPointCloud`:{let t=new Cn,n=new wn(r,t);return s===`Y`&&n.applyMatrix4(qn),c===`Y`&&n.applyMatrix4(Jn),{type:`ply`,modelUpAxis:s,upAxis:c,uri:e,byteLength:d,memoryUsage:Di(n),scene:n,textures:[],animations:[],dispose:()=>{r.dispose(),t.dispose()}}}default:break}throw Error(`Invalid Type: ${n.type}`)})}function nc(e,t){let n=new Uint8Array(e),{headerText:r,headerLength:i}=hc(n),a=ic(r,i,t);return a.format===`ascii`?{header:a,geometry:lc(new TextDecoder().decode(n),a,t)}:{header:a,geometry:mc(e,a,t)}}function rc(e,t){let n={name:``,type:e[0]};return n.type===`list`?(n.name=e[3],n.countType=e[1],n.itemType=e[2]):n.name=e[1],n.name in t.propertyNameMapping&&(n.name=t.propertyNameMapping[n.name]),n}function ic(e,t=0,n){let r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/,i=``,a=r.exec(e);a!==null&&(i=a[1]);let o={format:``,version:``,comments:[],elements:[],headerLength:t,objInfo:``},s=i.split(/\r\n|\r|\n/),c=null;for(let e=0;e<s.length;e++){let t=s[e];if(t=t.trim(),t===``)continue;let r=t.split(/\s+/),i=r.shift();switch(t=r.join(` `),i){case`format`:o.format=r[0],o.version=r[1];break;case`comment`:o.comments.push(t);break;case`element`:c&&o.elements.push(c),c={name:r[0],count:parseInt(r[1]),properties:[]};break;case`property`:c&&c.properties.push(rc(r,n));break;case`obj_info`:o.objInfo=t;break;default:console.log(`unhandled`,i,r)}}return c&&o.elements.push(c),o}function ac(e,t){switch(t){case`char`:case`uchar`:case`short`:case`ushort`:case`int`:case`uint`:case`int8`:case`uint8`:case`int16`:case`uint16`:case`int32`:case`uint32`:return parseInt(e);case`float`:case`double`:case`float32`:case`float64`:return parseFloat(e);default:throw Error(`unspport type: `+t)}}function oc(e,t){let n={};for(let r=0;r<e.length;r++){if(t.empty())return null;if(e[r].type===`list`){let i=[],a=ac(t.next(),e[r].countType);for(let n=0;n<a;n++){if(t.empty())return null;i.push(ac(t.next(),e[r].itemType))}n[e[r].name]=i}else n[e[r].name]=ac(t.next(),e[r].type)}return n}function sc(e){let t={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]};for(let n of Object.keys(e.customPropertyMapping))t[n]=[];return t}function cc(e){let t=e.map(e=>e.name);function n(e){for(let n=0,r=e.length;n<r;n++){let r=e[n];if(t.includes(r))return r}return null}return{attrX:n([`x`,`px`,`posx`])||`x`,attrY:n([`y`,`py`,`posy`])||`y`,attrZ:n([`z`,`pz`,`posz`])||`z`,attrNX:n([`nx`,`normalx`]),attrNY:n([`ny`,`normaly`]),attrNZ:n([`nz`,`normalz`]),attrS:n([`s`,`u`,`texture_u`,`tx`]),attrT:n([`t`,`v`,`texture_v`,`ty`]),attrR:n([`red`,`diffuse_red`,`r`,`diffuse_r`]),attrG:n([`green`,`diffuse_green`,`g`,`diffuse_g`]),attrB:n([`blue`,`diffuse_blue`,`b`,`diffuse_b`])}}function lc(e,t,n){let r=sc(n),i=/end_header\s+(\S[\s\S]*\S|\S)\s*$/,a,o=null;a=(o=i.exec(e))===null?[]:o[1].split(/\s+/);let s=new gc(a);loop:for(let e=0;e<t.elements.length;e++){let i=t.elements[e],a=cc(i.properties);for(let e=0;e<i.count;e++){let e=oc(i.properties,s);if(!e)break loop;dc(r,i.name,e,a,n)}}return uc(r,n)}function uc(e,n){let r=new t.BufferGeometry;e.indices.length>0&&r.setIndex(e.indices),r.setAttribute(`position`,new t.Float32BufferAttribute(e.vertices,3)),e.normals.length>0&&r.setAttribute(`normal`,new t.Float32BufferAttribute(e.normals,3)),e.uvs.length>0&&r.setAttribute(`uv`,new t.Float32BufferAttribute(e.uvs,2)),e.colors.length>0&&r.setAttribute(`color`,new t.Float32BufferAttribute(e.colors,3)),(e.faceVertexUvs.length>0||e.faceVertexColors.length>0)&&(r=r.toNonIndexed(),e.faceVertexUvs.length>0&&r.setAttribute(`uv`,new t.Float32BufferAttribute(e.faceVertexUvs,2)),e.faceVertexColors.length>0&&r.setAttribute(`color`,new t.Float32BufferAttribute(e.faceVertexColors,3)));for(let i of Object.keys(n.customPropertyMapping))if(e[i].length>0){let{itemType:a,itemNames:o,normalized:s}=n.customPropertyMapping[i],c=o.length,l;switch(a){case`float32`:l=new t.Float32BufferAttribute(e[i],c,s);break;case`uint32`:l=new t.Uint32BufferAttribute(e[i],c,s);break;case`int32`:l=new t.Int32BufferAttribute(e[i],c,s);break;case`uint16`:l=new t.Uint16BufferAttribute(e[i],c,s);break;case`int16`:l=new t.Int16BufferAttribute(e[i],c,s);break;case`uint8`:l=new t.Uint8BufferAttribute(e[i],c,s);break;case`int8`:l=new t.Int8BufferAttribute(e[i],c,s);break;default:l=new t.Float32BufferAttribute(e[i],c,s);break}r.setAttribute(i,l)}return r.computeBoundingSphere(),r}function dc(e,t,n,r,i){if(t===`vertex`){r.attrX!==null&&r.attrY!==null&&r.attrZ!==null&&e.vertices.push(n[r.attrX],n[r.attrY],n[r.attrZ]),r.attrNX!==null&&r.attrNY!==null&&r.attrNZ!==null&&e.normals.push(n[r.attrNX],n[r.attrNY],n[r.attrNZ]),r.attrS!==null&&r.attrT!==null&&e.uvs.push(n[r.attrS],n[r.attrT]),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(ec.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.colors.push(ec.r,ec.g,ec.b));for(let t of Object.keys(i.customPropertyMapping))for(let r of i.customPropertyMapping[t].itemNames)e[t].push(n[r])}else if(t===`face`){let t=n.vertex_indices||n.vertex_index,i=n.texcoord;t.length===3?(e.indices.push(t[0],t[1],t[2]),i&&i.length===6&&(e.faceVertexUvs.push(i[0],i[1]),e.faceVertexUvs.push(i[2],i[3]),e.faceVertexUvs.push(i[4],i[5]))):t.length===4&&(e.indices.push(t[0],t[1],t[3]),e.indices.push(t[1],t[2],t[3])),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(ec.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.faceVertexColors.push(ec.r,ec.g,ec.b),e.faceVertexColors.push(ec.r,ec.g,ec.b),e.faceVertexColors.push(ec.r,ec.g,ec.b))}}function fc(e,t){let n={},r=0;for(let i=0;i<t.length;i++){let a=t[i],o=a.valueReader;if(a.type===`list`){let t=[],i=a.countReader.read(e+r);r+=a.countReader.size;for(let n=0;n<i;n++)t.push(o.read(e+r)),r+=o.size;n[a.name]=t}else n[a.name]=o.read(e+r),r+=o.size}return[n,r]}function pc(e,t,n){function r(e,t,n){switch(t){case`int8`:case`char`:return{read:t=>e.getInt8(t),size:1};case`uint8`:case`uchar`:return{read:t=>e.getUint8(t),size:1};case`int16`:case`short`:return{read:t=>e.getInt16(t,n),size:2};case`uint16`:case`ushort`:return{read:t=>e.getUint16(t,n),size:2};case`int32`:case`int`:return{read:t=>e.getInt32(t,n),size:4};case`uint32`:case`uint`:return{read:t=>e.getUint32(t,n),size:4};case`float32`:case`float`:return{read:t=>e.getFloat32(t,n),size:4};case`float64`:case`double`:return{read:t=>e.getFloat64(t,n),size:8};default:throw Error(`not support type: `+t)}}for(let i=0,a=e.length;i<a;i++){let a=e[i];a.type===`list`?(a.countReader=r(t,a.countType,n),a.valueReader=r(t,a.itemType,n)):a.valueReader=r(t,a.type,n)}}function mc(e,t,n){let r=sc(n),i=t.format===`binary_little_endian`,a=new DataView(e,t.headerLength),o,s=0;for(let e=0;e<t.elements.length;e++){let c=t.elements[e],l=c.properties,u=cc(l);pc(l,a,i);for(let e=0;e<c.count;e++){o=fc(s,l),s+=o[1];let e=o[0];dc(r,c.name,e,u,n)}}return uc(r,n)}function hc(e){let t=0,n=!0,r=``,i=[],a=new TextDecoder().decode(e.subarray(0,5)),o=/^ply\r\n/.test(a);do{let a=String.fromCharCode(e[t++]);a!==`
|
|
861
|
+
j j*\0"8\0 \x07 \0Atj" \v8\b \f8 \r8\0 j-\0\0 $j-\0\0A\btr %j-\0\0Atr &j-\0\0Atr6\f *\0! '*\0! "*\0"\f \f !*\0"\v \v #*\0" *\0"\r \r"C\0\0\0\0^@ \f "!\f \r !\r ! \v !\v\v \r \f" \v "" " C\0\0? \v \v" \f \f"" " \r \v" \f "" " C\0\0@ \v \f"\x1B \r ""\f \f"\f "\v \v"\v C\0\0? \r \r" "\r \r"\r C\0\0@6 C\0\0? " " " " \x1B " "C\0\0@ \f \f \v \v \r \rC\0\0@6 A\x006 \f \v \r C\0\0@ C\0\0@6 \0Aj!\0\f\v\v\v\0\v\v \0A\b\v`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:ee}}function b(){function e(e,t){return ne=e.exports,N(ne),d(),ne}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h!=null||(h=g()),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch(e){}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==`function`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._pack=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var ee={a:k};function te(){f();function e(){var e;n.calledRun=!0,!o&&(p(),c==null||c(n),(e=n.onRuntimeInitialized)==null||e.call(n),m())}n.setStatus?(n.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>n.setStatus(``),1),e()},1)):e()}var ne=b();return te(),t=u?n:new Promise((e,t)=>{c=e}),t}),ns.apply(this,arguments)}var rs='(function(){var e=(e,t)=>()=>(e&&(t=e(e=0)),t);function t(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function n(...e){}function r(e){return typeof Symbol>`u`?`$Symbol<${e}>$`:Symbol(e)}r(`$$FIVE_EVENT$$`);let i=Date.now();typeof performance<`u`&&(typeof performance.timeOrigin==`number`?i=performance.timeOrigin:performance.timing!==void 0&&(i=performance.timing.navigationStart));let a=typeof performance<`u`?(()=>i+performance.now()):(()=>Date.now()),o=[/\\.([0-9a-z]+)\\.jsonp([\\?\\#].*)?$/i,/jsonp_([0-9a-z]+)([\\?\\#].*)?$/i],s=typeof location<`u`?location.href:``,c=/^https\\:/.test(s);var l=class extends Error{constructor(e,t,n){super(`[NETWORK]: request proxy error(type: ${t}, reason: ${n}): ${e}`)}},u=class extends Error{constructor(e,t,n){super(`[NETWORK]: response error(type: ${t}, status: ${n}): ${e}`),this.httpStatus=n}},d=class extends Error{constructor(e,t,n){super(`[NETWORK]: request timeout(type: ${t}, timeout: ${n}ms): ${e}`)}};function f(e){if(!e)return{};let t={},n=e.trim().split(`\n`);for(let e=0;e<n.length;e++){let r=n[e],i=r.indexOf(`:`),a=r.slice(0,i).trim().toLowerCase(),o=r.slice(i+1).trim();o&&(t[a]?t[a]+=`, `+o:t[a]=o)}return t}function p(e){for(let t of o){let n=e.match(t);if(n)return`jsonp_`+n[1]}return null}function m(e){return p(e)!==null}function h(e,t={},r=n,i=n,o=n){let m=a(),h=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>c&&/^http\\:/.test(e)?(console.warn(`The page at \'${s}\' was loaded over HTTPS, but requested an insecure element \'${e}\'. This request was automatically upgraded to HTTPS`),e.replace(/^http\\:/,`https:`)):e).catch(n=>{var r;p(e);let i=new l(h,`XMLHttpRequest`,n&&n.message?String(n.message):String(n));return(r=t.networkSubscribe)==null||r.emit(`network`,e,`XMLHttpRequest`,`forbidden`,i.message),Promise.reject(i)}).then(e=>new Promise((s,c)=>{let l=p(e);if(l){let n=window,o=null,f=!1,p=document.createElement(`script`);n[l]=d=>{var g,_;let v=a(),y=v-m;if(delete n[l],p.parentNode&&p.parentNode.removeChild(p),o!==null&&(window.clearTimeout(o),o=null),f===!0)return;if(d.indexOf(`data:`)!==0){let n=new u(e,`XMLHttpRequest`,500);i(n),c(n),(g=t.networkSubscribe)==null||g.emit(`network`,e,`XMLHttpRequest`,`error`,n.message);return}let b=d.split(`,`),x=(b[0].match(/:(.*?);/)||[])[1],S=b[1];if(t.responseType===`arraybuffer`||t.responseType===`blob`){let e=atob(b[1]),n=e.length,r=new Uint8Array(n);for(let t=0;t<n;t++)r[t]=e.charCodeAt(t);S=t.responseType===`arraybuffer`?r.buffer:new Blob([r],{type:x})}let C={body:S,meta:{origin:h,source:e,requestTime:m,responseTime:v,costs:y,headers:{}}};r(C),s(C),(_=t.networkSubscribe)==null||_.emit(`network`,e,`XMLHttpRequest`,`ok`,JSON.stringify(C.meta)),f=!0},p.src=e,document.body.appendChild(p),typeof t.timeout==`number`&&(o=window.setTimeout(()=>{var n;if(o=null,f!==!0){f=!0;let r=new d(e,`XMLHttpRequest`,t.timeout||NaN);i(r),c(r),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`timeout`,r.message)}},t.timeout))}else{let l=!1,p=new XMLHttpRequest,g=()=>{p&&(p.removeEventListener(`timeout`,_,!1),p.removeEventListener(`progress`,v,!1),p.removeEventListener(`load`,y,!1),p.removeEventListener(`error`,b,!1)),p=null,g=n},_=function(){var n;if(l===!0)return;l=!0,g();let r=new d(e,`XMLHttpRequest`,t.timeout||NaN);i(r),c(r),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`timeout`,r.message)},v=function(e){l!==!0&&e.lengthComputable&&(e.total<=0||o(e.loaded/e.total,e.loaded,e.total))},y=function(n){var i;if(l===!0)return;let o=this.status;if(o===0||o>=200&&o<400){l=!0,g();let o=a(),c=o-m,u=f(this.getAllResponseHeaders()),d=n.total,p={body:this.response,meta:{origin:h,source:e,requestTime:m,responseTime:o,costs:c,headers:u,size:d}};r(p),s(p),(i=t.networkSubscribe)==null||i.emit(`network`,e,`XMLHttpRequest`,`ok`,JSON.stringify(p.meta))}else b.call(this)},b=function(){var n;if(l===!0)return;l=!0,g();let r=new u(e,`XMLHttpRequest`,this.status);i(r),c(r),(n=t.networkSubscribe)==null||n.emit(`network`,e,`XMLHttpRequest`,`error`,r.message)};p.addEventListener(`timeout`,_,!1),p.addEventListener(`progress`,v,!1),p.addEventListener(`load`,y,!1),p.addEventListener(`error`,b,!1),t.responseType&&(p.responseType=t.responseType),typeof t.timeout==`number`&&(p.timeout=t.timeout),p.open(`GET`,e,!0),p.send(null)}}))}let g={};function _(e,t={}){let r=a(),i=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>c&&/^http\\:/.test(e)?(console.warn(`The page at \'${s}\' was loaded over HTTPS, but requested an insecure element \'${e}\'. This request was automatically upgraded to HTTPS`),e.replace(/^http\\:/,`https:`)):e).catch(n=>{var r;let a=new l(i,`Link`,n&&n.message?String(n.message):String(n));return(r=t.networkSubscribe)==null||r.emit(`network`,e,`Link`,`forbidden`,a.message),Promise.reject(a)}).then(e=>e in g?g[e]:g[e]=new Promise((o,s)=>{let c=document.head||document.getElementsByTagName(`head`)[0],l=document.createElement(`link`),d=!1,f=null;l.onload=s=>{var c;if(f!==null&&(clearTimeout(f),f=null),d===!0)return;d=!0,o(),l.onerror=n,l.onload=n;let u=a(),p={origin:i,source:e,requestTime:r,responseTime:u,costs:u-r,headers:{}};(c=t.networkSubscribe)==null||c.emit(`network`,e,`Link`,`preload`,JSON.stringify(p))},l.onerror=r=>{var i;if(f!==null&&(clearTimeout(f),f=null),d===!0)return;d=!0,delete g[e],c&&l.parentNode===c&&c.removeChild(l);let a=new u(e,`Link`,0);s(a),l.onerror=n,l.onload=n,(i=t.networkSubscribe)==null||i.emit(`network`,e,`Link`,`error`,a.message)},typeof t.timeout==`number`&&(f=window.setTimeout(()=>{var s;if(f=null,d===!0)return;d=!0,o(),l.onerror=n,l.onload=n;let c=a(),u={origin:i,source:e,requestTime:r,responseTime:c,costs:c-r,headers:{}};(s=t.networkSubscribe)==null||s.emit(`network`,e,`Link`,`timeout`,JSON.stringify(u))},t.timeout)),l.rel=l.relList&&l.relList.supports(`prefetch`)?`prefetch`:`preload`,l.as=`fetch`,l.crossOrigin=``,l.fetchPriority=`high`,l.href=e,c&&c.appendChild(l)}))}function v(e,t={},r=n,i=n,o=n,f){let p=a(),g=e;return Promise.resolve().then(()=>t.requestProxy?t.requestProxy(e):e).then(e=>c&&/^http\\:/.test(e)?(console.warn(`The page at \'${s}\' was loaded over HTTPS, but requested an insecure element \'${e}\'. This request was automatically upgraded to HTTPS`),e.replace(/^http\\:/,`https:`)):e).catch(n=>{var r;let i=new l(g,`Image`,n&&n.message?String(n.message):String(n));return(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`forbidden`,i.message),Promise.reject(i)}).then(e=>m(e)?h(e,{responseType:`blob`,networkSubscribe:t.networkSubscribe}).then(e=>URL.createObjectURL(e.body)):e).then(e=>new Promise((s,c)=>{let l=f==null?new Image:f,m=!1,h=null;typeof t.timeout==`number`&&(h=window.setTimeout(()=>{var r;if(l.onload=n,l.onerror=n,h=null,m===!0)return;m=!0;let a=new d(e,`Image`,t.timeout);i(a),c(a),(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`timeout`,a.message)},t.timeout)),l.onload=()=>{var i;if(l.onload=n,l.onerror=n,h!==null&&(clearTimeout(h),h=null),m===!0)return;let c=a(),u={headers:{},origin:g,source:e,requestTime:p,responseTime:c,costs:c-p};m=!0;let d={body:l,meta:u};o(1),r(d),s(d),(i=t.networkSubscribe)==null||i.emit(`network`,e,`Image`,`ok`,JSON.stringify(d.meta))},l.onerror=()=>{var r;if(l.onload=n,l.onerror=n,h!==null&&(clearTimeout(h),h=null),m===!0)return;m=!0;let a=new u(e,`Image`,0);i(a),c(a),(r=t.networkSubscribe)==null||r.emit(`network`,e,`Image`,`ok`,a.message)},o(0),l.src=e}))}new class{constructor(e={}){this.options=e}ajax(e,t={},r=n,i=n,a=n){var o;let s=this.options;return h(e,{responseType:t.responseType,timeout:(o=t.timeout)==null?s.timeout:o,get requestProxy(){var e;return(e=t.requestProxy)==null?s.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?s.networkSubscribe:e}},r,i,a)}loadImage(e,t={},r=n,i=n,a=n,o){var s;let c=this.options;return v(e,{timeout:(s=t.timeout)==null?c.timeout:s,get requestProxy(){var e;return(e=t.requestProxy)==null?c.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?c.networkSubscribe:e}},r,i,a,o)}preload(e,t={}){var n;let r=this.options;return _(e,{timeout:(n=t.timeout)==null?r.timeout:n,get requestProxy(){var e;return(e=t.requestProxy)==null?r.requestProxy:e},get networkSubscribe(){var e;return(e=t.networkSubscribe)==null?r.networkSubscribe:e}})}};function y(){}function b(e,t){this.x=e||0,this.y=t||0}function x(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error(`THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.`)}function S(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(this,`id`,{value:gc++}),this.uuid=X.generateUUID(),this.name=``,this.image=e===void 0?S.DEFAULT_IMAGE:e,this.mipmaps=[],this.mapping=t===void 0?S.DEFAULT_MAPPING:t,this.wrapS=n===void 0?Vo:n,this.wrapT=r===void 0?Vo:r,this.magFilter=i===void 0?Ko:i,this.minFilter=a===void 0?Jo:a,this.anisotropy=c===void 0?1:c,this.format=o===void 0?es:o,this.internalFormat=null,this.type=s===void 0?Yo:s,this.offset=new b(0,0),this.repeat=new b(1,1),this.center=new b(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new x,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l===void 0?$s:l,this.version=0,this.onUpdate=null}function C(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=r===void 0?1:r}function w(e,t,n){this.width=e,this.height=t,this.scissor=new C(0,0,e,t),this.scissorTest=!1,this.viewport=new C(0,0,e,t),n=n||{},this.texture=new S(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=n.generateMipmaps===void 0?!1:n.generateMipmaps,this.texture.minFilter=n.minFilter===void 0?Ko:n.minFilter,this.depthBuffer=n.depthBuffer===void 0?!0:n.depthBuffer,this.stencilBuffer=n.stencilBuffer===void 0?!0:n.stencilBuffer,this.depthTexture=n.depthTexture===void 0?null:n.depthTexture}function T(e,t,n){w.call(this,e,t,n),this.samples=4}function E(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=r===void 0?1:r}function D(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function O(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error(`THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.`)}function k(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||k.DefaultOrder}function A(){this.mask=1}function j(){Object.defineProperty(this,`id`,{value:Oc++}),this.uuid=X.generateUUID(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=j.DefaultUp.clone();var e=new D,t=new k,n=new E,r=new D(1,1,1);function i(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(i),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new O},normalMatrix:{value:new x}}),this.matrix=new O,this.matrixWorld=new O,this.matrixAutoUpdate=j.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new A,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function M(){j.call(this),this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}function N(e,t){this.min=e===void 0?new D(1/0,1/0,1/0):e,this.max=t===void 0?new D(-1/0,-1/0,-1/0):t}function P(e,t,n,r,i){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){$c.fromArray(e,a);var s=i.x*Math.abs($c.x)+i.y*Math.abs($c.y)+i.z*Math.abs($c.z),c=t.dot($c),l=n.dot($c),u=r.dot($c);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>s)return!1}return!0}function F(e,t){this.center=e===void 0?new D:e,this.radius=t===void 0?-1:t}function I(e,t){this.origin=e===void 0?new D:e,this.direction=t===void 0?new D(0,0,-1):t}function L(e,t){this.normal=e===void 0?new D(1,0,0):e,this.constant=t===void 0?0:t}function R(e,t,n){this.a=e===void 0?new D:e,this.b=t===void 0?new D:t,this.c=n===void 0?new D:n}function z(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}function ee(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}function te(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}function ne(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}function B(e,t,n,r,i,a){this.a=e,this.b=t,this.c=n,this.normal=r&&r.isVector3?r:new D,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new z,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=a===void 0?0:a}function V(){Object.defineProperty(this,`id`,{value:wl++}),this.uuid=X.generateUUID(),this.name=``,this.type=`Material`,this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=lc,this.stencilZFail=lc,this.stencilZPass=lc,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function re(e){V.call(this),this.type=`MeshBasicMaterial`,this.color=new z(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.setValues(e)}function H(e,t,n){if(Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n===!0,this.usage=uc,this.updateRange={offset:0,count:-1},this.version=0}function U(e,t,n){H.call(this,new Int8Array(e),t,n)}function ie(e,t,n){H.call(this,new Uint8Array(e),t,n)}function W(e,t,n){H.call(this,new Uint8ClampedArray(e),t,n)}function ae(e,t,n){H.call(this,new Int16Array(e),t,n)}function G(e,t,n){H.call(this,new Uint16Array(e),t,n)}function oe(e,t,n){H.call(this,new Int32Array(e),t,n)}function se(e,t,n){H.call(this,new Uint32Array(e),t,n)}function K(e,t,n){H.call(this,new Float32Array(e),t,n)}function ce(e,t,n){H.call(this,new Float64Array(e),t,n)}function le(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function ue(e){if(e.length===0)return-1/0;let t=e[0];for(let n=1,r=e.length;n<r;++n)e[n]>t&&(t=e[n]);return t}function q(){Object.defineProperty(this,`id`,{value:El+=2}),this.uuid=X.generateUUID(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}function de(e,t){j.call(this),this.type=`Mesh`,this.geometry=e===void 0?new q:e,this.material=t===void 0?new re:t,this.updateMorphTargets()}function fe(e,t,n,r,i,a,o,s){if((t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side!==2,s))===null)return null;Yl.copy(s),Yl.applyMatrix4(e.matrixWorld);var c=n.ray.origin.distanceTo(Yl);return c<n.near||c>n.far?null:{distance:c,point:Yl.clone(),object:e}}function pe(e,t,n,r,i,a,o,s,c,l,u,d){Il.fromBufferAttribute(i,l),Ll.fromBufferAttribute(i,u),Rl.fromBufferAttribute(i,d);var f=e.morphTargetInfluences;if(t.morphTargets&&a&&f){Hl.set(0,0,0),Ul.set(0,0,0),Wl.set(0,0,0);for(var p=0,m=a.length;p<m;p++){var h=f[p],g=a[p];h!==0&&(zl.fromBufferAttribute(g,l),Bl.fromBufferAttribute(g,u),Vl.fromBufferAttribute(g,d),o?(Hl.addScaledVector(zl,h),Ul.addScaledVector(Bl,h),Wl.addScaledVector(Vl,h)):(Hl.addScaledVector(zl.sub(Il),h),Ul.addScaledVector(Bl.sub(Ll),h),Wl.addScaledVector(Vl.sub(Rl),h)))}Il.add(Hl),Ll.add(Ul),Rl.add(Wl)}e.isSkinnedMesh&&(e.boneTransform(l,Il),e.boneTransform(u,Ll),e.boneTransform(d,Rl));var _=fe(e,t,n,r,Il,Ll,Rl,Jl);if(_){s&&(Gl.fromBufferAttribute(s,l),Kl.fromBufferAttribute(s,u),ql.fromBufferAttribute(s,d),_.uv=R.getUV(Jl,Il,Ll,Rl,Gl,Kl,ql,new b)),c&&(Gl.fromBufferAttribute(c,l),Kl.fromBufferAttribute(c,u),ql.fromBufferAttribute(c,d),_.uv2=R.getUV(Jl,Il,Ll,Rl,Gl,Kl,ql,new b));var v=new B(l,u,d);R.getNormal(Il,Ll,Rl,v.normal),_.face=v}return _}function J(){Object.defineProperty(this,`id`,{value:Xl+=2}),this.uuid=X.generateUUID(),this.name=``,this.type=`Geometry`,this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function me(e){var t={};for(var n in e)for(var r in t[n]={},e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}function he(e){for(var t={},n=0;n<e.length;n++){var r=me(e[n]);for(var i in r)t[i]=r[i]}return t}function ge(e){V.call(this),this.type=`ShaderMaterial`,this.defines={},this.uniforms={},this.vertexShader=ru,this.fragmentShader=iu,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,e!==void 0&&(e.attributes!==void 0&&console.error(`THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.`),this.setValues(e))}function _e(){j.call(this),this.type=`Camera`,this.matrixWorldInverse=new O,this.projectionMatrix=new O,this.projectionMatrixInverse=new O}function ve(e,t,n,r){_e.call(this),this.type=`PerspectiveCamera`,this.fov=e===void 0?50:e,this.zoom=1,this.near=n===void 0?.1:n,this.far=r===void 0?2e3:r,this.focus=10,this.aspect=t===void 0?1:t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function ye(e,t,n){if(j.call(this),this.type=`CubeCamera`,n.isWebGLCubeRenderTarget!==!0){console.error(`THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.`);return}this.renderTarget=n;var r=new ve(au,ou,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new D(1,0,0)),this.add(r);var i=new ve(au,ou,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new D(-1,0,0)),this.add(i);var a=new ve(au,ou,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new D(0,1,0)),this.add(a);var o=new ve(au,ou,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new D(0,-1,0)),this.add(o);var s=new ve(au,ou,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new D(0,0,1)),this.add(s);var c=new ve(au,ou,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new D(0,0,-1)),this.add(c),this.update=function(e,t){this.parent===null&&this.updateMatrixWorld();var l=e.xr.enabled,u=e.getRenderTarget();e.xr.enabled=!1;var d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,i),e.setRenderTarget(n,2),e.render(t,a),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,s),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(u),e.xr.enabled=l},this.clear=function(e,t,r,i){for(var a=e.getRenderTarget(),o=0;o<6;o++)e.setRenderTarget(n,o),e.clear(t,r,i);e.setRenderTarget(a)}}function be(e,t,n){Number.isInteger(t)&&(console.warn(`THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )`),t=n),w.call(this,e,e,t)}function xe(e,t,n,r,i,a,o,s,c,l,u,d){S.call(this,null,a,o,s,c,l,r,i,u,d),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=c===void 0?Uo:c,this.minFilter=l===void 0?Uo:l,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}function Se(e,t,n,r,i,a){this.planes=[e===void 0?new L:e,t===void 0?new L:t,n===void 0?new L:n,r===void 0?new L:r,i===void 0?new L:i,a===void 0?new L:a]}function Ce(){var e=null,t=!1,n=null;function r(i,a){t!==!1&&(n(i,a),e.requestAnimationFrame(r))}return{start:function(){t!==!0&&n!==null&&(e.requestAnimationFrame(r),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function we(e,t){var n=t.isWebGL2,r=new WeakMap;function i(t,n){var r=t.array,i=t.usage,a=e.createBuffer();e.bindBuffer(n,a),e.bufferData(n,r,i),t.onUploadCallback();var o=5126;return r instanceof Float32Array?o=5126:r instanceof Float64Array?console.warn(`THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.`):r instanceof Uint16Array?o=5123:r instanceof Int16Array?o=5122:r instanceof Uint32Array?o=5125:r instanceof Int32Array?o=5124:r instanceof Int8Array?o=5120:r instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version}}function a(t,r,i){var a=r.array,o=r.updateRange;e.bindBuffer(i,t),o.count===-1?e.bufferSubData(i,0,a):(n?e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}function o(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)}function s(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))}function c(e,t){e.isInterleavedBufferAttribute&&(e=e.data);var n=r.get(e);n===void 0?r.set(e,i(e,t)):n.version<e.version&&(a(n.buffer,e,t),n.version=e.version)}return{get:o,remove:s,update:c}}function Te(e,t,n,r){J.call(this),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new Ee(e,t,n,r)),this.mergeVertices()}function Ee(e,t,n,r){q.call(this),this.type=`PlaneBufferGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},e=e||1,t=t||1;var i=e/2,a=t/2,o=Math.floor(n)||1,s=Math.floor(r)||1,c=o+1,l=s+1,u=e/o,d=t/s,f,p,m=[],h=[],g=[],_=[];for(p=0;p<l;p++){var v=p*d-a;for(f=0;f<c;f++){var y=f*u-i;h.push(y,-v,0),g.push(0,0,1),_.push(f/o),_.push(1-p/s)}}for(p=0;p<s;p++)for(f=0;f<o;f++){var b=f+c*p,x=f+c*(p+1),S=f+1+c*(p+1),C=f+1+c*p;m.push(b,x,C),m.push(x,S,C)}this.setIndex(m),this.setAttribute(`position`,new K(h,3)),this.setAttribute(`normal`,new K(g,3)),this.setAttribute(`uv`,new K(_,2))}function De(e,t,n,r){var i=new z(0),a=0,o,s,c=null,l=0,u=null;function d(t,r,d,p){var m=r.background,h=e.xr,g=h.getSession&&h.getSession();if(g&&g.environmentBlendMode===`additive`&&(m=null),m===null?f(i,a):m&&m.isColor&&(f(m,1),p=!0),(e.autoClear||p)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),m&&(m.isCubeTexture||m.isWebGLCubeRenderTarget||m.mapping===306)){s===void 0&&(s=new de(new tu(1,1,1),new ge({type:`BackgroundCubeMaterial`,uniforms:me(lu.cube.uniforms),vertexShader:lu.cube.vertexShader,fragmentShader:lu.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute(`normal`),s.geometry.deleteAttribute(`uv`),s.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(s.material,`envMap`,{get:function(){return this.uniforms.envMap.value}}),n.update(s));var _=m.isWebGLCubeRenderTarget?m.texture:m;s.material.uniforms.envMap.value=_,s.material.uniforms.flipEnvMap.value=_.isCubeTexture?-1:1,(c!==m||l!==_.version||u!==e.toneMapping)&&(s.material.needsUpdate=!0,c=m,l=_.version,u=e.toneMapping),t.unshift(s,s.geometry,s.material,0,0,null)}else m&&m.isTexture&&(o===void 0&&(o=new de(new Ee(2,2),new ge({type:`BackgroundMaterial`,uniforms:me(lu.background.uniforms),vertexShader:lu.background.vertexShader,fragmentShader:lu.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute(`normal`),Object.defineProperty(o.material,`map`,{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=m,m.matrixAutoUpdate===!0&&m.updateMatrix(),o.material.uniforms.uvTransform.value.copy(m.matrix),(c!==m||l!==m.version||u!==e.toneMapping)&&(o.material.needsUpdate=!0,c=m,l=m.version,u=e.toneMapping),t.unshift(o,o.geometry,o.material,0,0,null))}function f(e,n){t.buffers.color.setClear(e.r,e.g,e.b,n,r)}return{getClearColor:function(){return i},setClearColor:function(e,t){i.set(e),a=t===void 0?1:t,f(i,a)},getClearAlpha:function(){return a},setClearAlpha:function(e){a=e,f(i,a)},render:d}}function Oe(e,t,n,r){var i=r.isWebGL2,a;function o(e){a=e}function s(t,r){e.drawArrays(a,t,r),n.update(r,a)}function c(r,o,s,c){if(c!==0){var l,u;if(i)l=e,u=`drawArraysInstanced`;else if(l=t.get(`ANGLE_instanced_arrays`),u=`drawArraysInstancedANGLE`,l===null){console.error(`THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.`);return}l[u](a,o,s,c),n.update(s,a,c)}}this.setMode=o,this.render=s,this.renderInstances=c}function ke(e,t,n){var r;function i(){if(r!==void 0)return r;var n=t.get(`EXT_texture_filter_anisotropic`);return r=n===null?0:e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT),r}function a(t){if(t===`highp`){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?`mediump`:`lowp`}var o=typeof WebGL2RenderingContext<`u`&&e instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<`u`&&e instanceof WebGL2ComputeRenderingContext,s=n.precision===void 0?`highp`:n.precision,c=a(s);c!==s&&(console.warn(`THREE.WebGLRenderer:`,s,`not supported, using`,c,`instead.`),s=c);var l=n.logarithmicDepthBuffer===!0,u=e.getParameter(34930),d=e.getParameter(35660),f=e.getParameter(3379),p=e.getParameter(34076),m=e.getParameter(34921),h=e.getParameter(36347),g=e.getParameter(36348),_=e.getParameter(36349),v=d>0,y=o||!!t.get(`OES_texture_float`),b=v&&y,x=o?e.getParameter(36183):0;return{isWebGL2:o,getMaxAnisotropy:i,getMaxPrecision:a,precision:s,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:d,maxTextureSize:f,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:h,maxVaryings:g,maxFragmentUniforms:_,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:b,maxSamples:x}}function Ae(){var e=this,t=null,n=0,r=!1,i=!1,a=new L,o=new x,s={value:null,needsUpdate:!1};this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,i,a){var o=e.length!==0||i||n!==0||r;return r=i,t=l(e,a,0),n=e.length,o},this.beginShadows=function(){i=!0,l(null)},this.endShadows=function(){i=!1,c()},this.setState=function(e,a,o,u,d,f){if(!r||e===null||e.length===0||i&&!o)i?l(null):c();else{var p=i?0:n,m=p*4,h=d.clippingState||null;s.value=h,h=l(e,u,m,f);for(var g=0;g!==m;++g)h[g]=t[g];d.clippingState=h,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=p}};function c(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function l(t,n,r,i){var c=t===null?0:t.length,l=null;if(c!==0){if(l=s.value,i!==!0||l===null){var u=r+c*4,d=n.matrixWorldInverse;o.getNormalMatrix(d),(l===null||l.length<u)&&(l=new Float32Array(u));for(var f=0,p=r;f!==c;++f,p+=4)a.copy(t[f]).applyMatrix4(d,o),a.normal.toArray(l,p),l[p+3]=a.constant}s.value=l,s.needsUpdate=!0}return e.numPlanes=c,e.numIntersection=0,l}}function je(e){var t={};return{get:function(n){if(t[n]!==void 0)return t[n];var r;switch(n){case`WEBGL_depth_texture`:r=e.getExtension(`WEBGL_depth_texture`)||e.getExtension(`MOZ_WEBGL_depth_texture`)||e.getExtension(`WEBKIT_WEBGL_depth_texture`);break;case`EXT_texture_filter_anisotropic`:r=e.getExtension(`EXT_texture_filter_anisotropic`)||e.getExtension(`MOZ_EXT_texture_filter_anisotropic`)||e.getExtension(`WEBKIT_EXT_texture_filter_anisotropic`);break;case`WEBGL_compressed_texture_s3tc`:r=e.getExtension(`WEBGL_compressed_texture_s3tc`)||e.getExtension(`MOZ_WEBGL_compressed_texture_s3tc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_s3tc`);break;case`WEBGL_compressed_texture_pvrtc`:r=e.getExtension(`WEBGL_compressed_texture_pvrtc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_pvrtc`);break;default:r=e.getExtension(n)}return r===null&&console.warn(`THREE.WebGLRenderer: `+n+` extension not supported.`),t[n]=r,r}}}function Me(e,t,n){var r=new WeakMap,i=new WeakMap;function a(e){var o=e.target,s=r.get(o);for(var c in s.index!==null&&t.remove(s.index),s.attributes)t.remove(s.attributes[c]);o.removeEventListener(`dispose`,a),r.delete(o);var l=i.get(s);l&&(t.remove(l),i.delete(s)),n.memory.geometries--}function o(e,t){var i=r.get(t);return i||(t.addEventListener(`dispose`,a),t.isBufferGeometry?i=t:t.isGeometry&&(t._bufferGeometry===void 0&&(t._bufferGeometry=new q().setFromObject(e)),i=t._bufferGeometry),r.set(t,i),n.memory.geometries++,i)}function s(e){var n=e.index,r=e.attributes;for(var i in n!==null&&t.update(n,34963),r)t.update(r[i],34962);var a=e.morphAttributes;for(var i in a)for(var o=a[i],s=0,c=o.length;s<c;s++)t.update(o[s],34962)}function c(e){var n=[],r=e.index,a=e.attributes.position,o=0;if(r!==null){var s=r.array;o=r.version;for(var c=0,l=s.length;c<l;c+=3){var u=s[c+0],d=s[c+1],f=s[c+2];n.push(u,d,d,f,f,u)}}else{var s=a.array;o=a.version;for(var c=0,l=s.length/3-1;c<l;c+=3){var u=c+0,d=c+1,f=c+2;n.push(u,d,d,f,f,u)}}var p=new(ue(n)>65535?se:G)(n,1);p.version=o,t.update(p,34963);var m=i.get(e);m&&t.remove(m),i.set(e,p)}function l(e){var t=i.get(e);if(t){var n=e.index;n!==null&&t.version<n.version&&c(e)}else c(e);return i.get(e)}return{get:o,update:s,getWireframeAttribute:l}}function Ne(e,t,n,r){var i=r.isWebGL2,a;function o(e){a=e}var s,c;function l(e){s=e.type,c=e.bytesPerElement}function u(t,r){e.drawElements(a,r,s,t*c),n.update(r,a)}function d(r,o,l,u){if(u!==0){var d,f;if(i)d=e,f=`drawElementsInstanced`;else if(d=t.get(`ANGLE_instanced_arrays`),f=`drawElementsInstancedANGLE`,d===null){console.error(`THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.`);return}d[f](a,l,s,o*c,u),n.update(l,a,u)}}this.setMode=o,this.setIndex=l,this.render=u,this.renderInstances=d}function Pe(e){var t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(e,t,r){switch(r=r||1,n.calls++,t){case 4:n.triangles+=e/3*r;break;case 1:n.lines+=e/2*r;break;case 3:n.lines+=r*(e-1);break;case 2:n.lines+=r*e;break;case 0:n.points+=r*e;break;default:console.error(`THREE.WebGLInfo: Unknown draw mode:`,t);break}}function i(){n.frame++,n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:i,update:r}}function Fe(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Ie(e){var t={},n=new Float32Array(8);function r(r,i,a,o){var s=r.morphTargetInfluences,c=s===void 0?0:s.length,l=t[i.id];if(l===void 0){l=[];for(var u=0;u<c;u++)l[u]=[u,0];t[i.id]=l}for(var d=a.morphTargets&&i.morphAttributes.position,f=a.morphNormals&&i.morphAttributes.normal,u=0;u<c;u++){var p=l[u];p[1]!==0&&(d&&i.deleteAttribute(`morphTarget`+u),f&&i.deleteAttribute(`morphNormal`+u))}for(var u=0;u<c;u++){var p=l[u];p[0]=u,p[1]=s[u]}l.sort(Fe);for(var m=0,u=0;u<8;u++){var p=l[u];if(p){var h=p[0],g=p[1];if(g){d&&i.setAttribute(`morphTarget`+u,d[h]),f&&i.setAttribute(`morphNormal`+u,f[h]),n[u]=g,m+=g;continue}}n[u]=0}var _=i.morphTargetsRelative?1:1-m;o.getUniforms().setValue(e,`morphTargetBaseInfluence`,_),o.getUniforms().setValue(e,`morphTargetInfluences`,n)}return{update:r}}function Le(e,t,n,r){var i=new WeakMap;function a(e){var a=r.render.frame,o=e.geometry,s=t.get(e,o);return i.get(s)!==a&&(o.isGeometry&&s.updateFromObject(e),t.update(s),i.set(s,a)),e.isInstancedMesh&&n.update(e.instanceMatrix,34962),s}function o(){i=new WeakMap}return{update:a,dispose:o}}function Re(e,t,n,r,i,a,o,s,c,l){e=e===void 0?[]:e,t=t===void 0?301:t,o=o===void 0?$o:o,S.call(this,e,t,n,r,i,a,o,s,c,l),this.flipY=!1}function ze(e,t,n,r){S.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=Uo,this.minFilter=Uo,this.wrapR=Vo,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Be(e,t,n,r){S.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=Uo,this.minFilter=Uo,this.wrapR=Vo,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Ve(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,a=mu[i];if(a===void 0&&(a=new Float32Array(i),mu[i]=a),t!==0){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function He(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Ue(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function We(e,t){var n=hu[t];n===void 0&&(n=new Int32Array(t),hu[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function Ge(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Ke(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(He(n,t))return;e.uniform2fv(this.addr,t),Ue(n,t)}}function qe(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(t.r!==void 0)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(He(n,t))return;e.uniform3fv(this.addr,t),Ue(n,t)}}function Je(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(He(n,t))return;e.uniform4fv(this.addr,t),Ue(n,t)}}function Ye(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(He(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ue(n,t)}else{if(He(n,r))return;vu.set(r),e.uniformMatrix2fv(this.addr,!1,vu),Ue(n,r)}}function Xe(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(He(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ue(n,t)}else{if(He(n,r))return;_u.set(r),e.uniformMatrix3fv(this.addr,!1,_u),Ue(n,r)}}function Ze(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(He(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ue(n,t)}else{if(He(n,r))return;gu.set(r),e.uniformMatrix4fv(this.addr,!1,gu),Ue(n,r)}}function Qe(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(t||uu,i)}function $e(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||du,i)}function et(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||fu,i)}function tt(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(t||pu,i)}function nt(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function rt(e,t){var n=this.cache;He(n,t)||(e.uniform2iv(this.addr,t),Ue(n,t))}function it(e,t){var n=this.cache;He(n,t)||(e.uniform3iv(this.addr,t),Ue(n,t))}function at(e,t){var n=this.cache;He(n,t)||(e.uniform4iv(this.addr,t),Ue(n,t))}function ot(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function st(e){switch(e){case 5126:return Ge;case 35664:return Ke;case 35665:return qe;case 35666:return Je;case 35674:return Ye;case 35675:return Xe;case 35676:return Ze;case 5124:case 35670:return nt;case 35667:case 35671:return rt;case 35668:case 35672:return it;case 35669:case 35673:return at;case 5125:return ot;case 35678:case 36198:case 36298:case 36306:case 35682:return Qe;case 35679:case 36299:case 36307:return et;case 35680:case 36300:case 36308:case 36293:return tt;case 36289:case 36303:case 36311:case 36292:return $e}}function ct(e,t){e.uniform1fv(this.addr,t)}function lt(e,t){e.uniform1iv(this.addr,t)}function ut(e,t){e.uniform2iv(this.addr,t)}function dt(e,t){e.uniform3iv(this.addr,t)}function ft(e,t){e.uniform4iv(this.addr,t)}function pt(e,t){var n=Ve(t,this.size,2);e.uniform2fv(this.addr,n)}function mt(e,t){var n=Ve(t,this.size,3);e.uniform3fv(this.addr,n)}function ht(e,t){var n=Ve(t,this.size,4);e.uniform4fv(this.addr,n)}function gt(e,t){var n=Ve(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function _t(e,t){var n=Ve(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function vt(e,t){var n=Ve(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function yt(e,t,n){var r=t.length,i=We(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTexture2D(t[a]||uu,i[a])}function bt(e,t,n){var r=t.length,i=We(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTextureCube(t[a]||pu,i[a])}function xt(e){switch(e){case 5126:return ct;case 35664:return pt;case 35665:return mt;case 35666:return ht;case 35674:return gt;case 35675:return _t;case 35676:return vt;case 5124:case 35670:return lt;case 35667:case 35671:return ut;case 35668:case 35672:return dt;case 35669:case 35673:return ft;case 35678:case 36198:case 36298:case 36306:case 35682:return yt;case 35680:case 36300:case 36308:case 36293:return bt}}function St(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=st(t.type)}function Ct(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=xt(t.type)}function wt(e){this.id=e,this.seq=[],this.map={}}function Tt(e,t){e.seq.push(t),e.map[t.id]=t}function Et(e,t,n){var r=e.name,i=r.length;for(yu.lastIndex=0;;){var a=yu.exec(r),o=yu.lastIndex,s=a[1],c=a[2]===`]`,l=a[3];if(c&&(s|=0),l===void 0||l===`[`&&o+2===i){Tt(n,l===void 0?new St(s,e,t):new Ct(s,e,t));break}else{var u=n.map[s];u===void 0&&(u=new wt(s),Tt(n,u)),n=u}}}function Dt(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),r=0;r<n;++r){var i=e.getActiveUniform(t,r);Et(i,e.getUniformLocation(t,i.name),this)}}function Ot(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}function kt(e){for(var t=e.split(`\n`),n=0;n<t.length;n++)t[n]=n+1+`: `+t[n];return t.join(`\n`)}function At(e){switch(e){case $s:return[`Linear`,`( value )`];case ec:return[`sRGB`,`( value )`];case nc:return[`RGBE`,`( value )`];case ic:return[`RGBM`,`( value, 7.0 )`];case ac:return[`RGBM`,`( value, 16.0 )`];case oc:return[`RGBD`,`( value, 256.0 )`];case tc:return[`Gamma`,`( value, float( GAMMA_FACTOR ) )`];case rc:return[`LogLuv`,`( value )`];default:throw Error(`unsupported encoding: `+e)}}function jt(e,t,n){var r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(r&&i===``)return``;var a=e.getShaderSource(t);return`THREE.WebGLShader: gl.getShaderInfoLog() `+n+`\n`+i+kt(a)}function Mt(e,t){var n=At(t);return`vec4 `+e+`( vec4 value ) { return `+n[0]+`ToLinear`+n[1]+`; }`}function Nt(e,t){var n=At(t);return`vec4 `+e+`( vec4 value ) { return LinearTo`+n[0]+n[1]+`; }`}function Pt(e,t){var n;switch(t){case 1:n=`Linear`;break;case 2:n=`Reinhard`;break;case 3:n=`Uncharted2`;break;case 4:n=`OptimizedCineon`;break;case 5:n=`ACESFilmic`;break;default:throw Error(`unsupported toneMapping: `+t)}return`vec3 `+e+`( vec3 color ) { return `+n+`ToneMapping( color ); }`}function Ft(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||e.shaderID===`physical`?`#extension GL_OES_standard_derivatives : enable`:``,(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?`#extension GL_EXT_frag_depth : enable`:``,e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?`#extension GL_EXT_draw_buffers : require`:``,(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?`#extension GL_EXT_shader_texture_lod : enable`:``].filter(Rt).join(`\n`)}function It(e){var t=[];for(var n in e){var r=e[n];r!==!1&&t.push(`#define `+n+` `+r)}return t.join(`\n`)}function Lt(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var a=e.getActiveAttrib(t,i).name;n[a]=e.getAttribLocation(t,a)}return n}function Rt(e){return e!==``}function zt(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Bt(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}function Vt(e){return e.replace(xu,Ht)}function Ht(e,t){var n=Q[t];if(n===void 0)throw Error(`Can not resolve #include <`+t+`>`);return Vt(n)}function Ut(e){return e.replace(Cu,Gt).replace(Su,Wt)}function Wt(e,t,n,r){return console.warn(`WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.`),Gt(e,t,n,r)}function Gt(e,t,n,r){for(var i=``,a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\\[ i \\]/g,`[ `+a+` ]`).replace(/UNROLLED_LOOP_INDEX/g,a);return i}function Kt(e){var t=`precision `+e.precision+` float;\nprecision `+e.precision+` int;`;return e.precision===`highp`?t+=`\n#define HIGH_PRECISION`:e.precision===`mediump`?t+=`\n#define MEDIUM_PRECISION`:e.precision===`lowp`&&(t+=`\n#define LOW_PRECISION`),t}function qt(e){var t=`SHADOWMAP_TYPE_BASIC`;return e.shadowMapType===1?t=`SHADOWMAP_TYPE_PCF`:e.shadowMapType===2?t=`SHADOWMAP_TYPE_PCF_SOFT`:e.shadowMapType===3&&(t=`SHADOWMAP_TYPE_VSM`),t}function Jt(e){var t=`ENVMAP_TYPE_CUBE`;if(e.envMap)switch(e.envMapMode){case 301:case 302:t=`ENVMAP_TYPE_CUBE`;break;case 306:case 307:t=`ENVMAP_TYPE_CUBE_UV`;break;case 303:case 304:t=`ENVMAP_TYPE_EQUIREC`;break;case 305:t=`ENVMAP_TYPE_SPHERE`;break}return t}function Yt(e){var t=`ENVMAP_MODE_REFLECTION`;if(e.envMap)switch(e.envMapMode){case 302:case 304:t=`ENVMAP_MODE_REFRACTION`;break}return t}function Xt(e){var t=`ENVMAP_BLENDING_NONE`;if(e.envMap)switch(e.combine){case 0:t=`ENVMAP_BLENDING_MULTIPLY`;break;case 1:t=`ENVMAP_BLENDING_MIX`;break;case 2:t=`ENVMAP_BLENDING_ADD`;break}return t}function Zt(e,t,n){var r=e.getContext(),i=n.defines,a=n.vertexShader,o=n.fragmentShader,s=qt(n),c=Jt(n),l=Yt(n),u=Xt(n),d=e.gammaFactor>0?e.gammaFactor:1,f=n.isWebGL2?``:Ft(n),p=It(i),m=r.createProgram(),h,g;if(n.isRawShaderMaterial?(h=[p].filter(Rt).join(`\n`),h.length>0&&(h+=`\n`),g=[f,p].filter(Rt).join(`\n`),g.length>0&&(g+=`\n`)):(h=[Kt(n),`#define SHADER_NAME `+n.shaderName,p,n.instancing?`#define USE_INSTANCING`:``,n.supportsVertexTextures?`#define VERTEX_TEXTURES`:``,`#define GAMMA_FACTOR `+d,`#define MAX_BONES `+n.maxBones,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMap&&n.objectSpaceNormalMap?`#define OBJECTSPACE_NORMALMAP`:``,n.normalMap&&n.tangentSpaceNormalMap?`#define TANGENTSPACE_NORMALMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.displacementMap&&n.supportsVertexTextures?`#define USE_DISPLACEMENTMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.vertexTangents?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexUvs?`#define USE_UV`:``,n.uvsVertexOnly?`#define UVS_VERTEX_ONLY`:``,n.flatShading?`#define FLAT_SHADED`:``,n.skinning?`#define USE_SKINNING`:``,n.useVertexTexture?`#define BONE_TEXTURE`:``,n.morphTargets?`#define USE_MORPHTARGETS`:``,n.morphNormals&&n.flatShading===!1?`#define USE_MORPHNORMALS`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+s:``,n.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?`#define USE_LOGDEPTHBUF_EXT`:``,`uniform mat4 modelMatrix;`,`uniform mat4 modelViewMatrix;`,`uniform mat4 projectionMatrix;`,`uniform mat4 viewMatrix;`,`uniform mat3 normalMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,`#ifdef USE_INSTANCING`,` attribute mat4 instanceMatrix;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#ifdef USE_COLOR`,` attribute vec3 color;`,`#endif`,`#ifdef USE_MORPHTARGETS`,` attribute vec3 morphTarget0;`,` attribute vec3 morphTarget1;`,` attribute vec3 morphTarget2;`,` attribute vec3 morphTarget3;`,` #ifdef USE_MORPHNORMALS`,` attribute vec3 morphNormal0;`,` attribute vec3 morphNormal1;`,` attribute vec3 morphNormal2;`,` attribute vec3 morphNormal3;`,` #else`,` attribute vec3 morphTarget4;`,` attribute vec3 morphTarget5;`,` attribute vec3 morphTarget6;`,` attribute vec3 morphTarget7;`,` #endif`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,`\n`].filter(Rt).join(`\n`),g=[f,Kt(n),`#define SHADER_NAME `+n.shaderName,p,n.alphaTest?`#define ALPHATEST `+n.alphaTest+(n.alphaTest%1?``:`.0`):``,`#define GAMMA_FACTOR `+d,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.matcap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+c:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMap&&n.objectSpaceNormalMap?`#define OBJECTSPACE_NORMALMAP`:``,n.normalMap&&n.tangentSpaceNormalMap?`#define TANGENTSPACE_NORMALMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.sheen?`#define USE_SHEEN`:``,n.vertexTangents?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexUvs?`#define USE_UV`:``,n.uvsVertexOnly?`#define UVS_VERTEX_ONLY`:``,n.gradientMap?`#define USE_GRADIENTMAP`:``,n.flatShading?`#define FLAT_SHADED`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+s:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.physicallyCorrectLights?`#define PHYSICALLY_CORRECT_LIGHTS`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?`#define USE_LOGDEPTHBUF_EXT`:``,(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?`#define TEXTURE_LOD_EXT`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:Q.tonemapping_pars_fragment,n.toneMapping===0?``:Pt(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?Q.encodings_pars_fragment:``,n.mapEncoding?Mt(`mapTexelToLinear`,n.mapEncoding):``,n.matcapEncoding?Mt(`matcapTexelToLinear`,n.matcapEncoding):``,n.envMapEncoding?Mt(`envMapTexelToLinear`,n.envMapEncoding):``,n.emissiveMapEncoding?Mt(`emissiveMapTexelToLinear`,n.emissiveMapEncoding):``,n.lightMapEncoding?Mt(`lightMapTexelToLinear`,n.lightMapEncoding):``,n.outputEncoding?Nt(`linearToOutputTexel`,n.outputEncoding):``,n.depthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,`\n`].filter(Rt).join(`\n`)),a=Vt(a),a=zt(a,n),a=Bt(a,n),o=Vt(o),o=zt(o,n),o=Bt(o,n),a=Ut(a),o=Ut(o),n.isWebGL2&&!n.isRawShaderMaterial){var _=!1,v=/^\\s*#version\\s+300\\s+es\\s*\\n/;n.isShaderMaterial&&a.match(v)!==null&&o.match(v)!==null&&(_=!0,a=a.replace(v,``),o=o.replace(v,``)),h=[`#version 300 es\n`,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(`\n`)+`\n`+h,g=[`#version 300 es\n`,`#define varying in`,_?``:`out highp vec4 pc_fragColor;`,_?``:`#define gl_FragColor pc_fragColor`,`#define gl_FragDepthEXT gl_FragDepth`,`#define texture2D texture`,`#define textureCube texture`,`#define texture2DProj textureProj`,`#define texture2DLodEXT textureLod`,`#define texture2DProjLodEXT textureProjLod`,`#define textureCubeLodEXT textureLod`,`#define texture2DGradEXT textureGrad`,`#define texture2DProjGradEXT textureProjGrad`,`#define textureCubeGradEXT textureGrad`].join(`\n`)+`\n`+g}var y=h+a,b=g+o,x=Ot(r,35633,y),S=Ot(r,35632,b);if(r.attachShader(m,x),r.attachShader(m,S),n.index0AttributeName===void 0?n.morphTargets===!0&&r.bindAttribLocation(m,0,`position`):r.bindAttribLocation(m,0,n.index0AttributeName),r.linkProgram(m),e.debug.checkShaderErrors){var C=r.getProgramInfoLog(m).trim(),w=r.getShaderInfoLog(x).trim(),T=r.getShaderInfoLog(S).trim(),E=!0,D=!0;if(r.getProgramParameter(m,35714)===!1){E=!1;var O=jt(r,x,`vertex`),k=jt(r,S,`fragment`);console.error(`THREE.WebGLProgram: shader error: `,r.getError(),`35715`,r.getProgramParameter(m,35715),`gl.getProgramInfoLog`,C,O,k)}else C===``?(w===``||T===``)&&(D=!1):console.warn(`THREE.WebGLProgram: gl.getProgramInfoLog()`,C);D&&(this.diagnostics={runnable:E,programLog:C,vertexShader:{log:w,prefix:h},fragmentShader:{log:T,prefix:g}})}r.deleteShader(x),r.deleteShader(S);var A;this.getUniforms=function(){return A===void 0&&(A=new Dt(r,m)),A};var j;return this.getAttributes=function(){return j===void 0&&(j=Lt(r,m)),j},this.destroy=function(){r.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=bu++,this.cacheKey=t,this.usedTimes=1,this.program=m,this.vertexShader=x,this.fragmentShader=S,this}function Qt(e,t,n){var r=[],i=n.isWebGL2,a=n.logarithmicDepthBuffer,o=n.floatVertexTextures,s=n.precision,c=n.maxVertexUniforms,l=n.vertexTextures,u={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distanceRGBA`,MeshNormalMaterial:`normal`,MeshBasicMaterial:`basic`,MeshLambertMaterial:`lambert`,MeshPhongMaterial:`phong`,MeshToonMaterial:`toon`,MeshStandardMaterial:`physical`,MeshPhysicalMaterial:`physical`,MeshMatcapMaterial:`matcap`,LineBasicMaterial:`basic`,LineDashedMaterial:`dashed`,PointsMaterial:`points`,ShadowMaterial:`shadow`,SpriteMaterial:`sprite`},d=`precision.isWebGL2.supportsVertexTextures.outputEncoding.instancing.map.mapEncoding.matcap.matcapEncoding.envMap.envMapMode.envMapEncoding.envMapCubeUV.lightMap.lightMapEncoding.aoMap.emissiveMap.emissiveMapEncoding.bumpMap.normalMap.objectSpaceNormalMap.tangentSpaceNormalMap.clearcoatMap.clearcoatRoughnessMap.clearcoatNormalMap.displacementMap.specularMap.roughnessMap.metalnessMap.gradientMap.alphaMap.combine.vertexColors.vertexTangents.vertexUvs.uvsVertexOnly.fog.useFog.fogExp2.flatShading.sizeAttenuation.logarithmicDepthBuffer.skinning.maxBones.useVertexTexture.morphTargets.morphNormals.maxMorphTargets.maxMorphNormals.premultipliedAlpha.numDirLights.numPointLights.numSpotLights.numHemiLights.numRectAreaLights.numDirLightShadows.numPointLightShadows.numSpotLightShadows.shadowMapEnabled.shadowMapType.toneMapping.physicallyCorrectLights.alphaTest.doubleSided.flipSided.numClippingPlanes.numClipIntersection.depthPacking.dithering.sheen`.split(`.`);function f(e,t){var n;if(t){var r=lu[t];n={name:e.type,uniforms:nu.clone(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader}}else n={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return n}function p(e){var t=e.skeleton.bones;if(o)return 1024;var n=Math.floor((c-20)/4),r=Math.min(n,t.length);return r<t.length?(console.warn(`THREE.WebGLRenderer: Skeleton has `+t.length+` bones. This GPU supports `+r+`.`),0):r}function m(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn(`THREE.WebGLPrograms.getTextureEncodingFromMap: don\'t use render targets as textures. Use their .texture property instead.`),t=e.texture.encoding):t=$s,t}this.getParameters=function(r,c,d,h,g,_,v){var y=h.fog,b=r.isMeshStandardMaterial?h.environment:null,x=r.envMap||b,S=u[r.type],C=v.isSkinnedMesh?p(v):0;r.precision!==null&&(s=n.getMaxPrecision(r.precision),s!==r.precision&&console.warn(`THREE.WebGLProgram.getParameters:`,r.precision,`not supported, using`,s,`instead.`));var w=f(r,S);r.onBeforeCompile(w,e);var T=e.getRenderTarget();return{isWebGL2:i,shaderID:S,shaderName:w.name,uniforms:w.uniforms,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,defines:r.defines,isRawShaderMaterial:r.isRawShaderMaterial,isShaderMaterial:r.isShaderMaterial,precision:s,instancing:v.isInstancedMesh===!0,supportsVertexTextures:l,outputEncoding:T===null?e.outputEncoding:m(T.texture),map:!!r.map,mapEncoding:m(r.map),matcap:!!r.matcap,matcapEncoding:m(r.matcap),envMap:!!x,envMapMode:x&&x.mapping,envMapEncoding:m(x),envMapCubeUV:!!x&&(x.mapping===306||x.mapping===307),lightMap:!!r.lightMap,lightMapEncoding:m(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:m(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:r.normalMapType===1,tangentSpaceNormalMap:r.normalMapType===0,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexUvs:!!r.map||!!r.bumpMap||!!r.normalMap||!!r.specularMap||!!r.alphaMap||!!r.emissiveMap||!!r.roughnessMap||!!r.metalnessMap||!!r.clearcoatMap||!!r.clearcoatRoughnessMap||!!r.clearcoatNormalMap||!!r.displacementMap,uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap)&&!!r.displacementMap,fog:!!y,useFog:r.fog,fogExp2:y&&y.isFogExp2,flatShading:r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:a,skinning:r.skinning&&C>0,maxBones:C,useVertexTexture:o,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:c.directional.length,numPointLights:c.point.length,numSpotLights:c.spot.length,numRectAreaLights:c.rectArea.length,numHemiLights:c.hemi.length,numDirLightShadows:c.directionalShadowMap.length,numPointLightShadows:c.pointShadowMap.length,numSpotLightShadows:c.spotShadowMap.length,numClippingPlanes:g,numClipIntersection:_,dithering:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:r.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===2,flipSided:r.side===1,depthPacking:r.depthPacking===void 0?!1:r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:i||t.get(`EXT_frag_depth`)!==null,rendererExtensionDrawBuffers:i||t.get(`WEBGL_draw_buffers`)!==null,rendererExtensionShaderTextureLod:i||t.get(`EXT_shader_texture_lod`)!==null,onBeforeCompile:r.onBeforeCompile}},this.getProgramCacheKey=function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),t.defines!==void 0)for(var r in t.defines)n.push(r),n.push(t.defines[r]);if(t.isRawShaderMaterial===void 0){for(var i=0;i<d.length;i++)n.push(t[d[i]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.onBeforeCompile.toString()),n.join()},this.acquireProgram=function(t,n){for(var i,a=0,o=r.length;a<o;a++){var s=r[a];if(s.cacheKey===n){i=s,++i.usedTimes;break}}return i===void 0&&(i=new Zt(e,n,t),r.push(i)),i},this.releaseProgram=function(e){if(--e.usedTimes===0){var t=r.indexOf(e);r[t]=r[r.length-1],r.pop(),e.destroy()}},this.programs=r}function $t(){var e=new WeakMap;function t(t){var n=e.get(t);return n===void 0&&(n={},e.set(t,n)),n}function n(t){e.delete(t)}function r(t,n,r){e.get(t)[n]=r}function i(){e=new WeakMap}return{get:t,remove:n,update:r,dispose:i}}function en(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.program===t.program?e.material.id===t.material.id?e.z===t.z?e.id-t.id:e.z-t.z:e.material.id-t.material.id:e.program.id-t.program.id:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function tn(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.z===t.z?e.id-t.id:t.z-e.z:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function nn(){var e=[],t=0,n=[],r=[],i={id:-1};function a(){t=0,n.length=0,r.length=0}function o(n,r,a,o,s,c){var l=e[t];return l===void 0?(l={id:n.id,object:n,geometry:r,material:a,program:a.program||i,groupOrder:o,renderOrder:n.renderOrder,z:s,group:c},e[t]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=a,l.program=a.program||i,l.groupOrder=o,l.renderOrder=n.renderOrder,l.z=s,l.group=c),t++,l}function s(e,t,i,a,s,c){var l=o(e,t,i,a,s,c);(i.transparent===!0?r:n).push(l)}function c(e,t,i,a,s,c){var l=o(e,t,i,a,s,c);(i.transparent===!0?r:n).unshift(l)}function l(e,t){n.length>1&&n.sort(e||en),r.length>1&&r.sort(t||tn)}function u(){for(var n=t,r=e.length;n<r;n++){var i=e[n];if(i.id===null)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}}return{opaque:n,transparent:r,init:a,push:s,unshift:c,finish:u,sort:l}}function rn(){var e=new WeakMap;function t(n){var r=n.target;r.removeEventListener(`dispose`,t),e.delete(r)}function n(n,r){var i=e.get(n),a;return i===void 0?(a=new nn,e.set(n,new WeakMap),e.get(n).set(r,a),n.addEventListener(`dispose`,t)):(a=i.get(r),a===void 0&&(a=new nn,i.set(r,a))),a}function r(){e=new WeakMap}return{get:n,dispose:r}}function an(){var e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];var n;switch(t.type){case`DirectionalLight`:n={direction:new D,color:new z};break;case`SpotLight`:n={position:new D,direction:new D,color:new z,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new D,color:new z,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new D,skyColor:new z,groundColor:new z};break;case`RectAreaLight`:n={color:new z,position:new D,halfWidth:new D,halfHeight:new D};break}return e[t.id]=n,n}}}function on(){var e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];var n;switch(t.type){case`DirectionalLight`:n={shadowBias:0,shadowRadius:1,shadowMapSize:new b};break;case`SpotLight`:n={shadowBias:0,shadowRadius:1,shadowMapSize:new b};break;case`PointLight`:n={shadowBias:0,shadowRadius:1,shadowMapSize:new b,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}function sn(e,t){return!!t.castShadow-+!!e.castShadow}function cn(){for(var e=new an,t=on(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},r=0;r<9;r++)n.probe.push(new D);var i=new D,a=new O,o=new O;function s(r,s,c){for(var l=0,u=0,d=0,f=0;f<9;f++)n.probe[f].set(0,0,0);var p=0,m=0,h=0,g=0,_=0,v=0,y=0,b=0,x=c.matrixWorldInverse;r.sort(sn);for(var f=0,S=r.length;f<S;f++){var C=r[f],w=C.color,T=C.intensity,E=C.distance,D=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)l+=w.r*T,u+=w.g*T,d+=w.b*T;else if(C.isLightProbe)for(var O=0;O<9;O++)n.probe[O].addScaledVector(C.sh.coefficients[O],T);else if(C.isDirectionalLight){var k=e.get(C);if(k.color.copy(C.color).multiplyScalar(C.intensity),k.direction.setFromMatrixPosition(C.matrixWorld),i.setFromMatrixPosition(C.target.matrixWorld),k.direction.sub(i),k.direction.transformDirection(x),C.castShadow){var A=C.shadow,j=t.get(C);j.shadowBias=A.bias,j.shadowRadius=A.radius,j.shadowMapSize=A.mapSize,n.directionalShadow[p]=j,n.directionalShadowMap[p]=D,n.directionalShadowMatrix[p]=C.shadow.matrix,v++}n.directional[p]=k,p++}else if(C.isSpotLight){var k=e.get(C);if(k.position.setFromMatrixPosition(C.matrixWorld),k.position.applyMatrix4(x),k.color.copy(w).multiplyScalar(T),k.distance=E,k.direction.setFromMatrixPosition(C.matrixWorld),i.setFromMatrixPosition(C.target.matrixWorld),k.direction.sub(i),k.direction.transformDirection(x),k.coneCos=Math.cos(C.angle),k.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),k.decay=C.decay,C.castShadow){var A=C.shadow,j=t.get(C);j.shadowBias=A.bias,j.shadowRadius=A.radius,j.shadowMapSize=A.mapSize,n.spotShadow[h]=j,n.spotShadowMap[h]=D,n.spotShadowMatrix[h]=C.shadow.matrix,b++}n.spot[h]=k,h++}else if(C.isRectAreaLight){var k=e.get(C);k.color.copy(w).multiplyScalar(T),k.position.setFromMatrixPosition(C.matrixWorld),k.position.applyMatrix4(x),o.identity(),a.copy(C.matrixWorld),a.premultiply(x),o.extractRotation(a),k.halfWidth.set(C.width*.5,0,0),k.halfHeight.set(0,C.height*.5,0),k.halfWidth.applyMatrix4(o),k.halfHeight.applyMatrix4(o),n.rectArea[g]=k,g++}else if(C.isPointLight){var k=e.get(C);if(k.position.setFromMatrixPosition(C.matrixWorld),k.position.applyMatrix4(x),k.color.copy(C.color).multiplyScalar(C.intensity),k.distance=C.distance,k.decay=C.decay,C.castShadow){var A=C.shadow,j=t.get(C);j.shadowBias=A.bias,j.shadowRadius=A.radius,j.shadowMapSize=A.mapSize,j.shadowCameraNear=A.camera.near,j.shadowCameraFar=A.camera.far,n.pointShadow[m]=j,n.pointShadowMap[m]=D,n.pointShadowMatrix[m]=C.shadow.matrix,y++}n.point[m]=k,m++}else if(C.isHemisphereLight){var k=e.get(C);k.direction.setFromMatrixPosition(C.matrixWorld),k.direction.transformDirection(x),k.direction.normalize(),k.skyColor.copy(C.color).multiplyScalar(T),k.groundColor.copy(C.groundColor).multiplyScalar(T),n.hemi[_]=k,_++}}n.ambient[0]=l,n.ambient[1]=u,n.ambient[2]=d;var M=n.hash;(M.directionalLength!==p||M.pointLength!==m||M.spotLength!==h||M.rectAreaLength!==g||M.hemiLength!==_||M.numDirectionalShadows!==v||M.numPointShadows!==y||M.numSpotShadows!==b)&&(n.directional.length=p,n.spot.length=h,n.rectArea.length=g,n.point.length=m,n.hemi.length=_,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.pointShadow.length=y,n.pointShadowMap.length=y,n.spotShadow.length=b,n.spotShadowMap.length=b,n.directionalShadowMatrix.length=v,n.pointShadowMatrix.length=y,n.spotShadowMatrix.length=b,M.directionalLength=p,M.pointLength=m,M.spotLength=h,M.rectAreaLength=g,M.hemiLength=_,M.numDirectionalShadows=v,M.numPointShadows=y,M.numSpotShadows=b,n.version=wu++)}return{setup:s,state:n}}function ln(){var e=new cn,t=[],n=[];function r(){t.length=0,n.length=0}function i(e){t.push(e)}function a(e){n.push(e)}function o(r){e.setup(t,n,r)}return{init:r,state:{lightsArray:t,shadowsArray:n,lights:e},setupLights:o,pushLight:i,pushShadow:a}}function un(){var e=new WeakMap;function t(n){var r=n.target;r.removeEventListener(`dispose`,t),e.delete(r)}function n(n,r){var i;return e.has(n)===!1?(i=new ln,e.set(n,new WeakMap),e.get(n).set(r,i),n.addEventListener(`dispose`,t)):e.get(n).has(r)===!1?(i=new ln,e.get(n).set(r,i)):i=e.get(n).get(r),i}function r(){e=new WeakMap}return{get:n,dispose:r}}function dn(e){V.call(this),this.type=`MeshDepthMaterial`,this.depthPacking=sc,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}function fn(e){V.call(this),this.type=`MeshDistanceMaterial`,this.referencePosition=new D,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}function pn(e,t,n){var r=new Se,i=new b,a=new b,o=new C,s=[],c=[],l={},u={0:1,1:0,2:2},d=new ge({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new b},radius:{value:4}},vertexShader:Eu,fragmentShader:Tu}),f=d.clone();f.defines.HORIZONAL_PASS=1;var p=new q;p.setAttribute(`position`,new H(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var m=new de(p,d),h=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,s,c){if(h.enabled!==!1&&!(h.autoUpdate===!1&&h.needsUpdate===!1)&&t.length!==0){var l=e.getRenderTarget(),u=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);for(var p=0,m=t.length;p<m;p++){var _=t[p],v=_.shadow;if(v===void 0){console.warn(`THREE.WebGLShadowMap:`,_,`has no shadow.`);continue}i.copy(v.mapSize);var y=v.getFrameExtents();if(i.multiply(y),a.copy(v.mapSize),(i.x>n||i.y>n)&&(i.x>n&&(a.x=Math.floor(n/y.x),i.x=a.x*y.x,v.mapSize.x=a.x),i.y>n&&(a.y=Math.floor(n/y.y),i.y=a.y*y.y,v.mapSize.y=a.y)),v.map===null&&!v.isPointLightShadow&&this.type===3){var b={minFilter:Ko,magFilter:Ko,format:es};v.map=new w(i.x,i.y,b),v.map.texture.name=_.name+`.shadowMap`,v.mapPass=new w(i.x,i.y,b),v.camera.updateProjectionMatrix()}if(v.map===null){var b={minFilter:Uo,magFilter:Uo,format:es};v.map=new w(i.x,i.y,b),v.map.texture.name=_.name+`.shadowMap`,v.camera.updateProjectionMatrix()}e.setRenderTarget(v.map),e.clear();for(var S=v.getViewportCount(),C=0;C<S;C++){var T=v.getViewport(C);o.set(a.x*T.x,a.y*T.y,a.x*T.z,a.y*T.w),f.viewport(o),v.updateMatrices(_,C),r=v.getFrustum(),x(s,c,v.camera,_,this.type)}!v.isPointLightShadow&&this.type===3&&g(v,c)}h.needsUpdate=!1,e.setRenderTarget(l,u,d)}};function g(n,r){var i=t.update(m);d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,i,d,m,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,f,m,null)}function _(e,t,n){var r=e<<0|t<<1|n<<2,i=s[r];return i===void 0&&(i=new dn({depthPacking:cc,morphTargets:e,skinning:t}),s[r]=i),i}function v(e,t,n){var r=e<<0|t<<1|n<<2,i=c[r];return i===void 0&&(i=new fn({morphTargets:e,skinning:t}),c[r]=i),i}function y(t,n,r,i,a,o,s){var c=null,d=_,f=t.customDepthMaterial;if(i.isPointLight===!0&&(d=v,f=t.customDistanceMaterial),f===void 0){var p=!1;r.morphTargets===!0&&(p=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);var m=!1;t.isSkinnedMesh===!0&&(r.skinning===!0?m=!0:console.warn(`THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:`,t));var h=t.isInstancedMesh===!0;c=d(p,m,h)}else c=f;if(e.localClippingEnabled&&r.clipShadows===!0&&r.clippingPlanes.length!==0){var g=c.uuid,y=r.uuid,b=l[g];b===void 0&&(b={},l[g]=b);var x=b[y];x===void 0&&(x=c.clone(),b[y]=x),c=x}return c.visible=r.visible,c.wireframe=r.wireframe,s===3?c.side=r.shadowSide===null?r.side:r.shadowSide:c.side=r.shadowSide===null?u[r.side]:r.shadowSide,c.clipShadows=r.clipShadows,c.clippingPlanes=r.clippingPlanes,c.clipIntersection=r.clipIntersection,c.wireframeLinewidth=r.wireframeLinewidth,c.linewidth=r.linewidth,i.isPointLight===!0&&c.isMeshDistanceMaterial===!0&&(c.referencePosition.setFromMatrixPosition(i.matrixWorld),c.nearDistance=a,c.farDistance=o),c}function x(n,i,a,o,s){if(n.visible!==!1){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var c=t.update(n),l=n.material;if(Array.isArray(l))for(var u=c.groups,d=0,f=u.length;d<f;d++){var p=u[d],m=l[p.materialIndex];if(m&&m.visible){var h=y(n,c,m,o,a.near,a.far,s);e.renderBufferDirect(a,null,c,h,n,p)}}else if(l.visible){var h=y(n,c,l,o,a.near,a.far,s);e.renderBufferDirect(a,null,c,h,n,null)}}for(var g=n.children,_=0,v=g.length;_<v;_++)x(g[_],i,a,o,s)}}}function mn(e,t,n){var r=n.isWebGL2;function i(){var t=!1,n=new C,r=null,i=new C(0,0,0,0);return{setMask:function(n){r!==n&&!t&&(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){s===!0&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),i.equals(n)===!1&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}}function a(){var t=!1,n=null,r=null,i=null;return{setTest:function(e){e?H(2929):U(2929)},setMask:function(r){n!==r&&!t&&(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}}function o(){var t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(e){t||(e?H(2960):U(2960))},setMask:function(r){n!==r&&!t&&(e.stencilMask(r),n=r)},setFunc:function(t,n,o){(r!==t||i!==n||a!==o)&&(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){(o!==t||s!==n||c!==r)&&(e.stencilOp(t,n,r),o=t,s=n,c=r)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null}}}var s=new i,c=new a,l=new o,u=e.getParameter(34921),d=new Uint8Array(u),f=new Uint8Array(u),p=new Uint8Array(u),m={},h=null,g=null,_=null,v=null,y=null,b=null,x=null,S=null,w=null,T=!1,E=null,D=null,O=null,k=null,A=null,j=e.getParameter(35661),M=!1,N=0,P=e.getParameter(7938);P.indexOf(`WebGL`)===-1?P.indexOf(`OpenGL ES`)!==-1&&(N=parseFloat(/^OpenGL\\ ES\\ ([0-9])/.exec(P)[1]),M=N>=2):(N=parseFloat(/^WebGL\\ ([0-9])/.exec(P)[1]),M=N>=1);var F=null,I={},L=new C,R=new C;function z(t,n,r){var i=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o<r;o++)e.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return a}var ee={};ee[3553]=z(3553,3553,1),ee[34067]=z(34067,34069,6),s.setClear(0,0,0,1),c.setClear(1),l.setClear(0),H(2929),c.setFunc(3),K(!1),ce(1),H(2884),oe(0);function te(){for(var e=0,t=d.length;e<t;e++)d[e]=0}function ne(e){B(e,0)}function B(n,i){d[n]=1,f[n]===0&&(e.enableVertexAttribArray(n),f[n]=1),p[n]!==i&&((r?e:t.get(`ANGLE_instanced_arrays`))[r?`vertexAttribDivisor`:`vertexAttribDivisorANGLE`](n,i),p[n]=i)}function V(){for(var t=0,n=f.length;t!==n;++t)f[t]!==d[t]&&(e.disableVertexAttribArray(t),f[t]=0)}function re(t,n,i,a,o,s){r===!0&&(i===5124||i===5125)?e.vertexAttribIPointer(t,n,i,a,o,s):e.vertexAttribPointer(t,n,i,a,o,s)}function H(t){m[t]!==!0&&(e.enable(t),m[t]=!0)}function U(t){m[t]!==!1&&(e.disable(t),m[t]=!1)}function ie(t){return h===t?!1:(e.useProgram(t),h=t,!0)}var W={100:32774,101:32778,102:32779};if(r)W[103]=32775,W[104]=32776;else{var ae=t.get(`EXT_blend_minmax`);ae!==null&&(W[103]=ae.MIN_EXT,W[104]=ae.MAX_EXT)}var G={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function oe(t,n,r,i,a,o,s,c){if(t===0){g&&(U(3042),g=!1);return}if(g||(H(3042),g=!0),t!==5){if(t!==_||c!==T){if((v!==100||x!==100)&&(e.blendEquation(32774),v=100,x=100),c)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,0,769,771);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error(`THREE.WebGLState: Invalid blending: `,t);break}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFunc(0,769);break;case 4:e.blendFunc(0,768);break;default:console.error(`THREE.WebGLState: Invalid blending: `,t);break}y=null,b=null,S=null,w=null,_=t,T=c}return}a=a||n,o=o||r,s=s||i,(n!==v||a!==x)&&(e.blendEquationSeparate(W[n],W[a]),v=n,x=a),(r!==y||i!==b||o!==S||s!==w)&&(e.blendFuncSeparate(G[r],G[i],G[o],G[s]),y=r,b=i,S=o,w=s),_=t,T=null}function se(e,t){e.side===2?U(2884):H(2884);var n=e.side===1;t&&(n=!n),K(n),e.blending===1&&e.transparent===!1?oe(0):oe(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),c.setFunc(e.depthFunc),c.setTest(e.depthTest),c.setMask(e.depthWrite),s.setMask(e.colorWrite);var r=e.stencilWrite;l.setTest(r),r&&(l.setMask(e.stencilWriteMask),l.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),l.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),ue(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function K(t){E!==t&&(t?e.frontFace(2304):e.frontFace(2305),E=t)}function ce(t){t===0?U(2884):(H(2884),t!==D&&(t===1?e.cullFace(1029):t===2?e.cullFace(1028):e.cullFace(1032))),D=t}function le(t){t!==O&&(M&&e.lineWidth(t),O=t)}function ue(t,n,r){t?(H(32823),(k!==n||A!==r)&&(e.polygonOffset(n,r),k=n,A=r)):U(32823)}function q(e){e?H(3089):U(3089)}function de(t){t===void 0&&(t=33984+j-1),F!==t&&(e.activeTexture(t),F=t)}function fe(t,n){F===null&&de();var r=I[F];r===void 0&&(r={type:void 0,texture:void 0},I[F]=r),(r.type!==t||r.texture!==n)&&(e.bindTexture(t,n||ee[t]),r.type=t,r.texture=n)}function pe(){var t=I[F];t!==void 0&&t.type!==void 0&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)}function J(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function me(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function he(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error(`THREE.WebGLState:`,e)}}function ge(t){L.equals(t)===!1&&(e.scissor(t.x,t.y,t.z,t.w),L.copy(t))}function _e(t){R.equals(t)===!1&&(e.viewport(t.x,t.y,t.z,t.w),R.copy(t))}function ve(){for(var t=0;t<f.length;t++)f[t]===1&&(e.disableVertexAttribArray(t),f[t]=0);m={},F=null,I={},h=null,_=null,E=null,D=null,s.reset(),c.reset(),l.reset()}return{buffers:{color:s,depth:c,stencil:l},initAttributes:te,enableAttribute:ne,enableAttributeAndDivisor:B,disableUnusedAttributes:V,vertexAttribPointer:re,enable:H,disable:U,useProgram:ie,setBlending:oe,setMaterial:se,setFlipSided:K,setCullFace:ce,setLineWidth:le,setPolygonOffset:ue,setScissorTest:q,activeTexture:de,bindTexture:fe,unbindTexture:pe,compressedTexImage2D:J,texImage2D:me,texImage3D:he,scissor:ge,viewport:_e,reset:ve}}function hn(e,t,n,r,i,a,o){var s=i.isWebGL2,c=i.maxTextures,l=i.maxCubemapSize,u=i.maxTextureSize,d=i.maxSamples,f=new WeakMap,p,m=!1;try{m=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch(e){}function h(e,t){return m?new OffscreenCanvas(e,t):document.createElementNS(`http://www.w3.org/1999/xhtml`,`canvas`)}function g(e,t,n,r){var i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||t===!0)if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){var a=t?X.floorPowerOfTwo:Math.floor,o=a(i*e.width),s=a(i*e.height);p===void 0&&(p=h(o,s));var c=n?h(o,s):p;return c.width=o,c.height=s,c.getContext(`2d`).drawImage(e,0,0,o,s),console.warn(`THREE.WebGLRenderer: Texture has been resized from (`+e.width+`x`+e.height+`) to (`+o+`x`+s+`).`),c}else return`data`in e&&console.warn(`THREE.WebGLRenderer: Image in DataTexture is too big (`+e.width+`x`+e.height+`).`),e;return e}function _(e){return X.isPowerOfTwo(e.width)&&X.isPowerOfTwo(e.height)}function v(e){return s?!1:e.wrapS!==1001||e.wrapT!==1001||e.minFilter!==1003&&e.minFilter!==1006}function y(e,t){return e.generateMipmaps&&t&&e.minFilter!==1003&&e.minFilter!==1006}function b(t,n,i,a){e.generateMipmap(t);var o=r.get(n);o.__maxMipLevel=Math.log(Math.max(i,a))*Math.LOG2E}function x(n,r,i){if(s===!1)return r;if(n!==null){if(e[n]!==void 0)return e[n];console.warn(`THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'`+n+`\'`)}var a=r;return r===6403&&(i===5126&&(a=33326),i===5131&&(a=33325),i===5121&&(a=33321)),r===6407&&(i===5126&&(a=34837),i===5131&&(a=34843),i===5121&&(a=32849)),r===6408&&(i===5126&&(a=34836),i===5131&&(a=34842),i===5121&&(a=32856)),(a===33325||a===33326||a===34842||a===34836)&&t.get(`EXT_color_buffer_float`),a}function S(e){return e===1003||e===1004||e===1005?9728:9729}function C(e){var t=e.target;t.removeEventListener(`dispose`,C),T(t),t.isVideoTexture&&f.delete(t),o.memory.textures--}function w(e){var t=e.target;t.removeEventListener(`dispose`,w),E(t),o.memory.textures--}function T(t){var n=r.get(t);n.__webglInit!==void 0&&(e.deleteTexture(n.__webglTexture),r.remove(t))}function E(t){var n=r.get(t),i=r.get(t.texture);if(t){if(i.__webglTexture!==void 0&&e.deleteTexture(i.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);r.remove(t.texture),r.remove(t)}}var D=0;function O(){D=0}function k(){var e=D;return e>=c&&console.warn(`THREE.WebGLTextures: Trying to use `+e+` texture units while this GPU supports only `+c),D+=1,e}function A(e,t){var i=r.get(e);if(e.isVideoTexture&&ie(e),e.version>0&&i.__version!==e.version){var a=e.image;if(a===void 0)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is undefined`);else if(a.complete===!1)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is incomplete`);else{z(i,e,t);return}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}function j(e,t){var i=r.get(e);if(e.version>0&&i.__version!==e.version){z(i,e,t);return}n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture)}function M(e,t){var i=r.get(e);if(e.version>0&&i.__version!==e.version){z(i,e,t);return}n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture)}function N(t,i){if(t.image.length===6){var o=r.get(t);if(t.version>0&&o.__version!==t.version){R(o,t),n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture),e.pixelStorei(37440,t.flipY);for(var c=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),u=t.image[0]&&t.image[0].isDataTexture,d=[],f=0;f<6;f++)!c&&!u?d[f]=g(t.image[f],!1,!0,l):d[f]=u?t.image[f].image:t.image[f];var p=d[0],m=_(p)||s,h=a.convert(t.format),v=a.convert(t.type),S=x(t.internalFormat,h,v);L(34067,t,m);var C;if(c){for(var f=0;f<6;f++){C=d[f].mipmaps;for(var w=0;w<C.length;w++){var T=C[w];t.format!==1023&&t.format!==1022?h===null?console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()`):n.compressedTexImage2D(34069+f,w,S,T.width,T.height,0,T.data):n.texImage2D(34069+f,w,S,T.width,T.height,0,h,v,T.data)}}o.__maxMipLevel=C.length-1}else{C=t.mipmaps;for(var f=0;f<6;f++)if(u){n.texImage2D(34069+f,0,S,d[f].width,d[f].height,0,h,v,d[f].data);for(var w=0;w<C.length;w++){var T=C[w],E=T.image[f].image;n.texImage2D(34069+f,w+1,S,E.width,E.height,0,h,v,E.data)}}else{n.texImage2D(34069+f,0,S,h,v,d[f]);for(var w=0;w<C.length;w++){var T=C[w];n.texImage2D(34069+f,w+1,S,h,v,T.image[f])}}o.__maxMipLevel=C.length}y(t,m)&&b(34067,t,p.width,p.height),o.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture)}}function P(e,t){n.activeTexture(33984+t),n.bindTexture(34067,r.get(e).__webglTexture)}var F={[Bo]:10497,[Vo]:33071,[Ho]:33648},I={[Uo]:9728,[Wo]:9984,[Go]:9986,[Ko]:9729,[qo]:9985,[Jo]:9987};function L(n,a,o){o?(e.texParameteri(n,10242,F[a.wrapS]),e.texParameteri(n,10243,F[a.wrapT]),(n===32879||n===35866)&&e.texParameteri(n,32882,F[a.wrapR]),e.texParameteri(n,10240,I[a.magFilter]),e.texParameteri(n,10241,I[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),(n===32879||n===35866)&&e.texParameteri(n,32882,33071),(a.wrapS!==1001||a.wrapT!==1001)&&console.warn(`THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.`),e.texParameteri(n,10240,S(a.magFilter)),e.texParameteri(n,10241,S(a.minFilter)),a.minFilter!==1003&&a.minFilter!==1006&&console.warn(`THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.`));var c=t.get(`EXT_texture_filter_anisotropic`);if(c){if(a.type===1015&&t.get(`OES_texture_float_linear`)===null||a.type===1016&&(s||t.get(`OES_texture_half_float_linear`))===null)return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function R(t,n){t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,C),t.__webglTexture=e.createTexture(),o.memory.textures++)}function z(t,r,i){var o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),R(t,r),n.activeTexture(33984+i),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment);var c=v(r)&&_(r.image)===!1,l=g(r.image,c,!1,u),d=_(l)||s,f=a.convert(r.format),p=a.convert(r.type),m=x(r.internalFormat,f,p);L(o,r,d);var h,S=r.mipmaps;if(r.isDepthTexture)m=6402,s?m=r.type===1015?36012:r.type===1014?33190:r.type===1020?35056:33189:r.type===1015&&console.error(`WebGLRenderer: Floating point depth texture requires WebGL2.`),r.format===1026&&m===6402&&r.type!==1012&&r.type!==1014&&(console.warn(`THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.`),r.type=Xo,p=a.convert(r.type)),r.format===1027&&m===6402&&(m=34041,r.type!==1020&&(console.warn(`THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.`),r.type=Qo,p=a.convert(r.type))),n.texImage2D(3553,0,m,l.width,l.height,0,f,p,null);else if(r.isDataTexture)if(S.length>0&&d){for(var C=0,w=S.length;C<w;C++)h=S[C],n.texImage2D(3553,C,m,h.width,h.height,0,f,p,h.data);r.generateMipmaps=!1,t.__maxMipLevel=S.length-1}else n.texImage2D(3553,0,m,l.width,l.height,0,f,p,l.data),t.__maxMipLevel=0;else if(r.isCompressedTexture){for(var C=0,w=S.length;C<w;C++)h=S[C],r.format!==1023&&r.format!==1022?f===null?console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`):n.compressedTexImage2D(3553,C,m,h.width,h.height,0,h.data):n.texImage2D(3553,C,m,h.width,h.height,0,f,p,h.data);t.__maxMipLevel=S.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,m,l.width,l.height,l.depth,0,f,p,l.data),t.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,m,l.width,l.height,l.depth,0,f,p,l.data),t.__maxMipLevel=0;else if(S.length>0&&d){for(var C=0,w=S.length;C<w;C++)h=S[C],n.texImage2D(3553,C,m,f,p,h);r.generateMipmaps=!1,t.__maxMipLevel=S.length-1}else n.texImage2D(3553,0,m,f,p,l),t.__maxMipLevel=0;y(r,d)&&b(o,r,l.width,l.height),t.__version=r.version,r.onUpdate&&r.onUpdate(r)}function ee(t,i,o,s){var c=a.convert(i.texture.format),l=a.convert(i.texture.type),u=x(i.texture.internalFormat,c,l);n.texImage2D(s,0,u,i.width,i.height,0,c,l,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,s,r.get(i.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function te(t,n,r){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var i=33189;if(r){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===1015?i=36012:o.type===1014&&(i=33190));var s=U(n);e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(r){var s=U(n);e.renderbufferStorageMultisample(36161,s,35056,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var c=a.convert(n.texture.format),l=a.convert(n.texture.type),i=x(n.texture.internalFormat,c,l);if(r){var s=U(n);e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height)}e.bindRenderbuffer(36161,null)}function ne(t,n){if(n&&n.isWebGLCubeRenderTarget)throw Error(`Depth Texture with cube render targets is not supported`);if(e.bindFramebuffer(36160,t),!(n.depthTexture&&n.depthTexture.isDepthTexture))throw Error(`renderTarget.depthTexture must be an instance of THREE.DepthTexture`);(!r.get(n.depthTexture).__webglTexture||n.depthTexture.image.width!==n.width||n.depthTexture.image.height!==n.height)&&(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),A(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===1026)e.framebufferTexture2D(36160,36096,3553,i,0);else if(n.depthTexture.format===1027)e.framebufferTexture2D(36160,33306,3553,i,0);else throw Error(`Unknown depthTexture format`)}function B(t){var n=r.get(t),i=t.isWebGLCubeRenderTarget===!0;if(t.depthTexture){if(i)throw Error(`target.depthTexture not supported in Cube render targets`);ne(n.__webglFramebuffer,t)}else if(i){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=e.createRenderbuffer(),te(n.__webglDepthbuffer[a],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),te(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function V(t){var i=r.get(t),c=r.get(t.texture);t.addEventListener(`dispose`,w),c.__webglTexture=e.createTexture(),o.memory.textures++;var l=t.isWebGLCubeRenderTarget===!0,u=t.isWebGLMultisampleRenderTarget===!0,d=_(t)||s;if(s&&t.texture.format===1022&&(t.texture.type===1015||t.texture.type===1016)&&(t.texture.format=es,console.warn(`THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.`)),l){i.__webglFramebuffer=[];for(var f=0;f<6;f++)i.__webglFramebuffer[f]=e.createFramebuffer()}else if(i.__webglFramebuffer=e.createFramebuffer(),u)if(s){i.__webglMultisampledFramebuffer=e.createFramebuffer(),i.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,i.__webglColorRenderbuffer);var p=a.convert(t.texture.format),m=a.convert(t.texture.type),h=x(t.texture.internalFormat,p,m),g=U(t);e.renderbufferStorageMultisample(36161,g,h,t.width,t.height),e.bindFramebuffer(36160,i.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,i.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(i.__webglDepthRenderbuffer=e.createRenderbuffer(),te(i.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn(`THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.`);if(l){n.bindTexture(34067,c.__webglTexture),L(34067,t.texture,d);for(var f=0;f<6;f++)ee(i.__webglFramebuffer[f],t,36064,34069+f);y(t.texture,d)&&b(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,c.__webglTexture),L(3553,t.texture,d),ee(i.__webglFramebuffer,t,36064,3553),y(t.texture,d)&&b(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&B(t)}function re(e){var t=e.texture;if(y(t,_(e)||s)){var i=e.isWebGLCubeRenderTarget?34067:3553,a=r.get(t).__webglTexture;n.bindTexture(i,a),b(i,t,e.width,e.height),n.bindTexture(i,null)}}function H(t){if(t.isWebGLMultisampleRenderTarget)if(s){var n=r.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var i=t.width,a=t.height,o=16384;t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024),e.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn(`THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.`)}function U(e){return s&&e.isWebGLMultisampleRenderTarget?Math.min(d,e.samples):0}function ie(e){var t=o.render.frame;f.get(e)!==t&&(f.set(e,t),e.update())}var W=!1,ae=!1;function G(e,t){e&&e.isWebGLRenderTarget&&(W===!1&&(console.warn(`THREE.WebGLTextures.safeSetTexture2D: don\'t use render targets as textures. Use their .texture property instead.`),W=!0),e=e.texture),A(e,t)}function oe(e,t){e&&e.isWebGLCubeRenderTarget&&(ae===!1&&(console.warn(`THREE.WebGLTextures.safeSetTextureCube: don\'t use cube render targets as textures. Use their .texture property instead.`),ae=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&e.image.length===6?N(e,t):P(e,t)}this.allocateTextureUnit=k,this.resetTextureUnits=O,this.setTexture2D=A,this.setTexture2DArray=j,this.setTexture3D=M,this.setTextureCube=N,this.setTextureCubeDynamic=P,this.setupRenderTarget=V,this.updateRenderTargetMipmap=re,this.updateMultisampleRenderTarget=H,this.safeSetTexture2D=G,this.safeSetTextureCube=oe}function gn(e,t,n){var r=n.isWebGL2;function i(e){var n;if(e===1009)return 5121;if(e===1017)return 32819;if(e===1018)return 32820;if(e===1019)return 33635;if(e===1010)return 5120;if(e===1011)return 5122;if(e===1012)return 5123;if(e===1013)return 5124;if(e===1014)return 5125;if(e===1015)return 5126;if(e===1016)return r?5131:(n=t.get(`OES_texture_half_float`),n===null?null:n.HALF_FLOAT_OES);if(e===1021)return 6406;if(e===1022)return 6407;if(e===1023)return 6408;if(e===1024)return 6409;if(e===1025)return 6410;if(e===1026)return 6402;if(e===1027)return 34041;if(e===1028)return 6403;if(e===1029)return 36244;if(e===1030)return 33319;if(e===1031)return 33320;if(e===1032)return 36248;if(e===1033)return 36249;if(e===33776||e===33777||e===33778||e===33779)if(n=t.get(`WEBGL_compressed_texture_s3tc`),n!==null){if(e===33776)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===33777)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===33778)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===33779)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===35840||e===35841||e===35842||e===35843)if(n=t.get(`WEBGL_compressed_texture_pvrtc`),n!==null){if(e===35840)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===35841)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===35842)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===35843)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===36196)return n=t.get(`WEBGL_compressed_texture_etc1`),n===null?null:n.COMPRESSED_RGB_ETC1_WEBGL;if((e===37492||e===37496)&&(n=t.get(`WEBGL_compressed_texture_etc`),n!==null)){if(e===37492)return n.COMPRESSED_RGB8_ETC2;if(e===37496)return n.COMPRESSED_RGBA8_ETC2_EAC}if(e===37808||e===37809||e===37810||e===37811||e===37812||e===37813||e===37814||e===37815||e===37816||e===37817||e===37818||e===37819||e===37820||e===37821||e===37840||e===37841||e===37842||e===37843||e===37844||e===37845||e===37846||e===37847||e===37848||e===37849||e===37850||e===37851||e===37852||e===37853)return n=t.get(`WEBGL_compressed_texture_astc`),n===null?null:e;if(e===36492)return n=t.get(`EXT_texture_compression_bptc`),n===null?null:e;if(e===1020)return r?34042:(n=t.get(`WEBGL_depth_texture`),n===null?null:n.UNSIGNED_INT_24_8_WEBGL)}return{convert:i}}function _n(e){ve.call(this),this.cameras=e||[]}function vn(){j.call(this),this.type=`Group`}function yn(){this._targetRay=null,this._grip=null}function bn(e,t){var n=this,r=null,i=1,a=null,o=`local-floor`,s=null,c=[],l=new Map,u=new ve;u.layers.enable(1),u.viewport=new C;var d=new ve;d.layers.enable(2),d.viewport=new C;var f=[u,d],p=new _n;p.layers.enable(1),p.layers.enable(2);var m=null,h=null;this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=c[e];return t===void 0&&(t=new yn,c[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){var t=c[e];return t===void 0&&(t=new yn,c[e]=t),t.getGripSpace()};function g(e){var t=l.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}function _(){l.forEach(function(e,t){e.disconnect(t)}),l.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),O.stop(),n.isPresenting=!1,n.dispatchEvent({type:`sessionend`})}function v(e){a=e,O.setContext(r),O.start(),n.isPresenting=!0,n.dispatchEvent({type:`sessionstart`})}this.setFramebufferScaleFactor=function(e){i=e,n.isPresenting===!0&&console.warn(`THREE.WebXRManager: Cannot change framebuffer scale while presenting.`)},this.setReferenceSpaceType=function(e){o=e,n.isPresenting===!0&&console.warn(`THREE.WebXRManager: Cannot change reference space type while presenting.`)},this.getReferenceSpace=function(){return a},this.getSession=function(){return r},this.setSession=function(e){if(r=e,r!==null){r.addEventListener(`select`,g),r.addEventListener(`selectstart`,g),r.addEventListener(`selectend`,g),r.addEventListener(`squeeze`,g),r.addEventListener(`squeezestart`,g),r.addEventListener(`squeezeend`,g),r.addEventListener(`end`,_);var n=t.getContextAttributes();n.xrCompatible!==!0&&t.makeXRCompatible();var a={antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:i},s=new XRWebGLLayer(r,t,a);r.updateRenderState({baseLayer:s}),r.requestReferenceSpace(o).then(v),r.addEventListener(`inputsourceschange`,y)}};function y(e){for(var t=r.inputSources,n=0;n<c.length;n++)l.set(t[n],c[n]);for(var n=0;n<e.removed.length;n++){var i=e.removed[n],a=l.get(i);a&&(a.dispatchEvent({type:`disconnected`,data:i}),l.delete(i))}for(var n=0;n<e.added.length;n++){var i=e.added[n],a=l.get(i);a&&a.dispatchEvent({type:`connected`,data:i})}}var b=new D,x=new D;function S(e,t,n){b.setFromMatrixPosition(t.matrixWorld),x.setFromMatrixPosition(n.matrixWorld);var r=b.distanceTo(x),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var g=o+m,_=s+m,v=f-h,y=p+(r-h),S=c*s/_*g,C=l*s/_*g;e.projectionMatrix.makePerspective(v,y,S,C,g,_)}function w(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){p.near=d.near=u.near=e.near,p.far=d.far=u.far=e.far,(m!==p.near||h!==p.far)&&(r.updateRenderState({depthNear:p.near,depthFar:p.far}),m=p.near,h=p.far);var t=e.parent,n=p.cameras;w(p,t);for(var i=0;i<n.length;i++)w(n[i],t);e.matrixWorld.copy(p.matrixWorld);for(var a=e.children,i=0,o=a.length;i<o;i++)a[i].updateMatrixWorld(!0);return n.length===2?S(p,u,d):p.projectionMatrix.copy(u.projectionMatrix),p};var T=null;function E(t,n){if(s=n.getViewerPose(a),s!==null){var i=s.views,o=r.renderState.baseLayer;e.setFramebuffer(o.framebuffer);var l=!1;i.length!==p.cameras.length&&(p.cameras.length=0,l=!0);for(var u=0;u<i.length;u++){var d=i[u],m=o.getViewport(d),h=f[u];h.matrix.fromArray(d.transform.matrix),h.projectionMatrix.fromArray(d.projectionMatrix),h.viewport.set(m.x,m.y,m.width,m.height),u===0&&p.matrix.copy(h.matrix),l===!0&&p.cameras.push(h)}}for(var g=r.inputSources,u=0;u<c.length;u++){var _=c[u],v=g[u];_.update(v,n,a)}T&&T(t,n)}var O=new Ce;O.setAnimationLoop(E),this.setAnimationLoop=function(e){T=e},this.dispose=function(){}}function xn(e){function t(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}function n(e,t,n,_,v){t.isMeshBasicMaterial?r(e,t):t.isMeshLambertMaterial?(r(e,t),c(e,t)):t.isMeshToonMaterial?(r(e,t),u(e,t)):t.isMeshPhongMaterial?(r(e,t),l(e,t)):t.isMeshStandardMaterial?(r(e,t,n),t.isMeshPhysicalMaterial?f(e,t,n):d(e,t,n)):t.isMeshMatcapMaterial?(r(e,t),p(e,t)):t.isMeshDepthMaterial?(r(e,t),m(e,t)):t.isMeshDistanceMaterial?(r(e,t),h(e,t)):t.isMeshNormalMaterial?(r(e,t),g(e,t)):t.isLineBasicMaterial?(i(e,t),t.isLineDashedMaterial&&a(e,t)):t.isPointsMaterial?o(e,t,_,v):t.isSpriteMaterial?s(e,t):t.isShadowMaterial?(e.color.value.copy(t.color),e.opacity.value=t.opacity):t.isShaderMaterial&&(t.uniformsNeedUpdate=!1)}function r(t,n,r){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map),n.alphaMap&&(t.alphaMap.value=n.alphaMap),n.specularMap&&(t.specularMap.value=n.specularMap);var i=n.envMap||r;i&&(t.envMap.value=i,t.flipEnvMap.value=i.isCubeTexture?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio,t.maxMipLevel.value=e.get(i).__maxMipLevel),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity);var a;n.map?a=n.map:n.specularMap?a=n.specularMap:n.displacementMap?a=n.displacementMap:n.normalMap?a=n.normalMap:n.bumpMap?a=n.bumpMap:n.roughnessMap?a=n.roughnessMap:n.metalnessMap?a=n.metalnessMap:n.alphaMap?a=n.alphaMap:n.emissiveMap&&(a=n.emissiveMap),a!==void 0&&(a.isWebGLRenderTarget&&(a=a.texture),a.matrixAutoUpdate===!0&&a.updateMatrix(),t.uvTransform.value.copy(a.matrix));var o;n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),o!==void 0&&(o.isWebGLRenderTarget&&(o=o.texture),o.matrixAutoUpdate===!0&&o.updateMatrix(),t.uv2Transform.value.copy(o.matrix))}function i(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}function a(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function o(e,t,n,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=r*.5,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap);var i;t.map?i=t.map:t.alphaMap&&(i=t.alphaMap),i!==void 0&&(i.matrixAutoUpdate===!0&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}function s(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),n!==void 0&&(n.matrixAutoUpdate===!0&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}function c(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}function l(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function d(e,t,n){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||n)&&(e.envMapIntensity.value=t.envMapIntensity)}function f(e,t,n){d(e,t,n),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen),t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===1&&e.clearcoatNormalScale.value.negate()),e.transparency.value=t.transparency}function p(e,t){t.matcap&&(e.matcap.value=t.matcap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function m(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function h(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}function g(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===1&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===1&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}return{refreshFogUniforms:t,refreshMaterialUniforms:n}}function Sn(e){e=e||{};var t=e.canvas===void 0?document.createElementNS(`http://www.w3.org/1999/xhtml`,`canvas`):e.canvas,n=e.context===void 0?null:e.context,r=e.alpha===void 0?!1:e.alpha,i=e.depth===void 0?!0:e.depth,a=e.stencil===void 0?!0:e.stencil,o=e.antialias===void 0?!1:e.antialias,s=e.premultipliedAlpha===void 0?!0:e.premultipliedAlpha,c=e.preserveDrawingBuffer===void 0?!1:e.preserveDrawingBuffer,l=e.powerPreference===void 0?`default`:e.powerPreference,u=e.failIfMajorPerformanceCaveat===void 0?!1:e.failIfMajorPerformanceCaveat,d=null,f=null;this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=$s,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var p=this,m=!1,h=null,g=0,_=0,v=null,y=null,x=-1,S={geometry:null,program:null,wireframe:!1},w=null,T=null,E=new C,k=new C,A=null,j=t.width,N=t.height,P=1,F=null,I=null,L=new C(0,0,j,N),R=new C(0,0,j,N),z=!1,ee=new Se,te=new Ae,ne=!1,B=!1,V=new O,re=new D;function H(){return v===null?P:1}var U;try{var ie={alpha:r,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(t.addEventListener(`webglcontextlost`,Te,!1),t.addEventListener(`webglcontextrestored`,Ee,!1),U=n||t.getContext(`webgl`,ie)||t.getContext(`experimental-webgl`,ie),U===null)throw t.getContext(`webgl`)===null?Error(`Error creating WebGL context.`):Error(`Error creating WebGL context with your selected attributes.`);U.getShaderPrecisionFormat===void 0&&(U.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error(`THREE.WebGLRenderer: `+e.message),e}var W,ae,G,oe,se,K,ce,le,ue,q,de,fe,pe,J,me,he,ge,_e;function ve(){W=new je(U),ae=new ke(U,W,e),ae.isWebGL2===!1&&(W.get(`WEBGL_depth_texture`),W.get(`OES_texture_float`),W.get(`OES_texture_half_float`),W.get(`OES_texture_half_float_linear`),W.get(`OES_standard_derivatives`),W.get(`OES_element_index_uint`),W.get(`ANGLE_instanced_arrays`)),W.get(`OES_texture_float_linear`),_e=new gn(U,W,ae),G=new mn(U,W,ae),G.scissor(k.copy(R).multiplyScalar(P).floor()),G.viewport(E.copy(L).multiplyScalar(P).floor()),oe=new Pe(U),se=new $t,K=new hn(U,W,G,se,ae,_e,oe),ce=new we(U,ae),le=new Me(U,ce,oe),ue=new Le(U,le,ce,oe),me=new Ie(U),q=new Qt(p,W,ae),de=new xn(se),fe=new rn,pe=new un,J=new De(p,G,ue,s),he=new Oe(U,W,oe,ae),ge=new Ne(U,W,oe,ae),oe.programs=q.programs,p.capabilities=ae,p.extensions=W,p.properties=se,p.renderLists=fe,p.state=G,p.info=oe}ve();var ye=new bn(p,U);this.xr=ye;var be=new pn(p,ue,ae.maxTextureSize);this.shadowMap=be,this.getContext=function(){return U},this.getContextAttributes=function(){return U.getContextAttributes()},this.forceContextLoss=function(){var e=W.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){var e=W.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(e){e!==void 0&&(P=e,this.setSize(j,N,!1))},this.getSize=function(e){return e===void 0&&(console.warn(`WebGLRenderer: .getsize() now requires a Vector2 as an argument`),e=new b),e.set(j,N)},this.setSize=function(e,n,r){if(ye.isPresenting){console.warn(`THREE.WebGLRenderer: Can\'t change size while VR device is presenting.`);return}j=e,N=n,t.width=Math.floor(e*P),t.height=Math.floor(n*P),r!==!1&&(t.style.width=e+`px`,t.style.height=n+`px`),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e===void 0&&(console.warn(`WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument`),e=new b),e.set(j*P,N*P).floor()},this.setDrawingBufferSize=function(e,n,r){j=e,N=n,P=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e===void 0&&(console.warn(`WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument`),e=new C),e.copy(E)},this.getViewport=function(e){return e.copy(L)},this.setViewport=function(e,t,n,r){e.isVector4?L.set(e.x,e.y,e.z,e.w):L.set(e,t,n,r),G.viewport(E.copy(L).multiplyScalar(P).floor())},this.getScissor=function(e){return e.copy(R)},this.setScissor=function(e,t,n,r){e.isVector4?R.set(e.x,e.y,e.z,e.w):R.set(e,t,n,r),G.scissor(k.copy(R).multiplyScalar(P).floor())},this.getScissorTest=function(){return z},this.setScissorTest=function(e){G.setScissorTest(z=e)},this.setOpaqueSort=function(e){F=e},this.setTransparentSort=function(e){I=e},this.getClearColor=function(){return J.getClearColor()},this.setClearColor=function(){J.setClearColor.apply(J,arguments)},this.getClearAlpha=function(){return J.getClearAlpha()},this.setClearAlpha=function(){J.setClearAlpha.apply(J,arguments)},this.clear=function(e,t,n){var r=0;(e===void 0||e)&&(r|=16384),(t===void 0||t)&&(r|=256),(n===void 0||n)&&(r|=1024),U.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener(`webglcontextlost`,Te,!1),t.removeEventListener(`webglcontextrestored`,Ee,!1),fe.dispose(),pe.dispose(),se.dispose(),ue.dispose(),ye.dispose(),Ge.stop()};function Te(e){e.preventDefault(),console.log(`THREE.WebGLRenderer: Context Lost.`),m=!0}function Ee(){console.log(`THREE.WebGLRenderer: Context Restored.`),m=!1,ve()}function Fe(e){var t=e.target;t.removeEventListener(`dispose`,Fe),Re(t)}function Re(e){ze(e),se.remove(e)}function ze(e){var t=se.get(e).program;e.program=void 0,t!==void 0&&q.releaseProgram(t)}function Be(e,t){e.render(function(e){p.renderBufferImmediate(e,t)})}this.renderBufferImmediate=function(e,t){G.initAttributes();var n=se.get(e);e.hasPositions&&!n.position&&(n.position=U.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=U.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=U.createBuffer()),e.hasColors&&!n.color&&(n.color=U.createBuffer());var r=t.getAttributes();e.hasPositions&&(U.bindBuffer(34962,n.position),U.bufferData(34962,e.positionArray,35048),G.enableAttribute(r.position),U.vertexAttribPointer(r.position,3,5126,!1,0,0)),e.hasNormals&&(U.bindBuffer(34962,n.normal),U.bufferData(34962,e.normalArray,35048),G.enableAttribute(r.normal),U.vertexAttribPointer(r.normal,3,5126,!1,0,0)),e.hasUvs&&(U.bindBuffer(34962,n.uv),U.bufferData(34962,e.uvArray,35048),G.enableAttribute(r.uv),U.vertexAttribPointer(r.uv,2,5126,!1,0,0)),e.hasColors&&(U.bindBuffer(34962,n.color),U.bufferData(34962,e.colorArray,35048),G.enableAttribute(r.color),U.vertexAttribPointer(r.color,3,5126,!1,0,0)),G.disableUnusedAttributes(),U.drawArrays(4,0,e.count),e.count=0};var Ve=new M;this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=Ve);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=Xe(e,t,r,i);G.setMaterial(r,o);var c=!1;(S.geometry!==n.id||S.program!==s.id||S.wireframe!==(r.wireframe===!0))&&(S.geometry=n.id,S.program=s.id,S.wireframe=r.wireframe===!0,c=!0),(r.morphTargets||r.morphNormals)&&(me.update(i,n,r,s),c=!0),i.isInstancedMesh===!0&&(c=!0);var l=n.index,u=n.attributes.position;if(l===null){if(u===void 0||u.count===0)return}else if(l.count===0)return;var d=1;r.wireframe===!0&&(l=le.getWireframeAttribute(n),d=2);var f,p=he;l!==null&&(f=ce.get(l),p=ge,p.setIndex(f)),c&&(He(i,n,r,s),l!==null&&U.bindBuffer(34963,f.buffer));var m=l===null?u.count:l.count,h=n.drawRange.start*d,g=n.drawRange.count*d,_=a===null?0:a.start*d,v=a===null?1/0:a.count*d,y=Math.max(h,_),b=Math.min(m,h+g,_+v)-1,x=Math.max(0,b-y+1);if(x!==0){if(i.isMesh)r.wireframe===!0?(G.setLineWidth(r.wireframeLinewidth*H()),p.setMode(1)):p.setMode(4);else if(i.isLine){var C=r.linewidth;C===void 0&&(C=1),G.setLineWidth(C*H()),i.isLineSegments?p.setMode(1):i.isLineLoop?p.setMode(2):p.setMode(3)}else i.isPoints?p.setMode(0):i.isSprite&&p.setMode(4);if(i.isInstancedMesh)p.renderInstances(n,y,x,i.count);else if(n.isInstancedBufferGeometry){var w=Math.min(n.instanceCount,n._maxInstanceCount);p.renderInstances(n,y,x,w)}else p.render(y,x)}};function He(e,t,n,r){if(!(ae.isWebGL2===!1&&(e.isInstancedMesh||t.isInstancedBufferGeometry)&&W.get(`ANGLE_instanced_arrays`)===null)){G.initAttributes();var i=t.attributes,a=r.getAttributes(),o=n.defaultAttributeValues;for(var s in a){var c=a[s];if(c>=0){var l=i[s];if(l!==void 0){var u=l.normalized,d=l.itemSize,f=ce.get(l);if(f===void 0)continue;var p=f.buffer,m=f.type,h=f.bytesPerElement;if(l.isInterleavedBufferAttribute){var g=l.data,_=g.stride,v=l.offset;g&&g.isInstancedInterleavedBuffer?(G.enableAttributeAndDivisor(c,g.meshPerAttribute),t._maxInstanceCount===void 0&&(t._maxInstanceCount=g.meshPerAttribute*g.count)):G.enableAttribute(c),U.bindBuffer(34962,p),G.vertexAttribPointer(c,d,m,u,_*h,v*h)}else l.isInstancedBufferAttribute?(G.enableAttributeAndDivisor(c,l.meshPerAttribute),t._maxInstanceCount===void 0&&(t._maxInstanceCount=l.meshPerAttribute*l.count)):G.enableAttribute(c),U.bindBuffer(34962,p),G.vertexAttribPointer(c,d,m,u,0,0)}else if(s===`instanceMatrix`){var f=ce.get(e.instanceMatrix);if(f===void 0)continue;var p=f.buffer,m=f.type;G.enableAttributeAndDivisor(c+0,1),G.enableAttributeAndDivisor(c+1,1),G.enableAttributeAndDivisor(c+2,1),G.enableAttributeAndDivisor(c+3,1),U.bindBuffer(34962,p),U.vertexAttribPointer(c+0,4,m,!1,64,0),U.vertexAttribPointer(c+1,4,m,!1,64,16),U.vertexAttribPointer(c+2,4,m,!1,64,32),U.vertexAttribPointer(c+3,4,m,!1,64,48)}else if(o!==void 0){var y=o[s];if(y!==void 0)switch(y.length){case 2:U.vertexAttrib2fv(c,y);break;case 3:U.vertexAttrib3fv(c,y);break;case 4:U.vertexAttrib4fv(c,y);break;default:U.vertexAttrib1fv(c,y)}}}}G.disableUnusedAttributes()}}this.compile=function(e,t){f=pe.get(e,t),f.init(),e.traverse(function(e){e.isLight&&(f.pushLight(e),e.castShadow&&f.pushShadow(e))}),f.setupLights(t);let n={};e.traverse(function(t){let r=t.material;if(r)if(Array.isArray(r))for(let i=0;i<r.length;i++){let a=r[i];a.uuid in n||(Ye(a,e,t),n[a.uuid]=!0)}else r.uuid in n||(Ye(r,e,t),n[r.uuid]=!0)})};var Ue=null;function We(e){ye.isPresenting||Ue&&Ue(e)}var Ge=new Ce;Ge.setAnimationLoop(We),typeof window<`u`&&Ge.setContext(window),this.setAnimationLoop=function(e){Ue=e,ye.setAnimationLoop(e),Ge.start()},this.render=function(e,t){var n,r;if(arguments[2]!==void 0&&(console.warn(`THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.`),n=arguments[2]),arguments[3]!==void 0&&(console.warn(`THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead.`),r=arguments[3]),!(t&&t.isCamera)){console.error(`THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(!m){S.geometry=null,S.program=null,S.wireframe=!1,x=-1,w=null,e.autoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.updateMatrixWorld(),ye.enabled&&ye.isPresenting&&(t=ye.getCamera(t)),e.onBeforeRender(p,e,t,n||v),f=pe.get(e,t),f.init(),V.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ee.setFromProjectionMatrix(V),B=this.localClippingEnabled,ne=te.init(this.clippingPlanes,B,t),d=fe.get(e,t),d.init(),Ke(e,t,0,p.sortObjects),d.finish(),p.sortObjects===!0&&d.sort(F,I),ne&&te.beginShadows();var i=f.state.shadowsArray;be.render(i,e,t),f.setupLights(t),ne&&te.endShadows(),this.info.autoReset&&this.info.reset(),n!==void 0&&this.setRenderTarget(n),J.render(d,e,t,r);var a=d.opaque,o=d.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&qe(a,e,t,s),o.length&&qe(o,e,t,s)}else a.length&&qe(a,e,t),o.length&&qe(o,e,t);e.onAfterRender(p,e,t),v!==null&&(K.updateRenderTargetMipmap(v),K.updateMultisampleRenderTarget(v)),G.buffers.depth.setTest(!0),G.buffers.depth.setMask(!0),G.buffers.color.setMask(!0),G.setPolygonOffset(!1),d=null,f=null}};function Ke(e,t,n,r){if(e.visible!==!1){if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)f.pushLight(e),e.castShadow&&f.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ee.intersectsSprite(e)){r&&re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V);var i=ue.update(e),a=e.material;a.visible&&d.push(e,i,a,n,re.z,null)}}else if(e.isImmediateRenderObject)r&&re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V),d.push(e,null,e.material,n,re.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==oe.render.frame&&(e.skeleton.update(),e.skeleton.frame=oe.render.frame),!e.frustumCulled||ee.intersectsObject(e))){r&&re.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V);var i=ue.update(e),a=e.material;if(Array.isArray(a))for(var o=i.groups,s=0,c=o.length;s<c;s++){var l=o[s],u=a[l.materialIndex];u&&u.visible&&d.push(e,i,u,n,re.z,l)}else a.visible&&d.push(e,i,a,n,re.z,null)}}for(var p=e.children,s=0,c=p.length;s<c;s++)Ke(p[s],t,n,r)}}function qe(e,t,n,r){for(var i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,c=o.geometry,l=r===void 0?o.material:r,u=o.group;if(n.isArrayCamera){T=n;for(var d=n.cameras,p=0,m=d.length;p<m;p++){var h=d[p];s.layers.test(h.layers)&&(G.viewport(E.copy(h.viewport)),f.setupLights(h),Je(s,t,h,c,l,u))}}else T=null,Je(s,t,n,c,l,u)}}function Je(e,t,n,r,i,a){if(e.onBeforeRender(p,t,n,r,i,a),f=pe.get(t,T||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var o=Xe(n,t,i,e);G.setMaterial(i),S.geometry=null,S.program=null,S.wireframe=!1,Be(e,o)}else p.renderBufferDirect(n,t,r,i,e,a);e.onAfterRender(p,t,n,r,i,a),f=pe.get(t,T||n)}function Ye(e,t,n){var r=se.get(e),i=f.state.lights,a=f.state.shadowsArray,o=i.state.version,s=q.getParameters(e,i.state,a,t,te.numPlanes,te.numIntersection,n),c=q.getProgramCacheKey(s),l=r.program,u=!0;if(l===void 0)e.addEventListener(`dispose`,Fe);else if(l.cacheKey!==c)ze(e);else if(r.lightsStateVersion!==o)r.lightsStateVersion=o,u=!1;else if(s.shaderID!==void 0)return;else u=!1;u&&(l=q.acquireProgram(s,c),r.program=l,r.uniforms=s.uniforms,r.outputEncoding=s.outputEncoding,e.program=l);var d=l.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var m=0;m<p.maxMorphTargets;m++)d[`morphTarget`+m]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var m=0;m<p.maxMorphNormals;m++)d[`morphNormal`+m]>=0&&e.numSupportedMorphNormals++}var h=r.uniforms;(!e.isShaderMaterial&&!e.isRawShaderMaterial||e.clipping===!0)&&(r.numClippingPlanes=te.numPlanes,r.numIntersection=te.numIntersection,h.clippingPlanes=te.uniform),r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.needsLights=Qe(e),r.lightsStateVersion=o,r.needsLights&&(h.ambientLightColor.value=i.state.ambient,h.lightProbe.value=i.state.probe,h.directionalLights.value=i.state.directional,h.directionalLightShadows.value=i.state.directionalShadow,h.spotLights.value=i.state.spot,h.spotLightShadows.value=i.state.spotShadow,h.rectAreaLights.value=i.state.rectArea,h.pointLights.value=i.state.point,h.pointLightShadows.value=i.state.pointShadow,h.hemisphereLights.value=i.state.hemi,h.directionalShadowMap.value=i.state.directionalShadowMap,h.directionalShadowMatrix.value=i.state.directionalShadowMatrix,h.spotShadowMap.value=i.state.spotShadowMap,h.spotShadowMatrix.value=i.state.spotShadowMatrix,h.pointShadowMap.value=i.state.pointShadowMap,h.pointShadowMatrix.value=i.state.pointShadowMatrix);var g=r.program.getUniforms();r.uniformsList=Dt.seqWithValue(g.seq,h)}function Xe(e,t,n,r){K.resetTextureUnits();var i=t.fog,a=n.isMeshStandardMaterial?t.environment:null,o=v===null?p.outputEncoding:v.texture.encoding,s=se.get(n),c=f.state.lights;if(ne&&(B||e!==w)){var l=e===w&&n.id===x;te.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,s,l)}n.version===s.__version?s.program===void 0||n.fog&&s.fog!==i?Ye(n,t,r):s.environment===a?(s.needsLights&&s.lightsStateVersion!==c.state.version||s.numClippingPlanes!==void 0&&(s.numClippingPlanes!==te.numPlanes||s.numIntersection!==te.numIntersection)||s.outputEncoding!==o)&&Ye(n,t,r):Ye(n,t,r):(Ye(n,t,r),s.__version=n.version);var u=!1,d=!1,m=!1,h=s.program,g=h.getUniforms(),_=s.uniforms;if(G.useProgram(h.program)&&(u=!0,d=!0,m=!0),n.id!==x&&(x=n.id,d=!0),u||w!==e){if(g.setValue(U,`projectionMatrix`,e.projectionMatrix),ae.logarithmicDepthBuffer&&g.setValue(U,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),w!==e&&(w=e,d=!0,m=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var y=g.map.cameraPosition;y!==void 0&&y.setValue(U,re.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&g.setValue(U,`isOrthographic`,e.isOrthographicCamera===!0),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&g.setValue(U,`viewMatrix`,e.matrixWorldInverse)}if(n.skinning){g.setOptional(U,r,`bindMatrix`),g.setOptional(U,r,`bindMatrixInverse`);var b=r.skeleton;if(b){var S=b.bones;if(ae.floatVertexTextures){if(b.boneTexture===void 0){var C=Math.sqrt(S.length*4);C=X.ceilPowerOfTwo(C),C=Math.max(C,4);var T=new Float32Array(C*C*4);T.set(b.boneMatrices);var E=new xe(T,C,C,es,Zo);b.boneMatrices=T,b.boneTexture=E,b.boneTextureSize=C}g.setValue(U,`boneTexture`,b.boneTexture,K),g.setValue(U,`boneTextureSize`,b.boneTextureSize)}else g.setOptional(U,b,`boneMatrices`)}}return(d||s.receiveShadow!==r.receiveShadow)&&(s.receiveShadow=r.receiveShadow,g.setValue(U,`receiveShadow`,r.receiveShadow)),d&&(g.setValue(U,`toneMappingExposure`,p.toneMappingExposure),g.setValue(U,`toneMappingWhitePoint`,p.toneMappingWhitePoint),s.needsLights&&Ze(_,m),i&&n.fog&&de.refreshFogUniforms(_,i),de.refreshMaterialUniforms(_,n,a,P,N),_.ltc_1!==void 0&&(_.ltc_1.value=Z.LTC_1),_.ltc_2!==void 0&&(_.ltc_2.value=Z.LTC_2),Dt.upload(U,s.uniformsList,_,K)),n.isShaderMaterial&&n.uniformsNeedUpdate===!0&&(Dt.upload(U,s.uniformsList,_,K),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&g.setValue(U,`center`,r.center),g.setValue(U,`modelViewMatrix`,r.modelViewMatrix),g.setValue(U,`normalMatrix`,r.normalMatrix),g.setValue(U,`modelMatrix`,r.matrixWorld),h}function Ze(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function Qe(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&e.lights===!0}this.setFramebuffer=function(e){h!==e&&v===null&&U.bindFramebuffer(36160,e),h=e},this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return v},this.setRenderTarget=function(e,t,n){v=e,g=t,_=n,e&&se.get(e).__webglFramebuffer===void 0&&K.setupRenderTarget(e);var r=h,i=!1;if(e){var a=se.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=a[t||0],i=!0):r=e.isWebGLMultisampleRenderTarget?se.get(e).__webglMultisampledFramebuffer:a,E.copy(e.viewport),k.copy(e.scissor),A=e.scissorTest}else E.copy(L).multiplyScalar(P).floor(),k.copy(R).multiplyScalar(P).floor(),A=z;if(y!==r&&(U.bindFramebuffer(36160,r),y=r),G.viewport(E),G.scissor(k),G.setScissorTest(A),i){var o=se.get(e.texture);U.framebufferTexture2D(36160,36064,34069+(t||0),o.__webglTexture,n||0)}},this.readRenderTargetPixels=function(e,t,n,r,i,a,o){if(!(e&&e.isWebGLRenderTarget)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}var s=se.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(s=s[o]),s){var c=!1;s!==y&&(U.bindFramebuffer(36160,s),c=!0);try{var l=e.texture,u=l.format,d=l.type;if(u!==1023&&_e.convert(u)!==U.getParameter(35739)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(d!==1009&&_e.convert(d)!==U.getParameter(35738)&&!(d===1015&&(ae.isWebGL2||W.get(`OES_texture_float`)||W.get(`WEBGL_color_buffer_float`)))&&!(d===1016&&(ae.isWebGL2?W.get(`EXT_color_buffer_float`):W.get(`EXT_color_buffer_half_float`)))){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}U.checkFramebufferStatus(36160)===36053?t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&U.readPixels(t,n,r,i,_e.convert(u),_e.convert(d),a):console.error(`THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.`)}finally{c&&U.bindFramebuffer(36160,y)}}},this.copyFramebufferToTexture=function(e,t,n){n===void 0&&(n=0);var r=Math.pow(2,-n),i=Math.floor(t.image.width*r),a=Math.floor(t.image.height*r),o=_e.convert(t.format);K.setTexture2D(t,0),U.copyTexImage2D(3553,n,o,e.x,e.y,i,a,0),G.unbindTexture()},this.copyTextureToTexture=function(e,t,n,r){r===void 0&&(r=0);var i=t.image.width,a=t.image.height,o=_e.convert(n.format),s=_e.convert(n.type);K.setTexture2D(n,0),t.isDataTexture?U.texSubImage2D(3553,r,e.x,e.y,i,a,o,s,t.image.data):t.isCompressedTexture?U.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):U.texSubImage2D(3553,r,e.x,e.y,o,s,t.image),r===0&&n.generateMipmaps&&U.generateMipmap(3553),G.unbindTexture()},this.initTexture=function(e){K.setTexture2D(e,0),G.unbindTexture()},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}function Cn(e,t){this.name=``,this.color=new z(e),this.density=t===void 0?25e-5:t}function wn(e,t,n){this.name=``,this.color=new z(e),this.near=t===void 0?1:t,this.far=n===void 0?1e3:n}function Tn(e,t){this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=uc,this.updateRange={offset:0,count:-1},this.version=0}function En(e,t,n,r){this.name=``,this.data=e,this.itemSize=t,this.offset=n,this.normalized=r===!0}function Dn(e){V.call(this),this.type=`SpriteMaterial`,this.color=new z(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}function On(e){if(j.call(this),this.type=`Sprite`,Ou===void 0){Ou=new q;var t=new Tn(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Ou.setIndex([0,1,2,0,2,3]),Ou.setAttribute(`position`,new En(t,3,0,!1)),Ou.setAttribute(`uv`,new En(t,2,3,!1))}this.geometry=Ou,this.material=e===void 0?new Dn:e,this.center=new b(.5,.5)}function kn(e,t,n,r,i,a){Mu.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?Nu.copy(Mu):(Nu.x=a*Mu.x-i*Mu.y,Nu.y=i*Mu.x+a*Mu.y),e.copy(t),e.x+=Nu.x,e.y+=Nu.y,e.applyMatrix4(Pu)}function An(){j.call(this),this._currentLevel=0,this.type=`LOD`,Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function jn(e,t){e&&e.isGeometry&&console.error(`THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`),de.call(this,e,t),this.type=`SkinnedMesh`,this.bindMode=`attached`,this.bindMatrix=new O,this.bindMatrixInverse=new O}function Mn(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(this.bones.length*16),this.frame=-1,t===void 0)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn(`THREE.Skeleton boneInverses is the wrong length.`),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new O)}}function Nn(){j.call(this),this.type=`Bone`}function Pn(e,t,n){de.call(this,e,t),this.instanceMatrix=new H(new Float32Array(n*16),16),this.count=n,this.frustumCulled=!1}function Fn(e){V.call(this),this.type=`LineBasicMaterial`,this.color=new z(16777215),this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.morphTargets=!1,this.setValues(e)}function In(e,t,n){n===1&&console.error(`THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead.`),j.call(this),this.type=`Line`,this.geometry=e===void 0?new q:e,this.material=t===void 0?new Fn:t,this.updateMorphTargets()}function Ln(e,t){In.call(this,e,t),this.type=`LineSegments`}function Rn(e,t){In.call(this,e,t),this.type=`LineLoop`}function zn(e){V.call(this),this.type=`PointsMaterial`,this.color=new z(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}function Bn(e,t){j.call(this),this.type=`Points`,this.geometry=e===void 0?new q:e,this.material=t===void 0?new zn:t,this.updateMorphTargets()}function Vn(e,t,n,r,i,a,o){var s=rd.distanceSqToPoint(e);if(s<n){var c=new D;rd.closestPointToPoint(e,c),c.applyMatrix4(r);var l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:c,index:t,face:null,object:o})}}function Hn(e,t,n,r,i,a,o,s,c){S.call(this,e,t,n,r,i,a,o,s,c),this.format=o===void 0?$o:o,this.minFilter=a===void 0?Ko:a,this.magFilter=i===void 0?Ko:i,this.generateMipmaps=!1}function Un(e,t,n,r,i,a,o,s,c,l,u,d){S.call(this,null,a,o,s,c,l,r,i,u,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Wn(e,t,n,r,i,a,o,s,c){S.call(this,e,t,n,r,i,a,o,s,c),this.needsUpdate=!0}function Gn(e,t,n,r,i,a,o,s,c,l){if(l=l===void 0?ns:l,l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);n===void 0&&l===1026&&(n=Xo),n===void 0&&l===1027&&(n=Qo),S.call(this,null,r,i,a,o,s,l,n,c),this.image={width:e,height:t},this.magFilter=o===void 0?Uo:o,this.minFilter=s===void 0?Uo:s,this.flipY=!1,this.generateMipmaps=!1}function Kn(e){q.call(this),this.type=`WireframeGeometry`;var t=[],n,r,i,a,o,s=[0,0],c={},l,u,d,f,p=[`a`,`b`,`c`],m;if(e&&e.isGeometry){var h=e.faces;for(n=0,i=h.length;n<i;n++){var g=h[n];for(r=0;r<3;r++)u=g[p[r]],d=g[p[(r+1)%3]],s[0]=Math.min(u,d),s[1]=Math.max(u,d),f=s[0]+`,`+s[1],c[f]===void 0&&(c[f]={index1:s[0],index2:s[1]})}for(f in c)l=c[f],m=e.vertices[l.index1],t.push(m.x,m.y,m.z),m=e.vertices[l.index2],t.push(m.x,m.y,m.z)}else if(e&&e.isBufferGeometry){var _,v,y,b,x,S,C,w;if(m=new D,e.index!==null){for(_=e.attributes.position,v=e.index,y=e.groups,y.length===0&&(y=[{start:0,count:v.count,materialIndex:0}]),a=0,o=y.length;a<o;++a)for(b=y[a],x=b.start,S=b.count,n=x,i=x+S;n<i;n+=3)for(r=0;r<3;r++)u=v.getX(n+r),d=v.getX(n+(r+1)%3),s[0]=Math.min(u,d),s[1]=Math.max(u,d),f=s[0]+`,`+s[1],c[f]===void 0&&(c[f]={index1:s[0],index2:s[1]});for(f in c)l=c[f],m.fromBufferAttribute(_,l.index1),t.push(m.x,m.y,m.z),m.fromBufferAttribute(_,l.index2),t.push(m.x,m.y,m.z)}else for(_=e.attributes.position,n=0,i=_.count/3;n<i;n++)for(r=0;r<3;r++)C=3*n+r,m.fromBufferAttribute(_,C),t.push(m.x,m.y,m.z),w=3*n+(r+1)%3,m.fromBufferAttribute(_,w),t.push(m.x,m.y,m.z)}this.setAttribute(`position`,new K(t,3))}function qn(e,t,n){J.call(this),this.type=`ParametricGeometry`,this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new Jn(e,t,n)),this.mergeVertices()}function Jn(e,t,n){q.call(this),this.type=`ParametricBufferGeometry`,this.parameters={func:e,slices:t,stacks:n};var r=[],i=[],a=[],o=[],s=1e-5,c=new D,l=new D,u=new D,d=new D,f=new D,p,m;e.length<3&&console.error(`THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.`);var h=t+1;for(p=0;p<=n;p++){var g=p/n;for(m=0;m<=t;m++){var _=m/t;e(_,g,l),i.push(l.x,l.y,l.z),_-s>=0?(e(_-s,g,u),d.subVectors(l,u)):(e(_+s,g,u),d.subVectors(u,l)),g-s>=0?(e(_,g-s,u),f.subVectors(l,u)):(e(_,g+s,u),f.subVectors(u,l)),c.crossVectors(d,f).normalize(),a.push(c.x,c.y,c.z),o.push(_,g)}}for(p=0;p<n;p++)for(m=0;m<t;m++){var v=p*h+m,y=p*h+m+1,b=(p+1)*h+m+1,x=(p+1)*h+m;r.push(v,y,x),r.push(y,b,x)}this.setIndex(r),this.setAttribute(`position`,new K(i,3)),this.setAttribute(`normal`,new K(a,3)),this.setAttribute(`uv`,new K(o,2))}function Yn(e,t,n,r){J.call(this),this.type=`PolyhedronGeometry`,this.parameters={vertices:e,indices:t,radius:n,detail:r},this.fromBufferGeometry(new Xn(e,t,n,r)),this.mergeVertices()}function Xn(e,t,n,r){q.call(this),this.type=`PolyhedronBufferGeometry`,this.parameters={vertices:e,indices:t,radius:n,detail:r},n=n||1,r=r||0;var i=[],a=[];o(r),c(n),l(),this.setAttribute(`position`,new K(i,3)),this.setAttribute(`normal`,new K(i.slice(),3)),this.setAttribute(`uv`,new K(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(e){for(var n=new D,r=new D,i=new D,a=0;a<t.length;a+=3)f(t[a+0],n),f(t[a+1],r),f(t[a+2],i),s(n,r,i,e)}function s(e,t,n,r){var i=Math.pow(2,r),a=[],o,s;for(o=0;o<=i;o++){a[o]=[];var c=e.clone().lerp(n,o/i),l=t.clone().lerp(n,o/i),u=i-o;for(s=0;s<=u;s++)s===0&&o===i?a[o][s]=c:a[o][s]=c.clone().lerp(l,s/u)}for(o=0;o<i;o++)for(s=0;s<2*(i-o)-1;s++){var f=Math.floor(s/2);s%2==0?(d(a[o][f+1]),d(a[o+1][f]),d(a[o][f])):(d(a[o][f+1]),d(a[o+1][f+1]),d(a[o+1][f]))}}function c(e){for(var t=new D,n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}function l(){for(var e=new D,t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];var n=h(e)/2/Math.PI+.5,r=g(e)/Math.PI+.5;a.push(n,1-r)}p(),u()}function u(){for(var e=0;e<a.length;e+=6){var t=a[e+0],n=a[e+2],r=a[e+4];Math.max(t,n,r)>.9&&Math.min(t,n,r)<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}function d(e){i.push(e.x,e.y,e.z)}function f(t,n){var r=t*3;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function p(){for(var e=new D,t=new D,n=new D,r=new D,o=new b,s=new b,c=new b,l=0,u=0;l<i.length;l+=9,u+=6){e.set(i[l+0],i[l+1],i[l+2]),t.set(i[l+3],i[l+4],i[l+5]),n.set(i[l+6],i[l+7],i[l+8]),o.set(a[u+0],a[u+1]),s.set(a[u+2],a[u+3]),c.set(a[u+4],a[u+5]),r.copy(e).add(t).add(n).divideScalar(3);var d=h(r);m(o,u+0,e,d),m(s,u+2,t,d),m(c,u+4,n,d)}}function m(e,t,n,r){r<0&&e.x===1&&(a[t]=e.x-1),n.x===0&&n.z===0&&(a[t]=r/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}function g(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}}function Zn(e,t){J.call(this),this.type=`TetrahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Qn(e,t)),this.mergeVertices()}function Qn(e,t){Xn.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type=`TetrahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function $n(e,t){J.call(this),this.type=`OctahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new er(e,t)),this.mergeVertices()}function er(e,t){Xn.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type=`OctahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function tr(e,t){J.call(this),this.type=`IcosahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new nr(e,t)),this.mergeVertices()}function nr(e,t){var n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];Xn.call(this,r,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type=`IcosahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function rr(e,t){J.call(this),this.type=`DodecahedronGeometry`,this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ir(e,t)),this.mergeVertices()}function ir(e,t){var n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r];Xn.call(this,i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type=`DodecahedronBufferGeometry`,this.parameters={radius:e,detail:t}}function ar(e,t,n,r,i,a){J.call(this),this.type=`TubeGeometry`,this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},a!==void 0&&console.warn(`THREE.TubeGeometry: taper has been removed.`);var o=new or(e,t,n,r,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function or(e,t,n,r,i){q.call(this),this.type=`TubeBufferGeometry`,this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},t=t||64,n=n||1,r=r||8,i=i||!1;var a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o=new D,s=new D,c=new b,l=new D,u,d,f=[],p=[],m=[],h=[];g(),this.setIndex(h),this.setAttribute(`position`,new K(f,3)),this.setAttribute(`normal`,new K(p,3)),this.setAttribute(`uv`,new K(m,2));function g(){for(u=0;u<t;u++)_(u);_(i===!1?t:0),y(),v()}function _(i){l=e.getPointAt(i/t,l);var c=a.normals[i],u=a.binormals[i];for(d=0;d<=r;d++){var m=d/r*Math.PI*2,h=Math.sin(m),g=-Math.cos(m);s.x=g*c.x+h*u.x,s.y=g*c.y+h*u.y,s.z=g*c.z+h*u.z,s.normalize(),p.push(s.x,s.y,s.z),o.x=l.x+n*s.x,o.y=l.y+n*s.y,o.z=l.z+n*s.z,f.push(o.x,o.y,o.z)}}function v(){for(d=1;d<=t;d++)for(u=1;u<=r;u++){var e=(r+1)*(d-1)+(u-1),n=(r+1)*d+(u-1),i=(r+1)*d+u,a=(r+1)*(d-1)+u;h.push(e,n,a),h.push(n,i,a)}}function y(){for(u=0;u<=t;u++)for(d=0;d<=r;d++)c.x=u/t,c.y=d/r,m.push(c.x,c.y)}}function sr(e,t,n,r,i,a,o){J.call(this),this.type=`TorusKnotGeometry`,this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},o!==void 0&&console.warn(`THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.`),this.fromBufferGeometry(new cr(e,t,n,r,i,a)),this.mergeVertices()}function cr(e,t,n,r,i,a){q.call(this),this.type=`TorusKnotBufferGeometry`,this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,a=a||3;var o=[],s=[],c=[],l=[],u,d,f=new D,p=new D,m=new D,h=new D,g=new D,_=new D,v=new D;for(u=0;u<=n;++u){var y=u/n*i*Math.PI*2;for(O(y,i,a,e,m),O(y+.01,i,a,e,h),_.subVectors(h,m),v.addVectors(h,m),g.crossVectors(_,v),v.crossVectors(g,_),g.normalize(),v.normalize(),d=0;d<=r;++d){var b=d/r*Math.PI*2,x=-t*Math.cos(b),S=t*Math.sin(b);f.x=m.x+(x*v.x+S*g.x),f.y=m.y+(x*v.y+S*g.y),f.z=m.z+(x*v.z+S*g.z),s.push(f.x,f.y,f.z),p.subVectors(f,m).normalize(),c.push(p.x,p.y,p.z),l.push(u/n),l.push(d/r)}}for(d=1;d<=n;d++)for(u=1;u<=r;u++){var C=(r+1)*(d-1)+(u-1),w=(r+1)*d+(u-1),T=(r+1)*d+u,E=(r+1)*(d-1)+u;o.push(C,w,E),o.push(w,T,E)}this.setIndex(o),this.setAttribute(`position`,new K(s,3)),this.setAttribute(`normal`,new K(c,3)),this.setAttribute(`uv`,new K(l,2));function O(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,c=Math.cos(s);i.x=r*(2+c)*.5*a,i.y=r*(2+c)*o*.5,i.z=r*Math.sin(s)*.5}}function lr(e,t,n,r,i){J.call(this),this.type=`TorusGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new ur(e,t,n,r,i)),this.mergeVertices()}function ur(e,t,n,r,i){q.call(this),this.type=`TorusBufferGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},e=e||1,t=t||.4,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||Math.PI*2;var a=[],o=[],s=[],c=[],l=new D,u=new D,d=new D,f,p;for(f=0;f<=n;f++)for(p=0;p<=r;p++){var m=p/r*i,h=f/n*Math.PI*2;u.x=(e+t*Math.cos(h))*Math.cos(m),u.y=(e+t*Math.cos(h))*Math.sin(m),u.z=t*Math.sin(h),o.push(u.x,u.y,u.z),l.x=e*Math.cos(m),l.y=e*Math.sin(m),d.subVectors(u,l).normalize(),s.push(d.x,d.y,d.z),c.push(p/r),c.push(f/n)}for(f=1;f<=n;f++)for(p=1;p<=r;p++){var g=(r+1)*f+p-1,_=(r+1)*(f-1)+p-1,v=(r+1)*(f-1)+p,y=(r+1)*f+p;a.push(g,_,y),a.push(_,v,y)}this.setIndex(a),this.setAttribute(`position`,new K(o,3)),this.setAttribute(`normal`,new K(s,3)),this.setAttribute(`uv`,new K(c,2))}function dr(e,t,n,r,i){var a,o;if(i===Vr(e,t,n,r)>0)for(a=t;a<n;a+=r)o=Rr(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=Rr(a,e[a],e[a+1],o);return o&&Ar(o,o.next)&&(zr(o),o=o.next),o}function fr(e,t){if(!e)return e;t||(t=e);var n=e,r;do if(r=!1,!n.steiner&&(Ar(n,n.next)||kr(n.prev,n,n.next)===0)){if(zr(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function pr(e,t,n,r,i,a,o){if(e){!o&&a&&Cr(e,r,i,a);for(var s=e,c,l;e.prev!==e.next;){if(c=e.prev,l=e.next,a?hr(e,r,i,a):mr(e)){t.push(c.i/n),t.push(e.i/n),t.push(l.i/n),zr(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=gr(fr(e),t,n),pr(e,t,n,r,i,a,2)):o===2&&_r(e,t,n,r,i,a):pr(fr(e),t,n,r,i,a,1);break}}}}function mr(e){var t=e.prev,n=e,r=e.next;if(kr(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(Dr(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&kr(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function hr(e,t,n,r){var i=e.prev,a=e,o=e.next;if(kr(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,c=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,l=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,d=Tr(s,c,t,n,r),f=Tr(l,u,t,n,r),p=e.prevZ,m=e.nextZ;p&&p.z>=d&&m&&m.z<=f;){if(p!==e.prev&&p!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&kr(p.prev,p,p.next)>=0||(p=p.prevZ,m!==e.prev&&m!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&kr(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;p&&p.z>=d;){if(p!==e.prev&&p!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&kr(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;m&&m.z<=f;){if(m!==e.prev&&m!==e.next&&Dr(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&kr(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function gr(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!Ar(i,a)&&jr(i,r,r.next,a)&&Fr(i,a)&&Fr(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),zr(r),zr(r.next),r=e=a),r=r.next}while(r!==e);return fr(r)}function _r(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Or(o,s)){var c=Lr(o,s);o=fr(o,o.next),c=fr(c,c.next),pr(o,t,n,r,i,a),pr(c,t,n,r,i,a);return}s=s.next}o=o.next}while(o!==e)}function vr(e,t,n,r){var i=[],a,o,s,c,l;for(a=0,o=t.length;a<o;a++)s=t[a]*r,c=a<o-1?t[a+1]*r:e.length,l=dr(e,s,c,r,!1),l===l.next&&(l.steiner=!0),i.push(Er(l));for(i.sort(yr),a=0;a<i.length;a++)br(i[a],n),n=fr(n,n.next);return n}function yr(e,t){return e.x-t.x}function br(e,t){if(t=xr(e,t),t){var n=Lr(t,e);fr(t,t.next),fr(n,n.next)}}function xr(e,t){var n=t,r=e.x,i=e.y,a=-1/0,o;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a){if(a=s,s===r){if(i===n.y)return n;if(i===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!o)return null;if(r===a)return o;var c=o,l=o.x,u=o.y,d=1/0,f;n=o;do r>=n.x&&n.x>=l&&r!==n.x&&Dr(i<u?r:a,i,l,u,i<u?a:r,i,n.x,n.y)&&(f=Math.abs(i-n.y)/(r-n.x),Fr(n,e)&&(f<d||f===d&&(n.x>o.x||n.x===o.x&&Sr(o,n)))&&(o=n,d=f)),n=n.next;while(n!==c);return o}function Sr(e,t){return kr(e.prev,e,t.prev)<0&&kr(t.next,e,e.next)<0}function Cr(e,t,n,r){var i=e;do i.z===null&&(i.z=Tr(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,wr(i)}function wr(e){var t,n,r,i,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<l&&(s++,r=r.nextZ,r);t++);for(c=l;s>0||c>0&&r;)s!==0&&(c===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1);return e}function Tr(e,t,n,r,i){return e=32767*(e-n)*i,t=32767*(t-r)*i,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Er(e){var t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Dr(e,t,n,r,i,a,o,s){return(i-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function Or(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Pr(e,t)&&(Fr(e,t)&&Fr(t,e)&&Ir(e,t)&&(kr(e.prev,e,t.prev)||kr(e,t.prev,t))||Ar(e,t)&&kr(e.prev,e,e.next)>0&&kr(t.prev,t,t.next)>0)}function kr(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ar(e,t){return e.x===t.x&&e.y===t.y}function jr(e,t,n,r){var i=Nr(kr(e,t,n)),a=Nr(kr(e,t,r)),o=Nr(kr(n,r,e)),s=Nr(kr(n,r,t));return!!(i!==a&&o!==s||i===0&&Mr(e,n,t)||a===0&&Mr(e,r,t)||o===0&&Mr(n,e,r)||s===0&&Mr(n,t,r))}function Mr(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Nr(e){return e>0?1:e<0?-1:0}function Pr(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&jr(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Fr(e,t){return kr(e.prev,e,e.next)<0?kr(e,t,e.next)>=0&&kr(e,e.prev,t)>=0:kr(e,t,e.prev)<0||kr(e,e.next,t)<0}function Ir(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Lr(e,t){var n=new Br(e.i,e.x,e.y),r=new Br(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Rr(e,t,n,r){var i=new Br(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function zr(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Br(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Vr(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}function Hr(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Ur(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function Wr(e,t){J.call(this),this.type=`ExtrudeGeometry`,this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Gr(e,t)),this.mergeVertices()}function Gr(e,t){q.call(this),this.type=`ExtrudeBufferGeometry`,this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var n=this,r=[],i=[],a=0,o=e.length;a<o;a++){var s=e[a];c(s)}this.setAttribute(`position`,new K(r,3)),this.setAttribute(`uv`,new K(i,2)),this.computeVertexNormals();function c(e){var a=[],o=t.curveSegments===void 0?12:t.curveSegments,s=t.steps===void 0?1:t.steps,c=t.depth===void 0?100:t.depth,l=t.bevelEnabled===void 0?!0:t.bevelEnabled,u=t.bevelThickness===void 0?6:t.bevelThickness,d=t.bevelSize===void 0?u-2:t.bevelSize,f=t.bevelOffset===void 0?0:t.bevelOffset,p=t.bevelSegments===void 0?3:t.bevelSegments,m=t.extrudePath,h=t.UVGenerator===void 0?cd:t.UVGenerator;t.amount!==void 0&&(console.warn(`THREE.ExtrudeBufferGeometry: amount has been renamed to depth.`),c=t.amount);var g,_=!1,v,y,x,S;m&&(g=m.getSpacedPoints(s),_=!0,l=!1,v=m.computeFrenetFrames(s,!1),y=new D,x=new D,S=new D),l||(p=0,u=0,d=0,f=0);var C,w,T,E=e.extractPoints(o),O=E.shape,k=E.holes;if(!sd.isClockWise(O))for(O=O.reverse(),w=0,T=k.length;w<T;w++)C=k[w],sd.isClockWise(C)&&(k[w]=C.reverse());var A=sd.triangulateShape(O,k),j=O;for(w=0,T=k.length;w<T;w++)C=k[w],O=O.concat(C);function M(e,t,n){return t||console.error(`THREE.ExtrudeGeometry: vec does not exist`),t.clone().multiplyScalar(n).add(e)}var N,P,F,I,L,R=O.length,z,ee=A.length;function te(e,t,n){var r,i,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,d=o*l-s*c;if(Math.abs(d)>Number.EPSILON){var f=Math.sqrt(u),p=Math.sqrt(c*c+l*l),m=t.x-s/f,h=t.y+o/f,g=n.x-l/p,_=n.y+c/p,v=((g-m)*l-(_-h)*c)/(o*l-s*c);r=m+o*v-e.x,i=h+s*v-e.y;var y=r*r+i*i;if(y<=2)return new b(r,i);a=Math.sqrt(y/2)}else{var x=!1;o>Number.EPSILON?c>Number.EPSILON&&(x=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(x=!0):Math.sign(s)===Math.sign(l)&&(x=!0),x?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new b(r/a,i/a)}for(var ne=[],B=0,V=j.length,re=V-1,H=B+1;B<V;B++,re++,H++)re===V&&(re=0),H===V&&(H=0),ne[B]=te(j[B],j[re],j[H]);var U=[],ie,W=ne.concat();for(w=0,T=k.length;w<T;w++){for(C=k[w],ie=[],B=0,V=C.length,re=V-1,H=B+1;B<V;B++,re++,H++)re===V&&(re=0),H===V&&(H=0),ie[B]=te(C[B],C[re],C[H]);U.push(ie),W=W.concat(ie)}for(N=0;N<p;N++){for(F=N/p,I=u*Math.cos(F*Math.PI/2),P=d*Math.sin(F*Math.PI/2)+f,B=0,V=j.length;B<V;B++)L=M(j[B],ne[B],P),K(L.x,L.y,-I);for(w=0,T=k.length;w<T;w++)for(C=k[w],ie=U[w],B=0,V=C.length;B<V;B++)L=M(C[B],ie[B],P),K(L.x,L.y,-I)}for(P=d+f,B=0;B<R;B++)L=l?M(O[B],W[B],P):O[B],_?(x.copy(v.normals[0]).multiplyScalar(L.x),y.copy(v.binormals[0]).multiplyScalar(L.y),S.copy(g[0]).add(x).add(y),K(S.x,S.y,S.z)):K(L.x,L.y,0);var ae;for(ae=1;ae<=s;ae++)for(B=0;B<R;B++)L=l?M(O[B],W[B],P):O[B],_?(x.copy(v.normals[ae]).multiplyScalar(L.x),y.copy(v.binormals[ae]).multiplyScalar(L.y),S.copy(g[ae]).add(x).add(y),K(S.x,S.y,S.z)):K(L.x,L.y,c/s*ae);for(N=p-1;N>=0;N--){for(F=N/p,I=u*Math.cos(F*Math.PI/2),P=d*Math.sin(F*Math.PI/2)+f,B=0,V=j.length;B<V;B++)L=M(j[B],ne[B],P),K(L.x,L.y,c+I);for(w=0,T=k.length;w<T;w++)for(C=k[w],ie=U[w],B=0,V=C.length;B<V;B++)L=M(C[B],ie[B],P),_?K(L.x,L.y+g[s-1].y,g[s-1].x+I):K(L.x,L.y,c+I)}G(),oe();function G(){var e=r.length/3;if(l){var t=0,i=R*t;for(B=0;B<ee;B++)z=A[B],ce(z[2]+i,z[1]+i,z[0]+i);for(t=s+p*2,i=R*t,B=0;B<ee;B++)z=A[B],ce(z[0]+i,z[1]+i,z[2]+i)}else{for(B=0;B<ee;B++)z=A[B],ce(z[2],z[1],z[0]);for(B=0;B<ee;B++)z=A[B],ce(z[0]+R*s,z[1]+R*s,z[2]+R*s)}n.addGroup(e,r.length/3-e,0)}function oe(){var e=r.length/3,t=0;for(se(j,t),t+=j.length,w=0,T=k.length;w<T;w++)C=k[w],se(C,t),t+=C.length;n.addGroup(e,r.length/3-e,1)}function se(e,t){var n,r;for(B=e.length;--B>=0;){n=B,r=B-1,r<0&&(r=e.length-1);var i=0,a=s+p*2;for(i=0;i<a;i++){var o=R*i,c=R*(i+1);le(t+n+o,t+r+o,t+r+c,t+n+c)}}}function K(e,t,n){a.push(e),a.push(t),a.push(n)}function ce(e,t,i){ue(e),ue(t),ue(i);var a=r.length/3,o=h.generateTopUV(n,r,a-3,a-2,a-1);q(o[0]),q(o[1]),q(o[2])}function le(e,t,i,a){ue(e),ue(t),ue(a),ue(t),ue(i),ue(a);var o=r.length/3,s=h.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);q(s[0]),q(s[1]),q(s[3]),q(s[1]),q(s[2]),q(s[3])}function ue(e){r.push(a[e*3+0]),r.push(a[e*3+1]),r.push(a[e*3+2])}function q(e){i.push(e.x),i.push(e.y)}}}function Kr(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function qr(e,t){J.call(this),this.type=`TextGeometry`,this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Jr(e,t)),this.mergeVertices()}function Jr(e,t){t=t||{};var n=t.font;if(!(n&&n.isFont))return console.error(`THREE.TextGeometry: font parameter is not an instance of THREE.Font.`),new J;var r=n.generateShapes(e,t.size);t.depth=t.height===void 0?50:t.height,t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),Gr.call(this,r,t),this.type=`TextBufferGeometry`}function Yr(e,t,n,r,i,a,o){J.call(this),this.type=`SphereGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Xr(e,t,n,r,i,a,o)),this.mergeVertices()}function Xr(e,t,n,r,i,a,o){q.call(this),this.type=`SphereBufferGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),r=r===void 0?0:r,i=i===void 0?Math.PI*2:i,a=a===void 0?0:a,o=o===void 0?Math.PI:o;var s=Math.min(a+o,Math.PI),c,l,u=0,d=[],f=new D,p=new D,m=[],h=[],g=[],_=[];for(l=0;l<=n;l++){var v=[],y=l/n,b=0;for(l==0&&a==0?b=.5/t:l==n&&s==Math.PI&&(b=-.5/t),c=0;c<=t;c++){var x=c/t;f.x=-e*Math.cos(r+x*i)*Math.sin(a+y*o),f.y=e*Math.cos(a+y*o),f.z=e*Math.sin(r+x*i)*Math.sin(a+y*o),h.push(f.x,f.y,f.z),p.copy(f).normalize(),g.push(p.x,p.y,p.z),_.push(x+b,1-y),v.push(u++)}d.push(v)}for(l=0;l<n;l++)for(c=0;c<t;c++){var S=d[l][c+1],C=d[l][c],w=d[l+1][c],T=d[l+1][c+1];(l!==0||a>0)&&m.push(S,C,T),(l!==n-1||s<Math.PI)&&m.push(C,w,T)}this.setIndex(m),this.setAttribute(`position`,new K(h,3)),this.setAttribute(`normal`,new K(g,3)),this.setAttribute(`uv`,new K(_,2))}function Zr(e,t,n,r,i,a){J.call(this),this.type=`RingGeometry`,this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new Qr(e,t,n,r,i,a)),this.mergeVertices()}function Qr(e,t,n,r,i,a){q.call(this),this.type=`RingBufferGeometry`,this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},e=e||.5,t=t||1,i=i===void 0?0:i,a=a===void 0?Math.PI*2:a,n=n===void 0?8:Math.max(3,n),r=r===void 0?1:Math.max(1,r);var o=[],s=[],c=[],l=[],u,d=e,f=(t-e)/r,p=new D,m=new b,h,g;for(h=0;h<=r;h++){for(g=0;g<=n;g++)u=i+g/n*a,p.x=d*Math.cos(u),p.y=d*Math.sin(u),s.push(p.x,p.y,p.z),c.push(0,0,1),m.x=(p.x/t+1)/2,m.y=(p.y/t+1)/2,l.push(m.x,m.y);d+=f}for(h=0;h<r;h++){var _=h*(n+1);for(g=0;g<n;g++){u=g+_;var v=u,y=u+n+1,x=u+n+2,S=u+1;o.push(v,y,S),o.push(y,x,S)}}this.setIndex(o),this.setAttribute(`position`,new K(s,3)),this.setAttribute(`normal`,new K(c,3)),this.setAttribute(`uv`,new K(l,2))}function $r(e,t,n,r){J.call(this),this.type=`LatheGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new ei(e,t,n,r)),this.mergeVertices()}function ei(e,t,n,r){q.call(this),this.type=`LatheBufferGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t)||12,n=n||0,r=r||Math.PI*2,r=X.clamp(r,0,Math.PI*2);var i=[],a=[],o=[],s,c=1/t,l=new D,u=new b,d,f;for(d=0;d<=t;d++){var p=n+d*c*r,m=Math.sin(p),h=Math.cos(p);for(f=0;f<=e.length-1;f++)l.x=e[f].x*m,l.y=e[f].y,l.z=e[f].x*h,a.push(l.x,l.y,l.z),u.x=d/t,u.y=f/(e.length-1),o.push(u.x,u.y)}for(d=0;d<t;d++)for(f=0;f<e.length-1;f++){s=f+d*e.length;var g=s,_=s+e.length,v=s+e.length+1,y=s+1;i.push(g,_,y),i.push(_,v,y)}if(this.setIndex(i),this.setAttribute(`position`,new K(a,3)),this.setAttribute(`uv`,new K(o,2)),this.computeVertexNormals(),r===Math.PI*2){var x=this.attributes.normal.array,S=new D,C=new D,w=new D;for(s=t*e.length*3,d=0,f=0;d<e.length;d++,f+=3)S.x=x[f+0],S.y=x[f+1],S.z=x[f+2],C.x=x[s+f+0],C.y=x[s+f+1],C.z=x[s+f+2],w.addVectors(S,C).normalize(),x[f+0]=x[s+f+0]=w.x,x[f+1]=x[s+f+1]=w.y,x[f+2]=x[s+f+2]=w.z}}function ti(e,t){J.call(this),this.type=`ShapeGeometry`,typeof t==`object`&&(console.warn(`THREE.ShapeGeometry: Options parameter has been removed.`),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new ni(e,t)),this.mergeVertices()}function ni(e,t){q.call(this),this.type=`ShapeBufferGeometry`,this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],r=[],i=[],a=[],o=0,s=0;if(Array.isArray(e)===!1)l(e);else for(var c=0;c<e.length;c++)l(e[c]),this.addGroup(o,s,c),o+=s,s=0;this.setIndex(n),this.setAttribute(`position`,new K(r,3)),this.setAttribute(`normal`,new K(i,3)),this.setAttribute(`uv`,new K(a,2));function l(e){var o,c,l,u=r.length/3,d=e.extractPoints(t),f=d.shape,p=d.holes;for(sd.isClockWise(f)===!1&&(f=f.reverse()),o=0,c=p.length;o<c;o++)l=p[o],sd.isClockWise(l)===!0&&(p[o]=l.reverse());var m=sd.triangulateShape(f,p);for(o=0,c=p.length;o<c;o++)l=p[o],f=f.concat(l);for(o=0,c=f.length;o<c;o++){var h=f[o];r.push(h.x,h.y,0),i.push(0,0,1),a.push(h.x,h.y)}for(o=0,c=m.length;o<c;o++){var g=m[o],_=g[0]+u,v=g[1]+u,y=g[2]+u;n.push(_,v,y),s+=3}}}function ri(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}function ii(e,t){q.call(this),this.type=`EdgesGeometry`,this.parameters={thresholdAngle:t},t=t===void 0?1:t;var n=[],r=Math.cos(X.DEG2RAD*t),i=[0,0],a={},o,s,c,l=[`a`,`b`,`c`],u;e.isBufferGeometry?(u=new J,u.fromBufferGeometry(e)):u=e.clone(),u.mergeVertices(),u.computeFaceNormals();for(var d=u.vertices,f=u.faces,p=0,m=f.length;p<m;p++)for(var h=f[p],g=0;g<3;g++)o=h[l[g]],s=h[l[(g+1)%3]],i[0]=Math.min(o,s),i[1]=Math.max(o,s),c=i[0]+`,`+i[1],a[c]===void 0?a[c]={index1:i[0],index2:i[1],face1:p,face2:void 0}:a[c].face2=p;for(c in a){var _=a[c];if(_.face2===void 0||f[_.face1].normal.dot(f[_.face2].normal)<=r){var v=d[_.index1];n.push(v.x,v.y,v.z),v=d[_.index2],n.push(v.x,v.y,v.z)}}this.setAttribute(`position`,new K(n,3))}function ai(e,t,n,r,i,a,o,s){J.call(this),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new oi(e,t,n,r,i,a,o,s)),this.mergeVertices()}function oi(e,t,n,r,i,a,o,s){q.call(this),this.type=`CylinderBufferGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};var c=this;e=e===void 0?1:e,t=t===void 0?1:t,n=n||1,r=Math.floor(r)||8,i=Math.floor(i)||1,a=a===void 0?!1:a,o=o===void 0?0:o,s=s===void 0?Math.PI*2:s;var l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new K(u,3)),this.setAttribute(`normal`,new K(d,3)),this.setAttribute(`uv`,new K(f,2));function _(){var a,_,v=new D,y=new D,b=0,x=(t-e)/n;for(_=0;_<=i;_++){var S=[],C=_/i,w=C*(t-e)+e;for(a=0;a<=r;a++){var T=a/r,E=T*s+o,O=Math.sin(E),k=Math.cos(E);y.x=w*O,y.y=-C*n+h,y.z=w*k,u.push(y.x,y.y,y.z),v.set(O,x,k).normalize(),d.push(v.x,v.y,v.z),f.push(T,1-C),S.push(p++)}m.push(S)}for(a=0;a<r;a++)for(_=0;_<i;_++){var A=m[_][a],j=m[_+1][a],M=m[_+1][a+1],N=m[_][a+1];l.push(A,j,N),l.push(j,M,N),b+=6}c.addGroup(g,b,0),g+=b}function v(n){var i,a,m,_=new b,v=new D,y=0,x=n===!0?e:t,S=n===!0?1:-1;for(a=p,i=1;i<=r;i++)u.push(0,h*S,0),d.push(0,S,0),f.push(.5,.5),p++;for(m=p,i=0;i<=r;i++){var C=i/r*s+o,w=Math.cos(C),T=Math.sin(C);v.x=x*T,v.y=h*S,v.z=x*w,u.push(v.x,v.y,v.z),d.push(0,S,0),_.x=w*.5+.5,_.y=T*.5*S+.5,f.push(_.x,_.y),p++}for(i=0;i<r;i++){var E=a+i,O=m+i;n===!0?l.push(O,O+1,E):l.push(O+1,O,E),y+=3}c.addGroup(g,y,n===!0?1:2),g+=y}}function si(e,t,n,r,i,a,o){ai.call(this,0,e,t,n,r,i,a,o),this.type=`ConeGeometry`,this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function ci(e,t,n,r,i,a,o){oi.call(this,0,e,t,n,r,i,a,o),this.type=`ConeBufferGeometry`,this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function li(e,t,n,r){J.call(this),this.type=`CircleGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new ui(e,t,n,r)),this.mergeVertices()}function ui(e,t,n,r){q.call(this),this.type=`CircleBufferGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||1,t=t===void 0?8:Math.max(3,t),n=n===void 0?0:n,r=r===void 0?Math.PI*2:r;var i=[],a=[],o=[],s=[],c,l,u=new D,d=new b;for(a.push(0,0,0),o.push(0,0,1),s.push(.5,.5),l=0,c=3;l<=t;l++,c+=3){var f=n+l/t*r;u.x=e*Math.cos(f),u.y=e*Math.sin(f),a.push(u.x,u.y,u.z),o.push(0,0,1),d.x=(a[c]/e+1)/2,d.y=(a[c+1]/e+1)/2,s.push(d.x,d.y)}for(c=1;c<=t;c++)i.push(c,c+1,0);this.setIndex(i),this.setAttribute(`position`,new K(a,3)),this.setAttribute(`normal`,new K(o,3)),this.setAttribute(`uv`,new K(s,2))}function di(e){V.call(this),this.type=`ShadowMaterial`,this.color=new z(0),this.transparent=!0,this.setValues(e)}function fi(e){ge.call(this,e),this.type=`RawShaderMaterial`}function pi(e){V.call(this),this.defines={STANDARD:``},this.type=`MeshStandardMaterial`,this.color=new z(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function mi(e){pi.call(this),this.defines={STANDARD:``,PHYSICAL:``},this.type=`MeshPhysicalMaterial`,this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new b(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function hi(e){V.call(this),this.type=`MeshPhongMaterial`,this.color=new z(16777215),this.specular=new z(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function gi(e){V.call(this),this.defines={TOON:``},this.type=`MeshToonMaterial`,this.color=new z(16777215),this.specular=new z(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function _i(e){V.call(this),this.type=`MeshNormalMaterial`,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function vi(e){V.call(this),this.type=`MeshLambertMaterial`,this.color=new z(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function yi(e){V.call(this),this.defines={MATCAP:``},this.type=`MeshMatcapMaterial`,this.color=new z(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new b(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function bi(e){Fn.call(this),this.type=`LineDashedMaterial`,this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}function xi(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n}function Si(e,t,n,r){xi.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Ci(e,t,n,r){xi.call(this,e,t,n,r)}function wi(e,t,n,r){xi.call(this,e,t,n,r)}function Ti(e,t,n,r){if(e===void 0)throw Error(`THREE.KeyframeTrack: track name is undefined`);if(t===void 0||t.length===0)throw Error(`THREE.KeyframeTrack: no keyframes in track named `+e);this.name=e,this.times=dd.convertArray(t,this.TimeBufferType),this.values=dd.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function Ei(e,t,n){Ti.call(this,e,t,n)}function Di(e,t,n,r){Ti.call(this,e,t,n,r)}function Oi(e,t,n,r){Ti.call(this,e,t,n,r)}function ki(e,t,n,r){xi.call(this,e,t,n,r)}function Ai(e,t,n,r){Ti.call(this,e,t,n,r)}function ji(e,t,n,r){Ti.call(this,e,t,n,r)}function Mi(e,t,n,r){Ti.call(this,e,t,n,r)}function Ni(e,t,n,r){this.name=e,this.tracks=n,this.duration=t===void 0?-1:t,this.blendMode=r===void 0?Zs:r,this.uuid=X.generateUUID(),this.duration<0&&this.resetDuration()}function Pi(e){switch(e.toLowerCase()){case`scalar`:case`double`:case`float`:case`number`:case`integer`:return Oi;case`vector`:case`vector2`:case`vector3`:case`vector4`:return Mi;case`color`:return Di;case`quaternion`:return Ai;case`bool`:case`boolean`:return Ei;case`string`:return ji}throw Error(`THREE.KeyframeTrack: Unsupported typeName: `+e)}function Fi(e){if(e.type===void 0)throw Error(`THREE.KeyframeTrack: track type undefined, can not parse`);var t=Pi(e.type);if(e.times===void 0){var n=[],r=[];dd.flattenJSON(e.keys,n,r,`value`),e.times=n,e.values=r}return t.parse===void 0?new t(e.name,e.times,e.values,e.interpolation):t.parse(e)}function Ii(e,t,n){var r=this,i=!1,a=0,o=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,i===!1&&r.onStart!==void 0&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,r.onProgress!==void 0&&r.onProgress(e,a,o),a===o&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(e){r.onError!==void 0&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){var t=c.indexOf(e);return t!==-1&&c.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=c.length;t<n;t+=2){var r=c[t],i=c[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}}function Li(e){this.manager=e===void 0?pd:e,this.crossOrigin=`anonymous`,this.path=``,this.resourcePath=``,this.requestHeader={}}function Ri(e){Li.call(this,e)}function zi(e){Li.call(this,e)}function Bi(e){Li.call(this,e)}function Vi(e){Li.call(this,e)}function Hi(e){Li.call(this,e)}function Ui(e){Li.call(this,e)}function Wi(e){Li.call(this,e)}function Y(){this.type=`Curve`,this.arcLengthDivisions=200}function Gi(e,t,n,r,i,a,o,s){Y.call(this),this.type=`EllipseCurve`,this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function Ki(e,t,n,r,i,a){Gi.call(this,e,t,n,n,r,i,a),this.type=`ArcCurve`}function qi(){var e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){var c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;c*=o,l*=o,i(t,n,c,l)},calc:function(i){var a=i*i,o=a*i;return e+t*i+n*a+r*o}}}function Ji(e,t,n,r){Y.call(this),this.type=`CatmullRomCurve3`,this.points=e||[],this.closed=t||!1,this.curveType=n||`centripetal`,this.tension=r||.5}function Yi(e,t,n,r,i){var a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function Xi(e,t){var n=1-e;return n*n*t}function Zi(e,t){return 2*(1-e)*e*t}function Qi(e,t){return e*e*t}function $i(e,t,n,r){return Xi(e,t)+Zi(e,n)+Qi(e,r)}function ea(e,t){var n=1-e;return n*n*n*t}function ta(e,t){var n=1-e;return 3*n*n*e*t}function na(e,t){return 3*(1-e)*e*e*t}function ra(e,t){return e*e*e*t}function ia(e,t,n,r,i){return ea(e,t)+ta(e,n)+na(e,r)+ra(e,i)}function aa(e,t,n,r){Y.call(this),this.type=`CubicBezierCurve`,this.v0=e||new b,this.v1=t||new b,this.v2=n||new b,this.v3=r||new b}function oa(e,t,n,r){Y.call(this),this.type=`CubicBezierCurve3`,this.v0=e||new D,this.v1=t||new D,this.v2=n||new D,this.v3=r||new D}function sa(e,t){Y.call(this),this.type=`LineCurve`,this.v1=e||new b,this.v2=t||new b}function ca(e,t){Y.call(this),this.type=`LineCurve3`,this.v1=e||new D,this.v2=t||new D}function la(e,t,n){Y.call(this),this.type=`QuadraticBezierCurve`,this.v0=e||new b,this.v1=t||new b,this.v2=n||new b}function ua(e,t,n){Y.call(this),this.type=`QuadraticBezierCurve3`,this.v0=e||new D,this.v1=t||new D,this.v2=n||new D}function da(e){Y.call(this),this.type=`SplineCurve`,this.points=e||[]}function fa(){Y.call(this),this.type=`CurvePath`,this.curves=[],this.autoClose=!1}function pa(e){fa.call(this),this.type=`Path`,this.currentPoint=new b,e&&this.setFromPoints(e)}function ma(e){pa.call(this,e),this.uuid=X.generateUUID(),this.type=`Shape`,this.holes=[]}function ha(e,t){j.call(this),this.type=`Light`,this.color=new z(e),this.intensity=t===void 0?1:t,this.receiveShadow=void 0}function ga(e,t,n){ha.call(this,e,n),this.type=`HemisphereLight`,this.castShadow=void 0,this.position.copy(j.DefaultUp),this.updateMatrix(),this.groundColor=new z(t)}function _a(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new b(512,512),this.map=null,this.mapPass=null,this.matrix=new O,this._frustum=new Se,this._frameExtents=new b(1,1),this._viewportCount=1,this._viewports=[new C(0,0,1,1)]}function va(){_a.call(this,new ve(50,1,.5,500))}function ya(e,t,n,r,i,a){ha.call(this,e,t),this.type=`SpotLight`,this.position.copy(j.DefaultUp),this.updateMatrix(),this.target=new j,Object.defineProperty(this,`power`,{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=n===void 0?0:n,this.angle=r===void 0?Math.PI/3:r,this.penumbra=i===void 0?0:i,this.decay=a===void 0?1:a,this.shadow=new va}function ba(){_a.call(this,new ve(90,1,.5,500)),this._frameExtents=new b(4,2),this._viewportCount=6,this._viewports=[new C(2,1,1,1),new C(0,1,1,1),new C(3,1,1,1),new C(1,1,1,1),new C(3,0,1,1),new C(1,0,1,1)],this._cubeDirections=[new D(1,0,0),new D(-1,0,0),new D(0,0,1),new D(0,0,-1),new D(0,1,0),new D(0,-1,0)],this._cubeUps=[new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,0,1),new D(0,0,-1)]}function xa(e,t,n,r){ha.call(this,e,t),this.type=`PointLight`,Object.defineProperty(this,`power`,{get:function(){return this.intensity*4*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=n===void 0?0:n,this.decay=r===void 0?1:r,this.shadow=new ba}function Sa(e,t,n,r,i,a){_e.call(this),this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e===void 0?-1:e,this.right=t===void 0?1:t,this.top=n===void 0?1:n,this.bottom=r===void 0?-1:r,this.near=i===void 0?.1:i,this.far=a===void 0?2e3:a,this.updateProjectionMatrix()}function Ca(){_a.call(this,new Sa(-5,5,5,-5,.5,500))}function wa(e,t){ha.call(this,e,t),this.type=`DirectionalLight`,this.position.copy(j.DefaultUp),this.updateMatrix(),this.target=new j,this.shadow=new Ca}function Ta(e,t){ha.call(this,e,t),this.type=`AmbientLight`,this.castShadow=void 0}function Ea(e,t,n,r){ha.call(this,e,t),this.type=`RectAreaLight`,this.width=n===void 0?10:n,this.height=r===void 0?10:r}function Da(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new D)}function Oa(e,t){ha.call(this,void 0,t),this.type=`LightProbe`,this.sh=e===void 0?new Da:e}function ka(e){Li.call(this,e),this.textures={}}function Aa(){q.call(this),this.type=`InstancedBufferGeometry`,this.instanceCount=1/0}function ja(e,t,n,r){typeof n==`number`&&(r=n,n=!1,console.error(`THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.`)),H.call(this,e,t,n),this.meshPerAttribute=r||1}function Ma(e){Li.call(this,e)}function Na(e){Li.call(this,e)}function Pa(e){typeof createImageBitmap>`u`&&console.warn(`THREE.ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&console.warn(`THREE.ImageBitmapLoader: fetch() not supported.`),Li.call(this,e),this.options=void 0}function Fa(){this.type=`ShapePath`,this.color=new z,this.subPaths=[],this.currentPath=null}function Ia(e){this.type=`Font`,this.data=e}function La(e,t,n){for(var r=Array.from?Array.from(e):String(e).split(``),i=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,c=0,l=0;l<r.length;l++){var u=r[l];if(u===`\n`)s=0,c-=a;else{var d=Ra(u,i,s,c,n);s+=d.offsetX,o.push(d.path)}}return o}function Ra(e,t,n,r,i){var a=i.glyphs[e]||i.glyphs[`?`];if(!a){console.error(`THREE.Font: character "`+e+`" does not exists in font family `+i.familyName+`.`);return}var o=new Fa,s,c,l,u,d,f,p,m;if(a.o)for(var h=a._cachedOutline||(a._cachedOutline=a.o.split(` `)),g=0,_=h.length;g<_;)switch(h[g++]){case`m`:s=h[g++]*t+n,c=h[g++]*t+r,o.moveTo(s,c);break;case`l`:s=h[g++]*t+n,c=h[g++]*t+r,o.lineTo(s,c);break;case`q`:l=h[g++]*t+n,u=h[g++]*t+r,d=h[g++]*t+n,f=h[g++]*t+r,o.quadraticCurveTo(d,f,l,u);break;case`b`:l=h[g++]*t+n,u=h[g++]*t+r,d=h[g++]*t+n,f=h[g++]*t+r,p=h[g++]*t+n,m=h[g++]*t+r,o.bezierCurveTo(d,f,p,m,l,u);break}return{offsetX:a.ha*t,path:o}}function za(e){Li.call(this,e)}function Ba(e){Li.call(this,e)}function Va(e,t,n){Oa.call(this,void 0,n);var r=new z().set(e),i=new z().set(t),a=new D(r.r,r.g,r.b),o=new D(i.r,i.g,i.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}function Ha(e,t){Oa.call(this,void 0,t);var n=new z().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}function Ua(){this.type=`StereoCamera`,this.aspect=1,this.eyeSep=.064,this.cameraL=new ve,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ve,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function Wa(e){this.autoStart=e===void 0?!0:e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Ga(){j.call(this),this.type=`AudioListener`,this.context=Ed.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Wa}function Ka(e){j.call(this),this.type=`Audio`,this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType=`empty`,this._startedAt=0,this._progress=0,this.filters=[]}function qa(e){Ka.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel=`HRTF`,this.panner.connect(this.gain)}function Ja(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t===void 0?2048:t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function Ya(e,t,n){this.binding=e,this.valueSize=n;var r,i,a;switch(t){case`quaternion`:r=this._slerp,i=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case`string`:case`bool`:r=this._select,i=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(n*5);break;default:r=this._lerp,i=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}function Xa(e,t,n){var r=n||Za.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function Za(e,t,n){this.path=t,this.parsedPath=n||Za.parseTrackName(t),this.node=Za.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function Qa(){this.uuid=X.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function $a(e,t,n,r){this._mixer=e,this._clip=t,this._localRoot=n||null,this.blendMode=r||t.blendMode;for(var i=t.tracks,a=i.length,o=Array(a),s={endingStart:Js,endingEnd:Js},c=0;c!==a;++c){var l=i[c].createInterpolant(null);o[c]=l,l.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Us,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function eo(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function to(e){typeof e==`string`&&(console.warn(`THREE.Uniform: Type parameter is no longer needed.`),e=arguments[1]),this.value=e}function no(e,t,n){Tn.call(this,e,t),this.meshPerAttribute=n||1}function ro(e,t,n,r){this.ray=new I(e,t),this.near=n||0,this.far=r||1/0,this.camera=null,this.layers=new A,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn(`THREE.Raycaster: params.PointCloud has been renamed to params.Points.`),this.Points}}})}function io(e,t){return e.distance-t.distance}function ao(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),r===!0)for(var i=e.children,a=0,o=i.length;a<o;a++)ao(i[a],t,n,!0)}function oo(e,t,n){return this.radius=e===void 0?1:e,this.phi=t===void 0?0:t,this.theta=n===void 0?0:n,this}function so(e,t,n){return this.radius=e===void 0?1:e,this.theta=t===void 0?0:t,this.y=n===void 0?0:n,this}function co(e,t){this.min=e===void 0?new b(1/0,1/0):e,this.max=t===void 0?new b(-1/0,-1/0):t}function lo(e,t){this.start=e===void 0?new D:e,this.end=t===void 0?new D:t}function uo(e){j.call(this),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}function fo(e,t){j.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new q,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],i=0,a=1,o=32;i<o;i++,a++){var s=i/o*Math.PI*2,c=a/o*Math.PI*2;r.push(Math.cos(s),Math.sin(s),1,Math.cos(c),Math.sin(c),1)}n.setAttribute(`position`,new K(r,3));var l=new Fn({fog:!1,toneMapped:!1});this.cone=new Ln(n,l),this.add(this.cone),this.update()}function po(e){var t=[];e&&e.isBone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,po(e.children[n]));return t}function mo(e){for(var t=po(e),n=new q,r=[],i=[],a=new z(0,0,1),o=new z(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}n.setAttribute(`position`,new K(r,3)),n.setAttribute(`color`,new K(i,3));var l=new Fn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});Ln.call(this,n,l),this.type=`SkeletonHelper`,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function ho(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var r=new Xr(t,4,2),i=new re({wireframe:!0,fog:!1,toneMapped:!1});de.call(this,r,i),this.type=`PointLightHelper`,this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function go(e,t,n){j.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var r=new er(t);r.rotateY(Math.PI*.5),this.material=new re({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);var i=r.getAttribute(`position`),a=new Float32Array(i.count*3);r.setAttribute(`color`,new H(a,3)),this.add(new de(r,this.material)),this.update()}function _o(e,t,n,r){e=e||10,t=t||10,n=new z(n===void 0?4473924:n),r=new z(r===void 0?8947848:r);for(var i=t/2,a=e/t,o=e/2,s=[],c=[],l=0,u=0,d=-o;l<=t;l++,d+=a){s.push(-o,0,d,o,0,d),s.push(d,0,-o,d,0,o);var f=l===i?n:r;f.toArray(c,u),u+=3,f.toArray(c,u),u+=3,f.toArray(c,u),u+=3,f.toArray(c,u),u+=3}var p=new q;p.setAttribute(`position`,new K(s,3)),p.setAttribute(`color`,new K(c,3));var m=new Fn({vertexColors:!0,toneMapped:!1});Ln.call(this,p,m),this.type=`GridHelper`}function vo(e,t,n,r,i,a){e=e||10,t=t||16,n=n||8,r=r||64,i=new z(i===void 0?4473924:i),a=new z(a===void 0?8947848:a);var o=[],s=[],c,l,u,d,f,p,m;for(d=0;d<=t;d++)u=d/t*(Math.PI*2),c=Math.sin(u)*e,l=Math.cos(u)*e,o.push(0,0,0),o.push(c,0,l),m=d&1?i:a,s.push(m.r,m.g,m.b),s.push(m.r,m.g,m.b);for(d=0;d<=n;d++)for(m=d&1?i:a,p=e-e/n*d,f=0;f<r;f++)u=f/r*(Math.PI*2),c=Math.sin(u)*p,l=Math.cos(u)*p,o.push(c,0,l),s.push(m.r,m.g,m.b),u=(f+1)/r*(Math.PI*2),c=Math.sin(u)*p,l=Math.cos(u)*p,o.push(c,0,l),s.push(m.r,m.g,m.b);var h=new q;h.setAttribute(`position`,new K(o,3)),h.setAttribute(`color`,new K(s,3));var g=new Fn({vertexColors:!0,toneMapped:!1});Ln.call(this,h,g),this.type=`PolarGridHelper`}function yo(e,t,n){j.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);var r=new q;r.setAttribute(`position`,new K([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var i=new Fn({fog:!1,toneMapped:!1});this.lightPlane=new In(r,i),this.add(this.lightPlane),r=new q,r.setAttribute(`position`,new K([0,0,0,0,0,1],3)),this.targetLine=new In(r,i),this.add(this.targetLine),this.update()}function bo(e){var t=new q,n=new Fn({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],a={},o=new z(16755200),s=new z(16711680),c=new z(43775),l=new z(16777215),u=new z(3355443);d(`n1`,`n2`,o),d(`n2`,`n4`,o),d(`n4`,`n3`,o),d(`n3`,`n1`,o),d(`f1`,`f2`,o),d(`f2`,`f4`,o),d(`f4`,`f3`,o),d(`f3`,`f1`,o),d(`n1`,`f1`,o),d(`n2`,`f2`,o),d(`n3`,`f3`,o),d(`n4`,`f4`,o),d(`p`,`n1`,s),d(`p`,`n2`,s),d(`p`,`n3`,s),d(`p`,`n4`,s),d(`u1`,`u2`,c),d(`u2`,`u3`,c),d(`u3`,`u1`,c),d(`c`,`t`,l),d(`p`,`c`,u),d(`cn1`,`cn2`,u),d(`cn3`,`cn4`,u),d(`cf1`,`cf2`,u),d(`cf3`,`cf4`,u);function d(e,t,n){f(e,n),f(t,n)}function f(e,t){r.push(0,0,0),i.push(t.r,t.g,t.b),a[e]===void 0&&(a[e]=[]),a[e].push(r.length/3-1)}t.setAttribute(`position`,new K(r,3)),t.setAttribute(`color`,new K(i,3)),Ln.call(this,t,n),this.type=`CameraHelper`,this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function xo(e,t,n,r,i,a,o){sf.set(i,a,o).unproject(r);var s=t[e];if(s!==void 0)for(var c=n.getAttribute(`position`),l=0,u=s.length;l<u;l++)c.setXYZ(s[l],sf.x,sf.y,sf.z)}function So(e,t){this.object=e,t===void 0&&(t=16776960);var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new q;i.setIndex(new H(n,1)),i.setAttribute(`position`,new H(r,3)),Ln.call(this,i,new Fn({color:t,toneMapped:!1})),this.type=`BoxHelper`,this.matrixAutoUpdate=!1,this.update()}function Co(e,t){this.type=`Box3Helper`,this.box=e,t=t||16776960;var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],i=new q;i.setIndex(new H(n,1)),i.setAttribute(`position`,new K(r,3)),Ln.call(this,i,new Fn({color:t,toneMapped:!1})),this.type=`Box3Helper`,this.geometry.computeBoundingSphere()}function wo(e,t,n){this.plane=e,this.size=t===void 0?1:t;var r=n===void 0?16776960:n,i=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],a=new q;a.setAttribute(`position`,new K(i,3)),a.computeBoundingSphere(),In.call(this,a,new Fn({color:r,toneMapped:!1})),this.type=`PlaneHelper`;var o=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],s=new q;s.setAttribute(`position`,new K(o,3)),s.computeBoundingSphere(),this.add(new de(s,new re({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}function To(e,t,n,r,i,a){j.call(this),this.type=`ArrowHelper`,e===void 0&&(e=new D(0,0,1)),t===void 0&&(t=new D(0,0,0)),n===void 0&&(n=1),r===void 0&&(r=16776960),i===void 0&&(i=.2*n),a===void 0&&(a=.2*i),df===void 0&&(df=new q,df.setAttribute(`position`,new K([0,0,0,0,1,0],3)),ff=new oi(0,.5,1,5,1),ff.translate(0,-.5,0)),this.position.copy(t),this.line=new In(df,new Fn({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new de(ff,new re({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,a)}function Eo(e){e=e||1;var t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new q;r.setAttribute(`position`,new K(t,3)),r.setAttribute(`color`,new K(n,3));var i=new Fn({vertexColors:!0,toneMapped:!1});Ln.call(this,r,i),this.type=`AxesHelper`}function Do(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=Mo(vf),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}function Oo(e){return e===void 0||e.type!==1009?!1:e.encoding===3e3||e.encoding===3001||e.encoding===3007}function ko(){for(var e=[],t=[],n=[],r=mf,i=0;i<_f;i++){var a=Math.pow(2,r);t.push(a);var o=1/a;i>mf-pf?o=gf[i-mf+pf-1]:i==0&&(o=0),n.push(o);for(var s=1/(a-1),c=-s/2,l=1+s/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],d=6,f=6,p=3,m=2,h=1,g=new Float32Array(p*f*d),_=new Float32Array(m*f*d),v=new Float32Array(h*f*d),y=0;y<d;y++){var b=y%3*2/3-1,x=y>2?0:-1,S=[b,x,0,b+2/3,x,0,b+2/3,x+1,0,b,x,0,b+2/3,x+1,0,b,x+1,0];g.set(S,p*f*y),_.set(u,m*f*y);var C=[y,y,y,y,y,y];v.set(C,h*f*y)}var w=new q;w.setAttribute(`position`,new H(g,p)),w.setAttribute(`uv`,new H(_,m)),w.setAttribute(`faceIndex`,new H(v,h)),e.push(w),r>pf&&r--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}function Ao(e){var t=new w(3*hf,3*hf,e);return t.texture.mapping=306,t.texture.name=`PMREM.cubeUv`,t.scissorTest=!0,t}function jo(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function Mo(e){var t=new Float32Array(e),n=new D(0,1,0),r=new fi({defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:yf[$s]},outputEncoding:{value:yf[$s]}},vertexShader:Fo(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n${Io()}\n\n#define ENVMAP_TYPE_CUBE_UV\n#include <cube_uv_reflection_fragment>\n\nvec3 getSample(float theta, vec3 axis) {\n float cosTheta = cos(theta);\n // Rodrigues\' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross(axis, vOutputDirection) * sin(theta)\n + axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n return bilinearCubeUV(envMap, sampleDirection, mipInt);\n}\n\nvoid main() {\n vec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n if (all(equal(axis, vec3(0.0))))\n axis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);\n axis = normalize(axis);\n gl_FragColor = vec4(0.0);\n gl_FragColor.rgb += weights[0] * getSample(0.0, axis);\n for (int i = 1; i < n; i++) {\n if (i >= samples)\n break;\n float theta = dTheta * float(i);\n gl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);\n gl_FragColor.rgb += weights[i] * getSample(theta, axis);\n }\n gl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n `,blending:0,depthTest:!1,depthWrite:!1});return r.type=`SphericalGaussianBlur`,r}function No(){var e=new fi({uniforms:{envMap:{value:null},texelSize:{value:new b(1,1)},inputEncoding:{value:yf[$s]},outputEncoding:{value:yf[$s]}},vertexShader:Fo(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n${Io()}\n\n#include <common>\n\nvoid main() {\n gl_FragColor = vec4(0.0);\n vec3 outputDirection = normalize(vOutputDirection);\n vec2 uv = equirectUv( outputDirection );\n vec2 f = fract(uv / texelSize - 0.5);\n uv -= f * texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize.x;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize.y;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize.x;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n gl_FragColor.rgb = mix(tm, bm, f.y);\n gl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n `,blending:0,depthTest:!1,depthWrite:!1});return e.type=`EquirectangularToCubeUV`,e}function Po(){var e=new fi({uniforms:{envMap:{value:null},inputEncoding:{value:yf[$s]},outputEncoding:{value:yf[$s]}},vertexShader:Fo(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n${Io()}\n\nvoid main() {\n gl_FragColor = vec4(0.0);\n gl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n gl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n `,blending:0,depthTest:!1,depthWrite:!1});return e.type=`CubemapToCubeUV`,e}function Fo(){return`\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection(vec2 uv, float face) {\n uv = 2.0 * uv - 1.0;\n vec3 direction = vec3(uv, 1.0);\n if (face == 0.0) {\n direction = direction.zyx; // ( 1, v, u ) pos x\n } else if (face == 1.0) {\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n } else if (face == 2.0) {\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n } else if (face == 3.0) {\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n } else if (face == 4.0) {\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n } else if (face == 5.0) {\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n }\n return direction;\n}\n\nvoid main() {\n vOutputDirection = getDirection(uv, faceIndex);\n gl_Position = vec4( position, 1.0 );\n}\n `}function Io(){return`\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include <encodings_pars_fragment>\n\nvec4 inputTexelToLinear(vec4 value){\n if(inputEncoding == 0){\n return value;\n }else if(inputEncoding == 1){\n return sRGBToLinear(value);\n }else if(inputEncoding == 2){\n return RGBEToLinear(value);\n }else if(inputEncoding == 3){\n return RGBMToLinear(value, 7.0);\n }else if(inputEncoding == 4){\n return RGBMToLinear(value, 16.0);\n }else if(inputEncoding == 5){\n return RGBDToLinear(value, 256.0);\n }else{\n return GammaToLinear(value, 2.2);\n }\n}\n\nvec4 linearToOutputTexel(vec4 value){\n if(outputEncoding == 0){\n return value;\n }else if(outputEncoding == 1){\n return LinearTosRGB(value);\n }else if(outputEncoding == 2){\n return LinearToRGBE(value);\n }else if(outputEncoding == 3){\n return LinearToRGBM(value, 7.0);\n }else if(outputEncoding == 4){\n return LinearToRGBM(value, 16.0);\n }else if(outputEncoding == 5){\n return LinearToRGBD(value, 256.0);\n }else{\n return LinearToGamma(value, 2.2);\n }\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n return inputTexelToLinear(color);\n}\n `}function Lo(e){console.warn(`THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.`),Ji.call(this,e),this.type=`catmullrom`,this.closed=!0}function Ro(e){console.warn(`THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.`),Ji.call(this,e),this.type=`catmullrom`}function zo(e){console.warn(`THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.`),Ji.call(this,e),this.type=`catmullrom`}var Bo,Vo,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs,gs,_s,vs,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds,Os,ks,As,js,Ms,Ns,Ps,Fs,Is,Ls,Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,Ks,qs,Js,Ys,Xs,Zs,Qs,$s,ec,tc,nc,rc,ic,ac,oc,sc,cc,lc,uc,dc,fc,pc,X,mc,hc,gc,_c,vc,yc,bc,xc,Sc,Cc,wc,Tc,Ec,Dc,Oc,kc,Ac,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc,zc,Bc,Vc,Hc,Uc,Wc,Gc,Kc,qc,Jc,Yc,Xc,Zc,Qc,$c,el,tl,nl,rl,il,al,ol,sl,cl,ll,ul,dl,fl,pl,ml,hl,gl,_l,vl,yl,bl,xl,Sl,Cl,wl,Tl,El,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Fl,Il,Ll,Rl,zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l,eu,tu,nu,ru,iu,au,ou,su,cu,Z,Q,lu,uu,du,fu,pu,mu,hu,gu,_u,vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au,ju,Mu,Nu,Pu,Fu,Iu,Lu,Ru,zu,Bu,Vu,Hu,Uu,Wu,Gu,Ku,qu,Ju,Yu,Xu,Zu,Qu,$u,ed,td,nd,rd,id,ad,od,sd,cd,ld,ud,dd,fd,pd,md,hd,gd,_d,vd,yd,bd,xd,Sd,Cd,wd,Td,Ed,Dd,Od,kd,Ad,jd,Md,Nd,Pd,Fd,Id,Ld,Rd,zd,Bd,Vd,Hd,Ud,Wd,Gd,Kd,qd,Jd,Yd,Xd,Zd,Qd,$d,ef,tf,nf,rf,af,of,sf,cf,lf,uf,df,ff,pf,mf,hf,gf,_f,vf,yf,bf,xf,Sf,Cf,wf,Tf,Ef,Df,Of=e((()=>{for(Number.EPSILON===void 0&&(Number.EPSILON=Math.pow(2,-52)),Number.isInteger===void 0&&(Number.isInteger=function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e}),Math.sign===void 0&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),(`name`in Function.prototype)||Object.defineProperty(Function.prototype,`name`,{get:function(){return this.toString().match(/^\\s*function\\s*([^\\(\\s]*)/)[1]}}),Object.assign===void 0&&(Object.assign=function(e){if(e==null)throw TypeError(`Cannot convert undefined or null to object`);let t=Object(e);for(let e=1;e<arguments.length;e++){let n=arguments[e];if(n!=null)for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t}),Bo=1e3,Vo=1001,Ho=1002,Uo=1003,Wo=1004,Go=1005,Ko=1006,qo=1007,Jo=1008,Yo=1009,Xo=1012,Zo=1015,Qo=1020,$o=1022,es=1023,ts=es,ns=1026,rs=33776,is=33777,as=33778,os=33779,ss=35840,cs=35841,ls=35842,us=35843,ds=36196,fs=37492,ps=37496,ms=37808,hs=37809,gs=37810,_s=37811,vs=37812,ys=37813,bs=37814,xs=37815,Ss=37816,Cs=37817,ws=37818,Ts=37819,Es=37820,Ds=37821,Os=36492,ks=37840,As=37841,js=37842,Ms=37843,Ns=37844,Ps=37845,Fs=37846,Is=37847,Ls=37848,Rs=37849,zs=37850,Bs=37851,Vs=37852,Hs=37853,Us=2201,Ws=2202,Gs=2300,Ks=2301,qs=2302,Js=2400,Ys=2401,Xs=2402,Zs=2500,Qs=2501,$s=3e3,ec=3001,tc=3007,nc=3002,rc=3003,ic=3004,ac=3005,oc=3006,sc=3200,cc=3201,lc=7680,uc=35044,dc=35048,Object.assign(y.prototype,{addEventListener:function(e,t){this._listeners===void 0&&(this._listeners={});var n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)},hasEventListener:function(e,t){if(this._listeners===void 0)return!1;var n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1},removeEventListener:function(e,t){if(this._listeners!==void 0){var n=this._listeners[e];if(n!==void 0){var r=n.indexOf(t);r!==-1&&n.splice(r,1)}}},dispatchEvent:function(e){if(this._listeners!==void 0){var t=this._listeners[e.type];if(t!==void 0){e.target=this;for(var n=t.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,e)}}}}),fc=[],pc=0;pc<256;pc++)fc[pc]=(pc<16?`0`:``)+pc.toString(16);X={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(fc[e&255]+fc[e>>8&255]+fc[e>>16&255]+fc[e>>24&255]+`-`+fc[t&255]+fc[t>>8&255]+`-`+fc[t>>16&15|64]+fc[t>>24&255]+`-`+fc[n&63|128]+fc[n>>8&255]+`-`+fc[n>>16&255]+fc[n>>24&255]+fc[r&255]+fc[r>>8&255]+fc[r>>16&255]+fc[r>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*X.DEG2RAD},radToDeg:function(e){return e*X.RAD2DEG},isPowerOfTwo:function(e){return(e&e-1)==0&&e!==0},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:console.warn(`THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}},Object.defineProperties(b.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(b.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return t===void 0?(this.x+=e.x,this.y+=e.y,this):(console.warn(`THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.`),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return t===void 0?(this.x-=e.x,this.y-=e.y,this):(console.warn(`THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.`),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn(`THREE.Vector2: offset has been removed from .fromBufferAttribute().`),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}}),Object.assign(x.prototype,{isMatrix3:!0,set:function(e,t,n,r,i,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return new this.constructor().fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},extractBasis:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s},getInverse:function(e,t){t!==void 0&&console.warn(`THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.`);var n=e.elements,r=this.elements,i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],d=n[7],f=n[8],p=f*c-l*d,m=l*u-f*s,h=d*s-c*u,g=i*p+a*m+o*h;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);var _=1/g;return r[0]=p*_,r[1]=(o*d-f*a)*_,r[2]=(l*a-o*c)*_,r[3]=m*_,r[4]=(f*i-o*u)*_,r[5]=(o*s-l*i)*_,r[6]=h*_,r[7]=(a*u-d*i)*_,r[8]=(c*i-a*s)*_,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,r,i,a,o){var s=Math.cos(i),c=Math.sin(i);this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],c=r[4],l=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*c,r[6]=t*o+n*l,r[1]=-n*i+t*s,r[4]=-n*a+t*c,r[7]=-n*o+t*l,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}}),hc={getDataURL:function(e){var t;if(typeof HTMLCanvasElement>`u`)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{mc===void 0&&(mc=document.createElementNS(`http://www.w3.org/1999/xhtml`,`canvas`)),mc.width=e.width,mc.height=e.height;var n=mc.getContext(`2d`);e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=mc}return t.width>2048||t.height>2048?t.toDataURL(`image/jpeg`,.6):t.toDataURL(`image/png`)}},gc=0,S.DEFAULT_IMAGE=void 0,S.DEFAULT_MAPPING=300,S.prototype=Object.assign(Object.create(y.prototype),{constructor:S,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];var n={metadata:{version:4.5,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,mapping:this.mapping,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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){var r=this.image;if(r.uuid===void 0&&(r.uuid=X.generateUUID()),!t&&e.images[r.uuid]===void 0){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)i.push(hc.getDataURL(r[a]))}else i=hc.getDataURL(r);e.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:`dispose`})},transformUv:function(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Bo:e.x-=Math.floor(e.x);break;case Vo:e.x=e.x<0?0:1;break;case Ho:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Bo:e.y-=Math.floor(e.y);break;case Vo:e.y=e.y<0?0:1;break;case Ho:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(S.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),Object.defineProperties(C.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(C.prototype,{isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this},add:function(e,t){return t===void 0?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this):(console.warn(`THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.`),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return t===void 0?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this):(console.warn(`THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.`),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var _=(c+1)/2,v=(f+1)/2,y=(g+1)/2,b=(l+d)/4,x=(u+m)/4,S=(p+h)/4;return _>v&&_>y?_<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(_),r=b/n,i=x/n):v>y?v<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(v),n=b/r,i=S/r):y<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(y),n=x/i,r=S/i),this.set(n,r,i,t),this}var C=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(C)<.001&&(C=1),this.x=(h-p)/C,this.y=(u-m)/C,this.z=(d-l)/C,this.w=Math.acos((c+f+g-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn(`THREE.Vector4: offset has been removed from .fromBufferAttribute().`),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}),w.prototype=Object.assign(Object.create(y.prototype),{constructor:w,isWebGLRenderTarget:!0,setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),T.prototype=Object.assign(Object.create(w.prototype),{constructor:T,isWebGLMultisampleRenderTarget:!0,copy:function(e){return w.prototype.copy.call(this,e),this.samples=e.samples,this}}),Object.assign(E,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,a,o){var s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){var h=1-o,g=s*d+c*f+l*p+u*m,_=g>=0?1:-1,v=1-g*g;if(v>Number.EPSILON){var y=Math.sqrt(v),b=Math.atan2(y,g*_);h=Math.sin(h*b)/y,o=Math.sin(o*b)/y}var x=o*_;if(s=s*h+d*x,c=c*h+f*x,l=l*h+p*x,u=u*h+m*x,h===1-o){var S=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=S,c*=S,l*=S,u*=S}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u},multiplyQuaternionsFlat:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}}),Object.defineProperties(E.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(E.prototype,{isQuaternion:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!(e&&e.isEuler))throw Error(`THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.`);var n=e._x,r=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:console.warn(`THREE.Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t!==!1&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u,f;return d>0?(f=.5/Math.sqrt(d+1),this._w=.25/f,this._x=(l-s)*f,this._y=(i-c)*f,this._z=(a-r)*f):n>o&&n>u?(f=2*Math.sqrt(1+n-o-u),this._w=(l-s)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(i+c)/f):o>u?(f=2*Math.sqrt(1+o-n-u),this._w=(i-c)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(s+l)/f):(f=2*Math.sqrt(1+u-n-o),this._w=(a-r)/f,this._x=(i+c)/f,this._y=(s+l)/f,this._z=.25*f),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=1e-6,r=e.dot(t)+1;return r<n?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(X.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(n===0)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this},multiply:function(e,t){return t===void 0?this.multiplyQuaternions(this,e):(console.warn(`THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.`),this.multiplyQuaternions(e,t))},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this},slerp:function(e,t){if(t===0)return this;if(t===1)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*n+t*this._x,this._y=c*r+t*this._y,this._z=c*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),u=Math.atan2(l,o),d=Math.sin((1-t)*u)/l,f=Math.sin(t*u)/l;return this._w=a*d+this._w*f,this._x=n*d+this._x*f,this._y=r*d+this._y*f,this._z=i*d+this._z*f,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return t===void 0&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),_c=new D,vc=new E,Object.assign(D.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return t===void 0?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this):(console.warn(`THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.`),this.addVectors(e,t))},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return t===void 0?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this):(console.warn(`THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.`),this.subVectors(e,t))},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return t===void 0?(this.x*=e.x,this.y*=e.y,this.z*=e.z,this):(console.warn(`THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.`),this.multiplyVectors(e,t))},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error(`THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.`),this.applyQuaternion(vc.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(vc.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*r-o*n,l=s*n+o*t-i*r,u=s*r+i*n-a*t,d=-i*t-a*n-o*r;return this.x=c*s+d*-i+l*-o-u*-a,this.y=l*s+d*-a+u*-i-c*-o,this.z=u*s+d*-o+c*-a-l*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this},cross:function(e,t){return t===void 0?this.crossVectors(this,e):(console.warn(`THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.`),this.crossVectors(e,t))},crossVectors:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},projectOnVector:function(e){var t=e.lengthSq();if(t===0)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return _c.copy(this).projectOnVector(e),this.sub(_c)},reflect:function(e){return this.sub(_c.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(X.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,t*4)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,t*3)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn(`THREE.Vector3: offset has been removed from .fromBufferAttribute().`),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}),yc=new D,bc=new O,xc=new D(0,0,0),Sc=new D(1,1,1),Cc=new D,wc=new D,Tc=new D,Object.assign(O.prototype,{isMatrix4:!0,set:function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return new O().fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,n=e.elements,r=1/yc.setFromMatrixColumn(e,0).length(),i=1/yc.setFromMatrixColumn(e,1).length(),a=1/yc.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error(`THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.`);var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){var d=a*l,f=a*u,p=o*l,m=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=f+p*c,t[5]=d-m*c,t[9]=-o*s,t[2]=m-d*c,t[6]=p+f*c,t[10]=a*s}else if(e.order===`YXZ`){var h=s*l,g=s*u,_=c*l,v=c*u;t[0]=h+v*o,t[4]=_*o-g,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=g*o-_,t[6]=v+h*o,t[10]=a*s}else if(e.order===`ZXY`){var h=s*l,g=s*u,_=c*l,v=c*u;t[0]=h-v*o,t[4]=-a*u,t[8]=_+g*o,t[1]=g+_*o,t[5]=a*l,t[9]=v-h*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){var d=a*l,f=a*u,p=o*l,m=o*u;t[0]=s*l,t[4]=p*c-f,t[8]=d*c+m,t[1]=s*u,t[5]=m*c+d,t[9]=f*c-p,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){var y=a*s,b=a*c,x=o*s,S=o*c;t[0]=s*l,t[4]=S-y*u,t[8]=x*u+b,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=b*u+x,t[10]=y-S*u}else if(e.order===`XZY`){var y=a*s,b=a*c,x=o*s,S=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=y*u+S,t[5]=a*l,t[9]=b*u-x,t[2]=x*u-b,t[6]=o*l,t[10]=S*u+y}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(xc,e,Sc)},lookAt:function(e,t,n){var r=this.elements;return Tc.subVectors(e,t),Tc.lengthSq()===0&&(Tc.z=1),Tc.normalize(),Cc.crossVectors(n,Tc),Cc.lengthSq()===0&&(Math.abs(n.z)===1?Tc.x+=1e-4:Tc.z+=1e-4,Tc.normalize(),Cc.crossVectors(n,Tc)),Cc.normalize(),wc.crossVectors(Tc,Cc),r[0]=Cc.x,r[4]=wc.x,r[8]=Tc.x,r[1]=Cc.y,r[5]=wc.y,r[9]=Tc.y,r[2]=Cc.z,r[6]=wc.z,r[10]=Tc.z,this},multiply:function(e,t){return t===void 0?this.multiplyMatrices(this,e):(console.warn(`THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.`),this.multiplyMatrices(e,t))},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],I=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*I,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*I,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*I,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*I,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15];return p*(+i*s*u-r*c*u-i*o*d+n*c*d+r*o*f-n*s*f)+m*(+t*s*f-t*c*d+i*a*d-r*a*f+r*c*l-i*s*l)+h*(+t*c*u-t*o*f-i*a*u+n*a*f+i*o*l-n*c*l)+g*(-r*o*l-t*s*u+t*o*d+r*a*u-n*a*d+n*s*l)},transpose:function(){var e=this.elements,t=e[1];return e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this},getInverse:function(e,t){t!==void 0&&console.warn(`THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.`);var n=this.elements,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=r[8],p=r[9],m=r[10],h=r[11],g=r[12],_=r[13],v=r[14],y=r[15],b=p*v*d-_*m*d+_*u*h-l*v*h-p*u*y+l*m*y,x=g*m*d-f*v*d-g*u*h+c*v*h+f*u*y-c*m*y,S=f*_*d-g*p*d+g*l*h-c*_*h-f*l*y+c*p*y,C=g*p*u-f*_*u-g*l*m+c*_*m+f*l*v-c*p*v,w=i*b+a*x+o*S+s*C;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var T=1/w;return n[0]=b*T,n[1]=(_*m*s-p*v*s-_*o*h+a*v*h+p*o*y-a*m*y)*T,n[2]=(l*v*s-_*u*s+_*o*d-a*v*d-l*o*y+a*u*y)*T,n[3]=(p*u*s-l*m*s-p*o*d+a*m*d+l*o*h-a*u*h)*T,n[4]=x*T,n[5]=(f*v*s-g*m*s+g*o*h-i*v*h-f*o*y+i*m*y)*T,n[6]=(g*u*s-c*v*s-g*o*d+i*v*d+c*o*y-i*u*y)*T,n[7]=(c*m*s-f*u*s+f*o*d-i*m*d-c*o*h+i*u*h)*T,n[8]=S*T,n[9]=(g*p*s-f*_*s-g*a*h+i*_*h+f*a*y-i*p*y)*T,n[10]=(c*_*s-g*l*s+g*a*d-i*_*d-c*a*y+i*l*y)*T,n[11]=(f*l*s-c*p*s-f*a*d+i*p*d+c*a*h-i*l*h)*T,n[12]=C*T,n[13]=(f*_*o-g*p*o+g*a*m-i*_*m-f*a*v+i*p*v)*T,n[14]=(g*l*o-c*_*o-g*a*u+i*_*u+c*a*v-i*l*v)*T,n[15]=(c*p*o-f*l*o+f*a*u-i*p*u-c*a*m+i*l*m)*T,this},scale:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this},decompose:function(e,t,n){var r=this.elements,i=yc.set(r[0],r[1],r[2]).length(),a=yc.set(r[4],r[5],r[6]).length(),o=yc.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],bc.copy(this);var s=1/i,c=1/a,l=1/o;return bc.elements[0]*=s,bc.elements[1]*=s,bc.elements[2]*=s,bc.elements[4]*=c,bc.elements[5]*=c,bc.elements[6]*=c,bc.elements[8]*=l,bc.elements[9]*=l,bc.elements[10]*=l,t.setFromRotationMatrix(bc),n.x=i,n.y=a,n.z=o,this},makePerspective:function(e,t,n,r,i,a){a===void 0&&console.warn(`THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.`);var o=this.elements,s=2*i/(t-e),c=2*i/(n-r),l=(t+e)/(t-e),u=(n+r)/(n-r),d=-(a+i)/(a-i),f=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=f,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),c=1/(n-r),l=1/(a-i),u=(t+e)*s,d=(n+r)*c,f=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-f,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}),Ec=new O,Dc=new E,k.RotationOrders=[`XYZ`,`YZX`,`ZXY`,`XZY`,`YXZ`,`ZYX`],k.DefaultOrder=`XYZ`,Object.defineProperties(k.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(k.prototype,{isEuler:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=X.clamp,i=e.elements,a=i[0],o=i[4],s=i[8],c=i[1],l=i[5],u=i[9],d=i[2],f=i[6],p=i[10];switch(t=t||this._order,t){case`XYZ`:this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(f,l),this._z=0);break;case`YXZ`:this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-d,a),this._z=0);break;case`ZXY`:this._x=Math.asin(r(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a));break;case`ZYX`:this._y=Math.asin(-r(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l));break;case`YZX`:this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-d,a)):(this._x=0,this._y=Math.atan2(s,p));break;case`XZY`:this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn(`THREE.Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n!==!1&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return Ec.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ec,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return Dc.setFromEuler(this),this.setFromQuaternion(Dc,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new D(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(A.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return(this.mask&e.mask)!==0}}),Oc=0,kc=new D,Ac=new E,jc=new O,Mc=new D,Nc=new D,Pc=new D,Fc=new E,Ic=new D(1,0,0),Lc=new D(0,1,0),Rc=new D(0,0,1),zc={type:`added`},Bc={type:`removed`},j.DefaultUp=new D(0,1,0),j.DefaultMatrixAutoUpdate=!0,j.prototype=Object.assign(Object.create(y.prototype),{constructor:j,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return Ac.setFromAxisAngle(e,t),this.quaternion.multiply(Ac),this},rotateOnWorldAxis:function(e,t){return Ac.setFromAxisAngle(e,t),this.quaternion.premultiply(Ac),this},rotateX:function(e){return this.rotateOnAxis(Ic,e)},rotateY:function(e){return this.rotateOnAxis(Lc,e)},rotateZ:function(e){return this.rotateOnAxis(Rc,e)},translateOnAxis:function(e,t){return kc.copy(e).applyQuaternion(this.quaternion),this.position.add(kc.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(Ic,e)},translateY:function(e){return this.translateOnAxis(Lc,e)},translateZ:function(e){return this.translateOnAxis(Rc,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(jc.getInverse(this.matrixWorld))},lookAt:function(e,t,n){e.isVector3?Mc.copy(e):Mc.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),Nc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?jc.lookAt(Nc,Mc,this.up):jc.lookAt(Mc,Nc,this.up),this.quaternion.setFromRotationMatrix(jc),r&&(jc.extractRotation(r.matrixWorld),Ac.setFromRotationMatrix(jc),this.quaternion.premultiply(Ac.inverse()))},add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error(`THREE.Object3D.add: object can\'t be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(zc)):console.error(`THREE.Object3D.add: object not an instance of THREE.Object3D.`,e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Bc)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),jc.getInverse(this.matrixWorld),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),jc.multiply(e.parent.matrixWorld)),e.applyMatrix4(jc),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty(`id`,e)},getObjectByName:function(e){return this.getObjectByProperty(`name`,e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(e,t);if(i!==void 0)return i}},getWorldPosition:function(e){return e===void 0&&(console.warn(`THREE.Object3D: .getWorldPosition() target is now required`),e=new D),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return e===void 0&&(console.warn(`THREE.Object3D: .getWorldQuaternion() target is now required`),e=new E),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Nc,e,Pc),e},getWorldScale:function(e){return e===void 0&&(console.warn(`THREE.Object3D: .getWorldScale() target is now required`),e=new D),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Nc,Fc,e),e},getWorldDirection:function(e){e===void 0&&(console.warn(`THREE.Object3D: .getWorldDirection() target is now required`),e=new D),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:`Object`,generator:`Object3D.toJSON`});var r={};r.uuid=this.uuid,r.type=this.type,this.name!==``&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),JSON.stringify(this.userData)!==`{}`&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON());function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);var a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){var o=a.shapes;if(Array.isArray(o))for(var s=0,c=o.length;s<c;s++){var l=o[s];i(e.shapes,l)}else i(e.shapes,o)}}if(this.material!==void 0)if(Array.isArray(this.material)){for(var u=[],s=0,c=this.material.length;s<c;s++)u.push(i(e.materials,this.material[s]));r.material=u}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(var s=0;s<this.children.length;s++)r.children.push(this.children[s].toJSON(e).object)}if(t){var d=h(e.geometries),f=h(e.materials),p=h(e.textures),m=h(e.images),o=h(e.shapes);d.length>0&&(n.geometries=d),f.length>0&&(n.materials=f),p.length>0&&(n.textures=p),m.length>0&&(n.images=m),o.length>0&&(n.shapes=o)}return n.object=r,n;function h(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}},clone:function(e){return new this.constructor().copy(this,e)},copy:function(e,t){if(t===void 0&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(var n=0;n<e.children.length;n++){var r=e.children[n];this.add(r.clone())}return this}}),M.prototype=Object.assign(Object.create(j.prototype),{constructor:M,isScene:!0,copy:function(e,t){return j.prototype.copy.call(this,e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return this.background!==null&&(t.object.background=this.background.toJSON(e)),this.environment!==null&&(t.object.environment=this.environment.toJSON(e)),this.fog!==null&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:`dispose`})}}),Vc=[new D,new D,new D,new D,new D,new D,new D,new D],Hc=new D,Uc=new N,Wc=new D,Gc=new D,Kc=new D,qc=new D,Jc=new D,Yc=new D,Xc=new D,Zc=new D,Qc=new D,$c=new D,Object.assign(N.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.length;s<c;s+=3){var l=e[s],u=e[s+1],d=e[s+2];l<t&&(t=l),u<n&&(n=u),d<r&&(r=d),l>i&&(i=l),u>a&&(a=u),d>o&&(o=d)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),u=e.getY(s),d=e.getZ(s);l<t&&(t=l),u<n&&(n=u),d<r&&(r=d),l>i&&(i=l),u>a&&(a=u),d>o&&(o=d)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=Hc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return e===void 0&&(console.warn(`THREE.Box3: .getCenter() target is now required`),e=new D),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return e===void 0&&(console.warn(`THREE.Box3: .getSize() target is now required`),e=new D),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;t!==void 0&&(t.boundingBox===null&&t.computeBoundingBox(),Uc.copy(t.boundingBox),Uc.applyMatrix4(e.matrixWorld),this.union(Uc));for(var n=e.children,r=0,i=n.length;r<i;r++)this.expandByObject(n[r]);return this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return t===void 0&&(console.warn(`THREE.Box3: .getParameter() target is now required`),t=new D),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,Hc),Hc.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(Xc),Zc.subVectors(this.max,Xc),Wc.subVectors(e.a,Xc),Gc.subVectors(e.b,Xc),Kc.subVectors(e.c,Xc),qc.subVectors(Gc,Wc),Jc.subVectors(Kc,Gc),Yc.subVectors(Wc,Kc);var t=[0,-qc.z,qc.y,0,-Jc.z,Jc.y,0,-Yc.z,Yc.y,qc.z,0,-qc.x,Jc.z,0,-Jc.x,Yc.z,0,-Yc.x,-qc.y,qc.x,0,-Jc.y,Jc.x,0,-Yc.y,Yc.x,0];return!P(t,Wc,Gc,Kc,Zc)||(t=[1,0,0,0,1,0,0,0,1],!P(t,Wc,Gc,Kc,Zc))?!1:(Qc.crossVectors(qc,Jc),t=[Qc.x,Qc.y,Qc.z],P(t,Wc,Gc,Kc,Zc))},clampPoint:function(e,t){return t===void 0&&(console.warn(`THREE.Box3: .clampPoint() target is now required`),t=new D),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Hc.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return e===void 0&&console.error(`THREE.Box3: .getBoundingSphere() target is now required`),this.getCenter(e.center),e.radius=this.getSize(Hc).length()*.5,e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()?this:(Vc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Vc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Vc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Vc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Vc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Vc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Vc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Vc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Vc),this)},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),el=new N,Object.assign(F.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;t===void 0?el.setFromPoints(e).getCenter(n):n.copy(t);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},isEmpty:function(){return this.radius<0},makeEmpty:function(){return this.center.set(0,0,0),this.radius=-1,this},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return t===void 0&&(console.warn(`THREE.Sphere: .clampPoint() target is now required`),t=new D),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return e===void 0&&(console.warn(`THREE.Sphere: .getBoundingBox() target is now required`),e=new N),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),tl=new D,nl=new D,rl=new D,il=new D,al=new D,ol=new D,sl=new D,Object.assign(I.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return t===void 0&&(console.warn(`THREE.Ray: .at() target is now required`),t=new D),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,tl)),this},closestPointToPoint:function(e,t){t===void 0&&(console.warn(`THREE.Ray: .closestPointToPoint() target is now required`),t=new D),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=tl.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(tl.copy(this.direction).multiplyScalar(t).add(this.origin),tl.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,r){nl.copy(e).add(t).multiplyScalar(.5),rl.copy(t).sub(e).normalize(),il.copy(this.origin).sub(nl);var i=e.distanceTo(t)*.5,a=-this.direction.dot(rl),o=il.dot(this.direction),s=-il.dot(rl),c=il.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){var m=1/l;u*=m,d*=m,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(rl).multiplyScalar(d).add(nl),f},intersectSphere:function(e,t){tl.subVectors(e.center,this.origin);var n=tl.dot(this.direction),r=tl.dot(tl)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return n===null?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||n!==n)&&(n=i),(a<r||r!==r)&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)},intersectsBox:function(e){return this.intersectBox(e,tl)!==null},intersectTriangle:function(e,t,n,r,i){al.subVectors(t,e),ol.subVectors(n,e),sl.crossVectors(al,ol);var a=this.direction.dot(sl),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;il.subVectors(this.origin,e);var s=o*this.direction.dot(ol.crossVectors(il,ol));if(s<0)return null;var c=o*this.direction.dot(al.cross(il));if(c<0||s+c>a)return null;var l=-o*il.dot(sl);return l<0?null:this.at(l/a,i)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),cl=new D,ll=new D,ul=new x,Object.assign(L.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var r=cl.subVectors(n,t).cross(ll.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return t===void 0&&(console.warn(`THREE.Plane: .projectPoint() target is now required`),t=new D),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){t===void 0&&(console.warn(`THREE.Plane: .intersectLine() target is now required`),t=new D);var n=e.delta(cl),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):void 0;var i=-(e.start.dot(this.normal)+this.constant)/r;if(!(i<0||i>1))return t.copy(n).multiplyScalar(i).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return e===void 0&&(console.warn(`THREE.Plane: .coplanarPoint() target is now required`),e=new D),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||ul.getNormalMatrix(e),r=this.coplanarPoint(cl).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),dl=new D,fl=new D,pl=new D,ml=new D,hl=new D,gl=new D,_l=new D,vl=new D,yl=new D,bl=new D,Object.assign(R,{getNormal:function(e,t,n,r){r===void 0&&(console.warn(`THREE.Triangle: .getNormal() target is now required`),r=new D),r.subVectors(n,t),dl.subVectors(e,t),r.cross(dl);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)},getBarycoord:function(e,t,n,r,i){dl.subVectors(r,t),fl.subVectors(n,t),pl.subVectors(e,t);var a=dl.dot(dl),o=dl.dot(fl),s=dl.dot(pl),c=fl.dot(fl),l=fl.dot(pl),u=a*c-o*o;if(i===void 0&&(console.warn(`THREE.Triangle: .getBarycoord() target is now required`),i=new D),u===0)return i.set(-2,-1,-1);var d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)},containsPoint:function(e,t,n,r){return R.getBarycoord(e,t,n,r,ml),ml.x>=0&&ml.y>=0&&ml.x+ml.y<=1},getUV:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,ml),s.set(0,0),s.addScaledVector(i,ml.x),s.addScaledVector(a,ml.y),s.addScaledVector(o,ml.z),s},isFrontFacing:function(e,t,n,r){return dl.subVectors(n,t),fl.subVectors(e,t),dl.cross(fl).dot(r)<0}}),Object.assign(R.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return dl.subVectors(this.c,this.b),fl.subVectors(this.a,this.b),dl.cross(fl).length()*.5},getMidpoint:function(e){return e===void 0&&(console.warn(`THREE.Triangle: .getMidpoint() target is now required`),e=new D),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return R.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return e===void 0&&(console.warn(`THREE.Triangle: .getPlane() target is now required`),e=new L),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return R.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,r,i){return R.getUV(e,this.a,this.b,this.c,t,n,r,i)},containsPoint:function(e){return R.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return R.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){t===void 0&&(console.warn(`THREE.Triangle: .closestPointToPoint() target is now required`),t=new D);var n=this.a,r=this.b,i=this.c,a,o;hl.subVectors(r,n),gl.subVectors(i,n),vl.subVectors(e,n);var s=hl.dot(vl),c=gl.dot(vl);if(s<=0&&c<=0)return t.copy(n);yl.subVectors(e,r);var l=hl.dot(yl),u=gl.dot(yl);if(l>=0&&u<=l)return t.copy(r);var d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(hl,a);bl.subVectors(e,i);var f=hl.dot(bl),p=gl.dot(bl);if(p>=0&&f<=p)return t.copy(i);var m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(gl,o);var h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return _l.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(_l,o);var g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(hl,a).addScaledVector(gl,o)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}),xl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Sl={h:0,s:0,l:0},Cl={h:0,s:0,l:0},Object.assign(z.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):typeof e==`number`?this.setHex(e):typeof e==`string`&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=X.euclideanModulo(e,1),t=X.clamp(t,0,1),n=X.clamp(n,0,1),t===0)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=ee(i,r,e+1/3),this.g=ee(i,r,e),this.b=ee(i,r,e-1/3)}return this},setStyle:function(e){function t(t){t!==void 0&&parseFloat(t)<1&&console.warn(`THREE.Color: Alpha component of `+e+` will be ignored.`)}var n;if(n=/^((?:rgb|hsl)a?)\\(\\s*([^\\)]*)\\)/.exec(e)){var r,i=n[1],a=n[2];switch(i){case`rgb`:case`rgba`:if(r=/^(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case`hsl`:case`hsla`:if(r=/^([0-9]*\\.?[0-9]+)\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(,\\s*([0-9]*\\.?[0-9]+)\\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(o,s,c)}break}}else if(n=/^\\#([A-Fa-f0-9]+)$/.exec(e)){var l=n[1],u=l.length;if(u===3)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(u===6)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=xl[e];return t===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(t),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return t===void 0&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){t===void 0&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=te(e.r),this.g=te(e.g),this.b=te(e.b),this},copyLinearToSRGB:function(e){return this.r=ne(e.r),this.g=ne(e.g),this.b=ne(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return this.r*255<<16^this.g*255<<8^this.b*255<<0},getHexString:function(){return(`000000`+this.getHex().toString(16)).slice(-6)},getHSL:function(e){e===void 0&&(console.warn(`THREE.Color: .getHSL() target is now required`),e={h:0,s:0,l:0});var t=this.r,n=this.g,r=this.b,i=Math.max(t,n,r),a=Math.min(t,n,r),o,s,c=(a+i)/2;if(a===i)o=0,s=0;else{var l=i-a;switch(s=c<=.5?l/(i+a):l/(2-i-a),i){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;case r:o=(t-n)/l+4;break}o/=6}return e.h=o,e.s=s,e.l=c,e},getStyle:function(){return`rgb(`+(this.r*255|0)+`,`+(this.g*255|0)+`,`+(this.b*255|0)+`)`},offsetHSL:function(e,t,n){return this.getHSL(Sl),Sl.h+=e,Sl.s+=t,Sl.l+=n,this.setHSL(Sl.h,Sl.s,Sl.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:function(e,t){this.getHSL(Sl),e.getHSL(Cl);var n=X.lerp(Sl.h,Cl.h,t),r=X.lerp(Sl.s,Cl.s,t),i=X.lerp(Sl.l,Cl.l,t);return this.setHSL(n,r,i),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return t===void 0&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),z.NAMES=xl,Object.assign(B.prototype,{clone:function(){return new this.constructor().copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}}),wl=0,V.prototype=Object.assign(Object.create(y.prototype),{constructor:V,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(e!==void 0)for(var t in e){var n=e[t];if(n===void 0){console.warn(`THREE.Material: \'`+t+`\' parameter is undefined.`);continue}if(t===`shading`){console.warn(`THREE.`+this.type+`: .shading has been removed. Use the boolean .flatShading instead.`),this.flatShading=n===1;continue}var r=this[t];if(r===void 0){console.warn(`THREE.`+this.type+`: \'`+t+`\' is not a property of this material.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}},toJSON:function(e){var t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,this.combine!==void 0&&(n.combine=this.combine),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.flatShading===!0&&(n.flatShading=this.flatShading),this.side!==0&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.morphTargets===!0&&(n.morphTargets=!0),this.morphNormals===!0&&(n.morphNormals=!0),this.skinning===!0&&(n.skinning=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),JSON.stringify(this.userData)!==`{}`&&(n.userData=this.userData);function r(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}if(t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n},clone:function(){return new this.constructor().copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(t!==null){var r=t.length;n=Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),Object.defineProperty(V.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),re.prototype=Object.create(V.prototype),re.prototype.constructor=re,re.prototype.isMeshBasicMaterial=!0,re.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},Tl=new D,Object.defineProperty(H.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),Object.assign(H.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyColorsArray(): color is undefined`,r),a=new z),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyVector2sArray(): vector is undefined`,r),a=new b),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyVector3sArray(): vector is undefined`,r),a=new D),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn(`THREE.BufferAttribute.copyVector4sArray(): vector is undefined`,r),a=new C),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},applyMatrix3:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.applyMatrix3(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},applyMatrix4:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.applyMatrix4(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},applyNormalMatrix:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.applyNormalMatrix(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},transformDirection:function(e){for(var t=0,n=this.count;t<n;t++)Tl.x=this.getX(t),Tl.y=this.getY(t),Tl.z=this.getZ(t),Tl.transformDirection(e),this.setXYZ(t,Tl.x,Tl.y,Tl.z);return this},set:function(e,t){return t===void 0&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),U.prototype=Object.create(H.prototype),U.prototype.constructor=U,ie.prototype=Object.create(H.prototype),ie.prototype.constructor=ie,W.prototype=Object.create(H.prototype),W.prototype.constructor=W,ae.prototype=Object.create(H.prototype),ae.prototype.constructor=ae,G.prototype=Object.create(H.prototype),G.prototype.constructor=G,oe.prototype=Object.create(H.prototype),oe.prototype.constructor=oe,se.prototype=Object.create(H.prototype),se.prototype.constructor=se,K.prototype=Object.create(H.prototype),K.prototype.constructor=K,ce.prototype=Object.create(H.prototype),ce.prototype.constructor=ce,Object.assign(le.prototype,{computeGroups:function(e){for(var t,n=[],r=void 0,i=e.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==r&&(r=o.materialIndex,t!==void 0&&(t.count=a*3-t.start,n.push(t)),t={start:a*3,materialIndex:r})}t!==void 0&&(t.count=a*3-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t=e.faces,n=e.vertices,r=e.faceVertexUvs,i=r[0]&&r[0].length>0,a=r[1]&&r[1].length>0,o=e.morphTargets,s=o.length,c;if(s>0){c=[];for(var l=0;l<s;l++)c[l]={name:o[l].name,data:[]};this.morphTargets.position=c}var u=e.morphNormals,d=u.length,f;if(d>0){f=[];for(var l=0;l<d;l++)f[l]={name:u[l].name,data:[]};this.morphTargets.normal=f}var p=e.skinIndices,m=e.skinWeights,h=p.length===n.length,g=m.length===n.length;n.length>0&&t.length===0&&console.error(`THREE.DirectGeometry: Faceless geometries are not supported.`);for(var l=0;l<t.length;l++){var _=t[l];this.vertices.push(n[_.a],n[_.b],n[_.c]);var v=_.vertexNormals;if(v.length===3)this.normals.push(v[0],v[1],v[2]);else{var y=_.normal;this.normals.push(y,y,y)}var x=_.vertexColors;if(x.length===3)this.colors.push(x[0],x[1],x[2]);else{var S=_.color;this.colors.push(S,S,S)}if(i===!0){var C=r[0][l];C===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv `,l),this.uvs.push(new b,new b,new b)):this.uvs.push(C[0],C[1],C[2])}if(a===!0){var C=r[1][l];C===void 0?(console.warn(`THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 `,l),this.uvs2.push(new b,new b,new b)):this.uvs2.push(C[0],C[1],C[2])}for(var w=0;w<s;w++){var T=o[w].vertices;c[w].data.push(T[_.a],T[_.b],T[_.c])}for(var w=0;w<d;w++){var E=u[w].vertexNormals[l];f[w].data.push(E.a,E.b,E.c)}h&&this.skinIndices.push(p[_.a],p[_.b],p[_.c]),g&&this.skinWeights.push(m[_.a],m[_.b],m[_.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}}),El=1,Dl=new O,Ol=new j,kl=new D,Al=new N,jl=new N,Ml=new D,q.prototype=Object.assign(Object.create(y.prototype),{constructor:q,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(ue(e)>65535?se:G)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:n===void 0?0:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(n!==void 0){var r=new x().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},rotateX:function(e){return Dl.makeRotationX(e),this.applyMatrix4(Dl),this},rotateY:function(e){return Dl.makeRotationY(e),this.applyMatrix4(Dl),this},rotateZ:function(e){return Dl.makeRotationZ(e),this.applyMatrix4(Dl),this},translate:function(e,t,n){return Dl.makeTranslation(e,t,n),this.applyMatrix4(Dl),this},scale:function(e,t,n){return Dl.makeScale(e,t,n),this.applyMatrix4(Dl),this},lookAt:function(e){return Ol.lookAt(e),Ol.updateMatrix(),this.applyMatrix4(Ol.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(kl).negate(),this.translate(kl.x,kl.y,kl.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new K(t.vertices.length*3,3),r=new K(t.colors.length*3,3);if(this.setAttribute(`position`,n.copyVector3sArray(t.vertices)),this.setAttribute(`color`,r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new K(t.lineDistances.length,1);this.setAttribute(`lineDistance`,i.copyArray(t.lineDistances))}t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute(`position`,new K(t,3)),this},updateFromObject:function(e){var t=e.geometry;if(e.isMesh){var n=t.__directGeometry;if(t.elementsNeedUpdate===!0&&(n=void 0,t.elementsNeedUpdate=!1),n===void 0)return this.fromGeometry(t);n.verticesNeedUpdate=t.verticesNeedUpdate,n.normalsNeedUpdate=t.normalsNeedUpdate,n.colorsNeedUpdate=t.colorsNeedUpdate,n.uvsNeedUpdate=t.uvsNeedUpdate,n.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=n}var r;return t.verticesNeedUpdate===!0&&(r=this.attributes.position,r!==void 0&&(r.copyVector3sArray(t.vertices),r.needsUpdate=!0),t.verticesNeedUpdate=!1),t.normalsNeedUpdate===!0&&(r=this.attributes.normal,r!==void 0&&(r.copyVector3sArray(t.normals),r.needsUpdate=!0),t.normalsNeedUpdate=!1),t.colorsNeedUpdate===!0&&(r=this.attributes.color,r!==void 0&&(r.copyColorsArray(t.colors),r.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(r=this.attributes.uv,r!==void 0&&(r.copyVector2sArray(t.uvs),r.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(r=this.attributes.lineDistance,r!==void 0&&(r.copyArray(t.lineDistances),r.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=new le().fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(e.vertices.length*3);if(this.setAttribute(`position`,new H(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(e.normals.length*3);this.setAttribute(`normal`,new H(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(e.colors.length*3);this.setAttribute(`color`,new H(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(e.uvs.length*2);this.setAttribute(`uv`,new H(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(e.uvs2.length*2);this.setAttribute(`uv2`,new H(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],c=e.morphTargets[o],l=0,u=c.length;l<u;l++){var d=c[l],f=new K(d.data.length*3,3);f.name=d.name,s.push(f.copyVector3sArray(d.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var p=new K(e.skinIndices.length*4,4);this.setAttribute(`skinIndex`,p.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var m=new K(e.skinWeights.length*4,4);this.setAttribute(`skinWeight`,m.copyVector4sArray(e.skinWeights))}return e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new N);var e=this.attributes.position,t=this.morphAttributes.position;if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var i=t[n];Al.setFromBufferAttribute(i),this.morphTargetsRelative?(Ml.addVectors(this.boundingBox.min,Al.min),this.boundingBox.expandByPoint(Ml),Ml.addVectors(this.boundingBox.max,Al.max),this.boundingBox.expandByPoint(Ml)):(this.boundingBox.expandByPoint(Al.min),this.boundingBox.expandByPoint(Al.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error(`THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new F);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(Al.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];jl.setFromBufferAttribute(a),this.morphTargetsRelative?(Ml.addVectors(Al.min,jl.min),Al.expandByPoint(Ml),Ml.addVectors(Al.max,jl.max),Al.expandByPoint(Ml)):(Al.expandByPoint(jl.min),Al.expandByPoint(jl.max))}Al.getCenter(n);for(var o=0,r=0,i=e.count;r<i;r++)Ml.fromBufferAttribute(e,r),o=Math.max(o,n.distanceToSquared(Ml));if(t)for(var r=0,i=t.length;r<i;r++)for(var a=t[r],s=this.morphTargetsRelative,c=0,l=a.count;c<l;c++)Ml.fromBufferAttribute(a,c),s&&(kl.fromBufferAttribute(e,c),Ml.add(kl)),o=Math.max(o,n.distanceToSquared(Ml));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error(`THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(t.normal===void 0)this.setAttribute(`normal`,new H(new Float32Array(n.length),3));else for(var r=t.normal.array,i=0,a=r.length;i<a;i++)r[i]=0;var o=t.normal.array,s,c,l,u=new D,d=new D,f=new D,p=new D,m=new D;if(e)for(var h=e.array,i=0,a=e.count;i<a;i+=3)s=h[i+0]*3,c=h[i+1]*3,l=h[i+2]*3,u.fromArray(n,s),d.fromArray(n,c),f.fromArray(n,l),p.subVectors(f,d),m.subVectors(u,d),p.cross(m),o[s]+=p.x,o[s+1]+=p.y,o[s+2]+=p.z,o[c]+=p.x,o[c+1]+=p.y,o[c+2]+=p.z,o[l]+=p.x,o[l+1]+=p.y,o[l+2]+=p.z;else for(var i=0,a=n.length;i<a;i+=9)u.fromArray(n,i),d.fromArray(n,i+3),f.fromArray(n,i+6),p.subVectors(f,d),m.subVectors(u,d),p.cross(m),o[i]=p.x,o[i+1]=p.y,o[i+2]=p.z,o[i+3]=p.x,o[i+4]=p.y,o[i+5]=p.z,o[i+6]=p.x,o[i+7]=p.y,o[i+8]=p.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(!(e&&e.isBufferGeometry)){console.error(`THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.`,e);return}t===void 0&&(t=0,console.warn(`THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.`));var n=this.attributes;for(var r in n)if(e.attributes[r]!==void 0)for(var i=n[r].array,a=e.attributes[r],o=a.array,s=a.itemSize*t,c=Math.min(o.length,i.length-s),l=0,u=s;l<c;l++,u++)i[u]=o[l];return this},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Ml.x=e.getX(t),Ml.y=e.getY(t),Ml.z=e.getZ(t),Ml.normalize(),e.setXYZ(t,Ml.x,Ml.y,Ml.z)},toNonIndexed:function(){function e(e,t){for(var n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0,c=0,l=t.length;c<l;c++){o=t[c]*r;for(var u=0;u<r;u++)a[s++]=n[o++]}return new H(a,r,i)}if(this.index===null)return console.warn(`THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed.`),this;var t=new q,n=this.index.array,r=this.attributes;for(var i in r){var a=r[i],o=e(a,n);t.setAttribute(i,o)}var s=this.morphAttributes;for(i in s){for(var c=[],l=s[i],u=0,d=l.length;u<d;u++){var a=l[u],o=e(a,n);c.push(o)}t.morphAttributes[i]=c}t.morphTargetsRelative=this.morphTargetsRelative;for(var f=this.groups,u=0,p=f.length;u<p;u++){var m=f[u];t.addGroup(m.start,m.count,m.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){var t=this.parameters;for(var n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;r!==null&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var n in i){var a=i[n],o=a.toJSON();a.name!==``&&(o.name=a.name),e.data.attributes[n]=o}var s={},c=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],u=[],d=0,f=l.length;d<f;d++){var a=l[d],o=a.toJSON();a.name!==``&&(o.name=a.name),u.push(o)}u.length>0&&(s[n]=u,c=!0)}c&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var p=this.groups;p.length>0&&(e.data.groups=JSON.parse(JSON.stringify(p)));var m=this.boundingSphere;return m!==null&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e},clone:function(){return new q().copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;i!==null&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,r=l.length;n<r;n++)c.push(l[n].clone());this.morphAttributes[t]=c}this.morphTargetsRelative=e.morphTargetsRelative;var u=e.groups;for(n=0,r=u.length;n<r;n++){var d=u[n];this.addGroup(d.start,d.count,d.materialIndex)}var f=e.boundingBox;f!==null&&(this.boundingBox=f.clone());var p=e.boundingSphere;return p!==null&&(this.boundingSphere=p.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),Nl=new O,Pl=new I,Fl=new F,Il=new D,Ll=new D,Rl=new D,zl=new D,Bl=new D,Vl=new D,Hl=new D,Ul=new D,Wl=new D,Gl=new b,Kl=new b,ql=new b,Jl=new D,Yl=new D,de.prototype=Object.assign(Object.create(j.prototype),{constructor:de,isMesh:!0,copy:function(e){return j.prototype.copy.call(this,e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error(`THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.`)}},raycast:function(e,t){var n=this.geometry,r=this.material,i=this.matrixWorld;if(r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Fl.copy(n.boundingSphere),Fl.applyMatrix4(i),e.ray.intersectsSphere(Fl)!==!1&&(Nl.getInverse(i),Pl.copy(e.ray).applyMatrix4(Nl),!(n.boundingBox!==null&&Pl.intersectsBox(n.boundingBox)===!1)))){var a;if(n.isBufferGeometry){var o,s,c,l=n.index,u=n.attributes.position,d=n.morphAttributes.position,f=n.morphTargetsRelative,p=n.attributes.uv,m=n.attributes.uv2,h=n.groups,g=n.drawRange,_,v,y,x,S,C,w,T;if(l!==null)if(Array.isArray(r))for(_=0,y=h.length;_<y;_++)for(S=h[_],C=r[S.materialIndex],w=Math.max(S.start,g.start),T=Math.min(S.start+S.count,g.start+g.count),v=w,x=T;v<x;v+=3)o=l.getX(v),s=l.getX(v+1),c=l.getX(v+2),a=pe(this,C,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(v/3),a.face.materialIndex=S.materialIndex,t.push(a));else for(w=Math.max(0,g.start),T=Math.min(l.count,g.start+g.count),_=w,y=T;_<y;_+=3)o=l.getX(_),s=l.getX(_+1),c=l.getX(_+2),a=pe(this,r,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(_/3),t.push(a));else if(u!==void 0)if(Array.isArray(r))for(_=0,y=h.length;_<y;_++)for(S=h[_],C=r[S.materialIndex],w=Math.max(S.start,g.start),T=Math.min(S.start+S.count,g.start+g.count),v=w,x=T;v<x;v+=3)o=v,s=v+1,c=v+2,a=pe(this,C,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(v/3),a.face.materialIndex=S.materialIndex,t.push(a));else for(w=Math.max(0,g.start),T=Math.min(u.count,g.start+g.count),_=w,y=T;_<y;_+=3)o=_,s=_+1,c=_+2,a=pe(this,r,e,Pl,u,d,f,p,m,o,s,c),a&&(a.faceIndex=Math.floor(_/3),t.push(a))}else if(n.isGeometry){var E,D,O,k=Array.isArray(r),A=n.vertices,j=n.faces,M,N=n.faceVertexUvs[0];N.length>0&&(M=N);for(var P=0,F=j.length;P<F;P++){var I=j[P],L=k?r[I.materialIndex]:r;if(L!==void 0&&(E=A[I.a],D=A[I.b],O=A[I.c],a=fe(this,L,e,Pl,E,D,O,Jl),a)){if(M&&M[P]){var z=M[P];Gl.copy(z[0]),Kl.copy(z[1]),ql.copy(z[2]),a.uv=R.getUV(Jl,E,D,O,Gl,Kl,ql,new b)}a.face=I,a.faceIndex=P,t.push(a)}}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Xl=0,Zl=new O,Ql=new j,$l=new D,J.prototype=Object.assign(Object.create(y.prototype),{constructor:J,isGeometry:!0,applyMatrix4:function(e){for(var t=new x().getNormalMatrix(e),n=0,r=this.vertices.length;n<r;n++)this.vertices[n].applyMatrix4(e);for(var n=0,r=this.faces.length;n<r;n++){var i=this.faces[n];i.normal.applyMatrix3(t).normalize();for(var a=0,o=i.vertexNormals.length;a<o;a++)i.vertexNormals[a].applyMatrix3(t).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return Zl.makeRotationX(e),this.applyMatrix4(Zl),this},rotateY:function(e){return Zl.makeRotationY(e),this.applyMatrix4(Zl),this},rotateZ:function(e){return Zl.makeRotationZ(e),this.applyMatrix4(Zl),this},translate:function(e,t,n){return Zl.makeTranslation(e,t,n),this.applyMatrix4(Zl),this},scale:function(e,t,n){return Zl.makeScale(e,t,n),this.applyMatrix4(Zl),this},lookAt:function(e){return Ql.lookAt(e),Ql.updateMatrix(),this.applyMatrix4(Ql.matrix),this},fromBufferGeometry:function(e){var t=this,n=e.index===null?void 0:e.index.array,r=e.attributes;if(r.position===void 0)return console.error(`THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.`),this;var i=r.position.array,a=r.normal===void 0?void 0:r.normal.array,o=r.color===void 0?void 0:r.color.array,s=r.uv===void 0?void 0:r.uv.array,c=r.uv2===void 0?void 0:r.uv2.array;c!==void 0&&(this.faceVertexUvs[1]=[]);for(var l=0;l<i.length;l+=3)t.vertices.push(new D().fromArray(i,l)),o!==void 0&&t.colors.push(new z().fromArray(o,l));function u(e,n,r,i){var l=o===void 0?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[r].clone()],u=new B(e,n,r,a===void 0?[]:[new D().fromArray(a,e*3),new D().fromArray(a,n*3),new D().fromArray(a,r*3)],l,i);t.faces.push(u),s!==void 0&&t.faceVertexUvs[0].push([new b().fromArray(s,e*2),new b().fromArray(s,n*2),new b().fromArray(s,r*2)]),c!==void 0&&t.faceVertexUvs[1].push([new b().fromArray(c,e*2),new b().fromArray(c,n*2),new b().fromArray(c,r*2)])}var d=e.groups;if(d.length>0)for(var l=0;l<d.length;l++)for(var f=d[l],p=f.start,m=f.count,h=p,g=p+m;h<g;h+=3)n===void 0?u(h,h+1,h+2,f.materialIndex):u(n[h],n[h+1],n[h+2],f.materialIndex);else if(n!==void 0)for(var l=0;l<n.length;l+=3)u(n[l],n[l+1],n[l+2]);else for(var l=0;l<i.length/3;l+=3)u(l,l+1,l+2);return this.computeFaceNormals(),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter($l).negate(),this.translate($l.x,$l.y,$l.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=t===0?1:1/t,r=new O;return r.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(r),this},computeFaceNormals:function(){for(var e=new D,t=new D,n=0,r=this.faces.length;n<r;n++){var i=this.faces[n],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){e===void 0&&(e=!0);var t,n,r,i,a,o=Array(this.vertices.length);for(t=0,n=this.vertices.length;t<n;t++)o[t]=new D;if(e){var s,c,l,u=new D,d=new D;for(r=0,i=this.faces.length;r<i;r++)a=this.faces[r],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,c),d.subVectors(s,c),u.cross(d),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),r=0,i=this.faces.length;r<i;r++)a=this.faces[r],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(r=0,i=this.faces.length;r<i;r++){a=this.faces[r];var f=a.vertexNormals;f.length===3?(f[0].copy(o[a.a]),f[1].copy(o[a.b]),f[2].copy(o[a.c])):(f[0]=o[a.a].clone(),f[1]=o[a.b].clone(),f[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){n=this.faces[e];var r=n.vertexNormals;r.length===3?(r[0].copy(n.normal),r[1].copy(n.normal),r[2].copy(n.normal)):(r[0]=n.normal.clone(),r[1]=n.normal.clone(),r[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n<r;n++)for(i=this.faces[n],i.__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),e=0,t=i.vertexNormals.length;e<t;e++)i.__originalVertexNormals[e]?i.__originalVertexNormals[e].copy(i.vertexNormals[e]):i.__originalVertexNormals[e]=i.vertexNormals[e].clone();var a=new J;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals,c,l;for(n=0,r=this.faces.length;n<r;n++)c=new D,l={a:new D,b:new D,c:new D},o.push(c),s.push(l)}var u=this.morphNormals[e];a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals();var c,l;for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],c=u.faceNormals[n],l=u.vertexNormals[n],c.copy(i.normal),l.a.copy(i.vertexNormals[0]),l.b.copy(i.vertexNormals[1]),l.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],i.normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new N),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new F),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(!(e&&e.isGeometry)){console.error(`THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.`,e);return}var r,i=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.colors,u=e.colors;n===void 0&&(n=0),t!==void 0&&(r=new x().getNormalMatrix(t));for(var d=0,f=o.length;d<f;d++){var p=o[d].clone();t!==void 0&&p.applyMatrix4(t),a.push(p)}for(var d=0,f=u.length;d<f;d++)l.push(u[d].clone());for(d=0,f=c.length;d<f;d++){var m=c[d],h,g,_,v=m.vertexNormals,y=m.vertexColors;h=new B(m.a+i,m.b+i,m.c+i),h.normal.copy(m.normal),r!==void 0&&h.normal.applyMatrix3(r).normalize();for(var b=0,S=v.length;b<S;b++)g=v[b].clone(),r!==void 0&&g.applyMatrix3(r).normalize(),h.vertexNormals.push(g);h.color.copy(m.color);for(var b=0,S=y.length;b<S;b++)_=y[b],h.vertexColors.push(_.clone());h.materialIndex=m.materialIndex+n,s.push(h)}for(var d=0,f=e.faceVertexUvs.length;d<f;d++){var C=e.faceVertexUvs[d];this.faceVertexUvs[d]===void 0&&(this.faceVertexUvs[d]=[]);for(var b=0,S=C.length;b<S;b++){for(var w=C[b],T=[],E=0,D=w.length;E<D;E++)T.push(w[E].clone());this.faceVertexUvs[d].push(T)}}},mergeMesh:function(e){if(!(e&&e.isMesh)){console.error(`THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.`,e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)},mergeVertices:function(){var e={},t=[],n=[],r,i,a=Math.pow(10,4),o,s,c,l,u,d;for(o=0,s=this.vertices.length;o<s;o++)r=this.vertices[o],i=Math.round(r.x*a)+`_`+Math.round(r.y*a)+`_`+Math.round(r.z*a),e[i]===void 0?(e[i]=o,t.push(this.vertices[o]),n[o]=t.length-1):n[o]=n[e[i]];var f=[];for(o=0,s=this.faces.length;o<s;o++){c=this.faces[o],c.a=n[c.a],c.b=n[c.b],c.c=n[c.c],l=[c.a,c.b,c.c];for(var p=0;p<3;p++)if(l[p]===l[(p+1)%3]){f.push(o);break}}for(o=f.length-1;o>=0;o--){var m=f[o];for(this.faces.splice(m,1),u=0,d=this.faceVertexUvs.length;u<d;u++)this.faceVertexUvs[u].splice(m,1)}var h=this.vertices.length-t.length;return this.vertices=t,h},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];this.vertices.push(new D(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;function r(e,t){return e.materialIndex-t.materialIndex}e.sort(r);var i=this.faceVertexUvs[0],a=this.faceVertexUvs[1],o,s;i&&i.length===t&&(o=[]),a&&a.length===t&&(s=[]);for(var n=0;n<t;n++){var c=e[n]._id;o&&o.push(i[c]),s&&s.push(a[c])}o&&(this.faceVertexUvs[0]=o),s&&(this.faceVertexUvs[1]=s)},toJSON:function(){var e={metadata:{version:4.5,type:`Geometry`,generator:`Geometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.type,this.name!==``&&(e.name=this.name),this.parameters!==void 0){var t=this.parameters;for(var n in t)t[n]!==void 0&&(e[n]=t[n]);return e}for(var r=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];r.push(a.x,a.y,a.z)}for(var o=[],s=[],c={},l=[],u={},d=[],f={},i=0;i<this.faces.length;i++){var p=this.faces[i],m=!0,h=!1,g=this.faceVertexUvs[0][i]!==void 0,_=p.normal.length()>0,v=p.vertexNormals.length>0,y=p.color.r!==1||p.color.g!==1||p.color.b!==1,b=p.vertexColors.length>0,x=0;if(x=T(x,0,0),x=T(x,1,m),x=T(x,2,h),x=T(x,3,g),x=T(x,4,_),x=T(x,5,v),x=T(x,6,y),x=T(x,7,b),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),g){var S=this.faceVertexUvs[0][i];o.push(O(S[0]),O(S[1]),O(S[2]))}if(_&&o.push(E(p.normal)),v){var C=p.vertexNormals;o.push(E(C[0]),E(C[1]),E(C[2]))}if(y&&o.push(D(p.color)),b){var w=p.vertexColors;o.push(D(w[0]),D(w[1]),D(w[2]))}}function T(e,t,n){return n?e|1<<t:e&~(1<<t)}function E(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return c[t]===void 0?(c[t]=s.length/3,s.push(e.x,e.y,e.z),c[t]):c[t]}function D(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return u[t]===void 0?(u[t]=l.length,l.push(e.getHex()),u[t]):u[t]}function O(e){var t=e.x.toString()+e.y.toString();return f[t]===void 0?(f[t]=d.length/2,d.push(e.x,e.y),f[t]):f[t]}return e.data={},e.data.vertices=r,e.data.normals=s,l.length>0&&(e.data.colors=l),d.length>0&&(e.data.uvs=[d]),e.data.faces=o,e},clone:function(){return new J().copy(this)},copy:function(e){var t,n,r,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var c=e.colors;for(t=0,n=c.length;t<n;t++)this.colors.push(c[t].clone());var l=e.faces;for(t=0,n=l.length;t<n;t++)this.faces.push(l[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var u=e.faceVertexUvs[t];for(this.faceVertexUvs[t]===void 0&&(this.faceVertexUvs[t]=[]),r=0,i=u.length;r<i;r++){var d=u[r],f=[];for(a=0,o=d.length;a<o;a++){var p=d[a];f.push(p.clone())}this.faceVertexUvs[t].push(f)}}var m=e.morphTargets;for(t=0,n=m.length;t<n;t++){var h={};if(h.name=m[t].name,m[t].vertices!==void 0)for(h.vertices=[],r=0,i=m[t].vertices.length;r<i;r++)h.vertices.push(m[t].vertices[r].clone());if(m[t].normals!==void 0)for(h.normals=[],r=0,i=m[t].normals.length;r<i;r++)h.normals.push(m[t].normals[r].clone());this.morphTargets.push(h)}var g=e.morphNormals;for(t=0,n=g.length;t<n;t++){var _={};if(g[t].vertexNormals!==void 0)for(_.vertexNormals=[],r=0,i=g[t].vertexNormals.length;r<i;r++){var v=g[t].vertexNormals[r],y={};y.a=v.a.clone(),y.b=v.b.clone(),y.c=v.c.clone(),_.vertexNormals.push(y)}if(g[t].faceNormals!==void 0)for(_.faceNormals=[],r=0,i=g[t].faceNormals.length;r<i;r++)_.faceNormals.push(g[t].faceNormals[r].clone());this.morphNormals.push(_)}var b=e.skinWeights;for(t=0,n=b.length;t<n;t++)this.skinWeights.push(b[t].clone());var x=e.skinIndices;for(t=0,n=x.length;t<n;t++)this.skinIndices.push(x[t].clone());var S=e.lineDistances;for(t=0,n=S.length;t<n;t++)this.lineDistances.push(S[t]);var C=e.boundingBox;C!==null&&(this.boundingBox=C.clone());var w=e.boundingSphere;return w!==null&&(this.boundingSphere=w.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:`dispose`})}}),eu=class extends J{constructor(e,t,n,r,i,a){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new tu(e,t,n,r,i,a)),this.mergeVertices()}},tu=class extends q{constructor(e,t,n,r,i,a){super(),this.type=`BoxBufferGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;e=e||1,t=t||1,n=n||1,r=Math.floor(r)||1,i=Math.floor(i)||1,a=Math.floor(a)||1;let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new K(c,3)),this.setAttribute(`normal`,new K(l,3)),this.setAttribute(`uv`,new K(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,O=new D;for(let a=0;a<w;a++){let o=a*y-x;for(let s=0;s<C;s++)O[e]=(s*v-b)*r,O[t]=o*i,O[n]=S,c.push(O.x,O.y,O.z),O[e]=0,O[t]=0,O[n]=m>0?1:-1,l.push(O.x,O.y,O.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(f,E,_),f+=E,d+=T}}},nu={clone:me,merge:he},ru=`void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}`,iu=`void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}`,ge.prototype=Object.create(V.prototype),ge.prototype.constructor=ge,ge.prototype.isShaderMaterial=!0,ge.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=me(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this},ge.prototype.toJSON=function(e){var t=V.prototype.toJSON.call(this,e);for(var n in t.uniforms={},this.uniforms){var r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:`t`,value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:`c`,value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:`v2`,value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:`v3`,value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:`v4`,value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:`m3`,value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:`m4`,value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var i={};for(var a in this.extensions)this.extensions[a]===!0&&(i[a]=!0);return Object.keys(i).length>0&&(t.extensions=i),t},_e.prototype=Object.assign(Object.create(j.prototype),{constructor:_e,isCamera:!0,copy:function(e,t){return j.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){e===void 0&&(console.warn(`THREE.Camera: .getWorldDirection() target is now required`),e=new D),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){j.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){j.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return new this.constructor().copy(this)}}),ve.prototype=Object.assign(Object.create(_e.prototype),{constructor:ve,isPerspectiveCamera:!0,copy:function(e,t){return _e.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=X.RAD2DEG*2*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(X.DEG2RAD*.5*this.fov);return .5*this.getFilmHeight()/e},getEffectiveFOV:function(){return X.RAD2DEG*2*Math.atan(Math.tan(X.DEG2RAD*.5*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(X.DEG2RAD*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var c=this.filmOffset;c!==0&&(i+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),au=90,ou=1,ye.prototype=Object.create(j.prototype),ye.prototype.constructor=ye,be.prototype=Object.create(w.prototype),be.prototype.constructor=be,be.prototype.isWebGLCubeRenderTarget=!0,be.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new M,r={uniforms:{tEquirect:{value:null}},vertexShader:[`varying vec3 vWorldDirection;`,`vec3 transformDirection( in vec3 dir, in mat4 matrix ) {`,` return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );`,`}`,`void main() {`,` vWorldDirection = transformDirection( position, modelMatrix );`,` #include <begin_vertex>`,` #include <project_vertex>`,`}`].join(`\n`),fragmentShader:[`uniform sampler2D tEquirect;`,`varying vec3 vWorldDirection;`,`#include <common>`,`void main() {`,` vec3 direction = normalize( vWorldDirection );`,` vec2 sampleUV = equirectUv( direction );`,` gl_FragColor = texture2D( tEquirect, sampleUV );`,`}`].join(`\n`)},i=new ge({type:`CubemapFromEquirect`,uniforms:me(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;var a=new de(new tu(5,5,5),i);return n.add(a),new ye(1,10,this).update(e,n),a.geometry.dispose(),a.material.dispose(),this},xe.prototype=Object.create(S.prototype),xe.prototype.constructor=xe,xe.prototype.isDataTexture=!0,su=new F,cu=new D,Object.assign(Se.prototype,{set:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],d=n[8],f=n[9],p=n[10],m=n[11],h=n[12],g=n[13],_=n[14],v=n[15];return t[0].setComponents(o-r,u-s,m-d,v-h).normalize(),t[1].setComponents(o+r,u+s,m+d,v+h).normalize(),t[2].setComponents(o+i,u+c,m+f,v+g).normalize(),t[3].setComponents(o-i,u-c,m-f,v-g).normalize(),t[4].setComponents(o-a,u-l,m-p,v-_).normalize(),t[5].setComponents(o+a,u+l,m+p,v+_).normalize(),this},intersectsObject:function(e){var t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),su.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(su)},intersectsSprite:function(e){return su.center.set(0,0,0),su.radius=.7071067811865476,su.applyMatrix4(e.matrixWorld),this.intersectsSphere(su)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++)if(t[i].distanceToPoint(n)<r)return!1;return!0},intersectsBox:function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(cu.x=r.normal.x>0?e.max.x:e.min.x,cu.y=r.normal.y>0?e.max.y:e.min.y,cu.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(cu)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}}),Z={common:{diffuse:{value:new z(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new x},uv2Transform:{value:new x},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new b(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new z(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new z(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new x}},sprite:{diffuse:{value:new z(15658734)},opacity:{value:1},center:{value:new b(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new x}}},Te.prototype=Object.create(J.prototype),Te.prototype.constructor=Te,Ee.prototype=Object.create(q.prototype),Ee.prototype.constructor=Ee,Q={alphamap_fragment:`#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif`,alphamap_pars_fragment:`#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,alphatest_fragment:`#ifdef ALPHATEST\n if ( diffuseColor.a < ALPHATEST ) discard;\n#endif`,aomap_fragment:`#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n #endif\n#endif`,aomap_pars_fragment:`#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif`,begin_vertex:`vec3 transformed = vec3( position );`,beginnormal_vertex:`vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif`,bsdfs:`vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n return vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n#else\n if( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n return ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n return Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n return 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( incidentLight.direction + viewDir );\n float dotNL = saturate( dot( normal, incidentLight.direction ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n return specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n vec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n vec3 FssEss = F * brdf.x + brdf.y;\n float Ess = brdf.x + brdf.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n float dotNH = saturate( dot( geometry.normal, halfDir ) );\n float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n vec3 F = F_Schlick( specularColor, dotLH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n return sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n float invAlpha = 1.0 / roughness;\n float cos2h = NoH * NoH;\n float sin2h = max(1.0 - cos2h, 0.0078125); return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n vec3 N = geometry.normal;\n vec3 V = geometry.viewDir;\n vec3 H = normalize( V + L );\n float dotNH = saturate( dot( N, H ) );\n return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif`,bumpmap_pars_fragment:`#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 );\n fDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif`,clipping_planes_fragment:`#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif`,color_fragment:`#ifdef USE_COLOR\n diffuseColor.rgb *= vColor;\n#endif`,color_pars_fragment:`#ifdef USE_COLOR\n varying vec3 vColor;\n#endif`,color_pars_vertex:`#ifdef USE_COLOR\n varying vec3 vColor;\n#endif`,color_vertex:`#ifdef USE_COLOR\n vColor.xyz = color.xyz;\n#endif`,common:`#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n#ifdef CLEARCOAT\n vec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n float distance = dot( planeNormal, point - pointOnPlane );\n return - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n return dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x); } else if (face == 1.0) {\n uv = vec2(-direction.x, -direction.z) / abs(direction.y); } else if (face == 2.0) {\n uv = vec2(-direction.x, direction.y) / abs(direction.z); } else if (face == 3.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x); } else if (face == 4.0) {\n uv = vec2(-direction.x, direction.z) / abs(direction.y); } else {\n uv = vec2(direction.x, direction.y) / abs(direction.z); }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n mat3 m = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vUv );\n emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif`,encodings_fragment:`gl_FragColor = linearToOutputTexel( gl_FragColor );`,encodings_pars_fragment:`\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.r, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.r, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract( Le );\n vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n return vec4( max( vRGB, 0.0 ), 1.0 );\n}`,envmap_fragment:`#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n \n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n #elif defined( ENVMAP_TYPE_EQUIREC )\n reflectVec = normalize( reflectVec );\n vec2 sampleUV = equirectUv( reflectVec );\n vec4 envColor = texture2D( envMap, sampleUV );\n #elif defined( ENVMAP_TYPE_SPHERE )\n reflectVec = normalize( reflectVec );\n vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifndef ENVMAP_TYPE_CUBE_UV\n envColor = envMapTexelToLinear( envColor );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform int maxMipLevel;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif`,envmap_physical_pars_fragment:`#if defined( USE_ENVMAP )\n #ifdef ENVMAP_MODE_REFRACTION\n uniform float refractionRatio;\n #endif\n vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n #else\n vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n #else\n vec4 envMapColor = vec4( 0.0 );\n #endif\n return PI * envMapColor.rgb * envMapIntensity;\n }\n float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n float maxMIPLevelScalar = float( maxMIPLevel );\n float sigma = PI * roughness * roughness / ( 1.0 + roughness );\n float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n }\n vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( -viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n #else\n vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n #endif\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n #else\n vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV = equirectUv( reflectVec );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #else\n vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n #endif\n envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n #endif\n return envMapColor.rgb * envMapIntensity;\n }\n#endif`,envmap_vertex:`#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) { \n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif`,fog_vertex:`#ifdef USE_FOG\n fogDepth = -mvPosition.z;\n#endif`,fog_pars_vertex:`#ifdef USE_FOG\n varying float fogDepth;\n#endif`,fog_fragment:`#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif`,fog_pars_fragment:`#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float fogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return texture2D( gradientMap, coord ).rgb;\n #else\n return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n #endif\n}`,lightmap_fragment:`#ifdef USE_LIGHTMAP\n vec4 lightMapTexel= texture2D( lightMap, vUv2 );\n reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif`,lights_lambert_vertex:`vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n vLightBack = vec3( 0.0 );\n vIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n vIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n #pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n #pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n dotNL = dot( geometry.normal, directLight.direction );\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n #endif\n }\n #pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n #ifdef DOUBLE_SIDED\n vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n #endif\n }\n #pragma unroll_loop_end\n#endif`,lights_pars_begin:`uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n directLight.color = directionalLight.color;\n directLight.direction = directionalLight.direction;\n directLight.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n struct PointLightShadow {\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = pointLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n directLight.color = pointLight.color;\n directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n directLight.visible = ( directLight.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n vec3 lVector = spotLight.position - geometry.position;\n directLight.direction = normalize( lVector );\n float lightDistance = length( lVector );\n float angleCos = dot( directLight.direction, spotLight.direction );\n if ( angleCos > spotLight.coneCos ) {\n float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n directLight.color = spotLight.color;\n directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n directLight.visible = true;\n } else {\n directLight.color = vec3( 0.0 );\n directLight.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n float dotNL = dot( geometry.normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n }\n#endif`,lights_toon_fragment:`ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,lights_toon_pars_fragment:`varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material ) (0)`,lights_phong_fragment:`BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material ) (0)`,lights_physical_fragment:`PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheen;\n#endif`,lights_physical_pars_fragment:`struct PhysicalMaterial {\n vec3 diffuseColor;\n float specularRoughness;\n vec3 specularColor;\n#ifdef CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n vec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometry.normal;\n vec3 viewDir = geometry.viewDir;\n vec3 position = geometry.position;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.specularRoughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n #ifdef CLEARCOAT\n float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = ccDotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n ccIrradiance *= PI;\n #endif\n float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n #else\n float clearcoatDHR = 0.0;\n #endif\n #ifdef USE_SHEEN\n reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n material.specularRoughness,\n directLight.direction,\n geometry,\n material.sheenColor\n );\n #else\n reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n #endif\n reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef CLEARCOAT\n float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n float ccDotNL = ccDotNV;\n float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n #else\n float clearcoatDHR = 0.0;\n #endif\n float clearcoatInv = 1.0 - clearcoatDHR;\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}`,lights_fragment_begin:`\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n geometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointDirectLightIrradiance( pointLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotDirectLightIrradiance( spotLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n irradiance += getLightProbeIrradiance( lightProbe, geometry );\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel= texture2D( lightMap, vUv2 );\n vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n lightMapIrradiance *= PI;\n #endif\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n #ifdef CLEARCOAT\n clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n #endif\n#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif`,logdepthbuf_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n varying float vIsPerspective;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif`,logdepthbuf_vertex:`#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n #else\n if ( isPerspectiveMatrix( projectionMatrix ) ) {\n gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n }\n #endif\n#endif`,map_fragment:`#ifdef USE_MAP\n vec4 texelColor = texture2D( map, vUv );\n texelColor = mapTexelToLinear( texelColor );\n diffuseColor *= texelColor;\n#endif`,map_pars_fragment:`#ifdef USE_MAP\n uniform sampler2D map;\n#endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n vec4 mapTexel = texture2D( map, uv );\n diffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif`,map_particle_pars_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,metalnessmap_fragment:`float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vUv );\n metalnessFactor *= texelMetalness.b;\n#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS\n uniform float morphTargetBaseInfluence;\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n #endif\n#endif`,normal_fragment_begin:`#ifdef FLAT_SHADED\n vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #endif\n #ifdef USE_TANGENT\n vec3 tangent = normalize( vTangent );\n vec3 bitangent = normalize( vBitangent );\n #ifdef DOUBLE_SIDED\n tangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n bitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #endif\n #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n mat3 vTBN = mat3( tangent, bitangent, normal );\n #endif\n #endif\n#endif\nvec3 geometryNormal = normal;`,normal_fragment_maps:`#ifdef OBJECTSPACE_NORMALMAP\n normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n #ifdef USE_TANGENT\n normal = normalize( vTBN * mapN );\n #else\n normal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n #endif\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n float scale = sign( st1.t * st0.s - st0.t * st1.s );\n vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n vec3 N = normalize( surf_norm );\n mat3 tsn = mat3( S, T, N );\n mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n return normalize( tsn * mapN );\n }\n#endif`,clearcoat_normal_fragment_begin:`#ifdef CLEARCOAT\n vec3 clearcoatNormal = geometryNormal;\n#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n #ifdef USE_TANGENT\n clearcoatNormal = normalize( vTBN * clearcoatMapN );\n #else\n clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n #endif\n#endif`,clearcoat_pars_fragment:`#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif`,packing:`vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif`,dithering_pars_fragment:`#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif`,roughnessmap_fragment:`float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n roughnessFactor *= texelRoughness.g;\n#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif`,shadowmap_pars_fragment:`#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n bool frustumTest = all( frustumTestVec );\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif`,shadowmap_pars_vertex:`#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif`,shadowmap_vertex:`#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif`,shadowmask_pars_fragment:`float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}`,skinbase_vertex:`#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n #ifdef BONE_TEXTURE\n uniform highp sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureSize ) );\n float y = floor( j / float( boneTextureSize ) );\n float dx = 1.0 / float( boneTextureSize );\n float dy = 1.0 / float( boneTextureSize );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n #else\n uniform mat4 boneMatrices[ MAX_BONES ];\n mat4 getBoneMatrix( const in float i ) {\n mat4 bone = boneMatrices[ int(i) ];\n return bone;\n }\n #endif\n#endif`,skinning_vertex:`#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif`,skinnormal_vertex:`#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif`,specularmap_fragment:`float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif`,tonemapping_pars_fragment:`#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}`,uv_pars_fragment:`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n varying vec2 vUv;\n#endif`,uv_pars_vertex:`#ifdef USE_UV\n #ifdef UVS_VERTEX_ONLY\n vec2 vUv;\n #else\n varying vec2 vUv;\n #endif\n uniform mat3 uvTransform;\n#endif`,uv_vertex:`#ifdef USE_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif`,uv2_pars_fragment:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n varying vec2 vUv2;\n#endif`,uv2_pars_vertex:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n attribute vec2 uv2;\n varying vec2 vUv2;\n uniform mat3 uv2Transform;\n#endif`,uv2_vertex:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif`,background_frag:`uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n gl_FragColor = mapTexelToLinear( texColor );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}`,background_vert:`varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}`,cube_frag:`#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n vec3 vReflect = vWorldDirection;\n #include <envmap_fragment>\n gl_FragColor = envColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}`,cube_vert:`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}`,depth_frag:`#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <logdepthbuf_fragment>\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}`,depth_vert:`#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}`,distanceRGBA_frag:`#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}`,distanceRGBA_vert:`#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}`,equirect_frag:`uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n vec4 texColor = texture2D( tEquirect, sampleUV );\n gl_FragColor = mapTexelToLinear( texColor );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}`,equirect_vert:`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}`,linedashed_frag:`uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}`,linedashed_vert:`uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <color_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}`,meshbasic_frag:`uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n \n vec4 lightMapTexel= texture2D( lightMap, vUv2 );\n reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshbasic_vert:`#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <skinbase_vertex>\n #ifdef USE_ENVMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}`,meshlambert_frag:`uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n varying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <emissivemap_fragment>\n #ifdef DOUBLE_SIDED\n reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n #else\n reflectedLight.indirectDiffuse += vIndirectFront;\n #endif\n #include <lightmap_fragment>\n reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n #ifdef DOUBLE_SIDED\n reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n #else\n reflectedLight.directDiffuse = vLightFront;\n #endif\n reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshlambert_vert:`#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n varying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <lights_lambert_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,meshmatcap_frag:`#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n matcapColor = matcapTexelToLinear( matcapColor );\n #else\n vec4 matcapColor = vec4( 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshmatcap_vert:`#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}`,meshtoon_frag:`#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshtoon_vert:`#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,meshphong_frag:`#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshphong_vert:`#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,meshphysical_frag:`#define STANDARD\n#ifdef PHYSICAL\n #define REFLECTIVITY\n #define CLEARCOAT\n #define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n uniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n uniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #ifdef TRANSPARENCY\n diffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n #endif\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,meshphysical_vert:`#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,normal_frag:`#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}`,normal_vert:`#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n vViewPosition = - mvPosition.xyz;\n#endif\n}`,points_frag:`uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}`,points_vert:`uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}`,shadow_frag:`uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}`,shadow_vert:`#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <begin_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,sprite_frag:`uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}`,sprite_vert:`uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}`},lu={basic:{uniforms:he([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.fog]),vertexShader:Q.meshbasic_vert,fragmentShader:Q.meshbasic_frag},lambert:{uniforms:he([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.fog,Z.lights,{emissive:{value:new z(0)}}]),vertexShader:Q.meshlambert_vert,fragmentShader:Q.meshlambert_frag},phong:{uniforms:he([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new z(0)},specular:{value:new z(1118481)},shininess:{value:30}}]),vertexShader:Q.meshphong_vert,fragmentShader:Q.meshphong_frag},standard:{uniforms:he([Z.common,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.roughnessmap,Z.metalnessmap,Z.fog,Z.lights,{emissive:{value:new z(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag},toon:{uniforms:he([Z.common,Z.specularmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.gradientmap,Z.fog,Z.lights,{emissive:{value:new z(0)},specular:{value:new z(1118481)},shininess:{value:30}}]),vertexShader:Q.meshtoon_vert,fragmentShader:Q.meshtoon_frag},matcap:{uniforms:he([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,{matcap:{value:null}}]),vertexShader:Q.meshmatcap_vert,fragmentShader:Q.meshmatcap_frag},points:{uniforms:he([Z.points,Z.fog]),vertexShader:Q.points_vert,fragmentShader:Q.points_frag},dashed:{uniforms:he([Z.common,Z.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Q.linedashed_vert,fragmentShader:Q.linedashed_frag},depth:{uniforms:he([Z.common,Z.displacementmap]),vertexShader:Q.depth_vert,fragmentShader:Q.depth_frag},normal:{uniforms:he([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,{opacity:{value:1}}]),vertexShader:Q.normal_vert,fragmentShader:Q.normal_frag},sprite:{uniforms:he([Z.sprite,Z.fog]),vertexShader:Q.sprite_vert,fragmentShader:Q.sprite_frag},background:{uniforms:{uvTransform:{value:new x},t2D:{value:null}},vertexShader:Q.background_vert,fragmentShader:Q.background_frag},cube:{uniforms:he([Z.envmap,{opacity:{value:1}}]),vertexShader:Q.cube_vert,fragmentShader:Q.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Q.equirect_vert,fragmentShader:Q.equirect_frag},distanceRGBA:{uniforms:he([Z.common,Z.displacementmap,{referencePosition:{value:new D},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Q.distanceRGBA_vert,fragmentShader:Q.distanceRGBA_frag},shadow:{uniforms:he([Z.lights,Z.fog,{color:{value:new z(0)},opacity:{value:1}}]),vertexShader:Q.shadow_vert,fragmentShader:Q.shadow_frag}},lu.physical={uniforms:he([lu.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new b(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new z(0)},transparency:{value:0}}]),vertexShader:Q.meshphysical_vert,fragmentShader:Q.meshphysical_frag},Re.prototype=Object.create(S.prototype),Re.prototype.constructor=Re,Re.prototype.isCubeTexture=!0,Object.defineProperty(Re.prototype,`images`,{get:function(){return this.image},set:function(e){this.image=e}}),ze.prototype=Object.create(S.prototype),ze.prototype.constructor=ze,ze.prototype.isDataTexture2DArray=!0,Be.prototype=Object.create(S.prototype),Be.prototype.constructor=Be,Be.prototype.isDataTexture3D=!0,uu=new S,du=new ze,fu=new Be,pu=new Re,mu=[],hu=[],gu=new Float32Array(16),_u=new Float32Array(9),vu=new Float32Array(4),Ct.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Ue(t,e)},wt.prototype.setValue=function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}},yu=/([\\w\\d_]+)(\\])?(\\[|\\.)?/g,Dt.prototype.setValue=function(e,t,n,r){var i=this.map[t];i!==void 0&&i.setValue(e,n,r)},Dt.prototype.setOptional=function(e,t,n){var r=t[n];r!==void 0&&this.setValue(e,n,r)},Dt.upload=function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];s.needsUpdate!==!1&&o.setValue(e,s.value,r)}},Dt.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n},bu=0,xu=/^[ \\t]*#include +<([\\w\\d./]+)>/gm,Su=/#pragma unroll_loop[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}/g,Cu=/#pragma unroll_loop_start[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}[\\s]+?#pragma unroll_loop_end/g,wu=0,dn.prototype=Object.create(V.prototype),dn.prototype.constructor=dn,dn.prototype.isMeshDepthMaterial=!0,dn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},fn.prototype=Object.create(V.prototype),fn.prototype.constructor=fn,fn.prototype.isMeshDistanceMaterial=!0,fn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},Tu=`uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}`,Eu=`void main() {\n gl_Position = vec4( position, 1.0 );\n}`,_n.prototype=Object.assign(Object.create(ve.prototype),{constructor:_n,isArrayCamera:!0}),vn.prototype=Object.assign(Object.create(j.prototype),{constructor:vn,isGroup:!0}),Object.assign(yn.prototype,{constructor:yn,getTargetRaySpace:function(){return this._targetRay===null&&(this._targetRay=new vn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return this._grip===null&&(this._grip=new vn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this},update:function(e,t,n){var r=null,i=null,a=this._targetRay,o=this._grip;return e&&(a!==null&&(r=t.getPose(e.targetRaySpace,n),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale))),o!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)))),a!==null&&(a.visible=r!==null),o!==null&&(o.visible=i!==null),this}}),Object.assign(bn.prototype,y.prototype),Object.assign(Cn.prototype,{isFogExp2:!0,clone:function(){return new Cn(this.color,this.density)},toJSON:function(){return{type:`FogExp2`,color:this.color.getHex(),density:this.density}}}),Object.assign(wn.prototype,{isFog:!0,clone:function(){return new wn(this.color,this.near,this.far)},toJSON:function(){return{type:`Fog`,color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Tn.prototype,`needsUpdate`,{set:function(e){e===!0&&this.version++}}),Object.assign(Tn.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t){return t===void 0&&(t=0),this.array.set(e,t),this},clone:function(){return new this.constructor().copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}}),Du=new D,Object.defineProperties(En.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(En.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)Du.x=this.getX(t),Du.y=this.getY(t),Du.z=this.getZ(t),Du.applyMatrix4(e),this.setXYZ(t,Du.x,Du.y,Du.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this},clone:function(){console.log(`THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.`);for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return new H(new this.array.constructor(e),this.itemSize,this.normalized)},toJSON:function(){console.log(`THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.`);for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}),Dn.prototype=Object.create(V.prototype),Dn.prototype.constructor=Dn,Dn.prototype.isSpriteMaterial=!0,Dn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this},ku=new D,Au=new D,ju=new D,Mu=new b,Nu=new b,Pu=new O,Fu=new D,Iu=new D,Lu=new D,Ru=new b,zu=new b,Bu=new b,On.prototype=Object.assign(Object.create(j.prototype),{constructor:On,isSprite:!0,raycast:function(e,t){e.camera===null&&console.error(`THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.`),Au.setFromMatrixScale(this.matrixWorld),Pu.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),ju.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Au.multiplyScalar(-ju.z);var n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));var a=this.center;kn(Fu.set(-.5,-.5,0),ju,a,Au,r,i),kn(Iu.set(.5,-.5,0),ju,a,Au,r,i),kn(Lu.set(.5,.5,0),ju,a,Au,r,i),Ru.set(0,0),zu.set(1,0),Bu.set(1,1);var o=e.ray.intersectTriangle(Fu,Iu,Lu,!1,ku);if(!(o===null&&(kn(Iu.set(-.5,.5,0),ju,a,Au,r,i),zu.set(0,1),o=e.ray.intersectTriangle(Fu,Lu,Iu,!1,ku),o===null))){var s=e.ray.origin.distanceTo(ku);s<e.near||s>e.far||t.push({distance:s,point:ku.clone(),uv:R.getUV(ku,Fu,Iu,Lu,Ru,zu,Bu,new b),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return j.prototype.copy.call(this,e),e.center!==void 0&&this.center.copy(e.center),this}}),Vu=new D,Hu=new D,An.prototype=Object.assign(Object.create(j.prototype),{constructor:An,isLOD:!0,copy:function(e){j.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n<r;n++){var i=t[n];this.addLevel(i.object.clone(),i.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){t===void 0&&(t=0),t=Math.abs(t);for(var n=this.levels,r=0;r<n.length&&!(t<n[r].distance);r++);return n.splice(r,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){if(this.levels.length>0){Vu.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(Vu);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){Vu.setFromMatrixPosition(e.matrixWorld),Hu.setFromMatrixPosition(this.matrixWorld);var n=Vu.distanceTo(Hu)/e.zoom;t[0].object.visible=!0;for(var r=1,i=t.length;r<i&&n>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var a=n[r];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),jn.prototype=Object.assign(Object.create(de.prototype),{constructor:jn,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new C,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var i=1/e.manhattanLength();i===1/0?e.set(1,0,0,0):e.multiplyScalar(i),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){de.prototype.updateMatrixWorld.call(this,e),this.bindMode===`attached`?this.bindMatrixInverse.getInverse(this.matrixWorld):this.bindMode===`detached`?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn(`THREE.SkinnedMesh: Unrecognized bindMode: `+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},boneTransform:function(){var e=new D,t=new C,n=new C,r=new D,i=new O;return function(a,o){var s=this.skeleton,c=this.geometry;t.fromBufferAttribute(c.attributes.skinIndex,a),n.fromBufferAttribute(c.attributes.skinWeight,a),e.fromBufferAttribute(c.attributes.position,a).applyMatrix4(this.bindMatrix),o.set(0,0,0);for(var l=0;l<4;l++){var u=n.getComponent(l);if(u!==0){var d=t.getComponent(l);i.multiplyMatrices(s.bones[d].matrixWorld,s.boneInverses[d]),o.addScaledVector(r.copy(e).applyMatrix4(i),u)}}return o.applyMatrix4(this.bindMatrixInverse)}}()}),Uu=new O,Wu=new O,Object.assign(Mn.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new O;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)e=this.bones[t],e&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:Wu;Uu.multiplyMatrices(o,t[i]),Uu.toArray(n,i*16)}r!==void 0&&(r.needsUpdate=!0)},clone:function(){return new Mn(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),Nn.prototype=Object.assign(Object.create(j.prototype),{constructor:Nn,isBone:!0}),Gu=new O,Ku=new O,qu=[],Ju=new de,Pn.prototype=Object.assign(Object.create(de.prototype),{constructor:Pn,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,e*16)},raycast:function(e,t){var n=this.matrixWorld,r=this.count;if(Ju.geometry=this.geometry,Ju.material=this.material,Ju.material!==void 0)for(var i=0;i<r;i++){this.getMatrixAt(i,Gu),Ku.multiplyMatrices(n,Gu),Ju.matrixWorld=Ku,Ju.raycast(e,qu);for(var a=0,o=qu.length;a<o;a++){var s=qu[a];s.instanceId=i,s.object=this,t.push(s)}qu.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,e*16)},updateMorphTargets:function(){}}),Fn.prototype=Object.create(V.prototype),Fn.prototype.constructor=Fn,Fn.prototype.isLineBasicMaterial=!0,Fn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this},Yu=new D,Xu=new D,Zu=new O,Qu=new I,$u=new F,In.prototype=Object.assign(Object.create(j.prototype),{constructor:In,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(e.index===null){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)Yu.fromBufferAttribute(t,r-1),Xu.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Yu.distanceTo(Xu);e.setAttribute(`lineDistance`,new K(n,1))}else console.warn(`THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);else if(e.isGeometry){var a=e.vertices,n=e.lineDistances;n[0]=0;for(var r=1,i=a.length;r<i;r++)n[r]=n[r-1],n[r]+=a[r-1].distanceTo(a[r])}return this},raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold;if(n.boundingSphere===null&&n.computeBoundingSphere(),$u.copy(n.boundingSphere),$u.applyMatrix4(r),$u.radius+=i,e.ray.intersectsSphere($u)!==!1){Zu.getInverse(r),Qu.copy(e.ray).applyMatrix4(Zu);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new D,c=new D,l=new D,u=new D,d=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var f=n.index,p=n.attributes.position.array;if(f!==null)for(var m=f.array,h=0,g=m.length-1;h<g;h+=d){var _=m[h],v=m[h+1];s.fromArray(p,_*3),c.fromArray(p,v*3);var y=Qu.distanceSqToSegment(s,c,u,l);if(!(y>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this})}}else for(var h=0,g=p.length/3-1;h<g;h+=d){s.fromArray(p,3*h),c.fromArray(p,3*h+3);var y=Qu.distanceSqToSegment(s,c,u,l);if(!(y>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this})}}}else if(n.isGeometry)for(var x=n.vertices,S=x.length,h=0;h<S-1;h+=d){var y=Qu.distanceSqToSegment(x[h],x[h+1],u,l);if(!(y>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this})}}}},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error(`THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),ed=new D,td=new D,Ln.prototype=Object.assign(Object.create(In.prototype),{constructor:Ln,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(e.index===null){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)ed.fromBufferAttribute(t,r),td.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+ed.distanceTo(td);e.setAttribute(`lineDistance`,new K(n,1))}else console.warn(`THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);else if(e.isGeometry)for(var a=e.vertices,n=e.lineDistances,r=0,i=a.length;r<i;r+=2)ed.copy(a[r]),td.copy(a[r+1]),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+ed.distanceTo(td);return this}}),Rn.prototype=Object.assign(Object.create(In.prototype),{constructor:Rn,isLineLoop:!0}),zn.prototype=Object.create(V.prototype),zn.prototype.constructor=zn,zn.prototype.isPointsMaterial=!0,zn.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this},nd=new O,rd=new I,id=new F,ad=new D,Bn.prototype=Object.assign(Object.create(j.prototype),{constructor:Bn,isPoints:!0,raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold;if(n.boundingSphere===null&&n.computeBoundingSphere(),id.copy(n.boundingSphere),id.applyMatrix4(r),id.radius+=i,e.ray.intersectsSphere(id)!==!1){nd.getInverse(r),rd.copy(e.ray).applyMatrix4(nd);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,c=n.attributes.position.array;if(s!==null)for(var l=s.array,u=0,d=l.length;u<d;u++){var f=l[u];ad.fromArray(c,f*3),Vn(ad,f,o,r,e,t,this)}else for(var u=0,p=c.length/3;u<p;u++)ad.fromArray(c,u*3),Vn(ad,u,o,r,e,t,this)}else for(var m=n.vertices,u=0,p=m.length;u<p;u++)Vn(m[u],u,o,r,e,t,this)}},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error(`THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.`)}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Hn.prototype=Object.assign(Object.create(S.prototype),{constructor:Hn,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Un.prototype=Object.create(S.prototype),Un.prototype.constructor=Un,Un.prototype.isCompressedTexture=!0,Wn.prototype=Object.create(S.prototype),Wn.prototype.constructor=Wn,Wn.prototype.isCanvasTexture=!0,Gn.prototype=Object.create(S.prototype),Gn.prototype.constructor=Gn,Gn.prototype.isDepthTexture=!0,Kn.prototype=Object.create(q.prototype),Kn.prototype.constructor=Kn,qn.prototype=Object.create(J.prototype),qn.prototype.constructor=qn,Jn.prototype=Object.create(q.prototype),Jn.prototype.constructor=Jn,Yn.prototype=Object.create(J.prototype),Yn.prototype.constructor=Yn,Xn.prototype=Object.create(q.prototype),Xn.prototype.constructor=Xn,Zn.prototype=Object.create(J.prototype),Zn.prototype.constructor=Zn,Qn.prototype=Object.create(Xn.prototype),Qn.prototype.constructor=Qn,$n.prototype=Object.create(J.prototype),$n.prototype.constructor=$n,er.prototype=Object.create(Xn.prototype),er.prototype.constructor=er,tr.prototype=Object.create(J.prototype),tr.prototype.constructor=tr,nr.prototype=Object.create(Xn.prototype),nr.prototype.constructor=nr,rr.prototype=Object.create(J.prototype),rr.prototype.constructor=rr,ir.prototype=Object.create(Xn.prototype),ir.prototype.constructor=ir,ar.prototype=Object.create(J.prototype),ar.prototype.constructor=ar,or.prototype=Object.create(q.prototype),or.prototype.constructor=or,or.prototype.toJSON=function(){var e=q.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},sr.prototype=Object.create(J.prototype),sr.prototype.constructor=sr,cr.prototype=Object.create(q.prototype),cr.prototype.constructor=cr,lr.prototype=Object.create(J.prototype),lr.prototype.constructor=lr,ur.prototype=Object.create(q.prototype),ur.prototype.constructor=ur,od={triangulate:function(e,t,n){n=n||2;var r=t&&t.length,i=r?t[0]*n:e.length,a=dr(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;var s,c,l,u,d,f,p;if(r&&(a=vr(e,t,a,n)),e.length>80*n){s=l=e[0],c=u=e[1];for(var m=n;m<i;m+=n)d=e[m],f=e[m+1],d<s&&(s=d),f<c&&(c=f),d>l&&(l=d),f>u&&(u=f);p=Math.max(l-s,u-c),p=p===0?0:1/p}return pr(a,o,n,s,c,p),o}},sd={area:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5},isClockWise:function(e){return sd.area(e)<0},triangulateShape:function(e,t){var n=[],r=[],i=[];Hr(e),Ur(n,e);var a=e.length;t.forEach(Hr);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Ur(n,t[o]);for(var s=od.triangulate(n,r),o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}},Wr.prototype=Object.create(J.prototype),Wr.prototype.constructor=Wr,Wr.prototype.toJSON=function(){var e=J.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return Kr(t,n,e)},Gr.prototype=Object.create(q.prototype),Gr.prototype.constructor=Gr,Gr.prototype.toJSON=function(){var e=q.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return Kr(t,n,e)},cd={generateTopUV:function(e,t,n,r,i){var a=t[n*3],o=t[n*3+1],s=t[r*3],c=t[r*3+1],l=t[i*3],u=t[i*3+1];return[new b(a,o),new b(s,c),new b(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[n*3],s=t[n*3+1],c=t[n*3+2],l=t[r*3],u=t[r*3+1],d=t[r*3+2],f=t[i*3],p=t[i*3+1],m=t[i*3+2],h=t[a*3],g=t[a*3+1],_=t[a*3+2];return Math.abs(s-u)<.01?[new b(o,1-c),new b(l,1-d),new b(f,1-m),new b(h,1-_)]:[new b(s,1-c),new b(u,1-d),new b(p,1-m),new b(g,1-_)]}},qr.prototype=Object.create(J.prototype),qr.prototype.constructor=qr,Jr.prototype=Object.create(Gr.prototype),Jr.prototype.constructor=Jr,Yr.prototype=Object.create(J.prototype),Yr.prototype.constructor=Yr,Xr.prototype=Object.create(q.prototype),Xr.prototype.constructor=Xr,Zr.prototype=Object.create(J.prototype),Zr.prototype.constructor=Zr,Qr.prototype=Object.create(q.prototype),Qr.prototype.constructor=Qr,$r.prototype=Object.create(J.prototype),$r.prototype.constructor=$r,ei.prototype=Object.create(q.prototype),ei.prototype.constructor=ei,ti.prototype=Object.create(J.prototype),ti.prototype.constructor=ti,ti.prototype.toJSON=function(){var e=J.prototype.toJSON.call(this),t=this.parameters.shapes;return ri(t,e)},ni.prototype=Object.create(q.prototype),ni.prototype.constructor=ni,ni.prototype.toJSON=function(){var e=q.prototype.toJSON.call(this),t=this.parameters.shapes;return ri(t,e)},ii.prototype=Object.create(q.prototype),ii.prototype.constructor=ii,ai.prototype=Object.create(J.prototype),ai.prototype.constructor=ai,oi.prototype=Object.create(q.prototype),oi.prototype.constructor=oi,si.prototype=Object.create(ai.prototype),si.prototype.constructor=si,ci.prototype=Object.create(oi.prototype),ci.prototype.constructor=ci,li.prototype=Object.create(J.prototype),li.prototype.constructor=li,ui.prototype=Object.create(q.prototype),ui.prototype.constructor=ui,ld=Object.freeze({__proto__:null,WireframeGeometry:Kn,ParametricGeometry:qn,ParametricBufferGeometry:Jn,TetrahedronGeometry:Zn,TetrahedronBufferGeometry:Qn,OctahedronGeometry:$n,OctahedronBufferGeometry:er,IcosahedronGeometry:tr,IcosahedronBufferGeometry:nr,DodecahedronGeometry:rr,DodecahedronBufferGeometry:ir,PolyhedronGeometry:Yn,PolyhedronBufferGeometry:Xn,TubeGeometry:ar,TubeBufferGeometry:or,TorusKnotGeometry:sr,TorusKnotBufferGeometry:cr,TorusGeometry:lr,TorusBufferGeometry:ur,TextGeometry:qr,TextBufferGeometry:Jr,SphereGeometry:Yr,SphereBufferGeometry:Xr,RingGeometry:Zr,RingBufferGeometry:Qr,PlaneGeometry:Te,PlaneBufferGeometry:Ee,LatheGeometry:$r,LatheBufferGeometry:ei,ShapeGeometry:ti,ShapeBufferGeometry:ni,ExtrudeGeometry:Wr,ExtrudeBufferGeometry:Gr,EdgesGeometry:ii,ConeGeometry:si,ConeBufferGeometry:ci,CylinderGeometry:ai,CylinderBufferGeometry:oi,CircleGeometry:li,CircleBufferGeometry:ui,BoxGeometry:eu,BoxBufferGeometry:tu}),di.prototype=Object.create(V.prototype),di.prototype.constructor=di,di.prototype.isShadowMaterial=!0,di.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this},fi.prototype=Object.create(ge.prototype),fi.prototype.constructor=fi,fi.prototype.isRawShaderMaterial=!0,pi.prototype=Object.create(V.prototype),pi.prototype.constructor=pi,pi.prototype.isMeshStandardMaterial=!0,pi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.defines={STANDARD:``},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},mi.prototype=Object.create(pi.prototype),mi.prototype.constructor=mi,mi.prototype.isMeshPhysicalMaterial=!0,mi.prototype.copy=function(e){return pi.prototype.copy.call(this,e),this.defines={STANDARD:``,PHYSICAL:``},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new z).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this},hi.prototype=Object.create(V.prototype),hi.prototype.constructor=hi,hi.prototype.isMeshPhongMaterial=!0,hi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},gi.prototype=Object.create(V.prototype),gi.prototype.constructor=gi,gi.prototype.isMeshToonMaterial=!0,gi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},_i.prototype=Object.create(V.prototype),_i.prototype.constructor=_i,_i.prototype.isMeshNormalMaterial=!0,_i.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},vi.prototype=Object.create(V.prototype),vi.prototype.constructor=vi,vi.prototype.isMeshLambertMaterial=!0,vi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},yi.prototype=Object.create(V.prototype),yi.prototype.constructor=yi,yi.prototype.isMeshMatcapMaterial=!0,yi.prototype.copy=function(e){return V.prototype.copy.call(this,e),this.defines={MATCAP:``},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},bi.prototype=Object.create(Fn.prototype),bi.prototype.constructor=bi,bi.prototype.isLineDashedMaterial=!0,bi.prototype.copy=function(e){return Fn.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this},ud=Object.freeze({__proto__:null,ShadowMaterial:di,SpriteMaterial:Dn,RawShaderMaterial:fi,ShaderMaterial:ge,PointsMaterial:zn,MeshPhysicalMaterial:mi,MeshStandardMaterial:pi,MeshPhongMaterial:hi,MeshToonMaterial:gi,MeshNormalMaterial:_i,MeshLambertMaterial:vi,MeshDepthMaterial:dn,MeshDistanceMaterial:fn,MeshBasicMaterial:re,MeshMatcapMaterial:yi,LineDashedMaterial:bi,LineBasicMaterial:Fn,Material:V}),dd={arraySlice:function(e,t,n){return dd.isTypedArray(e)?new e.constructor(e.subarray(t,n===void 0?e.length:n)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(t,n){return e[t]-e[n]}for(var n=e.length,r=Array(n),i=0;i!==n;++i)r[i]=i;return r.sort(t),r},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,c=0;c!==t;++c)i[o++]=e[s+c];return i},flattenJSON:function(e,t,n,r){for(var i=1,a=e[0];a!==void 0&&a[r]===void 0;)a=e[i++];if(a!==void 0){var o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push.apply(n,o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}},subclip:function(e,t,n,r,i){i=i||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var c=a.tracks[s],l=c.getValueSize(),u=[],d=[],f=0;f<c.times.length;++f){var p=c.times[f]*i;if(!(p<n||p>=r)){u.push(c.times[f]);for(var m=0;m<l;++m)d.push(c.values[f*l+m])}}u.length!==0&&(c.times=dd.convertArray(u,c.times.constructor),c.values=dd.convertArray(d,c.values.constructor),o.push(c))}a.tracks=o;for(var h=1/0,s=0;s<a.tracks.length;++s)h>a.tracks[s].times[0]&&(h=a.tracks[s].times[0]);for(var s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*h);return a.resetDuration(),a},makeClipAdditive:function(e,t,n,r){t===void 0&&(t=0),n===void 0&&(n=e),(r===void 0||r<=0)&&(r=30);for(var i=e.tracks.length,a=t/r,o=0;o<i;++o){var s=n.tracks[o],c=s.ValueTypeName;if(!(c===`bool`||c===`string`)){var l=e.tracks.find(function(e){return e.name===s.name&&e.ValueTypeName===c});if(l!==void 0){var u=s.getValueSize(),d=s.times.length-1,f;if(a<=s.times[0])f=dd.arraySlice(s.values,0,s.valueSize);else if(a>=s.times[d]){var p=d*u;f=dd.arraySlice(s.values,p)}else{var m=s.createInterpolant();m.evaluate(a),f=m.resultBuffer}c===`quaternion`&&new E(f[0],f[1],f[2],f[3]).normalize().conjugate().toArray(f);for(var h=l.times.length,g=0;g<h;++g){var _=g*u;if(c===`quaternion`)E.multiplyQuaternionsFlat(l.values,_,f,0,l.values,_);else for(var v=0;v<u;++v)l.values[_+v]-=f[v]}}}}return e.blendMode=Qs,e}},Object.assign(xi.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{var a;linear_scan:{forward_scan:if(!(e<r)){for(var o=n+2;;){if(r===void 0){if(e<i)break forward_scan;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,r=t[++n],e<r)break seek}a=t.length;break linear_scan}if(!(e>=i)){var s=t[1];e<s&&(n=2,i=s);for(var o=n-2;;){if(i===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,i=t[--n-1],e>=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n<a;){var c=n+a>>>1;e<t[c]?a=c:n=c+1}if(r=t[n],i=t[n-1],i===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(r===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,i,e)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t},interpolate_:function(){throw Error(`call to abstract method`)},intervalChanged_:function(){}}),Object.assign(xi.prototype,{beforeStart_:xi.prototype.copySampleValue_,afterEnd_:xi.prototype.copySampleValue_}),Si.prototype=Object.assign(Object.create(xi.prototype),{constructor:Si,DefaultSettings_:{endingStart:Js,endingEnd:Js},intervalChanged_:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case Ys:i=e,o=2*t-n;break;case Xs:i=r.length-2,o=t+r[i]-r[i+1];break;default:i=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case Ys:a=e,s=2*n-t;break;case Xs:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}var c=(n-t)*.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l},interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(r-t),m=p*p,h=m*p,g=-d*h+2*d*m-d*p,_=(1+d)*h+(-1.5-2*d)*m+(-.5+d)*p+1,v=(-1-f)*h+(1.5+f)*m+.5*p,y=f*h-f*m,b=0;b!==o;++b)i[b]=g*a[l+b]+_*a[c+b]+v*a[s+b]+y*a[u+b];return i}}),Ci.prototype=Object.assign(Object.create(xi.prototype),{constructor:Ci,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l,d=0;d!==o;++d)i[d]=a[c+d]*u+a[s+d]*l;return i}}),wi.prototype=Object.assign(Object.create(xi.prototype),{constructor:wi,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(Ti,{toJSON:function(e){var t=e.constructor,n;if(t.toJSON!==void 0)n=t.toJSON(e);else{n={name:e.name,times:dd.convertArray(e.times,Array),values:dd.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}}),Object.assign(Ti.prototype,{constructor:Ti,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Ks,InterpolantFactoryMethodDiscrete:function(e){return new wi(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Ci(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Si(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case Gs:t=this.InterpolantFactoryMethodDiscrete;break;case Ks:t=this.InterpolantFactoryMethodLinear;break;case qs:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){var n=`unsupported interpolation for `+this.ValueTypeName+` keyframe track named `+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(n);return console.warn(`THREE.KeyframeTrack:`,n),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Gs;case this.InterpolantFactoryMethodLinear:return Ks;case this.InterpolantFactoryMethodSmooth:return qs}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(e!==0)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this},scale:function(e){if(e!==1)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;a!==-1&&n[a]>t;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);var o=this.getValueSize();this.times=dd.arraySlice(n,i,a),this.values=dd.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error(`THREE.KeyframeTrack: Invalid value size in track.`,this),e=!1);var n=this.times,r=this.values,i=n.length;i===0&&(console.error(`THREE.KeyframeTrack: Track is empty.`,this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if(typeof s==`number`&&isNaN(s)){console.error(`THREE.KeyframeTrack: Time is not a valid number.`,this,o,s),e=!1;break}if(a!==null&&a>s){console.error(`THREE.KeyframeTrack: Out of order keys.`,this,o,s,a),e=!1;break}a=s}if(r!==void 0&&dd.isTypedArray(r))for(var o=0,c=r.length;o!==c;++o){var l=r[o];if(isNaN(l)){console.error(`THREE.KeyframeTrack: Value is not a valid number.`,this,o,l),e=!1;break}}return e},optimize:function(){for(var e=dd.arraySlice(this.times),t=dd.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===qs,i=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o];if(c!==e[o+1]&&(o!==1||c!==c[0]))if(r)s=!0;else for(var l=o*n,u=l-n,d=l+n,f=0;f!==n;++f){var p=t[l+f];if(p!==t[u+f]||p!==t[d+f]){s=!0;break}}if(s){if(o!==i){e[i]=e[o];for(var m=o*n,h=i*n,f=0;f!==n;++f)t[h+f]=t[m+f]}++i}}if(a>0){e[i]=e[a];for(var m=a*n,h=i*n,f=0;f!==n;++f)t[h+f]=t[m+f];++i}return i===e.length?(this.times=e,this.values=t):(this.times=dd.arraySlice(e,0,i),this.values=dd.arraySlice(t,0,i*n)),this},clone:function(){var e=dd.arraySlice(this.times,0),t=dd.arraySlice(this.values,0),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}),Ei.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Ei,ValueTypeName:`bool`,ValueBufferType:Array,DefaultInterpolation:Gs,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Di.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Di,ValueTypeName:`color`}),Oi.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Oi,ValueTypeName:`number`}),ki.prototype=Object.assign(Object.create(xi.prototype),{constructor:ki,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(n-t)/(r-t),l=s+o;s!==l;s+=4)E.slerpFlat(i,0,a,s-o,a,s,c);return i}}),Ai.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Ai,ValueTypeName:`quaternion`,DefaultInterpolation:Ks,InterpolantFactoryMethodLinear:function(e){return new ki(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),ji.prototype=Object.assign(Object.create(Ti.prototype),{constructor:ji,ValueTypeName:`string`,ValueBufferType:Array,DefaultInterpolation:Gs,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Mi.prototype=Object.assign(Object.create(Ti.prototype),{constructor:Mi,ValueTypeName:`vector`}),Object.assign(Ni,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(Fi(n[i]).scale(r));return new Ni(e.name,e.duration,t,e.blendMode)},toJSON:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},i=0,a=n.length;i!==a;++i)t.push(Ti.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],c=[];s.push((o+i-1)%i,o,(o+1)%i),c.push(0,1,0);var l=dd.getKeyframeOrder(s);s=dd.sortedArray(s,1,l),c=dd.sortedArray(c,1,l),!r&&s[0]===0&&(s.push(i),c.push(c[0])),a.push(new Oi(`.morphTargetInfluences[`+t[o].name+`]`,s,c).scale(1/n))}return new Ni(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var r={},i=/^([\\w-]*?)([\\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(i);if(c&&c.length>1){var l=c[1],u=r[l];u||(r[l]=u=[]),u.push(s)}}var d=[];for(var l in r)d.push(Ni.CreateFromMorphTargetSequence(l,r[l],t,n));return d},parseAnimation:function(e,t){if(!e)return console.error(`THREE.AnimationClip: No animation in JSONLoader data.`),null;for(var n=function(e,t,n,r,i){if(n.length!==0){var a=[],o=[];dd.flattenJSON(n,a,o,r),a.length!==0&&i.push(new e(t,a,o))}},r=[],i=e.name||`default`,a=e.length||-1,o=e.fps||30,s=e.blendMode,c=e.hierarchy||[],l=0;l<c.length;l++){var u=c[l].keys;if(!(!u||u.length===0))if(u[0].morphTargets){for(var d={},f=0;f<u.length;f++)if(u[f].morphTargets)for(var p=0;p<u[f].morphTargets.length;p++)d[u[f].morphTargets[p]]=-1;for(var m in d){for(var h=[],g=[],p=0;p!==u[f].morphTargets.length;++p){var _=u[f];h.push(_.time),g.push(+(_.morphTarget===m))}r.push(new Oi(`.morphTargetInfluence[`+m+`]`,h,g))}a=d.length*(o||1)}else{var v=`.bones[`+t[l].name+`]`;n(Mi,v+`.position`,u,`pos`,r),n(Ai,v+`.quaternion`,u,`rot`,r),n(Mi,v+`.scale`,u,`scl`,r)}}return r.length===0?null:new Ni(i,a,r,s)}}),Object.assign(Ni.prototype,{resetDuration:function(){for(var e=this.tracks,t=0,n=0,r=e.length;n!==r;++n){var i=this.tracks[n];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new Ni(this.name,this.duration,e,this.blendMode)}}),fd={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){if(this.enabled!==!1)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},pd=new Ii,Object.assign(Li.prototype,{load:function(){},loadAsync:function(e,t){var n=this;return new Promise(function(r,i){n.load(e,r,t,i)})},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),md={},Ri.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ri,load:function(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=fd.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;if(md[e]!==void 0){md[e].push({onLoad:t,onProgress:n,onError:r});return}var o=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],c=!!o[2],l=o[3];l=decodeURIComponent(l),c&&(l=atob(l));try{var u,d=(this.responseType||``).toLowerCase();switch(d){case`arraybuffer`:case`blob`:for(var f=new Uint8Array(l.length),p=0;p<l.length;p++)f[p]=l.charCodeAt(p);u=d===`blob`?new Blob([f.buffer],{type:s}):f.buffer;break;case`document`:u=new DOMParser().parseFromString(l,s);break;case`json`:u=JSON.parse(l);break;default:u=l;break}setTimeout(function(){t&&t(u),i.manager.itemEnd(e)},0)}catch(t){setTimeout(function(){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)},0)}}else{md[e]=[],md[e].push({onLoad:t,onProgress:n,onError:r});var m=new XMLHttpRequest;for(var h in m.open(`GET`,e,!0),m.addEventListener(`load`,function(t){var n=this.response,r=md[e];if(delete md[e],this.status===200||this.status===0){this.status===0&&console.warn(`THREE.FileLoader: HTTP Status 0 received.`),fd.add(e,n);for(var a=0,o=r.length;a<o;a++){var s=r[a];s.onLoad&&s.onLoad(n)}i.manager.itemEnd(e)}else{for(var a=0,o=r.length;a<o;a++){var s=r[a];s.onError&&s.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}},!1),m.addEventListener(`progress`,function(t){for(var n=md[e],r=0,i=n.length;r<i;r++){var a=n[r];a.onProgress&&a.onProgress(t)}},!1),m.addEventListener(`error`,function(t){var n=md[e];delete md[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),m.addEventListener(`abort`,function(t){var n=md[e];delete md[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),this.responseType!==void 0&&(m.responseType=this.responseType),this.withCredentials!==void 0&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(this.mimeType===void 0?`text/plain`:this.mimeType),this.requestHeader)m.setRequestHeader(h,this.requestHeader[h]);m.send(null)}return i.manager.itemStart(e),m},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this}}),zi.prototype=Object.assign(Object.create(Li.prototype),{constructor:zi,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setPath(i.path),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var r=Ni.parse(e[n]);t.push(r)}return t}}),Bi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Bi,load:function(e,t,n,r){var i=this,a=[],o=new Un;o.image=a;var s=new Ri(this.manager);s.setPath(this.path),s.setResponseType(`arraybuffer`);function c(c){s.load(e[c],function(e){var n=i.parse(e,!0);a[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,l===6&&(n.mipmapCount===1&&(o.minFilter=Ko),o.format=n.format,o.needsUpdate=!0,t&&t(o))},n,r)}if(Array.isArray(e))for(var l=0,u=0,d=e.length;u<d;++u)c(u);else s.load(e,function(e){var n=i.parse(e,!0);if(n.isCubemap)for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;s++){a[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;n.mipmapCount===1&&(o.minFilter=Ko),o.format=n.format,o.needsUpdate=!0,t&&t(o)},n,r);return o}}),Vi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Vi,load:function(e,t,n,r){var i=this,a=new xe,o=new Ri(this.manager);return o.setResponseType(`arraybuffer`),o.setPath(this.path),o.load(e,function(e){var n=i.parse(e);n&&(n.image===void 0?n.data!==void 0&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data):a.image=n.image,a.wrapS=n.wrapS===void 0?Vo:n.wrapS,a.wrapT=n.wrapT===void 0?Vo:n.wrapT,a.magFilter=n.magFilter===void 0?Ko:n.magFilter,a.minFilter=n.minFilter===void 0?Ko:n.minFilter,a.anisotropy=n.anisotropy===void 0?1:n.anisotropy,n.format!==void 0&&(a.format=n.format),n.type!==void 0&&(a.type=n.type),n.mipmaps!==void 0&&(a.mipmaps=n.mipmaps,a.minFilter=Jo),n.mipmapCount===1&&(a.minFilter=Ko),a.needsUpdate=!0,t&&t(a,n))},n,r),a}}),Hi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Hi,load:function(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=fd.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;var o=document.createElementNS(`http://www.w3.org/1999/xhtml`,`img`);function s(){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1),fd.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}return o.addEventListener(`load`,s,!1),o.addEventListener(`error`,c,!1),e.substr(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}}),Ui.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ui,load:function(e,t,n,r){var i=new Re,a=new Hi(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],function(e){i.images[n]=e,o++,o===6&&(i.needsUpdate=!0,t&&t(i))},void 0,r)}for(var c=0;c<e.length;++c)s(c);return i}}),Wi.prototype=Object.assign(Object.create(Li.prototype),{constructor:Wi,load:function(e,t,n,r){var i=new S,a=new Hi(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(n){i.image=n,i.format=e.search(/\\.jpe?g($|\\?)/i)>0||e.search(/^data\\:image\\/jpeg/)===0?$o:es,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}}),Object.assign(Y.prototype,{getPoint:function(){return console.warn(`THREE.Curve: .getPoint() not implemented.`),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){e===void 0&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){e===void 0&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e===void 0&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t=[],n,r=this.getPoint(0),i,a=0;for(t.push(0),i=1;i<=e;i++)n=this.getPoint(i/e),a+=n.distanceTo(r),t.push(a),r=n;return this.cacheArcLengths=t,t},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){for(var n=this.getLengths(),r=0,i=n.length,a=t||e*n[i-1],o=0,s=i-1,c;o<=s;)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);var l=n[r],u=n[r+1]-l,d=(a-l)/u;return(r+d)/(i-1)},getTangent:function(e,t){var n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);var a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new b:new D);return s.copy(o).sub(a).normalize(),s},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){var n=new D,r=[],i=[],a=[],o=new D,s=new O,c,l,u;for(c=0;c<=e;c++)l=c/e,r[c]=this.getTangentAt(l,new D),r[c].normalize();i[0]=new D,a[0]=new D;var d=Number.MAX_VALUE,f=Math.abs(r[0].x),p=Math.abs(r[0].y),m=Math.abs(r[0].z);for(f<=d&&(d=f,n.set(1,0,0)),p<=d&&(d=p,n.set(0,1,0)),m<=d&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]),c=1;c<=e;c++)i[c]=i[c-1].clone(),a[c]=a[c-1].clone(),o.crossVectors(r[c-1],r[c]),o.length()>Number.EPSILON&&(o.normalize(),u=Math.acos(X.clamp(r[c-1].dot(r[c]),-1,1)),i[c].applyMatrix4(s.makeRotationAxis(o,u))),a[c].crossVectors(r[c],i[c]);if(t===!0)for(u=Math.acos(X.clamp(i[0].dot(i[e]),-1,1)),u/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(u=-u),c=1;c<=e;c++)i[c].applyMatrix4(s.makeRotationAxis(r[c],u*c)),a[c].crossVectors(r[c],i[c]);return{tangents:r,normals:i,binormals:a}},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:`Curve`,generator:`Curve.toJSON`}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),Gi.prototype=Object.create(Y.prototype),Gi.prototype.constructor=Gi,Gi.prototype.isEllipseCurve=!0,Gi.prototype.getPoint=function(e,t){for(var n=t||new b,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),this.aClockwise===!0&&!a&&(i===r?i=-r:i-=r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){var l=Math.cos(this.aRotation),u=Math.sin(this.aRotation),d=s-this.aX,f=c-this.aY;s=d*l-f*u+this.aX,c=d*u+f*l+this.aY}return n.set(s,c)},Gi.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Gi.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},Gi.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Ki.prototype=Object.create(Gi.prototype),Ki.prototype.constructor=Ki,Ki.prototype.isArcCurve=!0,hd=new D,gd=new qi,_d=new qi,vd=new qi,Ji.prototype=Object.create(Y.prototype),Ji.prototype.constructor=Ji,Ji.prototype.isCatmullRomCurve3=!0,Ji.prototype.getPoint=function(e,t){var n=t||new D,r=this.points,i=r.length,a=(i-+!this.closed)*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);var c,l,u,d;if(this.closed||o>0?c=r[(o-1)%i]:(hd.subVectors(r[0],r[1]).add(r[0]),c=hd),l=r[o%i],u=r[(o+1)%i],this.closed||o+2<i?d=r[(o+2)%i]:(hd.subVectors(r[i-1],r[i-2]).add(r[i-1]),d=hd),this.curveType===`centripetal`||this.curveType===`chordal`){var f=this.curveType===`chordal`?.5:.25,p=Math.pow(c.distanceToSquared(l),f),m=Math.pow(l.distanceToSquared(u),f),h=Math.pow(u.distanceToSquared(d),f);m<1e-4&&(m=1),p<1e-4&&(p=m),h<1e-4&&(h=m),gd.initNonuniformCatmullRom(c.x,l.x,u.x,d.x,p,m,h),_d.initNonuniformCatmullRom(c.y,l.y,u.y,d.y,p,m,h),vd.initNonuniformCatmullRom(c.z,l.z,u.z,d.z,p,m,h)}else this.curveType===`catmullrom`&&(gd.initCatmullRom(c.x,l.x,u.x,d.x,this.tension),_d.initCatmullRom(c.y,l.y,u.y,d.y,this.tension),vd.initCatmullRom(c.z,l.z,u.z,d.z,this.tension));return n.set(gd.calc(s),_d.calc(s),vd.calc(s)),n},Ji.prototype.copy=function(e){Y.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Ji.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Ji.prototype.fromJSON=function(e){Y.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(new D().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},aa.prototype=Object.create(Y.prototype),aa.prototype.constructor=aa,aa.prototype.isCubicBezierCurve=!0,aa.prototype.getPoint=function(e,t){var n=t||new b,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ia(e,r.x,i.x,a.x,o.x),ia(e,r.y,i.y,a.y,o.y)),n},aa.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},aa.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},aa.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},oa.prototype=Object.create(Y.prototype),oa.prototype.constructor=oa,oa.prototype.isCubicBezierCurve3=!0,oa.prototype.getPoint=function(e,t){var n=t||new D,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ia(e,r.x,i.x,a.x,o.x),ia(e,r.y,i.y,a.y,o.y),ia(e,r.z,i.z,a.z,o.z)),n},oa.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},oa.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},oa.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},sa.prototype=Object.create(Y.prototype),sa.prototype.constructor=sa,sa.prototype.isLineCurve=!0,sa.prototype.getPoint=function(e,t){var n=t||new b;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},sa.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},sa.prototype.getTangent=function(e,t){var n=t||new b,n=n.copy(this.v2).sub(this.v1).normalize();return n},sa.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},sa.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},sa.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ca.prototype=Object.create(Y.prototype),ca.prototype.constructor=ca,ca.prototype.isLineCurve3=!0,ca.prototype.getPoint=function(e,t){var n=t||new D;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},ca.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},ca.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ca.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ca.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},la.prototype=Object.create(Y.prototype),la.prototype.constructor=la,la.prototype.isQuadraticBezierCurve=!0,la.prototype.getPoint=function(e,t){var n=t||new b,r=this.v0,i=this.v1,a=this.v2;return n.set($i(e,r.x,i.x,a.x),$i(e,r.y,i.y,a.y)),n},la.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},la.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},la.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ua.prototype=Object.create(Y.prototype),ua.prototype.constructor=ua,ua.prototype.isQuadraticBezierCurve3=!0,ua.prototype.getPoint=function(e,t){var n=t||new D,r=this.v0,i=this.v1,a=this.v2;return n.set($i(e,r.x,i.x,a.x),$i(e,r.y,i.y,a.y),$i(e,r.z,i.z,a.z)),n},ua.prototype.copy=function(e){return Y.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ua.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ua.prototype.fromJSON=function(e){return Y.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},da.prototype=Object.create(Y.prototype),da.prototype.constructor=da,da.prototype.isSplineCurve=!0,da.prototype.getPoint=function(e,t){var n=t||new b,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Yi(o,s.x,c.x,l.x,u.x),Yi(o,s.y,c.y,l.y,u.y)),n},da.prototype.copy=function(e){Y.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this},da.prototype.toJSON=function(){var e=Y.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e},da.prototype.fromJSON=function(e){Y.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(new b().fromArray(r))}return this},yd=Object.freeze({__proto__:null,ArcCurve:Ki,CatmullRomCurve3:Ji,CubicBezierCurve:aa,CubicBezierCurve3:oa,EllipseCurve:Gi,LineCurve:sa,LineCurve3:ca,QuadraticBezierCurve:la,QuadraticBezierCurve3:ua,SplineCurve:da}),fa.prototype=Object.assign(Object.create(Y.prototype),{constructor:fa,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new sa(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=t){var i=n[r]-t,a=this.curves[r],o=a.getLength(),s=o===0?0:1-i/o;return a.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){e===void 0&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t=[],n,r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?e*2:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];n&&n.equals(l)||(t.push(l),n=l)}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t},copy:function(e){Y.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=Y.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var r=this.curves[t];e.curves.push(r.toJSON())}return e},fromJSON:function(e){Y.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(new yd[r.type]().fromJSON(r))}return this}}),pa.prototype=Object.assign(Object.create(fa.prototype),{constructor:pa,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var n=new sa(this.currentPoint.clone(),new b(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,r){var i=new la(this.currentPoint.clone(),new b(e,t),new b(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this},bezierCurveTo:function(e,t,n,r,i,a){var o=new aa(this.currentPoint.clone(),new b(e,t),new b(n,r),new b(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this},splineThru:function(e){var t=new da([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this},absarc:function(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this},ellipse:function(e,t,n,r,i,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this},absellipse:function(e,t,n,r,i,a,o,s){var c=new Gi(e,t,n,r,i,a,o,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);return this.currentPoint.copy(u),this},copy:function(e){return fa.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=fa.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return fa.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),ma.prototype=Object.assign(Object.create(pa.prototype),{constructor:ma,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){pa.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(r.clone())}return this},toJSON:function(){var e=pa.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var r=this.holes[t];e.holes.push(r.toJSON())}return e},fromJSON:function(e){pa.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(new pa().fromJSON(r))}return this}}),ha.prototype=Object.assign(Object.create(j.prototype),{constructor:ha,isLight:!0,copy:function(e){return j.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}),ga.prototype=Object.assign(Object.create(ha.prototype),{constructor:ga,isHemisphereLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(_a.prototype,{_projScreenMatrix:new O,_lightPositionWorld:new D,_lookTarget:new D,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,n=this.matrix,r=this._projScreenMatrix,i=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),i.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(i),t.updateMatrixWorld(),r.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(r),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var e={};return this.bias!==0&&(e.bias=this.bias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),va.prototype=Object.assign(Object.create(_a.prototype),{constructor:va,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=X.RAD2DEG*2*e.angle,r=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),_a.prototype.updateMatrices.call(this,e)}}),ya.prototype=Object.assign(Object.create(ha.prototype),{constructor:ya,isSpotLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),ba.prototype=Object.assign(Object.create(_a.prototype),{constructor:ba,isPointLightShadow:!0,updateMatrices:function(e,t){t===void 0&&(t=0);var n=this.camera,r=this.matrix,i=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;i.setFromMatrixPosition(e.matrixWorld),n.position.copy(i),a.copy(n.position),a.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(a),n.updateMatrixWorld(),r.makeTranslation(-i.x,-i.y,-i.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}}),xa.prototype=Object.assign(Object.create(ha.prototype),{constructor:xa,isPointLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Sa.prototype=Object.assign(Object.create(_e.prototype),{constructor:Sa,isOrthographicCamera:!0,copy:function(e,t){return _e.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){var c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=c*this.view.offsetX,a=i+c*this.view.width,o-=l*this.view.offsetY,s=o-l*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=j.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}),Ca.prototype=Object.assign(Object.create(_a.prototype),{constructor:Ca,isDirectionalLightShadow:!0,updateMatrices:function(e){_a.prototype.updateMatrices.call(this,e)}}),wa.prototype=Object.assign(Object.create(ha.prototype),{constructor:wa,isDirectionalLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Ta.prototype=Object.assign(Object.create(ha.prototype),{constructor:Ta,isAmbientLight:!0}),Ea.prototype=Object.assign(Object.create(ha.prototype),{constructor:Ea,isRectAreaLight:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=ha.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Object.assign(Da.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*r*1.092548),t.addScaledVector(a[5],r*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],n*i*1.092548),t.addScaledVector(a[8],.546274*(n*n-r*r)),t},getIrradianceAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*r),t.addScaledVector(a[2],2*.511664*i),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*r),t.addScaledVector(a[5],2*.429043*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],2*.429043*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return new this.constructor().copy(this)},fromArray:function(e,t){t===void 0&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}}),Object.assign(Da,{getBasisAt:function(e,t){var n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}),Oa.prototype=Object.assign(Object.create(ha.prototype),{constructor:Oa,isLightProbe:!0,copy:function(e){return ha.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){var t=ha.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),ka.prototype=Object.assign(Object.create(Li.prototype),{constructor:ka,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setPath(i.path),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)},parse:function(e){var t=this.textures;function n(e){return t[e]===void 0&&console.warn(`THREE.MaterialLoader: Undefined texture`,e),t[e]}var r=new ud[e.type];if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=new z().setHex(e.sheen)),e.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular.setHex(e.specular),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==1&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.skinning!==void 0&&(r.skinning=e.skinning),e.morphTargets!==void 0&&(r.morphTargets=e.morphTargets),e.morphNormals!==void 0&&(r.morphNormals=e.morphNormals),e.dithering!==void 0&&(r.dithering=e.dithering),e.vertexTangents!==void 0&&(r.vertexTangents=e.vertexTangents),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors==`number`?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(var i in e.uniforms){var a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case`t`:r.uniforms[i].value=n(a.value);break;case`c`:r.uniforms[i].value=new z().setHex(a.value);break;case`v2`:r.uniforms[i].value=new b().fromArray(a.value);break;case`v3`:r.uniforms[i].value=new D().fromArray(a.value);break;case`v4`:r.uniforms[i].value=new C().fromArray(a.value);break;case`m3`:r.uniforms[i].value=new x().fromArray(a.value);case`m4`:r.uniforms[i].value=new O().fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(var o in e.extensions)r.extensions[o]=e.extensions[o];if(e.shading!==void 0&&(r.flatShading=e.shading===1),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=n(e.map)),e.matcap!==void 0&&(r.matcap=n(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){var s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new b().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=n(e.specularMap)),e.envMap!==void 0&&(r.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new b().fromArray(e.clearcoatNormalScale)),r},setTextures:function(e){return this.textures=e,this}}),bd={decodeText:function(e){if(typeof TextDecoder<`u`)return new TextDecoder().decode(e);for(var t=``,n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}},extractUrlBase:function(e){var t=e.lastIndexOf(`/`);return t===-1?`./`:e.substr(0,t+1)}},Aa.prototype=Object.assign(Object.create(q.prototype),{constructor:Aa,isInstancedBufferGeometry:!0,copy:function(e){return q.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var e=q.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}),ja.prototype=Object.assign(Object.create(H.prototype),{constructor:ja,isInstancedBufferAttribute:!0,copy:function(e){return H.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=H.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),Ma.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ma,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setPath(i.path),a.load(e,function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)},parse:function(e){var t=e.isInstancedBufferGeometry?new Aa:new q,n=e.data.index;if(n!==void 0){var r=new xd[n.type](n.array);t.setIndex(new H(r,1))}var i=e.data.attributes;for(var a in i){var o=i[a],r=new xd[o.type](o.array),s=new(o.isInstancedBufferAttribute?ja:H)(r,o.itemSize,o.normalized);o.name!==void 0&&(s.name=o.name),t.setAttribute(a,s)}var c=e.data.morphAttributes;if(c)for(var a in c){for(var l=c[a],u=[],d=0,f=l.length;d<f;d++){var o=l[d],r=new xd[o.type](o.array),s=new H(r,o.itemSize,o.normalized);o.name!==void 0&&(s.name=o.name),u.push(s)}t.morphAttributes[a]=u}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var p=e.data.groups||e.data.drawcalls||e.data.offsets;if(p!==void 0)for(var d=0,m=p.length;d!==m;++d){var h=p[d];t.addGroup(h.start,h.count,h.materialIndex)}var g=e.data.boundingSphere;if(g!==void 0){var _=new D;g.center!==void 0&&_.fromArray(g.center),t.boundingSphere=new F(_,g.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}}),xd={Int8Array,Uint8Array,Uint8ClampedArray:typeof Uint8ClampedArray<`u`?Uint8ClampedArray:Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array},Na.prototype=Object.assign(Object.create(Li.prototype),{constructor:Na,load:function(e,t,n,r){var i=this,a=this.path===``?bd.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new Ri(i.manager);o.setPath(this.path),o.load(e,function(n){var a=null;try{a=JSON.parse(n)}catch(t){r!==void 0&&r(t),console.error(`THREE:ObjectLoader: Can\'t parse `+e+`.`,t.message);return}var o=a.metadata;if(o===void 0||o.type===void 0||o.type.toLowerCase()===`geometry`){console.error(`THREE.ObjectLoader: Can\'t load `+e);return}i.parse(a,t)},n,r)},parse:function(e,t){var n=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,n),i=this.parseImages(e.images,function(){t!==void 0&&t(s)}),a=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,r,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),(e.images===void 0||e.images.length===0)&&t!==void 0&&t(s),s},parseShape:function(e){var t={};if(e!==void 0)for(var n=0,r=e.length;n<r;n++){var i=new ma().fromJSON(e[n]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var n={};if(e!==void 0)for(var r=new Ma,i=0,a=e.length;i<a;i++){var o,s=e[i];switch(s.type){case`PlaneGeometry`:case`PlaneBufferGeometry`:o=new ld[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case`BoxGeometry`:case`BoxBufferGeometry`:case`CubeGeometry`:o=new ld[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case`CircleGeometry`:case`CircleBufferGeometry`:o=new ld[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case`CylinderGeometry`:case`CylinderBufferGeometry`:o=new ld[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case`ConeGeometry`:case`ConeBufferGeometry`:o=new ld[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case`SphereGeometry`:case`SphereBufferGeometry`:o=new ld[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case`DodecahedronGeometry`:case`DodecahedronBufferGeometry`:case`IcosahedronGeometry`:case`IcosahedronBufferGeometry`:case`OctahedronGeometry`:case`OctahedronBufferGeometry`:case`TetrahedronGeometry`:case`TetrahedronBufferGeometry`:o=new ld[s.type](s.radius,s.detail);break;case`RingGeometry`:case`RingBufferGeometry`:o=new ld[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case`TorusGeometry`:case`TorusBufferGeometry`:o=new ld[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case`TorusKnotGeometry`:case`TorusKnotBufferGeometry`:o=new ld[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case`TubeGeometry`:case`TubeBufferGeometry`:o=new ld[s.type](new yd[s.path.type]().fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case`LatheGeometry`:case`LatheBufferGeometry`:o=new ld[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case`PolyhedronGeometry`:case`PolyhedronBufferGeometry`:o=new ld[s.type](s.vertices,s.indices,s.radius,s.details);break;case`ShapeGeometry`:case`ShapeBufferGeometry`:for(var c=[],l=0,u=s.shapes.length;l<u;l++){var d=t[s.shapes[l]];c.push(d)}o=new ld[s.type](c,s.curveSegments);break;case`ExtrudeGeometry`:case`ExtrudeBufferGeometry`:for(var c=[],l=0,u=s.shapes.length;l<u;l++){var d=t[s.shapes[l]];c.push(d)}var f=s.options.extrudePath;f!==void 0&&(s.options.extrudePath=new yd[f.type]().fromJSON(f)),o=new ld[s.type](c,s.options);break;case`BufferGeometry`:case`InstancedBufferGeometry`:o=r.parse(s);break;case`Geometry`:console.error(`THREE.ObjectLoader: Loading "Geometry" is not supported anymore.`);break;default:console.warn(`THREE.ObjectLoader: Unsupported geometry type "`+s.type+`"`);continue}o.uuid=s.uuid,s.name!==void 0&&(o.name=s.name),o.isBufferGeometry===!0&&s.userData!==void 0&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(e,t){var n={},r={};if(e!==void 0){var i=new ka;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if(s.type===`MultiMaterial`){for(var c=[],l=0;l<s.materials.length;l++){var u=s.materials[l];n[u.uuid]===void 0&&(n[u.uuid]=i.parse(u)),c.push(n[u.uuid])}r[s.uuid]=c}else n[s.uuid]===void 0&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=Ni.parse(r);r.uuid!==void 0&&(i.uuid=r.uuid),t.push(i)}return t},parseImages:function(e,t){var n=this,r={};function i(e){return n.manager.itemStart(e),a.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e),n.manager.itemEnd(e)})}if(e!==void 0&&e.length>0){var a=new Hi(new Ii(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var c=e[o],l=c.url;if(Array.isArray(l)){r[c.uuid]=[];for(var u=0,d=l.length;u<d;u++){var f=l[u],p=/^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test(f)?f:n.resourcePath+f;r[c.uuid].push(i(p))}}else{var p=/^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test(c.url)?c.url:n.resourcePath+c.url;r[c.uuid]=i(p)}}}return r},parseTextures:function(e,t){function n(e,t){return typeof e==`number`?e:(console.warn(`THREE.ObjectLoader.parseTexture: Constant should be in numeric form.`,e),t[e])}var r={};if(e!==void 0)for(var i=0,a=e.length;i<a;i++){var o=e[i];o.image===void 0&&console.warn(`THREE.ObjectLoader: No "image" specified for`,o.uuid),t[o.image]===void 0&&console.warn(`THREE.ObjectLoader: Undefined image`,o.image);var s=Array.isArray(t[o.image])?new Re(t[o.image]):new S(t[o.image]);s.needsUpdate=!0,s.uuid=o.uuid,o.name!==void 0&&(s.name=o.name),o.mapping!==void 0&&(s.mapping=n(o.mapping,Sd)),o.offset!==void 0&&s.offset.fromArray(o.offset),o.repeat!==void 0&&s.repeat.fromArray(o.repeat),o.center!==void 0&&s.center.fromArray(o.center),o.rotation!==void 0&&(s.rotation=o.rotation),o.wrap!==void 0&&(s.wrapS=n(o.wrap[0],Cd),s.wrapT=n(o.wrap[1],Cd)),o.format!==void 0&&(s.format=o.format),o.type!==void 0&&(s.type=o.type),o.encoding!==void 0&&(s.encoding=o.encoding),o.minFilter!==void 0&&(s.minFilter=n(o.minFilter,wd)),o.magFilter!==void 0&&(s.magFilter=n(o.magFilter,wd)),o.anisotropy!==void 0&&(s.anisotropy=o.anisotropy),o.flipY!==void 0&&(s.flipY=o.flipY),o.premultiplyAlpha!==void 0&&(s.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(s.unpackAlignment=o.unpackAlignment),r[o.uuid]=s}return r},parseObject:function(e,t,n){var r;function i(e){return t[e]===void 0&&console.warn(`THREE.ObjectLoader: Undefined geometry`,e),t[e]}function a(e){if(e!==void 0){if(Array.isArray(e)){for(var t=[],r=0,i=e.length;r<i;r++){var a=e[r];n[a]===void 0&&console.warn(`THREE.ObjectLoader: Undefined material`,a),t.push(n[a])}return t}return n[e]===void 0&&console.warn(`THREE.ObjectLoader: Undefined material`,e),n[e]}}switch(e.type){case`Scene`:r=new M,e.background!==void 0&&Number.isInteger(e.background)&&(r.background=new z(e.background)),e.fog!==void 0&&(e.fog.type===`Fog`?r.fog=new wn(e.fog.color,e.fog.near,e.fog.far):e.fog.type===`FogExp2`&&(r.fog=new Cn(e.fog.color,e.fog.density)));break;case`PerspectiveCamera`:r=new ve(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(r.focus=e.focus),e.zoom!==void 0&&(r.zoom=e.zoom),e.filmGauge!==void 0&&(r.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(r.filmOffset=e.filmOffset),e.view!==void 0&&(r.view=Object.assign({},e.view));break;case`OrthographicCamera`:r=new Sa(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(r.zoom=e.zoom),e.view!==void 0&&(r.view=Object.assign({},e.view));break;case`AmbientLight`:r=new Ta(e.color,e.intensity);break;case`DirectionalLight`:r=new wa(e.color,e.intensity);break;case`PointLight`:r=new xa(e.color,e.intensity,e.distance,e.decay);break;case`RectAreaLight`:r=new Ea(e.color,e.intensity,e.width,e.height);break;case`SpotLight`:r=new ya(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case`HemisphereLight`:r=new ga(e.color,e.groundColor,e.intensity);break;case`LightProbe`:r=new Oa().fromJSON(e);break;case`SkinnedMesh`:console.warn(`THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.`);case`Mesh`:var o=i(e.geometry),s=a(e.material);r=new de(o,s);break;case`InstancedMesh`:var o=i(e.geometry),s=a(e.material),c=e.count,l=e.instanceMatrix;r=new Pn(o,s,c),r.instanceMatrix=new H(new Float32Array(l.array),16);break;case`LOD`:r=new An;break;case`Line`:r=new In(i(e.geometry),a(e.material),e.mode);break;case`LineLoop`:r=new Rn(i(e.geometry),a(e.material));break;case`LineSegments`:r=new Ln(i(e.geometry),a(e.material));break;case`PointCloud`:case`Points`:r=new Bn(i(e.geometry),a(e.material));break;case`Sprite`:r=new On(a(e.material));break;case`Group`:r=new vn;break;default:r=new j}if(r.uuid=e.uuid,e.name!==void 0&&(r.name=e.name),e.matrix===void 0?(e.position!==void 0&&r.position.fromArray(e.position),e.rotation!==void 0&&r.rotation.fromArray(e.rotation),e.quaternion!==void 0&&r.quaternion.fromArray(e.quaternion),e.scale!==void 0&&r.scale.fromArray(e.scale)):(r.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(r.matrixAutoUpdate=e.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)),e.castShadow!==void 0&&(r.castShadow=e.castShadow),e.receiveShadow!==void 0&&(r.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(r.shadow.bias=e.shadow.bias),e.shadow.radius!==void 0&&(r.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&r.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(r.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(r.visible=e.visible),e.frustumCulled!==void 0&&(r.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(r.renderOrder=e.renderOrder),e.userData!==void 0&&(r.userData=e.userData),e.layers!==void 0&&(r.layers.mask=e.layers),e.children!==void 0)for(var u=e.children,d=0;d<u.length;d++)r.add(this.parseObject(u[d],t,n));if(e.type===`LOD`){e.autoUpdate!==void 0&&(r.autoUpdate=e.autoUpdate);for(var f=e.levels,p=0;p<f.length;p++){var m=f[p],h=r.getObjectByProperty(`uuid`,m.object);h!==void 0&&r.addLevel(h,m.distance)}}return r}}),Sd={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},Cd={RepeatWrapping:Bo,ClampToEdgeWrapping:Vo,MirroredRepeatWrapping:Ho},wd={NearestFilter:Uo,NearestMipmapNearestFilter:Wo,NearestMipmapLinearFilter:Go,LinearFilter:Ko,LinearMipmapNearestFilter:qo,LinearMipmapLinearFilter:Jo},Pa.prototype=Object.assign(Object.create(Li.prototype),{constructor:Pa,setOptions:function(e){return this.options=e,this},load:function(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=fd.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;fetch(e).then(function(e){return e.blob()}).then(function(e){return i.options===void 0?createImageBitmap(e):createImageBitmap(e,i.options)}).then(function(n){fd.add(e,n),t&&t(n),i.manager.itemEnd(e)}).catch(function(t){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}),i.manager.itemStart(e)}}),Object.assign(Fa.prototype,{moveTo:function(e,t){return this.currentPath=new pa,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this},bezierCurveTo:function(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n],a=new ma;a.curves=i.curves,t.push(a)}return t}function r(e,t){for(var n=t.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=t[i],s=t[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],c=-c,s=t[i],l=-l),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var u=l*(e.x-o.x)-c*(e.y-o.y);if(u===0)return!0;if(u<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var i=sd.isClockWise,a=this.subPaths;if(a.length===0)return[];if(t===!0)return n(a);var o,s,c,l=[];if(a.length===1)return s=a[0],c=new ma,c.curves=s.curves,l.push(c),l;var u=!i(a[0].getPoints());u=e?!u:u;var d=[],f=[],p=[],m=0,h;f[m]=void 0,p[m]=[];for(var g=0,_=a.length;g<_;g++)s=a[g],h=s.getPoints(),o=i(h),o=e?!o:o,o?(!u&&f[m]&&m++,f[m]={s:new ma,p:h},f[m].s.curves=s.curves,u&&m++,p[m]=[]):p[m].push({h:s,p:h[0]});if(!f[0])return n(a);if(f.length>1){for(var v=!1,y=[],b=0,x=f.length;b<x;b++)d[b]=[];for(var b=0,x=f.length;b<x;b++)for(var S=p[b],C=0;C<S.length;C++){for(var w=S[C],T=!0,E=0;E<f.length;E++)r(w.p,f[E].p)&&(b!==E&&y.push({froms:b,tos:E,hole:C}),T?(T=!1,d[E].push(w)):v=!0);T&&d[b].push(w)}y.length>0&&(v||(p=d))}for(var D,g=0,O=f.length;g<O;g++){c=f[g].s,l.push(c),D=p[g];for(var k=0,A=D.length;k<A;k++)c.holes.push(D[k].h)}return l}}),Object.assign(Ia.prototype,{isFont:!0,generateShapes:function(e,t){t===void 0&&(t=100);for(var n=[],r=La(e,t,this.data),i=0,a=r.length;i<a;i++)Array.prototype.push.apply(n,r[i].toShapes());return n}}),za.prototype=Object.assign(Object.create(Li.prototype),{constructor:za,load:function(e,t,n,r){var i=this,a=new Ri(this.manager);a.setPath(this.path),a.load(e,function(e){var n;try{n=JSON.parse(e)}catch(t){console.warn(`THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead.`),n=JSON.parse(e.substring(65,e.length-2))}var r=i.parse(n);t&&t(r)},n,r)},parse:function(e){return new Ia(e)}}),Ed={getContext:function(){return Td===void 0&&(Td=new(window.AudioContext||window.webkitAudioContext)),Td},setContext:function(e){Td=e}},Ba.prototype=Object.assign(Object.create(Li.prototype),{constructor:Ba,load:function(e,t,n,r){var i=this,a=new Ri(i.manager);a.setResponseType(`arraybuffer`),a.setPath(i.path),a.load(e,function(n){try{var a=n.slice(0);Ed.getContext().decodeAudioData(a,function(e){t(e)})}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}}),Va.prototype=Object.assign(Object.create(Oa.prototype),{constructor:Va,isHemisphereLightProbe:!0,copy:function(e){return Oa.prototype.copy.call(this,e),this},toJSON:function(e){return Oa.prototype.toJSON.call(this,e)}}),Ha.prototype=Object.assign(Object.create(Oa.prototype),{constructor:Ha,isAmbientLightProbe:!0,copy:function(e){return Oa.prototype.copy.call(this,e),this},toJSON:function(e){return Oa.prototype.toJSON.call(this,e)}}),Dd=new O,Od=new O,Object.assign(Ua.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;var n=e.projectionMatrix.clone(),r=t.eyeSep/2,i=r*t.near/t.focus,a=t.near*Math.tan(X.DEG2RAD*t.fov*.5)/t.zoom,o,s;Od.elements[12]=-r,Dd.elements[12]=r,o=-a*t.aspect+i,s=a*t.aspect+i,n.elements[0]=2*t.near/(s-o),n.elements[8]=(s+o)/(s-o),this.cameraL.projectionMatrix.copy(n),o=-a*t.aspect-i,s=a*t.aspect-i,n.elements[0]=2*t.near/(s-o),n.elements[8]=(s+o)/(s-o),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Od),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Dd)}}),Object.assign(Wa.prototype,{start:function(){this.startTime=(typeof performance>`u`?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=(typeof performance>`u`?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}),kd=new D,Ad=new E,jd=new D,Md=new D,Ga.prototype=Object.assign(Object.create(j.prototype),{constructor:Ga,getInput:function(){return this.gain},removeFilter:function(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return this.filter===null?this.gain.disconnect(this.context.destination):(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){j.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(kd,Ad,jd),Md.set(0,0,-1).applyQuaternion(Ad),t.positionX){var r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(kd.x,r),t.positionY.linearRampToValueAtTime(kd.y,r),t.positionZ.linearRampToValueAtTime(kd.z,r),t.forwardX.linearRampToValueAtTime(Md.x,r),t.forwardY.linearRampToValueAtTime(Md.y,r),t.forwardZ.linearRampToValueAtTime(Md.z,r),t.upX.linearRampToValueAtTime(n.x,r),t.upY.linearRampToValueAtTime(n.y,r),t.upZ.linearRampToValueAtTime(n.z,r)}else t.setPosition(kd.x,kd.y,kd.z),t.setOrientation(Md.x,Md.y,Md.z,n.x,n.y,n.z)}}),Ka.prototype=Object.assign(Object.create(j.prototype),{constructor:Ka,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=`audioNode`,this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=`mediaNode`,this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=`mediaStreamNode`,this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType=`buffer`,this.autoplay&&this.play(),this},play:function(e){if(e===void 0&&(e=0),this.isPlaying===!0){console.warn(`THREE.Audio: Audio is already playing.`);return}if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()},pause:function(){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress%=this.duration||this.buffer.duration),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this},stop:function(){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),this.isPlaying===!0?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return this.hasPlaybackControl===!1?(console.warn(`THREE.Audio: this Audio has no playback control.`),!1):this.loop},setLoop:function(e){if(this.hasPlaybackControl===!1){console.warn(`THREE.Audio: this Audio has no playback control.`);return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}),Nd=new D,Pd=new E,Fd=new D,Id=new D,qa.prototype=Object.assign(Object.create(Ka.prototype),{constructor:qa,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(e){if(j.prototype.updateMatrixWorld.call(this,e),!(this.hasPlaybackControl===!0&&this.isPlaying===!1)){this.matrixWorld.decompose(Nd,Pd,Fd),Id.set(0,0,1).applyQuaternion(Pd);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Nd.x,n),t.positionY.linearRampToValueAtTime(Nd.y,n),t.positionZ.linearRampToValueAtTime(Nd.z,n),t.orientationX.linearRampToValueAtTime(Id.x,n),t.orientationY.linearRampToValueAtTime(Id.y,n),t.orientationZ.linearRampToValueAtTime(Id.z,n)}else t.setPosition(Nd.x,Nd.y,Nd.z),t.setOrientation(Id.x,Id.y,Id.z)}}}),Object.assign(Ja.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),Object.assign(Ya.prototype,{accumulate:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(a===0){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{a+=t;var s=t/a;this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},accumulateAdditive:function(e){var t=this.buffer,n=this.valueSize,r=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=this.valueSize*3;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*4+3]=1},_setAdditiveIdentityOther:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]},_select:function(e,t,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,r){E.slerpFlat(e,t,e,t,e,n,r)},_slerpAdditive:function(e,t,n,r,i){var a=this._workIndex*i;E.multiplyQuaternionsFlat(e,a,e,t,e,n),E.slerpFlat(e,t,e,t,e,a,r)},_lerp:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}},_lerpAdditive:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}}),Ld=`\\\\[\\\\]\\\\.:\\\\/`,Rd=RegExp(`[`+Ld+`]`,`g`),zd=`[^`+Ld+`]`,Bd=`[^`+Ld.replace(`\\\\.`,``)+`]`,Vd=`((?:WC+[\\\\/:])*)`.replace(`WC`,zd),Hd=`(WCOD+)?`.replace(`WCOD`,Bd),Ud=`(?:\\\\.(WC+)(?:\\\\[(.+)\\\\])?)?`.replace(`WC`,zd),Wd=`\\\\.(WC+)(?:\\\\[(.+)\\\\])?`.replace(`WC`,zd),Gd=RegExp(`^`+Vd+Hd+Ud+Wd+`$`),Kd=[`material`,`materials`,`bones`],Object.assign(Xa.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(Za,{Composite:Xa,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Za.Composite(e,t,n):new Za(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\\s/g,`_`).replace(Rd,``)},parseTrackName:function(e){var t=Gd.exec(e);if(!t)throw Error(`PropertyBinding: Cannot parse trackName: `+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){var i=n.nodeName.substring(r+1);Kd.indexOf(i)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`PropertyBinding: can not parse propertyName from trackName: `+e);return n},findNode:function(e,t){if(!t||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){var r=function(e){for(var n=0;n<e.length;n++){var i=e[n];if(i.name===t||i.uuid===t)return i;var a=r(i.children);if(a)return a}return null},i=r(e.children);if(i)return i}return null}}),Object.assign(Za.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,i=t.propertyIndex;if(e||(e=Za.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error(`THREE.PropertyBinding: Trying to update node for track: `+this.path+` but it wasn\'t found.`);return}if(n){var a=t.objectIndex;switch(n){case`materials`:if(!e.material){console.error(`THREE.PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!e.material.materials){console.error(`THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.`,this);return}e=e.material.materials;break;case`bones`:if(!e.skeleton){console.error(`THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.`,this);return}e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(e[n]===void 0){console.error(`THREE.PropertyBinding: Can not bind to objectName of node undefined.`,this);return}e=e[n]}if(a!==void 0){if(e[a]===void 0){console.error(`THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.`,this,e);return}e=e[a]}}var s=e[r];if(s===void 0){var c=t.nodeName;console.error(`THREE.PropertyBinding: Trying to update property for track: `+c+`.`+r+` but it wasn\'t found.`,e);return}var l=this.Versioning.None;this.targetObject=e,e.needsUpdate===void 0?e.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate):l=this.Versioning.NeedsUpdate;var u=this.BindingType.Direct;if(i!==void 0){if(r===`morphTargetInfluences`){if(!e.geometry){console.error(`THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.`,this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error(`THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.`,this);return}e.morphTargetDictionary[i]!==void 0&&(i=e.morphTargetDictionary[i])}else{console.error(`THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.`,this);return}}u=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else s.fromArray!==void 0&&s.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(u=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Za.prototype,{_getValue_unbound:Za.prototype.getValue,_setValue_unbound:Za.prototype.setValue}),Object.assign(Qa.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,l=0,u=arguments.length;l!==u;++l){var d=arguments[l],f=d.uuid,p=r[f];if(p===void 0){p=t++,r[f]=p,e.push(d);for(var m=0,h=s;m!==h;++m)o[m].push(new Za(d,i[m],a[m]))}else if(p<n){c=e[p];var g=--n,_=e[g];r[_.uuid]=p,e[p]=_,r[f]=g,e[g]=d;for(var m=0,h=s;m!==h;++m){var v=o[m],y=v[g],b=v[p];v[p]=y,b===void 0&&(b=new Za(d,i[m],a[m])),v[g]=b}}else e[p]!==c&&console.error(`THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.`)}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,i=r.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=n[c];if(l!==void 0&&l>=t){var u=t++,d=e[u];n[d.uuid]=l,e[l]=d,n[c]=u,e[u]=s;for(var f=0,p=i;f!==p;++f){var m=r[f],h=m[u],g=m[l];m[l]=h,m[u]=g}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o].uuid,l=r[c];if(l!==void 0)if(delete r[c],l<n){var u=--n,d=e[u],f=--t,p=e[f];r[d.uuid]=l,e[l]=d,r[p.uuid]=u,e[u]=p,e.pop();for(var m=0,h=a;m!==h;++m){var g=i[m],_=g[u],v=g[f];g[l]=_,g[u]=v,g.pop()}}else{var f=--t,p=e[f];r[p.uuid]=l,e[l]=p,e.pop();for(var m=0,h=a;m!==h;++m){var g=i[m];g[l]=g[f],g.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(r!==void 0)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,u=Array(c);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(u);for(var d=l,f=s.length;d!==f;++d){var p=s[d];u[d]=new Za(p,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c=e[o];t[c]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}),Object.assign($a.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var r=this._mixer,i=r.time,a=this._timeScaleInterpolant,o=this.timeScale;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=i,s[1]=i+n,c[0]=e/o,c[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,r){if(!this.enabled){this._updateWeight(e);return}var i=this._startTime;if(i!==null){var a=(e-i)*n;if(a<0||n===0)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case Qs:for(var u=0,d=c.length;u!==d;++u)c[u].evaluate(o),l[u].accumulateAdditive(s);break;case Zs:default:for(var u=0,d=c.length;u!==d;++u)c[u].evaluate(o),l[u].accumulate(r,s)}}},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(n!==null){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(n!==null){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,r=this.loop,i=this._loopCount,a=r===Ws;if(e===0)return i===-1?t:a&&(i&1)==1?n-t:t;if(r===2200){i===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));handle_stop:{if(t>=n)t=n;else if(t<0)t=0;else{this.time=t;break handle_stop}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:`finished`,action:this,direction:e<0?-1:1})}}else{if(i===-1&&(e>=0?(i=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:`finished`,action:this,direction:e>0?1:-1});else{if(s===1){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=t,this._mixer.dispatchEvent({type:`loop`,action:this,loopDelta:o})}}else this.time=t;if(a&&(i&1)==1)return n-t}return t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=Ys,r.endingEnd=Ys):(e?r.endingStart=this.zeroSlopeAtStart?Ys:Js:r.endingStart=Xs,t?r.endingEnd=this.zeroSlopeAtEnd?Ys:Js:r.endingEnd=Xs)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}),eo.prototype=Object.assign(Object.create(y.prototype),{constructor:eo,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];l===void 0&&(l={},c[s]=l);for(var u=0;u!==i;++u){var d=r[u],f=d.name,p=l[f];if(p!==void 0)a[u]=p;else{if(p=a[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,s,f));continue}var m=t&&t._propertyBindings[u].binding.parsedPath;p=new Ya(Za.create(n,f,m),d.ValueTypeName,d.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,f),a[u]=p}o[u].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];--i.useCount===0&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return t!==null&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),e._byClipCacheIndex=null;var u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],s.length===0&&delete a[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];--i.referenceCount===0&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_addInactiveBinding:function(e,t,n){var r=this._bindingsByRootAndName,i=r[t],a=this._bindings;i===void 0&&(i={},r[t]=i),i[n]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[i],Object.keys(o).length===0&&delete a[r]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return n===void 0&&(n=new Ci(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){var r=t||this._root,i=r.uuid,a=typeof e==`string`?Ni.findByName(r,e):e,o=a===null?e:a.uuid,s=this._actionsByClip[o],c=null;if(n===void 0&&(n=a===null?Zs:a.blendMode),s!==void 0){var l=s.actionByRoot[i];if(l!==void 0&&l.blendMode===n)return l;c=s.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;var u=new $a(this,a,t,n);return this._bindAction(u,c),this._addInactiveAction(u,o,i),u},existingAction:function(e,t){var n=t||this._root,r=n.uuid,i=typeof e==`string`?Ni.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return o===void 0?null:o.actionByRoot[r]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o)t[o]._update(r,e,i,a);for(var s=this._bindings,c=this._nActiveBindings,o=0;o!==c;++o)s[o].apply(a);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(i!==void 0){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,t[l]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[t];i!==void 0&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[t];if(a!==void 0)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),to.prototype.clone=function(){return new to(this.value.clone===void 0?this.value:this.value.clone())},no.prototype=Object.assign(Object.create(Tn.prototype),{constructor:no,isInstancedInterleavedBuffer:!0,copy:function(e){return Tn.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(ro.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error(`THREE.Raycaster: Unsupported camera type.`)},intersectObject:function(e,t,n){var r=n||[];return ao(e,this,r,t),r.sort(io),r},intersectObjects:function(e,t,n){var r=n||[];if(Array.isArray(e)===!1)return console.warn(`THREE.Raycaster.intersectObjects: objects is not an Array.`),r;for(var i=0,a=e.length;i<a;i++)ao(e[i],this,r,t);return r.sort(io),r}}),Object.assign(oo.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(X.clamp(t/this.radius,-1,1))),this}}),Object.assign(so.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}}),qd=new b,Object.assign(co.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=qd.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return e===void 0&&(console.warn(`THREE.Box2: .getCenter() target is now required`),e=new b),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return e===void 0&&(console.warn(`THREE.Box2: .getSize() target is now required`),e=new b),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return t===void 0&&(console.warn(`THREE.Box2: .getParameter() target is now required`),t=new b),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return t===void 0&&(console.warn(`THREE.Box2: .clampPoint() target is now required`),t=new b),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return qd.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Jd=new D,Yd=new D,Object.assign(lo.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return e===void 0&&(console.warn(`THREE.Line3: .getCenter() target is now required`),e=new D),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return e===void 0&&(console.warn(`THREE.Line3: .delta() target is now required`),e=new D),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return t===void 0&&(console.warn(`THREE.Line3: .at() target is now required`),t=new D),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){Jd.subVectors(e,this.start),Yd.subVectors(this.end,this.start);var n=Yd.dot(Yd),r=Yd.dot(Jd)/n;return t&&(r=X.clamp(r,0,1)),r},closestPointToPoint:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return n===void 0&&(console.warn(`THREE.Line3: .closestPointToPoint() target is now required`),n=new D),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),uo.prototype=Object.create(j.prototype),uo.prototype.constructor=uo,uo.prototype.isImmediateRenderObject=!0,Xd=new D,fo.prototype=Object.create(j.prototype),fo.prototype.constructor=fo,fo.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},fo.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Xd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Xd),this.color===void 0?this.cone.material.color.copy(this.light.color):this.cone.material.color.set(this.color)},Zd=new D,Qd=new O,$d=new O,mo.prototype=Object.create(Ln.prototype),mo.prototype.constructor=mo,mo.prototype.isSkeletonHelper=!0,mo.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,r=n.getAttribute(`position`);$d.getInverse(this.root.matrixWorld);for(var i=0,a=0;i<t.length;i++){var o=t[i];o.parent&&o.parent.isBone&&(Qd.multiplyMatrices($d,o.matrixWorld),Zd.setFromMatrixPosition(Qd),r.setXYZ(a,Zd.x,Zd.y,Zd.z),Qd.multiplyMatrices($d,o.parent.matrixWorld),Zd.setFromMatrixPosition(Qd),r.setXYZ(a+1,Zd.x,Zd.y,Zd.z),a+=2)}n.getAttribute(`position`).needsUpdate=!0,j.prototype.updateMatrixWorld.call(this,e)},ho.prototype=Object.create(de.prototype),ho.prototype.constructor=ho,ho.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},ho.prototype.update=function(){this.color===void 0?this.material.color.copy(this.light.color):this.material.color.set(this.color)},ef=new D,tf=new z,nf=new z,go.prototype=Object.create(j.prototype),go.prototype.constructor=go,go.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},go.prototype.update=function(){var e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{var t=e.geometry.getAttribute(`color`);tf.copy(this.light.color),nf.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?tf:nf;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(ef.setFromMatrixPosition(this.light.matrixWorld).negate())},_o.prototype=Object.assign(Object.create(Ln.prototype),{constructor:_o,copy:function(e){return Ln.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return new this.constructor().copy(this)}}),vo.prototype=Object.create(Ln.prototype),vo.prototype.constructor=vo,rf=new D,af=new D,of=new D,yo.prototype=Object.create(j.prototype),yo.prototype.constructor=yo,yo.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},yo.prototype.update=function(){rf.setFromMatrixPosition(this.light.matrixWorld),af.setFromMatrixPosition(this.light.target.matrixWorld),of.subVectors(af,rf),this.lightPlane.lookAt(af),this.color===void 0?(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)):(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)),this.targetLine.lookAt(af),this.targetLine.scale.z=of.length()},sf=new D,cf=new _e,bo.prototype=Object.create(Ln.prototype),bo.prototype.constructor=bo,bo.prototype.update=function(){var e=this.geometry,t=this.pointMap,n=1,r=1;cf.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),xo(`c`,t,e,cf,0,0,-1),xo(`t`,t,e,cf,0,0,1),xo(`n1`,t,e,cf,-n,-r,-1),xo(`n2`,t,e,cf,n,-r,-1),xo(`n3`,t,e,cf,-n,r,-1),xo(`n4`,t,e,cf,n,r,-1),xo(`f1`,t,e,cf,-n,-r,1),xo(`f2`,t,e,cf,n,-r,1),xo(`f3`,t,e,cf,-n,r,1),xo(`f4`,t,e,cf,n,r,1),xo(`u1`,t,e,cf,n*.7,r*1.1,-1),xo(`u2`,t,e,cf,-n*.7,r*1.1,-1),xo(`u3`,t,e,cf,0,r*2,-1),xo(`cf1`,t,e,cf,-n,0,1),xo(`cf2`,t,e,cf,n,0,1),xo(`cf3`,t,e,cf,0,-r,1),xo(`cf4`,t,e,cf,0,r,1),xo(`cn1`,t,e,cf,-n,0,-1),xo(`cn2`,t,e,cf,n,0,-1),xo(`cn3`,t,e,cf,0,-r,-1),xo(`cn4`,t,e,cf,0,r,-1),e.getAttribute(`position`).needsUpdate=!0},lf=new N,So.prototype=Object.create(Ln.prototype),So.prototype.constructor=So,So.prototype.update=function(e){if(e!==void 0&&console.warn(`THREE.BoxHelper: .update() has no longer arguments.`),this.object!==void 0&&lf.setFromObject(this.object),!lf.isEmpty()){var t=lf.min,n=lf.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}},So.prototype.setFromObject=function(e){return this.object=e,this.update(),this},So.prototype.copy=function(e){return Ln.prototype.copy.call(this,e),this.object=e.object,this},So.prototype.clone=function(){return new this.constructor().copy(this)},Co.prototype=Object.create(Ln.prototype),Co.prototype.constructor=Co,Co.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),j.prototype.updateMatrixWorld.call(this,e))},wo.prototype=Object.create(In.prototype),wo.prototype.constructor=wo,wo.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=+(t<0),this.lookAt(this.plane.normal),j.prototype.updateMatrixWorld.call(this,e)},uf=new D,To.prototype=Object.create(j.prototype),To.prototype.constructor=To,To.prototype.setDirection=function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{uf.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(uf,t)}},To.prototype.setLength=function(e,t,n){t===void 0&&(t=.2*e),n===void 0&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},To.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},To.prototype.copy=function(e){return j.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},To.prototype.clone=function(){return new this.constructor().copy(this)},Eo.prototype=Object.create(Ln.prototype),Eo.prototype.constructor=Eo,pf=4,mf=8,hf=Math.pow(2,mf),gf=[.125,.215,.35,.446,.526,.582],_f=mf-pf+1+gf.length,vf=20,yf={[$s]:0,[ec]:1,[nc]:2,[ic]:3,[ac]:4,[oc]:5,[tc]:6},bf=new Sa,{_lodPlanes:xf,_sizeLods:Sf,_sigmas:Cf}=ko(),wf=null,Tf=(1+Math.sqrt(5))/2,Ef=1/Tf,Df=[new D(1,1,1),new D(-1,1,1),new D(1,1,-1),new D(-1,1,-1),new D(0,Tf,Ef),new D(0,Tf,-Ef),new D(Ef,0,Tf),new D(-Ef,0,Tf),new D(Tf,Ef,0),new D(-Tf,Ef,0)],Do.prototype={constructor:Do,fromScene:function(e,t=0,n=.1,r=100){wf=this._renderer.getRenderTarget();var i=this._allocateTargets();return this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i},fromEquirectangular:function(e){return e.magFilter=Uo,e.minFilter=Uo,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){wf=this._renderer.getRenderTarget();var t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t},compileCubemapShader:function(){this._cubemapShader===null&&(this._cubemapShader=Po(),this._compileMaterial(this._cubemapShader))},compileEquirectangularShader:function(){this._equirectShader===null&&(this._equirectShader=No(),this._compileMaterial(this._equirectShader))},dispose:function(){this._blurMaterial.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(var e=0;e<xf.length;e++)xf[e].dispose()},_cleanup:function(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(wf),e.scissorTest=!1,e.setSize(e.width,e.height)},_allocateTargets:function(e){var t={magFilter:Uo,minFilter:Uo,generateMipmaps:!1,type:Yo,format:ts,encoding:Oo(e)?e.encoding:nc,depthBuffer:!1,stencilBuffer:!1},n=Ao(t);return n.depthBuffer=!e,this._pingPongRenderTarget=Ao(t),n},_compileMaterial:function(e){var t=new de(xf[0],e);this._renderer.compile(t,bf)},_sceneToCubeUV:function(e,t,n,r){var i=new ve(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,c=s.outputEncoding,l=s.toneMapping,u=s.toneMappingExposure,d=s.getClearColor(),f=s.getClearAlpha();s.toneMapping=1,s.toneMappingExposure=1,s.outputEncoding=$s;var p=e.background;if(p&&p.isColor){p.convertSRGBToLinear();var m=Math.max(p.r,p.g,p.b),h=Math.min(Math.max(Math.ceil(Math.log2(m)),-128),127);p=p.multiplyScalar(Math.pow(2,-h));var g=(h+128)/255;s.setClearColor(p,g),e.background=null}for(var _=0;_<6;_++){var v=_%3;v==0?(i.up.set(0,a[_],0),i.lookAt(o[_],0,0)):v==1?(i.up.set(0,0,a[_]),i.lookAt(0,o[_],0)):(i.up.set(0,a[_],0),i.lookAt(0,0,o[_])),jo(r,v*hf,_>2?hf:0,hf,hf),s.setRenderTarget(r),s.render(e,i)}s.toneMapping=l,s.toneMappingExposure=u,s.outputEncoding=c,s.setClearColor(d,f)},_textureToCubeUV:function(e,t){var n=this._renderer;e.isCubeTexture?this._cubemapShader==null&&(this._cubemapShader=Po()):this._equirectShader==null&&(this._equirectShader=No());var r=e.isCubeTexture?this._cubemapShader:this._equirectShader,i=new de(xf[0],r),a=r.uniforms;a.envMap.value=e,e.isCubeTexture||a.texelSize.value.set(1/e.image.width,1/e.image.height),a.inputEncoding.value=yf[e.encoding],a.outputEncoding.value=yf[t.texture.encoding],jo(t,0,0,3*hf,2*hf),n.setRenderTarget(t),n.render(i,bf)},_applyPMREM:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;r<_f;r++){var i=Math.sqrt(Cf[r]*Cf[r]-Cf[r-1]*Cf[r-1]),a=Df[(r-1)%Df.length];this._blur(e,r-1,r,i,a)}t.autoClear=n},_blur:function(e,t,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,`latitudinal`,i),this._halfBlur(a,e,n,n,r,`longitudinal`,i)},_halfBlur:function(e,t,n,r,i,a,o){var s=this._renderer,c=this._blurMaterial;a!==`latitudinal`&&a!==`longitudinal`&&console.error(`blur direction must be either latitudinal or longitudinal!`);var l=3,u=new de(xf[r],c),d=c.uniforms,f=Sf[n]-1,p=isFinite(i)?Math.PI/(2*f):2*Math.PI/(2*vf-1),m=i/p,h=isFinite(i)?1+Math.floor(l*m):vf;h>vf&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${h} samples when the maximum is set to ${vf}`);for(var g=[],_=0,v=0;v<vf;++v){var y=v/m,b=Math.exp(-y*y/2);g.push(b),v==0?_+=b:v<h&&(_+=2*b)}for(var v=0;v<g.length;v++)g[v]=g[v]/_;d.envMap.value=e.texture,d.samples.value=h,d.weights.value=g,d.latitudinal.value=a===`latitudinal`,o&&(d.poleAxis.value=o),d.dTheta.value=p,d.mipInt.value=mf-n,d.inputEncoding.value=yf[e.texture.encoding],d.outputEncoding.value=yf[e.texture.encoding];var x=Sf[r],y=3*Math.max(0,hf-2*x);jo(t,y,(r===0?0:2*hf)+2*x*(r>mf-pf?r-mf+pf:0),3*x,2*x),s.setRenderTarget(t),s.render(u,bf)}},Y.create=function(e,t){return console.log(`THREE.Curve.create() has been deprecated`),e.prototype=Object.create(Y.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(fa.prototype,{createPointsGeometry:function(e){console.warn(`THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.`);var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn(`THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.`);var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn(`THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.`);for(var t=new J,n=0,r=e.length;n<r;n++){var i=e[n];t.vertices.push(new D(i.x,i.y,i.z||0))}return t}}),Object.assign(pa.prototype,{fromPoints:function(e){return console.warn(`THREE.Path: .fromPoints() has been renamed to .setFromPoints().`),this.setFromPoints(e)}}),Lo.prototype=Object.create(Ji.prototype),Ro.prototype=Object.create(Ji.prototype),zo.prototype=Object.create(Ji.prototype),Object.assign(zo.prototype,{initFromArray:function(){console.error(`THREE.Spline: .initFromArray() has been removed.`)},getControlPointsArray:function(){console.error(`THREE.Spline: .getControlPointsArray() has been removed.`)},reparametrizeByArcLength:function(){console.error(`THREE.Spline: .reparametrizeByArcLength() has been removed.`)}}),_o.prototype.setColors=function(){console.error(`THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.`)},mo.prototype.update=function(){console.error(`THREE.SkeletonHelper: update() no longer needs to be called.`)},Object.assign(Li.prototype,{extractUrlBase:function(e){return console.warn(`THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.`),bd.extractUrlBase(e)}}),Li.Handlers={add:function(){console.error(`THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.`)},get:function(){console.error(`THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.`)}},Object.assign(Na.prototype,{setTexturePath:function(e){return console.warn(`THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().`),this.setResourcePath(e)}}),Object.assign(co.prototype,{center:function(e){return console.warn(`THREE.Box2: .center() has been renamed to .getCenter().`),this.getCenter(e)},empty:function(){return console.warn(`THREE.Box2: .empty() has been renamed to .isEmpty().`),this.isEmpty()},isIntersectionBox:function(e){return console.warn(`THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().`),this.intersectsBox(e)},size:function(e){return console.warn(`THREE.Box2: .size() has been renamed to .getSize().`),this.getSize(e)}}),Object.assign(N.prototype,{center:function(e){return console.warn(`THREE.Box3: .center() has been renamed to .getCenter().`),this.getCenter(e)},empty:function(){return console.warn(`THREE.Box3: .empty() has been renamed to .isEmpty().`),this.isEmpty()},isIntersectionBox:function(e){return console.warn(`THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().`),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn(`THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().`),this.intersectsSphere(e)},size:function(e){return console.warn(`THREE.Box3: .size() has been renamed to .getSize().`),this.getSize(e)}}),Object.assign(F.prototype,{empty:function(){return console.warn(`THREE.Sphere: .empty() has been renamed to .isEmpty().`),this.isEmpty()}}),Se.prototype.setFromMatrix=function(e){return console.warn(`THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix().`),this.setFromProjectionMatrix(e)},lo.prototype.center=function(e){return console.warn(`THREE.Line3: .center() has been renamed to .getCenter().`),this.getCenter(e)},Object.assign(X,{random16:function(){return console.warn(`THREE.Math: .random16() has been deprecated. Use Math.random() instead.`),Math.random()},nearestPowerOfTwo:function(e){return console.warn(`THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo().`),X.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn(`THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo().`),X.ceilPowerOfTwo(e)}}),Object.assign(x.prototype,{flattenToArrayOffset:function(e,t){return console.warn(`THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.`),this.toArray(e,t)},multiplyVector3:function(e){return console.warn(`THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.`),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error(`THREE.Matrix3: .multiplyVector3Array() has been removed.`)},applyToBufferAttribute:function(e){return console.warn(`THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead.`),e.applyMatrix3(this)},applyToVector3Array:function(){console.error(`THREE.Matrix3: .applyToVector3Array() has been removed.`)}}),Object.assign(O.prototype,{extractPosition:function(e){return console.warn(`THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().`),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn(`THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.`),this.toArray(e,t)},getPosition:function(){return console.warn(`THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.`),new D().setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn(`THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().`),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn(`THREE.Matrix4: .multiplyToArray() has been removed.`)},multiplyVector3:function(e){return console.warn(`THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn(`THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error(`THREE.Matrix4: .multiplyVector3Array() has been removed.`)},rotateAxis:function(e){console.warn(`THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.`),e.transformDirection(this)},crossVector:function(e){return console.warn(`THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},translate:function(){console.error(`THREE.Matrix4: .translate() has been removed.`)},rotateX:function(){console.error(`THREE.Matrix4: .rotateX() has been removed.`)},rotateY:function(){console.error(`THREE.Matrix4: .rotateY() has been removed.`)},rotateZ:function(){console.error(`THREE.Matrix4: .rotateZ() has been removed.`)},rotateByAxis:function(){console.error(`THREE.Matrix4: .rotateByAxis() has been removed.`)},applyToBufferAttribute:function(e){return console.warn(`THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead.`),e.applyMatrix4(this)},applyToVector3Array:function(){console.error(`THREE.Matrix4: .applyToVector3Array() has been removed.`)},makeFrustum:function(e,t,n,r,i,a){return console.warn(`THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.`),this.makePerspective(e,t,r,n,i,a)}}),L.prototype.isIntersectionLine=function(e){return console.warn(`THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().`),this.intersectsLine(e)},E.prototype.multiplyVector3=function(e){return console.warn(`THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.`),e.applyQuaternion(this)},Object.assign(I.prototype,{isIntersectionBox:function(e){return console.warn(`THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().`),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn(`THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().`),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn(`THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().`),this.intersectsSphere(e)}}),Object.assign(R.prototype,{area:function(){return console.warn(`THREE.Triangle: .area() has been renamed to .getArea().`),this.getArea()},barycoordFromPoint:function(e,t){return console.warn(`THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().`),this.getBarycoord(e,t)},midpoint:function(e){return console.warn(`THREE.Triangle: .midpoint() has been renamed to .getMidpoint().`),this.getMidpoint(e)},normal:function(e){return console.warn(`THREE.Triangle: .normal() has been renamed to .getNormal().`),this.getNormal(e)},plane:function(e){return console.warn(`THREE.Triangle: .plane() has been renamed to .getPlane().`),this.getPlane(e)}}),Object.assign(R,{barycoordFromPoint:function(e,t,n,r,i){return console.warn(`THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().`),R.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn(`THREE.Triangle: .normal() has been renamed to .getNormal().`),R.getNormal(e,t,n,r)}}),Object.assign(ma.prototype,{extractAllPoints:function(e){return console.warn(`THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.`),this.extractPoints(e)},extrude:function(e){return console.warn(`THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.`),new Wr(this,e)},makeGeometry:function(e){return console.warn(`THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.`),new ti(this,e)}}),Object.assign(b.prototype,{fromAttribute:function(e,t,n){return console.warn(`THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().`),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn(`THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().`),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn(`THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().`),this.manhattanLength()}}),Object.assign(D.prototype,{setEulerFromRotationMatrix:function(){console.error(`THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.`)},setEulerFromQuaternion:function(){console.error(`THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.`)},getPositionFromMatrix:function(e){return console.warn(`THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().`),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn(`THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().`),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn(`THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().`),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn(`THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.`),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn(`THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().`),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn(`THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().`),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn(`THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().`),this.manhattanLength()}}),Object.assign(C.prototype,{fromAttribute:function(e,t,n){return console.warn(`THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().`),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn(`THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().`),this.manhattanLength()}}),Object.assign(J.prototype,{computeTangents:function(){console.error(`THREE.Geometry: .computeTangents() has been removed.`)},computeLineDistances:function(){console.error(`THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.`)},applyMatrix:function(e){return console.warn(`THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)}}),Object.assign(j.prototype,{getChildByName:function(e){return console.warn(`THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().`),this.getObjectByName(e)},renderDepth:function(){console.warn(`THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.`)},translate:function(e,t){return console.warn(`THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.`),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error(`THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.`)},applyMatrix:function(e){return console.warn(`THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)}}),Object.defineProperties(j.prototype,{eulerOrder:{get:function(){return console.warn(`THREE.Object3D: .eulerOrder is now .rotation.order.`),this.rotation.order},set:function(e){console.warn(`THREE.Object3D: .eulerOrder is now .rotation.order.`),this.rotation.order=e}},useQuaternion:{get:function(){console.warn(`THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.`)},set:function(){console.warn(`THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.`)}}}),Object.assign(de.prototype,{setDrawMode:function(){console.error(`THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.`)}}),Object.defineProperties(de.prototype,{drawMode:{get:function(){return console.error(`THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode.`),0},set:function(){console.error(`THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.`)}}}),Object.defineProperties(An.prototype,{objects:{get:function(){return console.warn(`THREE.LOD: .objects has been renamed to .levels.`),this.levels}}}),Object.defineProperty(Mn.prototype,`useVertexTexture`,{get:function(){console.warn(`THREE.Skeleton: useVertexTexture has been removed.`)},set:function(){console.warn(`THREE.Skeleton: useVertexTexture has been removed.`)}}),jn.prototype.initBones=function(){console.error(`THREE.SkinnedMesh: initBones() has been removed.`)},Object.defineProperty(Y.prototype,`__arcLengthDivisions`,{get:function(){return console.warn(`THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.`),this.arcLengthDivisions},set:function(e){console.warn(`THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.`),this.arcLengthDivisions=e}}),ve.prototype.setLens=function(e,t){console.warn(`THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup.`),t!==void 0&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(ha.prototype,{onlyShadow:{set:function(){console.warn(`THREE.Light: .onlyShadow has been removed.`)}},shadowCameraFov:{set:function(e){console.warn(`THREE.Light: .shadowCameraFov is now .shadow.camera.fov.`),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn(`THREE.Light: .shadowCameraLeft is now .shadow.camera.left.`),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn(`THREE.Light: .shadowCameraRight is now .shadow.camera.right.`),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn(`THREE.Light: .shadowCameraTop is now .shadow.camera.top.`),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn(`THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.`),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn(`THREE.Light: .shadowCameraNear is now .shadow.camera.near.`),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn(`THREE.Light: .shadowCameraFar is now .shadow.camera.far.`),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn(`THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.`)}},shadowBias:{set:function(e){console.warn(`THREE.Light: .shadowBias is now .shadow.bias.`),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn(`THREE.Light: .shadowDarkness has been removed.`)}},shadowMapWidth:{set:function(e){console.warn(`THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.`),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn(`THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.`),this.shadow.mapSize.height=e}}}),Object.defineProperties(H.prototype,{length:{get:function(){return console.warn(`THREE.BufferAttribute: .length has been deprecated. Use .count instead.`),this.array.length}},dynamic:{get:function(){return console.warn(`THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.`),this.usage===dc},set:function(){console.warn(`THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.`),this.setUsage(dc)}}}),Object.assign(H.prototype,{setDynamic:function(e){return console.warn(`THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.`),this.setUsage(e===!0?dc:uc),this},copyIndicesArray:function(){console.error(`THREE.BufferAttribute: .copyIndicesArray() has been removed.`)},setArray:function(){console.error(`THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers`)}}),Object.assign(q.prototype,{addIndex:function(e){console.warn(`THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().`),this.setIndex(e)},addAttribute:function(e,t){return console.warn(`THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().`),!(t&&t.isBufferAttribute)&&!(t&&t.isInterleavedBufferAttribute)?(console.warn(`THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).`),this.setAttribute(e,new H(arguments[1],arguments[2]))):e===`index`?(console.warn(`THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.`),this.setIndex(t),this):this.setAttribute(e,t)},addDrawCall:function(e,t,n){n!==void 0&&console.warn(`THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.`),console.warn(`THREE.BufferGeometry: .addDrawCall() is now .addGroup().`),this.addGroup(e,t)},clearDrawCalls:function(){console.warn(`THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().`),this.clearGroups()},computeTangents:function(){console.warn(`THREE.BufferGeometry: .computeTangents() has been removed.`)},computeOffsets:function(){console.warn(`THREE.BufferGeometry: .computeOffsets() has been removed.`)},removeAttribute:function(e){return console.warn(`THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute().`),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn(`THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4().`),this.applyMatrix4(e)}}),Object.defineProperties(q.prototype,{drawcalls:{get:function(){return console.error(`THREE.BufferGeometry: .drawcalls has been renamed to .groups.`),this.groups}},offsets:{get:function(){return console.warn(`THREE.BufferGeometry: .offsets has been renamed to .groups.`),this.groups}}}),Object.defineProperties(Aa.prototype,{maxInstancedCount:{get:function(){return console.warn(`THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.`),this.instanceCount},set:function(e){console.warn(`THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.`),this.instanceCount=e}}}),Object.defineProperties(ro.prototype,{linePrecision:{get:function(){return console.warn(`THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.`),this.params.Line.threshold},set:function(e){console.warn(`THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.`),this.params.Line.threshold=e}}}),Object.defineProperties(Tn.prototype,{dynamic:{get:function(){return console.warn(`THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.`),this.usage===dc},set:function(e){console.warn(`THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.`),this.setUsage(e)}}}),Object.assign(Tn.prototype,{setDynamic:function(e){return console.warn(`THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead.`),this.setUsage(e===!0?dc:uc),this},setArray:function(){console.error(`THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers`)}}),Object.assign(Gr.prototype,{getArrays:function(){console.error(`THREE.ExtrudeBufferGeometry: .getArrays() has been removed.`)},addShapeList:function(){console.error(`THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.`)},addShape:function(){console.error(`THREE.ExtrudeBufferGeometry: .addShape() has been removed.`)}}),Object.defineProperties(to.prototype,{dynamic:{set:function(){console.warn(`THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.`)}},onUpdate:{value:function(){return console.warn(`THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.`),this}}}),Object.defineProperties(V.prototype,{wrapAround:{get:function(){console.warn(`THREE.Material: .wrapAround has been removed.`)},set:function(){console.warn(`THREE.Material: .wrapAround has been removed.`)}},overdraw:{get:function(){console.warn(`THREE.Material: .overdraw has been removed.`)},set:function(){console.warn(`THREE.Material: .overdraw has been removed.`)}},wrapRGB:{get:function(){return console.warn(`THREE.Material: .wrapRGB has been removed.`),new z}},shading:{get:function(){console.error(`THREE.`+this.type+`: .shading has been removed. Use the boolean .flatShading instead.`)},set:function(e){console.warn(`THREE.`+this.type+`: .shading has been removed. Use the boolean .flatShading instead.`),this.flatShading=e===1}},stencilMask:{get:function(){return console.warn(`THREE.`+this.type+`: .stencilMask has been removed. Use .stencilFuncMask instead.`),this.stencilFuncMask},set:function(e){console.warn(`THREE.`+this.type+`: .stencilMask has been removed. Use .stencilFuncMask instead.`),this.stencilFuncMask=e}}}),Object.defineProperties(hi.prototype,{metal:{get:function(){return console.warn(`THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.`),!1},set:function(){console.warn(`THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead`)}}}),Object.defineProperties(ge.prototype,{derivatives:{get:function(){return console.warn(`THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.`),this.extensions.derivatives},set:function(e){console.warn(`THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.`),this.extensions.derivatives=e}}}),Object.assign(Sn.prototype,{clearTarget:function(e,t,n,r){console.warn(`THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.`),this.setRenderTarget(e),this.clear(t,n,r)},animate:function(e){console.warn(`THREE.WebGLRenderer: .animate() is now .setAnimationLoop().`),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn(`THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().`),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn(`THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().`),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn(`THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.`),this.capabilities.precision},resetGLState:function(){return console.warn(`THREE.WebGLRenderer: .resetGLState() is now .state.reset().`),this.state.reset()},supportsFloatTextures:function(){return console.warn(`THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).`),this.extensions.get(`OES_texture_float`)},supportsHalfFloatTextures:function(){return console.warn(`THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).`),this.extensions.get(`OES_texture_half_float`)},supportsStandardDerivatives:function(){return console.warn(`THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).`),this.extensions.get(`OES_standard_derivatives`)},supportsCompressedTextureS3TC:function(){return console.warn(`THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).`),this.extensions.get(`WEBGL_compressed_texture_s3tc`)},supportsCompressedTexturePVRTC:function(){return console.warn(`THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).`),this.extensions.get(`WEBGL_compressed_texture_pvrtc`)},supportsBlendMinMax:function(){return console.warn(`THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).`),this.extensions.get(`EXT_blend_minmax`)},supportsVertexTextures:function(){return console.warn(`THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.`),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn(`THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).`),this.extensions.get(`ANGLE_instanced_arrays`)},enableScissorTest:function(e){console.warn(`THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().`),this.setScissorTest(e)},initMaterial:function(){console.warn(`THREE.WebGLRenderer: .initMaterial() has been removed.`)},addPrePlugin:function(){console.warn(`THREE.WebGLRenderer: .addPrePlugin() has been removed.`)},addPostPlugin:function(){console.warn(`THREE.WebGLRenderer: .addPostPlugin() has been removed.`)},updateShadowMap:function(){console.warn(`THREE.WebGLRenderer: .updateShadowMap() has been removed.`)},setFaceCulling:function(){console.warn(`THREE.WebGLRenderer: .setFaceCulling() has been removed.`)},allocTextureUnit:function(){console.warn(`THREE.WebGLRenderer: .allocTextureUnit() has been removed.`)},setTexture:function(){console.warn(`THREE.WebGLRenderer: .setTexture() has been removed.`)},setTexture2D:function(){console.warn(`THREE.WebGLRenderer: .setTexture2D() has been removed.`)},setTextureCube:function(){console.warn(`THREE.WebGLRenderer: .setTextureCube() has been removed.`)},getActiveMipMapLevel:function(){return console.warn(`THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().`),this.getActiveMipmapLevel()}}),Object.defineProperties(Sn.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn(`THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.`),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn(`THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.`),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.`)}},context:{get:function(){return console.warn(`THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.`),this.getContext()}},vr:{get:function(){return console.warn(`THREE.WebGLRenderer: .vr has been renamed to .xr`),this.xr}},gammaInput:{get:function(){return console.warn(`THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.`),!1},set:function(){console.warn(`THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.`)}},gammaOutput:{get:function(){return console.warn(`THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.`),!1},set:function(e){console.warn(`THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.`),this.outputEncoding=e===!0?ec:$s}}}),Object.defineProperties(pn.prototype,{cullFace:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.`)}},renderReverseSided:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.`)}},renderSingleSided:{get:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.`)},set:function(){console.warn(`THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.`)}}}),Object.defineProperties(w.prototype,{wrapS:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.`),this.texture.wrapS},set:function(e){console.warn(`THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.`),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.`),this.texture.wrapT},set:function(e){console.warn(`THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.`),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.`),this.texture.magFilter},set:function(e){console.warn(`THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.`),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.`),this.texture.minFilter},set:function(e){console.warn(`THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.`),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.`),this.texture.anisotropy},set:function(e){console.warn(`THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.`),this.texture.anisotropy=e}},offset:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .offset is now .texture.offset.`),this.texture.offset},set:function(e){console.warn(`THREE.WebGLRenderTarget: .offset is now .texture.offset.`),this.texture.offset=e}},repeat:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .repeat is now .texture.repeat.`),this.texture.repeat},set:function(e){console.warn(`THREE.WebGLRenderTarget: .repeat is now .texture.repeat.`),this.texture.repeat=e}},format:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .format is now .texture.format.`),this.texture.format},set:function(e){console.warn(`THREE.WebGLRenderTarget: .format is now .texture.format.`),this.texture.format=e}},type:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .type is now .texture.type.`),this.texture.type},set:function(e){console.warn(`THREE.WebGLRenderTarget: .type is now .texture.type.`),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn(`THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.`),this.texture.generateMipmaps},set:function(e){console.warn(`THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.`),this.texture.generateMipmaps=e}}}),Object.defineProperties(Ka.prototype,{load:{value:function(e){console.warn(`THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.`);var t=this;return new Ba().load(e,function(e){t.setBuffer(e)}),this}},startTime:{set:function(){console.warn(`THREE.Audio: .startTime is now .play( delay ).`)}}}),Ja.prototype.getData=function(){return console.warn(`THREE.AudioAnalyser: .getData() is now .getFrequencyData().`),this.getFrequencyData()},ye.prototype.updateCubeMap=function(e,t){return console.warn(`THREE.CubeCamera: .updateCubeMap() is now .update().`),this.update(e,t)},hc.crossOrigin=void 0,hc.loadTexture=function(e,t,n,r){console.warn(`THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.`);var i=new Wi;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},hc.loadTextureCube=function(e,t,n,r){console.warn(`THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.`);var i=new Ui;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},hc.loadCompressedTexture=function(){console.error(`THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.`)},hc.loadCompressedTextureCube=function(){console.error(`THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.`)},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`register`,{detail:{revision:`117`}}))})),kf=e((()=>{Of()}));Of(),kf();function $(e,t,n){return function(r,i,a){return((r+e-1)/e|0)*((i+t-1)/t|0)*n*a}}function Af(e,t,n){return function(r,i,a){return(Math.max(r,e)*Math.max(i,t)/n|0)*a}}new Map([[rs,$(4,4,8)],[is,$(4,4,8)],[as,$(4,4,16)],[os,$(4,4,16)],[ds,$(4,4,8)],[ss,Af(8,8,2)],[ls,Af(8,8,2)],[cs,Af(16,8,4)],[us,Af(16,8,4)],[fs,$(4,4,8)],[ps,$(4,4,16)],[ms,$(4,4,16)],[ks,$(4,4,16)],[hs,$(5,4,16)],[As,$(5,4,16)],[gs,$(5,5,16)],[js,$(5,5,16)],[_s,$(6,5,16)],[Ms,$(6,5,16)],[vs,$(6,6,16)],[Ns,$(6,6,16)],[ys,$(8,5,16)],[Ps,$(8,5,16)],[bs,$(8,6,16)],[Fs,$(8,6,16)],[xs,$(8,8,16)],[Is,$(8,8,16)],[Ss,$(10,5,16)],[Ls,$(10,5,16)],[Cs,$(10,6,16)],[Rs,$(10,6,16)],[ws,$(10,8,16)],[zs,$(10,8,16)],[Ts,$(10,10,16)],[Bs,$(10,10,16)],[Es,$(12,10,16)],[Vs,$(12,10,16)],[Ds,$(12,12,16)],[Hs,$(12,12,16)],[Os,$(4,4,16)]]),Of();let jf=new O().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]);new O().getInverse(jf);function Mf(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function Nf(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){Mf(a,r,i,o,s,`next`,e)}function s(e){Mf(a,r,i,o,s,`throw`,e)}o(void 0)})}}function Pf(){return Ff.apply(this,arguments)}function Ff(){return Ff=Nf(function*(e={}){var t,n=e,r=!1,i=!0,a=self.location.href;if(r||i){try{new URL(`.`,a).href}catch(e){}(function(){var e=Nf(function*(e){var t=yield fetch(e,{credentials:`same-origin`});if(t.ok)return t.arrayBuffer();throw Error(t.status+` : `+t.url)});return function(t){return e.apply(this,arguments)}})()}console.log.bind(console),console.error.bind(console);var o=!1;function s(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var c,l,u=!1;function d(){var e=M.buffer;new Int8Array(e),new Int16Array(e),n.HEAPU8=l=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function f(){if(n.preRun)for(typeof n.preRun==`function`&&(n.preRun=[n.preRun]);n.preRun.length;)T(n.preRun.shift());x(w)}function p(){u=!0,I.c()}function m(){if(n.postRun)for(typeof n.postRun==`function`&&(n.postRun=[n.postRun]);n.postRun.length;)C(n.postRun.shift());x(S)}var h;function g(){return s(`\\0asm\\0\\0\\0&\\`\\`}}\\`}\\`\\0\\`\\v\\0\\`\\0\\0\\x07aa\\0\\0\\b\\x07\\0\\0\\x07\\bA\\v\\x07b\\0c\\0\\x07d\\0e\\0f\\0\\f\n;\\x07T~@A\\b(\\0" \\0B\\x07|Bøÿÿÿ|"BÿÿÿÿX@ §"\\0?\\0AtM\\r \\0\\0\\r\\vA\\bA06\\0A\\vA\\b \\x006\\0 \\v\\0 \\0 Atr\\vr \\0¼"Aÿÿÿq!@ AvAÿq"E\\r\\0 Að\\0M@ ArAñ\\0 kv!\\f\\v AK@Aø!A\\0!\\f\\v A\ntA\\x07k!\\v AvAqr A\\rvr\\vß\\v\\b@ \\0E\\r\\0 \\0A\\bk" \\0Ak(\\0"Axq"\\0j!@ Aq\\r\\0 AqE\\r (\\0"k"A\\b(\\0I\\r \\0 j!\\0@@@A\\b(\\0 G@ (\\f! AÿM@ (\\b"G\\rA\\bA\\b(\\0A~ Avwq6\\0\\f\\v (!\\x07 G@ (\\b" 6\\f 6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v ("AqAG\\rA\\b \\x006\\0 A~q6 \\0Ar6 \\x006\\0\\v 6\\f 6\\b\\f\\vA\\0!\\v \\x07E\\r\\0@ ("At"(¸\n F@ A¸\nj 6\\0 \\rA\\bA\\b(\\0A~ wq6\\0\\f\\v@ \\x07(F@ \\x07 6\\f\\v \\x07 6\\v E\\r\\v \\x076 ("@ 6 6\\v ("E\\r\\0 6 6\\v O\\r\\0 ("AqE\\r\\0@@@@ AqE@A\\xA0\\b(\\0 F@A\\xA0\\b 6\\0A\\bA\\b(\\0 \\0j"\\x006\\0 \\0Ar6 A\\b(\\0G\\rA\\bA\\x006\\0A\\bA\\x006\\0\\vA\\b(\\0"\\x07 F@A\\b 6\\0A\\bA\\b(\\0 \\0j"\\x006\\0 \\0Ar6 \\0 j \\x006\\0\\v Axq \\0j!\\0 (\\f! AÿM@ (\\b" F@A\\bA\\b(\\0A~ Avwq6\\0\\f\\v 6\\f 6\\b\\f\\v (!\\b G@ (\\b" 6\\f 6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v A~q6 \\0Ar6 \\0 j \\x006\\0\\f\\vA\\0!\\v \\bE\\r\\0@ ("At"(¸\n F@ A¸\nj 6\\0 \\rA\\bA\\b(\\0A~ wq6\\0\\f\\v@ \\b(F@ \\b 6\\f\\v \\b 6\\v E\\r\\v \\b6 ("@ 6 6\\v ("E\\r\\0 6 6\\v \\0Ar6 \\0 j \\x006\\0 \\x07G\\r\\0A\\b \\x006\\0\\v \\0AÿM@ \\0AøqA°\\bj!A\\b(\\0"A \\0Avt"\\0qE@A\\b \\0 r6\\0 \\f\\v (\\b\\v!\\0 6\\b \\0 6\\f 6\\f \\x006\\b\\vA! \\0Aÿÿÿ\\x07M@ \\0A& \\0A\\bvg"kvAq AtrA>s!\\v 6 B\\x007 AtA¸\nj!@A\\b(\\0"A t"qE@A\\b r6\\0 6\\0A!A\\b\\f\\v \\0A AvkA\\0 AG\\x1Bt! (\\0!@ "(Axq \\0F\\r Av! At! Aqj"("\\r\\0\\v 6A! !A\\b\\v!\\0 "\\f\\v (\\b" 6\\f 6\\bA!\\0A\\b!A\\0\\v! j 6\\0 6\\f \\0 j 6\\0A¨\\bA¨\\b(\\0Ak"\\0A \\0\\x1B6\\0\\v\\v¸\'\\v#\\0Ak"\n$\\0@@@@@@@@@@ \\0AôM@A\\b(\\0"A \\0A\\vjAøq \\0A\\vI\\x1B"Av"\\0v"Aq@@ AsAq \\0j"At"A°\\bj"\\0 (¸\\b"(\\b"F@A\\b A~ wq6\\0\\f\\v \\x006\\f \\0 6\\b\\v A\\bj!\\0 Ar6 j" (Ar6\\f\\v\\v A\\b(\\0"\\bM\\r @@A \\0t"A\\0 kr \\0tqh"At"A°\\bj" (¸\\b"\\0(\\b"F@A\\b A~ wq"6\\0\\f\\v 6\\f 6\\b\\v \\0 Ar6 \\0 j"\\x07 k"Ar6 \\0 j 6\\0 \\b@ \\bAxqA°\\bj!A\\b(\\0! A \\bAvt"qE@A\\b r6\\0 \\f\\v (\\b\\v! 6\\b 6\\f 6\\f 6\\b\\v \\0A\\bj!\\0A\\b \\x076\\0A\\b 6\\0\\f\\v\\vA\\b(\\0"\\vE\\r \\vhAt(¸\n"(Axq k! !@@ ("\\0E@ ("\\0E\\r\\v \\0(Axq k" I"\\x1B! \\0 \\x1B! \\0!\\f\\v\\v (! (\\f"\\0G@ (\\b" \\x006\\f \\0 6\\b\\f\n\\v (" Aj ("E\\r Aj\\v!@ !\\x07 "\\0Aj! \\0("\\r\\0 \\0Aj! \\0("\\r\\0\\v \\x07A\\x006\\0\\f \\vA! \\0A¿K\\r\\0 \\0A\\vj"Axq!A\\b(\\0"\\x07E\\r\\0A!\\bA\\0 k! \\0Aôÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtkA>j!\\b\\v@@@ \\bAt(¸\n"E@A\\0!\\0\\f\\vA\\0!\\0 A \\bAvkA\\0 \\bAG\\x1Bt!@@ (Axq k" O\\r\\0 ! "\\r\\0A\\0! !\\0\\f\\v \\0 (" AvAqj("F\\x1B \\0 \\x1B!\\0 At! \\r\\0\\v\\v \\0 rE@A\\0!A \\bt"\\0A\\0 \\0kr \\x07q"\\0E\\r \\0hAt(¸\n!\\0\\v \\0E\\r\\v@ \\0(Axq k" I! \\x1B! \\0 \\x1B! \\0(" \\0(\\v"\\0\\r\\0\\v\\v E\\r\\0 A\\b(\\0 kO\\r\\0 (!\\b (\\f"\\0G@ (\\b" \\x006\\f \\0 6\\b\\f\\b\\v (" Aj ("E\\r Aj\\v!@ ! "\\0Aj! \\0("\\r\\0 \\0Aj! \\0("\\r\\0\\v A\\x006\\0\\f\\x07\\v A\\b(\\0"M@A\\b(\\0!\\0@ k"AO@ \\0 j" Ar6 \\0 j 6\\0 \\0 Ar6\\f\\v \\0 Ar6 \\0 j" (Ar6A\\0!A\\0!\\vA\\b 6\\0A\\b 6\\0 \\0A\\bj!\\0\\f \\v A\\b(\\0"I@A\\b k"6\\0A\\xA0\\bA\\xA0\\b(\\0"\\0 j"6\\0 Ar6 \\0 Ar6 \\0A\\bj!\\0\\f \\vA\\0!\\0 A/j"Aà\\v(\\0@Aè\\v(\\0\\f\\vAì\\vB7\\0Aä\\vB\\xA07\\0Aà\\v \nA\\fjApqAتժs6\\0Aô\\vA\\x006\\0AÄ\\vA\\x006\\0A \\v"j"A\\0 k"\\x07q" M\\r\\bAÀ\\v(\\0"@A¸\\v(\\0"\\b j" \\bM Ir\\r \\v@AÄ\\v-\\0\\0AqE@@@@@A\\xA0\\b(\\0"@AÈ\\v!\\0@ \\0(\\0"\\b M@ \\b \\0(jI\\r\\v \\0(\\b"\\0\\r\\0\\v\\vA\\0"AF\\r !Aä\\v(\\0"\\0Ak" q@ k jA\\0 \\0kqj!\\v M\\rAÀ\\v(\\0"\\0@A¸\\v(\\0" j"\\x07 M \\0 \\x07Ir\\r\\v "\\0 G\\r\\f\\v k \\x07q"" \\0(\\0 \\0(jF\\r !\\0\\v \\0AF\\r A0j M@ \\0!\\f\\vAè\\v(\\0" kjA\\0 kq"AF\\r j! \\0!\\f\\v AG\\r\\vAÄ\\vAÄ\\v(\\0Ar6\\0\\v "AFA\\0"\\0AFr \\0 Mr\\r \\0 k" A(jM\\r\\vA¸\\vA¸\\v(\\0 j"\\x006\\0A¼\\v(\\0 \\0I@A¼\\v \\x006\\0\\v@A\\xA0\\b(\\0"@AÈ\\v!\\0@ \\0(\\0" \\0("jF\\r \\0(\\b"\\0\\r\\0\\v\\f\\vA\\b(\\0"\\0A\\0 \\0 M\\x1BE@A\\b 6\\0\\vA\\0!\\0AÌ\\v 6\\0AÈ\\v 6\\0A¨\\bA6\\0A¬\\bAà\\v(\\x006\\0AÔ\\vA\\x006\\0@ \\0At" A°\\bj"6¸\\b 6¼\\b \\0Aj"\\0A G\\r\\0\\vA\\b A(k"\\0Ax kA\\x07q"k"6\\0A\\xA0\\b j"6\\0 Ar6 \\0 jA(6A¤\\bAð\\v(\\x006\\0\\f\\v M Kr\\r \\0(\\fA\\bq\\r \\0 j6A\\xA0\\b Ax kA\\x07q"\\0j"6\\0A\\bA\\b(\\0 j" \\0k"\\x006\\0 \\0Ar6 jA(6A¤\\bAð\\v(\\x006\\0\\f\\vA\\0!\\0\\f\\vA\\0!\\0\\f\\vA\\b(\\0 K@A\\b 6\\0\\v j!AÈ\\v!\\0@@ \\0(\\0"G@ \\0(\\b"\\0\\r\\f\\v\\v \\0-\\0\\fA\\bqE\\r\\vAÈ\\v!\\0@@ \\0(\\0" M@ \\0(j"I\\r\\v \\0(\\b!\\0\\f\\v\\vA\\b A(k"\\0Ax kA\\x07q"k"\\x076\\0A\\xA0\\b j"6\\0 \\x07Ar6 \\0 jA(6A¤\\bAð\\v(\\x006\\0 A\' kA\\x07qjA/k"\\0 \\0 AjI\\x1B"A\\x1B6 AÐ\\v)\\x007 AÈ\\v)\\x007\\bAÐ\\v A\\bj6\\0AÌ\\v 6\\0AÈ\\v 6\\0AÔ\\vA\\x006\\0 Aj!\\0@ \\0A\\x076 \\0A\\bj \\0Aj!\\0 I\\r\\0\\v F\\r\\0 (A~q6 k"Ar6 6\\0 AÿM@ AøqA°\\bj!\\0A\\b(\\0"A Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\fA\\f!A\\b\\f\\vA!\\0 Aÿÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtrA>s!\\0\\v \\x006 B\\x007 \\0AtA¸\nj!@@A\\b(\\0"A \\0t"qE@A\\b r6\\0 6\\0\\f\\v A \\0AvkA\\0 \\0AG\\x1Bt!\\0 (\\0!@ "(Axq F\\r \\0Av! \\0At!\\0 Aqj"("\\r\\0\\v 6\\v 6A\\b! "!\\0A\\f\\f\\v (\\b"\\0 6\\f 6\\b \\x006\\bA\\0!\\0A!A\\f\\v j 6\\0 j \\x006\\0\\vA\\b(\\0"\\0 M\\r\\0A\\b \\0 k"6\\0A\\xA0\\bA\\xA0\\b(\\0"\\0 j"6\\0 Ar6 \\0 Ar6 \\0A\\bj!\\0\\f\\vA\\bA06\\0A\\0!\\0\\f\\v \\0 6\\0 \\0 \\0( j6 Ax kA\\x07qj"\\b Ar6 Ax kA\\x07qj" \\bj"k!\\x07@A\\xA0\\b(\\0 F@A\\xA0\\b 6\\0A\\bA\\b(\\0 \\x07j"\\x006\\0 \\0Ar6\\f\\vA\\b(\\0 F@A\\b 6\\0A\\bA\\b(\\0 \\x07j"\\x006\\0 \\0Ar6 \\0 j \\x006\\0\\f\\v ("\\0AqAF@ \\0Axq! (\\f!@ \\0AÿM@ (\\b" F@A\\bA\\b(\\0A~ \\0Avwq6\\0\\f\\v 6\\f 6\\b\\f\\v (!@ G@ (\\b"\\0 6\\f \\x006\\b\\f\\v@ ("\\0 Aj ("\\0E\\r Aj\\v!@ ! \\0"Aj! \\0("\\0\\r\\0 Aj! ("\\0\\r\\0\\v A\\x006\\0\\f\\vA\\0!\\v E\\r\\0@ ("\\0At"(¸\n F@ A¸\nj 6\\0 \\rA\\bA\\b(\\0A~ \\0wq6\\0\\f\\v@ (F@ 6\\f\\v 6\\v E\\r\\v 6 ("\\0@ \\x006 \\0 6\\v ("\\0E\\r\\0 \\x006 \\0 6\\v \\x07 j!\\x07 j"(!\\0\\v \\0A~q6 \\x07Ar6 \\x07j \\x076\\0 \\x07AÿM@ \\x07AøqA°\\bj!\\0A\\b(\\0"A \\x07Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\f\\vA! \\x07Aÿÿÿ\\x07M@ \\x07A& \\x07A\\bvg"\\0kvAq \\0AtrA>s!\\v 6 B\\x007 AtA¸\nj!\\0@@A\\b(\\0"A t"qE@A\\b r6\\0 \\0 6\\0\\f\\v \\x07A AvkA\\0 AG\\x1Bt! \\0(\\0!@ "\\0(Axq \\x07F\\r Av! At! \\0 Aqj"("\\r\\0\\v 6\\v \\x006 6\\f 6\\b\\f\\v \\0(\\b" 6\\f \\0 6\\b A\\x006 \\x006\\f 6\\b\\v \\bA\\bj!\\0\\f\\v@ \\bE\\r\\0@ ("At"(¸\n F@ A¸\nj \\x006\\0 \\0\\rA\\b \\x07A~ wq"\\x076\\0\\f\\v@ \\b(F@ \\b \\x006\\f\\v \\b \\x006\\v \\0E\\r\\v \\0 \\b6 ("@ \\0 6 \\x006\\v ("E\\r\\0 \\0 6 \\x006\\v@ AM@ j"\\0Ar6 \\0 j"\\0 \\0(Ar6\\f\\v Ar6 j" Ar6 j 6\\0 AÿM@ AøqA°\\bj!\\0A\\b(\\0"A Avt"qE@A\\b r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\f\\vA!\\0 Aÿÿÿ\\x07M@ A& A\\bvg"\\0kvAq \\0AtrA>s!\\0\\v \\x006 B\\x007 \\0AtA¸\nj!@@ \\x07A \\0t"qE@A\\b \\x07r6\\0 6\\0 6\\f\\v A \\0AvkA\\0 \\0AG\\x1Bt!\\0 (\\0!@ "(Axq F\\r \\0Av! \\0At!\\0 Aqj"\\x07("\\r\\0\\v \\x07 6 6\\v 6\\f 6\\b\\f\\v (\\b"\\0 6\\f 6\\b A\\x006 6\\f \\x006\\b\\v A\\bj!\\0\\f\\v@ E\\r\\0@ ("At"(¸\n F@ A¸\nj \\x006\\0 \\0\\rA\\b \\vA~ wq6\\0\\f\\v@ (F@ \\x006\\f\\v \\x006\\v \\0E\\r\\v \\0 6 ("@ \\0 6 \\x006\\v ("E\\r\\0 \\0 6 \\x006\\v@ AM@ j"\\0Ar6 \\0 j"\\0 \\0(Ar6\\f\\v Ar6 j" Ar6 j 6\\0 \\b@ \\bAxqA°\\bj!\\0A\\b(\\0!A \\bAvt"\\x07 qE@A\\b \\x07r6\\0 \\0\\f\\v \\0(\\b\\v! \\0 6\\b 6\\f \\x006\\f 6\\b\\vA\\b 6\\0A\\b 6\\0\\v A\\bj!\\0\\v \nAj$\\0 \\0\\v}\\vA\\0!\\0@ \\0 FE@ \\0A\\fl"Aj"j*\\0!\\f A\\bj"j*\\0!\\v \\bj j*\\0"\\r8\\0 \\b j \\v8\\0 \\b j \\f8\\0 \\0At"j j"#*\\x008\\0 \\0At"Ar"$At" j j" *\\x008\\0 Ar"%At"!j !j"!*\\x008\\0 Ar"&At""j "j""*\\x008\\0 \nj j"\'*\\x008\\0 \n j j"*\\x008\\0 \n j j*\\0"8\\0 \\x07 \\0Atj" \\v8\\b \\f8 \\r8\\0 j-\\0\\0 $j-\\0\\0A\\btr %j-\\0\\0Atr &j-\\0\\0Atr6\\f *\\0! \'*\\0! "*\\0"\\f \\f !*\\0"\\v \\v #*\\0" *\\0"\\r \\r"C\\0\\0\\0\\0^@ \\f "!\\f \\r !\\r ! \\v !\\v\\v \\r \\f" \\v "" " C\\0\\0? \\v \\v" \\f \\f"" " \\r \\v" \\f "" " C\\0\\0@ \\v \\f"\\x1B \\r ""\\f \\f"\\f "\\v \\v"\\v C\\0\\0? \\r \\r" "\\r \\r"\\r C\\0\\0@6 C\\0\\0? " " " " \\x1B " "C\\0\\0@ \\f \\f \\v \\v \\r \\rC\\0\\0@6 A\\x006 \\f \\v \\r C\\0\\0@ C\\0\\0@6 \\0Aj!\\0\\f\\v\\v\\v\\0\\v\\v \\0A\\b\\v`)}function _(e){return e}function v(e,t){var n,r=_(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function y(){return{a:P}}function b(){function e(e,t){return I=e.exports,N(I),d(),I}var t=y();return n.instantiateWasm?new Promise((r,i)=>{n.instantiateWasm(t,(t,n)=>{r(e(t,n))})}):(h!=null||(h=g()),e(v(h,t)[0]))}for(var x=e=>{for(;e.length>0;)e.shift()(n)},S=[],C=e=>S.push(e),w=[],T=e=>w.push(e),E=()=>2147483648,D=(e,t)=>Math.ceil(e/t)*t,O=e=>{var t=(e-M.buffer.byteLength+65535)/65536|0;try{return M.grow(t),d(),1}catch(e){}},k=e=>{var t=l.length;e>>>=0;var n=E();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),O(Math.min(n,D(Math.max(e,i),65536))))return!0}return!1},A=new Uint8Array(123),j=25;j>=0;--j)A[48+j]=52+j,A[65+j]=j,A[97+j]=26+j;if(A[43]=62,A[47]=63,n.noExitRuntime&&n.noExitRuntime,n.print&&n.print,n.printErr&&n.printErr,n.wasmBinary&&n.wasmBinary,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.preInit)for(typeof n.preInit==`function`&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()();var M;function N(e){n._pack=e.d,n._malloc=e.e,n._free=e.f,M=e.b,e.__indirect_function_table}var P={a:k};function F(){f();function e(){var e;n.calledRun=!0,!o&&(p(),c==null||c(n),(e=n.onRuntimeInitialized)==null||e.call(n),m())}n.setStatus?(n.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>n.setStatus(``),1),e()},1)):e()}var I=b();return F(),t=u?n:new Promise((e,t)=>{c=e}),t}),Ff.apply(this,arguments)}let If=new Float32Array(1),Lf=new Uint32Array(If.buffer),Rf=typeof Float16Array<`u`,zf=Rf?new Float16Array(1):null,Bf=Rf?new Uint16Array(zf.buffer):new Uint16Array(1);function Vf(e){if(Rf&&zf)return Bf[0]=e,zf[0];let t=e>>15&1,n=e>>10&31,r=e&1023,i;if(n===0)if(r===0)i=t<<31;else{let e=r,n=-14;for(;!(e&1024);)e<<=1,n--;e&=1023;let a=n+127,o=e<<13;i=t<<31|a<<23|o}else if(n===31)i=r===0?t<<31|2139095040:t<<31|2143289344;else{let e=n-15+127,a=r<<13;i=t<<31|e<<23|a}return Lf[0]=i,If[0]}var Hf=class{constructor({fileBytes:e}){this.fileBytes=e,this.chunks=[],this.totalBytes=0;let t=new DecompressionStream(`gzip`),n=new Blob([e]).stream().pipeThrough(t);this.reader=n.getReader()}read(e){return t(this,void 0,void 0,function*(){for(;this.totalBytes<e;){let{value:e,done:t}=yield this.reader.read();if(t)break;this.chunks.push(e),this.totalBytes+=e.length}if(this.totalBytes<e)throw Error(`Unexpected EOF: needed ${e}, got ${this.totalBytes}`);let t=new Uint8Array(this.totalBytes),n=0;for(let e of this.chunks)t.set(e,n),n+=e.length;let r=t.subarray(0,e);return this.chunks=[t.subarray(e)],this.totalBytes-=e,r})}},Uf=class{constructor({fileBytes:e}){this.version=-1,this.numSplats=0,this.shDegree=0,this.fractionalBits=0,this.flags=0,this.flagAntiAlias=!1,this.reserved=0,this.headerParsed=!1,this.parsed=!1,this.fileBytes=e instanceof ArrayBuffer?new Uint8Array(e):e,this.reader=new Hf({fileBytes:this.fileBytes})}parseHeader(){return t(this,void 0,void 0,function*(){if(this.headerParsed)throw Error(`SPZ file header already parsed`);let e=new DataView((yield this.reader.read(16)).buffer);if(e.getUint32(0,!0)!==1347635022)throw Error(`Invalid SPZ file`);if(this.version=e.getUint32(4,!0),this.version<1||this.version>3)throw Error(`Unsupported SPZ version: ${this.version}`);this.numSplats=e.getUint32(8,!0),this.shDegree=e.getUint8(12),this.fractionalBits=e.getUint8(13),this.flags=e.getUint8(14),this.flagAntiAlias=(this.flags&1)!=0,this.reserved=e.getUint8(15),this.headerParsed=!0,this.parsed=!1})}parseSplats(e,n,r,i,a,o){return t(this,void 0,void 0,function*(){if(!this.headerParsed)throw Error(`SPZ file header must be parsed first`);if(this.parsed)throw Error(`SPZ file already parsed`);if(this.parsed=!0,this.version===1){let t=yield this.reader.read(this.numSplats*3*2),n=new Uint16Array(t.buffer);for(let t=0;t<this.numSplats;t++){let r=t*3;e==null||e(t,Vf(n[r]),Vf(n[r+1]),Vf(n[r+2]))}}else if(this.version===2||this.version===3){let t=1<<this.fractionalBits,n=yield this.reader.read(this.numSplats*3*3);for(let r=0;r<this.numSplats;r++){let i=r*9,a=((n[i+2]<<24|n[i+1]<<16|n[i]<<8)>>8)/t,o=((n[i+5]<<24|n[i+4]<<16|n[i+3]<<8)>>8)/t,s=((n[i+8]<<24|n[i+7]<<16|n[i+6]<<8)>>8)/t;e==null||e(r,a,o,s)}}{let e=yield this.reader.read(this.numSplats);for(let t=0;t<this.numSplats;t++)n==null||n(t,e[t]/255)}{let e=yield this.reader.read(this.numSplats*3),t=.28209479177387814/.15;for(let n=0;n<this.numSplats;n++){let i=n*3;r==null||r(n,(e[i]/255-.5)*t+.5,(e[i+1]/255-.5)*t+.5,(e[i+2]/255-.5)*t+.5)}}{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3;i==null||i(t,Math.exp(e[n]/16-10),Math.exp(e[n+1]/16-10),Math.exp(e[n+2]/16-10))}}if(this.version===3){let e=1/Math.sqrt(2),t=yield this.reader.read(this.numSplats*4);for(let n=0;n<this.numSplats;n++){let r=n*4,i=[0,0,0,0],o=[t[r],t[r+1],t[r+2],t[r+3]],s=o[0]+(o[1]<<8)+(o[2]<<16)+(o[3]<<24),c=s>>>30,l=s,u=0;for(let t=3;t>=0;--t)if(t!==c){let n=l&511,r=l>>>9&1;l>>>=10,i[t]=n/511*e,i[t]=r===0?i[t]:-i[t],u+=i[t]*i[t]}i[c]=Math.sqrt(Math.max(1-u,0)),a==null||a(n,i[0],i[1],i[2],i[3])}}else{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3,r=e[n]/127.5-1,i=e[n+1]/127.5-1,o=e[n+2]/127.5-1,s=Math.sqrt(Math.max(0,1-r*r-i*i-o*o));a==null||a(t,r,i,o,s)}}if(o&&this.shDegree>=1){let e={1:3,2:8,3:15}[this.shDegree]||0,t=yield this.reader.read(this.numSplats*e*3),n=new Float32Array(9),r=this.shDegree>=2?new Float32Array(15):void 0,i=this.shDegree>=3?new Float32Array(21):void 0,a=0;for(let e=0;e<this.numSplats;e++){for(let e=0;e<9;++e)n[e]=(t[a+e]-128)/128;if(a+=9,r){for(let e=0;e<15;++e)r[e]=(t[a+e]-128)/128;a+=15}if(i){for(let e=0;e<21;++e)i[e]=(t[a+e]-128)/128;a+=21}o==null||o(e,new Float32Array(n),r?new Float32Array(r):void 0,i?new Float32Array(i):void 0)}}})}};function Wf(e){return t(this,void 0,void 0,function*(){let t=new Uf({fileBytes:e});yield t.parseHeader();let n=t.numSplats,r=new Float32Array(n*3),i=new Uint8Array(n*4),a=new Float32Array(n*3),o=new Float32Array(n*4),s,c,l;return t.shDegree>=1&&(s=new Float32Array(n*9)),t.shDegree>=2&&(c=new Float32Array(n*15)),t.shDegree>=3&&(l=new Float32Array(n*21)),yield t.parseSplats((e,t,n,i)=>{r[e*3]=t,r[e*3+1]=n,r[e*3+2]=i},(e,t)=>{i[e*4+3]=Math.round(t*255)},(e,t,n,r)=>{i[e*4]=Math.round(Math.max(0,Math.min(1,t))*255),i[e*4+1]=Math.round(Math.max(0,Math.min(1,n))*255),i[e*4+2]=Math.round(Math.max(0,Math.min(1,r))*255)},(e,t,n,r)=>{a[e*3]=t,a[e*3+1]=n,a[e*3+2]=r},(e,t,n,r,i)=>{o[e*4]=i,o[e*4+1]=t,o[e*4+2]=n,o[e*4+3]=r},(e,t,n,r)=>{s&&t&&s.set(t,e*9),c&&n&&c.set(n,e*15),l&&r&&l.set(r,e*21)}),{numPoints:n,shDegree:t.shDegree,flagAntiAlias:t.flagAntiAlias,positions:r,colors:i,scales:a,rotations:o,sh1:s,sh2:c,sh3:l}})}let Gf,Kf=!1;function qf(){return t(this,void 0,void 0,function*(){if(!Gf){for(;Kf;)yield new Promise(e=>setTimeout(e,0));Gf||(Kf=!0,Gf=yield Pf(),Kf=!1)}})}let Jf=0,Yf=0,Xf=0,Zf=0,Qf=0,$f=0,ep=0,tp=0,np=0,rp=0;function ip(e){let t=Math.pow(2,Math.ceil(Math.log2(Math.max(1,e))));t<=Jf||(Jf>0&&(Gf._free(Yf),Gf._free(Xf),Gf._free(Zf),Gf._free(Qf),Gf._free($f),Gf._free(ep),Gf._free(tp),Gf._free(np),Gf._free(rp)),Jf=t,Yf=Gf._malloc(3*t*4),Xf=Gf._malloc(4*t*4),Zf=Gf._malloc(3*t*4),Qf=Gf._malloc(4*t),$f=Gf._malloc(t),ep=Gf._malloc(8*t*4),tp=Gf._malloc(3*t*4),np=Gf._malloc(4*t*4),rp=Gf._malloc(3*t*4))}function ap(e,t,n,r,i){ip(e);let a=new Uint8Array(e);Gf.HEAPF32.set(t,Yf/4),Gf.HEAPF32.set(n,Xf/4),Gf.HEAPF32.set(r,Zf/4),Gf.HEAPU8.set(i,Qf),Gf.HEAPU8.set(a,$f),Gf._pack(!1,e,Yf,Xf,Zf,Qf,$f,ep,tp,np,rp);let o=new Uint32Array(Gf.HEAPU32.buffer,ep,e*8);return new Uint32Array(o.slice().buffer)}typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope&&(self.onmessage=e=>t(void 0,void 0,void 0,function*(){var t;let{requestId:n,fileBytes:r}=e.data;if(!(r===void 0||n===void 0))try{let e=yield Wf(new Uint8Array(r));yield qf();let t=ap(e.numPoints,e.positions,e.rotations,e.scales,e.colors),i=Object.assign(Object.assign({},e),{packedData:t}),a=[t.buffer,e.positions.buffer,e.colors.buffer,e.scales.buffer,e.rotations.buffer];e.sh1&&a.push(e.sh1.buffer),e.sh2&&a.push(e.sh2.buffer),e.sh3&&a.push(e.sh3.buffer),self.postMessage({requestId:n,decoded:i},a)}catch(e){self.postMessage({requestId:n,error:(t=e==null?void 0:e.message)==null?String(e):t})}}))})();',is=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,rs],{type:`text/javascript;charset=utf-8`});function as(e){let t;try{if(t=is&&(self.URL||self.webkitURL).createObjectURL(is),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(rs),{name:e==null?void 0:e.name})}}var os=new Float32Array(1),ss=new Uint32Array(os.buffer),cs=typeof Float16Array<`u`,ls=cs?new Float16Array(1):null,us=cs?new Uint16Array(ls.buffer):new Uint16Array(1);function ds(e){if(cs&&ls)return us[0]=e,ls[0];let t=e>>15&1,n=e>>10&31,r=e&1023,i;if(n===0)if(r===0)i=t<<31;else{let e=r,n=-14;for(;!(e&1024);)e<<=1,n--;e&=1023;let a=n+127,o=e<<13;i=t<<31|a<<23|o}else if(n===31)i=r===0?t<<31|2139095040:t<<31|2143289344;else{let e=n-15+127,a=r<<13;i=t<<31|e<<23|a}return ss[0]=i,os[0]}var fs=class{constructor({fileBytes:e}){this.fileBytes=e,this.chunks=[],this.totalBytes=0;let t=new DecompressionStream(`gzip`),n=new Blob([e]).stream().pipeThrough(t);this.reader=n.getReader()}read(e){return Xo(this,void 0,void 0,function*(){for(;this.totalBytes<e;){let{value:e,done:t}=yield this.reader.read();if(t)break;this.chunks.push(e),this.totalBytes+=e.length}if(this.totalBytes<e)throw Error(`Unexpected EOF: needed ${e}, got ${this.totalBytes}`);let t=new Uint8Array(this.totalBytes),n=0;for(let e of this.chunks)t.set(e,n),n+=e.length;let r=t.subarray(0,e);return this.chunks=[t.subarray(e)],this.totalBytes-=e,r})}},ps=.28209479177387814,ms=class{constructor({fileBytes:e}){this.version=-1,this.numSplats=0,this.shDegree=0,this.fractionalBits=0,this.flags=0,this.flagAntiAlias=!1,this.reserved=0,this.headerParsed=!1,this.parsed=!1,this.fileBytes=e instanceof ArrayBuffer?new Uint8Array(e):e,this.reader=new fs({fileBytes:this.fileBytes})}parseHeader(){return Xo(this,void 0,void 0,function*(){if(this.headerParsed)throw Error(`SPZ file header already parsed`);let e=new DataView((yield this.reader.read(16)).buffer);if(e.getUint32(0,!0)!==1347635022)throw Error(`Invalid SPZ file`);if(this.version=e.getUint32(4,!0),this.version<1||this.version>3)throw Error(`Unsupported SPZ version: ${this.version}`);this.numSplats=e.getUint32(8,!0),this.shDegree=e.getUint8(12),this.fractionalBits=e.getUint8(13),this.flags=e.getUint8(14),this.flagAntiAlias=(this.flags&1)!=0,this.reserved=e.getUint8(15),this.headerParsed=!0,this.parsed=!1})}parseSplats(e,t,n,r,i,a){return Xo(this,void 0,void 0,function*(){if(!this.headerParsed)throw Error(`SPZ file header must be parsed first`);if(this.parsed)throw Error(`SPZ file already parsed`);if(this.parsed=!0,this.version===1){let t=yield this.reader.read(this.numSplats*3*2),n=new Uint16Array(t.buffer);for(let t=0;t<this.numSplats;t++){let r=t*3;e==null||e(t,ds(n[r]),ds(n[r+1]),ds(n[r+2]))}}else if(this.version===2||this.version===3){let t=1<<this.fractionalBits,n=yield this.reader.read(this.numSplats*3*3);for(let r=0;r<this.numSplats;r++){let i=r*9,a=((n[i+2]<<24|n[i+1]<<16|n[i]<<8)>>8)/t,o=((n[i+5]<<24|n[i+4]<<16|n[i+3]<<8)>>8)/t,s=((n[i+8]<<24|n[i+7]<<16|n[i+6]<<8)>>8)/t;e==null||e(r,a,o,s)}}{let e=yield this.reader.read(this.numSplats);for(let n=0;n<this.numSplats;n++)t==null||t(n,e[n]/255)}{let e=yield this.reader.read(this.numSplats*3),t=ps/.15;for(let r=0;r<this.numSplats;r++){let i=r*3;n==null||n(r,(e[i]/255-.5)*t+.5,(e[i+1]/255-.5)*t+.5,(e[i+2]/255-.5)*t+.5)}}{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3;r==null||r(t,Math.exp(e[n]/16-10),Math.exp(e[n+1]/16-10),Math.exp(e[n+2]/16-10))}}if(this.version===3){let e=1/Math.sqrt(2),t=yield this.reader.read(this.numSplats*4);for(let n=0;n<this.numSplats;n++){let r=n*4,a=[0,0,0,0],o=[t[r],t[r+1],t[r+2],t[r+3]],s=o[0]+(o[1]<<8)+(o[2]<<16)+(o[3]<<24),c=s>>>30,l=s,u=0;for(let t=3;t>=0;--t)if(t!==c){let n=l&511,r=l>>>9&1;l>>>=10,a[t]=n/511*e,a[t]=r===0?a[t]:-a[t],u+=a[t]*a[t]}a[c]=Math.sqrt(Math.max(1-u,0)),i==null||i(n,a[0],a[1],a[2],a[3])}}else{let e=yield this.reader.read(this.numSplats*3);for(let t=0;t<this.numSplats;t++){let n=t*3,r=e[n]/127.5-1,a=e[n+1]/127.5-1,o=e[n+2]/127.5-1,s=Math.sqrt(Math.max(0,1-r*r-a*a-o*o));i==null||i(t,r,a,o,s)}}if(a&&this.shDegree>=1){let e={1:3,2:8,3:15}[this.shDegree]||0,t=yield this.reader.read(this.numSplats*e*3),n=new Float32Array(9),r=this.shDegree>=2?new Float32Array(15):void 0,i=this.shDegree>=3?new Float32Array(21):void 0,o=0;for(let e=0;e<this.numSplats;e++){for(let e=0;e<9;++e)n[e]=(t[o+e]-128)/128;if(o+=9,r){for(let e=0;e<15;++e)r[e]=(t[o+e]-128)/128;o+=15}if(i){for(let e=0;e<21;++e)i[e]=(t[o+e]-128)/128;o+=21}a==null||a(e,new Float32Array(n),r?new Float32Array(r):void 0,i?new Float32Array(i):void 0)}}})}};function hs(e){return Xo(this,void 0,void 0,function*(){let t=new ms({fileBytes:e});yield t.parseHeader();let n=t.numSplats,r=new Float32Array(n*3),i=new Uint8Array(n*4),a=new Float32Array(n*3),o=new Float32Array(n*4),s,c,l;return t.shDegree>=1&&(s=new Float32Array(n*9)),t.shDegree>=2&&(c=new Float32Array(n*15)),t.shDegree>=3&&(l=new Float32Array(n*21)),yield t.parseSplats((e,t,n,i)=>{r[e*3]=t,r[e*3+1]=n,r[e*3+2]=i},(e,t)=>{i[e*4+3]=Math.round(t*255)},(e,t,n,r)=>{i[e*4]=Math.round(Math.max(0,Math.min(1,t))*255),i[e*4+1]=Math.round(Math.max(0,Math.min(1,n))*255),i[e*4+2]=Math.round(Math.max(0,Math.min(1,r))*255)},(e,t,n,r)=>{a[e*3]=t,a[e*3+1]=n,a[e*3+2]=r},(e,t,n,r,i)=>{o[e*4]=i,o[e*4+1]=t,o[e*4+2]=n,o[e*4+3]=r},(e,t,n,r)=>{s&&t&&s.set(t,e*9),c&&n&&c.set(n,e*15),l&&r&&l.set(r,e*21)}),{numPoints:n,shDegree:t.shDegree,flagAntiAlias:t.flagAntiAlias,positions:r,colors:i,scales:a,rotations:o,sh1:s,sh2:c,sh3:l}})}var J,gs=!1;function _s(){return Xo(this,void 0,void 0,function*(){if(!J){for(;gs;)yield new Promise(e=>setTimeout(e,0));J||(gs=!0,J=yield ts(),gs=!1)}})}var vs=0,ys=0,bs=0,xs=0,Ss=0,Cs=0,ws=0,Ts=0,Es=0,Ds=0;function Os(e){let t=Math.pow(2,Math.ceil(Math.log2(Math.max(1,e))));t<=vs||(vs>0&&(J._free(ys),J._free(bs),J._free(xs),J._free(Ss),J._free(Cs),J._free(ws),J._free(Ts),J._free(Es),J._free(Ds)),vs=t,ys=J._malloc(3*t*4),bs=J._malloc(4*t*4),xs=J._malloc(3*t*4),Ss=J._malloc(4*t),Cs=J._malloc(t),ws=J._malloc(8*t*4),Ts=J._malloc(3*t*4),Es=J._malloc(4*t*4),Ds=J._malloc(3*t*4))}function ks(e,t,n,r,i){Os(e);let a=new Uint8Array(e);J.HEAPF32.set(t,ys/4),J.HEAPF32.set(n,bs/4),J.HEAPF32.set(r,xs/4),J.HEAPU8.set(i,Ss),J.HEAPU8.set(a,Cs),J._pack(!1,e,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds);let o=new Uint32Array(J.HEAPU32.buffer,ws,e*8);return new Uint32Array(o.slice().buffer)}typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope&&(self.onmessage=e=>Xo(void 0,void 0,void 0,function*(){var t;let{requestId:n,fileBytes:r}=e.data;if(!(r===void 0||n===void 0))try{let e=yield hs(new Uint8Array(r));yield _s();let t=ks(e.numPoints,e.positions,e.rotations,e.scales,e.colors),i=Object.assign(Object.assign({},e),{packedData:t}),a=[t.buffer,e.positions.buffer,e.colors.buffer,e.scales.buffer,e.rotations.buffer];e.sh1&&a.push(e.sh1.buffer),e.sh2&&a.push(e.sh2.buffer),e.sh3&&a.push(e.sh3.buffer),self.postMessage({requestId:n,decoded:i},a)}catch(e){self.postMessage({requestId:n,error:(t=e==null?void 0:e.message)==null?String(e):t})}}));var As=null,js=1,Ms=new Map;function Ns(){return As||(As=new as,As.onmessage=e=>{var t;let{requestId:n,decoded:r,error:i}=(t=e.data)==null?{}:t,a=Ms.get(n);a&&(Ms.delete(n),i?a.reject(Error(i)):a.resolve(r))}),As}function Ps(e){let t=Ns(),n=js++,r=e.slice().buffer;return new Promise((e,i)=>{Ms.set(n,{resolve:e,reject:i}),t.postMessage({requestId:n,fileBytes:r},[r])})}function Fs(e){return Xo(this,void 0,void 0,function*(){let t=yield Ps(e instanceof ArrayBuffer?new Uint8Array(e):e),{PBMGaussianSplattingObject:n}=yield Promise.resolve().then(()=>require(`../pbmGaussianSplattingObject-BDOzNal0.cjs`)).then(e=>e.n);return new n({numPoints:t.numPoints,packedData:t.packedData,sh1:t.sh1,sh2:t.sh2,sh3:t.sh3,shDegree:t.shDegree,antiAliased:t.flagAntiAlias})})}function Is(e,t={}){var n,r,i,a;let o=(n=t.modelUpAxis)==null?`Y`:n,s=(r=t.upAxis)==null?`Z`:r,c=(i=t.fetcher)==null?ur:i,l=(a=t.onDownloadProgress)==null?G:a,u=0;return Promise.resolve().then(()=>c.ajax(e,{responseType:`arraybuffer`},void 0,void 0,l)).then(e=>(u=e.body.byteLength,e.body)).then(e=>Fs(new Uint8Array(e))).then(t=>(o===`Z`&&(t.applyMatrix4(Jn),t.updateMatrix(),t.updateMatrixWorld(!0),t.transformChanged=!0),{type:`spz`,modelUpAxis:o,upAxis:s,uri:e,byteLength:u,memoryUsage:Di(t),scene:t,textures:[],animations:[],dispose:()=>t.dispose()}))}var Ls=new t.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),Rs=new t.Matrix4().getInverse(Ls),zs=class extends no{load(e,t){return Xo(this,void 0,void 0,function*(){let{bufferView:n}=e;return t.loadBufferView(n).then(e=>this.loadSpz(new Uint8Array(e)))})}loadSpz(e){return Xo(this,void 0,void 0,function*(){return Promise.resolve().then(()=>Fs(e)).then(e=>(e.applyMatrix4(Rs),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}},Bs=new t.Matrix4().fromArray([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),Vs=new t.Matrix4().getInverse(Bs),Hs={KHR_binary_glTF:io,KHR_draco_mesh_compression:fo,KHR_texture_basisu:Co,KHR_texture_transform:To,KHR_mesh_quantization:Eo,KHR_materials_unlit:Oo,KHR_node_visibility:Ao,KHR_animation_pointer:jo,KHR_materials_clearcoat:No,KHR_materials_sheen:Fo,KHR_materials_transmission:Lo,KHR_materials_emissive_strength:zo,EXT_meshopt_compression:Ho,EXT_texture_webp:Wo,CESIUM_RTC:Ko,REALSEE_materials_lightmap:Jo,KHR_gaussian_splatting:Qo,KHR_gaussian_splatting_compression_spz:zs,KHR_gaussian_splatting_compression_spz_2:class extends no{constructor(){super()}load(e,t){return Xo(this,void 0,void 0,function*(){let{bufferView:n}=e;return t.loadBufferView(n).then(e=>this.loadSpz(new Uint8Array(e)))})}loadSpz(e){return Xo(this,void 0,void 0,function*(){return Promise.resolve().then(()=>Fs(e)).then(e=>(e.applyMatrix4(Vs),e.updateMatrix(),e.updateMatrixWorld(!0),e.transformChanged=!0,e))})}}};function Us(e,t){var n,r,i;let a={},o,s;if(typeof e==`string`)s=e;else if(Hs.KHR_binary_glTF.getMagic(e)===Hs.KHR_binary_glTF.HEADER_MAGIC){o=new Hs.KHR_binary_glTF;try{o.loadGlbBinary(e)}catch(e){return Promise.reject(e)}a.KHR_binary_glTF=o,s=o.content}else s=za(new Uint8Array(e));let c=JSON.parse(s);if(t.jsonModify&&(c=t.jsonModify(c)),c.asset===void 0||Number(c.asset.version[0])<2)return Promise.reject(Error(`glTF: Unsupported asset. glTF versions >=2.0 are supported.`));if(c.extensionsUsed){let e=c.extensionsRequired||[];for(var l=0;l<c.extensionsUsed.length;l++){let t=c.extensionsUsed[l];a[t]||(Hs[t]?a[t]=new Hs[t]:e.indexOf(t)>=0&&console.warn(`glTF: Unknown extension "`+t+`".`))}}return new Za(c,a,{copyUV2:(n=t.copyUV2)==null?!1:n,resourcePath:(r=t.resourcePath)==null?``:r,search:(i=t.search)==null?``:i,fetcher:t.fetcher}).parse().then(e=>(o&&o.clear(),e))}function Ws(e,n={}){var r,i,a,o;let s=(r=n.modelUpAxis)==null?`Y`:r,c=(i=n.upAxis)==null?`Z`:i,l=(a=n.fetcher)==null?ur:a,u=(o=n.onDownloadProgress)==null?G:o,d={uri:e,gltfUpAxis:s};return Promise.resolve().then(()=>l.ajax(e,{responseType:`arraybuffer`},void 0,void 0,u).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>xa(d,e,t)).then(t=>Na(d,e,t)).then(t=>Ra(d,e,t))).then(()=>{var r;return Us(d.gltfArrayBuffer,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,jsonModify(e){var t,r;if(n.light===!1){let n=`KHR_materials_unlit`;if(e.extensionsUsed=(t=e.extensionsUsed)==null?[]:t,e.extensionsUsed.indexOf(n)===-1&&e.extensionsUsed.push(n),e.materials)for(let t of e.materials)t.extensions=(r=t.extensions)==null?{}:r,t.extensions[n]={}}return e},fetcher:l}).then(e=>{let n=new t.Matrix4;s===`Y`&&n.premultiply(qn);let r;if(d.rtcCenter?r=new t.Vector3().fromArray(d.rtcCenter):e.CESIUM_RTC&&(r=new t.Vector3().copy(e.CESIUM_RTC.center)),r){let e=new t.Matrix4().setPosition(r);n.premultiply(e)}return c===`Y`&&n.premultiply(Jn),e.scene.applyMatrix4(n),d.featureTableBinary=void 0,d.batchTableBinary=void 0,d.gltfArrayBuffer=void 0,{type:`b3dm`,modelUpAxis:s,upAxis:`Z`,uri:d.uri,byteLength:d.byteLength,memoryUsage:Di(e.scene),scene:e.scene,textures:e.textures,animations:[],rtcCenter:r,dispose:()=>e.dispose()}})})}var Gs="(function(){function e(e){onmessage=t=>{Promise.resolve(t.data).then(t=>e(t)).then(({output:e,transfer:t})=>postMessage(e,t)).catch(e=>postMessage({$$error:e}))}}var t;(function(e){e[e.BYTE=5120]=`BYTE`,e[e.UNSIGNED_BYTE=5121]=`UNSIGNED_BYTE`,e[e.SHORT=5122]=`SHORT`,e[e.UNSIGNED_SHORT=5123]=`UNSIGNED_SHORT`,e[e.INT=5124]=`INT`,e[e.UNSIGNED_INT=5125]=`UNSIGNED_INT`,e[e.FLOAT=5126]=`FLOAT`,e[e.DOUBLE=5130]=`DOUBLE`})(t||(t={}));let n={[t.DOUBLE]:Float64Array,[t.FLOAT]:Float32Array,[t.UNSIGNED_SHORT]:Uint16Array,[t.UNSIGNED_INT]:Uint32Array,[t.UNSIGNED_BYTE]:Uint8Array,[t.BYTE]:Int8Array,[t.SHORT]:Int16Array,[t.INT]:Int32Array},r={DOUBLE:t.DOUBLE,FLOAT:t.FLOAT,UNSIGNED_SHORT:t.UNSIGNED_SHORT,UNSIGNED_INT:t.UNSIGNED_INT,UNSIGNED_BYTE:t.UNSIGNED_BYTE,BYTE:t.BYTE,SHORT:t.SHORT,INT:t.INT};function i(e){let t=n[e];if(!t)throw Error(`Failed to convert GL type`);return t}function a(e){return i(e).BYTES_PER_ELEMENT}function o(e,t,n=0,r){let o=i(e);return n%a(e)===0?new o(t,n,r==null?(t.byteLength-n)/a(e):r):new o(r?t.slice(n,n+r*a(e)):t.slice(n))}function s(e){let t=r[e];if(!t)throw Error(`Failed to convert GL type`);return t}var c=class{constructor(e,n){this.featuresLength=0,this.cachedTypedArrays={},this.json=e,this.buffer=n;let r=this.getGlobalProperty(`POINTS_LENGTH`,t.UNSIGNED_INT,1);r&&r.length&&(this.featuresLength=r[0])}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return!!this.json[e]}getGlobalProperty(e,t,n){let r=this.json[e];return typeof r==`number`?new(i(t))([r]):Array.isArray(r)?new(i(t))(r):r&&Number.isFinite(r.byteOffset)?this.getTypedArrayFromBinary(e,t,n,1,r.byteOffset):null}getPropertyArray(e,t,n){let r=this.json[e];return r&&Number.isFinite(r.byteOffset)?(`componentType`in r&&(t=s(r.componentType)),this.getTypedArrayFromBinary(e,t,n,this.featuresLength,r.byteOffset)):this.getTypedArrayFromArray(e,t,r)}getProperty(e,t,n,r,i){if(!this.json[e])return null;let a=this.getPropertyArray(e,t,n);if(n===1)return i[0]=a[r],i;for(let e=0;e<n;++e)i[e]=a[n*r+e];return i}getTypedArrayFromBinary(e,t,n,r,i){let a=this.cachedTypedArrays,s=a[e];return s||(s=o(t,this.buffer.buffer,this.buffer.byteOffset+i,r*n),a[e]=s),s}getTypedArrayFromArray(e,t,n){let r=this.cachedTypedArrays,i=r[e];return i||(i=o(t,n),r[e]=i),i}};e(e=>Promise.resolve(e).then(e=>{let t=new c(e.featureTableJson,e.featureTableBinary),n=u(t),r=d(t),i=p(t),a=[];return n&&a.push(n.array.buffer),r&&a.push(r.array.buffer),i&&a.push(i.array.buffer),{output:{position:n,color:r,normal:i},transfer:a}}));let l=65535;function u(e){if(e.hasProperty(`POSITION`))return{array:e.getPropertyArray(`POSITION`,t.FLOAT,3),itemSize:3,normalized:!1};if(e.hasProperty(`POSITION_QUANTIZED`)){let n=e.getPropertyArray(`POSITION_QUANTIZED`,t.UNSIGNED_SHORT,3),r=e.getGlobalProperty(`QUANTIZED_VOLUME_SCALE`,t.FLOAT,3),i=e.getGlobalProperty(`QUANTIZED_VOLUME_OFFSET`,t.FLOAT,3);if(!r||!i)throw Error(`QUANTIZED_VOLUME_SCALE or QUANTIZED_VOLUME_OFFSET never found.`);let a=new Float32Array(n.length),o=n.length/3,s=r[0]/l,c=r[1]/l,u=r[2]/l,d=i[0],f=i[1],p=i[2];for(let e=0,t;e<o;e++)t=e*3,a[t]=n[t]*s+d,a[++t]=n[t]*c+f,a[++t]=n[t]*u+p;return{array:a,itemSize:3,normalized:!1}}return null}function d(e){if(e.hasProperty(`RGB`)){let n=e.getPropertyArray(`RGB`,t.UNSIGNED_BYTE,3),r=n.length/3,i=new Uint8Array(r*4);for(let e=0,t,a;e<r;e++)a=e*4,t=e*3,i[a]=n[t],i[++a]=n[++t],i[++a]=n[++t];return{array:i,itemSize:4,normalized:!0}}else if(e.hasProperty(`RGBA`))return{array:e.getPropertyArray(`RGBA`,t.UNSIGNED_BYTE,4),itemSize:4,normalized:!0};else if(e.hasProperty(`RGB565`)){let n=e.getPropertyArray(`RGB565`,t.UNSIGNED_SHORT,1),r=n.length,i=new Uint8Array(r*4);for(let e=0,t,a;e<r;e++)a=n[e],t=e*4,i[t]=(a>>11&31)<<3,i[++t]=(a>>5&63)<<2,i[++t]=(a&31)<<3;return{array:i,itemSize:4,normalized:!0}}return null}let f=2/255;function p(e){if(e.hasProperty(`NORMAL`)){let n=e.getPropertyArray(`NORMAL`,t.FLOAT,3),r=n.length/3,i=new Int8Array(r*4);for(let e=0,t,a;e<r;e++)a=e*4,t=e*3,i[a]=n[t]*127,i[++a]=n[++t]*127,i[++a]=n[++t]*127;return{array:i,itemSize:4,normalized:!0}}else if(e.hasProperty(`NORMAL_OCT16P`)){let n=e.getPropertyArray(`NORMAL_OCT16P`,t.UNSIGNED_BYTE,2),r=n.length/2,i=new Int8Array(r*4);for(let e=0,t,a,o,s,c,l,u;e<r;e++)t=e*2,a=n[t]*f-1,o=n[++t]*f-1,c=a<0?-a:a,l=o<0?-o:o,s=1-(c+l),s<0&&(a=(1-l)*(a<0?-1:1),o=(1-c)*(o<0?-1:1)),u=Math.sqrt(a*a+o*o+s*s),t=e*4,i[t]=a/u*127,i[++t]=o/u*127,i[++t]=s/u*127;return{array:i,itemSize:4,normalized:!0}}return null}})();",Ks=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,Gs],{type:`text/javascript;charset=utf-8`});function qs(e){let t;try{if(t=Ks&&(self.URL||self.webkitURL).createObjectURL(Ks),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(Gs),{name:e==null?void 0:e.name})}}var Js=new po(()=>new qs,2);function Ys(e,t,n){let r=new ka(e.featureTableJson,e.featureTableBinary);return Promise.resolve().then(()=>{let e=r.getExtension(`3DTILES_draco_point_compression`);return e?Xs(e,r):Js.postMessage({featureTableBinary:r.buffer,featureTableJson:r.json},[r.buffer.buffer])}).then(t=>(e.attributes=t,n))}function Xs(e,n){return Xo(this,void 0,void 0,function*(){let r=e.properties||{},i=e.byteOffset,a=e.byteLength;if(!r||!Number.isFinite(i)||!a)throw Error(`Draco properties, byteOffset, and byteLength must be defined`);let o=n.buffer.slice(i,i+a),s=e.properties;return co.decodeGeometry(o.buffer,{attributeIDs:s,attributeTypes:{POSITION:`Float32Array`,NORMAL:`Float32Array`,RGB:`Uint8Array`,RGBA:`Uint8Array`},useUniqueIDs:!0}).then(e=>{let n=e.getAttribute(`POSITION`),r=e.getAttribute(`RGB`),i=e.getAttribute(`RGBA`),a=e.getAttribute(`NORMAL`),o;if(i)o=i;else if(r){let e=r.count,n=r.array,i=new Uint8Array(e*4);for(let t=0,r,a;t<e;t++)a=t*4,r=t*3,i[a]=n[r],i[++a]=n[++r],i[++a]=n[++r];o=new t.BufferAttribute(i,4,r.normalized)}return{position:n?{array:n.array,itemSize:n.itemSize,normalized:n.normalized}:null,color:o?{array:o.array,itemSize:o.itemSize,normalized:o.normalized}:null,normal:a?{array:a.array,itemSize:a.itemSize,normalized:a.normalized}:null}})})}function Zs(e,n={}){var r,i,a;let o=(r=n.upAxis)==null?`Z`:r,s=(i=n.fetcher)==null?ur:i,c=(a=n.onDownloadProgress)==null?G:a,l={uri:e};return Promise.resolve().then(()=>s.ajax(e,{responseType:`arraybuffer`},void 0,void 0,c).then(e=>e.body)).then(e=>Promise.resolve(0).then(t=>xa(l,e,t)).then(t=>Na(l,e,t)).then(t=>Ys(l,e,t))).then(()=>{var e;return Qs(l.attributes,{computeBoundingBox:(e=n.computeBoundingBox)==null?!0:e})}).then(e=>{let n=new t.Matrix4,r;if(l.rtcCenter&&(r=new t.Vector3().fromArray(l.rtcCenter)),r){let e=new t.Matrix4().setPosition(r);n.premultiply(e)}return o===`Y`&&n.premultiply(Jn),e.object.applyMatrix4(n),l.gltfArrayBuffer=void 0,l.featureTableBinary=void 0,l.batchTableBinary=void 0,{type:`pnts`,modelUpAxis:`Z`,upAxis:o,uri:l.uri,byteLength:l.byteLength,memoryUsage:Di(e.object),scene:e.object,textures:[],animations:[],rtcCenter:r,dispose:()=>e.dispose()}})}function Qs(e,n){let r=new Set,i=new t.BufferGeometry;r.add(i);let a=new Cn;r.add(a),e.position&&i.setAttribute(`position`,new t.BufferAttribute(e.position.array,e.position.itemSize,e.position.normalized)),e.color&&i.setAttribute(`color`,new t.BufferAttribute(e.color.array,e.color.itemSize,e.color.normalized)),e.normal?i.setAttribute(`normal`,new t.BufferAttribute(e.normal.array,e.normal.itemSize,e.normal.normalized)):a.flatShading=!0,n.computeBoundingBox&&i.computeBoundingBox();let o=new wn(i,a);return o.matrix.compose(o.position,o.quaternion,o.scale),o.matrixAutoUpdate=!1,o.frustumCulled=!1,Promise.resolve({object:o,dispose:()=>{r.forEach(e=>{e.dispose()}),r.clear()}})}function $s(e,n={}){var r,i,a,o,s;let c=(r=n.modelUpAxis)==null?`Y`:r,l=(i=n.upAxis)==null?`Z`:i,u=(a=n.fetcher)==null?ur:a,d=(o=n.onDownloadProgress)==null?G:o,f=(s=n.jsonModify)==null?G:s,p=0;return Promise.resolve().then(()=>u.ajax(e,{responseType:`arraybuffer`},void 0,void 0,d).then(e=>(p=e.body.byteLength,e.body))).then(t=>{var r;return Us(t,{copyUV2:!1,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,jsonModify(e){var t,r,i;if(n.light===!1){let n=`KHR_materials_unlit`;if(e.extensionsUsed=(t=e.extensionsUsed)==null?[]:t,e.extensionsUsed.indexOf(n)===-1&&e.extensionsUsed.push(n),e.materials)for(let t of e.materials)t.extensions=(r=t.extensions)==null?{}:r,t.extensions[n]={}}return(i=f(e))==null?e:i},fetcher:u})}).then(n=>{var r;let i=new t.Matrix4;if(c===`Y`&&i.premultiply(qn),n.CESIUM_RTC){let e=new t.Matrix4().setPosition(n.CESIUM_RTC.center);i.premultiply(e)}return l===`Y`&&i.premultiply(Jn),n.scene.applyMatrix4(i),{type:`gltf`,modelUpAxis:c,upAxis:l,uri:e,byteLength:p,memoryUsage:Di(n.scene),scene:n.scene,textures:n.textures,animations:n.animations,rtcCenter:(r=n.CESIUM_RTC)==null?void 0:r.center,dispose:()=>n.dispose()}})}var ec=new t.Color;function tc(e,n={}){var r,i,a,o;let s=(r=n.modelUpAxis)==null?`Z`:r,c=(i=n.upAxis)==null?`Z`:i,l=(a=n.fetcher)==null?ur:a,u=(o=n.onDownloadProgress)==null?G:o,d=0;return Promise.resolve().then(()=>l.ajax(e,{responseType:`arraybuffer`},void 0,void 0,u).then(e=>(d=e.body.byteLength,e.body))).then(e=>{var t,r;return nc(e,{propertyNameMapping:(t=n.propertyNameMapping)==null?{}:t,customPropertyMapping:(r=n.customPropertyMapping)==null?{}:r})}).then(({geometry:r})=>{switch(n.type){case`geometry`:{let t=r;return s===`Y`&&t.applyMatrix4(qn),c===`Y`&&t.applyMatrix4(Jn),{type:`ply`,modelUpAxis:s,upAxis:c,uri:e,byteLength:d,memoryUsage:vi(t),scene:t,textures:[],animations:[],dispose:()=>{r.dispose()}}}case`line`:{let n=`color`in r.attributes,i=new t.LineBasicMaterial({vertexColors:n}),a=new t.Line(r,i);return a.computeLineDistances(),s===`Y`&&a.applyMatrix4(qn),c===`Y`&&a.applyMatrix4(Jn),{type:`ply`,modelUpAxis:s,upAxis:c,uri:e,byteLength:d,memoryUsage:Di(a),scene:a,textures:[],animations:[],dispose:()=>{r.dispose(),i.dispose()}}}case`pbmMesh`:{let i=new pn(n.light?`phong`:`basic`);i.vertexColors=`color`in r.attributes;let a=new t.Mesh(r,i);return s===`Y`&&a.applyMatrix4(qn),c===`Y`&&a.applyMatrix4(Jn),{type:`ply`,modelUpAxis:s,upAxis:c,uri:e,byteLength:d,memoryUsage:Di(a),scene:a,textures:[],animations:[],dispose:()=>{r.dispose(),i.dispose()}}}case`pbmPointCloud`:{let t=new Cn,n=new wn(r,t);return s===`Y`&&n.applyMatrix4(qn),c===`Y`&&n.applyMatrix4(Jn),{type:`ply`,modelUpAxis:s,upAxis:c,uri:e,byteLength:d,memoryUsage:Di(n),scene:n,textures:[],animations:[],dispose:()=>{r.dispose(),t.dispose()}}}default:break}throw Error(`Invalid Type: ${n.type}`)})}function nc(e,t){let n=new Uint8Array(e),{headerText:r,headerLength:i}=hc(n),a=ic(r,i,t);return a.format===`ascii`?{header:a,geometry:lc(new TextDecoder().decode(n),a,t)}:{header:a,geometry:mc(e,a,t)}}function rc(e,t){let n={name:``,type:e[0]};return n.type===`list`?(n.name=e[3],n.countType=e[1],n.itemType=e[2]):n.name=e[1],n.name in t.propertyNameMapping&&(n.name=t.propertyNameMapping[n.name]),n}function ic(e,t=0,n){let r=/^ply([\s\S]*)end_header(\r\n|\r|\n)/,i=``,a=r.exec(e);a!==null&&(i=a[1]);let o={format:``,version:``,comments:[],elements:[],headerLength:t,objInfo:``},s=i.split(/\r\n|\r|\n/),c=null;for(let e=0;e<s.length;e++){let t=s[e];if(t=t.trim(),t===``)continue;let r=t.split(/\s+/),i=r.shift();switch(t=r.join(` `),i){case`format`:o.format=r[0],o.version=r[1];break;case`comment`:o.comments.push(t);break;case`element`:c&&o.elements.push(c),c={name:r[0],count:parseInt(r[1]),properties:[]};break;case`property`:c&&c.properties.push(rc(r,n));break;case`obj_info`:o.objInfo=t;break;default:console.log(`unhandled`,i,r)}}return c&&o.elements.push(c),o}function ac(e,t){switch(t){case`char`:case`uchar`:case`short`:case`ushort`:case`int`:case`uint`:case`int8`:case`uint8`:case`int16`:case`uint16`:case`int32`:case`uint32`:return parseInt(e);case`float`:case`double`:case`float32`:case`float64`:return parseFloat(e);default:throw Error(`unspport type: `+t)}}function oc(e,t){let n={};for(let r=0;r<e.length;r++){if(t.empty())return null;if(e[r].type===`list`){let i=[],a=ac(t.next(),e[r].countType);for(let n=0;n<a;n++){if(t.empty())return null;i.push(ac(t.next(),e[r].itemType))}n[e[r].name]=i}else n[e[r].name]=ac(t.next(),e[r].type)}return n}function sc(e){let t={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[],faceVertexColors:[]};for(let n of Object.keys(e.customPropertyMapping))t[n]=[];return t}function cc(e){let t=e.map(e=>e.name);function n(e){for(let n=0,r=e.length;n<r;n++){let r=e[n];if(t.includes(r))return r}return null}return{attrX:n([`x`,`px`,`posx`])||`x`,attrY:n([`y`,`py`,`posy`])||`y`,attrZ:n([`z`,`pz`,`posz`])||`z`,attrNX:n([`nx`,`normalx`]),attrNY:n([`ny`,`normaly`]),attrNZ:n([`nz`,`normalz`]),attrS:n([`s`,`u`,`texture_u`,`tx`]),attrT:n([`t`,`v`,`texture_v`,`ty`]),attrR:n([`red`,`diffuse_red`,`r`,`diffuse_r`]),attrG:n([`green`,`diffuse_green`,`g`,`diffuse_g`]),attrB:n([`blue`,`diffuse_blue`,`b`,`diffuse_b`])}}function lc(e,t,n){let r=sc(n),i=/end_header\s+(\S[\s\S]*\S|\S)\s*$/,a,o=null;a=(o=i.exec(e))===null?[]:o[1].split(/\s+/);let s=new gc(a);loop:for(let e=0;e<t.elements.length;e++){let i=t.elements[e],a=cc(i.properties);for(let e=0;e<i.count;e++){let e=oc(i.properties,s);if(!e)break loop;dc(r,i.name,e,a,n)}}return uc(r,n)}function uc(e,n){let r=new t.BufferGeometry;e.indices.length>0&&r.setIndex(e.indices),r.setAttribute(`position`,new t.Float32BufferAttribute(e.vertices,3)),e.normals.length>0&&r.setAttribute(`normal`,new t.Float32BufferAttribute(e.normals,3)),e.uvs.length>0&&r.setAttribute(`uv`,new t.Float32BufferAttribute(e.uvs,2)),e.colors.length>0&&r.setAttribute(`color`,new t.Float32BufferAttribute(e.colors,3)),(e.faceVertexUvs.length>0||e.faceVertexColors.length>0)&&(r=r.toNonIndexed(),e.faceVertexUvs.length>0&&r.setAttribute(`uv`,new t.Float32BufferAttribute(e.faceVertexUvs,2)),e.faceVertexColors.length>0&&r.setAttribute(`color`,new t.Float32BufferAttribute(e.faceVertexColors,3)));for(let i of Object.keys(n.customPropertyMapping))if(e[i].length>0){let{itemType:a,itemNames:o,normalized:s}=n.customPropertyMapping[i],c=o.length,l;switch(a){case`float32`:l=new t.Float32BufferAttribute(e[i],c,s);break;case`uint32`:l=new t.Uint32BufferAttribute(e[i],c,s);break;case`int32`:l=new t.Int32BufferAttribute(e[i],c,s);break;case`uint16`:l=new t.Uint16BufferAttribute(e[i],c,s);break;case`int16`:l=new t.Int16BufferAttribute(e[i],c,s);break;case`uint8`:l=new t.Uint8BufferAttribute(e[i],c,s);break;case`int8`:l=new t.Int8BufferAttribute(e[i],c,s);break;default:l=new t.Float32BufferAttribute(e[i],c,s);break}r.setAttribute(i,l)}return r.computeBoundingSphere(),r}function dc(e,t,n,r,i){if(t===`vertex`){r.attrX!==null&&r.attrY!==null&&r.attrZ!==null&&e.vertices.push(n[r.attrX],n[r.attrY],n[r.attrZ]),r.attrNX!==null&&r.attrNY!==null&&r.attrNZ!==null&&e.normals.push(n[r.attrNX],n[r.attrNY],n[r.attrNZ]),r.attrS!==null&&r.attrT!==null&&e.uvs.push(n[r.attrS],n[r.attrT]),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(ec.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.colors.push(ec.r,ec.g,ec.b));for(let t of Object.keys(i.customPropertyMapping))for(let r of i.customPropertyMapping[t].itemNames)e[t].push(n[r])}else if(t===`face`){let t=n.vertex_indices||n.vertex_index,i=n.texcoord;t.length===3?(e.indices.push(t[0],t[1],t[2]),i&&i.length===6&&(e.faceVertexUvs.push(i[0],i[1]),e.faceVertexUvs.push(i[2],i[3]),e.faceVertexUvs.push(i[4],i[5]))):t.length===4&&(e.indices.push(t[0],t[1],t[3]),e.indices.push(t[1],t[2],t[3])),r.attrR!==null&&r.attrG!==null&&r.attrB!==null&&(ec.setRGB(n[r.attrR]/255,n[r.attrG]/255,n[r.attrB]/255),e.faceVertexColors.push(ec.r,ec.g,ec.b),e.faceVertexColors.push(ec.r,ec.g,ec.b),e.faceVertexColors.push(ec.r,ec.g,ec.b))}}function fc(e,t){let n={},r=0;for(let i=0;i<t.length;i++){let a=t[i],o=a.valueReader;if(a.type===`list`){let t=[],i=a.countReader.read(e+r);r+=a.countReader.size;for(let n=0;n<i;n++)t.push(o.read(e+r)),r+=o.size;n[a.name]=t}else n[a.name]=o.read(e+r),r+=o.size}return[n,r]}function pc(e,t,n){function r(e,t,n){switch(t){case`int8`:case`char`:return{read:t=>e.getInt8(t),size:1};case`uint8`:case`uchar`:return{read:t=>e.getUint8(t),size:1};case`int16`:case`short`:return{read:t=>e.getInt16(t,n),size:2};case`uint16`:case`ushort`:return{read:t=>e.getUint16(t,n),size:2};case`int32`:case`int`:return{read:t=>e.getInt32(t,n),size:4};case`uint32`:case`uint`:return{read:t=>e.getUint32(t,n),size:4};case`float32`:case`float`:return{read:t=>e.getFloat32(t,n),size:4};case`float64`:case`double`:return{read:t=>e.getFloat64(t,n),size:8};default:throw Error(`not support type: `+t)}}for(let i=0,a=e.length;i<a;i++){let a=e[i];a.type===`list`?(a.countReader=r(t,a.countType,n),a.valueReader=r(t,a.itemType,n)):a.valueReader=r(t,a.type,n)}}function mc(e,t,n){let r=sc(n),i=t.format===`binary_little_endian`,a=new DataView(e,t.headerLength),o,s=0;for(let e=0;e<t.elements.length;e++){let c=t.elements[e],l=c.properties,u=cc(l);pc(l,a,i);for(let e=0;e<c.count;e++){o=fc(s,l),s+=o[1];let e=o[0];dc(r,c.name,e,u,n)}}return uc(r,n)}function hc(e){let t=0,n=!0,r=``,i=[],a=new TextDecoder().decode(e.subarray(0,5)),o=/^ply\r\n/.test(a);do{let a=String.fromCharCode(e[t++]);a!==`
|
|
862
862
|
`&&a!==`\r`?r+=a:(r===`end_header`&&(n=!1),r!==``&&(i.push(r),r=``))}while(n&&t<e.length);return o===!0&&t++,{headerText:i.join(`\r`)+`\r`,headerLength:t}}var gc=class{constructor(e){this.arr=e,this.i=0}empty(){return this.i>=this.arr.length}next(){return this.arr[this.i++]}},_c=Uint8Array,vc=Uint16Array,yc=Int32Array,bc=new _c([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),xc=new _c([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Sc=new _c([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Cc=function(e,t){for(var n=new vc(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new yc(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},wc=Cc(bc,2),Tc=wc.b,Ec=wc.r;Tc[28]=258,Ec[258]=28;var Dc=Cc(xc,0),Oc=Dc.b;Dc.r;for(var kc=new vc(32768),Ac=0;Ac<32768;++Ac){var jc=(Ac&43690)>>1|(Ac&21845)<<1;jc=(jc&52428)>>2|(jc&13107)<<2,jc=(jc&61680)>>4|(jc&3855)<<4,kc[Ac]=((jc&65280)>>8|(jc&255)<<8)>>1}for(var Mc=(function(e,t,n){for(var r=e.length,i=0,a=new vc(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new vc(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new vc(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[kc[d]>>c]=l}else for(s=new vc(r),i=0;i<r;++i)e[i]&&(s[i]=kc[o[e[i]-1]++]>>15-e[i]);return s}),Nc=new _c(288),Ac=0;Ac<144;++Ac)Nc[Ac]=8;for(var Ac=144;Ac<256;++Ac)Nc[Ac]=9;for(var Ac=256;Ac<280;++Ac)Nc[Ac]=7;for(var Ac=280;Ac<288;++Ac)Nc[Ac]=8;for(var Pc=new _c(32),Ac=0;Ac<32;++Ac)Pc[Ac]=5;var Fc=Mc(Nc,9,1),Ic=Mc(Pc,5,1),Lc=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Rc=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},zc=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Bc=function(e){return(e+7)/8|0},Vc=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new _c(e.subarray(t,n))},Hc=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],Uc=function(e,t,n){var r=Error(t||Hc[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Uc),!n)throw r;return r},Wc=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new _c(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new _c(i*3));var l=function(e){var t=n.length;if(e>t){var r=new _c(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=Rc(e,d,1);var v=Rc(e,d+1,3);if(d+=3,!v){var y=Bc(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&Uc(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}else if(v==1)p=Fc,m=Ic,h=9,g=5;else if(v==2){var S=Rc(e,d,31)+257,C=Rc(e,d+10,15)+4,w=S+Rc(e,d+5,31)+1;d+=14;for(var T=new _c(w),E=new _c(19),D=0;D<C;++D)E[Sc[D]]=Rc(e,d+D*3,7);d+=C*3;for(var O=Lc(E),k=(1<<O)-1,A=Mc(E,O,1),D=0;D<w;){var j=A[Rc(e,d,k)];d+=j&15;var y=j>>4;if(y<16)T[D++]=y;else{var M=0,N=0;for(y==16?(N=3+Rc(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+Rc(e,d,7),d+=3):y==18&&(N=11+Rc(e,d,127),d+=7);N--;)T[D++]=M}}var ee=T.subarray(0,S),te=T.subarray(S);h=Lc(ee),g=Lc(te),p=Mc(ee,h,1),m=Mc(te,g,1)}else Uc(1);if(d>_){c&&Uc(0);break}}s&&l(f+131072);for(var ne=(1<<h)-1,re=(1<<g)-1,ie=d;;ie=d){var M=p[zc(e,d)&ne],ae=M>>4;if(d+=M&15,d>_){c&&Uc(0);break}if(M||Uc(2),ae<256)n[f++]=ae;else if(ae==256){ie=d,p=null;break}else{var oe=ae-254;if(ae>264){var D=ae-257,se=bc[D];oe=Rc(e,d,(1<<se)-1)+Tc[D],d+=se}var ce=m[zc(e,d)&re],le=ce>>4;ce||Uc(3),d+=ce&15;var te=Oc[le];if(le>3){var se=xc[le];te+=zc(e,d)&(1<<se)-1,d+=se}if(d>_){c&&Uc(0);break}s&&l(f+131072);var P=f+oe;if(f<te){var ue=a-te,de=Math.min(te,P);for(ue+f<0&&Uc(3);f<de;++f)n[f]=r[ue+f]}for(;f<P;++f)n[f]=n[f-te]}}t.l=p,t.p=ie,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?Vc(n,0,f):n.subarray(0,f)},Gc=new _c(0),Kc=function(e,t){return e[t]|e[t+1]<<8},qc=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Jc=function(e,t){return qc(e,t)+qc(e,t+4)*4294967296},Yc=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&Uc(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&Uc(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function Xc(e,t){return Wc(e,{i:2},t&&t.out,t&&t.dictionary)}function Zc(e,t){return Wc(e.subarray(Yc(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var Qc=typeof TextDecoder<`u`&&new TextDecoder;try{Qc.decode(Gc,{stream:!0})}catch(e){}var $c=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Vc(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function el(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else if(Qc)return Qc.decode(e);else{var i=$c(e),a=i.s,n=i.r;return n.length&&Uc(8),a}}var tl=function(e,t){return t+30+Kc(e,t+26)+Kc(e,t+28)},nl=function(e,t,n){var r=Kc(e,t+28),i=el(e.subarray(t+46,t+46+r),!(Kc(e,t+8)&2048)),a=t+46+r,o=qc(e,t+20),s=n&&o==4294967295?rl(e,a):[o,qc(e,t+24),qc(e,t+42)],c=s[0],l=s[1],u=s[2];return[Kc(e,t+10),c,l,i,a+Kc(e,t+30)+Kc(e,t+32),u]},rl=function(e,t){for(;Kc(e,t)!=1;t+=4+Kc(e,t+2));return[Jc(e,t+12),Jc(e,t+4),Jc(e,t+20)]};function il(e,t){for(var n={},r=e.length-22;qc(e,r)!=101010256;--r)(!r||e.length-r>65558)&&Uc(13);var i=Kc(e,r+8);if(!i)return{};var a=qc(e,r+16),o=a==4294967295||i==65535;if(o){var s=qc(e,r-12);o=qc(e,s)==101075792,o&&(i=qc(e,s+32),a=qc(e,s+48))}for(var c=t&&t.filter,l=0;l<i;++l){var u=nl(e,a,o),d=u[0],f=u[1],p=u[2],m=u[3],h=u[4],g=u[5],_=tl(e,g);a=h,(!c||c({name:m,size:f,originalSize:p,compression:d}))&&(d?d==8?n[m]=Xc(e.subarray(_,_+f),{out:new _c(p)}):Uc(14,`unknown compression type `+d):n[m]=Vc(e,_,_+f))}return n}function al(e,n={}){var r,i,a;let o=(r=n.upAxis)==null?`Z`:r,s=(i=n.fetcher)==null?ur:i,c=(a=n.onDownloadProgress)==null?G:a,l=0;return Promise.resolve().then(()=>s.ajax(e,{responseType:`arraybuffer`},void 0,void 0,c).then(e=>(l=e.body.byteLength,e.body))).then(t=>{var r;return ol(t,{light:n.light,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(r=e.split(`?`)[1])==null?``:r,fetcher:s})}).then(n=>{let r=n.scene,i=n.unitScale/100,a=new t.Matrix4;if(a.makeScale(i,i,i),n.upAxis===`X`)throw Error(`Cannot load fbx x upAxis`);return n.upAxis===`Y`&&a.premultiply(qn),o===`Y`&&a.premultiply(Jn),r.applyMatrix4(a),{type:`fbx`,modelUpAxis:n.upAxis,upAxis:o,uri:e,byteLength:l,memoryUsage:Di(r),scene:r,textures:n.textures,animations:n.animations,dispose:()=>n.dispose()}})}function ol(e,t){let n;if(ml(e))n=new dl().parse(e);else{let t=Tl(e);if(!hl(t))throw Error(`THREE.FBXLoader: Unknown format.`);if(gl(t)<7e3)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+gl(t));n=new ul().parse(t)}return new sl(t).parse(n)}var sl=class{constructor(e){var t,n,r;this.light=(t=e.light)==null?!0:t,this.resourcePath=(n=e.resourcePath)==null?``:n,this.search=(r=e.search)==null?``:r,this.fetcher=e.fetcher}parse(e){var n,r,i,a,o,s;let c=this.parseConnections(e),l=Object.assign(new t.Group,{animations:[]}),u=[],d=this.parseImages(e),f=this.parseTextures(e,d,c,u),p=this.parseMaterials(e,f,c),m=this.parseDeformers(e,c),h=new cl().parse(e,m,c);this.parseScene(e,m,h,p,c,l);let g=(r=(n=e.GlobalSettings.UpAxis)==null?void 0:n.value)==null?1:r,_=(a=(i=e.GlobalSettings.FrontAxis)==null?void 0:i.value)==null?2:a,v=(s=(o=e.GlobalSettings.UnitScaleFactor)==null?void 0:o.value)==null?1:s,y;if(e.GlobalSettings.AmbientColor){let n=e.GlobalSettings.AmbientColor.value,r=n[0],i=n[1],a=n[2];if(r!==0||i!==0||a!==0){let e=new t.Color().setRGB(r,i,a);y=new t.AmbientLight(e,1)}}return Promise.all(u).then(e=>{var t;return{scene:l,textures:e,ambientLight:y,upAxis:[`X`,`Y`,`Z`][g],frontAxis:[`X`,`Y`,`Z`][_],unitScale:v,animations:(t=l.animations)==null?[]:t,dispose:()=>{e.forEach(e=>e.dispose()),p.forEach(e=>e.dispose()),h.forEach(e=>e.dispose())}}})}parseConnections(e){let t=new Map;return`Connections`in e&&e.Connections.connections.forEach(function(e){let n=e[0],r=e[1],i=e[2];t.has(n)||t.set(n,{parents:[],children:[]});let a={ID:r,relationship:i};t.get(n).parents.push(a),t.has(r)||t.set(r,{parents:[],children:[]});let o={ID:n,relationship:i};t.get(r).children.push(o)}),t}parseImages(e){let t={},n={};if(`Video`in e.Objects){let r=e.Objects.Video;for(let e in r){let i=r[e],a=parseInt(e);if(t[a]=i.RelativeFilename||i.Filename,`Content`in i){let t=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,a=typeof i.Content==`string`&&i.Content!==``;if(t||a){let t=this.parseImage(r[e]);n[i.RelativeFilename||i.Filename]=t}}}}for(let e in t){let r=t[e];n[r]===void 0?t[e]=t[e].split(`\\`).pop():t[e]=n[r]}return t}parseImage(e){let t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(`.`)+1).toLowerCase(),i;switch(r){case`bmp`:i=`image/bmp`;break;case`jpg`:case`jpeg`:i=`image/jpeg`;break;case`png`:i=`image/png`;break;case`tif`:i=`image/tiff`;break;case`tga`:i=`image/tga`;break;default:return}if(typeof t==`string`)return`data:`+i+`;base64,`+t;{let e=new Uint8Array(t);return window.URL.createObjectURL(new Blob([e],{type:i}))}}parseTextures(e,t,n,r){let i=new Map;if(`Texture`in e.Objects){let a=e.Objects.Texture;for(let e in a){let o=this.parseTexture(a[e],t,n,r);i.set(parseInt(e),o)}}return i}parseTexture(e,n,r,i){let a=this.loadTexture(e,n,r,i);a.ID=e.id,a.name=e.attrName;let o=e.WrapModeU,s=e.WrapModeV,c=o===void 0?0:o.value,l=s===void 0?0:s.value;if(a.wrapS=c===0?t.RepeatWrapping:t.ClampToEdgeWrapping,a.wrapT=l===0?t.RepeatWrapping:t.ClampToEdgeWrapping,e.Scaling){let t=e.Scaling.value;a.repeat.x=t[0],a.repeat.y=t[1]}if(e.Translation){let t=e.Translation.value;a.offset.x=t[0],a.offset.y=t[1]}return a}loadTexture(e,n,r,i){let a=r.get(e.id).children,o=``;a!==void 0&&a.length>0&&n[a[0].ID]!==void 0&&(o=n[a[0].ID]),o=_r(this.resourcePath,vr(o,this.search));let s=Object.assign(new t.Texture,{ID:0}),c;c=ii()?this.fetcher.ajax(o,{responseType:`blob`}).then(e=>{let t=e.body;return oi(t)}):this.fetcher.loadImage(o,{},void 0,void 0,void 0,ai()).then(e=>e.body);let l=c.then(e=>(s.image=e,s.needsUpdate=!0,s)).catch(e=>(console.warn(e),s));return i.push(l),s}parseMaterials(e,t,n){let r=new Map;if(`Material`in e.Objects){let i=e.Objects.Material;for(let a in i){let o=this.parseMaterial(e,i[a],t,n);o!==null&&r.set(parseInt(a),o)}}return r}parseMaterial(e,n,r,i){let a=n.id,o=n.attrName,s=n.ShadingModel;if(typeof s==`object`&&(s=s.value),s=s.toLowerCase(),!i.has(a))return null;let c=new pn(this.light?`phong`:`basic`);c.name=o,n.BumpFactor&&(c.bumpScale=n.BumpFactor.value),n.Diffuse?c.color=new t.Color().fromArray(n.Diffuse.value):n.DiffuseColor&&(n.DiffuseColor.type===`Color`||n.DiffuseColor.type===`ColorRGB`)&&(c.color=new t.Color().fromArray(n.DiffuseColor.value)),n.DisplacementFactor&&(c.displacementScale=n.DisplacementFactor.value),n.Emissive?c.emissive=new t.Color().fromArray(n.Emissive.value):n.EmissiveColor&&(n.EmissiveColor.type===`Color`||n.EmissiveColor.type===`ColorRGB`)&&(c.emissive=new t.Color().fromArray(n.EmissiveColor.value)),n.EmissiveFactor&&(c.emissiveIntensity=parseFloat(n.EmissiveFactor.value));let l=1-(n.TransparencyFactor?parseFloat(n.TransparencyFactor.value):0);(l===1||l===0)&&(l=n.Opacity?parseFloat(n.Opacity.value):null,l===null&&(l=1-(n.TransparentColor?parseFloat(n.TransparentColor.value[0]):0))),c.opacity=l,c.opacity<1&&(c.transparent=!0),n.ReflectionFactor&&(c.reflectivity=n.ReflectionFactor.value),n.Shininess&&(c.shininess=n.Shininess.value),n.Specular?c.specular=new t.Color().fromArray(n.Specular.value):n.SpecularColor&&n.SpecularColor.type===`Color`&&(c.specular=new t.Color().fromArray(n.SpecularColor.value));let u=this;return i.get(a).children.forEach(function(n){let a=n.relationship;switch(a){case`Bump`:c.bumpMap=u.getTexture(e,r,n.ID,i);break;case`Maya|TEX_ao_map`:c.aoMap=u.getTexture(e,r,n.ID,i);break;case`DiffuseColor`:case`Maya|TEX_color_map`:c.map=u.getTexture(e,r,n.ID,i),c.map!==void 0&&(c.map.encoding=t.sRGBEncoding);break;case`DisplacementColor`:c.displacementMap=u.getTexture(e,r,n.ID,i);break;case`EmissiveColor`:c.emissiveMap=u.getTexture(e,r,n.ID,i),c.emissiveMap!==void 0&&(c.emissiveMap.encoding=t.sRGBEncoding);break;case`NormalMap`:case`Maya|TEX_normal_map`:c.normalMap=u.getTexture(e,r,n.ID,i);break;case`ReflectionColor`:c.envMap=u.getTexture(e,r,n.ID,i),c.envMap!==void 0&&(c.envMap.mapping=t.EquirectangularReflectionMapping,c.envMap.encoding=t.sRGBEncoding);break;case`SpecularColor`:c.specularMap=u.getTexture(e,r,n.ID,i),c.specularMap!==void 0&&(c.specularMap.encoding=t.sRGBEncoding);break;case`TransparentColor`:case`TransparencyFactor`:c.alphaMap=u.getTexture(e,r,n.ID,i),c.transparent=!0;break;default:console.warn(`THREE.FBXLoader: %s map is not supported in three.js, skipping texture.`,a);break}}),c}getTexture(e,t,n,r){return e.Objects.LayeredTexture&&n in e.Objects.LayeredTexture&&(console.warn(`THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.`),n=r.get(n).children[0].ID),t.get(n)}parseDeformers(e,t){let n={},r={};if(`Deformer`in e.Objects){let i=e.Objects.Deformer;for(let e in i){let a=i[e],o=t.get(parseInt(e));if(a.attrType===`Skin`){let t=this.parseSkeleton(o,i);t.ID=e,o.parents.length>1&&console.warn(`THREE.FBXLoader: skeleton attached to more than one geometry is not supported.`),t.geometryID=o.parents[0].ID,n[e]=t}else if(a.attrType===`BlendShape`){let n={id:e};n.rawTargets=this.parseMorphTargets(o,i,t),n.id=e,o.parents.length>1&&console.warn(`THREE.FBXLoader: morph target attached to more than one geometry is not supported.`),r[e]=n}}}return{skeletons:n,morphTargets:r}}parseSkeleton(e,n){let r=[];return e.children.forEach(function(e){let i=n[e.ID];if(i.attrType!==`Cluster`)return;let a={ID:e.ID,indices:[],weights:[],transformLink:new t.Matrix4().fromArray(i.TransformLink.a)};i.Indexes&&(a.indices=i.Indexes.a,a.weights=i.Weights.a),r.push(a)}),{ID:``,geometryID:0,rawBones:r,bones:[]}}parseMorphTargets(e,t,n){let r=[];for(let i=0;i<e.children.length;i++){let a=e.children[i],o=t[a.ID],s={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a,geoID:0};if(o.attrType!==`BlendShapeChannel`)return;s.geoID=n.get(parseInt(a.ID)).children.filter(function(e){return e.relationship===void 0})[0].ID,r.push(s)}return r}parseScene(e,n,r,i,a,o){let s=this.parseModels(e,n.skeletons,r,i,a),c=e.Objects.Model,l=this;s.forEach(function(t){let n=c[t.ID];l.setLookAtProperties(e,t,n,a,o),a.get(t.ID).parents.forEach(function(e){let n=s.get(e.ID);n!==void 0&&n.add(t)}),t.parent===null&&o.add(t)}),this.bindSkeleton(e,n.skeletons,r,s,a),o.traverse(function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);let t=Sl(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix(!0,!0)}});let u=new ll().parse(e,a,o);o.children.length===1&&o.children[0]instanceof t.Group&&(o=o.children[0]),o.animations=u}parseModels(e,n,r,i,a){let o=new Map,s=e.Objects.Model;for(let c in s){let l=parseInt(c),u=s[c],d=a.get(l),f=this.buildSkeleton(d,n,l,u.attrName);if(!f){switch(u.attrType){case`Camera`:f=this.createCamera(e,d);break;case`Light`:f=this.createLight(e,d);break;case`Mesh`:f=this.createMesh(d,r,i);break;case`NurbsCurve`:case`LimbNode`:case`Root`:f=new t.Bone;break;default:f=new t.Group;break}f.name=u.attrName?t.PropertyBinding.sanitizeNodeName(u.attrName):``,f.userData.originalName=u.attrName,f.ID=l}this.getTransformData(f,u),o.set(l,f)}return o}buildSkeleton(e,n,r,i){let a=null;return e.parents.forEach(function(e){for(let o in n){let s=n[o];s.rawBones.forEach(function(n,o){if(n.ID===e.ID){let e=a;a=new t.Bone,a.matrixWorld.copy(n.transformLink),a.name=i?t.PropertyBinding.sanitizeNodeName(i):``,a.userData.originalName=i,a.ID=r,s.bones[o]=a,e!==null&&a.add(e)}})}}),a}createCamera(e,n){let r,i;if(n.children.forEach(function(t){let n=e.Objects.NodeAttribute[t.ID];n!==void 0&&(i=n)}),i===void 0)r=new t.Object3D;else{let e=0;i.CameraProjectionType!==void 0&&i.CameraProjectionType.value===1&&(e=1);let n=1;i.NearPlane!==void 0&&(n=i.NearPlane.value/1e3);let a=1e3;i.FarPlane!==void 0&&(a=i.FarPlane.value/1e3);let o=window.innerWidth,s=window.innerHeight;i.AspectWidth!==void 0&&i.AspectHeight!==void 0&&(o=i.AspectWidth.value,s=i.AspectHeight.value);let c=o/s,l=45;i.FieldOfView!==void 0&&(l=i.FieldOfView.value);let u=i.FocalLength?i.FocalLength.value:null;switch(e){case 0:r=new t.PerspectiveCamera(l,c,n,a),u!==null&&r.setFocalLength(u);break;case 1:console.warn(`THREE.FBXLoader: Orthographic cameras not supported yet.`),r=new t.Object3D;break;default:console.warn(`THREE.FBXLoader: Unknown camera type `+e+`.`),r=new t.Object3D;break}}return r}createLight(e,n){let r,i;if(n.children.forEach(function(t){let n=e.Objects.NodeAttribute[t.ID];n!==void 0&&(i=n)}),i===void 0)r=new t.Object3D;else{let e;e=i.LightType===void 0?0:i.LightType.value;let n=new t.Color(16777215);i.Color!==void 0&&(n=new t.Color().fromArray(i.Color.value));let a=i.Intensity===void 0?1:i.Intensity.value/100;i.CastLightOnObject!==void 0&&i.CastLightOnObject.value===0&&(a=0);let o=0;switch(i.FarAttenuationEnd!==void 0&&(o=i.EnableFarAttenuation!==void 0&&i.EnableFarAttenuation.value===0?0:i.FarAttenuationEnd.value),e){case 0:r=new t.PointLight(n,a,o,1);break;case 1:r=new t.DirectionalLight(n,a);break;case 2:let e=Math.PI/3;i.InnerAngle!==void 0&&(e=t.MathUtils.degToRad(i.InnerAngle.value));let s=0;i.OuterAngle!==void 0&&(s=t.MathUtils.degToRad(i.OuterAngle.value),s=Math.max(s,1)),r=new t.SpotLight(n,a,o,e,s,1);break;default:console.warn(`THREE.FBXLoader: Unknown light type `+i.LightType.value+`, defaulting to a PointLight.`),r=new t.PointLight(n,a);break}i.CastShadows!==void 0&&i.CastShadows.value===1&&(r.castShadow=!0)}return r}createMesh(e,n,r){let i,a=null,o=[];if(e.children.forEach(function(e){n.has(e.ID)&&(a=n.get(e.ID)),r.has(e.ID)&&o.push(r.get(e.ID))}),o.length===0){let e=new pn(this.light?`phong`:`basic`);e.color=new t.Color(13421772),o.push(e)}return`color`in a.attributes&&o.forEach(function(e){e.vertexColors=!0}),(!a.groups||a.groups.length===0)&&a.addGroup(0,a.index?a.index.count:a.attributes.position.count,0),a.FBX_Deformer?(o.forEach(function(e){e.skinning=!0}),i=new hn(a,o),i.normalizeSkinWeights()):i=new mn(a,o),i}createCurve(e,n){let r=e.children.reduce(function(e,t){return n.has(t.ID)&&(e=n.get(t.ID)),e},null),i=new t.LineBasicMaterial({name:``,color:3342591,linewidth:1});return new t.Line(r,i)}getTransformData(e,t){let n={};t.InheritType&&(n.inheritType=parseInt(t.InheritType.value)),t.RotationOrder?n.eulerOrder=Cl(t.RotationOrder.value):n.eulerOrder=Cl(0),t.Lcl_Translation&&(n.translation=t.Lcl_Translation.value),t.PreRotation&&(n.preRotation=t.PreRotation.value),t.Lcl_Rotation&&(n.rotation=t.Lcl_Rotation.value),t.PostRotation&&(n.postRotation=t.PostRotation.value),t.Lcl_Scaling&&(n.scale=t.Lcl_Scaling.value),t.ScalingOffset&&(n.scalingOffset=t.ScalingOffset.value),t.ScalingPivot&&(n.scalingPivot=t.ScalingPivot.value),t.RotationOffset&&(n.rotationOffset=t.RotationOffset.value),t.RotationPivot&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,n,r,i,a){`LookAtProperty`in r&&i.get(n.ID).children.forEach(function(r){if(r.relationship===`LookAtProperty`){let i=e.Objects.Model[r.ID];if(i.Lcl_Translation){let e=i.Lcl_Translation.value;`target`in n&&n.target instanceof t.Object3D?(n.target.position.fromArray(e),a.add(n.target)):n.lookAt(new t.Vector3().fromArray(e))}}})}bindSkeleton(e,n,r,i,a){let o=this.parsePoseNodes(e);for(let e in n){let s=n[e];a.get(parseInt(s.ID)).parents.forEach(function(e){if(r.has(e.ID)){let n=e.ID;a.get(n).parents.forEach(function(e){if(i.has(e.ID)){let n=i.get(e.ID);n instanceof t.SkinnedMesh&&n.bind(new t.Skeleton(s.bones),o[e.ID])}})}})}}parsePoseNodes(e){let n={};if(e.Objects.Pose){let r=e.Objects.Pose;for(let e in r)if(r[e].attrType===`BindPose`&&r[e].NbPoseNodes>0){let i=r[e].PoseNode;Array.isArray(i)?i.forEach(function(e){n[e.Node]=new t.Matrix4().fromArray(e.Matrix.a)}):n[i.Node]=new t.Matrix4().fromArray(i.Matrix.a)}}return n}},cl=class{constructor(){this.negativeMaterialIndices=!1}parse(e,t,n){let r=new Map;if(`Geometry`in e.Objects){let i=e.Objects.Geometry;for(let a in i){let o=n.get(parseInt(a)),s=this.parseGeometry(e,o,i[a],t);r.set(parseInt(a),s)}}return this.negativeMaterialIndices===!0&&console.warn(`THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected.`),r}parseGeometry(e,t,n,r){switch(n.attrType){case`Mesh`:return this.parseMeshGeometry(e,t,n,r);case`NurbsCurve`:return this.parseNurbsGeometry(n)}}parseMeshGeometry(e,t,n,r){let i=r.skeletons,a=[],o=t.parents.map(function(t){return e.Objects.Model[t.ID]});if(o.length===0)return;let s=t.children.reduce(function(e,t){return i[t.ID]!==void 0&&(e=i[t.ID]),e},null);t.children.forEach(function(e){r.morphTargets[e.ID]!==void 0&&a.push(r.morphTargets[e.ID])});let c=o[0],l={};c.RotationOrder&&(l.eulerOrder=Cl(c.RotationOrder.value)),c.InheritType&&(l.inheritType=parseInt(c.InheritType.value)),c.GeometricTranslation&&(l.translation=c.GeometricTranslation.value),c.GeometricRotation&&(l.rotation=c.GeometricRotation.value),c.GeometricScaling&&(l.scale=c.GeometricScaling.value);let u=Sl(l);return this.genGeometry(e,n,s,a,u)}genGeometry(e,n,r,i,a){let o=new t.BufferGeometry;n.attrName&&(o.name=n.attrName);let s=this.parseGeoNode(n,r),c=this.genBuffers(s),l=new t.Float32BufferAttribute(c.vertex,3);if(l.applyMatrix4(a),o.setAttribute(`position`,l),c.colors.length>0&&o.setAttribute(`color`,new t.Float32BufferAttribute(c.colors,3)),r&&(o.setAttribute(`skinIndex`,new t.Uint16BufferAttribute(c.weightsIndices,4)),o.setAttribute(`skinWeight`,new t.Float32BufferAttribute(c.vertexWeights,4)),o.FBX_Deformer=r),c.normal.length>0){let e=new t.Matrix3().getNormalMatrix(a),n=new t.Float32BufferAttribute(c.normal,3);n.applyNormalMatrix(e),o.setAttribute(`normal`,n)}if(c.uvs.forEach(function(e,n){let r=n===0?`uv`:`uv${n+1}`;o.setAttribute(r,new t.Float32BufferAttribute(c.uvs[n],2))}),s.material&&s.material.mappingType!==`AllSame`){let e=c.materialIndex[0],t=0;if(c.materialIndex.forEach(function(n,r){n!==e&&(o.addGroup(t,r-t,e),e=n,t=r)}),o.groups.length>0){let t=o.groups[o.groups.length-1],n=t.start+t.count;n!==c.materialIndex.length&&o.addGroup(n,c.materialIndex.length-n,e)}o.groups.length===0&&o.addGroup(0,c.materialIndex.length,c.materialIndex[0])}return this.addMorphTargets(e,o,n,i,a),o}parseGeoNode(e,t){let n={};if(n.vertexPositions=e.Vertices===void 0?[]:e.Vertices.a,n.vertexIndices=e.PolygonVertexIndex===void 0?[]:e.PolygonVertexIndex.a,e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(e,t){e.indices.forEach(function(r,i){n.weightTable[r]===void 0&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})})})),n}genBuffers(e){let t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],o=[],s=[],c=[],l=[],u=[],d=this;return e.vertexIndices.forEach(function(f,p){let m=0,h=!1;f<0&&(f^=-1,h=!0);let g=[],_=[];if(a.push(f*3,f*3+1,f*3+2),e.color){let t=yl(p,n,f,e.color);s.push(t[0],t[1],t[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(e){_.push(e.weight),g.push(e.id)}),_.length>4){i||(console.warn(`THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.`),i=!0);let e=[0,0,0,0],t=[0,0,0,0];_.forEach(function(n,r){let i=n,a=g[r];t.forEach(function(t,n,r){if(i>t){r[n]=i,i=t;let o=e[n];e[n]=a,a=o}})}),g=e,_=t}for(;_.length<4;)_.push(0),g.push(0);for(let e=0;e<4;++e)l.push(_[e]),u.push(g[e])}if(e.normal){let t=yl(p,n,f,e.normal);o.push(t[0],t[1],t[2])}e.material&&e.material.mappingType!==`AllSame`&&(m=yl(p,n,f,e.material)[0],m<0&&(d.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(e,t){let r=yl(p,n,f,e);c[t]===void 0&&(c[t]=[]),c[t].push(r[0]),c[t].push(r[1])}),r++,h&&(d.genFace(t,e,a,m,o,s,c,l,u,r),n++,r=0,a=[],o=[],s=[],c=[],l=[],u=[])}),t}getNormalNewell(e){let n=new t.Vector3(0,0,0);for(let t=0;t<e.length;t++){let r=e[t],i=e[(t+1)%e.length];n.x+=(r.y-i.y)*(r.z+i.z),n.y+=(r.z-i.z)*(r.x+i.x),n.z+=(r.x-i.x)*(r.y+i.y)}return n.normalize(),n}getNormalTangentAndBitangent(e){let n=this.getNormalNewell(e),r=(Math.abs(n.z)>.5?new t.Vector3(0,1,0):new t.Vector3(0,0,1)).cross(n).normalize();return{normal:n,tangent:r,bitangent:n.clone().cross(r).normalize()}}flattenVertex(e,n,r){return new t.Vector2(e.dot(n),e.dot(r))}genFace(e,n,r,i,a,o,s,c,l,u){let d;if(u>3){let e=[],i=n.baseVertexPositions||n.vertexPositions;for(let n=0;n<r.length;n+=3)e.push(new t.Vector3(i[r[n]],i[r[n+1]],i[r[n+2]]));let{tangent:a,bitangent:o}=this.getNormalTangentAndBitangent(e),s=[];for(let t of e)s.push(this.flattenVertex(t,a,o));d=t.ShapeUtils.triangulateShape(s,[])}else d=[[0,1,2]];for(let[t,u,f]of d)e.vertex.push(n.vertexPositions[r[t*3]]),e.vertex.push(n.vertexPositions[r[t*3+1]]),e.vertex.push(n.vertexPositions[r[t*3+2]]),e.vertex.push(n.vertexPositions[r[u*3]]),e.vertex.push(n.vertexPositions[r[u*3+1]]),e.vertex.push(n.vertexPositions[r[u*3+2]]),e.vertex.push(n.vertexPositions[r[f*3]]),e.vertex.push(n.vertexPositions[r[f*3+1]]),e.vertex.push(n.vertexPositions[r[f*3+2]]),n.skeleton&&(e.vertexWeights.push(c[t*4]),e.vertexWeights.push(c[t*4+1]),e.vertexWeights.push(c[t*4+2]),e.vertexWeights.push(c[t*4+3]),e.vertexWeights.push(c[u*4]),e.vertexWeights.push(c[u*4+1]),e.vertexWeights.push(c[u*4+2]),e.vertexWeights.push(c[u*4+3]),e.vertexWeights.push(c[f*4]),e.vertexWeights.push(c[f*4+1]),e.vertexWeights.push(c[f*4+2]),e.vertexWeights.push(c[f*4+3]),e.weightsIndices.push(l[t*4]),e.weightsIndices.push(l[t*4+1]),e.weightsIndices.push(l[t*4+2]),e.weightsIndices.push(l[t*4+3]),e.weightsIndices.push(l[u*4]),e.weightsIndices.push(l[u*4+1]),e.weightsIndices.push(l[u*4+2]),e.weightsIndices.push(l[u*4+3]),e.weightsIndices.push(l[f*4]),e.weightsIndices.push(l[f*4+1]),e.weightsIndices.push(l[f*4+2]),e.weightsIndices.push(l[f*4+3])),n.color&&(e.colors.push(o[t*3]),e.colors.push(o[t*3+1]),e.colors.push(o[t*3+2]),e.colors.push(o[u*3]),e.colors.push(o[u*3+1]),e.colors.push(o[u*3+2]),e.colors.push(o[f*3]),e.colors.push(o[f*3+1]),e.colors.push(o[f*3+2])),n.material&&n.material.mappingType!==`AllSame`&&(e.materialIndex.push(i),e.materialIndex.push(i),e.materialIndex.push(i)),n.normal&&(e.normal.push(a[t*3]),e.normal.push(a[t*3+1]),e.normal.push(a[t*3+2]),e.normal.push(a[u*3]),e.normal.push(a[u*3+1]),e.normal.push(a[u*3+2]),e.normal.push(a[f*3]),e.normal.push(a[f*3+1]),e.normal.push(a[f*3+2])),n.uv&&n.uv.forEach(function(n,r){e.uvs[r]===void 0&&(e.uvs[r]=[]),e.uvs[r].push(s[r][t*2]),e.uvs[r].push(s[r][t*2+1]),e.uvs[r].push(s[r][u*2]),e.uvs[r].push(s[r][u*2+1]),e.uvs[r].push(s[r][f*2]),e.uvs[r].push(s[r][f*2+1])})}addMorphTargets(e,t,n,r,i){if(r.length===0)return;t.morphTargetsRelative=!0,t.morphAttributes.position=[];let a=this;r.forEach(function(r){r.rawTargets.forEach(function(r){let o=e.Objects.Geometry[r.geoID];o!==void 0&&a.genMorphGeometry(t,n,o,i,r.name)})})}genMorphGeometry(e,n,r,i,a){let o=n.Vertices===void 0?[]:n.Vertices.a,s=n.PolygonVertexIndex===void 0?[]:n.PolygonVertexIndex.a,c=r.Vertices===void 0?[]:r.Vertices.a,l=r.Indexes?r.Indexes.a:[],u=e.attributes.position.count*3,d=new Float32Array(u);for(let e=0;e<l.length;e++){let t=l[e]*3;d[t]=c[e*3],d[t+1]=c[e*3+1],d[t+2]=c[e*3+2]}let f={vertexIndices:s,vertexPositions:d,baseVertexPositions:o},p=this.genBuffers(f),m=new t.Float32BufferAttribute(p.vertex,3);m.name=a||r.attrName,m.applyMatrix4(i),e.morphAttributes.position.push(m)}parseNormals(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return n===`IndexToDirect`&&(e.NormalIndex?i=e.NormalIndex.a:e.NormalsIndex&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}}parseUVs(e){let t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,i=[];return n===`IndexToDirect`&&(i=e.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:t,referenceType:n}}parseVertexColors(e){let n=e.MappingInformationType,r=e.ReferenceInformationType,i=e.Colors.a,a=[];r===`IndexToDirect`&&(a=e.ColorIndex.a);for(let e=0,n=new t.Color;e<i.length;e+=4)n.fromArray(i,e),n.toArray(i,e);return{dataSize:4,buffer:i,indices:a,mappingType:n,referenceType:r}}parseMaterialIndices(e){let t=e.MappingInformationType,n=e.ReferenceInformationType;if(t===`NoMappingInformation`)return{dataSize:1,buffer:[0],indices:[0],mappingType:`AllSame`,referenceType:n};let r=e.Materials.a,i=[];for(let e=0;e<r.length;++e)i.push(e);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}}parseNurbsGeometry(e){let n=parseInt(e.Order);if(isNaN(n))return console.error(`THREE.FBXLoader: Invalid Order %s given for geometry ID: %s`,e.Order,e.id),new t.BufferGeometry;let r=n-1,i=e.KnotVector.a,a=[],o=e.Points.a;for(let e=0,n=o.length;e<n;e+=4)a.push(new t.Vector4().fromArray(o,e));let s,c;if(e.Form===`Closed`)a.push(a[0]);else if(e.Form===`Periodic`){s=r,c=i.length-1-s;for(let e=0;e<r;++e)a.push(a[e])}let l=new Ol(r,i,a,s,c).getPoints(a.length*12);return new t.BufferGeometry().setFromPoints(l)}},ll=class{parse(e,t,n){let r=[],i=this.parseClips(e,t,n);if(i!==void 0)for(let e in i){let t=i[e],a=this.addClip(t,n);r.push(a)}return r}parseClips(e,t,n){if(e.Objects.AnimationCurve===void 0)return;let r=this.parseAnimationCurveNodes(e);this.parseAnimationCurves(e,r,t);let i=this.parseAnimationLayers(e,r,t,n);return this.parseAnimStacks(e,i,t)}parseAnimationCurveNodes(e){let t=e.Objects.AnimationCurveNode,n=new Map;for(let e in t){let r=t[e];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){let e={id:r.id,attr:r.attrName,curves:{}};n.set(e.id,e)}}return n}parseAnimationCurves(e,t,n){let r=e.Objects.AnimationCurve;for(let e in r){let i={id:r[e].id,times:r[e].KeyTime.a.map(_l),values:r[e].KeyValueFloat.a},a=n.get(i.id);if(a!==void 0){let e=a.parents[0].ID,n=a.parents[0].relationship,r=t.get(e);r&&(n.match(/X/)?r.curves.x=i:n.match(/Y/)?r.curves.y=i:n.match(/Z/)?r.curves.z=i:n.match(/DeformPercent/)&&t.has(e)&&(r.curves.morph=i))}}}parseAnimationLayers(e,n,r,i){let a=e.Objects.AnimationLayer,o=new Map;for(let s in a){let a=[],c=r.get(parseInt(s));c!==void 0&&(c.children.forEach((o,s)=>{if(n.has(o.ID)){let c=n.get(o.ID);if(c.curves.x!==void 0||c.curves.y!==void 0||c.curves.z!==void 0){if(a[s]===void 0){let n=r.get(o.ID).parents.filter(function(e){return e.relationship!==void 0})[0].ID;if(n!==void 0){let r=e.Objects.Model[n.toString()];if(r===void 0){console.warn(`THREE.FBXLoader: Encountered a unused curve.`,o);return}let c={modelName:r.attrName?t.PropertyBinding.sanitizeNodeName(r.attrName):``,ID:r.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1],transform:new t.Matrix4,eulerOrder:``,preRotation:[0,0,0],postRotation:[0,0,0]};i.traverse(function(e){e.ID===r.id&&(c.transform=e.matrix,e.userData.transformData&&(c.eulerOrder=e.userData.transformData.eulerOrder))}),c.transform||(c.transform=new t.Matrix4),r.PreRotation&&(c.preRotation=r.PreRotation.value),r.PostRotation&&(c.postRotation=r.PostRotation.value),a[s]=c}}a[s]&&(a[s][c.attr]=c)}else if(c.curves.morph!==void 0){if(a[s]===void 0){let n=r.get(o.ID).parents.filter(function(e){return e.relationship!==void 0})[0].ID,i=r.get(n).parents[0].ID,c=r.get(i).parents[0].ID,l=r.get(c).parents[0].ID,u=e.Objects.Model[l];a[s]={modelName:u.attrName?t.PropertyBinding.sanitizeNodeName(u.attrName):``,morphName:e.Objects.Deformer[n].attrName}}a[s][c.attr]=c}}}),o.set(parseInt(s),a))}return o}parseAnimStacks(e,t,n){let r=e.Objects.AnimationStack,i={};for(let e in r){let a=n.get(parseInt(e)).children;a.length>1&&console.warn(`THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.`);let o=t.get(a[0].ID);i[e]={name:r[e].attrName,layer:o}}return i}addClip(e,n){let r=[],i=this;return e.layer.forEach(function(e){r=r.concat(i.generateTracks(e,n))}),new t.AnimationClip(e.name,-1,r)}generateTracks(e,n){let r=[],i=new t.Vector3,a=new t.Vector3;e.transform&&e.transform.decompose(i,new t.Quaternion,a);let o=i.toArray(),s=a.toArray();if(e.T!==void 0&&Object.keys(e.T.curves).length>0){let t=this.generateVectorTrack(e.modelName,e.T.curves,o,`position`);t!==void 0&&r.push(t)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){let t=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);t!==void 0&&r.push(t)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){let t=this.generateVectorTrack(e.modelName,e.S.curves,s,`scale`);t!==void 0&&r.push(t)}if(e.DeformPercent!==void 0){let t=this.generateMorphTrack(e,n);t!==void 0&&r.push(t)}return r}generateVectorTrack(e,n,r,i){let a=this.getTimesForAllAxes(n),o=this.getKeyframeTrackValues(a,n,r);return new t.VectorKeyframeTrack(e+`.`+i,a,o)}generateRotationTrack(e,n,r,i,a){let o,s;if(n.x!==void 0&&n.y!==void 0&&n.z!==void 0){let e=this.interpolateRotations(n.x,n.y,n.z,a);o=e[0],s=e[1]}let c=Cl(0),l=new t.Quaternion,u=new t.Quaternion;r!==void 0&&(r=r.map(t.MathUtils.degToRad),r.push(c),l.setFromEuler(new t.Euler().fromArray(r))),i!==void 0&&(i=i.map(t.MathUtils.degToRad),i.push(c),u.setFromEuler(new t.Euler().fromArray(i)),u.inverse());let d=new t.Quaternion,f=new t.Euler,p=[];if(!s||!o)return new t.QuaternionKeyframeTrack(e+`.quaternion`,[0],[0]);for(let e=0;e<s.length;e+=3)f.set(s[e],s[e+1],s[e+2],a),d.setFromEuler(f),d.premultiply(l),d.multiply(u),e>2&&new t.Quaternion().fromArray(p,(e-3)/3*4).dot(d)<0&&d.set(-d.x,-d.y,-d.z,-d.w),d.toArray(p,e/3*4);return new t.QuaternionKeyframeTrack(e+`.quaternion`,o,p)}generateMorphTrack(e,n){let r=e.DeformPercent.curves.morph,i=r.values.map(function(e){return e/100}),a=n.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new t.NumberKeyframeTrack(e.modelName+`.morphTargetInfluences[`+a+`]`,r.times,i)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(e,t){return e-t}),t.length>1){let e=1,n=t[0];for(let r=1;r<t.length;r++){let i=t[r];i!==n&&(t[e]=i,n=i,e++)}t=t.slice(0,e)}return t}getKeyframeTrackValues(e,t,n){let r=n,i=[],a=-1,o=-1,s=-1;return e.forEach(function(e){if(t.x&&(a=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),a!==-1){let e=t.x.values[a];i.push(e),r[0]=e}else i.push(r[0]);if(o!==-1){let e=t.y.values[o];i.push(e),r[1]=e}else i.push(r[1]);if(s!==-1){let e=t.z.values[s];i.push(e),r[2]=e}else i.push(r[2])}),i}interpolateRotations(e,n,r,i){let a=[],o=[];a.push(e.times[0]),o.push(t.MathUtils.degToRad(e.values[0])),o.push(t.MathUtils.degToRad(n.values[0])),o.push(t.MathUtils.degToRad(r.values[0]));for(let s=1;s<e.values.length;s++){let c=[e.values[s-1],n.values[s-1],r.values[s-1]];if(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))continue;let l=c.map(t.MathUtils.degToRad),u=[e.values[s],n.values[s],r.values[s]];if(isNaN(u[0])||isNaN(u[1])||isNaN(u[2]))continue;u.map(t.MathUtils.degToRad);let d=[u[0]-c[0],u[1]-c[1],u[2]-c[2]],f=[Math.abs(d[0]),Math.abs(d[1]),Math.abs(d[2])];if(f[0]>=180||f[1]>=180||f[2]>=180){let n=Math.max(...f)/180,r=new t.Euler(l[0],l[1],l[2],i),c=new t.Euler(l[0],l[1],l[2],i),u=new t.Quaternion().setFromEuler(r),d=new t.Quaternion().setFromEuler(c);u.dot(d)&&d.set(-d.x,-d.y,-d.z,-d.w);let p=e.times[s-1],m=e.times[s]-p,h=new t.Quaternion,g=new t.Euler;for(let e=0;e<1;e+=1/n)h.copy(u.clone().slerp(d.clone(),e)),a.push(p+e*m),g.setFromQuaternion(h,i),o.push(g.x),o.push(g.y),o.push(g.z)}else a.push(e.times[s]),o.push(t.MathUtils.degToRad(e.values[s])),o.push(t.MathUtils.degToRad(n.values[s])),o.push(t.MathUtils.degToRad(r.values[s]))}return[a,o]}},ul=class{constructor(){this.allNodes=new pl,this.nodeStack=[],this.currentIndent=0,this.currentPropName=``}getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),--this.currentIndent}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new pl,this.nodeStack=[],this.currentProp=[],this.currentPropName=``;let t=this,n=e.split(/[\r\n]+/);return n.forEach(function(e,r){let i=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);if(i||a)return;let o=e.match(`^\\t{`+t.currentIndent+`}(\\w+):(.*){`),s=e.match(`^\\t{`+t.currentIndent+`}(\\w+):[\\s\\t\\r\\n](.*)`),c=e.match(`^\\t{`+(t.currentIndent-1)+`}}`);o?t.parseNodeBegin(e,o):s?t.parseNodeProperty(e,s,n[++r]):c?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}),this.allNodes}parseNodeBegin(e,t){let n=t[1].trim().replace(/^"/,``).replace(/"$/,``),r=t[2].split(`,`).map(function(e){return e.trim().replace(/^"/,``).replace(/"$/,``)}),i={name:n},a=this.parseNodeAttr(r),o=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,i):n in o?(n===`PoseNode`?o.PoseNode.push(i):o[n].id!==void 0&&(o[n]={},o[n][o[n].id]=o[n]),a.id!==``&&(o[n][a.id]=i)):typeof a.id==`number`?(o[n]={},o[n][a.id]=i):n!==`Properties70`&&(n===`PoseNode`?o[n]=[i]:o[n]=i),typeof a.id==`number`&&(i.id=a.id),a.name!==``&&(i.attrName=a.name),a.type!==``&&(i.attrType=a.type),this.pushStack(i)}parseNodeAttr(e){let t=e[0];e[0]!==``&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n=``,r=``;return e.length>1&&(n=e[1].replace(/^(\w+)::/,``),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,``).replace(/"$/,``).trim(),i=t[2].replace(/^"/,``).replace(/"$/,``).trim();r===`Content`&&i===`,`&&(i=n.replace(/"/g,``).replace(/,$/,``).trim());let a=this.getCurrentNode();if(a.name===`Properties70`){this.parseNodeSpecialProperty(e,r,i);return}if(r===`C`){let e=i.split(`,`).slice(1),t=parseInt(e[0]),n=parseInt(e[1]),o=i.split(`,`).slice(3);o=o.map(function(e){return e.trim().replace(/^"/,``)}),r=`connections`,i=[t,n],El(i,o),a[r]===void 0&&(a[r]=[])}r===`Node`&&(a.id=i),r in a&&Array.isArray(a[r])?a[r].push(i):r===`a`?a.a=i:a[r]=i,this.setCurrentProp(a,r),r===`a`&&i.slice(-1)!==`,`&&(a.a=wl(i))}parseNodePropertyContinued(e){let t=this.getCurrentNode();t.a+=e,e.slice(-1)!==`,`&&(t.a=wl(t.a))}parseNodeSpecialProperty(e,t,n){let r=n.split(`",`).map(function(e){return e.trim().replace(/^\"/,``).replace(/\s/,`_`)}),i=r[0],a=r[1],o=r[2],s=r[3],c=r[4];switch(a){case`int`:case`enum`:case`bool`:case`ULongLong`:case`double`:case`Number`:case`FieldOfView`:c=parseFloat(c);break;case`Color`:case`ColorRGB`:case`Vector3D`:case`Lcl_Translation`:case`Lcl_Rotation`:case`Lcl_Scaling`:c=wl(c);break}this.getPrevNode()[i]={type:a,type2:o,flag:s,value:c},this.setCurrentProp(this.getPrevNode(),i)}},dl=class{parse(e){let t=new fl(e);t.skip(23);let n=t.getUint32();if(n<6400)throw Error(`THREE.FBXLoader: FBX version not supported, FileVersion: `+n);let r=new pl;for(;!this.endOfContent(t);){let e=this.parseNode(t,n);e!==null&&r.add(e.name,e)}return r}endOfContent(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){let n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();let a=e.getUint8(),o=e.getString(a);if(r===0)return null;let s=[];for(let t=0;t<i;t++)s.push(this.parseProperty(e));let c=s.length>0?s[0]:``,l=s.length>1?s[1]:``,u=s.length>2?s[2]:``;for(n.singleProperty=i===1&&e.getOffset()===r;r>e.getOffset();){let r=this.parseNode(e,t);r!==null&&this.parseSubNode(o,n,r)}return n.propertyList=s,typeof c==`number`&&(n.id=c),l!==``&&(n.attrName=l),u!==``&&(n.attrType=u),o!==``&&(n.name=o),n}parseSubNode(e,t,n){if(n.singleProperty===!0){let e=n.propertyList[0];Array.isArray(e)?(t[n.name]=n,n.a=e):t[n.name]=e}else if(e===`Connections`&&n.name===`C`){let e=[];n.propertyList.forEach(function(t,n){n!==0&&e.push(t)}),t.connections===void 0&&(t.connections=[]),t.connections.push(e)}else if(n.name===`Properties70`)Object.keys(n).forEach(function(e){t[e]=n[e]});else if(e===`Properties70`&&n.name===`P`){let e=n.propertyList[0],r=n.propertyList[1],i=n.propertyList[2],a=n.propertyList[3],o;e.indexOf(`Lcl `)===0&&(e=e.replace(`Lcl `,`Lcl_`)),r.indexOf(`Lcl `)===0&&(r=r.replace(`Lcl `,`Lcl_`)),o=r===`Color`||r===`ColorRGB`||r===`Vector`||r===`Vector3D`||r.indexOf(`Lcl_`)===0?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[e]={type:r,type2:i,flag:a,value:o}}else t[n.name]===void 0?typeof n.id==`number`?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name===`PoseNode`?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){let t=e.getString(1),n;switch(t){case`C`:return e.getBoolean();case`D`:return e.getFloat64();case`F`:return e.getFloat32();case`I`:return e.getInt32();case`L`:return e.getInt64();case`R`:return n=e.getUint32(),e.getArrayBuffer(n);case`S`:return n=e.getUint32(),e.getString(n);case`Y`:return e.getInt16();case`b`:case`c`:case`d`:case`f`:case`i`:case`l`:let r=e.getUint32(),i=e.getUint32(),a=e.getUint32();if(i===0)switch(t){case`b`:case`c`:return e.getBooleanArray(r);case`d`:return e.getFloat64Array(r);case`f`:return e.getFloat32Array(r);case`i`:return e.getInt32Array(r);case`l`:return e.getInt64Array(r)}let o=new fl(Zc(new Uint8Array(e.getArrayBuffer(a))).buffer);switch(t){case`b`:case`c`:return o.getBooleanArray(r);case`d`:return o.getFloat64Array(r);case`f`:return o.getFloat32Array(r);case`i`:return o.getInt32Array(r);case`l`:return o.getInt64Array(r)}break;default:throw Error(`THREE.FBXLoader: Unknown property type `+t)}}},fl=class{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t===void 0?!0:t,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)==1}getBooleanArray(e){let t=[];for(let n=0;n<e;n++)t.push(this.getBoolean());return t}getUint8(){let e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){let e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){let e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt32());return t}getUint32(){let e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){let e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat32());return t}getFloat64(){let e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){let t=[];for(let n=0;n<e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){let t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=this.offset,n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);let r=n.indexOf(0);return r>=0&&(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}},pl=class{constructor(){this.Connections={connections:[]},this.Objects={Model:{},NodeAttribute:{},Geometry:{}},this.GlobalSettings={}}add(e,t){this[e]=t}};function ml(e){return e.byteLength>=21&&Tl(e,0,21)===`Kaydara FBX Binary \0`}function hl(e){let t=[`K`,`a`,`y`,`d`,`a`,`r`,`a`,`\\`,`F`,`B`,`X`,`\\`,`B`,`i`,`n`,`a`,`r`,`y`,`\\`,`\\`],n=0;function r(t){let r=e[t-1];return e=e.slice(n+t),n++,r}for(let e=0;e<t.length;++e)if(r(1)===t[e])return!1;return!0}function gl(e){let t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw Error(`THREE.FBXLoader: Cannot find the version number for the file given.`)}function _l(e){return e/46186158e3}var vl=[];function yl(e,t,n,r){let i;switch(r.mappingType){case`ByPolygonVertex`:i=e;break;case`ByPolygon`:i=t;break;case`ByVertice`:i=n;break;case`AllSame`:i=r.indices[0];break;default:console.warn(`THREE.FBXLoader: unknown attribute mapping type `+r.mappingType),i=0}r.referenceType===`IndexToDirect`&&(i=r.indices[i]);let a=i*r.dataSize,o=a+r.dataSize;return Dl(vl,r.buffer,a,o)}var bl=new t.Euler,xl=new t.Vector3;function Sl(e){let n=new t.Matrix4,r=new t.Matrix4,i=new t.Matrix4,a=new t.Matrix4,o=new t.Matrix4,s=new t.Matrix4,c=new t.Matrix4,l=new t.Matrix4,u=new t.Matrix4,d=new t.Matrix4,f=new t.Matrix4,p=new t.Matrix4,m=e.inheritType?e.inheritType:0;e.translation&&n.setPosition(xl.fromArray(e.translation));let h=Cl(0);if(e.preRotation){let n=e.preRotation.map(t.MathUtils.degToRad);n.push(h),r.makeRotationFromEuler(bl.fromArray(n))}if(e.rotation){let n=e.rotation.map(t.MathUtils.degToRad);n.push(e.eulerOrder||h),i.makeRotationFromEuler(bl.fromArray(n))}if(e.postRotation){let n=e.postRotation.map(t.MathUtils.degToRad);n.push(h),a.makeRotationFromEuler(bl.fromArray(n)),a.copy(new t.Matrix4().getInverse(a))}e.scale&&o.scale(xl.fromArray(e.scale)),e.scalingOffset&&c.setPosition(xl.fromArray(e.scalingOffset)),e.scalingPivot&&s.setPosition(xl.fromArray(e.scalingPivot)),e.rotationOffset&&l.setPosition(xl.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(xl.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(f.copy(e.parentMatrix),d.copy(e.parentMatrixWorld));let g=r.clone().multiply(i).multiply(a),_=new t.Matrix4;_.extractRotation(d);let v=new t.Matrix4;v.copyPosition(d);let y=new t.Matrix4().getInverse(v).multiply(d),b=new t.Matrix4().getInverse(_).multiply(y),x=o,S=new t.Matrix4;if(m===0)S.copy(_).multiply(g).multiply(b).multiply(x);else if(m===1)S.copy(_).multiply(b).multiply(g).multiply(x);else{let e=new t.Matrix4().scale(new t.Vector3().setFromMatrixScale(f)),n=new t.Matrix4().getInverse(e),r=b.clone().multiply(n);S.copy(_).multiply(g).multiply(r).multiply(x)}let C=new t.Matrix4().getInverse(u),w=new t.Matrix4().getInverse(s),T=n.clone().multiply(l).multiply(u).multiply(r).multiply(i).multiply(a).multiply(C).multiply(c).multiply(s).multiply(o).multiply(w),E=new t.Matrix4().copyPosition(T),D=d.clone().multiply(E);return p.copyPosition(D),T=p.clone().multiply(S),T.premultiply(new t.Matrix4().getInverse(d)),T}function Cl(e){e=e||0;let t=[`ZYX`,`YZX`,`XZY`,`ZXY`,`YXZ`,`XYZ`];return e===6?(console.warn(`THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.`),t[0]):t[e]}function wl(e){return e.split(`,`).map(function(e){return parseFloat(e)})}function Tl(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=e.byteLength),new TextDecoder().decode(new Uint8Array(e,t,n))}function El(e,t){for(let n=0,r=e.length,i=t.length;n<i;n++,r++)e[r]=t[n]}function Dl(e,t,n,r){for(let i=n,a=0;i<r;i++,a++)e[a]=t[i];return e}var Ol=class extends t.Curve{constructor(e,n,r,i,a){super();let o=n?n.length-1:0,s=r?r.length:0;this.degree=e,this.knots=n,this.controlPoints=[],this.startKnot=i||0,this.endKnot=a||o;for(let e=0;e<s;++e){let n=r[e];this.controlPoints[e]=new t.Vector4(n.x,n.y,n.z,n.w)}}getPoint(e,n=new t.Vector3){let r=n,i=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),a=jl(this.degree,this.knots,this.controlPoints,i);return a.w!==1&&a.divideScalar(a.w),r.set(a.x,a.y,a.z)}getTangent(e,n=new t.Vector3){let r=n,i=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),a=Il(this.degree,this.knots,this.controlPoints,i,1);return r.copy(a[1]).normalize(),r}toJSON(){let e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(e=>e.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(e=>new t.Vector4(e[0],e[1],e[2],e[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}};function kl(e,t,n){let r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;let i=e,a=r,o=Math.floor((i+a)/2);for(;t<n[o]||t>=n[o+1];)t<n[o]?a=o:i=o,o=Math.floor((i+a)/2);return o}function Al(e,t,n,r){let i=[],a=[],o=[];i[0]=1;for(let s=1;s<=n;++s){a[s]=t-r[e+1-s],o[s]=r[e+s]-t;let n=0;for(let e=0;e<s;++e){let t=o[e+1],r=a[s-e],c=i[e]/(t+r);i[e]=n+t*c,n=r*c}i[s]=n}return i}function jl(e,n,r,i){let a=kl(e,i,n),o=Al(a,i,e,n),s=new t.Vector4(0,0,0,0);for(let t=0;t<=e;++t){let n=r[a-e+t],i=o[t],c=n.w*i;s.x+=n.x*c,s.y+=n.y*c,s.z+=n.z*c,s.w+=n.w*i}return s}function Ml(e,t,n,r,i){let a=[];for(let e=0;e<=n;++e)a[e]=0;let o=[];for(let e=0;e<=r;++e)o[e]=a.slice(0);let s=[];for(let e=0;e<=n;++e)s[e]=a.slice(0);s[0][0]=1;let c=a.slice(0),l=a.slice(0);for(let r=1;r<=n;++r){c[r]=t-i[e+1-r],l[r]=i[e+r]-t;let n=0;for(let e=0;e<r;++e){let t=l[e+1],i=c[r-e];s[r][e]=t+i;let a=s[e][r-1]/s[r][e];s[e][r]=n+t*a,n=i*a}s[r][r]=n}for(let e=0;e<=n;++e)o[0][e]=s[e][n];for(let e=0;e<=n;++e){let t=0,i=1,c=[];for(let e=0;e<=n;++e)c[e]=a.slice(0);c[0][0]=1;for(let a=1;a<=r;++a){let r=0,l=e-a,u=n-a;e>=a&&(c[i][0]=c[t][0]/s[u+1][l],r=c[i][0]*s[l][u]);let d=l>=-1?1:-l,f=e-1<=u?a-1:n-e;for(let e=d;e<=f;++e)c[i][e]=(c[t][e]-c[t][e-1])/s[u+1][l+e],r+=c[i][e]*s[l+e][u];e<=u&&(c[i][a]=-c[t][a-1]/s[u+1][e],r+=c[i][a]*s[e][u]),o[a][e]=r;let p=t;t=i,i=p}}let u=n;for(let e=1;e<=r;++e){for(let t=0;t<=n;++t)o[e][t]*=u;u*=n-e}return o}function Nl(e,n,r,i,a){let o=a<e?a:e,s=[],c=kl(e,i,n),l=Ml(c,i,e,o,n),u=[];for(let e=0;e<r.length;++e){let t=r[e].clone(),n=t.w;t.x*=n,t.y*=n,t.z*=n,u[e]=t}for(let t=0;t<=o;++t){let n=u[c-e].clone().multiplyScalar(l[t][0]);for(let r=1;r<=e;++r)n.add(u[c-e+r].clone().multiplyScalar(l[t][r]));s[t]=n}for(let e=o+1;e<=a+1;++e)s[e]=new t.Vector4(0,0,0);return s}function Pl(e,t){let n=1;for(let t=2;t<=e;++t)n*=t;let r=1;for(let e=2;e<=t;++e)r*=e;for(let n=2;n<=e-t;++n)r*=n;return n/r}function Fl(e){let n=e.length,r=[],i=[];for(let a=0;a<n;++a){let n=e[a];r[a]=new t.Vector3(n.x,n.y,n.z),i[a]=n.w}let a=[];for(let e=0;e<n;++e){let t=r[e].clone();for(let n=1;n<=e;++n)t.sub(a[e-n].clone().multiplyScalar(Pl(e,n)*i[n]));a[e]=t.divideScalar(i[0])}return a}function Il(e,t,n,r,i){return Fl(Nl(e,t,n,r,i))}var Ll=new t.Vector3;function Rl(e,t){switch(t){case`D`:return new Float64Array(e);case`F`:return new Float32Array(e);case`L`:return new Int32Array(e);case`I`:return new Int16Array(e);default:return new Uint8Array(e)}}function zl(e,n={}){var r,i,a;let o=(r=n.upAxis)==null?`Z`:r,s=(i=n.fetcher)==null?ur:i,c=(a=n.onDownloadProgress)==null?G:a,l={byteLength:0};return Promise.resolve().then(()=>s.ajax(e,{responseType:`arraybuffer`},void 0,void 0,c)).then(t=>{var r,i;return l.byteLength=t.body.byteLength,Bl(new Uint8Array(t.body),{light:(r=n.light)==null?!0:r,color:n.color,resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(i=e.split(`?`)[1])==null?``:i,fetcher:s})}).then(n=>{let r=new t.Group;return r.name=e,r.add(n.object),o===`Y`&&r.applyMatrix4(Jn),{type:`x3p`,modelUpAxis:`Z`,upAxis:o,uri:e,byteLength:l.byteLength,memoryUsage:Di(r),scene:r,textures:[],animations:[],dispose:()=>n.dispose()}})}function Bl(e,n){var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,ee,te,ne,re,ie,ae,oe,se,ce,le,P,ue,de,fe,pe,me,he,ge,_e,ve,ye,be,xe;let Se=il(e),Ce=``,we=null;for(let e of Object.keys(Se))/(^|\/)main\.xml$/i.test(e)&&(we=Se[e],Ce=e.slice(0,e.lastIndexOf(`/`)+1));if(!we)throw Error(`X3p: main.xml not found.`);if(typeof DOMParser>`u`)throw Error(`X3p: DOMParser not found.`);let Te=(r=n.color)==null?new t.Color(10066329):r,Ee=new DOMParser,De=za(we),Oe=Ee.parseFromString(De,`text/xml`),F=Oe.querySelector(`Record1 Axes`),ke={x:{type:(o=(a=(i=F==null?void 0:F.querySelector(`CX AxisType`))==null?void 0:i.textContent)==null?void 0:a.toUpperCase())==null?`I`:o,dataType:(l=(c=(s=F==null?void 0:F.querySelector(`CX DataType`))==null?void 0:s.textContent)==null?void 0:c.toUpperCase())==null?`D`:l,increment:Number((d=(u=F==null?void 0:F.querySelector(`CX Increment`))==null?void 0:u.textContent)==null?`1`:d),offset:Number((p=(f=F==null?void 0:F.querySelector(`CX Offset`))==null?void 0:f.textContent)==null?`0`:p)},y:{type:(g=(h=(m=F==null?void 0:F.querySelector(`CY AxisType`))==null?void 0:m.textContent)==null?void 0:h.toUpperCase())==null?`I`:g,dataType:(y=(v=(_=F==null?void 0:F.querySelector(`CY DataType`))==null?void 0:_.textContent)==null?void 0:v.toUpperCase())==null?`D`:y,increment:Number((x=(b=F==null?void 0:F.querySelector(`CY Increment`))==null?void 0:b.textContent)==null?`1`:x),offset:Number((C=(S=F==null?void 0:F.querySelector(`CY Offset`))==null?void 0:S.textContent)==null?`0`:C)},z:{type:(E=(T=(w=F==null?void 0:F.querySelector(`CZ AxisType`))==null?void 0:w.textContent)==null?void 0:T.toUpperCase())==null?`A`:E,dataType:(k=(O=(D=F==null?void 0:F.querySelector(`CZ DataType`))==null?void 0:D.textContent)==null?void 0:O.toUpperCase())==null?`D`:k,increment:Number((j=(A=F==null?void 0:F.querySelector(`CZ Increment`))==null?void 0:A.textContent)==null?`1`:j),offset:Number((N=(M=F==null?void 0:F.querySelector(`CZ Offset`))==null?void 0:M.textContent)==null?`0`:N)}},Ae=null,je=Oe.querySelector(`Record1 Axes Rotation`);je&&(Ae=new t.Matrix3,Ae.set(Number((te=(ee=je.querySelector(`r11`))==null?void 0:ee.textContent)==null?0:te),Number((re=(ne=je.querySelector(`r12`))==null?void 0:ne.textContent)==null?0:re),Number((ae=(ie=je.querySelector(`r13`))==null?void 0:ie.textContent)==null?0:ae),Number((se=(oe=je.querySelector(`r21`))==null?void 0:oe.textContent)==null?0:se),Number((le=(ce=je.querySelector(`r22`))==null?void 0:ce.textContent)==null?0:le),Number((ue=(P=je.querySelector(`r23`))==null?void 0:P.textContent)==null?0:ue),Number((fe=(de=je.querySelector(`r31`))==null?void 0:de.textContent)==null?0:fe),Number((me=(pe=je.querySelector(`r32`))==null?void 0:pe.textContent)==null?0:me),Number((ge=(he=je.querySelector(`r33`))==null?void 0:he.textContent)==null?0:ge)));let I=(_e=Oe.querySelector(`Record3 DataLink PointDataLink`))==null?void 0:_e.textContent;if(typeof I!=`string`)throw Error(`X3p: PointDataLink not found.`);I=_r(Ce,I);let Me=Se[I];if(!Me)throw Error(`X3p: ${Me} not found.`);let Ne=Rl(Me.buffer,ke.z.dataType),Pe=Number((ye=(ve=Oe.querySelector(`Record3 MatrixDimension SizeX`))==null?void 0:ve.textContent)==null?`0`:ye),Fe=Number((xe=(be=Oe.querySelector(`Record3 MatrixDimension SizeY`))==null?void 0:be.textContent)==null?`0`:xe),Ie=Math.floor(Pe-1),Le=Math.floor(Fe-1),Re=Ie+1,ze=Le+1,Be=new Float32Array(Re*ze*3),Ve=new Float32Array(Re*ze*2),He=new Uint32Array(Ie*Le*6),Ue=new t.Box3;for(let e=0;e<ze;e++){let t=e*ke.y.increment+ke.y.offset;for(let n=0;n<Re;n++){let r=e*Re+n,i=n*ke.x.increment+ke.x.offset,a=Ne[r],o=!isNaN(a),s=o?a:NaN;Ll.set(i,-t,s),Ae&&Ll.applyMatrix3(Ae),o&&Ue.expandByPoint(Ll),Be[r*3+0]=Ll.x,Be[r*3+1]=Ll.y,Be[r*3+2]=Ll.z,Ve[r*2+0]=n/Ie,Ve[r*2+1]=1-e/Le}}for(let e=0;e<Le;e++)for(let t=0;t<Ie;t++){let n=t+Re*e,r=t+Re*(e+1),i=t+1+Re*(e+1),a=t+1+Re*e,o=(e*Ie+t)*6;He[o+0]=n,He[o+1]=r,He[o+2]=a,He[o+3]=r,He[o+4]=i,He[o+5]=a}let We=new t.BufferGeometry;We.setAttribute(`position`,new t.BufferAttribute(Be,3)),We.setAttribute(`uv`,new t.BufferAttribute(Ve,2)),We.setIndex(new t.BufferAttribute(He,1)),(!We.groups||We.groups.length===0)&&We.addGroup(0,We.index?We.index.count:We.attributes.position.count,0),We.boundingBox=Ue;let Ge=new pn(n.light?`phong`:`basic`);return Ge.flatShading=!0,Ge.color.copy(Te),{object:new mn(We,[Ge]),dispose:()=>{We.dispose(),Ge.dispose()}}}var Vl;(function(e){e[e.Outside=-1]=`Outside`,e[e.Intersecting=0]=`Intersecting`,e[e.Inside=1]=`Inside`})(Vl||(Vl={}));var Hl=1e-6,Ul=new t.Matrix4().identity(),Y=new t.Vector3,Wl=new t.Matrix4,Gl=new t.Vector3,Kl=new t.Vector3,ql=new t.Vector3,Jl=new t.Vector3,Yl=new t.Box3,Xl=new t.Sphere,Zl=new t.Matrix4,Ql=new t.Ray,$l=new t.Object3D,eu=new t.Frustum;function tu(e,t){let n=e.elements;return t.setFromRotationMatrix(Wl.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1)),t}var nu=class e{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(e=[]){this.planes=e}setFromFrustum(e){return this.planes=e.planes.map(e=>e.clone()),this}setFromCamera(e){return Wl.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),eu.setFromProjectionMatrix(Wl),this.setFromFrustum(eu),this}applyMatrix4(e){for(let t of this.planes)t.applyMatrix4(e)}copy(e){return this.planes=e.planes.map(e=>e.clone()),this}clone(){return new e().copy(this)}computeVisibility(e){let t=Vl.Inside;for(let n of this.planes)switch(e.intersectPlane(n)){case Vl.Outside:return Vl.Outside;case Vl.Intersecting:t=Vl.Intersecting;break;default:}return t}computeVisibilityWithPlaneMask(t,n){if(n===e.MASK_OUTSIDE||n===e.MASK_INSIDE)return n;let r=e.MASK_INSIDE,i=Math.min(32,this.planes.length);for(let a=0;a<i;++a){let i=1<<a;if((n&i)===0)continue;let o=this.planes[a],s=t.intersectPlane(o);if(s===Vl.Outside)return e.MASK_OUTSIDE;s===Vl.Intersecting&&(r|=i)}return r}},ru=class e{constructor(){this.type=`box`,this.center=new t.Vector3,this.halfSize=new t.Vector3,this.rotation=new t.Matrix3}fromJson({box:e}){this.center.set(e[0],e[1],e[2]);let t=e[3],n=e[4],r=e[5],i=e[6],a=e[7],o=e[8],s=e[9],c=e[10],l=e[11],u=Math.max(Math.sqrt(t*t+n*n+r*r),.001),d=Math.max(Math.sqrt(i*i+a*a+o*o),.001),f=Math.max(Math.sqrt(s*s+c*c+l*l),.001);this.halfSize.set(u,d,f);let p=this.halfSize.toArray().reduce((e,t)=>e+t,0);return(isNaN(p)||p<=0)&&this.halfSize.setScalar(Hl),this.rotation.fromArray([t/u,n/u,r/u,i/d,a/d,o/d,s/f,c/f,l/f]),isNaN(this.rotation.toArray().reduce((e,t)=>e+t,0))&&this.rotation.identity(),this}toJson(){return this.rotation.extractBasis(Gl,Kl,ql),{box:[...this.center.toArray(),...Gl.multiplyScalar(this.halfSize.x).toArray(),...Kl.multiplyScalar(this.halfSize.y).toArray(),...ql.multiplyScalar(this.halfSize.z).toArray()]}}copy(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this}clone(){return new e().copy(this)}applyMatrix4(e){return e.equals(Ul)?this:($l.position.copy(this.center),tu(this.rotation,$l.quaternion),$l.scale.copy(this.halfSize),$l.matrix.compose($l.position,$l.quaternion,$l.scale),$l.matrix.premultiply(e),$l.matrix.decompose($l.position,$l.quaternion,$l.scale),this.center.copy($l.position),this.rotation.setFromMatrix4(Wl.makeRotationFromQuaternion($l.quaternion)),this.halfSize.copy($l.scale),this)}getCenter(e){return e.copy(this.center)}distanceSquaredToPoint(e){let t=this.rotation.elements,n=e.x-this.center.x,r=e.y-this.center.y,i=e.z-this.center.z,a=0,o;return o=n*t[0]+r*t[1]+i*t[2],o<0&&(o=-o),o-=this.halfSize.x,o>0&&(a+=o*o),o=n*t[3]+r*t[4]+i*t[5],o<0&&(o=-o),o-=this.halfSize.y,o>0&&(a+=o*o),o=n*t[6]+r*t[7]+i*t[8],o<0&&(o=-o),o-=this.halfSize.z,o>0&&(a+=o*o),a}distanceToPoint(e){return Math.sqrt(this.distanceSquaredToPoint(e))}distanceToPlane(e){let n=e.projectPoint(this.center,new t.Vector3);return this.distanceToPoint(n)}getBoundingBox(e){return e.makeEmpty(),this.rotation.extractBasis(Gl,Kl,ql),Gl.setLength(this.halfSize.x),Kl.setLength(this.halfSize.y),ql.setLength(this.halfSize.z),e.expandByPoint(Y.copy(this.center).add(Gl)),e.expandByPoint(Y.copy(this.center).sub(Gl)),e.expandByPoint(Y.copy(this.center).add(Kl)),e.expandByPoint(Y.copy(this.center).sub(Kl)),e.expandByPoint(Y.copy(this.center).add(ql)),e.expandByPoint(Y.copy(this.center).sub(ql)),e}toGeometry(){let e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24);Y.set(this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(n,0),Y.set(-this.halfSize.x,this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(n,3),Y.set(-this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(n,6),Y.set(this.halfSize.x,-this.halfSize.y,this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(n,9),Y.set(this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(n,12),Y.set(-this.halfSize.x,this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(n,15),Y.set(-this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(n,18),Y.set(this.halfSize.x,-this.halfSize.y,-this.halfSize.z).applyMatrix3(this.rotation).add(this.center).toArray(n,21);let r=new t.BufferGeometry;return r.setIndex(new t.BufferAttribute(e,1)),r.setAttribute(`position`,new t.BufferAttribute(n,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r}intersectPlane(e){let t=this.center,n=e.normal,r=this.rotation.elements,i=this.halfSize,a=n.x,o=n.y,s=n.z,c=Math.abs(a*r[0]*i.x+o*r[1]*i.x+s*r[2]*i.x)+Math.abs(a*r[3]*i.y+o*r[4]*i.y+s*r[5]*i.y)+Math.abs(a*r[6]*i.z+o*r[7]*i.z+s*r[8]*i.z),l=n.dot(t)+e.constant;return l<=-c?Vl.Outside:l>=c?Vl.Inside:Vl.Intersecting}intersectRay(e,t=0,n){if(Jl.copy(this.halfSize).multiplyScalar(2),Yl.setFromCenterAndSize(Y.set(0,0,0),Jl),Yl.expandByScalar(t),this.rotation.extractBasis(Gl,Kl,ql),Wl.makeBasis(Gl,Kl,ql),Wl.setPosition(this.center),Zl.getInverse(Wl),Ql.copy(e).applyMatrix4(Zl),Yl.containsPoint(Ql.origin))return!0;let r=Ql.intersectBox(Yl,Y);return r?n===void 0?!0:(n+=t,r.distanceToSquared(Ql.origin)<=n*n):!1}},iu=class e{constructor(){this.type=`sphere`,this.center=new t.Vector3,this.radius=-1}fromJson({sphere:e}){return this.center.set(e[0],e[1],e[2]),this.radius=Math.max(e[3],Hl),this}toJson(){return{sphere:[...this.center.toArray(),this.radius]}}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}clone(){return new e().copy(this)}getBoundingBox(e){return e.setFromCenterAndSize(this.center,Jl.set(1,1,1).multiplyScalar(this.radius*2)),e}toGeometry(){let e=new Float32Array(384);for(let t=0;t<=32;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=this.center.x+Math.cos(n)*this.radius,e[t*6+1]=this.center.y+Math.sin(n)*this.radius,e[t*6+2]=this.center.z+0,n=(t+1)/32*Math.PI*2,e[t*6+3]=this.center.x+Math.cos(n)*this.radius,e[t*6+4]=this.center.y+Math.sin(n)*this.radius,e[t*6+5]=this.center.z+0}for(let t=32;t<=64;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=this.center.x+Math.cos(n)*this.radius,e[t*6+1]=this.center.y+0,e[t*6+2]=this.center.z+Math.sin(n)*this.radius,n=(t+1)/32*Math.PI*2,e[t*6+3]=this.center.x+Math.cos(n)*this.radius,e[t*6+4]=this.center.y+0,e[t*6+5]=this.center.z+Math.sin(n)*this.radius}let n=new t.BufferGeometry;return n.setAttribute(`position`,new t.BufferAttribute(e,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n}applyMatrix4(e){return e.equals(Ul)?this:(this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this)}getCenter(e){return e.copy(this.center)}distanceSquaredToPoint(e){let t=this.distanceToPoint(e);return t*t}distanceToPoint(e){let t=this.center.distanceTo(e)-this.radius;return t<=0?0:t}distanceToPlane(e){let t=Math.abs(e.distanceToPoint(this.center));return Math.max(0,t-this.radius)}intersectPlane(e){let t=this.center,n=this.radius,r=e.normal.dot(t)+e.constant;return r<-n?Vl.Outside:r<n?Vl.Intersecting:Vl.Inside}intersectRay(e,t=0,n){if(Xl.set(this.center,this.radius+t),Xl.containsPoint(e.origin))return!0;let r=e.intersectSphere(Xl,Y);return r?n===void 0?!0:(n+=t,e.origin.distanceToSquared(r)<=n*n):!1}},au=class e{constructor(){throw this.type=`regin`,this.west=0,this.south=0,this.east=0,this.north=0,this.minHeight=0,this.maxHeight=0,Error(`Region bounding volume not supported.`)}fromJson({region:e}){return this.west=e[0],this.south=e[1],this.east=e[2],this.north=e[3],this.minHeight=e[4],this.maxHeight=e[5],this}toJson(){return{region:[this.west,this.south,this.east,this.north,this.minHeight,this.maxHeight]}}copy(e){return this.west=e.west,this.south=e.south,this.east=e.east,this.north=e.north,this.minHeight=e.minHeight,this.maxHeight=e.maxHeight,this}clone(){return new e().copy(this)}getBoundingBox(e){throw Error(`not implemented`)}toGeometry(){throw Error(`not implemented`)}applyMatrix4(e){throw Error(`not implemented`)}getCenter(e){throw Error(`not implemented`)}distanceToPoint(e){throw Error(`not implemented`)}distanceSquaredToPoint(e){throw Error(`not implemented`)}distanceToPlane(e){throw Error(`not implemented`)}intersectPlane(e){throw Error(`not implemented`)}intersectRay(e,t=0,n){throw Error(`not implemented`)}};function ou(e){return e instanceof ru||e instanceof iu||e instanceof au}function su(e){if(ou(e))return e;if(`box`in e)return new ru().fromJson(e);if(`sphere`in e)return new iu().fromJson(e);if(`region`in e)return new au().fromJson(e);throw Error(`BoundingVolume ${JSON.stringify(e)} never suppored.`)}var cu=[4821759,8191922,16637280,16739958,5822969,376977,16747077,9259235,14514687].map(e=>new t.LineBasicMaterial({color:e,depthWrite:!1,depthTest:!0,transparent:!0,opacity:.5})),lu=(()=>{let e=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24);Y.set(1,1,1).toArray(n,0),Y.set(-1,1,1).toArray(n,3),Y.set(-1,-1,1).toArray(n,6),Y.set(1,-1,1).toArray(n,9),Y.set(1,1,-1).toArray(n,12),Y.set(-1,1,-1).toArray(n,15),Y.set(-1,-1,-1).toArray(n,18),Y.set(1,-1,-1).toArray(n,21);let r=new t.BufferGeometry;return r.setIndex(new t.BufferAttribute(e,1)),r.setAttribute(`position`,new t.BufferAttribute(n,3)),r.computeBoundingBox(),r.computeBoundingSphere(),r})(),uu=(()=>{let e=new Float32Array(384);for(let t=0;t<=32;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=Math.cos(n),e[t*6+1]=Math.sin(n),e[t*6+2]=0,n=(t+1)/32*Math.PI*2,e[t*6+3]=Math.cos(n),e[t*6+4]=Math.sin(n),e[t*6+5]=0}for(let t=32;t<=64;t++){let n=0;n=t/32*Math.PI*2,e[t*6+0]=Math.cos(n),e[t*6+1]=0,e[t*6+2]=Math.sin(n),n=(t+1)/32*Math.PI*2,e[t*6+3]=Math.cos(n),e[t*6+4]=0,e[t*6+5]=Math.sin(n)}let n=new t.BufferGeometry;return n.setAttribute(`position`,new t.BufferAttribute(e,3)),n.computeBoundingBox(),n.computeBoundingSphere(),n})();function du(e,n=0){if(e instanceof ru){let r=new t.LineSegments(lu,cu[Math.min(n,cu.length-1)]);return r.position.copy(e.center),tu(e.rotation,r.quaternion),r.scale.set(e.halfSize.x,e.halfSize.y,e.halfSize.z),r.matrix.compose(r.position,r.quaternion,r.scale),r}else if(e instanceof iu){let r=new t.LineSegments(uu,cu[Math.min(n,cu.length-1)]);return r.position.copy(e.center),r.scale.set(e.radius,e.radius,e.radius),r.matrix.compose(r.position,r.quaternion,r.scale),r}return null}var fu=new t.Vector3,pu=new t.Plane,mu=new iu,hu=new ru,gu=class e{constructor(n,r,i,a){var o,s,c,l;this.parent=null,this.contentParent=null,this.floor=0,this.id=n,this.state={visible:!1,frameNumber:0,selectedFrameNumber:0,requestedFrameNumber:0,touchedFrameNumber:0,distanceToCamera:0,centerZDepth:0,centerScreenY:0,screenSpaceError:0,visibilityPlaneMask:0,inRequestVolume:!1,shouldRefine:!1,stackLength:0,finalResolution:!0,selectionDepth:0,shouldSelect:!1,lastSelect:!1,ancestorWithContent:null,ancestorWithContentAvailable:null},this.parent=a==null?null:a,this.contentParent=a?a.hasRenderContent?a:a.contentParent:null,this.level=this.parent?this.parent.level+1:0,this.tileset=i,this.refine=(o=r.refine)==null?this.parent?this.parent.refine:`REPLACE`:o,this.transform=new t.Matrix4,r.transform&&this.transform.fromArray(r.transform),this.parent&&this.transform.premultiply(this.parent.transform),typeof r.geometricError==`number`?this.geometricError=r.geometricError*this.transform.getMaxScaleOnAxis():this.geometricError=(c=(s=this.parent)==null?void 0:s.geometricError)==null?0:c,r.content&&r.content.uri?(this.content={uri:r.content.uri,loadState:`UNLOADED`,loadProgress:0,loadStateUpdateTime:V(),loadfailRetryDelay:0,byteLength:0,memoryUsage:0},r.content.group!==void 0&&(this.content.group=r.content.group),/\.json$/.test(this.content.uri)?this.type=`TILESET`:this.type=`SCENEGRAPH`):(this.content=null,this.type=`EMPTY`),this.levelOfContent=this.parent?this.parent.levelOfContent:-1,this.type===`SCENEGRAPH`&&(this.levelOfContent+=1),r.boundingVolume&&(this.boundingVolume=su(r.boundingVolume).applyMatrix4(this.transform)),r.viewerRequestVolume&&(this.viewerRequestVolume=su(r.viewerRequestVolume).applyMatrix4(this.transform)),this.extras=(l=r.extras)==null?{}:l,typeof this.extras.floor!=`number`&&a&&typeof a.extras.floor==`number`&&(this.extras.floor=a.extras.floor),typeof this.extras.floor==`number`&&(this.floor=this.extras.floor,this.tileset.floorLength=Math.max(this.tileset.floorLength,this.floor+1)),r.children?this.children=r.children.map((t,n)=>new e(`${this.id}.${n}`,t,i,this)):this.children=[]}traverse(e){e(this);for(let t of this.children)t.traverse(e)}updateState(e){this.state.frameNumber=e.frameNumber;let t=this.tileset.transform;if(this.boundingVolume){let n;n=this.boundingVolume instanceof ru?hu.copy(this.boundingVolume):this.boundingVolume instanceof iu?mu.copy(this.boundingVolume):this.boundingVolume.clone(),n.applyMatrix4(t),e.camera.type===`OrthographicCamera`?(pu.setFromNormalAndCoplanarPoint(e.camera.direction,e.camera.position),this.state.distanceToCamera=n.distanceToPlane(pu)):this.state.distanceToCamera=n.distanceToPoint(e.camera.position);let r=n.getCenter(fu).sub(e.camera.position);this.state.centerZDepth=e.camera.direction.dot(r),this.state.centerScreenY=e.camera.up.dot(r);let i=this.parent?this.parent.state.visibilityPlaneMask:nu.MASK_INDETERMINATE;this.state.visibilityPlaneMask=e.cullingVolume.computeVisibilityWithPlaneMask(n,i),this.state.visible=this.state.visibilityPlaneMask!==nu.MASK_OUTSIDE,e.cameraCulling||(this.state.visible=!0)}else this.state.distanceToCamera=0,this.state.centerZDepth=0,this.state.visibilityPlaneMask=nu.MASK_INDETERMINATE,this.state.visible=!0;if((this.levelOfContent<=e.minLevelOfDetail||this.geometricError>=e.maxGeometricError)&&(this.state.visible=!0),this.viewerRequestVolume){let n;n=this.viewerRequestVolume instanceof ru?hu.copy(this.viewerRequestVolume):this.viewerRequestVolume instanceof iu?mu.copy(this.viewerRequestVolume):this.viewerRequestVolume.clone(),n.applyMatrix4(t),this.state.inRequestVolume=n.distanceSquaredToPoint(e.camera.position)<=0}else this.state.inRequestVolume=!0;this.state.screenSpaceError=this.getScreenSpaceError(e,this.state.distanceToCamera,!1)}get selected(){return this.state.selectedFrameNumber===this.tileset.frameNumber}get hasChildren(){return this.children.length>0}get siblingIndex(){var e,t;return(t=(e=this.parent)==null?void 0:e.children.indexOf(this))==null?0:t}get hasTilesetContent(){return this.children.length>0&&this.type===`TILESET`}get hasRenderContent(){return this.type===`SCENEGRAPH`}get contentAvailable(){var e;return this.hasRenderContent&&((e=this.content)==null?void 0:e.loadState)===`READY`}get hasUnloadedContent(){var e;return((e=this.content)==null?void 0:e.loadState)===`UNLOADED`}get hasEmptyContent(){return this.type===`EMPTY`}get contentReady(){var e;return((e=this.content)==null?void 0:e.loadState)===`READY`||this.hasEmptyContent}get contentByteLength(){return this.content?this.content.byteLength:0}get contentMemoryUsage(){return this.content?this.content.memoryUsage:0}getScreenSpaceError(e,t,n){let r=this.tileset.transform.getMaxScaleOnAxis(),i=this.parent?this.parent.geometricError:this.tileset.geometricError,a=r*(n?i:this.geometricError);if(a===0)return 0;let o=e.height,s=e.sseDenominator;return e.camera.type===`OrthographicCamera`?a/(1/(e.camera.projectionMatrix.elements[5]/2)/o*.9):a/(Math.max(t,.001)*s/o)}getPriority(e){let t=this.refine===`ADD`||e.skipLevelOfDetail;if(t&&!this.state.visible||e.frameNumber-this.state.touchedFrameNumber>=1)return-1;let n=this.parent,r=n&&(!t||this.state.screenSpaceError===0)?n.state.screenSpaceError:this.state.screenSpaceError,i=this.tileset.root?this.tileset.root.state.screenSpaceError:0;return Math.max(i-r,0)}},_u=e=>Number(e);function vu(e,t=_u,n=!1){let r,i=1/0;for(let n of e){let e=t(n);e<=i&&(r=n,i=e)}return isFinite(i)||(i=0),n?[r,i]:r}function yu(e,t,n=(e,t)=>e===t){let r=e.length;if(r!==t.length)return!1;for(let i=0;i<r;i++)if(n(e[i],t[i])===!1)return!1;return!0}var bu=new Set;function xu(e){bu.clear();let t=[],n=e.length;for(let r=0;r<n;r++){let n=e[r];bu.has(n)||(t.push(n),bu.add(n))}return bu.clear(),t}var Su=e=>e.distance,Cu=(e,t)=>e.distance-t.distance;function wu(e,t=!0,n=!1){if(n&&e.length>1){let t=vu(e,Su);t?(e[0]=t,e.length=1):e.length=0}return t&&e.length>1&&e.sort(Cu),e}var Tu=class{constructor(e,t){this.position=e,this.indices=t}getPositionCount(){var e,t;let n=this.indices,r=this.position;return n?n.array.length/((e=n.stride)==null?1:e):r.array.length/((t=r.stride)==null?3:t)}getPositionByIndex(e,t){var n,r,i,a;let o=this.indices,s=this.position,c=e;if(o){let t=o.array,i=(n=o.stride)==null?1:n,a=(r=o.offset)==null?0:r;c=t[e*i+a]}let l=s.array,u=(i=s.stride)==null?3:i,d=(a=s.offset)==null?0:a;return c=c*u+d,t.x=l[c],t.y=l[c+1],t.z=l[c+2],t}createTree(e,t,n){throw Error(`not implemented`)}trianglesInSphere(e,t){throw Error(`not implemented`)}intersectRay(e,t,n=0,r=!1,i){throw Error(`not implemented`)}},Eu=class{constructor(e,t,n,r,i){this.id=e,this.extents=t,this.startIndex=n,this.endIndex=r,this.deepth=i}};function Du(e,t){let n=new ArrayBuffer(t*36),r=new Float32Array(n),i=new Uint32Array(n),a=new Uint16Array(n),o=[e],s,c;for(;s=o.pop();)c=s.id*36/4,r[c]=s.extents[0],r[c+1]=s.extents[1],r[c+2]=s.extents[2],r[c+3]=s.extents[3],r[c+4]=s.extents[4],r[c+5]=s.extents[5],i[c+6]=s.startIndex,i[c+7]=s.endIndex,c=s.id*36/2,s.node0&&(a[c+16]=s.node0.id,o.push(s.node0)),s.node1&&(a[c+17]=s.node1.id,o.push(s.node1));return n}function Ou(e,t,n,r=0){let i=n.min.x-r,a=n.min.y-r,o=n.min.z-r,s=n.max.x+r,c=n.max.y+r,l=n.max.z+r,u=0,d=0,f=0,p=0,m=0,h=0;return t.x>=0?(u=(i-e.x)*t.x,d=(s-e.x)*t.x):(u=(s-e.x)*t.x,d=(i-e.x)*t.x),t.y>=0?(f=(a-e.y)*t.y,p=(c-e.y)*t.y):(f=(c-e.y)*t.y,p=(a-e.y)*t.y),u>p||f>d||((f>u||u!==u)&&(u=f),(p<d||d!==d)&&(d=p),t.z>=0?(m=(o-e.z)*t.z,h=(l-e.z)*t.z):(m=(l-e.z)*t.z,h=(o-e.z)*t.z),u>h||m>d)||((m>u||u!==u)&&(u=m),(h<d||d!==d)&&(d=h),d<0)?null:u>=0?u:0}var ku=class e{constructor(e,t,n){this.x=e,this.y=t,this.z=n}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){let t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}clone(){return new e(this.x,this.y,this.z)}},Au=class{constructor(e,t,n,r,i){this.pointA=e,this.pointB=t,this.pointC=n,this.index=r,this.intersectionPoint=i}},ju=class{constructor(e,t){this.min=e,this.max=t}},Mu=1e-6,Nu=new ku(0,0,0),Pu=new ku(0,0,0),Fu=new ku(0,0,0),Iu=new ku(0,0,0),Lu=class extends Tu{createTree(e,t,n){t=Math.min(t,16);let r=this.getPositionCount()/3,i=r>65535?new Uint32Array(r):new Uint16Array(r),a=new Float32Array(r*6),o=[],s=0,c=-1;if(n)for(let e=0;e<r;e+=1){let t=e*3,n=e*6,r,o,s,c,l,u,d;i[e]=e,this.getPositionByIndex(t,Pu),this.getPositionByIndex(t+1,Fu),this.getPositionByIndex(t+2,Iu),r=c=Pu.x,d=Fu.x,d<r&&(r=d),d>c&&(c=d),d=Iu.x,d<r&&(r=d),d>c&&(c=d),o=l=Pu.y,d=Fu.y,d<o&&(o=d),d>l&&(l=d),d=Iu.y,d<o&&(o=d),d>l&&(l=d),s=u=Pu.z,d=Fu.z,d<s&&(s=d),d>u&&(u=d),d=Iu.z,d<s&&(s=d),d>u&&(u=d),a[n]=r,a[n+1]=o,a[n+2]=s,a[n+3]=c,a[n+4]=l,a[n+5]=u}else{let e=1/0,t=1/0,o=1/0,s=-1/0,c=-1/0,l=-1/0;for(let n=0;n<r;n+=1){let r=n*3,u=n*6,d,f,p,m,h,g,_;i[n]=n,this.getPositionByIndex(r,Pu),this.getPositionByIndex(r+1,Fu),this.getPositionByIndex(r+2,Iu),d=m=Pu.x,_=Fu.x,_<d&&(d=_),_>m&&(m=_),_=Iu.x,_<d&&(d=_),_>m&&(m=_),f=h=Pu.y,_=Fu.y,_<f&&(f=_),_>h&&(h=_),_=Iu.y,_<f&&(f=_),_>h&&(h=_),p=g=Pu.z,_=Fu.z,_<p&&(p=_),_>g&&(g=_),_=Iu.z,_<p&&(p=_),_>g&&(g=_),a[u]=d,a[u+1]=f,a[u+2]=p,a[u+3]=m,a[u+4]=h,a[u+5]=g,d<e&&(e=d),m>s&&(s=m),f<t&&(t=f),h>c&&(c=h),p<o&&(o=p),g>l&&(l=g)}n=[e,t,o,s,c,l]}let l=new Eu(++c,n,0,r,0);o[s++]=l;let u=[],d=[0,1,2],f=function(e,t){return u[t]-u[e]};function p(n){let r=n.startIndex,l=n.endIndex,p=n.extents;u[0]=p[3]-p[0],u[1]=p[4]-p[1],u[2]=p[5]-p[2],d.sort(f);for(let u=0;u<3;u++){let f=d[u],m=p[f]+p[f+3],h=r,g=l-1,_=-1,v;for(;h<=g;)_===-1?(v=i[h],a[v*6+f]+a[v*6+f+3]<m?h++:_=v):(v=i[g],a[v*6+f]+a[v*6+f+3]>=m?g--:(i[h]=v,i[g]=_,_=-1,h++,g--));if(h>r&&h<l){let u=new Eu(++c,zu(i,a,r,h,Mu),r,h,n.deepth+1);u.deepth<t&&u.endIndex-u.startIndex>e&&(o[s++]=u);let d=new Eu(++c,zu(i,a,h,l,Mu),h,l,n.deepth+1);d.deepth<t&&d.endIndex-d.startIndex>e&&(o[s++]=d),n.node0=u,n.node1=d,n.startIndex=0,n.endIndex=0;break}}}for(;s;)p(o[--s]);return this.offsetArray=i,this.rootNodePacked=Du(l,c+1),o.length=0,this}trianglesInSphere(e,t){let n=this.offsetArray,r=this.rootNodePacked,i=new Float32Array(r),a=new Uint32Array(r),o=new Uint16Array(r),s=[0],c=[],l;for(;(l=s.pop())!==void 0;){let r=l*36/4,u=Ru(e.x,i[r],i[r+3])-e.x,d=Ru(e.y,i[r+1],i[r+4])-e.y,f=Ru(e.z,i[r+2],i[r+5])-e.z;if(u*u+d*d+f*f<=t*t){let e=a[r+6],t=a[r+7];for(let r=e;r<t;r++){let e=n[r];c.push(e)}let i=l*36/2,u=o[i+16],d=o[i+17];u&&s.push(u),d&&s.push(d)}}let u=c.length,d=new Float32Array(u*9);for(let e=0;e<u;e++){let t=c[e]*3;this.getPositionByIndex(t,Nu),d[e*9]=Nu.x,d[e*9+1]=Nu.y,d[e*9+2]=Nu.z,this.getPositionByIndex(t+1,Nu),d[e*9+3]=Nu.x,d[e*9+4]=Nu.y,d[e*9+5]=Nu.z,this.getPositionByIndex(t+2,Nu),d[e*9+6]=Nu.x,d[e*9+7]=Nu.y,d[e*9+8]=Nu.z}return d}intersectRay(e,t,n=0,r=!1,i){let a=[],o=this.offsetArray,s=this.rootNodePacked,c=new Float32Array(s),l=new Uint32Array(s),u=new Uint16Array(s),d=new ku(1/t.x,1/t.y,1/t.z),f=[0],p,m=1/0,h=new ju(new ku(0,0,0),new ku(0,0,0)),g=new ku(0,0,0),_=new ku(0,0,0),v=new ku(0,0,0);for(;(p=f.pop())!==void 0;){let s=p*36/4;h.min.x=c[s],h.min.y=c[s+1],h.min.z=c[s+2],h.max.x=c[s+3],h.max.y=c[s+4],h.max.z=c[s+5];let y=Ou(e,d,h,n);if(y===null||r&&y>m)continue;let b=e.x,x=e.y,S=e.z,C=t.x,w=t.y,T=t.z,E=l[s+6],D=l[s+7];for(let e=E;e<D;e++){let t=o[e],n=t*3;this.getPositionByIndex(n,g);let s=g.x,c=g.y,l=g.z;this.getPositionByIndex(n+1,_);let u=_.x,d=_.y,f=_.z;this.getPositionByIndex(n+2,v);let p=v.x,h=v.y,y=v.z,E=u-s,D=d-c,O=f-l,k=p-s,A=h-c,j=y-l,M=D*j-O*A,N=O*k-E*j,ee=E*A-D*k,te=C*M+w*N+T*ee,ne;if(te>0)ne=1;else if(te<0)ne=-1,te=-te;else continue;let re=b-s,ie=x-c,ae=S-l,oe=ne*(C*(ie*j-ae*A)+w*(ae*k-re*j)+T*(re*A-ie*k));if(oe<0)continue;let se=ne*(C*(D*ae-O*ie)+w*(O*re-E*ae)+T*(E*ie-D*re));if(se<0||oe+se>te)continue;let ce=-ne*(re*M+ie*N+ae*ee);if(ce<0)continue;let le=ce/te,P=new Au(g,_,v,t,new ku(b+C*le,x+w*le,S+T*le));(!i||i(P))&&(r?le<m&&(m=le,a.length>0&&(a.length=0),a.push(P)):a.push(P))}let O=p*36/2,k=u[O+16],A=u[O+17];k&&f.push(k),A&&f.push(A)}return a}};function Ru(e,t,n){return e<t?t:e>n?n:e}function zu(e,t,n,r,i){if(n>=r)return[0,0,0,0,0,0];let a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let i=n;i<r;i++){let n=e[i]*6,r=t[n];r<a&&(a=r),r=t[n+1],r<o&&(o=r),r=t[n+2],r<s&&(s=r),r=t[n+3],r>c&&(c=r),r=t[n+4],r>l&&(l=r),r=t[n+5],r>u&&(u=r)}return[a-i,o-i,s-i,c+i,l+i,u+i]}(function(){let e=new ku(0,0,0),t=new ku(0,0,0),n=new ku(0,0,0),r=new ku(0,0,0);return function(i,a,o,s,c){t.subVectors(a,i),n.subVectors(o,i),r.crossVectors(t,n);let l=c.dot(r),u;if(l>0)u=1;else if(l<0)u=-1,l=-l;else return null;e.subVectors(s,i);let d=u*c.dot(n.crossVectors(e,n));if(d<0)return null;let f=u*c.dot(t.cross(e));if(f<0||d+f>l)return null;let p=-u*e.dot(r);if(p<0)return null;let m=p/l;return new ku(0,0,0).copy(c).multiplyScalar(m).add(s)}})();var Bu=1e-6,Vu=[`x`,`y`,`z`],Hu=new ku(0,0,0),Uu=class extends Tu{createTree(e,t,n){t=Math.min(t,16);let r=this.getPositionByIndex.bind(this),i=this.getPositionCount(),a=i>65535?new Uint32Array(i):new Uint16Array(i),o=[],s=0,c=-1;if(n)for(let e=0;e<i;e+=1)a[e]=e;else{r(0,Hu);let e=Hu.x,t=Hu.y,o=Hu.z,s=e,c=t,l=o;for(let n=0;n<i;n+=1){a[n]=n,r(n,Hu);let i=Hu.x,u=Hu.y,d=Hu.z;i<e?e=i:i>s&&(s=i),u<t?t=u:u>c&&(c=u),d<o?o=d:d>l&&(l=d)}n=[e,t,o,s,c,l]}let l=new Eu(++c,n,0,i,0);o[s++]=l;let u=[],d=[0,1,2],f=function(e,t){return u[t]-u[e]};function p(n){let i=n.startIndex,l=n.endIndex,p=n.extents;u[0]=p[3]-p[0],u[1]=p[4]-p[1],u[2]=p[5]-p[2];let m=d.sort(f)[0],h=Vu[m],g=(p[m]+p[m+3])/2,_=i,v=l-1,y=-1,b;for(;_<=v;)y===-1?(b=a[_],r(b,Hu),Hu[h]<g?_++:y=b):(b=a[v],r(b,Hu),Hu[h]>=g?v--:(a[_]=b,a[v]=y,y=-1,_++,v--));if(_>i){let r=p.slice();r[m+3]=g+Bu;let a=new Eu(++c,r,i,_,n.deepth+1);a.deepth<t&&a.endIndex-a.startIndex>e&&(o[s++]=a),n.node0=a}if(l>_){let r=p.slice();r[m]=g-Bu;let i=new Eu(++c,r,_,l,n.deepth+1);i.deepth<t&&i.endIndex-i.startIndex>e&&(o[s++]=i),n.node1=i}n.startIndex=0,n.endIndex=0}for(;s;)p(o[--s]);return this.offsetArray=a,this.rootNodePacked=Du(l,c+1),o.length=0,this}intersectRay(e,t,n=0,r=!1,i){let a=[],o=this.offsetArray,s=this.rootNodePacked,c=new Float32Array(s),l=new Uint32Array(s),u=new Uint16Array(s),d=n*n,f=new ku(1/t.x,1/t.y,1/t.z),p=[0],m,h=1/0,g=new ju(new ku(0,0,0),new ku(0,0,0)),_=new ku(0,0,0);for(;(m=p.pop())!==void 0;){let s=m*36/4;g.min.x=c[s],g.min.y=c[s+1],g.min.z=c[s+2],g.max.x=c[s+3],g.max.y=c[s+4],g.max.z=c[s+5];let v=Ou(e,f,g,n);if(v===null||r&&v>h)continue;let y=l[s+6],b=l[s+7];for(let n=y;n<b;n++){let s=o[n];this.getPositionByIndex(s,_);let c=_.x,l=_.y,u=_.z,f=e.x,p=e.y,m=e.z,g=t.x,v=t.y,y=t.z,b=g*(c-f)+v*(l-p)+y*(u-m);if(b>0?(f+=g*b,p+=v*b,m+=y*b):b<0&&(b=0),g=c-f,v=l-p,y=u-m,g*g+v*v+y*y<=d){let e=new Au(_,_,_,s,new ku(f,p,m));(!i||i(e))&&(r?b<h&&(h=b,a.length>0&&(a.length=0),a.push(e)):a.push(e))}}let x=m*36/2,S=u[x+16],C=u[x+17];S&&p.push(S),C&&p.push(C)}return a}},Wu="(function(){var e=class{constructor(e,t){this.position=e,this.indices=t}getPositionCount(){var e,t;let n=this.indices,r=this.position;return n?n.array.length/((e=n.stride)==null?1:e):r.array.length/((t=r.stride)==null?3:t)}getPositionByIndex(e,t){var n,r,i,a;let o=this.indices,s=this.position,c=e;if(o){let t=o.array,i=(n=o.stride)==null?1:n,a=(r=o.offset)==null?0:r;c=t[e*i+a]}let l=s.array,u=(i=s.stride)==null?3:i,d=(a=s.offset)==null?0:a;return c=c*u+d,t.x=l[c],t.y=l[c+1],t.z=l[c+2],t}createTree(e,t,n){throw Error(`not implemented`)}trianglesInSphere(e,t){throw Error(`not implemented`)}intersectRay(e,t,n=0,r=!1,i){throw Error(`not implemented`)}},t=class{constructor(e,t,n,r,i){this.id=e,this.extents=t,this.startIndex=n,this.endIndex=r,this.deepth=i}};function n(e,t){let n=new ArrayBuffer(t*36),r=new Float32Array(n),i=new Uint32Array(n),a=new Uint16Array(n),o=[e],s,c;for(;s=o.pop();)c=s.id*36/4,r[c]=s.extents[0],r[c+1]=s.extents[1],r[c+2]=s.extents[2],r[c+3]=s.extents[3],r[c+4]=s.extents[4],r[c+5]=s.extents[5],i[c+6]=s.startIndex,i[c+7]=s.endIndex,c=s.id*36/2,s.node0&&(a[c+16]=s.node0.id,o.push(s.node0)),s.node1&&(a[c+17]=s.node1.id,o.push(s.node1));return n}function r(e,t,n,r=0){let i=n.min.x-r,a=n.min.y-r,o=n.min.z-r,s=n.max.x+r,c=n.max.y+r,l=n.max.z+r,u=0,d=0,f=0,p=0,m=0,h=0;return t.x>=0?(u=(i-e.x)*t.x,d=(s-e.x)*t.x):(u=(s-e.x)*t.x,d=(i-e.x)*t.x),t.y>=0?(f=(a-e.y)*t.y,p=(c-e.y)*t.y):(f=(c-e.y)*t.y,p=(a-e.y)*t.y),u>p||f>d||((f>u||u!==u)&&(u=f),(p<d||d!==d)&&(d=p),t.z>=0?(m=(o-e.z)*t.z,h=(l-e.z)*t.z):(m=(l-e.z)*t.z,h=(o-e.z)*t.z),u>h||m>d)||((m>u||u!==u)&&(u=m),(h<d||d!==d)&&(d=h),d<0)?null:u>=0?u:0}var i=class e{constructor(e,t,n){this.x=e,this.y=t,this.z=n}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}set(e,t,n){return this.x=e,this.y=t,this.z=n,this}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){let t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}clone(){return new e(this.x,this.y,this.z)}},a=class{constructor(e,t,n,r,i){this.pointA=e,this.pointB=t,this.pointC=n,this.index=r,this.intersectionPoint=i}},o=class{constructor(e,t){this.min=e,this.max=t}};let s=1e-6,c=new i(0,0,0),l=new i(0,0,0),u=new i(0,0,0),d=new i(0,0,0);var f=class extends e{createTree(e,r,i){r=Math.min(r,16);let a=this.getPositionCount()/3,o=a>65535?new Uint32Array(a):new Uint16Array(a),c=new Float32Array(a*6),f=[],p=0,h=-1;if(i)for(let e=0;e<a;e+=1){let t=e*3,n=e*6,r,i,a,s,f,p,m;o[e]=e,this.getPositionByIndex(t,l),this.getPositionByIndex(t+1,u),this.getPositionByIndex(t+2,d),r=s=l.x,m=u.x,m<r&&(r=m),m>s&&(s=m),m=d.x,m<r&&(r=m),m>s&&(s=m),i=f=l.y,m=u.y,m<i&&(i=m),m>f&&(f=m),m=d.y,m<i&&(i=m),m>f&&(f=m),a=p=l.z,m=u.z,m<a&&(a=m),m>p&&(p=m),m=d.z,m<a&&(a=m),m>p&&(p=m),c[n]=r,c[n+1]=i,c[n+2]=a,c[n+3]=s,c[n+4]=f,c[n+5]=p}else{let e=1/0,t=1/0,n=1/0,r=-1/0,s=-1/0,f=-1/0;for(let i=0;i<a;i+=1){let a=i*3,p=i*6,m,h,g,_,v,y,b;o[i]=i,this.getPositionByIndex(a,l),this.getPositionByIndex(a+1,u),this.getPositionByIndex(a+2,d),m=_=l.x,b=u.x,b<m&&(m=b),b>_&&(_=b),b=d.x,b<m&&(m=b),b>_&&(_=b),h=v=l.y,b=u.y,b<h&&(h=b),b>v&&(v=b),b=d.y,b<h&&(h=b),b>v&&(v=b),g=y=l.z,b=u.z,b<g&&(g=b),b>y&&(y=b),b=d.z,b<g&&(g=b),b>y&&(y=b),c[p]=m,c[p+1]=h,c[p+2]=g,c[p+3]=_,c[p+4]=v,c[p+5]=y,m<e&&(e=m),_>r&&(r=_),h<t&&(t=h),v>s&&(s=v),g<n&&(n=g),y>f&&(f=y)}i=[e,t,n,r,s,f]}let g=new t(++h,i,0,a,0);f[p++]=g;let _=[],v=[0,1,2],y=function(e,t){return _[t]-_[e]};function b(n){let i=n.startIndex,a=n.endIndex,l=n.extents;_[0]=l[3]-l[0],_[1]=l[4]-l[1],_[2]=l[5]-l[2],v.sort(y);for(let u=0;u<3;u++){let d=v[u],g=l[d]+l[d+3],_=i,y=a-1,b=-1,x;for(;_<=y;)b===-1?(x=o[_],c[x*6+d]+c[x*6+d+3]<g?_++:b=x):(x=o[y],c[x*6+d]+c[x*6+d+3]>=g?y--:(o[_]=x,o[y]=b,b=-1,_++,y--));if(_>i&&_<a){let l=new t(++h,m(o,c,i,_,s),i,_,n.deepth+1);l.deepth<r&&l.endIndex-l.startIndex>e&&(f[p++]=l);let u=new t(++h,m(o,c,_,a,s),_,a,n.deepth+1);u.deepth<r&&u.endIndex-u.startIndex>e&&(f[p++]=u),n.node0=l,n.node1=u,n.startIndex=0,n.endIndex=0;break}}}for(;p;)b(f[--p]);return this.offsetArray=o,this.rootNodePacked=n(g,h+1),f.length=0,this}trianglesInSphere(e,t){let n=this.offsetArray,r=this.rootNodePacked,i=new Float32Array(r),a=new Uint32Array(r),o=new Uint16Array(r),s=[0],l=[],u;for(;(u=s.pop())!==void 0;){let r=u*36/4,c=p(e.x,i[r],i[r+3])-e.x,d=p(e.y,i[r+1],i[r+4])-e.y,f=p(e.z,i[r+2],i[r+5])-e.z;if(c*c+d*d+f*f<=t*t){let e=a[r+6],t=a[r+7];for(let r=e;r<t;r++){let e=n[r];l.push(e)}let i=u*36/2,c=o[i+16],d=o[i+17];c&&s.push(c),d&&s.push(d)}}let d=l.length,f=new Float32Array(d*9);for(let e=0;e<d;e++){let t=l[e]*3;this.getPositionByIndex(t,c),f[e*9]=c.x,f[e*9+1]=c.y,f[e*9+2]=c.z,this.getPositionByIndex(t+1,c),f[e*9+3]=c.x,f[e*9+4]=c.y,f[e*9+5]=c.z,this.getPositionByIndex(t+2,c),f[e*9+6]=c.x,f[e*9+7]=c.y,f[e*9+8]=c.z}return f}intersectRay(e,t,n=0,s=!1,c){let l=[],u=this.offsetArray,d=this.rootNodePacked,f=new Float32Array(d),p=new Uint32Array(d),m=new Uint16Array(d),h=new i(1/t.x,1/t.y,1/t.z),g=[0],_,v=1/0,y=new o(new i(0,0,0),new i(0,0,0)),b=new i(0,0,0),x=new i(0,0,0),S=new i(0,0,0);for(;(_=g.pop())!==void 0;){let o=_*36/4;y.min.x=f[o],y.min.y=f[o+1],y.min.z=f[o+2],y.max.x=f[o+3],y.max.y=f[o+4],y.max.z=f[o+5];let d=r(e,h,y,n);if(d===null||s&&d>v)continue;let C=e.x,w=e.y,T=e.z,E=t.x,D=t.y,O=t.z,k=p[o+6],A=p[o+7];for(let e=k;e<A;e++){let t=u[e],n=t*3;this.getPositionByIndex(n,b);let r=b.x,o=b.y,d=b.z;this.getPositionByIndex(n+1,x);let f=x.x,p=x.y,m=x.z;this.getPositionByIndex(n+2,S);let h=S.x,g=S.y,_=S.z,y=f-r,k=p-o,A=m-d,j=h-r,M=g-o,N=_-d,P=k*N-A*M,F=A*j-y*N,I=y*M-k*j,L=E*P+D*F+O*I,R;if(L>0)R=1;else if(L<0)R=-1,L=-L;else continue;let z=C-r,B=w-o,V=T-d,H=R*(E*(B*N-V*M)+D*(V*j-z*N)+O*(z*M-B*j));if(H<0)continue;let U=R*(E*(k*V-A*B)+D*(A*z-y*V)+O*(y*B-k*z));if(U<0||H+U>L)continue;let W=-R*(z*P+B*F+V*I);if(W<0)continue;let G=W/L,K=new a(b,x,S,t,new i(C+E*G,w+D*G,T+O*G));(!c||c(K))&&(s?G<v&&(v=G,l.length>0&&(l.length=0),l.push(K)):l.push(K))}let j=_*36/2,M=m[j+16],N=m[j+17];M&&g.push(M),N&&g.push(N)}return l}};function p(e,t,n){return e<t?t:e>n?n:e}function m(e,t,n,r,i){if(n>=r)return[0,0,0,0,0,0];let a=1/0,o=1/0,s=1/0,c=-1/0,l=-1/0,u=-1/0;for(let i=n;i<r;i++){let n=e[i]*6,r=t[n];r<a&&(a=r),r=t[n+1],r<o&&(o=r),r=t[n+2],r<s&&(s=r),r=t[n+3],r>c&&(c=r),r=t[n+4],r>l&&(l=r),r=t[n+5],r>u&&(u=r)}return[a-i,o-i,s-i,c+i,l+i,u+i]}(function(){let e=new i(0,0,0),t=new i(0,0,0),n=new i(0,0,0),r=new i(0,0,0);return function(a,o,s,c,l){t.subVectors(o,a),n.subVectors(s,a),r.crossVectors(t,n);let u=l.dot(r),d;if(u>0)d=1;else if(u<0)d=-1,u=-u;else return null;e.subVectors(c,a);let f=d*l.dot(n.crossVectors(e,n));if(f<0)return null;let p=d*l.dot(t.cross(e));if(p<0||f+p>u)return null;let m=-d*e.dot(r);if(m<0)return null;let h=m/u;return new i(0,0,0).copy(l).multiplyScalar(h).add(c)}})();let h=1e-6,g=[`x`,`y`,`z`],_=new i(0,0,0);var v=class extends e{createTree(e,r,i){r=Math.min(r,16);let a=this.getPositionByIndex.bind(this),o=this.getPositionCount(),s=o>65535?new Uint32Array(o):new Uint16Array(o),c=[],l=0,u=-1;if(i)for(let e=0;e<o;e+=1)s[e]=e;else{a(0,_);let e=_.x,t=_.y,n=_.z,r=e,c=t,l=n;for(let i=0;i<o;i+=1){s[i]=i,a(i,_);let o=_.x,u=_.y,d=_.z;o<e?e=o:o>r&&(r=o),u<t?t=u:u>c&&(c=u),d<n?n=d:d>l&&(l=d)}i=[e,t,n,r,c,l]}let d=new t(++u,i,0,o,0);c[l++]=d;let f=[],p=[0,1,2],m=function(e,t){return f[t]-f[e]};function v(n){let i=n.startIndex,o=n.endIndex,d=n.extents;f[0]=d[3]-d[0],f[1]=d[4]-d[1],f[2]=d[5]-d[2];let v=p.sort(m)[0],y=g[v],b=(d[v]+d[v+3])/2,x=i,S=o-1,C=-1,w;for(;x<=S;)C===-1?(w=s[x],a(w,_),_[y]<b?x++:C=w):(w=s[S],a(w,_),_[y]>=b?S--:(s[x]=w,s[S]=C,C=-1,x++,S--));if(x>i){let a=d.slice();a[v+3]=b+h;let o=new t(++u,a,i,x,n.deepth+1);o.deepth<r&&o.endIndex-o.startIndex>e&&(c[l++]=o),n.node0=o}if(o>x){let i=d.slice();i[v]=b-h;let a=new t(++u,i,x,o,n.deepth+1);a.deepth<r&&a.endIndex-a.startIndex>e&&(c[l++]=a),n.node1=a}n.startIndex=0,n.endIndex=0}for(;l;)v(c[--l]);return this.offsetArray=s,this.rootNodePacked=n(d,u+1),c.length=0,this}intersectRay(e,t,n=0,s=!1,c){let l=[],u=this.offsetArray,d=this.rootNodePacked,f=new Float32Array(d),p=new Uint32Array(d),m=new Uint16Array(d),h=n*n,g=new i(1/t.x,1/t.y,1/t.z),_=[0],v,y=1/0,b=new o(new i(0,0,0),new i(0,0,0)),x=new i(0,0,0);for(;(v=_.pop())!==void 0;){let o=v*36/4;b.min.x=f[o],b.min.y=f[o+1],b.min.z=f[o+2],b.max.x=f[o+3],b.max.y=f[o+4],b.max.z=f[o+5];let d=r(e,g,b,n);if(d===null||s&&d>y)continue;let S=p[o+6],C=p[o+7];for(let n=S;n<C;n++){let r=u[n];this.getPositionByIndex(r,x);let o=x.x,d=x.y,f=x.z,p=e.x,m=e.y,g=e.z,_=t.x,v=t.y,b=t.z,S=_*(o-p)+v*(d-m)+b*(f-g);if(S>0?(p+=_*S,m+=v*S,g+=b*S):S<0&&(S=0),_=o-p,v=d-m,b=f-g,_*_+v*v+b*b<=h){let e=new a(x,x,x,r,new i(p,m,g));(!c||c(e))&&(s?S<y&&(y=S,l.length>0&&(l.length=0),l.push(e)):l.push(e))}}let w=v*36/2,T=m[w+16],E=m[w+17];T&&_.push(T),E&&_.push(E)}return l}};function y(e){onmessage=t=>{Promise.resolve(t.data).then(t=>e(t)).then(({output:e,transfer:t})=>postMessage(e,t)).catch(e=>postMessage({$$error:e}))}}y(e=>Promise.resolve(e).then(e=>{let t=[],n=new Set;for(let r of e){let e;if(r.type===`mesh`)e=new f(r.attributes.position,r.indices);else if(r.type===`points`)e=new v(r.attributes.position,r.indices);else throw Error(`Invalid Type`);e.createTree(r.maxItemPerNode,r.maxTreeDepth,r.extents);let i={type:r.type,attributes:r.attributes,indices:r.indices,offsetArray:e.offsetArray,rootNodePacked:e.rootNodePacked};t.push(i);let a;for(let e in i.attributes){let t=i.attributes[e];t&&t.buffer instanceof ArrayBuffer&&n.add(t.buffer)}a=i.indices,a&&a.buffer instanceof ArrayBuffer&&n.add(a.buffer),a=i.offsetArray,a&&a.buffer instanceof ArrayBuffer&&n.add(a.buffer),n.add(i.rootNodePacked)}return{output:t,transfer:Array.from(n)}}))})();",Gu=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,Wu],{type:`text/javascript;charset=utf-8`});function Ku(e){let t;try{if(t=Gu&&(self.URL||self.webkitURL).createObjectURL(Gu),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(Wu),{name:e==null?void 0:e.name})}}var qu=new po(()=>new Ku,4),Ju=()=>!0,Yu=new t.Ray,Xu=new t.Matrix3,Zu=new t.Matrix4,Qu=new t.Vector3,$u=new t.Vector3,ed=new t.Vector3,td=new WeakMap;function nd(e,n,r,i){var a,o;let s=e.matrixWorld;Zu.getInverse(s),Yu.copy(r.ray).applyMatrix4(Zu);let c=(a=r.hitFilter)==null?Ju:a,l=(o=r.firstHitOnly)==null?!1:o,u=e.geometry,d=e.material,f=u.groups,p=u.index,m=n.intersectRay(Yu.origin,Yu.direction,0,l,n=>{var i;let a=n.index,o=a*3,l;if(Array.isArray(d)){if(f){for(let e of f)if(o>=e.start&&o-e.start<e.count){l=d[(i=e.materialIndex)==null?0:i];break}}}else l=d;if(!l)return!1;let u=n.intersectionPoint,m=new t.Vector3(u.x,u.y,u.z).applyMatrix4(s),h=r.ray.origin.distanceTo(m);if(h<r.near||h>r.far)return!1;let g=n.pointA,_=n.pointB,v=n.pointC,y=t.Triangle.getNormal(Qu.set(g.x,g.y,g.z).applyMatrix4(s),$u.set(_.x,_.y,_.z).applyMatrix4(s),ed.set(v.x,v.y,v.z).applyMatrix4(s),new t.Vector3),b=r.ray.direction.dot(y);if(l.side===t.FrontSide&&b>=0||l.side===t.BackSide&&b<=0)return!1;let x={distance:h,object:e,face:new t.Face3(p?p.array[o]:o,p?p.array[o+1]:o+1,p?p.array[o+2]:o+2,y),point:m,distanceToRay:0,faceIndex:a};return td.set(n,x),c(x)}),h=m.length;for(let e=0;e<h;e++){let t=td.get(m[e]);t&&i.push(t)}m.length=0}function rd(n,r,i,a){var o,s,c,l;let u=n.matrixWorld;Xu.getNormalMatrix(u),Zu.getInverse(u),Yu.copy(i.ray).applyMatrix4(Zu);let d=((s=(o=i.params.Points)==null?void 0:o.threshold)==null?1:s)*Zu.getMaxScaleOnAxis(),f=(c=i.hitFilter)==null?Ju:c,p=(l=i.firstHitOnly)==null?!1:l,m=n.geometry,h=m.index,g=m.getAttribute(`normal`),_=g instanceof t.BufferAttribute,v=r.intersectRay(Yu.origin,Yu.direction,d,p,r=>{let a=r.intersectionPoint,o=new t.Vector3(a.x,a.y,a.z).applyMatrix4(u),s=i.ray.origin.distanceTo(o);if(s<i.near||s>i.far)return!1;let c=r.pointA,l=Qu.set(c.x,c.y,c.z).applyMatrix4(u),d=o.distanceTo(l);if(d/s>.07)return!1;let p=r.index,m=h?h.array[p]:p,v;if(_){let e=new t.Vector3().fromBufferAttribute(g,m).applyNormalMatrix(Xu);v=new t.Face3(m,m,m,e)}else if(n instanceof e.t){let e=n.decodeCov3D(m);if(e){let[n,r,a,o,s,c]=e,l=`z`;l=n<=o&&n<=c?`x`:o<=n&&o<=c?`y`:`z`;let u=new t.Vector3(0,0,0);u[l]=1,u.applyNormalMatrix(Xu),i.ray.direction.dot(u)>0&&u.negate(),v=new t.Face3(m,m,m,u)}}let y={distance:s,object:n,face:v,point:o,distanceToRay:d,index:p};return td.set(r,y),f(y)}),y=v.length;for(let e=0;e<y;e++){let t=td.get(v[e]);t&&a.push(t)}v.length=0}var id=`__bvh_mesh__`,ad=t.Mesh.prototype.raycast;function od(e,t){let n=sd(this);n?nd(this,n,e,t):ad.call(this,e,t)}function sd(e){let t=e[id];return t instanceof Lu,t}function cd(e,t){Object.assign(e,{[id]:t,raycast:od})}var ld=`__bvh_points__`,ud=t.Points.prototype.raycast;function dd(e,t){let n=fd(this);n?rd(this,n,e,t):ud.call(this,e,t)}function fd(e){let t=e[ld];return t instanceof Uu,t}function pd(e,t){Object.assign(e,{[ld]:t,raycast:dd})}function md(n,r=!0,i=100,a=10){let o=[];return n.traverse(e=>{(e instanceof t.Mesh||e instanceof t.Points)&&e.geometry instanceof t.BufferGeometry&&o.push(e)}),r?Promise.resolve().then(()=>{for(let t=o.length-1;t>=0;t--){let n=o[t];if(n instanceof e.t){let e=n.packedData;if(e&&e.length>=n.numPoints*8){let t=new Uu({array:new Float32Array(e.buffer,e.byteOffset,e.length),stride:8,offset:0});t.createTree(i,a),pd(n,t)}o.splice(t,1)}}let n=[],r=new Set,s=null;for(let e=0;e<o.length;e++){let c=o[e],l=c.geometry;if(!(l instanceof t.BufferGeometry))continue;let u;if(c instanceof t.Mesh?u=`mesh`:c instanceof t.Points&&(u=`points`),!u)continue;let d=l.boundingBox,f=d?[d.min.x,d.min.y,d.min.z,d.max.x,d.max.y,d.max.z]:void 0,p={};for(let e in l.attributes){let n=l.attributes[e];n instanceof t.InterleavedBufferAttribute?(p[e]={array:n.data.array,stride:n.data.stride,offset:n.offset},s=n.data.array,s&&s.buffer instanceof ArrayBuffer&&r.add(s.buffer)):(p[e]={array:n.array},s=n.array,s&&s.buffer instanceof ArrayBuffer&&r.add(s.buffer))}let m,h=l.getIndex();h&&(h instanceof t.InterleavedBufferAttribute?(m={array:h.data.array,stride:h.data.stride,offset:h.offset},s=h.data.array,s&&s.buffer instanceof ArrayBuffer&&r.add(s.buffer)):(m={array:h.array},s=h.array,s&&s.buffer instanceof ArrayBuffer&&r.add(s.buffer)));let g={type:u,attributes:p,indices:m,maxItemPerNode:i,maxTreeDepth:a,extents:f};n.push(g)}return qu.postMessage(n,Array.from(r))}).then(e=>{for(let n=0;n<o.length;n++){let r=o[n],i=r.geometry,a=e[n];if(!(i instanceof t.BufferGeometry))continue;for(let e in a.attributes){let n=a.attributes[e].array,r=i.attributes[e];r instanceof t.InterleavedBufferAttribute?r.data.array=n:r.array=n}let s=i.getIndex();if(s&&a.indices){let e=a.indices.array;s instanceof t.InterleavedBufferAttribute?s.data.array=e:s.array=e}if(r instanceof t.Mesh){let e=new Lu(a.attributes.position,a.indices);e.offsetArray=a.offsetArray,e.rootNodePacked=a.rootNodePacked,cd(r,e)}else if(r instanceof t.Points){let e=new Uu(a.attributes.position,a.indices);e.offsetArray=a.offsetArray,e.rootNodePacked=a.rootNodePacked,pd(r,e)}}return n}):Promise.resolve().then(()=>{for(let n of o)if(n instanceof t.Mesh){let e=n.geometry,r=e.boundingBox,o=r?[r.min.x,r.min.y,r.min.z,r.max.x,r.max.y,r.max.z]:void 0;if(e instanceof t.BufferGeometry){let r,s,c=e.attributes.position;r=c instanceof t.InterleavedBufferAttribute?{array:c.data.array,stride:c.data.stride,offset:c.offset}:{array:c.array};let l=e.getIndex();l&&(s=l instanceof t.InterleavedBufferAttribute?{array:l.data.array,stride:l.data.stride,offset:l.offset}:{array:l.array});let u=new Lu(r,s);u.createTree(i,a,o),cd(n,u)}}else if(n instanceof t.Points)if(n instanceof e.t){let e=n.packedData;if(e&&e.length>=n.numPoints*8){let t=new Uu({array:new Float32Array(e.buffer,e.byteOffset,e.length),stride:8,offset:0});t.createTree(i,a),pd(n,t)}}else{let e=n.geometry,r=e.boundingBox,o=r?[r.min.x,r.min.y,r.min.z,r.max.x,r.max.y,r.max.z]:void 0;if(e instanceof t.BufferGeometry){let r,s,c=e.attributes.position;r=c instanceof t.InterleavedBufferAttribute?{array:c.data.array,stride:c.data.stride,offset:c.offset}:{array:c.array};let l=e.getIndex();l&&(s=l instanceof t.InterleavedBufferAttribute?{array:l.data.array,stride:l.data.stride,offset:l.offset}:{array:l.array});let u=new Uu(r,s);u.createTree(i,a,o),pd(n,u)}}return n})}function hd(e,t,n){return e+(t-e)*n}function gd(e,t,n,r){let i=(t*n+2*e)/Math.pow(n,3),a=-(2*t*n+3*e)/Math.pow(n,2),o=t,s=e;return i*Math.pow(r,3)+a*Math.pow(r,2)+o*r+s}function _d(e,t,n,r){let i=(t*n+2*e)/Math.pow(n,3),a=-(2*t*n+3*e)/Math.pow(n,2),o=t;return 3*i*Math.pow(r,2)+2*a*r+o}function vd(e,t,n,r){let i=r[1]-r[0];return e=yd(e,r),t=yd(t,r),t-e>i/2?hd(e+i,t,n):e-t>i/2?hd(e-i,t,n):hd(e,t,n)}function yd(e,t){let n=t[1]-t[0];return e<t[0]?yd(e+n,t):e>=t[1]?yd(e-n,t):e}function bd(e,t,n,r){return r?vd(e,t,n,r):hd(e,t,n)}function xd(e){let t=Number(e);return isNaN(t)||!isFinite(t)?0:t}var X=class{constructor(e){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=V(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(let t in e){let n=e[t];typeof n==`object`?(this.value[t]=xd(n.value),this.config[t]={circle:n.circle}):(this.value[t]=xd(n),this.config[t]={circle:!1})}this.keyframes=[{progress:0,value:Object.assign({},this.value)},{progress:1,value:Object.assign({},this.value)}]}getProgress(e){let t=e-this.startTime;return t<0?0:t>=this.duration?1:1-gd(1,this.startVelocity,this.duration,t)}getValue(e){for(let t=1;t<this.keyframes.length;t++)if(this.keyframes[t].progress>e){let n=this.keyframes[t-1],r=this.keyframes[t],i={};for(let t in this.config){let a=(e-n.progress)/(r.progress-n.progress);i[t]=bd(n.value[t],r.value[t],a,this.config[t].circle)}return i}return Object.assign({},this.keyframes[this.keyframes.length-1].value)}getProgressVelocity(e){let t=e-this.startTime;return t>=this.duration?0:_d(1,this.startVelocity,this.duration,t)}update(e){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(e))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)}getKeyFrameSegment(e){let t=this.getProgress(e);for(let e=1;e<this.keyframes.length;e++)if(this.keyframes[e].progress>t)return[this.keyframes[e-1],this.keyframes[e]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]}getTargetKeyframe(){return this.keyframes[this.keyframes.length-1]}set(e,t,n=0,r){var i;isNaN(t)&&(t=0),isNaN(n)&&(n=0),r=r==null?V():r;let a=this.getProgress(r),o=this.getValue(a),s={};for(let t in this.config)s[t]=(i=e[t])==null?o[t]:i;let c=[{progress:0,value:o},{progress:1,value:s}];return this.setKeyframes(c,t,n,r)}setKeyframes(e,t,n=0,r){if(e.length<2)throw Error(`keyframes invalid.`);return isNaN(t)&&(t=0),isNaN(n)&&(n=0),this.callbacks&&(this.callbacks[1](Error(`motion aborted.`)),this.callbacks=void 0),new Promise((i,a)=>{r=r==null?V():r,this.progress=0,this.ended=!1,this.startTime=r,this.startVelocity=n,this.keyframes=e,this.duration=t,t===0?(this.progress=1,this.value=Object.assign({},e[e.length-1].value)):this.value=Object.assign({},e[0].value),this.callbacks=[i,a]})}dispose(){this.callbacks&&(this.callbacks[1](Error(`motion dispose.`)),this.callbacks=void 0)}},Sd=Math.PI,Cd=1.70158;Cd*1.525,Cd+1,2*Sd/3,2*Sd/4.5;var wd=function(e){return e},Td=function(e){return e*e*e},Ed=function(e){return e*e*e*e},Dd=500,Od=new WeakMap,kd=new t.Vector3,Ad=new t.Matrix4,jd=class n extends t.Object3D{constructor(n,r,i,a=G){super(),this.name=n,this.materials=[],this.pbmObjects=[],this.contentObject=r,this.animations=i,this.appearMotion=new X({appear:0}),this.disposers=[a],this.add(r),r.traverse(n=>{if(n instanceof t.Mesh||n instanceof t.Points){let e=n.material;if(Array.isArray(e))for(let t=0;t<e.length;t++)this.materials.push(e[t]);else this.materials.push(e)}(n instanceof mn||n instanceof hn||n instanceof wn||n instanceof e.t)&&this.pbmObjects.push(n)})}generateBvhTree(){return md(this,!0,200,20)}intersectRaycaster(e,t){let n=t==null?[]:t,r=e.hitFilter;e.hitFilter=t=>{if(t.object instanceof wn&&t.object.material.pointBack===`HIDDEN`&&t.face&&t.face.normal.angleTo(e.ray.direction)<Math.PI/2)return!1;let n=0,i=-1;if((t.object instanceof mn||t.object instanceof hn||t.object instanceof wn)&&t.face){let e=Array.isArray(t.object.material)?t.object.material[t.face.materialIndex]:t.object.material;if(e){n=e.floorIndex,i=e.shownFloorIndex;for(let r of e.clippers)if(!(typeof r.floorIndex==`number`&&r.floorIndex!==n)&&(Ad.getInverse(r.clippingBoxMatrix),kd.copy(t.point).applyMatrix4(Ad),Math.abs(kd.x)<.5&&Math.abs(kd.y)<.5&&Math.abs(kd.z)<.5))return!1}}let a=i;return e.floorIndex===void 0?e.floor!==void 0&&(a=e.floor===null?-1:e.floor):a=e.floorIndex,a>=0&&n!==a?!1:(Object.assign(t,{floorIndex:n,floor:n}),r?r.call(e,t):!0)};let i=this.children.slice(),a;for(;a=i.pop();)if(a.visible){a.raycast(e,n);for(let e=0,t=a.children.length;e<t;e++)i.push(a.children[e])}return e.hitFilter=r,wu(n,e.sortByDistance,e.firstHitOnly),n}update(t,n,r,i,a,o){let s=!1;i.visible&&a.state.selectedFrameNumber===a.tileset.frameNumber?this.appearMotion.getTargetKeyframe().value.appear!==1&&this.appearMotion.set({appear:1},Dd).catch(G):this.appearMotion.getTargetKeyframe().value.appear!==0&&this.appearMotion.set({appear:0},0).catch(G),this.appearMotion.ended!==!0&&this.appearMotion.update(n.time);for(let c of this.pbmObjects)c instanceof mn||c instanceof hn?Md(c,this.appearMotion,t,n,r,a,o)===!0&&(s=!0):c instanceof wn?Nd(c,this.appearMotion,t,n,r,a,o)===!0&&(s=!0):c instanceof e.t&&Pd(c,this.appearMotion,t,n,r,i,a,o)===!0&&(s=!0);return s}dispose(){for(let e of this.disposers)e();this.disposers.length=0,this.pbmObjects.length=0}clone(){return new n(this.name,this.contentObject.clone(),this.animations)}};function Md(e,n,r,i,a,o,s){var c,l;let u=!1;if(Od.get(e)!==s.versionNumber){Od.set(e,s.versionNumber),u=!0,e.castShadow=s.castShadow,e.receiveShadow=s.receiveShadow;let n=e.material;for(let e of n)e.customShaders=s.customShaders,e.pano0=s.pano0,e.pano1=s.pano1,e.pano0Depth=s.pano0Depth,e.pano1Depth=s.pano1Depth,e.panoFilter=(l=(c=s.panoFilter)==null?void 0:c.toValue())==null?null:l,e.refinedScreen=s.refinedScreen,e.modelAlpha=s.modelAlpha,e.progress=s.progress,e.transition=s.transition,e.opacity=s.opacity,e.floorStyle=s.floorStyle,e.constantColor=s.constantColor,e.shownFloorIndex=s.shownFloorIndex,e.clippers=s.clippers,e.brightness=s.brightness,e.useHQWeight=s.useHQWeight,e.useHQDepth=s.useHQDepth,e.colorSaturation=s.colorSaturation,e.colorBrightness=s.colorBrightness,e.gradientTexture=s.gradientTexture,e.vertexMarks=s.vertexMarks,e.depthOffset=s.depthOffset,e.modelBoundingMax.copy(s.boundingBox.max),e.modelBoundingMin.copy(s.boundingBox.min),e.shaderType===`none`?(e.transparent=!0,e.blending=t.NormalBlending,e.blendDst=t.OneMinusSrcAlphaFactor,e.blendEquation=t.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.colorWrite=!0,e.depthWrite=!1,e.depthTest=!0):(e.transparent=e.alphaMode===`BLEND`,e.blending=t.NormalBlending,e.blendDst=t.OneMinusSrcAlphaFactor,e.blendEquation=t.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.colorWrite=!0,e.depthWrite=!0,e.depthTest=!0,s.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=t.AdditiveBlending),s.onlyDepth&&(e.colorWrite=!1,e.depthWrite=!0,e.depthTest=!0),e.shownFloorIndex>-1&&e.shownFloorIndex!==e.floorIndex&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.alphaMap&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),e.modelAlpha<=0&&(e.transparent=!1),e.depthWrite=!e.transparent,s.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=t.AdditiveBlending))}return u}function Nd(e,n,r,i,a,o,s){var c,l;let u=!1;if(s.pointAppearAnimation===!0&&o.refine===`ADD`&&o.tileset.rootMeta.pntsOrder===`RANDOM`){let t=e.geometry,r=o.tileset.currentMaxScreenSpaceError,i=o.state.screenSpaceError,a=(l=(c=o.parent)==null?void 0:c.state.screenSpaceError)==null?i:l,s=1;a!==i&&(s=(a-r)/(a-i)),s=H(s,0,1),s=Td(s);let d=t.index?t.index.count:t.attributes.position?t.attributes.position.count:1/0,f=Math.floor(d*s*n.value.appear);t.drawRange.count!==f&&(t.setDrawRange(0,f),u=!0)}if(Od.get(e)!==s.versionNumber){Od.set(e,s.versionNumber),u=!0,e.castShadow=s.castShadow,e.receiveShadow=s.receiveShadow;let n=[e.material];for(let e of n)e.customShaders=s.customShaders,e.pointScale=s.pointScale,e.pointMinPixel=s.pointMinPixel,e.pointMaxPixel=s.pointMaxPixel,e.pointSize=s.pointSize,e.pointShape=s.pointShape,e.pointBack=s.pointBack,e.modelAlpha=s.modelAlpha,e.opacity=s.opacity,e.floorStyle=s.floorStyle,e.constantColor=s.constantColor,e.shownFloorIndex=s.shownFloorIndex,e.clippers=s.clippers,e.brightness=s.brightness,e.useHQWeight=s.useHQWeight,e.useHQDepth=s.useHQDepth,e.colorSaturation=s.colorSaturation,e.colorBrightness=s.colorBrightness,e.outlineGain=s.outlineGain,e.distanceGain=s.distanceGain,e.gradientTexture=s.gradientTexture,e.depthOffset=s.depthOffset,e.transparent=!1,e.blending=t.NormalBlending,e.blendDst=t.OneMinusSrcAlphaFactor,e.blendEquation=t.AddEquation,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.colorWrite=!0,e.depthWrite=!0,e.depthTest=!0,e.modelBoundingMax.copy(s.boundingBox.max),e.modelBoundingMin.copy(s.boundingBox.min),e.shownFloorIndex>-1&&(e.transparent=e.shownFloorIndex!==e.floorIndex),e.modelAlpha<1&&(e.transparent=!0),e.opacity<1&&(e.transparent=!0),e.brightness<1&&(e.transparent=!0),s.useAddBlend&&(e.depthWrite=!1,e.depthTest=!1,e.blending=t.AdditiveBlending),s.onlyDepth&&(e.colorWrite=!1,e.depthWrite=!0,e.depthTest=!0),e.useHQWeight&&(e.depthWrite=!1,e.blending=t.CustomBlending,e.blendSrc=t.SrcAlphaFactor,e.blendSrcAlpha=t.SrcAlphaFactor,e.blendDst=t.OneFactor,e.blendDstAlpha=t.OneFactor),e.useHQDepth&&(e.colorWrite=!1)}return u}function Pd(e,n,r,i,a,o,s,c){let l=!1,u=o.uuid;return e.gsViewLayerKey!==u&&(e.gsViewLayerKey=u,l=!0),e.gsClippers!==c.clippers&&(e.gsClippers=c.clippers,l=!0),e.updateMatrix(),e.updateMatrixWorld(),e.usedSHDegree=c.gaussianSplattingSHDegree,e.initAnimationEnabled=c.enableGaussianSplattingInitAnimation,e.lastMatrixWorld?e.transformChanged=!e.lastMatrixWorld.equals(e.matrixWorld):(e.lastMatrixWorld=new t.Matrix4,e.transformChanged=!0,l=!0),e.lastMatrixWorld.copy(e.matrixWorld),e.transformChanged&&(l=!0),l}var Fd=class{constructor(e,n,r){this.id=e,this.name=n.name,this.visible=!1,this.tileset=r,this.transform=new t.Matrix4,n.transform&&this.transform.fromArray(n.transform),this.transform.premultiply(this.tileset.root.transform),this.content={uri:n.file,byteLength:0,memoryUsage:0,loadState:`UNLOADED`,loadProgress:0,loadStateUpdateTime:V(),loadfailRetryDelay:0,data:void 0}}},Id=class e extends t.Object3D{constructor(e,t,n=G){super(),this.name=e,this.contentObject=t,this.name=e,this.add(t),this.disposers=[n]}update(e,t,n,r,i,a){let o=this.contentObject.material[2];return o.uniforms.dashOffset.value=(o.uniforms.dashOffset.value-.003)%(o.uniforms.dashSize.value.x+o.uniforms.dashSize.value.y),!0}dispose(){for(let e of this.disposers)e();this.disposers.length=0}clone(){return new e(this.name,this.contentObject.clone())}},Ld=new Map;function Rd(e,t,n){if(n&&n.has(t))return n.get(t);let r=t.refine===`ADD`||e.skipLevelOfDetail,i=t.parent,a=i&&(!r||t.state.screenSpaceError===0)?i.state.screenSpaceError:t.state.screenSpaceError,o=t.tileset.root?t.tileset.root.state.screenSpaceError:0,s=Math.max(o-a,0);return n&&n.set(t,s),s}var zd=class{constructor(e,t){this.tileset=e,this.options=t,this.activeRequests=0,this.requestQueue=[]}reset(){for(let e of this.requestQueue)this.options.onTileSkip&&(e.tile.content&&this.tileset.options.tileUnloader(e.tile),this.options.onTileSkip(e.tile));this.requestQueue.length=0}update(e,t,n){let r=n.time,i=this.requestQueue,a=new Set(e);for(let e=0;e<i.length;e++){let t=i[e];if(a.has(t.tile)){a.delete(t.tile);continue}t.status===`WAITING`&&(i.splice(e,1),e--,this.options.onTileSkip&&this.options.onTileSkip(t.tile))}a.size>0&&(a.forEach(e=>{i.push({tile:e,status:`WAITING`,time:r,error:null})}),a.clear());let o=n.maxRequests;for(let e=0;e<i.length&&o>0;e++){let t=i[e];if(t.status===`DONE`)t.error===null?(o--,t.tile.content&&(t.tile.content.loadState=`READY`),this.options.onTileLoad&&this.options.onTileLoad(t.tile)):this.options.onTileError&&this.options.onTileError(t.tile,t.error),i.splice(e,1),e--;else if(t.status===`PENDING`&&r-t.time<1e3)break}switch(Ld.clear(),t){case`SCREEN_SPACE_ERROR`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?Rd(n,e.tile,Ld)-Rd(n,t.tile,Ld):e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;case`SCREEN_VERTICAL`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?e.tile.state.centerScreenY===t.tile.state.centerScreenY?e.tile.state.centerZDepth===t.tile.state.centerZDepth?e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:e.tile.state.centerZDepth-t.tile.state.centerZDepth:e.tile.state.centerScreenY-t.tile.state.centerScreenY:e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;case`SCREEN_LEVEL_VERTICAL`:i.sort((e,t)=>e.tile.state.requestedFrameNumber===t.tile.state.requestedFrameNumber?e.tile.state.requestedFrameNumber===n.frameNumber?e.tile.level===t.tile.level?e.tile.state.centerScreenY===t.tile.state.centerScreenY?e.tile.state.centerZDepth===t.tile.state.centerZDepth?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.state.centerZDepth-t.tile.state.centerZDepth:e.tile.state.centerScreenY-t.tile.state.centerScreenY:e.tile.level-t.tile.level:e.tile.level===t.tile.level?e.tile.state.distanceToCamera-t.tile.state.distanceToCamera:e.tile.level-t.tile.level:t.tile.state.requestedFrameNumber-e.tile.state.requestedFrameNumber);break;default:break}if(o=Math.max(n.maxRequests-this.activeRequests,0),!n.skipLevelOfDetail){let e=0,t=i.length;for(let r=0;r<t;r++){let t=i[r].tile;if(t.hasTilesetContent||t.contentParent===null||t.contentParent.state.selectedFrameNumber===n.frameNumber){let t=i.splice(r,1);i.splice(e++,0,...t)}}}for(let e=0;e<i.length&&o>0;e++){let t=i[e];t.status===`WAITING`&&(o--,t.status=`PENDING`,t.time=r,this.activeRequests++,this.tileset.options.tileLoader(t.tile).catch(e=>{t.error=e}).then(()=>{t.status=`DONE`,t.tile.content&&t.tile.content.loadState===`READY`&&(t.tile.content.loadState=`LOADING`),this.activeRequests--}))}}},Bd=class{constructor(e,t,n){this.item=e,this.previous=t,this.next=n}},Vd=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(e){let t=new Bd(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),this._length++,t}remove(e){e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,this._length--}splice(e,t){e!==t&&(this.remove(t),this.insert(e,t))}insert(e,t){let n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e,this._length++}toArray(){let e=[],t=this.head;for(;t;)e.push(t),t=t.next;return e}},Hd=class{constructor(e={}){this.options=e,this.cacheNodeMap=new WeakMap,this.list=new Vd,this.sentinel=this.list.add(`sentinel`)}reset(){this.list.tail&&this.list.splice(this.list.tail,this.sentinel)}touchTile(e){let t=this.cacheNodeMap.get(e);t&&this.list.splice(this.sentinel,t)}loadTile(e){if(!this.cacheNodeMap.has(e)){let t=this.list.add(e);this.cacheNodeMap.set(e,t),this.options.onTileLoad&&this.options.onTileLoad(e)}}unloadTile(e){let t=this.cacheNodeMap.get(e);t&&(this.list.remove(t),this.cacheNodeMap.delete(e),this.options.onTileUnload&&this.options.onTileUnload(e))}unloadTiles(e){let t=this.list.head;for(;t!==this.sentinel&&e();){let e=t.item;t=t.next,this.unloadTile(e)}}toArray(){let e=[];for(let t of this.list.toArray())t.item!==`sentinel`&&e.push(t.item);return e}},Ud=class{constructor(){this.map=new Map,this.array=[],this._length=0}get length(){return this._length}get(e){return this.array[e]}set(e,t){e>=this.length&&(this._length=e+1),this.map.has(this.array[e])&&this.map.delete(this.array[e]),this.array[e]=t,this.map.set(t,e)}delete(e){let t=this.map.get(e);t!==void 0&&t>=0&&(this.array.splice(t,1),this.map.delete(e),this._length--)}push(e){if(!this.map.has(e)){let t=this._length++;this.array[t]=e,this.map.set(e,t)}}pop(){let e=this.array[--this._length];return this.map.delete(e),this.array[this._length]=void 0,e}reset(){this.array=[],this.map=new Map,this._length=0}find(e){return this.map.has(e)}peek(){return this.array[this._length-1]}},Wd=class{constructor(e){this.tileset=e,this._canSelectTile=!0,this._loadAllTilesTraversalStack=new Ud}traverse(e,t,n=[]){this.reset()}reset(){this._loadAllTilesTraversalStack.reset(),this.tileset.hasMixedContent=!1,this.tileset.needsRefinedTiles.clear(),this.tileset.requestedTiles.length=0,this.tileset.selectedTiles.length=0}updateTile(e,t){this.updateTileVisibility(e,t),e.state.shouldSelect=!1,e.state.finalResolution=!0}selectTile(e,t){this._canSelectTile&&e.contentAvailable&&e.state.selectedFrameNumber<t.frameNumber&&(e.state.selectedFrameNumber=t.frameNumber,this.tileset.selectedTiles.push(e),this.tileset.needsRefinedTiles.add(e))}loadTile(e,t){this._canSelectTile&&(e.state.requestedFrameNumber<t.frameNumber&&(e.state.requestedFrameNumber=t.frameNumber,e.content&&(e.content.loadState===`FAILED`&&t.time-e.content.loadStateUpdateTime>e.content.loadfailRetryDelay&&(e.content.loadState=`UNLOADED`,e.content.loadProgress=0,e.content.loadStateUpdateTime=t.time),e.content.loadState===`UNLOADED`&&this.tileset.requestedTiles.push(e))),this.tileset.needsRefinedTiles.add(e))}touchTile(e,t){this._canSelectTile&&(this.tileset.cache.touchTile(e),e.state.touchedFrameNumber=t.frameNumber)}canTraverse(e,t){return!e.state.inRequestVolume||e.hasRenderContent&&(e.levelOfContent>=t.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=t.minGeometricError)||e.children.length===0?!1:e.levelOfContent<t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.hasTilesetContent?!0:e.state.screenSpaceError>this.tileset.currentMaxScreenSpaceError}updateTileVisibility(e,t){if(e.updateState(t),!e.state.visible||!e.state.inRequestVolume)return;let n=e.children.length>0;if(e.hasTilesetContent&&n){let n=e.children[0];this.updateTileVisibility(n,t),e.state.visible=n.state.visible;return}if(this.meetsScreenSpaceErrorEarly(e,t)){e.state.visible=!1;return}if(e.refine===`REPLACE`&&n&&!this.anyChildrenVisible(e,t)){e.state.visible=!1;return}}anyChildrenVisible(e,t){let n=!1,r=e.children;for(let e of r)e.updateState(t),n=n||e.state.visible;return n}meetsScreenSpaceErrorEarly(e,t){let{parent:n}=e;return!n||n.refine!==`ADD`||n.levelOfContent<t.minLevelOfDetail||n.geometricError>t.maxGeometricError?!1:n.levelOfContent>t.maxLevelOfDetail||n.levelOfContent>=0&&n.geometricError<t.minGeometricError?!0:e.getScreenSpaceError(t,e.state.distanceToCamera,!0)<this.tileset.currentMaxScreenSpaceError}sortTilesByDistanceToCamera(e){e.sort((e,t)=>t.state.distanceToCamera===0&&e.state.distanceToCamera===0?t.state.centerZDepth-e.state.centerZDepth:t.state.distanceToCamera-e.state.distanceToCamera)}},Gd=class extends Wd{constructor(e){super(e),this._traversalStack=new Ud,this._emptyTraversalStack=new Ud}traverse(e,t,n=[]){super.traverse(e,t,n);for(let t of n)this._traversalStack.reset(),this._emptyTraversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t));this._traversalStack.reset(),this._emptyTraversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t))}reset(){super.reset(),this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&n.push(e);n.length>0;){let e=n.pop(),r=e.parent,i=!r||r.state.shouldRefine,a=!1;this.canTraverse(e,t)&&(a=this.updateAndPushChildren(e,t,n)&&i);let o=!a&&i;e.hasRenderContent?e.refine===`ADD`?(this.loadTile(e,t),this.selectDesiredTile(e,t)):e.refine===`REPLACE`&&(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)):(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)),this.touchTile(e,t),e.state.shouldRefine=a}}updateAndPushChildren(e,t,n){let r=e.children;for(let e of r)this.updateTile(e,t);this.sortTilesByDistanceToCamera(r);let i=e.refine===`REPLACE`&&e.hasRenderContent,a=!1,o=!0;for(let e of r)if(e.levelOfContent<=t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.state.visible&&e.state.inRequestVolume?(n.find(e)&&n.delete(e),n.push(e),a===!1&&(a=!0)):(i||t.loadSiblings)&&(this.loadTile(e,t),this.touchTile(e,t)),i){let n;n=e.state.inRequestVolume?e.hasRenderContent?e.contentAvailable:this.executeEmptyTraversal(e,t):!1,o=o&&n}return a||(o=!1),o}selectDesiredTile(e,t){e.contentAvailable&&super.selectTile(e,t)}executeEmptyTraversal(e,t){let n=!0,r=this._emptyTraversalStack;for(r.push(e);r.length>0&&n;){let e=r.pop(),i=!e.hasRenderContent&&this.canTraverse(e,t);if(!i&&!e.contentAvailable&&(n=!1),this.updateTile(e,t),e.state.visible||(this.loadTile(e,t),this.touchTile(e,t)),i){let t=e.children;for(let e of t)r.find(e)&&r.delete(e),r.push(e)}}return n}},Kd=class extends Wd{constructor(e){super(e),this.baseScreenSpaceError=1024,this.skipScreenSpaceErrorFactor=16,this.skipLevels=1,this._traversalStack=new Ud,this._descendantTraversalStack=new Ud,this._selectionTraversalStack=new Ud,this._selectionTraversalancestorStack=new Ud}traverse(e,t,n=[]){super.traverse(e,t,n);for(let t of n)this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t),this.traverseAndSelect(e,t));this.tileset.hasMixedContent=!1,this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,this.updateTile(e,t),this.executeTraversal(e,t),this.traverseAndSelect(e,t))}reset(){super.reset(),this._traversalStack.reset(),this._descendantTraversalStack.reset(),this._selectionTraversalStack.reset(),this._selectionTraversalancestorStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(e.state.visible&&e.state.inRequestVolume&&n.push(e);n.length>0;){let e=n.pop();this.updateTileAncestorContentLinks(e,t);let r=e.parent,i=!r||r.state.shouldRefine,a=!1;this.canTraverse(e,t)&&(a=this.updateAndPushChildren(e,t,n)&&i);let o=!a&&i;e.hasRenderContent?e.refine===`ADD`?(this.loadTile(e,t),this.selectDesiredTile(e,t)):e.refine===`REPLACE`&&(this.inBaseTraversal(e,this.baseScreenSpaceError)?(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)):o?(this.loadTile(e,t),this.selectDesiredTile(e,t)):this.reachedSkippingThreshold(e)&&this.loadTile(e,t)):(this.loadTile(e,t),o&&this.selectDesiredTile(e,t)),this.touchTile(e,t),e.state.shouldRefine=a}}updateAndPushChildren(e,t,n){let r=e.children;for(let e of r)this.updateTile(e,t);this.sortTilesByDistanceToCamera(r);let i=!1;for(let e of r)e.levelOfContent<=t.minLevelOfDetail||e.geometricError>=t.maxGeometricError||e.state.visible&&e.state.inRequestVolume?(n.push(e),i===!1&&(i=!0)):t.loadSiblings&&(this.loadTile(e,t),this.touchTile(e,t));return i}selectDesiredTile(e,t){let n=e.contentAvailable?e:e.state.ancestorWithContentAvailable;n&&(n.state.shouldSelect=!0),e.contentAvailable||this.selectDescendants(e,t)}selectDescendants(e,t){let n=this._descendantTraversalStack;for(n.push(e);n.length>0;){let e=n.pop().children;for(let r of e)r.state.visible&&(r.contentAvailable?(this.updateTile(r,t),this.touchTile(r,t),this.selectTile(r,t)):n.push(r))}}reachedSkippingThreshold(e){let t=e.state.ancestorWithContent;return t!==null&&e.state.screenSpaceError<t.state.screenSpaceError/this.skipScreenSpaceErrorFactor&&e.levelOfContent>t.levelOfContent+this.skipLevels}updateTileAncestorContentLinks(e,t){e.state.ancestorWithContent=null,e.state.ancestorWithContentAvailable=null;let{parent:n}=e;if(!n)return;let r=!(n.hasRenderContent&&n.hasUnloadedContent)||n.state.requestedFrameNumber===t.frameNumber;e.state.ancestorWithContent=r?n:n.state.ancestorWithContent,e.state.ancestorWithContentAvailable=n.contentAvailable?n:n.state.ancestorWithContentAvailable}inBaseTraversal(e,t){return e.state.ancestorWithContent?e.parent&&e.state.screenSpaceError===0?e.parent.state.screenSpaceError>t:e.state.screenSpaceError>t:!0}traverseAndSelect(e,t){let n=this._selectionTraversalStack,r=this._selectionTraversalancestorStack,i;for(n.push(e);n.length>0||r.length>0;){if(r.length>0){let e=r.peek();if(e.state.stackLength===n.length){r.pop(),e!==i&&(e.state.finalResolution=!1),this.selectTile(e,t);continue}}let e=n.pop();if(!e)continue;let a=this.canTraverse(e,t);if(e.state.shouldSelect)if(e.refine===`ADD`)this.selectTile(e,t);else{if(e.state.selectionDepth=r.length,e.state.selectionDepth>0&&(e.tileset.hasMixedContent=!0),i=e,!a){this.selectTile(e,t);continue}r.push(e),e.state.stackLength=n.length}if(a)for(let t of e.children)t.state.visible&&n.push(t)}}},qd=class extends Wd{constructor(e){super(e),this._traversalStack=new Ud}canTraverse(e,t){return!(!e.state.inRequestVolume||e.levelOfContent>=t.maxLevelOfDetail||e.levelOfContent>=0&&e.geometricError<=t.minGeometricError||e.children.length===0)}traverse(e,t,n){super.traverse(e,t,[]),this._traversalStack.reset(),e.updateState(t);for(let t of n)this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,e.updateState(t),this.executeTraversal(e,t));this._traversalStack.reset(),t.camera.refine&&(this._canSelectTile=t.camera.visible,e.updateState(t),this.executeTraversal(e,t))}reset(){super.reset(),this._traversalStack.reset()}executeTraversal(e,t){let n=this._traversalStack;for(n.push(e);n.length>0;){let e=n.pop(),r=e.refine===`ADD`,i=e.refine===`REPLACE`,a=this.canTraverse(e,t);a&&this.updateAndPushChildren(e,t,n),(r||i&&!a)&&(this.loadTile(e,t),this.touchTile(e,t),this.selectDesiredTile(e,t))}}updateAndPushChildren(e,t,n){let{children:r}=e;for(let e=0;e<r.length;++e){let i=r[e];i.updateState(t),i.state.visible&&n.push(i)}}selectDesiredTile(e,t){e.contentAvailable&&super.selectTile(e,t)}},Jd=class{constructor(e,n){var r,i,a,o,s,c,l;if(this.id=e.tilesetUrl,this.transform=new t.Matrix4,this.hasMixedContent=!1,this.frameNumber=0,this.maxAverageTileMemory=0,this.asset={version:e.asset.version,tilesetVersion:e.asset.tilesetVersion||``,gltfUpAxis:(r=e.asset.gltfUpAxis)==null?`Y`:r,overview:e.asset.overview,trajectories:(a=(i=e.asset.trajectories)==null?void 0:i.list)==null?[]:a,extras:e.asset.extras},this.rootMeta=(o=e.rootMeta)==null?{}:o,this.pointLength=(s=this.rootMeta.numTotalPoints)==null?1/0:s,this.floorLength=(c=this.rootMeta.numFloors)==null?1:c,this.properties=(l=e.properties)==null?{}:l,this.options=n,this.requestedTiles=[],this.selectedTiles=[],this.unloadTiles=[],this.needsRefinedTiles=new Set,this.selectedTrajectories=[],this.normalTraverser=new Gd(this),this.skipTraverser=new Kd(this),this.mostDetailTraverser=new qd(this),this.cache=new Hd({onTileLoad:e=>{this.cacheMemoryUsageInBytes+=e.contentMemoryUsage},onTileUnload:e=>{this.cacheMemoryUsageInBytes-=e.contentMemoryUsage,this.unloadTiles.push(e)}}),this.requestScheduler=new zd(this,{onTileSkip:e=>{},onTileLoad:e=>{var t;(t=e.content)!=null&&t.data&&(this.loadedTiles.add(e),this.cache.loadTile(e)),this.options.onTileLoad(e)},onTileError:(e,t)=>{this.options.onTileError(e,t)}}),this.loadedTiles=new Set,this.cacheMemoryUsageInBytes=0,this.currentMaxScreenSpaceError=NaN,this.root=new gu(`${this.id}#tile:0`,e.root,this),this.geometricError=e.geometricError,this.trajectories=[],this.asset.trajectories)for(let e=0;e<this.asset.trajectories.length;e++){let t=new Fd(`${this.id}#trajectory:${e}`,this.asset.trajectories[e],this);this.trajectories.push(t)}}adjustScreenSpaceError(e){if(e.frameNumber%20==0)if((isNaN(this.currentMaxScreenSpaceError)||!isFinite(this.currentMaxScreenSpaceError))&&(this.currentMaxScreenSpaceError=e.maxScreenSpaceError),e.memoryAdjustedScreenSpaceError){let t=0,n=0,r=0;if(this.needsRefinedTiles.forEach(e=>{e.content&&(n++,t+=e.content.memoryUsage,e.content.loadState===`READY`&&r++)}),r<2||n<2)this.currentMaxScreenSpaceError=e.maxScreenSpaceError;else{let i=1024*1024,a=t/r*n,o=e.maxMemoryUsage*i,s=o-H(o*.2,32*i,128*i),c=this.currentMaxScreenSpaceError;if(a<s){let e=.3*Math.max(1-a/s,0);c-=e}else a>o&&(c+=.15);c=H(c,.5,e.maxScreenSpaceError),Math.abs(c-this.currentMaxScreenSpaceError)>=.1&&(this.currentMaxScreenSpaceError=c)}}else this.currentMaxScreenSpaceError=e.maxScreenSpaceError}getTraverser(e){return e.mostDetail?this.mostDetailTraverser:e.skipLevelOfDetail?this.skipTraverser:this.normalTraverser}reset(){this.cache.reset(),this.skipTraverser.reset(),this.normalTraverser.reset(),this.mostDetailTraverser.reset(),this.requestScheduler.reset();let e=[this.root],t;for(;t=e.pop();){for(let n=0,r=t.children.length;n<r;n++)e.push(t.children[n]);this.cache.unloadTile(t)}for(;this.unloadTiles.length;){let e=this.unloadTiles.pop();e&&(this.loadedTiles.delete(e),this.cacheMemoryUsageInBytes-=e.contentMemoryUsage,this.options.tileUnloader(e).catch(()=>{}).then(()=>{this.options.onTileUnload&&this.options.onTileUnload(e)}))}for(this.loadedTiles.clear();this.trajectories.length;){let e=this.trajectories.pop();e&&this.options.trajectoryUnloader(e).catch(()=>{}).then(()=>{this.options.onTrajectoryUnload&&this.options.onTrajectoryUnload(e)})}}update(e,t=[]){var n;for(this.frameNumber=e.frameNumber,this.adjustScreenSpaceError(e),this.cache.reset(),this.getTraverser(e).traverse(this.root,e,t),this.cache.unloadTiles(()=>this.cacheMemoryUsageInBytes>e.maxMemoryUsage*1024*1024),this.requestScheduler.update(this.requestedTiles,e.requestOrder,e);this.unloadTiles.length;){let e=this.unloadTiles.pop();e&&(this.loadedTiles.delete(e),this.options.tileUnloader(e).catch(()=>{}).then(()=>{this.options.onTileUnload&&this.options.onTileUnload(e)}))}this.selectedTrajectories.length=0;for(let t of this.trajectories)t.visible===!0&&t.content.loadState===`READY`&&(n=t.content.data)!=null&&n.object?this.selectedTrajectories.push(t):t.visible===!0&&(t.content.loadState===`FAILED`&&e.time-t.content.loadStateUpdateTime>t.content.loadfailRetryDelay&&(t.content.loadState=`UNLOADED`,t.content.loadStateUpdateTime=e.time),t.content.loadState===`UNLOADED`&&this.options.trajectoryLoader(t).then(()=>{this.options.onTrajectoryLoad(t)}).catch(e=>{this.options.onTrajectoryError(t,e)}))}};function Yd(e,t){var n;if(e.content){let r=(n=e.content.uri)==null?e.content.url:n;typeof r==`string`&&!hr(r)&&(e.content.uri=yr(_r(t,r)))}if(e.transform){let t=!1;for(let n=0;n<16;n++){let r=e.transform[n];if(typeof r!=`number`||isNaN(r)||!isFinite(r)){t=!0;break}}if(e.transform[15]===0&&(t=!0),t)throw Error(`Invalid Tile Transform: `+JSON.stringify(e.transform))}if(e.children)for(let n of e.children)Yd(n,t);return e}function Xd(e,t){e.tilesetUrl=t;let n=/^blob\:/.test(t)?``:t.slice(0,t.lastIndexOf(`/`)+1);if(e.asset||(e.asset={}),e.rootMeta||(e.rootMeta={}),e.rootMeta.taskParameters||(e.rootMeta.taskParameters={}),e.asset.overview){let t=e.asset.overview;hr(t.imageFile)||(t.imageFile=yr(_r(n,t.imageFile))),hr(t.worldFile)||(t.worldFile=yr(_r(n,t.worldFile)))}if(e.asset.trajectories)for(let t=0;t<e.asset.trajectories.list.length;t++){let r=e.asset.trajectories.list[t];r.file=yr(_r(n,r.file))}return Yd(e.root,n),e}function Zd(e){return new Promise(t=>setTimeout(t,e))}var Qd=new class{constructor(e){this.queue=[],this.concurrency=e,this.dequeuing=0}add(e,t=1e3){let n,r,i=new Promise((e,t)=>{n=e,r=t});return this.queue.unshift(()=>{let i=Promise.resolve().then(e);i.then(n,r);let a=Zd(t);return Promise.race([i,a]).then(G,G)}),this.dequeue(),i}dequeue(){for(;this.dequeuing<this.concurrency&&this.queue.length>0;){let e=this.queue.pop();this.dequeuing++,e().catch(G).then(()=>{this.dequeuing--,this.dequeue()})}}}(1),$d=256;function ef(e){return typeof e.image==`object`&&e.image.width>0&&e.image.height>0}function tf(e,t){if(!ef(e))return Promise.resolve(e);if(e.image.width<$d&&e.image.width<$d)return t.initTexture(e),Promise.resolve(e);let n=!1,r=()=>{n=!0,e.removeEventListener(`dispose`,r)};return e.addEventListener(`dispose`,r),Qd.add(()=>new Promise(i=>{ei.shared.add(()=>{ef(e)&&n===!1&&t.initTexture(e),e.removeEventListener(`dispose`,r),i(e)},!0)}))}function nf(e,t){return Promise.all(e.map(e=>tf(e,t)))}var rf=new t.Matrix4,af=5e3,of=1e3;function sf(e,n){e.name=n.id;let r=n.tileset.properties.floorInfo;e.traverse(e=>{if(`floor`in n.extras){if(e instanceof t.Mesh||e instanceof t.Points){let t=Array.isArray(e.material)?e.material:e.material?[e.material]:[];for(let e of t)(e instanceof pn||e instanceof Cn)&&(e.floorIndex=n.extras.floor)}}else if(!(e instanceof wn)&&(e instanceof mn||e instanceof hn)&&r){let i=new t.Box3().expandByObject(e).getCenter(new t.Vector3),a=0;for(let e=0;e<r.length;e++){let{ground:t,height:n}=r[e];if(i.y<t+n){a=e;break}}n.floor=a,n.tileset.floorLength=Math.max(n.tileset.floorLength,n.floor+1),e.material.forEach(e=>e.floorIndex=a)}})}function cf(e,n){if(!e.content)return Promise.resolve(e);let r=e.content,i=vr(r.uri,n.search);if(e.type===`TILESET`){let t=Ur(i,{key:`model.${e.siblingIndex}`});return r.loadState=`LOADING`,r.loadStateUpdateTime=V(),n.fetcher.ajax(t,{responseType:`text`},void 0,void 0,(e,t,n)=>{(r.loadState=`LOADING`)&&(r.loadProgress=e)}).then(e=>e.body).then(e=>{let t=i.slice(0,i.lastIndexOf(`/`)+1);return Xd(JSON.parse(e),t)}).then(t=>{r.loadState=`READY`,r.loadStateUpdateTime=V(),r.loadfailRetryDelay=0,e.children.length===0&&(e.children=[new gu(`${e.id}.0`,t.root,e.tileset,e)])}).then(()=>e).catch(e=>(r.loadState=`FAILED`,r.loadStateUpdateTime=V(),r.loadfailRetryDelay=Math.min(r.loadfailRetryDelay+1e3,5e3),Promise.reject(e)))}if(e.type===`SCENEGRAPH`){r.loadState=`LOADING`,r.loadStateUpdateTime=V();let a=(e,t,n)=>{(r.loadState=`LOADING`)&&(r.loadProgress=e,n&&(r.byteLength=n))};return Promise.resolve().then(()=>{var r,o,s,c,l,u,d,f,p,m,h,g;let _=``,[v,y]=i.split(`#`),b=(y||v).split(`?`)[0].match(/\.([0-9a-zA-Z]+)$/);if(b&&(_=b[1]),_===`b3dm`)return Ws(Ur(i,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:e.tileset.asset.gltfUpAxis,light:n.light,fetcher:n.fetcher,onDownloadProgress:a}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,sf(t.scene,e),t));if(_===`pnts`)return Zs(Ur(i,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,computeBoundingBox:!1,fetcher:n.fetcher,onDownloadProgress:a}).then(n=>{if(n.scene.applyMatrix4(e.transform),n.scene.updateWorldMatrix(!1,!0),n.scene.matrixAutoUpdate=!1,e.boundingVolume){let r=e.boundingVolume;n.scene.traverse(e=>{if(e instanceof wn){rf.getInverse(e.matrixWorld);let n=new t.Box3;r.getBoundingBox(n),n.applyMatrix4(rf),e.geometry.boundingBox=n}})}return sf(n.scene,e),n});if(_===`glb`||_===`gltf`)return $s(Ur(i,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:e.tileset.asset.gltfUpAxis,light:n.light,fetcher:n.fetcher,onDownloadProgress:a}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,sf(t.scene,e),t));if(_===`at3d`)return ca(e.extras.at3d?i:Ur(i,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:n.light,textureBaseUri:(r=e.extras.at3d)==null?void 0:r.textureBaseUri,textureArray:(o=e.extras.at3d)==null?void 0:o.textureArray,textureOptions:(s=e.extras.at3d)==null?void 0:s.textureOptions,fetcher:n.fetcher,onDownloadProgress:a}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`pbm`)return ki(e.extras.pbm?i:Ur(i,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:n.light,textureBaseUri:(c=e.extras.pbm)==null?void 0:c.textureBaseUri,textureArray:(l=e.extras.pbm)==null?void 0:l.textureArray,textureOptions:(u=e.extras.pbm)==null?void 0:u.textureOptions,fetcher:n.fetcher,onDownloadProgress:a}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`dome`)return fa(e.extras.dome?i:Ur(i,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:n.light,textureBaseUri:(d=e.extras.dome)==null?void 0:d.textureBaseUri,textureOptions:(f=e.extras.dome)==null?void 0:f.textureOptions,fetcher:n.fetcher,onDownloadProgress:a}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`domez`)return ya(e.extras.domez?i:Ur(i,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:n.light,textureBaseUri:(p=e.extras.domez)==null?void 0:p.textureBaseUri,textureOptions:(m=e.extras.domez)==null?void 0:m.textureOptions,fetcher:n.fetcher,onDownloadProgress:a}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`ply`)return tc(e.extras.ply?i:Ur(i,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:(h=e.extras.ply)==null?void 0:h.upAxis,type:`pbmPointCloud`,light:n.light,fetcher:n.fetcher,onDownloadProgress:a}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`obj`)return Ji(e.extras.obj?i:Ur(i,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:(g=e.extras.obj)==null?void 0:g.upAxis,light:n.light,fetcher:n.fetcher,onDownloadProgress:a}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`fbx`)return al(e.extras.fbx?i:Ur(i,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:n.light,fetcher:n.fetcher,onDownloadProgress:a}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`x3p`)return zl(e.extras.x3p?i:Ur(i,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,light:n.light,fetcher:n.fetcher,onDownloadProgress:a}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t));if(_===`spz`)return Is(Ur(i,{key:`model.${e.siblingIndex}`}),{upAxis:`Z`,modelUpAxis:`Z`,fetcher:n.fetcher,onDownloadProgress:a}).then(t=>(t.scene.applyMatrix4(e.transform),t.scene.updateWorldMatrix(!1,!0),t.scene.matrixAutoUpdate=!1,t.scene.transformChanged=!0,t));throw Error(`Invalid Tile content: ${i}`)}).then(t=>{let i={type:t.type,uri:t.uri,byteLength:t.byteLength,memoryUsage:t.memoryUsage,object:new jd(e.id,t.scene,t.animations,t.dispose)};return Promise.resolve().then(()=>{i.object.traverse(e=>{e.matrix.compose(e.position,e.quaternion,e.scale),e.matrixAutoUpdate=!1})}).then(()=>Promise.all([i.object.generateBvhTree(),n.renderer?nf(t.textures,n.renderer):null])).then(()=>(r.loadState=`READY`,r.loadStateUpdateTime=V(),r.loadfailRetryDelay=0,r.byteLength=i.byteLength,r.memoryUsage=i.memoryUsage,r.data=i,e)).catch(t=>(lf(e),Promise.reject(t)))}).catch(e=>(r.loadState=`FAILED`,r.loadStateUpdateTime=V(),e instanceof $n&&e.httpStatus===0||e instanceof er||e instanceof Qn?r.loadfailRetryDelay=H(r.loadfailRetryDelay+of,of,af):r.loadfailRetryDelay=1/0,Promise.reject(e)))}throw Error(`Invalid Tile type: ${e.type}`)}function lf(e){e.content&&(e.content.data&&e.content.data.object.dispose(),e.content.data=void 0,e.content.loadState=`UNLOADED`,e.content.loadStateUpdateTime=V(),e.content.byteLength=0,e.content.memoryUsage=0)}var uf=5e3,df=1e3,ff={vertexShader:`
|
|
863
863
|
varying vec2 vUv;
|
|
864
864
|
uniform float displacementScalar;
|
|
@@ -2840,7 +2840,7 @@ void main() {
|
|
|
2840
2840
|
#include <premultiplied_alpha_fragment>
|
|
2841
2841
|
|
|
2842
2842
|
}
|
|
2843
|
-
`},cy=class extends t.ShaderMaterial{constructor(e){super({uniforms:t.UniformsUtils.clone(sy.uniforms),vertexShader:sy.vertexShader,fragmentShader:sy.fragmentShader,clipping:!0}),this.type=`LineMaterial`,this.dashed=!1,Object.defineProperties(this,{color:{enumerable:!0,get(){return this.uniforms.diffuse.value},set(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get(){return this.uniforms.linewidth.value},set(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get(){return this.uniforms.dashScale.value},set(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get(){return this.uniforms.dashSize.value},set(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get(){return this.uniforms.gapSize.value},set(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(e){this.uniforms.resolution.value.copy(e)}}}),this.setValues(e)}};Object.assign(cy.prototype,{isLineMaterial:!0});var ly=class extends t.Mesh{constructor(e,t){super(),this.type=`LineSegments2`,this.geometry=e===void 0?new oy:e,this.material=t===void 0?new cy({color:Math.random()*16777215}):t}computeLineDistances(){let e=this.geometry,n=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*n.count),a=new t.Vector3,o=new t.Vector3;for(var s=0,c=0,l=n.count;s<l;s++,c+=2)a.fromBufferAttribute(n,s),o.fromBufferAttribute(r,s),i[c]=c===0?0:i[c-1],i[c+1]=i[c]+a.distanceTo(o);let u=new t.InstancedInterleavedBuffer(i,2,1);return e.setAttribute(`instanceDistanceStart`,new t.InterleavedBufferAttribute(u,1,0)),e.setAttribute(`instanceDistanceEnd`,new t.InterleavedBufferAttribute(u,1,1)),this}raycast(e,n){e.camera===null&&console.error(`LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.`);let r=e.ray,i=e.camera,a=i.projectionMatrix,o=this.geometry,s=this.material,c=s.resolution,l=s.linewidth,u=o.attributes.instanceStart,d=o.attributes.instanceEnd,f=new t.Vector4,p=new t.Vector4,m=new t.Vector4,h=new t.Vector3,g=new t.Matrix4,_=new t.Line3,v=new t.Vector3;r.at(1,m),m.w=1,m.applyMatrix4(i.matrixWorldInverse),m.applyMatrix4(a),m.multiplyScalar(1/m.w),m.x*=c.x/2,m.y*=c.y/2,m.z=0,h.copy(m);let y=this.matrixWorld;g.multiplyMatrices(i.matrixWorldInverse,y);for(var b=0,x=u.count;b<x;b++){f.fromBufferAttribute(u,b),p.fromBufferAttribute(d,b),f.w=1,p.w=1,f.applyMatrix4(g),p.applyMatrix4(g),f.applyMatrix4(a),p.applyMatrix4(a),f.multiplyScalar(1/f.w),p.multiplyScalar(1/p.w);var S=f.z<-1&&p.z<-1,C=f.z>1&&p.z>1;if(S||C)continue;f.x*=c.x/2,f.y*=c.y/2,p.x*=c.x/2,p.y*=c.y/2,_.start.copy(f),_.start.z=0,_.end.copy(p),_.end.z=0;let e=_.closestPointToPointParameter(h,!0);_.at(e,v);let i=t.MathUtils.lerp(f.z,p.z,e),o=i>=-1&&i<=1;var w=h.distanceTo(v)<l*.5;if(o&&w){_.start.fromBufferAttribute(u,b),_.end.fromBufferAttribute(d,b),_.start.applyMatrix4(y),_.end.applyMatrix4(y);var T=new t.Vector3,E=new t.Vector3;r.distanceSqToSegment(_.start,_.end,E,T),n.push({point:E,pointOnLine:T,distance:r.origin.distanceTo(E),object:this,faceIndex:b})}}}};Object.assign(ly.prototype,{isLineSegments2:!0});var uy=class extends ly{constructor(e,t){super(e,t),this.type=`Line2`}};Object.assign(uy.prototype,{isLine2:!0});var dy=class extends oy{constructor(){super(),this.type=`LineGeometry`}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}fromLine(e){let n=e.geometry;if(n instanceof t.Geometry){let e=new t.BufferGeometry().fromGeometry(n);this.setPositions(e.attributes.position.array)}else n instanceof t.BufferGeometry&&this.setPositions(n.attributes.position.array);return this}copy(){return this}};Object.assign(dy.prototype,{isLineGeometry:!0});var fy=14467195,py=8,my=2,hy=20,gy=null,_y=class extends t.Object3D{static get version(){return`6.9.0-alpha.2`}constructor(e=new t.Vector3,n=new t.Vector3){super(),this.type=`FiveLine`,this.needsRender=!0;let r=new dy,i=new cy({color:fy,linewidth:my,dashScale:hy,dashed:!1});this.line=new uy(r,i);let a=new t.BufferGeometry,o=new t.PointsMaterial({color:fy,size:py,map:gy||(gy=new t.TextureLoader().load(`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==`)),sizeAttenuation:!1,transparent:!0});this.points=new t.Points(a,o),this.points.renderOrder=11,this.points.frustumCulled=!1,this.setPoints(e,n),this.add(this.line,this.points)}setPoints(e,n){let r=[].concat(e.toArray(),n.toArray());this.points.geometry.setAttribute(`position`,new t.BufferAttribute(new Float32Array(r),3)),this.line.geometry.setPositions(r),this.line.computeLineDistances(),this.needsRender=!0}getPoints(){let e=this.points.geometry.attributes.position.array;return[new t.Vector3(e[0],e[1],e[2]),new t.Vector3(e[3],e[4],e[5])]}setMaterial(e){let t=this.line.material;for(let n in e){if(!e.hasOwnProperty(n))continue;let r=e[n];n===`dashed`?(t.dashed=r,r?t.defines.USE_DASH=``:delete t.defines.USE_DASH,t.needsUpdate=!0):t[n]=e[n]}this.needsRender=!0}setResolution(e,t){let n=this.line.material.resolution;(n.x!==e||n.y!==t)&&(n.set(e,t),this.needsRender=!0)}};Object.assign(_y.prototype,{isFiveLine:!0});var vy={Handedness:Object.freeze({NONE:`none`,LEFT:`left`,RIGHT:`right`}),ComponentState:Object.freeze({DEFAULT:`default`,TOUCHED:`touched`,PRESSED:`pressed`}),ComponentProperty:Object.freeze({BUTTON:`button`,X_AXIS:`xAxis`,Y_AXIS:`yAxis`,STATE:`state`}),ComponentType:Object.freeze({TRIGGER:`trigger`,SQUEEZE:`squeeze`,TOUCHPAD:`touchpad`,THUMBSTICK:`thumbstick`,BUTTON:`button`}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:`transform`,VISIBILITY:`visibility`})};function yy(e){return Xo(this,void 0,void 0,function*(){let t=yield fetch(e);if(t.ok)return t.json();throw Error(t.statusText)})}function by(e){return Xo(this,void 0,void 0,function*(){if(!e)throw Error(`No basePath supplied`);return yield yy(`${e}/profilesList.json`)})}function xy(e,t){return Xo(this,arguments,void 0,function*(e,t,n=null,r=!0){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No basePath supplied`);let i=yield by(t),a;if(e.profiles.some(e=>{let n=i[e];return n&&(a={profileId:e,profilePath:`${t}/${n.path}`,deprecated:!!n.deprecated}),!!a}),!a){if(!n)throw Error(`No matching profile name found`);let e=i[n];if(!e)throw Error(`No matching profile name found and default profile "${n}" missing.`);a={profileId:n,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}let o=yield yy(a.profilePath),s;if(r){let t;if(t=o.layouts[e.handedness],!t)throw Error(`No matching handedness, ${e.handedness}, in profile ${a.profileId}`);t.assetPath&&(s=a.profilePath.replace(`profile.json`,t.assetPath))}return{profile:o,assetPath:s}})}var Sy={xAxis:0,yAxis:0,button:0,state:vy.ComponentState.DEFAULT};function Cy(e=0,t=0){let n=e,r=t;if(Math.sqrt(e*e+t*t)>1){let i=Math.atan2(t,e);n=Math.cos(i),r=Math.sin(i)}return{normalizedXAxis:n*.5+.5,normalizedYAxis:r*.5+.5}}var wy=class{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===vy.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Sy)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:r}){let{normalizedXAxis:i,normalizedYAxis:a}=Cy(e,t);switch(this.componentProperty){case vy.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?i:.5;break;case vy.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?a:.5;break;case vy.ComponentProperty.BUTTON:this.value=this.states.includes(r)?n:0;break;case vy.ComponentProperty.STATE:this.valueNodeProperty===vy.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=+!!this.states.includes(r);break;default:throw Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}},Ty=class{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw Error(`Invalid arguments supplied`);this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(e=>{let n=new wy(t.visualResponses[e]);this.visualResponses[e]=n}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:vy.ComponentState.DEFAULT,button:this.gamepadIndices.button===void 0?void 0:0,xAxis:this.gamepadIndices.xAxis===void 0?void 0:0,yAxis:this.gamepadIndices.yAxis===void 0?void 0:0}}get data(){return Object.assign({id:this.id},this.values)}updateFromGamepad(e){if(this.values.state=vy.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){let t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=vy.ComponentState.PRESSED:(t.touched||this.values.button>vy.ButtonTouchThreshold)&&(this.values.state=vy.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===vy.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>vy.AxisTouchThreshold&&(this.values.state=vy.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===vy.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>vy.AxisTouchThreshold&&(this.values.state=vy.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}},Ey=class{constructor(e,t,n){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No profile supplied`);this.xrInputSource=e,this.assetUrl=n,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(e=>{let t=this.layoutDescription.components[e];this.components[e]=new Ty(e,t)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){let e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}},Dy=`https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles`,Oy=`generic-trigger`,ky=class extends t.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(e=>{e instanceof t.Mesh&&e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}),this)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(e=>{Object.values(e.visualResponses).forEach(e=>{let{valueNode:t,minNode:n,maxNode:r,value:i,valueNodeProperty:a}=e;t&&(a===vy.VisualResponseProperty.VISIBILITY?t.visible=i:a===vy.VisualResponseProperty.TRANSFORM&&(t.quaternion.copy(n.quaternion).slerp(r.quaternion,i),t.position.lerpVectors(n.position,r.position,i)))})}))}};function Ay(e,n){Object.values(e.components).forEach(e=>{let{type:r,touchPointNodeName:i,visualResponses:a}=e;if(r===vy.ComponentType.TOUCHPAD)if(e.touchPointNode=n.getObjectByName(i),e.touchPointNode){let n=new t.Mesh(new t.SphereGeometry(.001),new t.MeshBasicMaterial({color:255}));e.touchPointNode.add(n)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(a).forEach(e=>{let{valueNodeName:t,minNodeName:r,maxNodeName:i,valueNodeProperty:a}=e;if(a===vy.VisualResponseProperty.TRANSFORM){if(e.minNode=n.getObjectByName(r),e.maxNode=n.getObjectByName(i),!e.minNode){console.warn(`Could not find ${r} in the model`);return}if(!e.maxNode){console.warn(`Could not find ${i} in the model`);return}}e.valueNode=n.getObjectByName(t),e.valueNode||console.warn(`Could not find ${t} in the model`)})})}function jy(e,n){Ay(e.motionController,n),e.envMap&&n.traverse(n=>{n instanceof t.Mesh&&n.isMesh&&(n.material.envMap=e.envMap,n.material.needsUpdate=!0)}),e.add(n)}var My=class{constructor(e=null){this.gltfLoader=e,this.path=Dy,this._assetCache={}}createControllerModel(e){let t=new ky,n=null;return e.addEventListener(`connected`,e=>{let r=e.data;r.targetRayMode!==`tracked-pointer`||!r.gamepad||xy(r,this.path,Oy).then(({profile:e,assetPath:i})=>{t.motionController=new Ey(r,e,i);let a=this._assetCache[t.motionController.assetUrl];if(a)n=a.scene.clone(),jy(t,n);else{if(!this.gltfLoader)throw Error(`GLTFLoader not set.`);this.gltfLoader.load(t.motionController.assetUrl,e=>{this._assetCache[t.motionController.assetUrl]=e,n=e.scene.clone(),jy(t,n)})}}).catch(e=>{console.warn(e)})}),e.addEventListener(`disconnected`,()=>{t.motionController=null,t.remove(n),n=null}),t}},Ny=`fade`,Py=Object.assign({},fr(Y_,[`maxLatitude`,`minLatitude`]));function Fy(e,t){if(!t)return e;let n=e.match(/\d+_[a-z].png/);return e.substring(0,n.index)+t+`/`+e.substring(n.index)}var Iy=300,Ly=new t.Raycaster,Ry=new t.Vector3,zy={Floorplan:Jg,Topview:Xg,Panorama:X_,VRPanorama:Vv,Model:Kv,Mapview:Qv,XRPanorama:class e extends X_{static parseArgs(t){if(t instanceof e)return t;let n=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return super.parseArgs(n)}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`XRPanorama`})}constructor(e){super(e),this.xrManager=new ay(this.renderer,this.renderer.getContext(),{onSessionStart:e=>{this.emit(`xr.session.start`,Q(`xr.session.start`,{session:e,machineType:this.xrManager.machineType}))},onSessionEnd:()=>{this.emit(`xr.session.end`,Q(`xr.session.end`,{session:null,machineType:this.xrManager.machineType}))}}),this.xrControllerRay={left:new t.Raycaster,right:new t.Raycaster},this.xrControllerRay.left.params.Points={threshold:.1},this.xrControllerRay.left.firstHitOnly=!0,this.xrControllerRay.left.floorIndex=-1,this.xrControllerRay.right.params.Points={threshold:.1},this.xrControllerRay.right.firstHitOnly=!0,this.xrControllerRay.right.floorIndex=-1,this.gazeRay=null,this.pointerLines={left:new _y,right:new _y},this.pointerLines.left.visible=!1,this.pointerLines.right.visible=!0,this.pointerLines.left.setMaterial({color:new t.Vector3(1,1,1)}),this.pointerLines.left.points.material.depthTest=!1,this.pointerLines.right.setMaterial({color:new t.Vector3(1,1,1)}),this.pointerLines.right.points.material.depthTest=!1,this.controllerWrappers=[new t.Group,new t.Group];let n=this.xrManager.getController(0);this.controllerWrappers[0].add(n);let r=this.xrManager.getController(1);this.controllerWrappers[1].add(r);let i=new My;i.gltfLoader={load(e,t){ur.ajax(e,{responseType:`arraybuffer`}).then(t=>{var n;return Us(t.body,{resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,fetcher:ur})}).then(e=>t(e))}},(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`)&&this.scene.add(this.pointerLines.left,this.pointerLines.right,this.controllerWrappers[0],this.controllerWrappers[1]),this.panoResources={},this.panoResources[this.locationMotion.keyframes[0].key=this.locationMotion.keyframes[1].key=Zt()]={panoId:Z(this.currentPano),leftPanoPicture:null,position:this.camera.pose.offset.clone(),effect:Ny,effectEasing:G_,fixCameraTransform:new t.Matrix4},this.parallaxCameraMatrixs=[];let a=ei.shared.getContext();if(!a){console.error(`获取session失败,请退出重试`);return}this.on(`xr.session.end`,()=>{this.scene.remove(this.pointerLines.left,this.pointerLines.right)}),this.xrManager.setSession(a),this.on(`xr.session.start`,()=>{let e=this.xrManager.getControllerGrip(0);e.add(i.createControllerModel(e)),this.controllerWrappers[0].add(e);let t=this.xrManager.getControllerGrip(1);t.add(i.createControllerModel(t)),this.controllerWrappers[1].add(t)}),this.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},this.xrManager.machineType===`VP`&&this.initHandEvent()}updateConfiguration(e){return super.updateConfiguration(Object.assign(Object.assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))}moveToPano(e,n,r){var i,a,o;this.userAction=r,this.stopMomentumMovement();let s=Z(e),c=this.works.getObserver(e);if(!c)throw Error(`Invalid PanoIndex`);let l=Kr(c.images.up),u=this.imageOptions.size;u===void 0&&c&&l&&(u=Number(l)),u===void 0&&(u=2048);let d=this.imageOptions.transform,f=(e,t)=>Fy(Wr(e,d,t)),p=Object.assign({key:`pano.${s}`},dr(this.imageOptions,[`format`,`size`,`quality`])),m={right:c.images.work.getURL(c.images.right),left:c.images.work.getURL(c.images.left),up:c.images.work.getURL(c.images.up),down:c.images.work.getURL(c.images.down),front:c.images.work.getURL(c.images.front),back:c.images.work.getURL(c.images.back)},h=`pano:`+Ip([m,p,d]);if(this.pendingPanoTask){if(this.pendingPanoTask.hash===h)return;{let t=this.pendingPanoTask.panoId;(i=this.panoMeshes.get(t))==null||i.setProgress(0),this.emit(`pano.texture.abort`,Q(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:e}))}}let g=`move-to-pano-`+s;this.pending.add(g);let _=xg(`pano.prepare`,{options:n,prevMode:this.mode,prevPano:this.currentPano,pano:e});if(this.emit(`pano.prepare`,_),_.defaultPrevented){this.pending.delete(g);return}_.options!==n&&Object.assign(n,_.options);let v=this.modelScene.parameter,y;v.pano0&&v.pano0.map.name===h?y=v.pano0:v.pano1&&v.pano1.map.name===h&&(y=v.pano1);let b=(a=n.effect)==null?Ny:a,x=(o=n.effectEasing)==null?G_:o;if(y){let r={panoId:s,effect:b,effectEasing:x,leftPanoPicture:{panoId:y.panoId,map:y.map,mapHistogram:y.mapHistogram,mapSize:y.mapSize,matrix:c.matrix.clone().premultiply(c.work.transform),zoom:1},position:c.position.clone().applyMatrix4(c.work.transform),fixCameraTransform:new t.Matrix4};r.leftPanoPicture&&this.panoPictureObserverMap.set(r.leftPanoPicture,c),this.pendingPanoTask=void 0,Promise.resolve().then(()=>Sg(_)).catch(e=>{let t=Wg(e);return this.emit(`error`,t),t}).then(t=>{var i,a;if(!(t instanceof Error))this.pending.delete(g),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0),this.doMoveToPano(e,r,n);else{let e=null;t instanceof Error&&(e||(e=t));let r=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:null,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:r})),n.moveCancelCallback&&n.moveCancelCallback(),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:r})),e instanceof Error&&e.message&&this.emit(`error`,e),this.pending.delete(g),this.pendingPanoTask=void 0,(a=this.panoMeshes.get(s))==null||a.setProgress(0)}});return}let S=this.panoMeshes.get(s);S&&S.tap&&S.tap(),this.pendingPanoTask={panoId:s,hash:h,onLoad:r=>{var i;let a=r.body;if(this.destroyed)a.dispose();else{a.name=h;let r=Array.isArray(a.image)?a.image[0]:a.image,o=(i=r==null?void 0:r.width)==null?2048:i,l=new zm().formPixels(Rg(this.renderer,a,!0,Fm).data),u={panoId:s,effect:b,effectEasing:x,leftPanoPicture:{panoId:s,map:a,mapSize:o,mapHistogram:new t.Vector4().fromArray(l.toArray()),matrix:c.matrix.clone(),zoom:1},position:c.position.clone(),fixCameraTransform:new t.Matrix4};u.leftPanoPicture&&this.panoPictureObserverMap.set(u.leftPanoPicture,c),this.doMoveToPano(e,u,n)}},onError:e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:null,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:t})),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:t})),e instanceof Error&&e.message&&this.emit(`error`,e),n.moveCancelCallback&&n.moveCancelCallback()}},Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}).then(()=>this.textureLoader.loadCubeTexture(m,{imageURL:{transform:f,options:p},format:t.RGBFormat,viaAjax:!0,fetcher:Gf(this.fiveId,c.work)},void 0,void 0,t=>{var n,r;this.emit(`pano.texture.progress`,Q(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e})),((n=this.pendingPanoTask)==null?void 0:n.hash)===h&&((r=this.panoMeshes.get(s))==null||r.setProgress(t))},this.renderer)).catch(t=>{let n=Wg(t);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:n,progress:0,meta:null,pano:e})),n}),Promise.resolve().then(()=>Sg(_)).catch(e=>Wg(e))]).then(([t,n])=>{var r,i,a,o;if(!(t instanceof Error)&&!(n instanceof Error))this.pending.delete(g),((r=this.pendingPanoTask)==null?void 0:r.hash)===h?(this.pendingPanoTask.onLoad(t),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,Q(`pano.texture.success`,{error:null,progress:1,meta:t.meta,pano:e}));else{let e=null;t instanceof Error?e||(e=t):t.body.dispose(),n instanceof Error&&(e||(e=n)),this.pending.delete(g),((a=this.pendingPanoTask)==null?void 0:a.hash)===h&&(this.pendingPanoTask.onError(e),this.pendingPanoTask=void 0,(o=this.panoMeshes.get(s))==null||o.setProgress(0))}})}doMoveToPano(e,n,r={}){var i,a,o,s,c,l,u,d,f,p;let m=V(),h=Zt();this.panoResources[h]=n;let g,_,v;if(this.locationMotion.ended){let[e,t]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(t).position,a=n.position;g=Math.max(i.distanceTo(a),1),_=[{key:t.key,progress:0,value:Object.assign(Object.assign({},r),{count:0})},{key:h,progress:1,value:{distance:0,count:1}}],v=0}else{let[e,t]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(t).position,o=n.position,s=t.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;g=c+Math.max(a.distanceTo(o),1),_=[{key:e.key,progress:0,value:Object.assign({},r)},{key:t.key,progress:c/g,value:t.value},{key:h,progress:1,value:{count:t.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(_);v=this.locationMotion.getProgressVelocity(m)*l/u}let y=n.effect===`instant`?0:this.calculateMovingDuration(r.duration,n.effect===`fly`||n.effect===`model`?g:0),b={longitude:r.longitude,latitude:r.latitude,fov:r.fov},x=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(i=b.longitude)==null?this.camera.pose.longitude:i,latitude:(a=b.latitude)==null?this.camera.pose.latitude:a,fov:(o=b.fov)==null?this.camera.pose.fov:o,offset:n.position.clone(),distance:0}),S=this.currentPano;if(this.emit(`pano.moveTo`,Q(`pano.moveTo`,{options:r,prevPano:S,pano:{panoIndex:x.panoIndex,workCode:x.workCode},progress:0,state:x,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(x),this.perspToOrthoMotion.set({perspToOrtho:0},y).catch(G),this.modelAlphaMotion.setKeyframes([{progress:0,value:Object.assign({},this.modelAlphaMotion.value)},{progress:.6,value:Object.assign({},this.modelAlphaMotion.value)},{progress:1,value:{modelAlpha:0}}],y).catch(G),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute(`src`)&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute(`uuid`),this.videoTexture.image.removeAttribute(`src`),this.videoTexture.image.oncanplay=G,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),n.effect===`fly`||n.effect===`model`)this.cameraMotion.set(b,y).catch(G);else{let e=It({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),r=It({longitude:(s=b.longitude)==null?this.cameraMotion.value.longitude:s,latitude:(c=b.latitude)==null?this.cameraMotion.value.latitude:c}),i=new t.Object3D;i.lookAt(e);let a=new t.Matrix4().makeRotationFromQuaternion(i.quaternion);i.lookAt(r);let o=new t.Matrix4().makeRotationFromQuaternion(i.quaternion),m=new t.Matrix4().getInverse(a).premultiply(o),h=this.cameraMotion.value.fov,g=(l=b.fov)==null?this.cameraMotion.value.fov:l,v=1;n.effect===`zoomin`?v=1.5:n.effect===`zoomout`&&(v=.4);let x=g*v;for(let e=0;e<_.length-1;e++){let t=_[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(m),e.leftPanoPicture&&(e.leftPanoPicture.zoom=Math.tan(x/2/180*Math.PI)/Math.tan(h/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(u=b.longitude)==null?this.cameraMotion.value.longitude:u,latitude:(d=b.latitude)==null?this.cameraMotion.value.latitude:d,fov:x}},{progress:1,value:{longitude:(f=b.longitude)==null?this.cameraMotion.value.longitude:f,latitude:(p=b.latitude)==null?this.cameraMotion.value.latitude:p,fov:g}}],y).catch(G)}this.locationMotion.setKeyframes(_,y,v).then(()=>{for(let e of this.modelScene.children)e instanceof up&&e.show();let t=Object.assign(Object.assign({},e),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:0});this.emit(`pano.arrived`,Q(`pano.arrived`,{options:r,prevPano:S,pano:{panoIndex:t.panoIndex,workCode:t.workCode},progress:1,state:t,userAction:this.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(t);let n=this.works.getObserver(this.currentPano);if(n&&n.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:n.images.video.size.clone(),matrix:n.images.video.matrix.clone(),panoMatrix:n.matrix.clone().premultiply(n.work.transform),alpha:1},t=Zt(),r=this.videoTexture.image;r.setAttribute(`uuid`,t),t_().then(i=>{i&&n.images.video&&r.getAttribute(`uuid`)===t&&(r.oncanplay=()=>{r.oncanplay=G,r.play()},r.ontimeupdate=()=>{r.currentTime>.5&&(r.ontimeupdate=G,this.panoVideo.setMaterial(e))},r.src=n.images.video.source)}).catch((()=>{r.removeAttribute(`uuid`)}))}},()=>{let e=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{options:r,prevPano:S,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),r.moveCancelCallback&&r.moveCancelCallback()})}checkSelectedPano(e){var n;this.stopMomentumMovement(),this.camera.getDirection(new t.Vector3).setY(0);let r=null,i=this.works.getObserver(this.currentPano);if(!i)return null;let a=i.work.observers,o=i.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&i.work.workCode===this.currentPano.workCode)return!1;let t=a[e];return!t||Ry.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[s]=this.modelScene.intersectRaycaster(e);if(s){let[e,t]=vu(o,e=>{let t=a[e];return t?Ry.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(s.point):1/0},!0);typeof e==`number`&&t<this.panoTapTriggerRadius&&(r=(n=a[e])==null?null:n)}if($v(r)){let t=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);t&&(r=t)}for(let e of this.locationMotion.keyframes){let t=this.panoResourceFromLocationMotionKeyframe(e);if(!(e.progress<this.locationMotion.progress)&&r){let e=Z({panoIndex:r.panoIndex,workCode:r.work.workCode});if(t.panoId===e){r=null;break}}}if($v(r))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!r.active){let e=Z({panoIndex:r.panoIndex,workCode:r.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}let c={workCode:r.work.workCode,panoIndex:r.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:r?r.position.clone():new t.Vector3};return this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.workCode},state:c,userAction:!0,options:{},progress:0,error:null})),r&&r.active?(this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.workCode},progress:0,state:c,options:{},error:null})),{workCode:r.work.workCode,panoIndex:r.panoIndex}):null}destroy(){super.destroy()}isReady(){return!1}updateCamera(e,t,n){return Promise.resolve()}updateCameraWithKeyframes(e,t,n){return Promise.resolve()}updateTime(e,n,...r){var i,a,o,s,c,l,u,d,f;this.userAction=!0;let p={},m={},h=this.camera.getDirection(new t.Vector3),g=this.locationMotion.keyframes[0],_=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[v,y]=this.locationMotion.getKeyFrameSegment(e),b=this.panoResourceFromLocationMotionKeyframe(v),x=this.panoResourceFromLocationMotionKeyframe(y),S=this.panoResourceFromLocationMotionKeyframe(g),C=this.panoResourceFromLocationMotionKeyframe(_),w=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),m.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let n=this.locationMotion.value.count-y.value.count+1,r=new t.Vector3().copy(b.position),o=new t.Vector3().copy(x.position);if(p.progress=n,n>=.01&&n<=.99&&(p.progress=H(x.effectEasing(n),.01,.99)),x.leftPanoPicture&&(n<1?b.leftPanoPicture&&(p.pano0=b.leftPanoPicture):p.pano0=x.leftPanoPicture,p.pano1=x.leftPanoPicture),x.effect===`montage`?p.transition=`BLACK`:x.effect===`spread`?p.transition=`SPREAD`:p.transition=`FADE`,x.effect===`zoomin`||x.effect===`zoomout`?p.progress=Math.pow(n,3):x.effect===`model`&&this.camera.pose.distance<.01&&(p.modelAlpha=1-Math.pow(H(Math.abs(n-.5)*2,0,1),4)),n<1&&x.effect!==`fly`){if(p.pano0&&b.leftPanoPicture){let e={panoId:p.pano0.panoId,map:p.pano0.map,mapHistogram:p.pano0.mapHistogram,mapSize:p.pano0.mapSize,zoom:p.pano0.zoom,matrix:b.leftPanoPicture.matrix.clone().setPosition(x.position)},t=this.panoPictureObserverMap.get(p.pano0);t&&this.panoPictureObserverMap.set(e,t),p.pano0=e}r.copy(o),w=!0}m.distance=this.locationMotion.value.distance,m.offset=new t.Vector3(r.x+(o.x-r.x)*n,r.y+(o.y-r.y)*n,r.z+(o.z-r.z)*n);let s=[],c=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(s.push(t),n>this.locationMotion.progress&&c.push(t))}for(let e of Object.keys(this.panoResources)){if(c.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.leftPanoPicture){let e=t.leftPanoPicture.map;if(e){if(e===((i=p.pano0)==null?void 0:i.map)||e===((a=p.pano1)==null?void 0:a.map))continue;e.dispose(),t.leftPanoPicture=null}}s.indexOf(e)>=0||delete this.panoResources[e]}let l=Rp(x.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,Q(`pano.moving`,{userAction:this.userAction,prevPano:Rp(S.panoId),pano:Rp(C.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},Rp(C.panoId)),{mode:this.mode}),$(this.camera.pose)),m),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(m),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);let[T,E]=r,D=new t.Vector3(0,0,0),O=new t.Vector2().copy(this.camera.resolution);if(E&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){let r=this.xrManager.cameraVR,i=this.xrManager.referenceSpace,a=this.xrManager.session.renderState.baseLayer,l=E.getViewerPose(i),u=(o=l==null?void 0:l.views)==null?[]:o;for(let e=0;e<u.length;e++){let t=u[e],n=r.cameras[e],i=a.getViewport(t);i&&(n.projectionMatrix.fromArray(t.projectionMatrix),n.projectionMatrixInverse.getInverse(n.projectionMatrix),n.matrix.fromArray(t.transform.matrix),n.matrix.setPosition(this.camera.position),n.matrix.decompose(n.position,n.quaternion,n.scale),n.matrixWorld.copy(n.matrix),n.matrixWorldInverse.getInverse(n.matrixWorld),n.matrixAutoUpdate=!1,D.copy(n.position),n.viewport.set(i.x,i.y,i.width,i.height),O.set(i.width,i.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((s=m.distance)==null?this.camera.pose.distance:s),this.xrManager.session.inputSources){for(let e=0;e<this.xrManager.session.inputSources.length;e++)if(this.xrManager.session.inputSources[e]&&this.xrManager.session.inputSources[e].targetRayMode===`transient-pointer`){let n=E.getPose(this.xrManager.session.inputSources[e].targetRaySpace,i);if(n){let e=n.transform.orientation,r=new t.Quaternion(e.x,e.y,e.z,e.w),i=new t.Vector3(0,0,-1).applyQuaternion(r),a=new t.Raycaster(this.camera.position,i);this.gazeRay=a}}}if(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`){let r=this.xrManager.session.inputSources;for(let e=0;e<r.length;e++){let n=this.xrManager.controllers[e],a=r[e];if(!a)continue;n&&n.update(a,E,i);let o=this.xrManager.getController(e),s=new t.Vector3(0,1.2,0),l=o.position.clone().add(D).sub(s);a.handedness===`left`?this.xrControllerRay.left.set(l,new t.Vector3(0,0,-1).applyEuler(o.rotation)):a.handedness===`right`&&this.xrControllerRay.right.set(l,new t.Vector3(0,0,-1).applyEuler(o.rotation)),this.controllerWrappers[e].position.copy(new t.Vector3(0,0,0).add(D).sub(s));let u=this.modelScene.intersectRaycaster(this.xrControllerRay.right);if(u.length===0){let e=this.works.getResolvedObserver(this.currentPano);u=this.xrControllerRay.right.intersectObject(this.modelScene.boundingMesh,!0).map(t=>{var n;let r=(n=e==null?void 0:e.floorIndex)==null?0:n;return Object.assign({floorIndex:r,floor:r},t)})}if(u.length>=1&&u[0].face)if(a.handedness===`right`){let e=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),t=u[0].face.normal,n=t.clone(),r=u[0].point.clone();this.intersectMesh.position.copy(r);let i=r.clone().add(n);if(this.intersectMesh.lookAt(i),Math.abs(t.y)>.99){let e=this.camera.position.clone().sub(r);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0,e.length>0?(this.pointerLines.right.setPoints(l,e[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(l,u[0].point));let a=u[0],o=Q(`intersect.update`,{raycaster:(c=this.xrControllerRay.right)==null?null:c,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(l,u[0].point)}this.updateControllerHelper(r,e,n)}}else E||console.error(`xrFrame丢失,请重试`),this.xrManager.session||console.error(`session丢失,请重试`),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error(`no layer found`);Ag(p)===!1&&this.modelScene.parameter.set(p),this.emit(`camera.update`,Q(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose))}));let k=this.works.getResolvedObserver(this.currentPano),A=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,j=this.works.getObserver(b.panoId),M=this.works.getObserver(x.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&k){let e=[],n=k.work.observers;for(let t of k.accessibleNodes){let r=n[t];r&&e.push(r)}let r=new Map;if(e.sort((e,t)=>{let n=r.get(e);n===void 0&&(n=e.standingPosition.distanceTo(k.standingPosition),r.set(e,n));let i=r.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(k.standingPosition),r.set(t,i)),n-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let n=e[this.accessibleObserverFloorCheckCount],r=this.modelScene.models.find(e=>e.work===(n==null?void 0:n.work));if(n&&r&&r.visible){let e=.3,i=.005,a=n.standingPosition.clone().applyMatrix4(n.work.transform),o=Z({panoIndex:n.panoIndex,workCode:n.work.workCode}),s=J_.map(n=>{Ly.ray.origin.copy(a),Ly.ray.origin.add(Ry.copy(n).setY(e)),Ly.ray.direction.set(0,-1,0),Ly.firstHitOnly=!0,Ly.floorIndex=-1;let[o]=r.intersectRaycaster(Ly);return o&&o.distance-i<=e?new t.Vector3().copy(a).setY(o.point.y+i):a});s.sort((e,t)=>t.y-e.y);let c=s[Math.floor(s.length/2)],[l]=s.filter(e=>e.distanceTo(c)<=.05);if(l){let e=new t.Vector4(a.x,a.y,a.z,l.y-a.y),n=this.adjustPanoCircleMeshPositionFix.get(o);n&&!e.equals(n)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(o,e)}}this.accessibleObserverFloorCheckCount++}}let N=new Map;if(j)for(let e of j.accessibleNodes){let t=j.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(M)for(let e of M.accessibleNodes){let t=M.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{N.get(t)?N.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),N.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),N.delete(t)}),this.panoMeshes.forEach((e,n)=>{let r=this.works.getObserver(n);if(r){let i=r.position.distanceTo(r.standingPosition)>this.aerialObserverMinHeight;if(i)e.position.copy(r.position).applyMatrix4(r.work.transform),e.scale.setScalar(18);else{e.position.copy(r.standingPosition).applyMatrix4(r.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(r.panoId);t&&(Ry.set(t.x,t.y,t.z),Ry.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let a=this.camera.position.clone().setY(e.position.y),o=new t.Vector3().copy(e.position).sub(a).normalize();if(n===Z(this.currentPano)){let t=H((.5-a.distanceTo(e.position))/.5,0,1);o.multiplyScalar(1-t).add(h.clone().multiplyScalar(t))}if(o.length()>0){let n=i?-Math.PI/2:0,r=Math.atan2(o.x,o.z);e.quaternion.setFromEuler(new t.Euler(n,r,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||w)this.panoMeshes.forEach(t=>{t.setOpacity(0),t.setCurrent(!1),t.updateTime&&t.updateTime(e,n),t.visible=!1});else if(k){let t=k.work.observers,[,r]=vu(k.accessibleNodes,e=>{let n=t[e];return!n||!n.active?1/0:k.standingPosition.distanceTo(n.standingPosition)},!0);r=H(r,2.5,1/0);let i=k.accessibleNodes.concat(k.panoIndex).map(e=>Z({panoIndex:e,workCode:k.work.workCode}));this.panoMeshes.forEach((t,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=t.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!t.loading&&t.progress===0&&A!==null&&Z({panoIndex:A.panoIndex,workCode:A.work.workCode})===a;let n=t.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=n<.01?0:H(r/n,.1,.85)}o&&o===M&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&t.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue(`modelAlpha`)>0&&(c=0),t.setCurrent(s),t.setOpacity(c),t.updateTime&&t.updateTime(e,n)})}{let e=(l=this.modelScene.parameter.progress)==null?1:l,n=Math.round(e),r=this.modelScene.parameter.pano0,i=this.modelScene.parameter.pano1,a=n===0?r:i,o;if(a&&(o=this.works.getObserver(a.panoId),o||(o=this.panoPictureObserverMap.get(a))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(ii()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!o||!a||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new t.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=Yr(a.mapSize)+1;this.tiling.setObserver(o);let t={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:a.map,panoMatrix:a.matrix,panoZoom:a.zoom,minLevel:e,level:4},s=this.tiling.update(t),c={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:n,opacity:(r==null?void 0:r.panoId)===(i==null?void 0:i.panoId)?1:Ed(Math.abs(((u=this.modelScene.parameter.progress)==null?0:u)-.5)*2)},l=this.modelScene.parameter.refinedScreen;(s||c.pano!==(l==null?void 0:l.pano)||c.opacity!==(l==null?void 0:l.opacity))&&this.modelScene.parameter.set(`refinedScreen`,c)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&k&&k.position.y-k.standingPosition.y>10){let e=H(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1);{let e=x.effect,{pano0:n,pano1:r}=this.modelScene.parameter;if(n&&r&&n!==r&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((d=this.modelScene.parameter.pano0Depth)==null?void 0:d.panoId)!==n.panoId||((f=this.modelScene.parameter.pano1Depth)==null?void 0:f.panoId)!==r.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1});let e=new t.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(n.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,U_(this.renderer,this.modelScene,e,500);let i=new t.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);i.matrix.copy(r.matrix),i.matrixWorld.copy(i.matrix),i.matrixAutoUpdate=!1,U_(this.renderer,this.modelScene,i,500),this.modelScene.parameter.set({pano0Depth:{panoId:n.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:r.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}render(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){let e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1}onPanGesture(){}onTapGesture(){}onPinchGesture(){}onMouseMove(){}onMouseOut(){}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}updateControllerHelper(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(!e||e.length===0)return;let a={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}};for(let o=0;o<e.length;o++){let s=e[o].handedness,c=e[o].gamepad;switch(s){case`left`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`LeftAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`LeftAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`LeftAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`LeftAxesDown`,t)),c!=null&&c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`X`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`Y`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`LeftTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`LeftPinch`,t));let e={raycaster:r,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n};a.buttons.X=c.buttons&&c.buttons[4]?c.buttons[4].pressed:!1,a.buttons.Y=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.LeftTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.LeftPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1,a.left=e;break;case`right`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`RightAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`RightAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`RightAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`RightAxesDown`,t)),c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`A`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`B`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`RightTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`RightPinch`,t)),a.right={raycaster:i,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n},a.buttons.A=c.buttons&&c.buttons[4]?c==null?void 0:c.buttons[4].pressed:!1,a.buttons.B=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.RightTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.RightPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1;break;default:break}}this.emit(`xr.controller.update`,Q(`xr.controller.update`,a))}emitHandleEvent(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(e)this.xrHandleState[t].touchStart===!1?(this.xrHandleState[t].touchStartTime=n,this.xrHandleState[t].touchStart=!0,this.emit(`xr.gesture.buttonDown`,Q(`xr.gesture.buttonDown`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}))):n-this.xrHandleState[t].touchStartTime>Iy&&this.emit(`xr.gesture.press`,Q(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}));else if(this.xrHandleState[t].touchStart===!0){if(this.emit(`xr.gesture.buttonUp`,Q(`xr.gesture.buttonUp`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}})),n-this.xrHandleState[t].touchStartTime<=Iy){let e=Q(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}});!this.emit(`xr.gesture.tap`,e)&&!e.defaultPrevented&&t===`RightTrigger`&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[t].touchStart=!1,this.xrHandleState[t].touchStartTime=0}}initHandEvent(){if(!this.xrManager.session)throw Error(`初始化失败`);this.xrManager.session.addEventListener(`select`,e=>{this.gazeRay&&this.checkSelectedPano(this.gazeRay)})}}},By={Floorplan:qg,Topview:Yg,Panorama:Y_,VRPanorama:Bv,Model:Gv,Mapview:Zv,XRPanorama:Py},Vy=`gesture.pan,gesture.tap,gesture.dbltap,gesture.press,gesture.pinch,gesture.mousewheel,gesture.mousemove,gesture.momentum,gesture.fire,initAnimation.start,initAnimation.end,camera.update,intersect.update,pano.select,pano.moveTo,pano.moving,pano.arrived,pano.cancel,pano.error,pano.prepare,pano.texture.load,pano.texture.progress,pano.texture.success,pano.texture.error,pano.texture.abort,xr.session.start,xr.session.end,xr.gesture.tap,xr.gesture.press,xr.gesture.buttonUp,xr.gesture.buttonDown,xr.controller.update`.split(`,`);function Hy(e){e.on(`initAnimation.start`,t=>{e.emit(`initAnimationWillStart`,t.state.panoIndex,t.state,t.userAction)}),e.on(`initAnimation.end`,t=>{e.emit(`initAnimationEnded`,t.state.panoIndex,t.state,t.userAction)}),e.on(`gesture.pan`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pan`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPanGesture`,t.state,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pan`,t.pointers,t.isFinal),e.emit(`panGesture`,t.state,t.isFinal))}),e.on(`gesture.tap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`tap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`tap`,t.pointers,t.isFinal),e.emit(`tapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.dbltap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`dbltap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsDblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`dbltap`,t.pointers,t.isFinal),e.emit(`dblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.press`,t=>{let n=!1;n=e.emit(`wantsGesture`,`press`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`press`,t.pointers,t.isFinal),e.emit(`pressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),e.on(`gesture.pinch`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pinch`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPinchGesture`,t.scale,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pinch`,t.pointers,t.isFinal),e.emit(`pinchGesture`,t.scale,t.state.fov,t.isFinal))}),e.on(`gesture.mousewheel`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseWheel`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsMouseWheel`,t.center.delta,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseWheel`,t.pointers,t.isFinal),e.emit(`mouseWheel`,t.center.delta,t.state.fov,t.isFinal))}),e.on(`gesture.mousemove`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseMove`,t.pointers,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseMove`,t.pointers,t.isFinal),n=e.emit(`wantsChangeCameraFov`,t.state.fov),n&&t.preventDefault())}),e.on(`gesture.momentum`,t=>{let n=!1;n=e.emit(`wantsInteriaPan`,t.state),n&&t.preventDefault(),t.defaultPrevented||e.emit(`interiaPan`,t.state,t.isFinal)}),e.on(`camera.update`,t=>{e.emit(`cameraFovUpdate`,t.state.fov,t.userAction),e.emit(`cameraDirectionUpdate`,t.state,t.userAction);let n=It(t.state);n.setLength(t.state.distance);let r=t.state.offset.clone().sub(n);e.emit(`cameraPositionUpdate`,r,t.userAction),e.emit(`cameraUpdate`,t.state,t.userAction)}),e.on(`intersect.update`,t=>{if(t.intersection){let n=!1;n=e.emit(`wantsShowIntersectionOnModel`,t.raycaster),n&&t.preventDefault(),t.defaultPrevented||e.emit(`intersectionOnModelUpdate`,t.intersection,t.object)}else e.emit(`intersectionHidden`)}),e.on(`pano.request`,t=>{let n=e.emit(`wantsMoveToPano`,t.state.panoIndex,t.options,t.userAction);n||(n=e.emit(`wantsToMoveToPano`,t.state.panoIndex,t.options,t.userAction)),n&&t.preventDefault(),t.defaultPrevented||e.emit(`panoWillLoad`,t.state.panoIndex)}),e.on(`pano.select`,t=>{e.emit(`panoSelected`,t.state.panoIndex)}),e.on(`pano.moveTo`,t=>{e.emit(`panoLoaded`,t.state.panoIndex),e.emit(`moveToPano`,t.state.panoIndex,t.userAction),e.emit(`panoWillArrive`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.moving`,t=>{e.emit(`movingToPano`,t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),e.on(`pano.arrived`,t=>{e.emit(`panoArrived`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.cancel`,t=>{e.emit(`moveToPanoCanceled`,t.state.panoIndex)}),e.on(`pano.error`,t=>{e.emit(`panoLoadError`,t.error,t.state.panoIndex)}),e.on(`pano.texture.load`,t=>{e.emit(`textureStartLoad`,t.pano.panoIndex)}),e.on(`pano.texture.success`,t=>{e.emit(`textureLoaded`,t.pano.panoIndex,t.meta)}),e.on(`pano.texture.error`,t=>{e.emit(`textureError`,t.error,t.pano.panoIndex)}),e.on(`pano.texture.abort`,t=>{e.emit(`textureAbort`,t.pano.panoIndex)}),e.on(`pano.texture.progress`,t=>{e.emit(`textureLoading`,t.progress,t.pano.panoIndex)}),e.on(`xr.session.start`,t=>{e.emit(`webXRSessionStart`)}),e.on(`xr.session.end`,t=>{e.emit(`webXRSessionEnd`)}),e.on(`xr.gesture.tap`,t=>{e.emit(`webXRControllerEvent`,`tap`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.press`,t=>{e.emit(`webXRControllerEvent`,`press`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonUp`,t=>{e.emit(`webXRControllerEvent`,`buttonUp`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonDown`,t=>{e.emit(`webXRControllerEvent`,`buttonDown`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.controller.update`,t=>{e.emit(`webXRControllerRayUpdate`,{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&e.emit(`webXRAxesUpdate`,`left`,{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&e.emit(`webXRAxesUpdate`,`right`,{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),e.on(`works.request`,t=>{e.emit(`willLoad`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.load`,t=>{e.emit(`load`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.ready`,t=>{e.emit(`loaded`,t.input,t.works[0])}),e.on(`state.change`,t=>{e.emit(`stateChange`,t.state,t.userAction)}),e.on(`currentState.change`,t=>{e.emit(`currentStateChange`,t.state,t.userAction)}),e.on(`state.set`,t=>{e.emit(`setState`,t.state)}),e.on(`state.synced`,t=>{e.emit(`stateSynced`,t.state)}),e.on(`model.request`,t=>{e.emit(`modelWillLoad`,t.work.model)}),e.on(`model.error`,t=>{e.emit(`modelLoadError`,t.error,t.model)}),e.on(`model.load`,t=>{e.emit(`modelLoaded`,t.model)}),e.on(`model.changeShownFloor`,t=>{e.emit(`modelShownFloorChange`,t.model.shownFloor,t.model.floorLength)}),e.on(`render`,t=>{e.emit(`renderFrame`,t.needsRender)}),e.on(`mode.change.request`,t=>{e.emit(`wantsChangeMode`,t.mode,t.prevMode)}),e.on(`mode.change`,t=>{e.emit(`modeChange`,t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),e.on(`helpers.visible`,t=>{e.emit(`helpersVisibleChange`,t.object.visible)}),e.on(`network.resource`,t=>{e.emit(`network`,t.source,t.requestType,t.requestState,t.detail)})}function Uy(){if(typeof window<`u`){let e=document.createElement(`video`);e.loop=!0,e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.crossOrigin=``;let t=()=>{document.removeEventListener(`touchstart`,t,!1),document.removeEventListener(`mousedown`,t,!1),e.muted=!1};return document.addEventListener(`touchstart`,t,!1),document.addEventListener(`mousedown`,t,!1),e}else return{}}function Wy(){let e=new t.Group;e.name=`internalLights`;{let n=new t.DirectionalLight(16777215,.1);n.name=`direction0`,n.position.copy(new t.Vector3(0,1,0)),e.add(n)}{let n=new t.DirectionalLight(16777215,.1);n.name=`direction1`,n.position.copy(new t.Vector3(-1,-1,-1)),e.add(n)}{let n=new t.DirectionalLight(16777215,.3);n.name=`direction2`,n.position.copy(new t.Vector3(1,1,1)),e.add(n)}{let n=new t.AmbientLight(16777215,.6);n.name=`ambient0`,e.add(n)}return e}function Gy(e){var t,n;let r={},i=e.split(/(\;|\,)/);for(let e of i){let i=e.split(`=`),a=(t=i[0])==null?void 0:t.trim(),o=(n=i[1])==null?void 0:n.trim();a&&o&&(r[a]=o)}return r}function Ky(){var e;if(typeof document<`u`){let t=document.getElementsByTagName(`meta`);for(let n=0;n<t.length;n++){let r=t[n];if(r.getAttribute(`name`)===`viewport`){let t=Gy((e=r.getAttribute(`content`))==null?``:e),n=Number(t[`initial-scale`]);if(!isNaN(n))return n}}}return 1}var qy=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQnIISwiPvpD7TwYQTssZXK47vg8y9Gp2nxRcATkozOEmdCeObSt3IIo+xf/00IDRKAaZ89PBTkHqpkA5LagKeNZKlIhqX8RcQ95GHtdYA62Y6rOg5LLsOSnoyvk4V38hFhytef+V9/3DER1P48W89o1GxE9o5vns2Mk+F7yiftafEN4nhmUv9DKEeyqI0U+l0CQg+B//sZ5+6lOuqKaTgm0LH41RHw/CsLZRk4huiYxrvP2SNr1OSS+Dr1ulBMR+K9SqHa58Oec49VgL3mXHvDr7QfuM7LMNrH1/IS30Moe64SLYBuFVJ+MbnJY7L+GrVQkFcl4ISx/fEll4ZWnz18DpcSzUCX602LqD9svDLzmdaLkP28P1+VsJjsx/4hmh6x/gmm/i6pbrGneCL9iCOg0dQUvF1UwEdVvG19r2uTXxXLz0J37eLjfZoF++tTtPnU/cWp5e8n3An0m/G+U7qjiy4PpHyV16HKx5flCxAV/H9A88nUnZ7l7KN78SBxPcQgzLAepxEScU3l7pZ6fL2+Dot8fXECfj+QRoGYAwlAfBSPrXQXQri0Pd85NJKcVw8XUdt1LZapk7YRhO1RdpmFJwW8ozekYvx2/fjM5Hr5MfQ95HvcY2a/9hoNK4yEntL+dEuGseTdNmxIPqd5v2YRjeaX8pQ8IW2ohuP7+dTN87RMK4aitx8XPsH0r2oBqNRqrv7+gmjjY7uIr6TBxBfL2MlxNRKSVp8S5CTuGgHXxfkFvh69Pq3LD4pkkd2bdRvHaSNC3/l2sQXAccdlIS+lc57qhPJwxPybT7XSxnUrdqnXuHlJHS+mjZfJfUZR9s2FuQR+EQKdSi9Am8UTnsEvlYS+L6TFwW6kl74Vjr6AFHsX89rgg8njRltK0XPOL7NyDL0IurV4VtMwafB1709vu9X4OjWHoP3z1Ii7eaQdG00Lx5n8HXyDSva/dU0Pq2vZnKYxHYMYRo1WY5ov1G7Vh4r3y+kMdgbilxeOrV0aqOFenFl8GGJig7rG0bbPRqiSRpP2AL0w+yon9dHbi43zFetnKcuw9ZLeSa+7kTw/TDfuFu0Z7Vp/uhyHfPkAZ5ufP9wLIfD49E3clR818rR089Lzyy+VRREPneICnYLX9cT8PVKQs36TbQ3i6NcCwYkxEAQ3phN4CjAvC4mFr5vrlKe7AizBKj8cu33s7i9GbeY7BHYujTjjd3Bx54SSyT4m8mxOoYOAGX/DtwvnGE1M+5v5Bgt1hbkJRW9Cxv9X81GL2i5jqaoJ4avBcCsLYp+Ru+VC5sWPpFhXt8/EPvJL2F/alJDEeIjUhcrP5P45rDeATPj+wKl7gBf1fcq+HpVnfHO1vEf//UCHgt/OxfDE3onj5UkfTaThrg3NCGoBUCtZjvgMnwQB0bG5XENeraJ5XEWvtiHkqSVRqN+uQ4lEx2o+69SeY1dC++Wcsj+LCW+H0ZE4KtDWHkGwCtrxstbFqr51e9wbz42E2fpjRQsqEn50PnM4eumO9IbujCi393Hd+3q72TI+p9DPyyfraF+c3rOx0KJyB2z7Fa1yCO8HoHzlDFhPiWD8XoB3aPppRrUQdRp1D8qE9exdgr+Zbpqf8BLfmZ/bMYbh87k58VCSswCjQoLPPw4Jnp4uFi/YQlfKB5eBd/gr6aqB973zbDAF+v5PN+NZEvm+84bSkhxUPE9C9wqbeJ7Hi+gA9Jr5ZM7x9el4mulyK0Bb2xiMTj3/iBtK77Tnii27H/MlCfsjcJY+2oTg2/U4TYWQERE0r+aCouBcx5zEZzEYrqui8JXsQW/X8FLHJ3IVbWXhQV3zAJCjFQst1F25y1arlXwhRR4Bb4rZ3VPy5d+bHEtHIPF27K16ItYuKXM5kHD10M9DKFeSpbqLlOYAlRiC99yCiDmbUf0206jPPO7b/iud71avBkHf+kQP0OrWHBFrhmt75ZyPzbLg5KmWK9oH4Oq1eFZOm0c6n48mdfer46HcLUZU3pGB8R9IDBbJ+N7v1q0J2xhudZ45tcL8PN16vq9WizwtRLwFQtKER+NDypj4QQOdJNY3NC7GEsaGtiSmDsA+CZhyx+hXFHjYrgGGXpZNvDNpn5gWWuiWkUtyEB0UcrO8Y2L9KI9K+cXLmxqruGd6pcKfycj/ij3URVgu6bPUaycN1qXTHD+KoOmjGORnH57q8rh+e9sTHk5r1+7zpEXk36bp7iiXRrBW61e5k/D0fn+EXF/OxYEypFW3ZH1HzPt4Pv5PN2Rd7VJLDZeboGnbpSPwPDcBw5f6AIysadFOR9Hr7vksoFvE91jdbdYvzpYqyIvdQPU87uKL45u3u213CA8qkYPT6H1YgwIfkz7RI5xJdomfjoV4PXjfjgaRkNGhHwG1mNt1oq0y/j+SaZ5pV0LnrlG89Dl1YkmEsc3nKKzMKskJD+fx6NhlFiohdTe5EsZIig5WPgWUYCC9Dx5TG/sA5x15LCBbzXDtx/+uh74VmMZjLDamh8JvhzQtSsoeVTNNXB/Euv96LRR/qjO+By5xTxxJ683/FB00Pj0fZz9F2GPa70Ld2hbbVptWmjWabbGCl/ZAiTsbJa5hQ9OK/eWFE4xva9nG3z1zwCtnFXjYr6c3ykxPn9QiYWEWPhA4uuiDnzBpt4EMcg0QOm28M0gP76hJuELbIdZi4PqaILpJI+RYz4ZV42y+q49wBcxIbyXTmtXgevRWPl3MmjSSJU5vB3J0TA2Uu8mtP+R5/Au4iiF6NrUUiuCieOiJpnJq8gSXzwFLFiLP8X6bV0bYvzt8TXj75eLtKPRauY1RM1HR7GwEHpFbonIWAPwjxpfqJSCyBVUsk/DFOChhC18kyiPHFvwdVGh6XFbmfLx+RRi4jaqYiCnUDO1wc4u4ovo7pfS+XFD32e9GzndwxJiHcbQ/Vz6JrBMDGYyYK5l7YOsfkS2MVePfGkLsNXLGl9hIVbWXAv9fQ5i/j6UFL1RaQffB9qlwn3tS4WxMhaxETCMz6T9ZTqCk5FznoOKL9SEXMMIUwAZW6dNfCEVX61azdxwmIbg4aHdwtcj5KVBeNiqrb2+g5M8hTskSB6exHZ5bMEIF/wCoOT128zvdXziMLbvuDu/Usmh0oG7doMmafKNSmt8hQWUnmzhjJf/RskXCzQL8aYNfLG/QPGLY5KjKtcuNPGsyGytmj0/kPi6qdXwwJCPvOTYI3zTaICCNEh9FGSWM54OX4+A1UI80RV98czWKceJf65ervsleJm164/7ganACHHn+IPz8Nby1ptcnRztRWbipArvp4/gRchodbIFvsBSWPBaW+CHtzWfauFfcmnKRuyr+Fiu1WbzGKtCPWWMHjIgU1/Mgn2B74GKfbkajHwtVIHy3uBbh0Ocj9oplCC+kIJvYuKvI9bbkUUQ2+JaG7AeknwvhLd0YUxx+SZIf4XkGeqHUCNt9N8sQdvYlwtl9H4hMzqI5dHosMIX2taCl2s6LRowaubPyld/IgcvHBJPnKGnHDLh0ArfqzlYtkv5D8++4RsAvPbwTaJzgDcIDzxIRXuEbx4NIsYupjt7gi/6idL3j1AIqPY+OPH5PGO67x/jUS9NvF6hTte7x2kaCvtSZJiMlxjxMSqEtqXr3GPMn/9y4cXUypS/ymPxbIAvmurtYl9o7dqmBV9KdbLOgsik4B3d6xW/lO7w/kfe+yfx7bFuGkwY3/C6sURDj8584rCxJH5QtnYFVrFQVL35HNoQgO0jvt228XVRC4WQPLtANyiEzb1gD/BNoy5kHa5QEnUmiq/uG2fubeXh+kwuNj8IRxAoOqiLIqfTaNw84SfLWsDmqo08k30prHVKbHuYDo7ez6U7EsLX0oJX1ltV2AOg2KfoMPPA/sTx/ZPMqF9YiN11AsHLFrHgaAT3GBvw7hO+U9TH4bX10rgVx7YgMr0p7Pow4tL8XcY3l1kJMfVQmsA3fa/wFQh3JK9eivtV+tCaD4cUjdZvIRI9BfDUDd6PkkbfKhVbOJf/jUpuQcXXlgVNv68ejr4gTflk5AZ71+jR4AvEdPg6PDNpaz6a2AQm2otoWKvVS+LVTyL4OnaE7wSNUjfdpnZb+KbQdcA7Jr5ek0od8MD9dNjiN43t4etk1v0ITfyw6gS+Q4l5XwGwbXli+u/sj6pWGu9XfyYXx75d18+lf6t0tnau/pXKv8+xzorIkltn0l4r2dYCXlO8XDRbu9xw/9g/Zko2FXSFtKPxOxn3q+caluteK5lJsboXwVP/S27cPVz28X3i3/Ll/v8eDVMPDmzwvDbwddMt+NoROhq3yXcC4D7KpmTyA+XnqEzSFQrawDeLrsNemHrEL2+24r7NlENZUMa2vyxkH2DIs628e669ubdsR4VXC7C9u79eIVJtOwgdgO/dOICHGK6jQHaIwdXN4Lwt0LWHr4d6kX8tV+ozqAs+uYCSmO2w+jd4zGNeUYL4nqZxeN5WKVgooSAClmEaYhqhdit89QC7niSbCEM2sdkBuHYxQg9ri5ZjkuhI6DMP+J7cTvEtokEx0aPscyddoFJKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==`,Jy=[351,63],Yy=[20,20],Xy=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Zy=new Float32Array([0,0,1,0,0,1,1,1]),Qy=new Uint8Array([0,1,2,1,3,2]),$y=new t.BufferGeometry;$y.setAttribute(`position`,new t.BufferAttribute(Xy,3)),$y.setAttribute(`uv`,new t.BufferAttribute(Zy,2)),$y.setIndex(new t.BufferAttribute(Qy,1));var eb=new t.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),tb=new t.Mesh($y,eb);tb.matrixAutoUpdate=!1;var nb=new t.Scene;nb.add(tb),nb.matrixAutoUpdate=!1;var rb=new t.OrthographicCamera(-.5,.5,.5,-.5,.1,1);rb.position.set(0,0,.5),rb.lookAt(0,0,0),rb.updateMatrixWorld(!0),rb.matrixAutoUpdate=!1;var ib=new t.Vector4,ab=new t.Vector4;function ob(e){if(eb.map){let t=e.getViewport(ib),n=e.getScissor(ab),r=e.getScissorTest(),i=e.autoClear,a=n.x+Yy[0]/3,o=n.y+Yy[1]/3,s=Jy[0]/3,c=Jy[1]/3;e.setViewport(a,o,s,c),e.setScissor(a,o,s,c),e.setScissorTest(!0),e.autoClear=!1,e.render(nb,rb),e.setViewport(t),e.setScissor(n),e.setScissorTest(r),e.autoClear=i}else{let e=new t.Texture,n=new Image;n.onload=()=>{e.image=n,e.wrapS=t.ClampToEdgeWrapping,e.wrapT=t.ClampToEdgeWrapping,e.minFilter=t.LinearFilter,e.needsUpdate=!0,e.generateMipmaps=!1,eb.needsUpdate=!0,n.onload=G},n.src=qy,eb.map=e}}var sb=class{constructor(e=2048){this._count=0,this.width=e,this.height=1,this.data=new Uint32Array(this.width*this.height),this.texture=this.createTexture(this.data,this.width,this.height)}get count(){return this._count}createTexture(e,n,r){let i=new t.DataTexture(e,n,r,t.RedIntegerFormat,t.UnsignedIntType);return i.internalFormat=`R32UI`,i.minFilter=t.NearestFilter,i.magFilter=t.NearestFilter,i.generateMipmaps=!1,i.needsUpdate=!0,i}update(e){let t=e.length,n=Math.max(1,Math.ceil(t/this.width));n>this.height&&(this.height=n,this.data=new Uint32Array(this.width*this.height),this.texture.dispose(),this.texture=this.createTexture(this.data,this.width,this.height)),this.data.set(e,0),this._count=t,this.texture.needsUpdate=!0}dispose(){this.texture.dispose()}},cb=2,lb=8,ub=class{constructor(e){let n=e.numPoints,r=e.packedData;if(!r||r.length<n*lb)throw Error(`[TileTexture] object 缺少足量 packedData`);let i=n*cb,a=Math.max(1,Math.min(2048,i)),o=Math.max(1,Math.ceil(i/a)),s=new Uint32Array(a*o*4);s.set(r.subarray(0,n*lb),0);let c=new t.DataTexture(s,a,o,t.RGBAIntegerFormat,t.UnsignedIntType);c.internalFormat=`RGBA32UI`,c.minFilter=t.NearestFilter,c.magFilter=t.NearestFilter,c.generateMipmaps=!1,c.needsUpdate=!0,this.texture=c,this.count=n,this.width=a,this.height=o}dispose(){this.texture.dispose()}},db=2,fb=class e{constructor(n=2048){this.target=null,this.targetHeight=0,this.regionMap=new Map,this.regionList=[],this.width=n,this.material=new t.RawShaderMaterial({vertexShader:e.VERTEX,fragmentShader:e.FRAGMENT,uniforms:{u_tileTex:{value:null},u_tileWidth:{value:1},u_bigWidth:{value:n},u_startTexel:{value:0},u_count:{value:0},u_transformIndex:{value:0},u_layerIndex:{value:0}},depthTest:!1,depthWrite:!1}),this.scene=new t.Scene,this.mesh=new t.Mesh(new t.PlaneGeometry(2,2),this.material),this.mesh.frustumCulled=!1,this.scene.add(this.mesh),this.camera=new t.Camera}get texture(){return this.target?this.target.texture:null}get totalPoints(){let e=0;for(let t of this.regionList)e+=t.count;return e}get regions(){return this.regionList}has(e){return this.regionMap.has(e)}add(e,t,n,r){if(this.regionMap.has(e))return;let i={object:e,tile:t,start:0,count:t.count,transformIndex:n,layerIndex:r};this.regionMap.set(e,i),this.regionList.push(i)}sync(e,t){let n=new Set(e);for(let e of Array.from(this.regionMap.keys()))n.has(e)||(this.regionMap.get(e).tile.dispose(),this.regionMap.delete(e));let r=[];for(let n of e){let e=this.regionMap.get(n),{transformIndex:i,layerIndex:a}=t(n);e?(e.transformIndex=i,e.layerIndex=a):(e={object:n,tile:new ub(n),start:0,count:n.numPoints,transformIndex:i,layerIndex:a},this.regionMap.set(n,e)),r.push(e)}this.regionList=r}remove(e){let t=this.regionMap.get(e);if(!t)return;t.tile.dispose(),this.regionMap.delete(e);let n=this.regionList.indexOf(t);n>=0&&this.regionList.splice(n,1)}clear(){for(let e of this.regionList)e.tile.dispose();this.regionMap.clear(),this.regionList=[]}assemble(e){let n=0;for(let e of this.regionList)e.start=n,n+=e.count;let r=Math.max(1,Math.ceil(n*db/this.width));(!this.target||r>this.targetHeight)&&(this.target&&this.target.dispose(),this.targetHeight=r,this.target=new t.WebGLRenderTarget(this.width,r,{format:t.RGBAIntegerFormat,type:t.UnsignedIntType,minFilter:t.NearestFilter,magFilter:t.NearestFilter,depthBuffer:!1,stencilBuffer:!1}),this.target.texture.internalFormat=`RGBA32UI`,this.target.texture.generateMipmaps=!1);let i=e.getRenderTarget(),a=e.autoClear,o=e.getScissorTest(),s=e.getScissor(new t.Vector4),c=e.getPixelRatio()||1;e.autoClear=!1,e.setRenderTarget(this.target),e.setScissorTest(!0);for(let t of this.regionList){let n=t.start*db,r=(t.start+t.count)*db,i=Math.floor(n/this.width),a=Math.ceil(r/this.width),o=Math.max(0,Math.floor(i/c)-1),s=Math.ceil(a/c)+1,l=Math.ceil(this.width/c)+1;e.setScissor(0,o,l,s-o);let u=this.material.uniforms;u.u_tileTex.value=t.tile.texture,u.u_tileWidth.value=t.tile.width,u.u_bigWidth.value=this.width,u.u_startTexel.value=n,u.u_count.value=t.count,u.u_transformIndex.value=t.transformIndex,u.u_layerIndex.value=t.layerIndex,this.material.uniformsNeedUpdate=!0,e.render(this.scene,this.camera)}e.setScissorTest(o),e.setScissor(s),e.setRenderTarget(i),e.autoClear=a}snapshot(){return this.regionList.map(e=>Object.assign({},e))}extractSortInputs(){let e=this.totalPoints,t=new Float32Array(e*3),n=new Uint32Array(e);for(let e of this.regionList){let r=e.object.packedData;if(!r)continue;let i=new Float32Array(r.buffer,r.byteOffset,r.length),a=e.transformIndex;for(let r=0;r<e.count;r++){let o=e.start+r;t[o*3+0]=i[r*8+0],t[o*3+1]=i[r*8+1],t[o*3+2]=i[r*8+2],n[o]=a}}return{positions:t,transformIndices:n,count:e}}readback(e){if(!this.target)return new Uint32Array;let t=this.width,n=this.targetHeight,r=new Uint32Array(t*n*4),i=e.getRenderTarget();e.setRenderTarget(this.target);let a=e.getContext();return a.readPixels(0,0,t,n,a.RGBA_INTEGER,a.UNSIGNED_INT,r),e.setRenderTarget(i),r}dispose(){this.clear(),this.target&&(this.target.dispose(),this.target=null),this.mesh.geometry.dispose(),this.material.dispose()}};fb.VERTEX=`#version 300 es
|
|
2843
|
+
`},cy=class extends t.ShaderMaterial{constructor(e){super({uniforms:t.UniformsUtils.clone(sy.uniforms),vertexShader:sy.vertexShader,fragmentShader:sy.fragmentShader,clipping:!0}),this.type=`LineMaterial`,this.dashed=!1,Object.defineProperties(this,{color:{enumerable:!0,get(){return this.uniforms.diffuse.value},set(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get(){return this.uniforms.linewidth.value},set(e){this.uniforms.linewidth.value=e}},dashScale:{enumerable:!0,get(){return this.uniforms.dashScale.value},set(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get(){return this.uniforms.dashSize.value},set(e){this.uniforms.dashSize.value=e}},gapSize:{enumerable:!0,get(){return this.uniforms.gapSize.value},set(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(e){this.uniforms.resolution.value.copy(e)}}}),this.setValues(e)}};Object.assign(cy.prototype,{isLineMaterial:!0});var ly=class extends t.Mesh{constructor(e,t){super(),this.type=`LineSegments2`,this.geometry=e===void 0?new oy:e,this.material=t===void 0?new cy({color:Math.random()*16777215}):t}computeLineDistances(){let e=this.geometry,n=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*n.count),a=new t.Vector3,o=new t.Vector3;for(var s=0,c=0,l=n.count;s<l;s++,c+=2)a.fromBufferAttribute(n,s),o.fromBufferAttribute(r,s),i[c]=c===0?0:i[c-1],i[c+1]=i[c]+a.distanceTo(o);let u=new t.InstancedInterleavedBuffer(i,2,1);return e.setAttribute(`instanceDistanceStart`,new t.InterleavedBufferAttribute(u,1,0)),e.setAttribute(`instanceDistanceEnd`,new t.InterleavedBufferAttribute(u,1,1)),this}raycast(e,n){e.camera===null&&console.error(`LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.`);let r=e.ray,i=e.camera,a=i.projectionMatrix,o=this.geometry,s=this.material,c=s.resolution,l=s.linewidth,u=o.attributes.instanceStart,d=o.attributes.instanceEnd,f=new t.Vector4,p=new t.Vector4,m=new t.Vector4,h=new t.Vector3,g=new t.Matrix4,_=new t.Line3,v=new t.Vector3;r.at(1,m),m.w=1,m.applyMatrix4(i.matrixWorldInverse),m.applyMatrix4(a),m.multiplyScalar(1/m.w),m.x*=c.x/2,m.y*=c.y/2,m.z=0,h.copy(m);let y=this.matrixWorld;g.multiplyMatrices(i.matrixWorldInverse,y);for(var b=0,x=u.count;b<x;b++){f.fromBufferAttribute(u,b),p.fromBufferAttribute(d,b),f.w=1,p.w=1,f.applyMatrix4(g),p.applyMatrix4(g),f.applyMatrix4(a),p.applyMatrix4(a),f.multiplyScalar(1/f.w),p.multiplyScalar(1/p.w);var S=f.z<-1&&p.z<-1,C=f.z>1&&p.z>1;if(S||C)continue;f.x*=c.x/2,f.y*=c.y/2,p.x*=c.x/2,p.y*=c.y/2,_.start.copy(f),_.start.z=0,_.end.copy(p),_.end.z=0;let e=_.closestPointToPointParameter(h,!0);_.at(e,v);let i=t.MathUtils.lerp(f.z,p.z,e),o=i>=-1&&i<=1;var w=h.distanceTo(v)<l*.5;if(o&&w){_.start.fromBufferAttribute(u,b),_.end.fromBufferAttribute(d,b),_.start.applyMatrix4(y),_.end.applyMatrix4(y);var T=new t.Vector3,E=new t.Vector3;r.distanceSqToSegment(_.start,_.end,E,T),n.push({point:E,pointOnLine:T,distance:r.origin.distanceTo(E),object:this,faceIndex:b})}}}};Object.assign(ly.prototype,{isLineSegments2:!0});var uy=class extends ly{constructor(e,t){super(e,t),this.type=`Line2`}};Object.assign(uy.prototype,{isLine2:!0});var dy=class extends oy{constructor(){super(),this.type=`LineGeometry`}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}fromLine(e){let n=e.geometry;if(n instanceof t.Geometry){let e=new t.BufferGeometry().fromGeometry(n);this.setPositions(e.attributes.position.array)}else n instanceof t.BufferGeometry&&this.setPositions(n.attributes.position.array);return this}copy(){return this}};Object.assign(dy.prototype,{isLineGeometry:!0});var fy=14467195,py=8,my=2,hy=20,gy=null,_y=class extends t.Object3D{static get version(){return`6.9.0-alpha.3`}constructor(e=new t.Vector3,n=new t.Vector3){super(),this.type=`FiveLine`,this.needsRender=!0;let r=new dy,i=new cy({color:fy,linewidth:my,dashScale:hy,dashed:!1});this.line=new uy(r,i);let a=new t.BufferGeometry,o=new t.PointsMaterial({color:fy,size:py,map:gy||(gy=new t.TextureLoader().load(`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==`)),sizeAttenuation:!1,transparent:!0});this.points=new t.Points(a,o),this.points.renderOrder=11,this.points.frustumCulled=!1,this.setPoints(e,n),this.add(this.line,this.points)}setPoints(e,n){let r=[].concat(e.toArray(),n.toArray());this.points.geometry.setAttribute(`position`,new t.BufferAttribute(new Float32Array(r),3)),this.line.geometry.setPositions(r),this.line.computeLineDistances(),this.needsRender=!0}getPoints(){let e=this.points.geometry.attributes.position.array;return[new t.Vector3(e[0],e[1],e[2]),new t.Vector3(e[3],e[4],e[5])]}setMaterial(e){let t=this.line.material;for(let n in e){if(!e.hasOwnProperty(n))continue;let r=e[n];n===`dashed`?(t.dashed=r,r?t.defines.USE_DASH=``:delete t.defines.USE_DASH,t.needsUpdate=!0):t[n]=e[n]}this.needsRender=!0}setResolution(e,t){let n=this.line.material.resolution;(n.x!==e||n.y!==t)&&(n.set(e,t),this.needsRender=!0)}};Object.assign(_y.prototype,{isFiveLine:!0});var vy={Handedness:Object.freeze({NONE:`none`,LEFT:`left`,RIGHT:`right`}),ComponentState:Object.freeze({DEFAULT:`default`,TOUCHED:`touched`,PRESSED:`pressed`}),ComponentProperty:Object.freeze({BUTTON:`button`,X_AXIS:`xAxis`,Y_AXIS:`yAxis`,STATE:`state`}),ComponentType:Object.freeze({TRIGGER:`trigger`,SQUEEZE:`squeeze`,TOUCHPAD:`touchpad`,THUMBSTICK:`thumbstick`,BUTTON:`button`}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:`transform`,VISIBILITY:`visibility`})};function yy(e){return Xo(this,void 0,void 0,function*(){let t=yield fetch(e);if(t.ok)return t.json();throw Error(t.statusText)})}function by(e){return Xo(this,void 0,void 0,function*(){if(!e)throw Error(`No basePath supplied`);return yield yy(`${e}/profilesList.json`)})}function xy(e,t){return Xo(this,arguments,void 0,function*(e,t,n=null,r=!0){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No basePath supplied`);let i=yield by(t),a;if(e.profiles.some(e=>{let n=i[e];return n&&(a={profileId:e,profilePath:`${t}/${n.path}`,deprecated:!!n.deprecated}),!!a}),!a){if(!n)throw Error(`No matching profile name found`);let e=i[n];if(!e)throw Error(`No matching profile name found and default profile "${n}" missing.`);a={profileId:n,profilePath:`${t}/${e.path}`,deprecated:!!e.deprecated}}let o=yield yy(a.profilePath),s;if(r){let t;if(t=o.layouts[e.handedness],!t)throw Error(`No matching handedness, ${e.handedness}, in profile ${a.profileId}`);t.assetPath&&(s=a.profilePath.replace(`profile.json`,t.assetPath))}return{profile:o,assetPath:s}})}var Sy={xAxis:0,yAxis:0,button:0,state:vy.ComponentState.DEFAULT};function Cy(e=0,t=0){let n=e,r=t;if(Math.sqrt(e*e+t*t)>1){let i=Math.atan2(t,e);n=Math.cos(i),r=Math.sin(i)}return{normalizedXAxis:n*.5+.5,normalizedYAxis:r*.5+.5}}var wy=class{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===vy.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Sy)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:r}){let{normalizedXAxis:i,normalizedYAxis:a}=Cy(e,t);switch(this.componentProperty){case vy.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?i:.5;break;case vy.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?a:.5;break;case vy.ComponentProperty.BUTTON:this.value=this.states.includes(r)?n:0;break;case vy.ComponentProperty.STATE:this.valueNodeProperty===vy.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=+!!this.states.includes(r);break;default:throw Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}},Ty=class{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw Error(`Invalid arguments supplied`);this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(e=>{let n=new wy(t.visualResponses[e]);this.visualResponses[e]=n}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:vy.ComponentState.DEFAULT,button:this.gamepadIndices.button===void 0?void 0:0,xAxis:this.gamepadIndices.xAxis===void 0?void 0:0,yAxis:this.gamepadIndices.yAxis===void 0?void 0:0}}get data(){return Object.assign({id:this.id},this.values)}updateFromGamepad(e){if(this.values.state=vy.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){let t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=vy.ComponentState.PRESSED:(t.touched||this.values.button>vy.ButtonTouchThreshold)&&(this.values.state=vy.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===vy.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>vy.AxisTouchThreshold&&(this.values.state=vy.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===vy.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>vy.AxisTouchThreshold&&(this.values.state=vy.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(e=>{e.updateFromComponent(this.values)})}},Ey=class{constructor(e,t,n){if(!e)throw Error(`No xrInputSource supplied`);if(!t)throw Error(`No profile supplied`);this.xrInputSource=e,this.assetUrl=n,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(e=>{let t=this.layoutDescription.components[e];this.components[e]=new Ty(e,t)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){let e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}},Dy=`https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles`,Oy=`generic-trigger`,ky=class extends t.Object3D{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(e=>{e instanceof t.Mesh&&e.isMesh&&(e.material.envMap=this.envMap,e.material.needsUpdate=!0)}),this)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(e=>{Object.values(e.visualResponses).forEach(e=>{let{valueNode:t,minNode:n,maxNode:r,value:i,valueNodeProperty:a}=e;t&&(a===vy.VisualResponseProperty.VISIBILITY?t.visible=i:a===vy.VisualResponseProperty.TRANSFORM&&(t.quaternion.copy(n.quaternion).slerp(r.quaternion,i),t.position.lerpVectors(n.position,r.position,i)))})}))}};function Ay(e,n){Object.values(e.components).forEach(e=>{let{type:r,touchPointNodeName:i,visualResponses:a}=e;if(r===vy.ComponentType.TOUCHPAD)if(e.touchPointNode=n.getObjectByName(i),e.touchPointNode){let n=new t.Mesh(new t.SphereGeometry(.001),new t.MeshBasicMaterial({color:255}));e.touchPointNode.add(n)}else console.warn(`Could not find touch dot, ${e.touchPointNodeName}, in touchpad component ${e.id}`);Object.values(a).forEach(e=>{let{valueNodeName:t,minNodeName:r,maxNodeName:i,valueNodeProperty:a}=e;if(a===vy.VisualResponseProperty.TRANSFORM){if(e.minNode=n.getObjectByName(r),e.maxNode=n.getObjectByName(i),!e.minNode){console.warn(`Could not find ${r} in the model`);return}if(!e.maxNode){console.warn(`Could not find ${i} in the model`);return}}e.valueNode=n.getObjectByName(t),e.valueNode||console.warn(`Could not find ${t} in the model`)})})}function jy(e,n){Ay(e.motionController,n),e.envMap&&n.traverse(n=>{n instanceof t.Mesh&&n.isMesh&&(n.material.envMap=e.envMap,n.material.needsUpdate=!0)}),e.add(n)}var My=class{constructor(e=null){this.gltfLoader=e,this.path=Dy,this._assetCache={}}createControllerModel(e){let t=new ky,n=null;return e.addEventListener(`connected`,e=>{let r=e.data;r.targetRayMode!==`tracked-pointer`||!r.gamepad||xy(r,this.path,Oy).then(({profile:e,assetPath:i})=>{t.motionController=new Ey(r,e,i);let a=this._assetCache[t.motionController.assetUrl];if(a)n=a.scene.clone(),jy(t,n);else{if(!this.gltfLoader)throw Error(`GLTFLoader not set.`);this.gltfLoader.load(t.motionController.assetUrl,e=>{this._assetCache[t.motionController.assetUrl]=e,n=e.scene.clone(),jy(t,n)})}}).catch(e=>{console.warn(e)})}),e.addEventListener(`disconnected`,()=>{t.motionController=null,t.remove(n),n=null}),t}},Ny=`fade`,Py=Object.assign({},fr(Y_,[`maxLatitude`,`minLatitude`]));function Fy(e,t){if(!t)return e;let n=e.match(/\d+_[a-z].png/);return e.substring(0,n.index)+t+`/`+e.substring(n.index)}var Iy=300,Ly=new t.Raycaster,Ry=new t.Vector3,zy={Floorplan:Jg,Topview:Xg,Panorama:X_,VRPanorama:Vv,Model:Kv,Mapview:Qv,XRPanorama:class e extends X_{static parseArgs(t){if(t instanceof e)return t;let n=Object.assign(Object.assign({},t),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2});return super.parseArgs(n)}static initAnimationEndState(e){let t=this.parseArgs(e),n=super.initAnimationEndState(t);return Object.assign(Object.assign({},n),{mode:`XRPanorama`})}constructor(e){super(e),this.xrManager=new ay(this.renderer,this.renderer.getContext(),{onSessionStart:e=>{this.emit(`xr.session.start`,Q(`xr.session.start`,{session:e,machineType:this.xrManager.machineType}))},onSessionEnd:()=>{this.emit(`xr.session.end`,Q(`xr.session.end`,{session:null,machineType:this.xrManager.machineType}))}}),this.xrControllerRay={left:new t.Raycaster,right:new t.Raycaster},this.xrControllerRay.left.params.Points={threshold:.1},this.xrControllerRay.left.firstHitOnly=!0,this.xrControllerRay.left.floorIndex=-1,this.xrControllerRay.right.params.Points={threshold:.1},this.xrControllerRay.right.firstHitOnly=!0,this.xrControllerRay.right.floorIndex=-1,this.gazeRay=null,this.pointerLines={left:new _y,right:new _y},this.pointerLines.left.visible=!1,this.pointerLines.right.visible=!0,this.pointerLines.left.setMaterial({color:new t.Vector3(1,1,1)}),this.pointerLines.left.points.material.depthTest=!1,this.pointerLines.right.setMaterial({color:new t.Vector3(1,1,1)}),this.pointerLines.right.points.material.depthTest=!1,this.controllerWrappers=[new t.Group,new t.Group];let n=this.xrManager.getController(0);this.controllerWrappers[0].add(n);let r=this.xrManager.getController(1);this.controllerWrappers[1].add(r);let i=new My;i.gltfLoader={load(e,t){ur.ajax(e,{responseType:`arraybuffer`}).then(t=>{var n;return Us(t.body,{resourcePath:e.slice(0,e.lastIndexOf(`/`)+1),search:(n=e.split(`?`)[1])==null?``:n,fetcher:ur})}).then(e=>t(e))}},(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`)&&this.scene.add(this.pointerLines.left,this.pointerLines.right,this.controllerWrappers[0],this.controllerWrappers[1]),this.panoResources={},this.panoResources[this.locationMotion.keyframes[0].key=this.locationMotion.keyframes[1].key=Zt()]={panoId:Z(this.currentPano),leftPanoPicture:null,position:this.camera.pose.offset.clone(),effect:Ny,effectEasing:G_,fixCameraTransform:new t.Matrix4},this.parallaxCameraMatrixs=[];let a=ei.shared.getContext();if(!a){console.error(`获取session失败,请退出重试`);return}this.on(`xr.session.end`,()=>{this.scene.remove(this.pointerLines.left,this.pointerLines.right)}),this.xrManager.setSession(a),this.on(`xr.session.start`,()=>{let e=this.xrManager.getControllerGrip(0);e.add(i.createControllerModel(e)),this.controllerWrappers[0].add(e);let t=this.xrManager.getControllerGrip(1);t.add(i.createControllerModel(t)),this.controllerWrappers[1].add(t)}),this.xrHandleState={LeftAxesUp:{touchStartTime:0,touchStart:!1},LeftAxesDown:{touchStartTime:0,touchStart:!1},LeftAxesLeft:{touchStartTime:0,touchStart:!1},LeftAxesRight:{touchStartTime:0,touchStart:!1},LeftTrigger:{touchStartTime:0,touchStart:!1},LeftPinch:{touchStartTime:0,touchStart:!1},RightAxesUp:{touchStartTime:0,touchStart:!1},RightAxesDown:{touchStartTime:0,touchStart:!1},RightAxesLeft:{touchStartTime:0,touchStart:!1},RightAxesRight:{touchStartTime:0,touchStart:!1},RightTrigger:{touchStartTime:0,touchStart:!1},RightPinch:{touchStartTime:0,touchStart:!1},Y:{touchStartTime:0,touchStart:!1},X:{touchStartTime:0,touchStart:!1},A:{touchStartTime:0,touchStart:!1},B:{touchStartTime:0,touchStart:!1}},this.xrManager.machineType===`VP`&&this.initHandEvent()}updateConfiguration(e){return super.updateConfiguration(Object.assign(Object.assign({},e),{maxLatitude:Math.PI/2,minLatitude:-Math.PI/2}))}moveToPano(e,n,r){var i,a,o;this.userAction=r,this.stopMomentumMovement();let s=Z(e),c=this.works.getObserver(e);if(!c)throw Error(`Invalid PanoIndex`);let l=Kr(c.images.up),u=this.imageOptions.size;u===void 0&&c&&l&&(u=Number(l)),u===void 0&&(u=2048);let d=this.imageOptions.transform,f=(e,t)=>Fy(Wr(e,d,t)),p=Object.assign({key:`pano.${s}`},dr(this.imageOptions,[`format`,`size`,`quality`])),m={right:c.images.work.getURL(c.images.right),left:c.images.work.getURL(c.images.left),up:c.images.work.getURL(c.images.up),down:c.images.work.getURL(c.images.down),front:c.images.work.getURL(c.images.front),back:c.images.work.getURL(c.images.back)},h=`pano:`+Ip([m,p,d]);if(this.pendingPanoTask){if(this.pendingPanoTask.hash===h)return;{let t=this.pendingPanoTask.panoId;(i=this.panoMeshes.get(t))==null||i.setProgress(0),this.emit(`pano.texture.abort`,Q(`pano.texture.abort`,{error:null,progress:0,meta:null,pano:e}))}}let g=`move-to-pano-`+s;this.pending.add(g);let _=xg(`pano.prepare`,{options:n,prevMode:this.mode,prevPano:this.currentPano,pano:e});if(this.emit(`pano.prepare`,_),_.defaultPrevented){this.pending.delete(g);return}_.options!==n&&Object.assign(n,_.options);let v=this.modelScene.parameter,y;v.pano0&&v.pano0.map.name===h?y=v.pano0:v.pano1&&v.pano1.map.name===h&&(y=v.pano1);let b=(a=n.effect)==null?Ny:a,x=(o=n.effectEasing)==null?G_:o;if(y){let r={panoId:s,effect:b,effectEasing:x,leftPanoPicture:{panoId:y.panoId,map:y.map,mapHistogram:y.mapHistogram,mapSize:y.mapSize,matrix:c.matrix.clone().premultiply(c.work.transform),zoom:1},position:c.position.clone().applyMatrix4(c.work.transform),fixCameraTransform:new t.Matrix4};r.leftPanoPicture&&this.panoPictureObserverMap.set(r.leftPanoPicture,c),this.pendingPanoTask=void 0,Promise.resolve().then(()=>Sg(_)).catch(e=>{let t=Wg(e);return this.emit(`error`,t),t}).then(t=>{var i,a;if(!(t instanceof Error))this.pending.delete(g),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0),this.doMoveToPano(e,r,n);else{let e=null;t instanceof Error&&(e||(e=t));let r=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:null,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:r})),n.moveCancelCallback&&n.moveCancelCallback(),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:r})),e instanceof Error&&e.message&&this.emit(`error`,e),this.pending.delete(g),this.pendingPanoTask=void 0,(a=this.panoMeshes.get(s))==null||a.setProgress(0)}});return}let S=this.panoMeshes.get(s);S&&S.tap&&S.tap(),this.pendingPanoTask={panoId:s,hash:h,onLoad:r=>{var i;let a=r.body;if(this.destroyed)a.dispose();else{a.name=h;let r=Array.isArray(a.image)?a.image[0]:a.image,o=(i=r==null?void 0:r.width)==null?2048:i,l=new zm().formPixels(Rg(this.renderer,a,!0,Fm).data),u={panoId:s,effect:b,effectEasing:x,leftPanoPicture:{panoId:s,map:a,mapSize:o,mapHistogram:new t.Vector4().fromArray(l.toArray()),matrix:c.matrix.clone(),zoom:1},position:c.position.clone(),fixCameraTransform:new t.Matrix4};u.leftPanoPicture&&this.panoPictureObserverMap.set(u.leftPanoPicture,c),this.doMoveToPano(e,u,n)}},onError:e=>{let t=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{error:null,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:t})),this.emit(`pano.error`,Q(`pano.error`,{error:e,userAction:this.userAction,options:n,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.work.workCode},progress:0,state:t})),e instanceof Error&&e.message&&this.emit(`error`,e),n.moveCancelCallback&&n.moveCancelCallback()}},Promise.all([Promise.resolve().then(()=>{this.emit(`pano.texture.load`,Q(`pano.texture.load`,{error:null,progress:0,meta:null,pano:e}))}).then(()=>this.textureLoader.loadCubeTexture(m,{imageURL:{transform:f,options:p},format:t.RGBFormat,viaAjax:!0,fetcher:Gf(this.fiveId,c.work)},void 0,void 0,t=>{var n,r;this.emit(`pano.texture.progress`,Q(`pano.texture.progress`,{error:null,progress:t,meta:null,pano:e})),((n=this.pendingPanoTask)==null?void 0:n.hash)===h&&((r=this.panoMeshes.get(s))==null||r.setProgress(t))},this.renderer)).catch(t=>{let n=Wg(t);return this.emit(`pano.texture.error`,Q(`pano.texture.error`,{error:n,progress:0,meta:null,pano:e})),n}),Promise.resolve().then(()=>Sg(_)).catch(e=>Wg(e))]).then(([t,n])=>{var r,i,a,o;if(!(t instanceof Error)&&!(n instanceof Error))this.pending.delete(g),((r=this.pendingPanoTask)==null?void 0:r.hash)===h?(this.pendingPanoTask.onLoad(t),this.pendingPanoTask=void 0,(i=this.panoMeshes.get(s))==null||i.setProgress(0)):t.body.dispose(),this.emit(`pano.texture.success`,Q(`pano.texture.success`,{error:null,progress:1,meta:t.meta,pano:e}));else{let e=null;t instanceof Error?e||(e=t):t.body.dispose(),n instanceof Error&&(e||(e=n)),this.pending.delete(g),((a=this.pendingPanoTask)==null?void 0:a.hash)===h&&(this.pendingPanoTask.onError(e),this.pendingPanoTask=void 0,(o=this.panoMeshes.get(s))==null||o.setProgress(0))}})}doMoveToPano(e,n,r={}){var i,a,o,s,c,l,u,d,f,p;let m=V(),h=Zt();this.panoResources[h]=n;let g,_,v;if(this.locationMotion.ended){let[e,t]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(t).position,a=n.position;g=Math.max(i.distanceTo(a),1),_=[{key:t.key,progress:0,value:Object.assign(Object.assign({},r),{count:0})},{key:h,progress:1,value:{distance:0,count:1}}],v=0}else{let[e,t]=this.locationMotion.getKeyFrameSegment(m),r=this.locationMotion.value,i=this.panoResourceFromLocationMotionKeyframe(e).position,a=this.panoResourceFromLocationMotionKeyframe(t).position,o=n.position,s=t.value.count-r.count,c=Math.max(i.distanceTo(a),1)*s;g=c+Math.max(a.distanceTo(o),1),_=[{key:e.key,progress:0,value:Object.assign({},r)},{key:t.key,progress:c/g,value:t.value},{key:h,progress:1,value:{count:t.value.count+1,distance:0}}];let l=this.locationMotionKeyframesLength(this.locationMotion.keyframes),u=this.locationMotionKeyframesLength(_);v=this.locationMotion.getProgressVelocity(m)*l/u}let y=n.effect===`instant`?0:this.calculateMovingDuration(r.duration,n.effect===`fly`||n.effect===`model`?g:0),b={longitude:r.longitude,latitude:r.latitude,fov:r.fov},x=Object.assign(Object.assign({},e),{mode:this.mode,longitude:(i=b.longitude)==null?this.camera.pose.longitude:i,latitude:(a=b.latitude)==null?this.camera.pose.latitude:a,fov:(o=b.fov)==null?this.camera.pose.fov:o,offset:n.position.clone(),distance:0}),S=this.currentPano;if(this.emit(`pano.moveTo`,Q(`pano.moveTo`,{options:r,prevPano:S,pano:{panoIndex:x.panoIndex,workCode:x.workCode},progress:0,state:x,userAction:this.userAction,error:null})),r.moveStartCallback&&r.moveStartCallback(x),this.perspToOrthoMotion.set({perspToOrtho:0},y).catch(G),this.modelAlphaMotion.setKeyframes([{progress:0,value:Object.assign({},this.modelAlphaMotion.value)},{progress:.6,value:Object.assign({},this.modelAlphaMotion.value)},{progress:1,value:{modelAlpha:0}}],y).catch(G),this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement&&this.videoTexture.image.getAttribute(`src`)&&(this.videoTexture.image.pause(),this.videoTexture.image.removeAttribute(`uuid`),this.videoTexture.image.removeAttribute(`src`),this.videoTexture.image.oncanplay=G,this.videoTexture.needsUpdate=!0),this.panoVideo.setMaterial(null),n.effect===`fly`||n.effect===`model`)this.cameraMotion.set(b,y).catch(G);else{let e=It({longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude}),r=It({longitude:(s=b.longitude)==null?this.cameraMotion.value.longitude:s,latitude:(c=b.latitude)==null?this.cameraMotion.value.latitude:c}),i=new t.Object3D;i.lookAt(e);let a=new t.Matrix4().makeRotationFromQuaternion(i.quaternion);i.lookAt(r);let o=new t.Matrix4().makeRotationFromQuaternion(i.quaternion),m=new t.Matrix4().getInverse(a).premultiply(o),h=this.cameraMotion.value.fov,g=(l=b.fov)==null?this.cameraMotion.value.fov:l,v=1;n.effect===`zoomin`?v=1.5:n.effect===`zoomout`&&(v=.4);let x=g*v;for(let e=0;e<_.length-1;e++){let t=_[e].key;if(t){let e=this.panoResources[t];e&&(e.fixCameraTransform.copy(m),e.leftPanoPicture&&(e.leftPanoPicture.zoom=Math.tan(x/2/180*Math.PI)/Math.tan(h/2/180*Math.PI)))}}this.cameraMotion.setKeyframes([{progress:0,value:{longitude:this.cameraMotion.value.longitude,latitude:this.cameraMotion.value.latitude,fov:this.cameraMotion.value.fov}},{progress:0,value:{longitude:(u=b.longitude)==null?this.cameraMotion.value.longitude:u,latitude:(d=b.latitude)==null?this.cameraMotion.value.latitude:d,fov:x}},{progress:1,value:{longitude:(f=b.longitude)==null?this.cameraMotion.value.longitude:f,latitude:(p=b.latitude)==null?this.cameraMotion.value.latitude:p,fov:g}}],y).catch(G)}this.locationMotion.setKeyframes(_,y,v).then(()=>{for(let e of this.modelScene.children)e instanceof up&&e.show();let t=Object.assign(Object.assign({},e),{mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:0});this.emit(`pano.arrived`,Q(`pano.arrived`,{options:r,prevPano:S,pano:{panoIndex:t.panoIndex,workCode:t.workCode},progress:1,state:t,userAction:this.userAction,error:null})),r.moveEndCallback&&r.moveEndCallback(t);let n=this.works.getObserver(this.currentPano);if(n&&n.images.video&&this.videoTexture&&this.videoTexture.image instanceof HTMLVideoElement){let e={map:this.videoTexture,size:n.images.video.size.clone(),matrix:n.images.video.matrix.clone(),panoMatrix:n.matrix.clone().premultiply(n.work.transform),alpha:1},t=Zt(),r=this.videoTexture.image;r.setAttribute(`uuid`,t),t_().then(i=>{i&&n.images.video&&r.getAttribute(`uuid`)===t&&(r.oncanplay=()=>{r.oncanplay=G,r.play()},r.ontimeupdate=()=>{r.currentTime>.5&&(r.ontimeupdate=G,this.panoVideo.setMaterial(e))},r.src=n.images.video.source)}).catch((()=>{r.removeAttribute(`uuid`)}))}},()=>{let e=Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose));this.emit(`pano.cancel`,Q(`pano.cancel`,{options:r,prevPano:S,pano:{panoIndex:e.panoIndex,workCode:e.workCode},progress:0,state:e,userAction:this.userAction,error:null})),r.moveCancelCallback&&r.moveCancelCallback()})}checkSelectedPano(e){var n;this.stopMomentumMovement(),this.camera.getDirection(new t.Vector3).setY(0);let r=null,i=this.works.getObserver(this.currentPano);if(!i)return null;let a=i.work.observers,o=i.accessibleNodes.filter(e=>{if(e===this.currentPano.panoIndex&&i.work.workCode===this.currentPano.workCode)return!1;let t=a[e];return!t||Ry.copy(t.position).applyMatrix4(t.work.transform).distanceTo(this.camera.position)>this.maxAccessibleDistance?!1:t.loadable||t.active}),[s]=this.modelScene.intersectRaycaster(e);if(s){let[e,t]=vu(o,e=>{let t=a[e];return t?Ry.copy(t.standingPosition).applyMatrix4(t.work.transform).distanceTo(s.point):1/0},!0);typeof e==`number`&&t<this.panoTapTriggerRadius&&(r=(n=a[e])==null?null:n)}if($v(r)){let t=this.getForwardObserverOrNot(this.xrManager.cameraVR,e);t&&(r=t)}for(let e of this.locationMotion.keyframes){let t=this.panoResourceFromLocationMotionKeyframe(e);if(!(e.progress<this.locationMotion.progress)&&r){let e=Z({panoIndex:r.panoIndex,workCode:r.work.workCode});if(t.panoId===e){r=null;break}}}if($v(r))return this.locationMotion.ended===!0&&this.cameraBounce(),null;if(!r.active){let e=Z({panoIndex:r.panoIndex,workCode:r.work.workCode}),t=this.panoMeshes.get(e);t&&(t.setDisabled(!1),t.setLoading(!0))}let c={workCode:r.work.workCode,panoIndex:r.panoIndex,mode:this.mode,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,distance:0,offset:r?r.position.clone():new t.Vector3};return this.emit(`pano.select`,Q(`pano.select`,{prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.workCode},state:c,userAction:!0,options:{},progress:0,error:null})),r&&r.active?(this.emit(`pano.request`,Q(`pano.request`,{userAction:!0,prevPano:this.currentPano,pano:{panoIndex:c.panoIndex,workCode:c.workCode},progress:0,state:c,options:{},error:null})),{workCode:r.work.workCode,panoIndex:r.panoIndex}):null}destroy(){super.destroy()}isReady(){return!1}updateCamera(e,t,n){return Promise.resolve()}updateCameraWithKeyframes(e,t,n){return Promise.resolve()}updateTime(e,n,...r){var i,a,o,s,c,l,u,d,f;this.userAction=!0;let p={},m={},h=this.camera.getDirection(new t.Vector3),g=this.locationMotion.keyframes[0],_=this.locationMotion.keyframes[this.locationMotion.keyframes.length-1],[v,y]=this.locationMotion.getKeyFrameSegment(e),b=this.panoResourceFromLocationMotionKeyframe(v),x=this.panoResourceFromLocationMotionKeyframe(y),S=this.panoResourceFromLocationMotionKeyframe(g),C=this.panoResourceFromLocationMotionKeyframe(_),w=!1;if(this.cameraMotion.ended===!1&&(this.cameraMotion.update(e),m.fov=this.cameraMotion.value.fov),this.modelAlphaMotion.ended===!1&&(this.modelAlphaMotion.update(e),p.modelAlpha=this.modelAlphaMotion.value.modelAlpha),this.perspToOrthoMotion.ended===!1&&(this.perspToOrthoMotion.update(e),this.camera.perspToOrtho.setScalar(H(this.perspToOrthoMotion.value.perspToOrtho,0,1))),this.locationMotion.ended===!1){this.locationMotion.update(e);let n=this.locationMotion.value.count-y.value.count+1,r=new t.Vector3().copy(b.position),o=new t.Vector3().copy(x.position);if(p.progress=n,n>=.01&&n<=.99&&(p.progress=H(x.effectEasing(n),.01,.99)),x.leftPanoPicture&&(n<1?b.leftPanoPicture&&(p.pano0=b.leftPanoPicture):p.pano0=x.leftPanoPicture,p.pano1=x.leftPanoPicture),x.effect===`montage`?p.transition=`BLACK`:x.effect===`spread`?p.transition=`SPREAD`:p.transition=`FADE`,x.effect===`zoomin`||x.effect===`zoomout`?p.progress=Math.pow(n,3):x.effect===`model`&&this.camera.pose.distance<.01&&(p.modelAlpha=1-Math.pow(H(Math.abs(n-.5)*2,0,1),4)),n<1&&x.effect!==`fly`){if(p.pano0&&b.leftPanoPicture){let e={panoId:p.pano0.panoId,map:p.pano0.map,mapHistogram:p.pano0.mapHistogram,mapSize:p.pano0.mapSize,zoom:p.pano0.zoom,matrix:b.leftPanoPicture.matrix.clone().setPosition(x.position)},t=this.panoPictureObserverMap.get(p.pano0);t&&this.panoPictureObserverMap.set(e,t),p.pano0=e}r.copy(o),w=!0}m.distance=this.locationMotion.value.distance,m.offset=new t.Vector3(r.x+(o.x-r.x)*n,r.y+(o.y-r.y)*n,r.z+(o.z-r.z)*n);let s=[],c=[];for(let e of this.locationMotion.keyframes){let{key:t,progress:n}=e;t!==void 0&&(s.push(t),n>this.locationMotion.progress&&c.push(t))}for(let e of Object.keys(this.panoResources)){if(c.indexOf(e)>=0)continue;let t=this.panoResources[e];if(t.leftPanoPicture){let e=t.leftPanoPicture.map;if(e){if(e===((i=p.pano0)==null?void 0:i.map)||e===((a=p.pano1)==null?void 0:a.map))continue;e.dispose(),t.leftPanoPicture=null}}s.indexOf(e)>=0||delete this.panoResources[e]}let l=Rp(x.panoId);l!==this.currentPano&&(this.currentPano=l,this.accessibleObserverFloorCheckCount=0),this.emit(`pano.moving`,Q(`pano.moving`,{userAction:this.userAction,prevPano:Rp(S.panoId),pano:Rp(C.panoId),state:Object.assign(Object.assign(Object.assign(Object.assign({},Rp(C.panoId)),{mode:this.mode}),$(this.camera.pose)),m),options:{},progress:this.locationMotion.progress,error:null}))}this.camera.setFromPose(m),this.xrManager.cameraVR.projectionMatrix.copy(this.camera.projectionMatrix),this.xrManager.cameraVR.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.xrManager.cameraVR.matrix.copy(this.camera.matrix),this.xrManager.cameraVR.position.copy(this.camera.position),this.xrManager.cameraVR.quaternion.copy(this.camera.quaternion),this.xrManager.cameraVR.scale.copy(this.camera.scale),this.xrManager.cameraVR.matrixAutoUpdate=!1,this.xrManager.cameraVR.matrixWorld.copy(this.camera.matrixWorld);let[T,E]=r,D=new t.Vector3(0,0,0),O=new t.Vector2().copy(this.camera.resolution);if(E&&this.xrManager.session&&this.xrManager.referenceSpace&&this.xrManager.session.renderState.baseLayer){let r=this.xrManager.cameraVR,i=this.xrManager.referenceSpace,a=this.xrManager.session.renderState.baseLayer,l=E.getViewerPose(i),u=(o=l==null?void 0:l.views)==null?[]:o;for(let e=0;e<u.length;e++){let t=u[e],n=r.cameras[e],i=a.getViewport(t);i&&(n.projectionMatrix.fromArray(t.projectionMatrix),n.projectionMatrixInverse.getInverse(n.projectionMatrix),n.matrix.fromArray(t.transform.matrix),n.matrix.setPosition(this.camera.position),n.matrix.decompose(n.position,n.quaternion,n.scale),n.matrixWorld.copy(n.matrix),n.matrixWorldInverse.getInverse(n.matrixWorld),n.matrixAutoUpdate=!1,D.copy(n.position),n.viewport.set(i.x,i.y,i.width,i.height),O.set(i.width,i.height))}if(this.xrManager.setProjectionFromUnion(this.xrManager.cameraVR,this.xrManager.cameraL,this.xrManager.cameraR),this.camera.quaternion.copy(this.xrManager.cameraVR.quaternion),this.camera.scale.copy(this.xrManager.cameraVR.scale),this.camera.matrix.compose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.computePose((s=m.distance)==null?this.camera.pose.distance:s),this.xrManager.session.inputSources){for(let e=0;e<this.xrManager.session.inputSources.length;e++)if(this.xrManager.session.inputSources[e]&&this.xrManager.session.inputSources[e].targetRayMode===`transient-pointer`){let n=E.getPose(this.xrManager.session.inputSources[e].targetRaySpace,i);if(n){let e=n.transform.orientation,r=new t.Quaternion(e.x,e.y,e.z,e.w),i=new t.Vector3(0,0,-1).applyQuaternion(r),a=new t.Raycaster(this.camera.position,i);this.gazeRay=a}}}if(this.xrManager.machineType===`Oculus`||this.xrManager.machineType===`Pico`){let r=this.xrManager.session.inputSources;for(let e=0;e<r.length;e++){let n=this.xrManager.controllers[e],a=r[e];if(!a)continue;n&&n.update(a,E,i);let o=this.xrManager.getController(e),s=new t.Vector3(0,1.2,0),l=o.position.clone().add(D).sub(s);a.handedness===`left`?this.xrControllerRay.left.set(l,new t.Vector3(0,0,-1).applyEuler(o.rotation)):a.handedness===`right`&&this.xrControllerRay.right.set(l,new t.Vector3(0,0,-1).applyEuler(o.rotation)),this.controllerWrappers[e].position.copy(new t.Vector3(0,0,0).add(D).sub(s));let u=this.modelScene.intersectRaycaster(this.xrControllerRay.right);if(u.length===0){let e=this.works.getResolvedObserver(this.currentPano);u=this.xrControllerRay.right.intersectObject(this.modelScene.boundingMesh,!0).map(t=>{var n;let r=(n=e==null?void 0:e.floorIndex)==null?0:n;return Object.assign({floorIndex:r,floor:r},t)})}if(u.length>=1&&u[0].face)if(a.handedness===`right`){let e=this.xrControllerRay.right.intersectObject(this.xrCustomObjectsScene,!0),t=u[0].face.normal,n=t.clone(),r=u[0].point.clone();this.intersectMesh.position.copy(r);let i=r.clone().add(n);if(this.intersectMesh.lookAt(i),Math.abs(t.y)>.99){let e=this.camera.position.clone().sub(r);this.intersectMesh.rotation.z=-Math.atan2(e.z,e.x)}this.intersectMesh.visible=!0,this.needsRender=!0,e.length>0?(this.pointerLines.right.setPoints(l,e[0].point),this.pointerLines.right.points.visible=!0,this.intersectMesh.visible=!1):(this.pointerLines.right.points.visible=!1,this.pointerLines.right.setPoints(l,u[0].point));let a=u[0],o=Q(`intersect.update`,{raycaster:(c=this.xrControllerRay.right)==null?null:c,intersection:a==null?null:a,object:this.intersectMesh});if(this.emit(`intersect.update`,o),o.defaultPrevented){this.hideIntersectMesh();return}}else this.pointerLines.left.setPoints(l,u[0].point)}this.updateControllerHelper(r,e,n)}}else E||console.error(`xrFrame丢失,请重试`),this.xrManager.session||console.error(`session丢失,请重试`),this.xrManager.session&&!this.xrManager.session.renderState.baseLayer&&console.error(`no layer found`);Ag(p)===!1&&this.modelScene.parameter.set(p),this.emit(`camera.update`,Q(`camera.update`,{userAction:this.userAction,state:Object.assign(Object.assign(Object.assign({},this.currentPano),{mode:this.mode}),$(this.camera.pose))}));let k=this.works.getResolvedObserver(this.currentPano),A=this.locationMotion.ended?this.getForwardObserverOrNot(this.xrManager.cameraVR):null,j=this.works.getObserver(b.panoId),M=this.works.getObserver(x.panoId);if(this.adjustPanoCircleMeshPositionBasedOnModel&&this.helper.visible&&k){let e=[],n=k.work.observers;for(let t of k.accessibleNodes){let r=n[t];r&&e.push(r)}let r=new Map;if(e.sort((e,t)=>{let n=r.get(e);n===void 0&&(n=e.standingPosition.distanceTo(k.standingPosition),r.set(e,n));let i=r.get(e);return i===void 0&&(i=t.standingPosition.distanceTo(k.standingPosition),r.set(t,i)),n-i}),e.length){this.accessibleObserverFloorCheckCount%=e.length;let n=e[this.accessibleObserverFloorCheckCount],r=this.modelScene.models.find(e=>e.work===(n==null?void 0:n.work));if(n&&r&&r.visible){let e=.3,i=.005,a=n.standingPosition.clone().applyMatrix4(n.work.transform),o=Z({panoIndex:n.panoIndex,workCode:n.work.workCode}),s=J_.map(n=>{Ly.ray.origin.copy(a),Ly.ray.origin.add(Ry.copy(n).setY(e)),Ly.ray.direction.set(0,-1,0),Ly.firstHitOnly=!0,Ly.floorIndex=-1;let[o]=r.intersectRaycaster(Ly);return o&&o.distance-i<=e?new t.Vector3().copy(a).setY(o.point.y+i):a});s.sort((e,t)=>t.y-e.y);let c=s[Math.floor(s.length/2)],[l]=s.filter(e=>e.distanceTo(c)<=.05);if(l){let e=new t.Vector4(a.x,a.y,a.z,l.y-a.y),n=this.adjustPanoCircleMeshPositionFix.get(o);n&&!e.equals(n)&&(this.needsRender=!0),this.adjustPanoCircleMeshPositionFix.set(o,e)}}this.accessibleObserverFloorCheckCount++}}let N=new Map;if(j)for(let e of j.accessibleNodes){let t=j.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(M)for(let e of M.accessibleNodes){let t=M.work.observers[e];if(t){let e=Z({panoIndex:t.panoIndex,workCode:t.work.workCode});N.set(e,t)}}if(this.panoMeshes.forEach((e,t)=>{N.get(t)?N.delete(t):(this.helper.remove(e),e.dispose(),this.panoMeshes.delete(t))}),N.forEach((e,t)=>{let n=this.panoCircleMeshCreator(e,{aerialObserverMinHeight:this.aerialObserverMinHeight});this.panoMeshes.set(t,n),this.helper.add(n),N.delete(t)}),this.panoMeshes.forEach((e,n)=>{let r=this.works.getObserver(n);if(r){let i=r.position.distanceTo(r.standingPosition)>this.aerialObserverMinHeight;if(i)e.position.copy(r.position).applyMatrix4(r.work.transform),e.scale.setScalar(18);else{e.position.copy(r.standingPosition).applyMatrix4(r.work.transform);let t=this.adjustPanoCircleMeshPositionFix.get(r.panoId);t&&(Ry.set(t.x,t.y,t.z),Ry.equals(e.position)&&(e.position.y+=t.w)),e.scale.setScalar(1.2)}let a=this.camera.position.clone().setY(e.position.y),o=new t.Vector3().copy(e.position).sub(a).normalize();if(n===Z(this.currentPano)){let t=H((.5-a.distanceTo(e.position))/.5,0,1);o.multiplyScalar(1-t).add(h.clone().multiplyScalar(t))}if(o.length()>0){let n=i?-Math.PI/2:0,r=Math.atan2(o.x,o.z);e.quaternion.setFromEuler(new t.Euler(n,r,0,`YXZ`))}}else e.visible=!1}),this.camera.pose.distance>.1||w)this.panoMeshes.forEach(t=>{t.setOpacity(0),t.setCurrent(!1),t.updateTime&&t.updateTime(e,n),t.visible=!1});else if(k){let t=k.work.observers,[,r]=vu(k.accessibleNodes,e=>{let n=t[e];return!n||!n.active?1/0:k.standingPosition.distanceTo(n.standingPosition)},!0);r=H(r,2.5,1/0);let i=k.accessibleNodes.concat(k.panoIndex).map(e=>Z({panoIndex:e,workCode:k.work.workCode}));this.panoMeshes.forEach((t,a)=>{let o=this.works.getObserver(a),s=!1,c=1;if(i.indexOf(a)===-1)s=!1,c=0;else if(!o)s=!1,c=0;else if(!o.loadable&&!o.active)s=!1,c=0;else{let e=t.position.clone().project(this.camera);s=Math.abs(e.x)<1&&Math.abs(e.y)<1&&Math.abs(e.z)<1&&!t.loading&&t.progress===0&&A!==null&&Z({panoIndex:A.panoIndex,workCode:A.work.workCode})===a;let n=t.position.clone().setY(this.camera.position.y).distanceTo(this.camera.position);c=n<.01?0:H(r/n,.1,.85)}o&&o===M&&o.position.distanceTo(o.standingPosition)>this.aerialObserverMinHeight&&t.position.distanceTo(this.camera.position)<35&&(c=0),this.modelScene.parameter.resolveValue(`modelAlpha`)>0&&(c=0),t.setCurrent(s),t.setOpacity(c),t.updateTime&&t.updateTime(e,n)})}{let e=(l=this.modelScene.parameter.progress)==null?1:l,n=Math.round(e),r=this.modelScene.parameter.pano0,i=this.modelScene.parameter.pano1,a=n===0?r:i,o;if(a&&(o=this.works.getObserver(a.panoId),o||(o=this.panoPictureObserverMap.get(a))),this.tiling.appearDuration=this.tileAppearDuration,this.tiling.maxRequest=e<(ii()?.6:.99)?0:this.tileMaxRequest,this.tiling.imageOptions=this.imageOptions,!o||!a||this.tileLevelForFov===!1||this.camera.perspToOrtho.x>0){this.tiling.setObserver(null);let e={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:null,panoMatrix:new t.Matrix4,panoZoom:1,minLevel:0,level:0};this.tiling.update(e),this.modelScene.parameter.set(`refinedScreen`,null)}else{let e=Yr(a.mapSize)+1;this.tiling.setObserver(o);let t={renderer:this.renderer,resolution:O,pixelRatio:1,time:this.camera.time,cameraMatrix:this.xrManager.cameraVR.matrixWorld,cameraProjectionMatrix:this.xrManager.cameraVR.projectionMatrix,panoMap:a.map,panoMatrix:a.matrix,panoZoom:a.zoom,minLevel:e,level:4},s=this.tiling.update(t),c={map:this.tiling.renderTarget.texture,matrixInverse:this.tiling.camera.matrixWorldInverse,projectionMatrix:this.tiling.camera.projectionMatrix,pano:n,opacity:(r==null?void 0:r.panoId)===(i==null?void 0:i.panoId)?1:Ed(Math.abs(((u=this.modelScene.parameter.progress)==null?0:u)-.5)*2)},l=this.modelScene.parameter.refinedScreen;(s||c.pano!==(l==null?void 0:l.pano)||c.opacity!==(l==null?void 0:l.opacity))&&this.modelScene.parameter.set(`refinedScreen`,c)}}if(this.panoVideo.object.position.copy(this.camera.position),this.panoVideo.updateTime(e),this.intersectMesh&&this.intersectMesh.parent&&k&&k.position.y-k.standingPosition.y>10){let e=H(this.camera.position.distanceTo(this.intersectMesh.position)*(2*Math.tan(.5*this.camera.fov/180*Math.PI))/5,.5);this.intersectMesh.scale.setScalar(e)}else this.intersectMesh.scale.setScalar(1);{let e=x.effect,{pano0:n,pano1:r}=this.modelScene.parameter;if(n&&r&&n!==r&&(e===`fly`||e===`model`)&&this.flyEffectUseDepthBuffer){if(((d=this.modelScene.parameter.pano0Depth)==null?void 0:d.panoId)!==n.panoId||((f=this.modelScene.parameter.pano1Depth)==null?void 0:f.panoId)!==r.panoId){this.pano0DepthCubeRenderTarget?this.pano0DepthCubeRenderTarget.width!==512&&this.pano0DepthCubeRenderTarget.setSize(512,512):this.pano0DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1}),this.pano1DepthCubeRenderTarget?this.pano1DepthCubeRenderTarget.width!==512&&this.pano1DepthCubeRenderTarget.setSize(512,512):this.pano1DepthCubeRenderTarget=new t.WebGLCubeRenderTarget(512,{minFilter:t.NearestFilter,magFilter:t.NearestFilter,generateMipmaps:!1});let e=new t.CubeCamera(this.camera.near,this.camera.far,this.pano0DepthCubeRenderTarget);e.matrix.copy(n.matrix),e.matrixWorld.copy(e.matrix),e.matrixAutoUpdate=!1,U_(this.renderer,this.modelScene,e,500);let i=new t.CubeCamera(this.camera.near,this.camera.far,this.pano1DepthCubeRenderTarget);i.matrix.copy(r.matrix),i.matrixWorld.copy(i.matrix),i.matrixAutoUpdate=!1,U_(this.renderer,this.modelScene,i,500),this.modelScene.parameter.set({pano0Depth:{panoId:n.panoId,map:this.pano0DepthCubeRenderTarget.texture,mapSize:this.pano0DepthCubeRenderTarget.width,maxDepth:500},pano1Depth:{panoId:r.panoId,map:this.pano1DepthCubeRenderTarget.texture,mapSize:this.pano1DepthCubeRenderTarget.width,maxDepth:500}})}}else this.modelScene.parameter.set({pano0Depth:null,pano1Depth:null}),this.flyEffectUseDepthBuffer||(this.pano0DepthCubeRenderTarget&&(this.pano0DepthCubeRenderTarget.dispose(),this.pano0DepthCubeRenderTarget=void 0),this.pano1DepthCubeRenderTarget&&(this.pano1DepthCubeRenderTarget.dispose(),this.pano1DepthCubeRenderTarget=void 0))}}render(){if(this.xrManager.session&&this.xrManager.session.renderState.baseLayer){let e=this.xrManager.session.renderState.baseLayer;return this.renderer.setRenderTarget(null),this.renderer.setScissorTest(!1),this.renderer.setFramebuffer(e.framebuffer),this.renderer.render(this.scene,this.xrManager.cameraVR),this.renderer.setFramebuffer(null),!0}return!1}onPanGesture(){}onTapGesture(){}onPinchGesture(){}onMouseMove(){}onMouseOut(){}panoResourceFromLocationMotionKeyframe(e){return this.panoResources[e.key]}updateControllerHelper(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(!e||e.length===0)return;let a={buttons:{X:!1,Y:!1,LeftTrigger:!1,LeftPinch:!1,A:!1,B:!1,RightTrigger:!1,RightPinch:!1}};for(let o=0;o<e.length;o++){let s=e[o].handedness,c=e[o].gamepad;switch(s){case`left`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`LeftAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`LeftAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`LeftAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`LeftAxesDown`,t)),c!=null&&c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`X`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`Y`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`LeftTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`LeftPinch`,t));let e={raycaster:r,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n};a.buttons.X=c.buttons&&c.buttons[4]?c.buttons[4].pressed:!1,a.buttons.Y=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.LeftTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.LeftPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1,a.left=e;break;case`right`:c.axes&&(this.emitHandleEvent(c.axes[2]===-1,`RightAxesLeft`,t),this.emitHandleEvent(c.axes[2]===1,`RightAxesRight`,t),this.emitHandleEvent(c.axes[3]===-1,`RightAxesUp`,t),this.emitHandleEvent(c.axes[3]===1,`RightAxesDown`,t)),c.buttons&&(c.buttons[4]&&this.emitHandleEvent(c.buttons[4].pressed,`A`,t),c.buttons[5]&&this.emitHandleEvent(c.buttons[5].pressed,`B`,t),c.buttons[0]&&this.emitHandleEvent(c.buttons[0].pressed,`RightTrigger`,t),c.buttons[1]&&this.emitHandleEvent(c.buttons[1].pressed,`RightPinch`,t)),a.right={raycaster:i,axes:{up:c.axes&&c.axes[3]<0?Math.abs(c.axes[3]):0,down:c.axes&&c.axes[3]<0?0:Math.abs(c.axes[3]),left:c.axes&&c.axes[2]<0?Math.abs(c.axes[2]):0,right:c.axes&&c.axes[2]<0?0:Math.abs(c.axes[2])},deltaTime:n},a.buttons.A=c.buttons&&c.buttons[4]?c==null?void 0:c.buttons[4].pressed:!1,a.buttons.B=c.buttons&&c.buttons[5]?c==null?void 0:c.buttons[5].pressed:!1,a.buttons.RightTrigger=c.buttons&&c.buttons[0]?c==null?void 0:c.buttons[0].pressed:!1,a.buttons.RightPinch=c.buttons&&c.buttons[1]?c==null?void 0:c.buttons[1].pressed:!1;break;default:break}}this.emit(`xr.controller.update`,Q(`xr.controller.update`,a))}emitHandleEvent(e,t,n){let r=this.xrControllerRay.left,i=this.xrControllerRay.right;if(e)this.xrHandleState[t].touchStart===!1?(this.xrHandleState[t].touchStartTime=n,this.xrHandleState[t].touchStart=!0,this.emit(`xr.gesture.buttonDown`,Q(`xr.gesture.buttonDown`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!1,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}))):n-this.xrHandleState[t].touchStartTime>Iy&&this.emit(`xr.gesture.press`,Q(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!0,controllers:{raycaster:{leftRay:r,rightRay:i}}}));else if(this.xrHandleState[t].touchStart===!0){if(this.emit(`xr.gesture.buttonUp`,Q(`xr.gesture.buttonUp`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}})),n-this.xrHandleState[t].touchStartTime<=Iy){let e=Q(`xr.gesture.tap`,{session:this.xrManager.session,machineType:this.xrManager.machineType,buttons:t,isFinal:!0,isFirst:!1,controllers:{raycaster:{leftRay:r,rightRay:i}}});!this.emit(`xr.gesture.tap`,e)&&!e.defaultPrevented&&t===`RightTrigger`&&this.checkSelectedPano(this.xrControllerRay.right)}this.xrHandleState[t].touchStart=!1,this.xrHandleState[t].touchStartTime=0}}initHandEvent(){if(!this.xrManager.session)throw Error(`初始化失败`);this.xrManager.session.addEventListener(`select`,e=>{this.gazeRay&&this.checkSelectedPano(this.gazeRay)})}}},By={Floorplan:qg,Topview:Yg,Panorama:Y_,VRPanorama:Bv,Model:Gv,Mapview:Zv,XRPanorama:Py},Vy=`gesture.pan,gesture.tap,gesture.dbltap,gesture.press,gesture.pinch,gesture.mousewheel,gesture.mousemove,gesture.momentum,gesture.fire,initAnimation.start,initAnimation.end,camera.update,intersect.update,pano.select,pano.moveTo,pano.moving,pano.arrived,pano.cancel,pano.error,pano.prepare,pano.texture.load,pano.texture.progress,pano.texture.success,pano.texture.error,pano.texture.abort,xr.session.start,xr.session.end,xr.gesture.tap,xr.gesture.press,xr.gesture.buttonUp,xr.gesture.buttonDown,xr.controller.update`.split(`,`);function Hy(e){e.on(`initAnimation.start`,t=>{e.emit(`initAnimationWillStart`,t.state.panoIndex,t.state,t.userAction)}),e.on(`initAnimation.end`,t=>{e.emit(`initAnimationEnded`,t.state.panoIndex,t.state,t.userAction)}),e.on(`gesture.pan`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pan`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPanGesture`,t.state,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pan`,t.pointers,t.isFinal),e.emit(`panGesture`,t.state,t.isFinal))}),e.on(`gesture.tap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`tap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`tap`,t.pointers,t.isFinal),e.emit(`tapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.dbltap`,t=>{let n=!1;n=e.emit(`wantsGesture`,`dbltap`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsDblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`dbltap`,t.pointers,t.isFinal),e.emit(`dblTapGesture`,t.center.raycaster,t.center.coords,t.isFinal))}),e.on(`gesture.press`,t=>{let n=!1;n=e.emit(`wantsGesture`,`press`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`press`,t.pointers,t.isFinal),e.emit(`pressGesture`,t.center.raycaster,t.center.coords,t.center.delta,t.isFinal))}),e.on(`gesture.pinch`,t=>{let n=!1;n=e.emit(`wantsGesture`,`pinch`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsPinchGesture`,t.scale,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`pinch`,t.pointers,t.isFinal),e.emit(`pinchGesture`,t.scale,t.state.fov,t.isFinal))}),e.on(`gesture.mousewheel`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseWheel`,t.pointers,t.isFinal),n&&t.preventDefault(),n=e.emit(`wantsMouseWheel`,t.center.delta,t.state.fov,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseWheel`,t.pointers,t.isFinal),e.emit(`mouseWheel`,t.center.delta,t.state.fov,t.isFinal))}),e.on(`gesture.mousemove`,t=>{let n=!1;n=e.emit(`wantsGesture`,`mouseMove`,t.pointers,t.isFinal),n&&t.preventDefault(),t.defaultPrevented||(e.emit(`gesture`,`mouseMove`,t.pointers,t.isFinal),n=e.emit(`wantsChangeCameraFov`,t.state.fov),n&&t.preventDefault())}),e.on(`gesture.momentum`,t=>{let n=!1;n=e.emit(`wantsInteriaPan`,t.state),n&&t.preventDefault(),t.defaultPrevented||e.emit(`interiaPan`,t.state,t.isFinal)}),e.on(`camera.update`,t=>{e.emit(`cameraFovUpdate`,t.state.fov,t.userAction),e.emit(`cameraDirectionUpdate`,t.state,t.userAction);let n=It(t.state);n.setLength(t.state.distance);let r=t.state.offset.clone().sub(n);e.emit(`cameraPositionUpdate`,r,t.userAction),e.emit(`cameraUpdate`,t.state,t.userAction)}),e.on(`intersect.update`,t=>{if(t.intersection){let n=!1;n=e.emit(`wantsShowIntersectionOnModel`,t.raycaster),n&&t.preventDefault(),t.defaultPrevented||e.emit(`intersectionOnModelUpdate`,t.intersection,t.object)}else e.emit(`intersectionHidden`)}),e.on(`pano.request`,t=>{let n=e.emit(`wantsMoveToPano`,t.state.panoIndex,t.options,t.userAction);n||(n=e.emit(`wantsToMoveToPano`,t.state.panoIndex,t.options,t.userAction)),n&&t.preventDefault(),t.defaultPrevented||e.emit(`panoWillLoad`,t.state.panoIndex)}),e.on(`pano.select`,t=>{e.emit(`panoSelected`,t.state.panoIndex)}),e.on(`pano.moveTo`,t=>{e.emit(`panoLoaded`,t.state.panoIndex),e.emit(`moveToPano`,t.state.panoIndex,t.userAction),e.emit(`panoWillArrive`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.moving`,t=>{e.emit(`movingToPano`,t.state.panoIndex,t.prevPano.panoIndex,t.progress)}),e.on(`pano.arrived`,t=>{e.emit(`panoArrived`,t.state.panoIndex,t.state,t.userAction)}),e.on(`pano.cancel`,t=>{e.emit(`moveToPanoCanceled`,t.state.panoIndex)}),e.on(`pano.error`,t=>{e.emit(`panoLoadError`,t.error,t.state.panoIndex)}),e.on(`pano.texture.load`,t=>{e.emit(`textureStartLoad`,t.pano.panoIndex)}),e.on(`pano.texture.success`,t=>{e.emit(`textureLoaded`,t.pano.panoIndex,t.meta)}),e.on(`pano.texture.error`,t=>{e.emit(`textureError`,t.error,t.pano.panoIndex)}),e.on(`pano.texture.abort`,t=>{e.emit(`textureAbort`,t.pano.panoIndex)}),e.on(`pano.texture.progress`,t=>{e.emit(`textureLoading`,t.progress,t.pano.panoIndex)}),e.on(`xr.session.start`,t=>{e.emit(`webXRSessionStart`)}),e.on(`xr.session.end`,t=>{e.emit(`webXRSessionEnd`)}),e.on(`xr.gesture.tap`,t=>{e.emit(`webXRControllerEvent`,`tap`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.press`,t=>{e.emit(`webXRControllerEvent`,`press`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonUp`,t=>{e.emit(`webXRControllerEvent`,`buttonUp`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.gesture.buttonDown`,t=>{e.emit(`webXRControllerEvent`,`buttonDown`,t.buttons,{raycaster:t.controllers.raycaster})}),e.on(`xr.controller.update`,t=>{e.emit(`webXRControllerRayUpdate`,{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0}),t.left&&e.emit(`webXRAxesUpdate`,`left`,{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.left.axes.up,down:t.left.axes.down,left:t.left.axes.left,right:t.left.axes.right},deltaTime:t.left.deltaTime}),t.right&&e.emit(`webXRAxesUpdate`,`right`,{raycaster:{leftRay:t.left?t.left.raycaster:void 0,rightRay:t.right?t.right.raycaster:void 0},axesState:{up:t.right.axes.up,down:t.right.axes.down,left:t.right.axes.left,right:t.right.axes.right},deltaTime:t.right.deltaTime})}),e.on(`works.request`,t=>{e.emit(`willLoad`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.load`,t=>{e.emit(`load`,t.input,t.works[0],e.getCurrentState())}),e.on(`works.ready`,t=>{e.emit(`loaded`,t.input,t.works[0])}),e.on(`state.change`,t=>{e.emit(`stateChange`,t.state,t.userAction)}),e.on(`currentState.change`,t=>{e.emit(`currentStateChange`,t.state,t.userAction)}),e.on(`state.set`,t=>{e.emit(`setState`,t.state)}),e.on(`state.synced`,t=>{e.emit(`stateSynced`,t.state)}),e.on(`model.request`,t=>{e.emit(`modelWillLoad`,t.work.model)}),e.on(`model.error`,t=>{e.emit(`modelLoadError`,t.error,t.model)}),e.on(`model.load`,t=>{e.emit(`modelLoaded`,t.model)}),e.on(`model.changeShownFloor`,t=>{e.emit(`modelShownFloorChange`,t.model.shownFloor,t.model.floorLength)}),e.on(`render`,t=>{e.emit(`renderFrame`,t.needsRender)}),e.on(`mode.change.request`,t=>{e.emit(`wantsChangeMode`,t.mode,t.prevMode)}),e.on(`mode.change`,t=>{e.emit(`modeChange`,t.mode,t.prevMode,t.state.panoIndex,t.state,t.userAction)}),e.on(`helpers.visible`,t=>{e.emit(`helpersVisibleChange`,t.object.visible)}),e.on(`network.resource`,t=>{e.emit(`network`,t.source,t.requestType,t.requestState,t.detail)})}function Uy(){if(typeof window<`u`){let e=document.createElement(`video`);e.loop=!0,e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.crossOrigin=``;let t=()=>{document.removeEventListener(`touchstart`,t,!1),document.removeEventListener(`mousedown`,t,!1),e.muted=!1};return document.addEventListener(`touchstart`,t,!1),document.addEventListener(`mousedown`,t,!1),e}else return{}}function Wy(){let e=new t.Group;e.name=`internalLights`;{let n=new t.DirectionalLight(16777215,.1);n.name=`direction0`,n.position.copy(new t.Vector3(0,1,0)),e.add(n)}{let n=new t.DirectionalLight(16777215,.1);n.name=`direction1`,n.position.copy(new t.Vector3(-1,-1,-1)),e.add(n)}{let n=new t.DirectionalLight(16777215,.3);n.name=`direction2`,n.position.copy(new t.Vector3(1,1,1)),e.add(n)}{let n=new t.AmbientLight(16777215,.6);n.name=`ambient0`,e.add(n)}return e}function Gy(e){var t,n;let r={},i=e.split(/(\;|\,)/);for(let e of i){let i=e.split(`=`),a=(t=i[0])==null?void 0:t.trim(),o=(n=i[1])==null?void 0:n.trim();a&&o&&(r[a]=o)}return r}function Ky(){var e;if(typeof document<`u`){let t=document.getElementsByTagName(`meta`);for(let n=0;n<t.length;n++){let r=t[n];if(r.getAttribute(`name`)===`viewport`){let t=Gy((e=r.getAttribute(`content`))==null?``:e),n=Number(t[`initial-scale`]);if(!isNaN(n))return n}}}return 1}var qy=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV8AAAA/CAQAAADtPwPkAAAR+0lEQVR4AezYg3LEQACH8d1cbdu23Q5qG9G47z/TN/h6tn2b/H+TUTLc7yjcOXV46OUAnUs6EbUp022ZBXc1NhoZYYd7fjDRvdcHAwrlK2QBVJ4sgoqONmY45RUT23sZ6H42F2hK5CtkMbjhZlDmUUcvq1zyieUVyjbE4I1GBfItwxG56YaUZTQwyh4P6NgJ4YYYvCuQb5kOyI03pORjiqe4Lwpq5pt1vJqfUwKWJVbSMYfppYconG+maNNQOWBZuwHTzicGel75NtFOkxr5apmV8cikcko0DrDQs863AeGl0cE0+1xy573m0/wf0cEKW6H7BWtggiMG8sy3oHRDpJMw4NWb6am/bv9znkqEzjd61t5oo5clTrjhwevO75EJRBKSRt745Z16ZEjcM73sccZplBPm8PyTcxZAkSRdHm/acJ0Z3JZhHB0BxqDHgWFZFmm0ZbCw87twI/zc3e/Cz93vPneXtU/WdQS3oTviXdY/q5PsJKfoGuQjZuO/0in1qsj85cuXrxqeAOJpGqdJOqrUutgVl2Qb0BWqp/RE8AWWVB7t2KrIzY2Wx2fWKl7yfswgxqj8lYummYa3hfwF9MuQRmbfQE4ocPDjtUWQ6Tq1M2w7gC2EcrMGtWS6xlpGKEDDcb1vUQ25zT4lrC2s0dU4gFPppKkbeIYr7NMpqjStuFg5rNU9epGyt8PXyfX4DE1bKLhR/1XPxwJhp5DAV67T9ZPwFdovhBMIGUYoRBN4wim6S3eoXVEHXdLgmwY0x6BQnO4xPJ0Ar5OVxhQF0L9UslRM4yaQQfQImnBegi8vhY2A1k6YLlrj61TwDdNQnIISwiPvpD7TwYQTssZXK47vg8y9Gp2nxRcATkozOEmdCeObSt3IIo+xf/00IDRKAaZ89PBTkHqpkA5LagKeNZKlIhqX8RcQ95GHtdYA62Y6rOg5LLsOSnoyvk4V38hFhytef+V9/3DER1P48W89o1GxE9o5vns2Mk+F7yiftafEN4nhmUv9DKEeyqI0U+l0CQg+B//sZ5+6lOuqKaTgm0LH41RHw/CsLZRk4huiYxrvP2SNr1OSS+Dr1ulBMR+K9SqHa58Oec49VgL3mXHvDr7QfuM7LMNrH1/IS30Moe64SLYBuFVJ+MbnJY7L+GrVQkFcl4ISx/fEll4ZWnz18DpcSzUCX602LqD9svDLzmdaLkP28P1+VsJjsx/4hmh6x/gmm/i6pbrGneCL9iCOg0dQUvF1UwEdVvG19r2uTXxXLz0J37eLjfZoF++tTtPnU/cWp5e8n3An0m/G+U7qjiy4PpHyV16HKx5flCxAV/H9A88nUnZ7l7KN78SBxPcQgzLAepxEScU3l7pZ6fL2+Dot8fXECfj+QRoGYAwlAfBSPrXQXQri0Pd85NJKcVw8XUdt1LZapk7YRhO1RdpmFJwW8ozekYvx2/fjM5Hr5MfQ95HvcY2a/9hoNK4yEntL+dEuGseTdNmxIPqd5v2YRjeaX8pQ8IW2ohuP7+dTN87RMK4aitx8XPsH0r2oBqNRqrv7+gmjjY7uIr6TBxBfL2MlxNRKSVp8S5CTuGgHXxfkFvh69Pq3LD4pkkd2bdRvHaSNC3/l2sQXAccdlIS+lc57qhPJwxPybT7XSxnUrdqnXuHlJHS+mjZfJfUZR9s2FuQR+EQKdSi9Am8UTnsEvlYS+L6TFwW6kl74Vjr6AFHsX89rgg8njRltK0XPOL7NyDL0IurV4VtMwafB1709vu9X4OjWHoP3z1Ii7eaQdG00Lx5n8HXyDSva/dU0Pq2vZnKYxHYMYRo1WY5ov1G7Vh4r3y+kMdgbilxeOrV0aqOFenFl8GGJig7rG0bbPRqiSRpP2AL0w+yon9dHbi43zFetnKcuw9ZLeSa+7kTw/TDfuFu0Z7Vp/uhyHfPkAZ5ufP9wLIfD49E3clR818rR089Lzyy+VRREPneICnYLX9cT8PVKQs36TbQ3i6NcCwYkxEAQ3phN4CjAvC4mFr5vrlKe7AizBKj8cu33s7i9GbeY7BHYujTjjd3Bx54SSyT4m8mxOoYOAGX/DtwvnGE1M+5v5Bgt1hbkJRW9Cxv9X81GL2i5jqaoJ4avBcCsLYp+Ru+VC5sWPpFhXt8/EPvJL2F/alJDEeIjUhcrP5P45rDeATPj+wKl7gBf1fcq+HpVnfHO1vEf//UCHgt/OxfDE3onj5UkfTaThrg3NCGoBUCtZjvgMnwQB0bG5XENeraJ5XEWvtiHkqSVRqN+uQ4lEx2o+69SeY1dC++Wcsj+LCW+H0ZE4KtDWHkGwCtrxstbFqr51e9wbz42E2fpjRQsqEn50PnM4eumO9IbujCi393Hd+3q72TI+p9DPyyfraF+c3rOx0KJyB2z7Fa1yCO8HoHzlDFhPiWD8XoB3aPppRrUQdRp1D8qE9exdgr+Zbpqf8BLfmZ/bMYbh87k58VCSswCjQoLPPw4Jnp4uFi/YQlfKB5eBd/gr6aqB973zbDAF+v5PN+NZEvm+84bSkhxUPE9C9wqbeJ7Hi+gA9Jr5ZM7x9el4mulyK0Bb2xiMTj3/iBtK77Tnii27H/MlCfsjcJY+2oTg2/U4TYWQERE0r+aCouBcx5zEZzEYrqui8JXsQW/X8FLHJ3IVbWXhQV3zAJCjFQst1F25y1arlXwhRR4Bb4rZ3VPy5d+bHEtHIPF27K16ItYuKXM5kHD10M9DKFeSpbqLlOYAlRiC99yCiDmbUf0206jPPO7b/iud71avBkHf+kQP0OrWHBFrhmt75ZyPzbLg5KmWK9oH4Oq1eFZOm0c6n48mdfer46HcLUZU3pGB8R9IDBbJ+N7v1q0J2xhudZ45tcL8PN16vq9WizwtRLwFQtKER+NDypj4QQOdJNY3NC7GEsaGtiSmDsA+CZhyx+hXFHjYrgGGXpZNvDNpn5gWWuiWkUtyEB0UcrO8Y2L9KI9K+cXLmxqruGd6pcKfycj/ij3URVgu6bPUaycN1qXTHD+KoOmjGORnH57q8rh+e9sTHk5r1+7zpEXk36bp7iiXRrBW61e5k/D0fn+EXF/OxYEypFW3ZH1HzPt4Pv5PN2Rd7VJLDZeboGnbpSPwPDcBw5f6AIysadFOR9Hr7vksoFvE91jdbdYvzpYqyIvdQPU87uKL45u3u213CA8qkYPT6H1YgwIfkz7RI5xJdomfjoV4PXjfjgaRkNGhHwG1mNt1oq0y/j+SaZ5pV0LnrlG89Dl1YkmEsc3nKKzMKskJD+fx6NhlFiohdTe5EsZIig5WPgWUYCC9Dx5TG/sA5x15LCBbzXDtx/+uh74VmMZjLDamh8JvhzQtSsoeVTNNXB/Euv96LRR/qjO+By5xTxxJ683/FB00Pj0fZz9F2GPa70Ld2hbbVptWmjWabbGCl/ZAiTsbJa5hQ9OK/eWFE4xva9nG3z1zwCtnFXjYr6c3ykxPn9QiYWEWPhA4uuiDnzBpt4EMcg0QOm28M0gP76hJuELbIdZi4PqaILpJI+RYz4ZV42y+q49wBcxIbyXTmtXgevRWPl3MmjSSJU5vB3J0TA2Uu8mtP+R5/Au4iiF6NrUUiuCieOiJpnJq8gSXzwFLFiLP8X6bV0bYvzt8TXj75eLtKPRauY1RM1HR7GwEHpFbonIWAPwjxpfqJSCyBVUsk/DFOChhC18kyiPHFvwdVGh6XFbmfLx+RRi4jaqYiCnUDO1wc4u4ovo7pfS+XFD32e9GzndwxJiHcbQ/Vz6JrBMDGYyYK5l7YOsfkS2MVePfGkLsNXLGl9hIVbWXAv9fQ5i/j6UFL1RaQffB9qlwn3tS4WxMhaxETCMz6T9ZTqCk5FznoOKL9SEXMMIUwAZW6dNfCEVX61azdxwmIbg4aHdwtcj5KVBeNiqrb2+g5M8hTskSB6exHZ5bMEIF/wCoOT128zvdXziMLbvuDu/Usmh0oG7doMmafKNSmt8hQWUnmzhjJf/RskXCzQL8aYNfLG/QPGLY5KjKtcuNPGsyGytmj0/kPi6qdXwwJCPvOTYI3zTaICCNEh9FGSWM54OX4+A1UI80RV98czWKceJf65ervsleJm164/7ganACHHn+IPz8Nby1ptcnRztRWbipArvp4/gRchodbIFvsBSWPBaW+CHtzWfauFfcmnKRuyr+Fiu1WbzGKtCPWWMHjIgU1/Mgn2B74GKfbkajHwtVIHy3uBbh0Ocj9oplCC+kIJvYuKvI9bbkUUQ2+JaG7AeknwvhLd0YUxx+SZIf4XkGeqHUCNt9N8sQdvYlwtl9H4hMzqI5dHosMIX2taCl2s6LRowaubPyld/IgcvHBJPnKGnHDLh0ArfqzlYtkv5D8++4RsAvPbwTaJzgDcIDzxIRXuEbx4NIsYupjt7gi/6idL3j1AIqPY+OPH5PGO67x/jUS9NvF6hTte7x2kaCvtSZJiMlxjxMSqEtqXr3GPMn/9y4cXUypS/ymPxbIAvmurtYl9o7dqmBV9KdbLOgsik4B3d6xW/lO7w/kfe+yfx7bFuGkwY3/C6sURDj8584rCxJH5QtnYFVrFQVL35HNoQgO0jvt228XVRC4WQPLtANyiEzb1gD/BNoy5kHa5QEnUmiq/uG2fubeXh+kwuNj8IRxAoOqiLIqfTaNw84SfLWsDmqo08k30prHVKbHuYDo7ez6U7EsLX0oJX1ltV2AOg2KfoMPPA/sTx/ZPMqF9YiN11AsHLFrHgaAT3GBvw7hO+U9TH4bX10rgVx7YgMr0p7Pow4tL8XcY3l1kJMfVQmsA3fa/wFQh3JK9eivtV+tCaD4cUjdZvIRI9BfDUDd6PkkbfKhVbOJf/jUpuQcXXlgVNv68ejr4gTflk5AZ71+jR4AvEdPg6PDNpaz6a2AQm2otoWKvVS+LVTyL4OnaE7wSNUjfdpnZb+KbQdcA7Jr5ek0od8MD9dNjiN43t4etk1v0ITfyw6gS+Q4l5XwGwbXli+u/sj6pWGu9XfyYXx75d18+lf6t0tnau/pXKv8+xzorIkltn0l4r2dYCXlO8XDRbu9xw/9g/Zko2FXSFtKPxOxn3q+caluteK5lJsboXwVP/S27cPVz28X3i3/Ll/v8eDVMPDmzwvDbwddMt+NoROhq3yXcC4D7KpmTyA+XnqEzSFQrawDeLrsNemHrEL2+24r7NlENZUMa2vyxkH2DIs628e669ubdsR4VXC7C9u79eIVJtOwgdgO/dOICHGK6jQHaIwdXN4Lwt0LWHr4d6kX8tV+ozqAs+uYCSmO2w+jd4zGNeUYL4nqZxeN5WKVgooSAClmEaYhqhdit89QC7niSbCEM2sdkBuHYxQg9ri5ZjkuhI6DMP+J7cTvEtokEx0aPscyddoFJKpSZqV7G1GTxcpmEthpnw5058c6GfwqpwzGOtGjXSJI3FLYhc+O+jSr9aGhPWQlRshS8AticLX7wnsgbXxt6gsWCpRBa0vRGQM8oB9dhmP3QAwFX4c079dJNq6Qi5xbuyTmpPSJ1Ur4UtF7GoTtmUL3zxaWqMU8P/k3cXSQ1EQRjHGdzdHTa4u7tzBs7CedhykNwF2/5jq56iU11db6Lv2yTj8hs3JoiU9sZZp5/62J5v1z9NjrDHaSbnbFMf52sHrDUVaidDxNG0o9+uLjfosfdb3jT5d5j757riJgst9NIZQ2Pn+ySZll80vjI6Wz/hQJG4vPG0L/H6poQch/dW3vL3B0u8jl0HvVj5PvHCElEF8DUAFikVYTcvmfBdDzQlvvMXSV5lP5zrXj/fJ54zuWaeeuoqkW8AwCIaqeTZKkmYrpPwR2eqN9X72W7EG57vU67OBeuMV8KXLUzv93UTTj42tvaFS++GVsc5JRyLSLJ8nzO555hFBmiSRCqMr4GwrcmGkib5xSvcwmzFK6e8s7DMa2xH4YZdZumSOwsVzFeBWdr37tpIhOpSwXqONNgZq/2KgvBt54znHN1HzlljTO4oVD5fb+prNIJXQNL1ofDKQisbPLJDv3jNSLq9OkYBEIihKIj3v7S1TRQCX5Kdl1ZQlol7LF+E++fwirfiq2sf4cTXxc6hzxffPuLEeqSWrPGWMF58TWr5viyJAP5/4EV4KePiaSE8eNRgjDy8/tyRW+FZjhS+2tlovNJovtJovNJ0uhK6Wo64SDdxEbM//KesjwAAAABJRU5ErkJggg==`,Jy=[351,63],Yy=[20,20],Xy=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),Zy=new Float32Array([0,0,1,0,0,1,1,1]),Qy=new Uint8Array([0,1,2,1,3,2]),$y=new t.BufferGeometry;$y.setAttribute(`position`,new t.BufferAttribute(Xy,3)),$y.setAttribute(`uv`,new t.BufferAttribute(Zy,2)),$y.setIndex(new t.BufferAttribute(Qy,1));var eb=new t.MeshBasicMaterial({transparent:!0,depthTest:!1,depthWrite:!1,stencilWrite:!1,fog:!1}),tb=new t.Mesh($y,eb);tb.matrixAutoUpdate=!1;var nb=new t.Scene;nb.add(tb),nb.matrixAutoUpdate=!1;var rb=new t.OrthographicCamera(-.5,.5,.5,-.5,.1,1);rb.position.set(0,0,.5),rb.lookAt(0,0,0),rb.updateMatrixWorld(!0),rb.matrixAutoUpdate=!1;var ib=new t.Vector4,ab=new t.Vector4;function ob(e){if(eb.map){let t=e.getViewport(ib),n=e.getScissor(ab),r=e.getScissorTest(),i=e.autoClear,a=n.x+Yy[0]/3,o=n.y+Yy[1]/3,s=Jy[0]/3,c=Jy[1]/3;e.setViewport(a,o,s,c),e.setScissor(a,o,s,c),e.setScissorTest(!0),e.autoClear=!1,e.render(nb,rb),e.setViewport(t),e.setScissor(n),e.setScissorTest(r),e.autoClear=i}else{let e=new t.Texture,n=new Image;n.onload=()=>{e.image=n,e.wrapS=t.ClampToEdgeWrapping,e.wrapT=t.ClampToEdgeWrapping,e.minFilter=t.LinearFilter,e.needsUpdate=!0,e.generateMipmaps=!1,eb.needsUpdate=!0,n.onload=G},n.src=qy,eb.map=e}}var sb=class{constructor(e=2048){this._count=0,this.width=e,this.height=1,this.data=new Uint32Array(this.width*this.height),this.texture=this.createTexture(this.data,this.width,this.height)}get count(){return this._count}createTexture(e,n,r){let i=new t.DataTexture(e,n,r,t.RedIntegerFormat,t.UnsignedIntType);return i.internalFormat=`R32UI`,i.minFilter=t.NearestFilter,i.magFilter=t.NearestFilter,i.generateMipmaps=!1,i.needsUpdate=!0,i}update(e){let t=e.length,n=Math.max(1,Math.ceil(t/this.width));n>this.height&&(this.height=n,this.data=new Uint32Array(this.width*this.height),this.texture.dispose(),this.texture=this.createTexture(this.data,this.width,this.height)),this.data.set(e,0),this._count=t,this.texture.needsUpdate=!0}dispose(){this.texture.dispose()}},cb=2,lb=8,ub=class{constructor(e){let n=e.numPoints,r=e.packedData;if(!r||r.length<n*lb)throw Error(`[TileTexture] object 缺少足量 packedData`);let i=n*cb,a=Math.max(1,Math.min(2048,i)),o=Math.max(1,Math.ceil(i/a)),s=new Uint32Array(a*o*4);s.set(r.subarray(0,n*lb),0);let c=new t.DataTexture(s,a,o,t.RGBAIntegerFormat,t.UnsignedIntType);c.internalFormat=`RGBA32UI`,c.minFilter=t.NearestFilter,c.magFilter=t.NearestFilter,c.generateMipmaps=!1,c.needsUpdate=!0,this.texture=c,this.count=n,this.width=a,this.height=o}dispose(){this.texture.dispose()}},db=2,fb=class e{constructor(n=2048){this.target=null,this.targetHeight=0,this.regionMap=new Map,this.regionList=[],this.width=n,this.material=new t.RawShaderMaterial({vertexShader:e.VERTEX,fragmentShader:e.FRAGMENT,uniforms:{u_tileTex:{value:null},u_tileWidth:{value:1},u_bigWidth:{value:n},u_startTexel:{value:0},u_count:{value:0},u_transformIndex:{value:0},u_layerIndex:{value:0}},depthTest:!1,depthWrite:!1}),this.scene=new t.Scene,this.mesh=new t.Mesh(new t.PlaneGeometry(2,2),this.material),this.mesh.frustumCulled=!1,this.scene.add(this.mesh),this.camera=new t.Camera}get texture(){return this.target?this.target.texture:null}get totalPoints(){let e=0;for(let t of this.regionList)e+=t.count;return e}get regions(){return this.regionList}has(e){return this.regionMap.has(e)}add(e,t,n,r){if(this.regionMap.has(e))return;let i={object:e,tile:t,start:0,count:t.count,transformIndex:n,layerIndex:r};this.regionMap.set(e,i),this.regionList.push(i)}sync(e,t){let n=new Set(e);for(let e of Array.from(this.regionMap.keys()))n.has(e)||(this.regionMap.get(e).tile.dispose(),this.regionMap.delete(e));let r=[];for(let n of e){let e=this.regionMap.get(n),{transformIndex:i,layerIndex:a}=t(n);e?(e.transformIndex=i,e.layerIndex=a):(e={object:n,tile:new ub(n),start:0,count:n.numPoints,transformIndex:i,layerIndex:a},this.regionMap.set(n,e)),r.push(e)}this.regionList=r}remove(e){let t=this.regionMap.get(e);if(!t)return;t.tile.dispose(),this.regionMap.delete(e);let n=this.regionList.indexOf(t);n>=0&&this.regionList.splice(n,1)}clear(){for(let e of this.regionList)e.tile.dispose();this.regionMap.clear(),this.regionList=[]}assemble(e){let n=0;for(let e of this.regionList)e.start=n,n+=e.count;let r=Math.max(1,Math.ceil(n*db/this.width));(!this.target||r>this.targetHeight)&&(this.target&&this.target.dispose(),this.targetHeight=r,this.target=new t.WebGLRenderTarget(this.width,r,{format:t.RGBAIntegerFormat,type:t.UnsignedIntType,minFilter:t.NearestFilter,magFilter:t.NearestFilter,depthBuffer:!1,stencilBuffer:!1}),this.target.texture.internalFormat=`RGBA32UI`,this.target.texture.generateMipmaps=!1);let i=e.getRenderTarget(),a=e.autoClear,o=e.getScissorTest(),s=e.getScissor(new t.Vector4),c=e.getPixelRatio()||1;e.autoClear=!1,e.setRenderTarget(this.target),e.setScissorTest(!0);for(let t of this.regionList){let n=t.start*db,r=(t.start+t.count)*db,i=Math.floor(n/this.width),a=Math.ceil(r/this.width),o=Math.max(0,Math.floor(i/c)-1),s=Math.ceil(a/c)+1,l=Math.ceil(this.width/c)+1;e.setScissor(0,o,l,s-o);let u=this.material.uniforms;u.u_tileTex.value=t.tile.texture,u.u_tileWidth.value=t.tile.width,u.u_bigWidth.value=this.width,u.u_startTexel.value=n,u.u_count.value=t.count,u.u_transformIndex.value=t.transformIndex,u.u_layerIndex.value=t.layerIndex,this.material.uniformsNeedUpdate=!0,e.render(this.scene,this.camera)}e.setScissorTest(o),e.setScissor(s),e.setRenderTarget(i),e.autoClear=a}snapshot(){return this.regionList.map(e=>Object.assign({},e))}extractSortInputs(){let e=this.totalPoints,t=new Float32Array(e*3),n=new Uint32Array(e);for(let e of this.regionList){let r=e.object.packedData;if(!r)continue;let i=new Float32Array(r.buffer,r.byteOffset,r.length),a=e.transformIndex;for(let r=0;r<e.count;r++){let o=e.start+r;t[o*3+0]=i[r*8+0],t[o*3+1]=i[r*8+1],t[o*3+2]=i[r*8+2],n[o]=a}}return{positions:t,transformIndices:n,count:e}}readback(e){if(!this.target)return new Uint32Array;let t=this.width,n=this.targetHeight,r=new Uint32Array(t*n*4),i=e.getRenderTarget();e.setRenderTarget(this.target);let a=e.getContext();return a.readPixels(0,0,t,n,a.RGBA_INTEGER,a.UNSIGNED_INT,r),e.setRenderTarget(i),r}dispose(){this.clear(),this.target&&(this.target.dispose(),this.target=null),this.mesh.geometry.dispose(),this.material.dispose()}};fb.VERTEX=`#version 300 es
|
|
2844
2844
|
in vec3 position;
|
|
2845
2845
|
void main() {
|
|
2846
2846
|
gl_Position = vec4(position.xy, 0.0, 1.0);
|
|
@@ -2871,7 +2871,7 @@ void main() {
|
|
|
2871
2871
|
}
|
|
2872
2872
|
outColor = v;
|
|
2873
2873
|
}
|
|
2874
|
-
`;var pb=5,mb=pb*4,hb=class{constructor(){this.texture=null,this.width=pb,this.data=new Float32Array,this.indexMap=new Map,this.count=0}indexOf(e){return this.indexMap.get(e)}get objectCount(){return this.count}get transforms(){return this.data}sync(e){this.indexMap.clear(),this.count=e.length;let t=Math.max(1,this.count)*mb;this.data.length<t&&(this.data=new Float32Array(t));for(let t=0;t<e.length;t++){let n=e[t];this.indexMap.set(n,t),this.data.set(n.matrixWorld.elements,t*mb),this.data[t*mb+16]=+!!n.selected}this.rebuildTexture()}updateOne(e){let t=this.indexMap.get(e);t!==void 0&&(this.data.set(e.matrixWorld.elements,t*mb),this.data[t*mb+16]=+!!e.selected,this.texture&&(this.texture.needsUpdate=!0))}rebuildTexture(){let e=Math.max(1,this.count);this.texture&&this.texture.dispose();let n=new t.DataTexture(this.data,this.width,e,t.RGBAFormat,t.FloatType);n.internalFormat=`RGBA32F`,n.minFilter=t.NearestFilter,n.magFilter=t.NearestFilter,n.generateMipmaps=!1,n.needsUpdate=!0,this.texture=n}dispose(){this.texture&&(this.texture.dispose(),this.texture=null)}},gb=class{constructor(){this.layerKeys=[],this.layerKeyToIndex=new Map,this.objectLayerIndex=new Map}sync(e){this.layerKeys=[],this.layerKeyToIndex.clear(),this.objectLayerIndex.clear();for(let t of e){let e=t.gsViewLayerKey||t.uuid,n=this.layerKeyToIndex.get(e);n===void 0&&(n=this.layerKeys.length,this.layerKeys.push(e),this.layerKeyToIndex.set(e,n)),this.objectLayerIndex.set(t,n)}}layerIndexOf(e){var t;return(t=this.objectLayerIndex.get(e))==null?0:t}get layerCount(){return this.layerKeys.length}},
|
|
2874
|
+
`;var pb=5,mb=pb*4,hb=class{constructor(){this.texture=null,this.width=pb,this.data=new Float32Array,this.indexMap=new Map,this.count=0}indexOf(e){return this.indexMap.get(e)}get objectCount(){return this.count}get transforms(){return this.data}sync(e){this.indexMap.clear(),this.count=e.length;let t=Math.max(1,this.count)*mb;this.data.length<t&&(this.data=new Float32Array(t));for(let t=0;t<e.length;t++){let n=e[t];this.indexMap.set(n,t),this.data.set(n.matrixWorld.elements,t*mb),this.data[t*mb+16]=+!!n.selected}this.rebuildTexture()}updateOne(e){let t=this.indexMap.get(e);t!==void 0&&(this.data.set(e.matrixWorld.elements,t*mb),this.data[t*mb+16]=+!!e.selected,this.texture&&(this.texture.needsUpdate=!0))}rebuildTexture(){let e=Math.max(1,this.count);this.texture&&this.texture.dispose();let n=new t.DataTexture(this.data,this.width,e,t.RGBAFormat,t.FloatType);n.internalFormat=`RGBA32F`,n.minFilter=t.NearestFilter,n.magFilter=t.NearestFilter,n.generateMipmaps=!1,n.needsUpdate=!0,this.texture=n}dispose(){this.texture&&(this.texture.dispose(),this.texture=null)}},gb=1,_b=gb*4,vb=class{constructor(){this.texture=null,this.width=gb,this.data=new Float32Array,this.indexMap=new Map,this.count=0}get objectCount(){return this.count}sync(e,t){this.indexMap.clear(),this.count=e.length;let n=Math.max(1,this.count)*_b;this.data.length<n&&(this.data=new Float32Array(n));for(let n of e){let e=t(n);e===void 0||e<0||e>=this.count||(this.indexMap.set(n,e),this.write(n,e))}this.rebuildTexture()}updateOne(e){let t=this.indexMap.get(e);t!==void 0&&(this.write(e,t),this.texture&&(this.texture.needsUpdate=!0))}write(e,t){let n=t*_b;this.data[n+0]=e.preBlurAmount,this.data[n+1]=e.blurAmount,this.data[n+2]=0,this.data[n+3]=0}rebuildTexture(){let e=Math.max(1,this.count);this.texture&&this.texture.dispose();let n=new t.DataTexture(this.data,this.width,e,t.RGBAFormat,t.FloatType);n.internalFormat=`RGBA32F`,n.minFilter=t.NearestFilter,n.magFilter=t.NearestFilter,n.generateMipmaps=!1,n.needsUpdate=!0,this.texture=n}dispose(){this.texture&&(this.texture.dispose(),this.texture=null),this.indexMap.clear(),this.count=0}},yb=class{constructor(){this.layerKeys=[],this.layerKeyToIndex=new Map,this.objectLayerIndex=new Map}sync(e){this.layerKeys=[],this.layerKeyToIndex.clear(),this.objectLayerIndex.clear();for(let t of e){let e=t.gsViewLayerKey||t.uuid,n=this.layerKeyToIndex.get(e);n===void 0&&(n=this.layerKeys.length,this.layerKeys.push(e),this.layerKeyToIndex.set(e,n)),this.objectLayerIndex.set(t,n)}}layerIndexOf(e){var t;return(t=this.objectLayerIndex.get(e))==null?0:t}get layerCount(){return this.layerKeys.length}},bb=2048,xb=4,Sb=class{constructor(){this.texture=null,this.textureSize=new t.Vector2,this.dataMaxDegree=0,this.appliedDegree=0}sync(e,n){let r=0,i=0;for(let t of e)t.maxSHDegree>r&&(r=t.maxSHDegree),i+=t.numPoints;this.dataMaxDegree=r;let a=Math.min(n,r);if(this.appliedDegree=a,a<=0||i===0)return this.appliedDegree=0,!1;let o=0;a>=1&&(o+=9),a>=2&&(o+=15),a>=3&&(o+=21);let s=o;s%xb!==0&&(s=Math.ceil(s/xb)*xb);let c=s/xb,l=i*c,u=bb,d=Math.ceil(l/u),f=new Float32Array(u*d*xb),p=0;for(let t of e){let e=t.sh1,n=t.sh2,r=t.sh3;for(let i=0;i<t.numPoints;i++){let t=(p+i)*c,o=0;if(e&&a>=1)for(let n=0;n<9;n++){let r=t+Math.floor(o/xb),a=o%xb;f[r*xb+a]=e[i*9+n],o++}if(n&&a>=2)for(let e=0;e<15;e++){let r=t+Math.floor(o/xb),a=o%xb;f[r*xb+a]=n[i*15+e],o++}if(r&&a>=3)for(let e=0;e<21;e++){let n=t+Math.floor(o/xb),a=o%xb;f[n*xb+a]=r[i*21+e],o++}}p+=t.numPoints}this.texture&&this.texture.dispose();let m=new t.DataTexture(f,u,d,t.RGBAFormat,t.FloatType);return m.internalFormat=`RGBA32F`,m.minFilter=t.NearestFilter,m.magFilter=t.NearestFilter,m.generateMipmaps=!1,m.needsUpdate=!0,this.texture=m,this.textureSize.set(u,d),!0}dispose(){this.texture&&(this.texture.dispose(),this.texture=null)}},Cb=4294967295,wb=class e{constructor(n=64){this.maxSeg=n,this.segStart=Array(n).fill(0),this.segEnd=Array(n).fill(0),this.segDelta=Array(n).fill(0),this.segRemoved=Array(n).fill(0),this.material=new t.RawShaderMaterial({vertexShader:e.VERTEX,fragmentShader:e.buildFragment(n),uniforms:{u_srcOrder:{value:null},u_orderWidth:{value:1},u_segCount:{value:0},u_segStart:{value:this.segStart},u_segEnd:{value:this.segEnd},u_segDelta:{value:this.segDelta},u_segRemoved:{value:this.segRemoved}},depthTest:!1,depthWrite:!1}),this.scene=new t.Scene,this.mesh=new t.Mesh(new t.PlaneGeometry(2,2),this.material),this.mesh.frustumCulled=!1,this.scene.add(this.mesh),this.camera=new t.Camera}static createOrderTarget(e,n){let r=new t.WebGLRenderTarget(e,n,{format:t.RedIntegerFormat,type:t.UnsignedIntType,minFilter:t.NearestFilter,magFilter:t.NearestFilter,depthBuffer:!1,stencilBuffer:!1});return r.texture.internalFormat=`R32UI`,r.texture.generateMipmaps=!1,r}run(e,t,n,r,i){let a=Math.min(i.length,this.maxSeg);i.length>this.maxSeg&&console.warn(`[ReorderPass] segments ${i.length} 超过 maxSeg ${this.maxSeg},将被截断。`);for(let e=0;e<a;e++){let t=i[e];this.segStart[e]=t.oldStart,this.segEnd[e]=t.oldEnd,this.segDelta[e]=t.delta,this.segRemoved[e]=+!!t.removed}this.material.uniforms.u_srcOrder.value=t,this.material.uniforms.u_orderWidth.value=n,this.material.uniforms.u_segCount.value=a,this.material.uniformsNeedUpdate=!0;let o=e.getRenderTarget(),s=e.autoClear;e.autoClear=!1,e.setRenderTarget(r),e.render(this.scene,this.camera),e.setRenderTarget(o),e.autoClear=s}dispose(){this.mesh.geometry.dispose(),this.material.dispose()}static buildFragment(e){return`#version 300 es
|
|
2875
2875
|
precision highp float;
|
|
2876
2876
|
precision highp int;
|
|
2877
2877
|
precision highp usampler2D;
|
|
@@ -2901,12 +2901,12 @@ void main() {
|
|
|
2901
2901
|
}
|
|
2902
2902
|
outColor = uvec4(result, 0u, 0u, 0u);
|
|
2903
2903
|
}
|
|
2904
|
-
`}};
|
|
2904
|
+
`}};wb.SENTINEL=Cb,wb.VERTEX=`#version 300 es
|
|
2905
2905
|
in vec3 position;
|
|
2906
2906
|
void main() {
|
|
2907
2907
|
gl_Position = vec4(position.xy, 0.0, 1.0);
|
|
2908
2908
|
}
|
|
2909
|
-
`;var
|
|
2909
|
+
`;var Tb=`(function(){function e(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function t(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function n(e){return function(){var n=this,r=arguments;return new Promise(function(i,a){var o=e.apply(n,r);function s(e){t(o,i,a,s,c,\`next\`,e)}function c(e){t(o,i,a,s,c,\`throw\`,e)}s(void 0)})}}function r(){return i.apply(this,arguments)}function i(){return i=n(function*(e={}){var t,r=e,i=!1,a=!0,o=self.location.href;if(i||a){try{new URL(\`.\`,o).href}catch(e){}(function(){var e=n(function*(e){var t=yield fetch(e,{credentials:\`same-origin\`});if(t.ok)return t.arrayBuffer();throw Error(t.status+\` : \`+t.url)});return function(t){return e.apply(this,arguments)}})()}console.log.bind(console),console.error.bind(console);var s=!1;function c(e){for(var t=0,n=e.length,r=new Uint8Array(n),i;t<n;++t)i=e.charCodeAt(t),r[t]=~i>>8&i;return r}var l,u,d=!1;function f(){var e=N.buffer;new Int8Array(e),new Int16Array(e),r.HEAPU8=u=new Uint8Array(e),new Uint16Array(e),new Int32Array(e),r.HEAPU32=new Uint32Array(e),r.HEAPF32=new Float32Array(e),new Float64Array(e),new BigInt64Array(e),new BigUint64Array(e)}function p(){if(r.preRun)for(typeof r.preRun==\`function\`&&(r.preRun=[r.preRun]);r.preRun.length;)E(r.preRun.shift());S(T)}function m(){d=!0,L.c()}function h(){if(r.postRun)for(typeof r.postRun==\`function\`&&(r.postRun=[r.postRun]);r.postRun.length;)w(r.postRun.shift());S(C)}var g;function _(){return c(\`\\0asm\\0\\0\\0\\\`\\\`\\0\\\`
|
|
2910
2910
|
\\0\\\`\\0\\0\\x07aa\\0\\0\\0\\0\\x07\\bA\\v\\x07b\\0c\\0d\\0e\\0f\\0\\f
|
|
2911
2911
|
ü8T~@A\\b(\\0" \\0B\\x07|Bøÿÿÿ|"BÿÿÿÿX@ §"\\0?\\0AtM\\r \\0\\0\\r\\vA\\bA06\\0A\\vA\\b \\x006\\0 \\vß\\v\\b@ \\0E\\r\\0 \\0A\\bk" \\0Ak(\\0"Axq"\\0j!@ Aq\\r\\0 AqE\\r (\\0"k"A\\b(\\0I\\r \\0 j!\\0@@@A\\b(\\0 G@ (\\f! AÿM@ (\\b"G\\rA\\bA\\b(\\0A~ Avwq6\\0\\f\\v (!\\x07 G@ (\\b" 6\\f 6\\b\\f\\v (" Aj ("E\\r Aj\\v!@ ! "Aj! ("\\r\\0 Aj! ("\\r\\0\\v A\\x006\\0\\f\\v ("AqAG\\rA\\b \\x006\\0 A~q6 \\0Ar6 \\x006\\0\\v 6\\f 6\\b\\f\\vA\\0!\\v \\x07E\\r\\0@ ("At"(¸
|
|
2912
2912
|
F@ A¸
|
|
@@ -2949,5 +2949,5 @@ Aj$\\0 \\0\\v
|
|
|
2949
2949
|
*\\b
|
|
2950
2950
|
*\\0
|
|
2951
2951
|
* ! \\v!
|
|
2952
|
-
\\v j ¼"\\v \\vAsAÿÿÿÿ\\x07q \\vA\\0H\\x1B"\\v6\\0 \\b \\vAÿÿqAtj" (\\0Aj6\\0 \\vAvAüÿqj"\\v \\v(\\0Aj6\\0 \\fAj!\\f\\f\\v\\v\\v\\0\\v\\v \\0A\\b\\v\`)}function v(e){return e}function y(e,t){var n,r=v(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function b(){return{a:F}}function x(){function e(e,t){return L=e.exports,P(L),f(),L}var t=b();return r.instantiateWasm?new Promise((n,i)=>{r.instantiateWasm(t,(t,r)=>{n(e(t,r))})}):(g!=null||(g=_()),e(y(g,t)[0]))}for(var S=e=>{for(;e.length>0;)e.shift()(r)},C=[],w=e=>C.push(e),T=[],E=e=>T.push(e),D=()=>2147483648,O=(e,t)=>Math.ceil(e/t)*t,k=e=>{var t=(e-N.buffer.byteLength+65535)/65536|0;try{return N.grow(t),f(),1}catch(e){}},A=e=>{var t=u.length;e>>>=0;var n=D();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),k(Math.min(n,O(Math.max(e,i),65536))))return!0}return!1},j=new Uint8Array(123),M=25;M>=0;--M)j[48+M]=52+M,j[65+M]=M,j[97+M]=26+M;if(j[43]=62,j[47]=63,r.noExitRuntime&&r.noExitRuntime,r.print&&r.print,r.printErr&&r.printErr,r.wasmBinary&&r.wasmBinary,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.preInit)for(typeof r.preInit==\`function\`&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.shift()();var N;function P(e){r._sort=e.d,r._malloc=e.e,r._free=e.f,N=e.b,e.__indirect_function_table}var F={a:A};function I(){p();function e(){var e;r.calledRun=!0,!s&&(m(),l==null||l(r),(e=r.onRuntimeInitialized)==null||e.call(r),h())}r.setStatus?(r.setStatus(\`Running...\`),setTimeout(()=>{setTimeout(()=>r.setStatus(\`\`),1),e()},1)):e()}var L=x();return I(),t=d?r:new Promise((e,t)=>{l=e}),t}),i.apply(this,arguments)}let a;function o(){return e(this,void 0,void 0,function*(){a=yield r()})}let s,c,l,u,d,f,p,m,h,g,_=0,v=0,y=!1,b=[],x=!0,S=!0,C=!1,w=!1,T=!1;function E(e,t){if(t.length!==16)return!0;for(let n=0;n<16;n++)if(Math.abs(e[n]-t[n])>1e-7)return!0;return!1}let D=[],O=65536,k=()=>e(void 0,void 0,void 0,function*(){if(C){w=!0;return}C=!0,w=!1,a||(yield o());let e=Math.pow(2,Math.ceil(Math.log2(s.vertexCount)));_<e&&(_>0&&(a._free(c),a._free(u),a._free(d),a._free(f),a._free(p),a._free(m)),_=e,c=a._malloc(64),u=a._malloc(_*4),d=a._malloc(3*_*4),f=a._malloc(_*4),p=a._malloc(_*4),m=a._malloc(_*4)),y||(h=a._malloc(O*4),g=a._malloc(O*4),y=!0),v<s.transforms.length&&(v>0&&a._free(l),v=s.transforms.length,l=a._malloc(v*4)),C=!1,w&&(w=!1,yield k())}),A=()=>{if(C||w||!a)return;C=!0,S&&(a.HEAPF32.set(s.positions,d/4),a.HEAPF32.set(s.transforms,l/4),a.HEAPU32.set(s.transformIndices,u/4),S=!1),a.HEAPF32.set(new Float32Array(b),c/4),a._sort(c,l,u,s.vertexCount,d,f,p,m,h,g);let e=s.vertexCount,t=new Uint32Array(a.HEAPU32.buffer,p,e),n=e*4,r=D.pop();(!r||r.byteLength<n)&&(r=new ArrayBuffer(n));let i=new Uint32Array(r,0,e);i.set(t),self.postMessage({depthIndex:i,generation:s.generation},[r]),C=!1,x=!1},j=()=>{T||(T=!0,x&&A(),setTimeout(()=>{T=!1,j()}))};self.onmessage=t=>new Promise(n=>e(void 0,void 0,void 0,function*(){var e;if(t.data.warmup){yield o(),n(!0);return}if(t.data.returnBuffer){D.length<3&&D.push(t.data.returnBuffer),n(!0);return}let r=!1,i=!!t.data.sortData;if(t.data.sortData&&(s={positions:t.data.sortData.positions,transforms:t.data.sortData.transforms,transformIndices:t.data.sortData.transformIndices,vertexCount:t.data.sortData.vertexCount,generation:(e=t.data.sortData.generation)==null?0:e},x=!0,S=!0,yield k(),r=!0),t.data.viewProj){let e=t.data.viewProj;(E(e,b)||i)&&(b=e,x=!0,r=!0)}r&&x&&j(),n(!0)}))})();`,Cb=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,Sb],{type:`text/javascript;charset=utf-8`});function wb(e){let t;try{if(t=Cb&&(self.URL||self.webkitURL).createObjectURL(Cb),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(Sb),{name:e==null?void 0:e.name})}}var Tb=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}("}rpvv|{-uvtu}-sy|nH}rpvv|{-uvtu}-v{H0vsqrs-b`Rl\\_QR_laReab_R{vs|z-uvtu}-nz}yr?Q-l|qrar\x07rH{vs|z-v{-l|qrdvquH{vs|z-v{-l{z]|v{H0ryrnvor-sy|n-}ynV{qr\x07H0r{qvs{vs|z-uvtu}-nz}yr?Q-lr\x07rH{vs|z-uvtu}-nz}yr?Q-ln{s|zH{vs|z-uvtu}-nz}yr?Q-luar\x07rH{vs|z-rp?-luar\x07r`v rH{vs|z-v{-lzn\x07`uQrtrrH0vs-[bZlT`lPYV]]R_`-K-=----{vs|z-rp?-lyn\brPyv}}r_n{trh[bZlT`lYNfR_`jH----{vs|z-znA-lpyv}}rZnvprV{rrh[bZlT`lPYV]]R_`jH0r{qvs{vs|z-rp?-r|yv|{H0vs-R[NOYRlT`lV[ValN[VZNaV\\[{vs|z-sy|n-lnttrtnv|{]|trH{vs|z-sy|n-lnttrtnv|{]|v{Qnv|{H{vs|z-rp@-lnttrtnv|{O|{qZv{H{vs|z-rp@-lnttrtnv|{O|{qZn\x07H0r{qvsn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bHp|{-sy|n-xr{ry?Q`v r-J-=;@Hp|{-sy|n-zn\x07`prr{`}npr`}yn`v r-J-?=AE;=Hp|{-sy|n-`UlP>-J-=;AEEC=?B>>F=?F>FFHp|{-sy|n-`UlP?l=-J->;=F?BAEAHp|{-sy|n-`UlP?l>-J-:>;=F?BAEAHp|{-sy|n-`UlP?l?-J-=;@>B@F>CHp|{-sy|n-`UlP?l@-J-:>;=F?BAEAHp|{-sy|n-`UlP?lA-J-=;BAC?DA?Hrp?-tr`UQnnbc5v{-}ynVq\x079-v{-p|z}|{r{\\ssr9-rp?-r\x07r`v r6-\n----v{-uP|z}|{r{P|{-J-=H----vs-5lzn\x07`uQrtrr-KJ->6-uP|z}|{r{P|{-8J-FH----vs-5lzn\x07`uQrtrr-KJ-?6-uP|z}|{r{P|{-8J->BH----vs-5lzn\x07`uQrtrr-KJ-@6-uP|z}|{r{P|{-8J-?>H----v{-}nqqrqP|z}|{r{P|{-J-uP|z}|{r{P|{H----vs-5}nqqrqP|z}|{r{P|{-2-A-.J-=6-\n--------}nqqrqP|z}|{r{P|{-J-55}nqqrqP|z}|{r{P|{-<-A6-8->6-7-AH----\f----sy|n-yv{rnP|z}|{r{V{qr\x07-J-sy|n5}ynVq\x07-7-}nqqrqP|z}|{r{P|{-8-p|z}|{r{\\ssr6H----sy|n-r\x07ryV{qr\x07-J-yv{rnP|z}|{r{V{qr\x07-<-A;=H----sy|n-q-J-r\x07ryV{qr\x07-<-r\x07r`v r;\x07H----sy|n-\b-J-sy||5q6-<-r\x07r`v r;\bH----sy|n-\x07-J-snp5q6H----r{-rp?5\x079-\b6H\f|vq-znv{-56-\n0vsqrs-b`Rl\\_QR_laReab_R----<<-|qr-走纹理:用实例号从-|qrar\x07r-取本实例要画的全局点索引----vrp?-|qrP||q-J-vrp?5tylV{n{prVQ-2-l|qrdvqu9-tylV{n{prVQ-<-l|qrdvqu6H----v{-}ynV{qr\x07b-J-r\x07rySrpu5l|qrar\x07r9-|qrP||q9-=6;H----<<-r|qr-标记为-`R[aV[RY5KJ-{z]|v{6-的实例被剔除----vs-5}ynV{qr\x07b-KJ-v{5l{z]|v{66-\n--------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------r{H----\f0ryr----v{-}ynV{qr\x07b-J-v{5}ynV{qr\x07-8-=;B6H0r{qvs----v{-}ynV{qr\x07V-J-v{5}ynV{qr\x07b6H----<<-每-}yn-?-r\x07ry-5_TON@?bV6G----<<-r\x07ry-=G-h}|els@?ov9-}|fls@?ov9-}|gls@?ov9-_TONl}npxrqj----<<-r\x07ry->G-hp|==\vp|=>5unys?69-p|=?\vp|>>5unys?69-p|>?\vp|??5unys?69-n{s|zV{qr\x07II>C\vyn\brV{qr\x07j----v{-onrar\x07ry-J-}ynV{qr\x07b-7-?H----v{-r\x07dvqu-J-v{5r\x07r`v r5lr\x07r9-=6;\x076H----vrp?-p||q=-J-vrp?5onrar\x07ry-2-r\x07dvqu9-onrar\x07ry-<-r\x07dvqu6H----vrp?-p||q>-J-vrp?55onrar\x07ry-8->6-2-r\x07dvqu9-5onrar\x07ry-8->6-<-r\x07dvqu6H----rpA-=-J-r\x07rySrpu5lr\x07r9-p||q=9-=6H----rpA->-J-r\x07rySrpu5lr\x07r9-p||q>9-=6H----<<-全精度位置-5|owrp-}npr6----rp@-}ynPr{r-J-rp@5--------v{Ova|Sy|n5=;69--------v{Ova|Sy|n5=;t69--------v{Ova|Sy|n5=;o6----6H----<<-颜色----rpA-p|y|-J-rpA5--------sy|n5=;n-3-=\x07SS69--------sy|n55=;n-KK-E6-3-=\x07SS69--------sy|n55=;n-KK->C6-3-=\x07SS69--------sy|n55=;n-KK-?A6-3-=\x07SS6----6-<-?BB;=H----<<-预计算的-@Q-协方差(|owrp-}npr),对称矩阵-C-分量-5unys:}rpvv|{6----rp?-p|ln-J-{}npxUnys?\x07>C5>;6H--<<-5p|==9-p|=>6----rp?-p|lo-J-{}npxUnys?\x07>C5>;t6H--<<-5p|=?9-p|>>6----rp?-p|lp-J-{}npxUnys?\x07>C5>;o6H--<<-5p|>?9-p|??6----zn@-cx-J-zn@5--------p|ln;\x079-p|ln;\b9-p|lo;\x079--------p|ln;\b9-p|lo;\b9-p|lp;\x079--------p|lo;\x079-p|lp;\x079-p|lp;\b----6H----<<-n{s|zV{qr\x07-和-yn\brV{qr\x07-从->;n-解包----v{-n{s|zV{qr\x07-J->;n-KK->CH----v{-yn\brV{qr\x07-J->;n-3-=\x07SSSSH----znA-n{s|z-J-znA5--------r\x07rySrpu5ln{s|z9-vrp?5=9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5>9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5?9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5@9-n{s|zV{qr\x0769-=6----6H----znA-n{s|zZ|qrycvrZnv\x07-J-vrZnv\x07-7-n{s|zH----rpA-|yqPr{r-J-n{s|z-7-rpA5}ynPr{r9->;=6H0vs-R[NOYRlT`lV[ValN[VZNaV\\[----sy|n-y|pny]|tr-J-lnttrtnv|{]|trH----sy|n-pnyr]|tr-J-=;=H----o||y-v{O|{qS|Nttrtnv|{-J-snyrH----vs-5lnttrtnv|{]|tr-I->;=6-\n--------o||y-v{O|{q-J-|yqPr{r;\x07-KJ-lnttrtnv|{O|{qZv{;\x07---------------------33-|yqPr{r;\x07-IJ-lnttrtnv|{O|{qZn\x07;\x07---------------------33-|yqPr{r; -KJ-lnttrtnv|{O|{qZv{; ---------------------33-|yqPr{r; -IJ-lnttrtnv|{O|{qZn\x07; H--------vs-5v{O|{q6-\n------------v{O|{qS|Nttrtnv|{-J-rH------------sy|n-urvtu_n{tr-J-lnttrtnv|{O|{qZn\x07;\b-:-lnttrtnv|{O|{qZv{;\bH------------sy|n-{|znyv rqUrvtu-J-urvtu_n{tr-K-=;==>----------------L-pynz}55|yqPr{r;\b-:-lnttrtnv|{O|{qZv{;\b6-<-urvtu_n{tr9-=;=9->;=6----------------G-=;BH------------sy|n-}|v{Q-J-pynz}5lnttrtnv|{]|v{Qnv|{9-=;=>9->;=6H------------sy|n-navzr-J-5>;=-:-{|znyv rqUrvtu6-7-5>;=-:-}|v{Q6H------------y|pny]|tr-J-pynz}55lnttrtnv|{]|tr-:-navzr6-<-}|v{Q9-=;=9->;=6H------------sy|n-|ssr]|tr-J-z||ur}5=;=9->;=9-y|pny]|tr6H------------pnyr]|tr-J-y|pny]|tr-7-y|pny]|tr-7-y|pny]|trH------------rp@-nttrtnv|{Pr{r-J-5lnttrtnv|{O|{qZv{-8-lnttrtnv|{O|{qZn\x076-<-?;=H------------rp@-qv-J-|yqPr{r;\x07\b -:-nttrtnv|{Pr{rH------------sy|n-qv-J-yr{tu5qv6H------------sy|n-n{q`rrq-J-q|5}ynPr{r9-rp@5>?;FEFE9-DE;?@@9-AB;>CA66H------------sy|n-n{qQv-J-snp5v{5n{q`rrq6-7-A@DBE;BAB@6H------------sy|n-n{tyr-J-n{q`rrq-7->=;=H------------rp@-pnrQv-J-{|znyv r5rp@5----------------p|5n{tyr69----------------zv\x075:=;D9-=;>9-snp5v{5n{q`rrq-7->;D6-7-A@DBE;BAB@669----------------v{5n{tyr6------------66H------------sy|n-r\x07}y|v|{Snp|-J-5>;=-:-|ssr]|tr6-7-5>;=-8->;=-7-n{qQv6H------------rp@-|ssr-J-pnrQv-7-qv-7-r\x07}y|v|{Snp|H------------|yqPr{r;\x07\b -8J-|ssrH------------}ynPr{r-J-5v{rr5n{s|z6-7-|yqPr{r6;\x07\b H--------\f----\f0r{qvs----0vs-[bZlT`lPYV]]R_`-K-=----vs-5yn\brV{qr\x07-I-v{5[bZlT`lYNfR_`66-\n--------rp?-pyv}_n{tr-J-lyn\brPyv}}r_n{trhyn\brV{qr\x07jH--------v{-pyv}`n-J-v{5pyv}_n{tr;\x07-8-=;B6H--------v{-pyv}P|{-J-v{5pyv}_n{tr;\b-8-=;B6H--------v{-pyv}R{q-J-pyv}`n-8-pyv}P|{H--------s|-5v{-v-J-=H-v-I-[bZlT`lPYV]]R_`H-v886-\n----------------vs-5v-I-pyv}`n-\v\v-v-KJ-pyv}R{q6-\n--------------------p|{v{rH----------------\f----------------rpA-pyv}}r]|vv|{-J-lpyv}}rZnvprV{rrhvj-7-|yqPr{rH----------------o||y-pyv}}rq-J-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH----------------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH----------------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH----------------vs-5pyv}}rq6-\n--------------------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------------------r{H----------------\f--------\f----\f----0r{qvs----rpA-vrPr{r-J-n{s|zZ|qrycvrZnv\x07-7-rpA5}ynPr{r9->;=6H----rpA-pyv}Pr{r-J-}|wrpv|{Znv\x07-7-vrPr{rH----sy|n-pyv}-J->;?-7-pyv}Pr{r;H----vs-5pyv}Pr{r; -I-:pyv}Pr{r;-\v\v-pyv}Pr{r; -K-pyv}Pr{r;-\v\v--------pyv}Pr{r;\x07-I-:pyv}-\v\v-pyv}Pr{r;\x07-K-pyv}-\v\v--------pyv}Pr{r;\b-I-:pyv}-\v\v-pyv}Pr{r;\b-K-pyv}6-\n--------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------r{H----\f----rp@-{qpPr{r-J-pyv}Pr{r;\x07\b -<-pyv}Pr{r;H----]|vv|{-J-}|vv|{;\x07\bH----rp?-s|pny-J-rp?5--------}|wrpv|{Znv\x07h=jh=j-7-r|yv|{;\x07-7-=;B9--------}|wrpv|{Znv\x07h>jh>j-7-r|yv|{;\b-7-=;B----6H----o||y-v\\u|tn}uvp-J-}|wrpv|{Znv\x07h@jh@j-K-=;DH----zn@-WH----vs-5v\\u|tn}uvp6-\n--------W-J-n{}|r5zn@5------------s|pny;\x079-=;=9-=;=9------------=;=9-s|pny;\b9-=;=9------------=;=9-=;=9-=;=--------66H----\f-ryr-\n--------sy|n--J->;=-<-5vrPr{r; -7-vrPr{r; 6H--------W-J-zn@5------------s|pny;\x07-<-vrPr{r; 9-=;=9-:5s|pny;\x07-7-vrPr{r;\x076-7-9------------=;=9-s|pny;\b-<-vrPr{r; 9-:5s|pny;\b-7-vrPr{r;\b6-7-9------------=;=9-=;=9-=;=--------6H----\f----zn@-d-J-n{}|r5zn@5n{s|zZ|qrycvrZnv\x0766H----zn@-a-J-d-7-WH----<<-@Q-→-?Q-协方差投影-5nyvt{rq-vu-t}yn-_r{qr]|tnz6----zn@-p|?Qz-J-n{}|r5a6-7-cx-7-aH----p|?Qzh=jh=j-8J-xr{ry?Q`v rH----p|?Qzh>jh>j-8J-xr{ry?Q`v rH----sy|n-zvq-J-5p|?Qzh=jh=j-8-p|?Qzh>jh>j6-<-?;=H----sy|n-nqv-J-yr{tu5rp?55p|?Qzh=jh=j-:-p|?Qzh>jh>j6-<-?;=9-p|?Qzh=jh>j66H----sy|n-ynzoqn>-J-zvq-8-nqvH----sy|n-ynzoqn?-J-zvq-:-nqvH----vs-5ynzoqn?-I-=;=6-\n--------r{H----\f----rp?-qvnt|{nycrp|-J-{|znyv r5rp?5p|?Qzh=jh>j9-ynzoqn>-:-p|?Qzh=jh=j66H----<<-协方差已在-}npx-阶段-×A(与-t}yn-对齐),故用-\05?7ynzoqn6-而非-\05E7ynzoqn6----rp?-znw|N\x07v-J-zv{5\05?;=-7-ynzoqn>69-zn\x07`prr{`}npr`}yn`v r6-7-qvnt|{nycrp|H----rp?-zv{|N\x07v-J-zv{5\05?;=-7-ynzoqn?69-zn\x07`prr{`}npr`}yn`v r6-7-rp?5qvnt|{nycrp|;\b9-:qvnt|{nycrp|;\x076H----<<-\0nq-顶点为-h:?9?j,等价于-t}yn-的-}|vv|{-7-n\x07v-<-vr}|----rp?-onvcvr}|-J-rp?5>;=-<-r|yv|{;\x079->;=-<-r|yv|{;\b6H----rp?-{qp\\ssr-J-5]|vv|{;\x07-7-znw|N\x07v-8-]|vv|{;\b-7-zv{|N\x07v6-7-onvcvr}|H0vs-R[NOYRlT`lV[ValN[VZNaV\\[----sy|n-sv{ny`pnyr]|tr-J-v{O|{qS|Nttrtnv|{-L-pnyr]|tr-G-5lnttrtnv|{]|tr-7-lnttrtnv|{]|tr-7-lnttrtnv|{]|tr6H----{qp\\ssr-7J-zv\x075=;>9->;=9-sv{ny`pnyr]|tr6H0r{qvs----rpA-\0nq]|-J-rpA5{qpPr{r;\x07\b-8-{qp\\ssr9-{qpPr{r; 9->;=6H----tyl]|vv|{-J-\0nq]|H----vs-5lzn\x07`uQrtrr-KJ->6-\n--------rp@-pnzrn]|V{\\owrp-J-rp@5v{rr5n{s|z6-7-rpA5pnzrn]|vv|{9->;=66H--------rp@-|owrpcvrQv-J-{|znyv r5}ynPr{r-:-pnzrn]|V{\\owrp6H--------rpA-u=>?@-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-=9-luar\x07r`v r66H--------rpA-uABCD-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-A9-luar\x07r`v r66H--------rpA-uEF>=>>-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-E9-luar\x07r`v r66H--------rp@-u>-J-u=>?@;toH--------rp@-u?-J-rp@5u=>?@;n9-uABCD;t6H--------rp@-u@-J-rp@5uABCD;on9-uEF>=>>;6H--------sy|n-\x07-J-|owrpcvrQv;\x07H--------sy|n-\b-J-|owrpcvrQv;\bH--------sy|n- -J-|owrpcvrQv; H--------rp@-uP|y|-J-u>-7-5:=;AEEC=?B-7-\b6-8-u?-7-5=;AEEC=?B-7- 6-8-u@-7-5:=;AEEC=?B-7-\x076H--------p|y|;to-8J-uP|y|H--------vs-5lzn\x07`uQrtrr-KJ-?6-\n------------rpA-u>?>@>A>B-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9->?9-luar\x07r`v r66H------------rpA-u>C>D>E>F-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9->C9-luar\x07r`v r66H------------rpA-u?=?>???@-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-?=9-luar\x07r`v r66H------------rp@-uA-J-uEF>=>>;tonH------------rp@-uB-J-u>?>@>A>B;toH------------rp@-uC-J-rp@5u>?>@>A>B;n9-u>C>D>E>F;t6H------------rp@-uD-J-rp@5u>C>D>E>F;on9-u?=?>???@;6H------------rp@-uElqrt?-J-u?=?>???@;tonH------------sy|n-\x07\x07-J-\x07-7-\x07H------------sy|n-\b\b-J-\b-7-\bH------------sy|n- -J- -7- H------------sy|n-\x07\b-J-\x07-7-\bH------------sy|n-\b -J-\b-7- H------------sy|n-\x07 -J-\x07-7- H------------p|y|;to-8J----------------5`UlP?l=-7-\x07\b6-7-uA-8----------------5`UlP?l>-7-\b 6-7-uB-8----------------5`UlP?l?-7-5?;=-7- -:-\x07\x07-:-\b\b66-7-uC-8----------------5`UlP?l@-7-\x07 6-7-uD-8----------------5`UlP?lA-7-5\x07\x07-:-\b\b66-7-uElqrt?H--------\f----\f----p|y|;to-J-pynz}5p|y|;to9-rp@5=;=69-rp@5>;=66H----P|y|-J-p|y|H----<<-]|vv|{-直接传-h:?9?j-的-\0nq-坐标给-sntzr{(与-t}yn-一致)----b-J-}|vv|{;\x07\bH\f"),Eb=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`}rpvv|{-uvtu}-sy|nH0v{pyqr-Ip|zz|{Kn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bH|vq-znv{-56-
|
|
2953
|
-
----<<-与-t}yn-_r{qr]|tnz-一致:]|vv|{-为-h:?9?j-的-\0nq-坐标----sy|n-N-J-:q|5]|vv|{9-]|vv|{6H----vs-5N-I-:A;=6-qvpnqH----rp@-p|y|-J-P|y|;toH----sy|n-|}npv\b-J-r\x07}5N6-7-P|y|;nH----tylSntP|y|-J-rpA5p|y|;to9-|}npv\b6H\f`),Db=new t.Vector3,Ob=new t.Vector3,kb=new t.Quaternion,Ab=new t.Quaternion,jb=new t.Vector3,Mb=class extends t.Mesh{constructor(){super(),this.needsRender=!1,this.sortWorker=null,this.splatIndexCapacity=0,this.sortDataUploaded=!1,this.usedSHDegree=0,this.transformStore=null,this.transformsDirty=!1,this.layerRegistry=null,this.shStore=null,this.orderTexture=null,this.assembler=null,this.reorderPass=null,this.orderTarget=null,this.orderBaseSnapshot=[],this.sortGeneration=0,this.snapshotByGen=new Map,this.orderCount=0,this.orderDirty=!1,this.layoutDirty=!1,this.lastObjectsHash=``,this.lastClipperHash=``,this.prevSortCameraMatrix=null,this.sortCameraDistance=1,this.sortCameraCoorient=.99,this.sortMinIntervalMs=0,this.sortLastTime=-1/0,this.onBeforeRender=(e,n,r)=>{let i=r,a=this.collectObjects(n);if(a.length===0){this.geometry.instanceCount=0;return}let o=0,s=!1;for(let e of a)e.usedSHDegree>o&&(o=e.usedSHDegree),e.initAnimationEnabled&&(s=!0);let c=o!==this.usedSHDegree;this.usedSHDegree=o,this.updateInitAnimationDefine(s),this.isSceneChanged(a)?this.rebuild(e,a):c&&this.updateSH(a);for(let e of a)e.transformChanged&&this.transformStore.indexOf(e)!==void 0&&(this.transformStore.updateOne(e),this.transformsDirty=!0,e.transformChanged=!1,e.selectedChanged=!1);let l=new t.Matrix4().multiplyMatrices(i.perspectiveProjectionMatrix,i.matrixWorldInverse);this.requestSort(i,l.elements),(this.orderDirty||this.layoutDirty)&&(this.runReorder(e),this.orderDirty=!1,this.layoutDirty=!1);let u=a.map(e=>{let t=e.gsClippers.map(e=>{var t;return`${(t=e.floorIndex)==null?-1:t}:${e.clippingBoxMatrix.elements.join(`,`)}`}).join(`;`);return`${e.gsViewLayerKey}:${t}`}).join(`|`);u!==this.lastClipperHash&&(this.updateClipperUniforms(a),this.lastClipperHash=u,this.needsRender=!0),this.material.uniforms.resolution.value.set(i.resolution.x,i.resolution.y)},this.geometry=this.createGeometry(),this.material=this.createMaterial(),this.orderTexture=new sb,this.assembler=new fb,this.reorderPass=new xb,this.transformStore=new hb,this.layerRegistry=new gb,this.shStore=new yb,this.material.uniforms.u_orderTexture.value=this.orderTexture.texture,this.material.uniforms.u_orderWidth.value=this.orderTexture.width,this.frustumCulled=!1,this.renderOrder=-99999999999,this.sortWorker=new wb,this.sortWorker.postMessage({warmup:!0}),this.sortWorker.onmessage=e=>{var t;if(e.data.depthIndex){let n=e.data.depthIndex;this.applyDepthIndex(n,e.data.generation);let r=n.buffer;r.byteLength>0&&((t=this.sortWorker)==null||t.postMessage({returnBuffer:r},[r]))}}}createGeometry(){let e=new t.InstancedBufferGeometry,n=new Float32Array([-2,-2,0,2,-2,0,2,2,0,-2,2,0]);e.setAttribute(`position`,new t.BufferAttribute(n,3)),e.setIndex(new t.BufferAttribute(new Uint16Array([0,1,2,0,2,3]),1)),this.splatIndexCapacity=1;let r=new Float32Array(this.splatIndexCapacity),i=new t.InstancedBufferAttribute(r,1,!1,1);return i.setUsage(t.DynamicDrawUsage),e.setAttribute(`splatIndex`,i),e._maxInstanceCount=this.splatIndexCapacity,e.instanceCount=0,e}ensureSplatIndexCapacity(e){let n=this.geometry.getAttribute(`splatIndex`);if(e<=this.splatIndexCapacity)return n;let r=Math.max(this.splatIndexCapacity,1);for(;r<e;)r*=2;let i=new Float32Array(r);i.set(n.array.subarray(0,Math.min(n.array.length,r)));let a=new t.InstancedBufferAttribute(i,1,!1,1);return a.setUsage(t.DynamicDrawUsage),this.geometry.setAttribute(`splatIndex`,a),this.splatIndexCapacity=r,this.geometry._maxInstanceCount=r,a}createMaterial(){return new t.ShaderMaterial({vertexShader:Tb,fragmentShader:Eb,defines:{NUM_GS_LAYERS:0,NUM_GS_CLIPPERS:0,ENABLE_GS_INIT_ANIMATION:0,USE_ORDER_TEXTURE:1},uniforms:{u_texture:{value:null},u_transforms:{value:null},u_orderTexture:{value:null},u_orderWidth:{value:2048},u_numPoints:{value:0},u_numGsLayers:{value:0},u_numGsClippers:{value:0},u_layerClipperRanges:{value:[]},u_clipperMatricesInverse:{value:[]},u_shTexture:{value:null},u_shTextureSize:{value:new t.Vector2},u_maxShDegree:{value:0},resolution:{value:new t.Vector2},u_aggregationProgress:{value:0},u_aggregationBoundsMin:{value:new t.Vector3(0,0,0)},u_aggregationBoundsMax:{value:new t.Vector3(0,0,0)},u_aggregationPointDuration:{value:.6}},side:t.DoubleSide,transparent:!0,blending:t.NormalBlending,depthTest:!0,depthWrite:!1})}rebuildTransformsTexture(e){this.transformStore.sync(e),this.material.uniforms.u_transforms.value=this.transformStore.texture,this.transformsDirty=!0}rebuildAssembled(e,t){this.assembler.sync(t,e=>({transformIndex:this.transformStore.indexOf(e),layerIndex:this.layerRegistry.layerIndexOf(e)})),this.assembler.assemble(e),this.material.uniforms.u_texture.value=this.assembler.texture}updateSH(e){this.shStore.sync(e,this.usedSHDegree),this.material.uniforms.u_shTexture.value=this.shStore.texture,this.material.uniforms.u_shTextureSize.value.copy(this.shStore.textureSize),this.material.uniforms.u_maxShDegree.value=this.shStore.appliedDegree}applyDepthIndex(e,t){let n=e.length,r=this.ensureSplatIndexCapacity(n);r.array.set(e,0),r.count=n,r.updateRange.offset=0,r.updateRange.count=n,r.needsUpdate=!0,this.orderTexture&&this.orderTexture.update(e);let i=this.snapshotByGen.get(t);if(i){this.orderBaseSnapshot=i;for(let e of this.snapshotByGen.keys())e<t&&this.snapshotByGen.delete(e)}this.orderCount=n,this.orderDirty=!0,this.geometry.instanceCount=n,this.needsRender=!0}snapshotLayout(){return this.assembler?this.assembler.regions.map(e=>({object:e.object,start:e.start,count:e.count})):[]}buildSegments(e,t){let n=new Map;for(let e of t)n.set(e.object,e.start);let r=[];for(let t of e){let e=n.get(t.object),i=e===void 0,a=i?0:e-t.start,o=r[r.length-1];o&&o.removed===i&&(i||o.delta===a)&&o.oldEnd===t.start?o.oldEnd=t.start+t.count:r.push({oldStart:t.start,oldEnd:t.start+t.count,delta:a,removed:i})}return r}runReorder(e){if(!this.reorderPass||!this.orderTexture||this.orderCount===0)return;let t=this.snapshotLayout(),n=this.buildSegments(this.orderBaseSnapshot,t),r=this.orderTexture.width,i=Math.max(1,Math.ceil(this.orderCount/r));this.orderTarget?(this.orderTarget.width!==r||this.orderTarget.height<i)&&this.orderTarget.setSize(r,Math.max(this.orderTarget.height,i)):this.orderTarget=xb.createOrderTarget(r,i),this.reorderPass.run(e,this.orderTexture.texture,r,this.orderTarget,n);let a=0;for(let e of t)a+=e.count;this.material.uniforms.u_orderTexture.value=this.orderTarget.texture,this.material.uniforms.u_orderWidth.value=r,this.material.uniforms.u_numPoints.value=a}postSortData(){var e;let t=++this.sortGeneration;this.snapshotByGen.set(t,this.snapshotLayout());let{positions:n,transformIndices:r,count:i}=this.assembler.extractSortInputs(),a=this.transformStore.transforms.slice(0,this.transformStore.objectCount*20);(e=this.sortWorker)==null||e.postMessage({sortData:{positions:n,transforms:a,transformIndices:r,vertexCount:i,generation:t}},[n.buffer,a.buffer,r.buffer]),this.sortDataUploaded=!0,this.transformsDirty=!1}shouldSort(e){if(this.transformsDirty||!this.sortDataUploaded||!this.prevSortCameraMatrix)return!0;this.prevSortCameraMatrix.decompose(Db,kb,jb),e.matrixWorld.decompose(Ob,Ab,jb);let t=Db.distanceTo(Ob),n=Math.abs(kb.dot(Ab));return t>this.sortCameraDistance||n<this.sortCameraCoorient}requestSort(e,n){var r;!this.assembler||this.assembler.totalPoints===0||this.shouldSort(e)&&(performance.now()-this.sortLastTime<this.sortMinIntervalMs||((this.transformsDirty||!this.sortDataUploaded)&&this.postSortData(),(r=this.sortWorker)==null||r.postMessage({viewProj:n}),this.prevSortCameraMatrix||(this.prevSortCameraMatrix=new t.Matrix4),this.prevSortCameraMatrix.copy(e.matrixWorld),this.sortLastTime=performance.now()))}collectObjects(t){let n=[];return t.traverse(t=>{t instanceof e.t&&t.visible&&n.push(t)}),n.sort((e,t)=>{let n=e.uuid+e.gsViewLayerKey,r=t.uuid+t.gsViewLayerKey;return n<r?-1:+(n>r)}),n}isSceneChanged(e){let t=e.map(e=>`${e.uuid}:${e.gsViewLayerKey}`).join(`|`);return t===this.lastObjectsHash?!1:(this.lastObjectsHash=t,!0)}rebuild(e,t){this.sortDataUploaded=!1,this.layerRegistry.sync(t),this.rebuildTransformsTexture(t),this.rebuildAssembled(e,t),this.material.uniforms.u_numPoints.value=this.assembler.totalPoints,this.ensureSplatIndexCapacity(this.assembler.totalPoints),this.updateSH(t),this.lastClipperHash=``,this.layoutDirty=!0,this.needsRender=!0}updateClipperUniforms(e){var n,r;let i=this.layerRegistry;if(!i||i.layerCount===0){this.material.uniforms.u_layerClipperRanges.value=[],this.material.uniforms.u_clipperMatricesInverse.value=[],this.updateClipperCounts(0,0);return}let a=new Map;for(let t of e)a.has(t.gsViewLayerKey)||a.set(t.gsViewLayerKey,t.gsClippers);let o=i.layerKeys.length,s=0;for(let e of i.layerKeys)s+=((n=a.get(e))==null?[]:n).length;let c=Array.from({length:o},()=>new t.Vector2(-1,0)),l=Array.from({length:s},()=>new t.Matrix4),u=0;for(let e of i.layerKeys){let t=i.layerKeyToIndex.get(e);if(t===void 0)continue;let n=(r=a.get(e))==null?[]:r,o=u;for(let e of n)l[u].getInverse(e.clippingBoxMatrix),u++;n.length>0&&c[t].set(o,n.length)}this.material.uniforms.u_layerClipperRanges.value=c,this.material.uniforms.u_clipperMatricesInverse.value=l,this.updateClipperCounts(o,u)}updateClipperCounts(e,t){let n=this.material.defines;(n.NUM_GS_LAYERS!==e||n.NUM_GS_CLIPPERS!==t)&&(n.NUM_GS_LAYERS=e,n.NUM_GS_CLIPPERS=t,this.material.needsUpdate=!0),this.material.uniforms.u_numGsLayers.value=e,this.material.uniforms.u_numGsClippers.value=t}updateInitAnimationDefine(e){let t=this.material.defines,n=+!!e;t.ENABLE_GS_INIT_ANIMATION!==n&&(t.ENABLE_GS_INIT_ANIMATION=n,this.material.needsUpdate=!0,this.needsRender=!0)}dispose(){this.sortWorker&&(this.sortWorker.terminate(),this.sortWorker=null),this.assembler&&(this.assembler.dispose(),this.assembler=null),this.reorderPass&&(this.reorderPass.dispose(),this.reorderPass=null),this.orderTarget&&(this.orderTarget.dispose(),this.orderTarget=null),this.transformStore&&(this.transformStore.dispose(),this.transformStore=null),this.shStore&&(this.shStore.dispose(),this.shStore=null),this.layerRegistry=null,this.orderTexture&&(this.orderTexture.dispose(),this.orderTexture=null),this.geometry.dispose(),this.material.dispose()}},Nb=class extends t.Mesh{constructor(){super(),this.onBeforeRender=(e,t,n)=>{this.collectObjects(t).length>0&&console.warn(`未开启webgl2, 3dgs仅支持在开启webgl2模式后使用`)}}collectObjects(t){let n=[];return t.traverse(t=>{t instanceof e.t&&t.visible&&n.push(t)}),n}},Pb=1e3,Fb=90,Ib=e=>e.replace(`//vrlab-public.ljcdn.com/`,`//vr-public.realsee-cdn.cn/`).replace(`//vrlab-image4.ljcdn.com/`,`//vr-image-4.realsee-cdn.cn/`).replace(`//vrlab-image3.ljcdn.com/`,`//vr-image-3.realsee-cdn.cn/`).replace(`//vrlab-image2.ljcdn.com/`,`//vr-image-2.realsee-cdn.cn/`).replace(`//vrlab-image1.ljcdn.com/`,`//vr-image-1.realsee-cdn.cn/`),Lb=new t.Sphere,Rb=new t.Box3,zb=new t.Vector4,Bb=new t.Vector4,Vb=new t.Color,Hb=new t.Vector2,Ub=new WeakMap,Wb=wm([xm(null)]),Gb={},Kb=class e extends nn{static get version(){return`6.9.0-alpha.2`}static get dracoPath(){return co.decoderPath}static set dracoPath(e){co.setDecoderPath(e)}static get ktx2Path(){return _o.transcoderPath}static set ktx2Path(e){_o.setTranscoderPath(e)}static get useNativeImageBitmap(){return ii()}static set useNativeImageBitmap(e){ri(e)}constructor(e={}){var n,r,i,a,o,s,c,l,u,d,f;if(super(),this.pbmGaussianSplattingRenderMesh=null,this.fiveId=Zt(),Gb[this.fiveId]=this,this.currentUpdateArgs={time:V(),args:[]},this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.needsRender=!1,this.onlyRenderIfNeeds=(n=e.onlyRenderIfNeeds)==null?!0:n,this.imageOptions=Object.assign({},(r=e.imageOptions)==null?{}:r),this.textureOptions=Object.assign({},(i=e.textureOptions)==null?{}:i),this.poweredByRealsee=(a=e.poweredByRealsee)==null?!0:a,this.backgroundColor=new t.Color((o=e.backgroundColor)==null?1579548:o),this.backgroundAlpha=(s=e.backgroundAlpha)==null?1:s,this.extraElements=[],this.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},this.fps={testCount:0,testTime:V()},this.modeChangeDuration=(c=e.modeChangeDuration)==null?Pb:c,this.enableWheel=(l=e.enableWheel)==null?!0:l,typeof window<`u`)if(`renderer`in e)e.renderer instanceof Uh&&this.throwError(Error(`cannot render a internal renderer`)),this.renderer=e.renderer;else try{this.renderer=new Uh({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});let t=Ky();this.renderer.setPixelRatio(t===1?window.devicePixelRatio:1),this.renderer.setSize(512,512),this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha)}catch(e){let t=e instanceof Error?e:Error(String(e));this.throwError(t)}this.getPixelsRenderTarget=new t.WebGLRenderTarget(1,1,{encoding:(d=(u=this.renderer)==null?void 0:u.outputEncoding)==null?t.sRGBEncoding:d,generateMipmaps:!1}),this.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),this.camera=new Yt(Fb),this.scene=new Xh,this.xrCustomObjectsScene=new t.Scene,this.scene.add(this.xrCustomObjectsScene),this.scene.matrixAutoUpdate=!1,this.loadWorkTask=Promise.resolve(),this.requestProxy=(f=e.requestProxy)==null?Ib:f,this.networkSubscribe=new ir,this.networkSubscribe.on(`network`,(e,t,n,r)=>{var i;this.emit(`network.resource`,Q(`network.resource`,{source:e,requestType:t,requestState:n,detail:r})),(i=this.analysis)==null||i.network(this.works,e,t,n,r)}),this.readyCallbacks=[],this.syncingState=!1,this.helperGroup=new t.Group,this.helperGroup.name=`helper`,this.helperGroup.matrixAutoUpdate=!1,this.scene.add(this.helperGroup),Ub.set(this,Wb),this.modelScene=new xp({fiveId:this.fiveId}),this.modelScene.addEventListener(`model.create`,e=>{this.bindModel(e.model)}),this.scene.add(this.modelScene);let[p]=this.modelScene.setModels(Wb,{forceReplaceImmediately:!0});B(p,`loaded`,{get(){return!1},set(e){}}),this.videoTexture=new t.VideoTexture(e.videoInstance||Uy());let m=Wy();this.scene.add(m),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.stateSynced=!1,this.destroyed=!1,this.paused=!0,typeof window<`u`&&(e.play!==!1&&this.play(),this.stopAnimationLoop=ei.shared.add((e,t,...n)=>{this.updateTime(e,t,...n)},!1,0,10));let h=()=>{typeof document<`u`&&document.fullscreenElement===null&&this.currentMode===`VRPanorama`&&this.controller.emit(`vr.requestExit`,Q(`vr.requestExit`,{}))},g=()=>{this.needsRender=!0};if(typeof document<`u`&&document.addEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.addEventListener(`webglcontextrestored`,g,!1),this.removeEventListeners=()=>{typeof document<`u`&&document.removeEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.removeEventListener(`webglcontextrestored`,g,!1)},this.plugins={},e.plugins&&e.plugins.length){for(let t of e.plugins)if(typeof t==`function`)t(this);else if(Array.isArray(t)){let[e,n,r]=t;if(typeof e==`function`){let t=e(this,r);typeof n==`string`&&(this.plugins[n]?this.throwError(Error(`plugin name ${n} is exists.`)):this.plugins[n]=t)}}}Hy(this),this.fiveRenderer=new Hh,this.adaptiveLuminancePass=new Ym,this.adaptiveLuminancePass.enabled=!1,this.fiveRenderer.composer.addPass(this.adaptiveLuminancePass),this.eyeDomeLightingPass=new Qm(this.camera),this.eyeDomeLightingPass.enabled=!1,this.fiveRenderer.composer.addPass(this.eyeDomeLightingPass),e.webgl2?(this.pbmGaussianSplattingRenderMesh=new Mb,this.scene.add(this.pbmGaussianSplattingRenderMesh)):this.scene.add(new Nb)}get ident(){return this.fiveId}get panoIndex(){return this.pano.panoIndex}get panoId(){return Z(this.pano)}dispose(){var e;if(this.destroyed===!0)return;delete Gb[this.fiveId],this.emit(`dispose`),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);let n=this.getElement();n&&n.parentNode&&n.parentNode.removeChild(n);let r=this.modelScene.parameter;r.pano0&&r.pano0.map.dispose(),r.pano1&&r.pano1.map!==((e=r.pano0)==null?void 0:e.map)&&r.pano1.map.dispose(),r.reset(`pano0`,`pano1`),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),Ub.set(this,Wb),this.renderer&&this.renderer.render(new t.Scene,new t.Camera),this.fiveRenderer.dispose(),this.renderer instanceof Uh&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}setViewport(e){Object.assign(this.viewport,e),this.needsRender=!0}get boundingMesh(){return this.modelScene.boundingMesh}get helperVisible(){return this.helperGroup.visible}set helperVisible(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit(`helpers.visible`,Q(`helpers.visible`,{object:this.helperGroup})),this.needsRender=!0)}updateConfiguration(e,t=!0){let n=!1,r=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,pr(e.panorama)),this.currentMode===`Panorama`&&(n=!0)),e.model&&(Object.assign(this.controllerInits.Model,pr(e.model)),this.currentMode===`Model`&&(n=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,pr(e.floorplan)),this.currentMode===`Floorplan`&&(n=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,pr(e.topview)),this.currentMode===`Topview`&&(n=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,pr(e.mapview)),this.currentMode===`Mapview`&&(n=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,pr(e.vrPanorama)),this.currentMode===`VRPanorama`&&(n=!0)),e.xrPanorama&&(Object.assign(this.controllerInits.XRPanorama,pr(e.xrPanorama)),this.currentMode===`XRPanorama`&&(n=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode===`Panorama`||this.currentMode===`VRPanorama`)&&(r=!0,n=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),t&&n&&this.controller&&this.currentMode&&(!this.controller.updateConfiguration(this.controllerInits[this.currentMode])||r)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}appendTo(e,t={}){if(!this.renderer)return;if(!(this.renderer instanceof Uh)){this.throwError(Error(`cannot call appendTo method when render a external renderer`));return}let n=this.getElement();if(!n)return;e.appendChild(n),this.refresh(t);let r=window.getComputedStyle(e).position;r!==`relative`&&r!==`absolute`&&r!==`fixed`&&r!==`sticky`&&(e.style.position=`relative`)}refresh(e={},t){var n,r,i;if(!this.renderer)return;let a=this.renderer.domElement.parentNode,{width:o=(n=a==null?void 0:a.offsetWidth)==null?512:n,height:s=(r=a==null?void 0:a.offsetHeight)==null?512:r}=e;if(o=Math.max(1,o),s=Math.max(1,s),!t){let e=Ky(),n=typeof window<`u`?window.devicePixelRatio:1;if(t=(i=e===1?n:1)==null?1:i,t>1){let e=Math.max(o,s)*t,n=Math.min(this.renderer.capabilities.maxTextureSize,4096);e>n&&(t=Math.max(t/e*n,1),t=Math.floor(t*100)/100)}}this.renderer.setPixelRatio(t),this.renderer.setSize(o,s),this.needsRender=!0;let c=V(),l=c-this.currentUpdateArgs.time,u=this.currentUpdateArgs.args;this.updateTime(c,l,...u)}addExtraElement(e){return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),()=>this.removeExtraElement(e)}removeExtraElement(e){let t=this.extraElements.indexOf(e);t!==-1&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))}getSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}getDrawingBufferSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}updateCamera(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCamera(e,t,n)}updateCameraWithKeyframes(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCameraWithKeyframes(e,t,n)}get works(){return Ub.get(this)||Wb}get work(){return this.works[0]}get observers(){return this.work.observers}get models(){return this.modelScene.models}get model(){return this.modelScene.models[0]}load(e,t,n,r=!0){if(!this.renderer)throw Error(`renderer is not initialized`);let i=this.loadWorkTask.then(()=>gg(e)?e.then(e=>this.load_(e,t,n,r)):this.load_(e,t,n,r));return this.loadWorkTask=i.catch(e=>{this.throwError(e)}),i}load_(n,r,i,a=!0){var o,s,c,l,u,d,f,p,m,h;let g={};typeof i==`number`?g.duration=i:typeof i==`object`&&Object.assign(g,i),this.works===Wb&&(g.duration===void 0&&(g.duration=0),g.effect===void 0&&(g.effect=`instant`));let _={};Object.assign(_,g.model),!_[`3d-tiles`]&&g[`3d-tiles`]&&(_[`3d-tiles`]=g[`3d-tiles`]),!_.textureOptions&&g.textureOptions&&(_.textureOptions=g.textureOptions),!_.textureOptions&&this.textureOptions&&(_.textureOptions=this.textureOptions);let v=[];if(Array.isArray(n))for(let e of n)e instanceof bm?v.push(e):typeof e!=`string`&&`work`in e?v.push(xm(e.work,e)):v.push(xm(e));else n instanceof bm?v.push(n):v.push(xm(n));g.mode===`add`&&(v=[].concat(this.works,v));let y;try{y=wm(v)}catch(e){return this.throwError(e),Promise.reject(e)}for(let e of y)this.bindWorkFetcher(e);r===void 0&&(r=`inherit`),r===`inherit`&&this.works===Wb&&(r=`initial`);let b=this.currentMode,x=y.initial,S=x.work.observers[0],C=S?{workCode:S.work.workCode,panoIndex:S.panoIndex}:{workCode:x.work.workCode,panoIndex:0},w=(o=x.mode)==null?S?`Panorama`:`Mapview`:o,T={};if(r===`inherit`){let e=this.getCurrentState(),[t]=y.filter(t=>t.workCode===e.workCode);if(t)C={workCode:e.workCode,panoIndex:e.panoIndex},w=e.mode,T={longitude:e.latitude,latitude:e.latitude,fov:e.fov,distance:e.distance,offset:e.offset.clone()};else{r={mode:b};let e=(c=(s=y[0])==null?void 0:s.observers)==null?void 0:c[this.panoIndex];e?(r.workCode=e.work.workCode,r.panoIndex=e.panoIndex):typeof y.initial.panoIndex==`number`?(r.workCode=y.initial.work.workCode,r.panoIndex=y.initial.panoIndex):(r.mode===`Panorama`||r.mode===`VRPanorama`||r.mode===`XRPanorama`)&&(r.mode=`Mapview`),r.mode===b&&(r.longitude=this.camera.pose.longitude,r.latitude=this.camera.pose.latitude,r.fov=this.camera.pose.fov)}}if(r===`initial`&&(typeof x.panoIndex==`number`&&(C={workCode:x.work.workCode,panoIndex:x.panoIndex}),x.mode&&(w=x.mode),T={longitude:x.longitude,latitude:x.latitude,fov:x.fov,distance:x.distance,offset:(l=x.offset)==null?void 0:l.clone()}),typeof r==`object`){if(w=(u=r.mode)==null?b:u,typeof r.panoIndex==`number`){let e=y.getObserver({workCode:(f=(d=r.workCode)==null?x.work.workCode:d)==null?``:f,panoIndex:r.panoIndex});e&&(C={workCode:e.work.workCode,panoIndex:e.panoIndex})}T={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset?new t.Vector3().copy(r.offset):void 0}}let E=(p=g.duration)==null?this.modeChangeDuration:p;(w===`Floorplan`||w===`Topview`||w===`Mapview`)&&b===w&&(E=0);let D=`fly`;(w===`Panorama`||w===`VRPanorama`||w===`XRPanorama`)&&b===w&&(D=(m=g.effect)==null?`fade`:m),this.emit(`works.request`,Q(`works.request`,{input:n,works:y,userAction:a}));let O=(e,t,n)=>{let i=this.getCurrentState(),o=Object.assign(Object.assign({mode:e},t),n);r===`inherit`&&(o=this.getCurrentState()),this.pano=t;let s=Object.assign(Object.assign({initial:{state:o,currentState:i,duration:E,effect:D,userAction:a}},this.commonParams()),this.controllerInits[e]),c=zy[o.mode].initAnimationEndState(s);if(this.controller&&b===e)this.controller.updateWork(y,c,{effect:D,duration:E},a)===!1&&(this.controller.destroy(),this.controller=this.applyController(e,s));else{if(this.controller)this.controller.destroy();else{let t=zy[e].initAnimationEndState(s);this.camera.setFromPose(t),this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:a}))}this.controller=this.applyController(e,s);let t=Q(`mode.change`,{prevMode:b,mode:e,state:c,userAction:a});try{this.emit(`mode.change`,t)}catch(e){console.error(e)}}this.updateTime(this.currentUpdateArgs.time,0,...this.currentUpdateArgs.args)};Ub.set(this,y);let k=Promise.resolve();if(w===e.Mode.Floorplan||w===e.Mode.Topview||w===e.Mode.Mapview||w===e.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(T),Dg(this.state,this.camera.pose));let e=this.modelScene.setModels(y,_);k=Promise.all(e.map(e=>e.loadedReady)).then(()=>{this.needsRender=!0,O(w,C,T),this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:a}))})}else{O(w,C,T);let e=this.controller,t=!1;this.modelScene.autoRefine=!1;let n=()=>{this.works===y&&t===!1&&(this.needsRender=!0,this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:a})),t=!0,this.modelScene.autoRefine=!0),e.off(`pano.arrived`,n),e.off(`pano.cancel`,n)},r=this.modelScene.setModels(y,_);k=Promise.all(r.map(e=>e.initReady)).then(G),e.once(`pano.arrived`,n),e.once(`pano.cancel`,n),setTimeout(n,((h=g.duration)==null?this.modeChangeDuration:h)+1e3)}return this.emit(`works.load`,Q(`works.load`,{input:n,userAction:a,works:y})),k.then(()=>this.ready()).then(()=>{var e;this.emit(`works.ready`,Q(`works.ready`,{input:n,userAction:a,works:y})),(e=this.analysis)==null||e.work(y)})}reset(){let e=this.loadWorkTask.then(()=>this.reset_());return this.loadWorkTask=e.catch(e=>{this.throwError(e)}),e}reset_(){return new Promise(e=>{var n;this.controller&&(this.controller.destroy(),this.controller=void 0);let r=this.modelScene.parameter;r.pano0&&r.pano0.map.dispose(),r.pano1&&r.pano1.map!==((n=r.pano0)==null?void 0:n.map)&&r.pano1.map.dispose(),r.set({pano0:null,pano1:null,modelAlpha:1}),Ub.set(this,Wb),this.modelScene.setModels(Wb,{forceReplaceImmediately:!0}),this.renderer&&this.modelScene.update(this.renderer,this.camera),this.needsRender=!0,this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.camera.setFromPose({distance:0,fov:Fb,longitude:0,latitude:0,offset:new t.Vector3(0,0,0)}),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.camera.needsRender=!1,this.needsRender=!1,e()})}changeMode(t,n={},r,i=!0,a=!1){return new Promise((o,s)=>{var c,l,u,d;if(!this.renderer)throw Error(`renderer is not initialized.`);n=Object.assign({},n);let f=0;this.controller&&(f=typeof r==`number`?r:(c=r==null?void 0:r.duration)==null?this.modeChangeDuration:c);let p=`fly`;this.controller&&typeof r==`object`&&r.effect&&(p=r.effect);let m=typeof n.panoIndex==`number`?{workCode:(d=(l=n.workCode)==null?(u=this.work)==null?void 0:u.workCode:l)==null?``:d,panoIndex:n.panoIndex}:this.pano;if(!e.Mode.hasOwnProperty(t)){let e=Error(`mode "${t}" is not existed`);this.throwError(e),s(e);return}if((t===e.Mode.Panorama||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama)&&!this.works.getObserver(m)){let e=Error(`PanoId ${Z(m)} not existed.`);this.throwError(e),s(e);return}(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)&&this.modelScene.empty&&(f=0);let h=this.controller,g=this.currentMode,_=()=>{if(this.controller&&this.controller.stopMomentumMovement(),this.controller&&a===!1&&g===t)t===e.Mode.Panorama||t===e.Mode.Model||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama?!zp(this.pano,m)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`?this.controller.moveToPano(m,Object.assign({duration:f},n),i):this.controller.updateCamera(n,f,i).catch(G):(zp(this.pano,m)||(this.pano=m),this.controller.updateCamera(n,f,i).catch(G));else{let e=Object.assign(Object.assign({},n),m),r=Object.assign(Object.assign({initial:{state:e,currentState:this.getCurrentState(),duration:f,effect:p,userAction:i}},this.commonParams()),this.controllerInits[t]),a=zy[t].initAnimationEndState(r),o=Q(`mode.change.request`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});if(this.emit(`mode.change.request`,o),!o.defaultPrevented){h&&h.destroy(),this.controller=this.applyController(t,r);let e=Q(`mode.change`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});this.emit(`mode.change`,e)}}o()},v=ei.shared.getContext();v&&(typeof XRSession<`u`&&v instanceof XRSession&&v.end(),ei.shared.setContext(null)),t===e.Mode.VRPanorama?(this.requestFullscreen(),Cg().then(()=>_()).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.exitFullscreen(),this.throwError(t),s(t)})):t===e.Mode.XRPanorama?wg().then(e=>{ei.shared.setContext(e),a=!0,_()}).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.throwError(t),s(t)}):_()})}getPixels(e,n,r,i,a,o,s){if(!this.renderer)throw Error(`renderer is not initialized.`);let c=V(),l=this.renderer.getPixelRatio(),u=this.renderer.getRenderTarget(),d=this.getSize(new t.Vector2),f=0,p=0,m=1,h=1,g,_,v,y,b;typeof e==`number`?(f=e,typeof n==`number`&&(p=n),typeof r==`number`&&(m=r),typeof i==`number`&&(h=i),g=a,_=o,b=s):(f=e.x,p=e.y,m=e.width,h=e.height,g=e.pixelRatio,_=e.flipY,v=e.helperVisible,y=e.skipPanorama,b=e.buffer),f=Math.floor(f),p=Math.floor(p),m=Math.floor(m),h=Math.floor(h),g=Math.floor(g==null?l:g),_=_==null?!1:_;let x=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=v==null?this.helperVisible:v,y&&(this.controller instanceof zy.Panorama||this.controller instanceof zy.VRPanorama||this.controller instanceof zy.XRPanorama)&&y===!0&&this.modelScene.parameter.set(`modelAlpha`,1),this.modelScene.update(this.renderer,this.camera);let C=this.getPixelsRenderTarget;C.setSize(m*g,h*g),this.renderer.setRenderTarget(C),this.camera.pixelRatio=g,this.camera.resolution.set(m,h),this.camera.setViewOffset(d.width,d.height,f,d.height-p-h,m,h),this.camera.aspect=d.width/d.height,this.camera.updateTime(c),this.scene.update(this.renderer,this.camera);let w=this.renderer.autoClear,T=this.renderer.autoClearColor,E=this.renderer.autoClearDepth,D=this.renderer.autoClearStencil,O=Vb.copy(this.renderer.getClearColor()),k=this.renderer.getClearAlpha(),A=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);let j=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:j,this.renderer.render(this.scene,this.camera),this.scene.background=j,this.renderer.autoClear=w,this.renderer.autoClearColor=T,this.renderer.autoClearDepth=E,this.renderer.autoClearStencil=D,this.renderer.setClearColor(O,k),this.renderer.setScissorTest(A),this.helperVisible=x,S===void 0?this.modelScene.parameter.reset(`modelAlpha`):this.modelScene.parameter.set(`modelAlpha`,S),this.renderer.setRenderTarget(u),this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.camera.resolution.copy(d),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(c),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);let M=m*g,N=h*g,ee=M*N,te=ee*4;if(b){if(b.length!==te)throw Error(`buffer length is not equals pixels ${te}`)}else b=new Uint8Array(te);if(this.renderer.readRenderTargetPixels(C,0,0,m*g,h*g,b),_){let e=ee/2;for(let t=0,n=0,r=0,i=0;n<e;n++)for(i=(N-Math.floor(n/M)-1)*M+n%M,r=0;r<4;r++)t=b[n*4+r],b[n*4+r]=b[i*4+r],b[i*4+r]=t}return b}getElement(){var e;return(e=this.renderer)==null?void 0:e.domElement}render(e){let t=this.renderer;if(!t)return;let n=t.getRenderTarget();t.setRenderTarget(null);let r=t.autoClear,i=t.autoClearColor,a=t.autoClearDepth,o=t.autoClearStencil,s=Vb.copy(t.getClearColor()),c=t.getClearAlpha(),l=t.getViewport(zb),u=t.getScissor(Bb),d=t.getScissorTest();t.autoClear=!0,t.autoClearColor=!0,t.autoClearDepth=!0,t.autoClearStencil=!0;let f=t.getSize(Hb),p=Math.floor(f.x*this.viewport.left),m=Math.floor(f.y*this.viewport.bottom),h=Math.floor(f.x*this.viewport.width),g=Math.floor(f.y*this.viewport.height);t.setClearColor(this.backgroundColor,this.backgroundAlpha),t.setViewport(p,m,h,g),t.setScissor(p,m,h,g);let _=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;t.setScissorTest(_);let v=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:v;let y=!0;if(this.controller&&this.controller.render()&&(y=!1),y){let e=this.fiveRenderer.render(t,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&e&&ob(t)}this.scene.background=v,t.autoClear=r,t.autoClearColor=i,t.autoClearDepth=a,t.autoClearStencil=o,t.setClearColor(s,c),t.setViewport(l),t.setScissor(u),t.setScissorTest(d),t.setRenderTarget(n),e&&ei.shared.add(e,!0)}updateTime(e,t,...n){if(this.currentUpdateArgs={time:e,args:n},this.destroyed)return;if(this.renderer&&_o.detectSupport(this.renderer),this.syncingState=this.syncState(e,t),this.controller&&this.controller.updateTime(e,t,...n),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){let e=this.modelScene.loaded,t=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),e===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),ei.shared.add(()=>{this.emit(`models.load`,Q(`models.load`,{modelScene:this.modelScene}))},!0,0,10)),t===!1&&this.modelScene.refined===!0&&ei.shared.add(()=>{this.emit(`models.refined`,Q(`models.refined`,{modelScene:this.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){Rb.makeEmpty(),Rb.expandByObject(this.modelScene.boundingMesh);let t=Rb.getBoundingSphere(Lb),n=t.radius*2;t.containsPoint(this.camera.position)||(n=this.camera.position.distanceTo(t.center)+t.radius),n=H(n,800);let r=n/1e4;r=H(r,.03,.1),this.camera.near!==r&&(this.camera.near=r),this.camera.far!==n&&(this.camera.far=n),this.camera.updateTime(e)}if(this.renderer){let e=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=e}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.pbmGaussianSplattingRenderMesh&&this.pbmGaussianSplattingRenderMesh.needsRender===!0&&(this.pbmGaussianSplattingRenderMesh.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused===!0)return;let r=Q(`render.prepare`,{needsRender:this.needsRender});this.emit(`render.prepare`,r),r.defaultPrevented&&(this.needsRender=!1);let i=this.needsRender;this.render(),this.needsRender=!1,this.emit(`render`,Q(`render`,{needsRender:i})),this.hasListener(`fps`)&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit(`fps`,this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}pause(){this.paused=!0,this.renderer&&this.renderer instanceof Uh&&this.renderer.clear(!0,!0,!0)}play(){this.needsRender=!0,this.paused=!1}moveToPano(t,n={},r=!0){let{controller:i,renderer:a}=this;if(!i)return this.throwError(Error(`controller is not initialized.`)),Promise.resolve();if(!a)return this.throwError(Error(`renderer is not initialized.`)),Promise.resolve();typeof t==`number`&&this.pano.workCode&&(t={workCode:this.pano.workCode,panoIndex:t});let o=this.works.getObserver(t);if(!o)return this.throwError(Error(`pano ${JSON.stringify(t)} not existed.`)),Promise.resolve();let s={workCode:o.work.workCode,panoIndex:o.panoIndex};return`moveToPano`in i&&typeof i.moveToPano==`function`?i.moveToPano(s,n,r):o&&(this.pano=s,this.once(`initAnimation.start`,e=>{n.moveStartCallback&&n.moveStartCallback(e.state)}),this.once(`initAnimation.end`,e=>{n.moveEndCallback&&n.moveEndCallback(e.state)}),this.changeMode(e.Mode.Panorama,n,{effect:n.effect},r)),this.ready()}preloadPano(e,t=G){let n=this.works.getObserver(e);if(!n)return Promise.reject(Error(`Pano ${JSON.stringify(e)} never found`));let r=[`right`,`left`,`up`,`down`,`front`,`back`],i=V();return Promise.all(r.map(e=>{let t=Z({panoIndex:n.panoIndex,workCode:n.work.workCode}),r=Object.assign({key:`pano.${t}.${e}`},dr(this.imageOptions,[`size`,`format`,`quality`,`forceUseExifOrientation`,`mappings`])),i=n.work.getURL(n.images[e]),a=this.imageOptions.transform?this.imageOptions.transform(i,r):Ur(i,r);return Gf(this.fiveId,n.work).preload(a)})).then(()=>{let e=V()-i;return t(e),e})}project2d(e,n=!1){if(!this.renderer)return null;if(n){let n=this.camera.position,r=e.clone().sub(n),i=new t.Raycaster(n,r.clone().normalize());i.params.Points={threshold:.1};let[a]=this.modelScene.intersectRaycaster(i);if(a&&a.distance+.01<r.length())return null}let r=e.clone().project(this.camera);if(Math.abs(r.z)>1)return null;let i=this.renderer.getSize(new t.Vector2),a=i.x*this.viewport.width,o=i.y*this.viewport.height,s=i.x*this.viewport.left+(r.x+1)/2*a,c=i.y*(1-this.viewport.bottom-this.viewport.height)+(-r.y+1)/2*o;return new t.Vector2(s,c)}getCurrentState(){return Object.assign(Object.assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})}setState(e,n=!1,r=!0){var i,a,o,s,c,l,u,d,f,p;e=dr(e,[`mode`,`workCode`,`panoIndex`,`longitude`,`latitude`,`fov`,`offset`,`distance`]),e.offset&&!(e instanceof t.Vector3)&&(e.offset=new t.Vector3(e.offset.x,e.offset.y,e.offset.z));let m;if(typeof e.panoIndex==`number`)if(e.workCode)m={workCode:e.workCode,panoIndex:e.panoIndex};else{let t=(a=(i=this.work)==null?void 0:i.workCode)==null?``:a,n=this.state.workCode;this.works.filter(e=>e.workCode===n).length>0&&(t=n),m={workCode:t,panoIndex:e.panoIndex}}let h=(o=e.mode)==null?this.state.mode:o,g,_,v,y,b;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==h){if(h===`VRPanorama`){this.changeMode(`VRPanorama`,void 0,void 0,!0);return}let n={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude==`number`&&(n.longitude=e.longitude),typeof e.latitude==`number`&&(n.latitude=e.latitude),typeof e.fov==`number`&&(n.fov=e.fov),typeof e.distance==`number`&&(n.distance=e.distance),e.offset instanceof t.Vector3&&(n.offset=e.offset);let r=Object.assign(Object.assign({initial:{state:n,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:`fly`,userAction:!1}},this.commonParams()),this.controllerInits[h]),i=zy[h].initAnimationEndState(r);g=i.longitude,_=i.latitude,v=i.fov,y=i.offset,b=i.distance}else g=(s=e.longitude)==null?this.state.longitude:s,_=(c=e.latitude)==null?this.state.latitude:c,v=(l=e.fov)==null?this.state.fov:l,y=(u=e.offset)==null?this.state.offset:u,b=(d=e.distance)==null?this.state.distance:d;let x={workCode:(m==null?this.pano:m).workCode,panoIndex:(m==null?this.pano:m).panoIndex,mode:h,longitude:g,latitude:_,fov:v,offset:y,distance:b};this.emit(`state.set`,Q(`state.set`,{userAction:r,state:x})),Eg(this.state,x)||(this.controller&&x.mode===`VRPanorama`&&x.mode!==this.state.mode?(Tg(this.state,x),this.changeMode(`VRPanorama`)):this.controller&&x.mode===`XRPanorama`&&x.mode!==this.state.mode?(Tg(this.state,x),this.changeMode(`XRPanorama`)):(Tg(this.state,x),this.controller&&r&&(this.controller.userAction=!1),n&&this.state.mode===x.mode&&(this.syncingState=this.syncState(V(),0,n),this.syncingState&&((f=this.controller)==null||f.updateTime(V(),0),this.syncingState=!1)),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(p=this.analysis)==null||p.state(this.works,this.state)))}syncState(n,r,i=!1){let a=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){let e={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,e,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof zy.Model){if(hg(this.camera.pose.offset,this.state.offset)){let e={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,Object.assign(Object.assign({},e),{duration:i?0:void 0}),!1),!0}}else{let e={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!zp(e,this.pano)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`){let t={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(e,t,!1),!0}}if(this.controller instanceof zy.Floorplan||this.controller instanceof zy.Topview||this.controller instanceof zy.Mapview){let e=.2,n=Math.PI/45,r=i?this.state.fov:Hm(this.camera.pose.fov,this.state.fov,1),a=Math.abs(this.camera.pose.distance-this.state.distance),o=a>e*15?a/15:.2,s=i?this.state.distance:Hm(this.camera.pose.distance,this.state.distance,o),c=this.camera.pose.offset.distanceTo(this.state.offset),l=c>e*15?c/15:e,u=i?new t.Vector3().copy(this.state.offset):Um(this.camera.pose.offset,this.state.offset,l),{longitude:d,latitude:f}=i?{longitude:this.state.longitude,latitude:this.state.latitude}:Wm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},n);if(pg(r,this.camera.pose.fov)||hg(u,this.camera.pose.offset)||pg(s,this.camera.pose.distance)||pg(d,this.camera.pose.longitude,Math.PI*2)||pg(f,this.camera.pose.latitude)){let e={x:u.x,y:u.y,z:u.z},t={fov:r};return Object.assign(e,{distance:s}),Object.assign(t,{longitude:d,latitude:f}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(t,0).catch(G),this.controller.locationMotion.set(e,0).catch(G),!0}}else{let e=Math.PI/45,n=i?this.state.fov:Hm(this.camera.pose.fov,this.state.fov,1),{longitude:r,latitude:a}=i?{longitude:this.state.longitude,latitude:this.state.latitude}:Wm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},e),o=this.state.distance,s=new t.Vector3().copy(this.state.offset);if(pg(o,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),hg(s,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),pg(r,this.camera.pose.longitude,Math.PI*2)||pg(a,this.camera.pose.latitude)||pg(n,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:r,latitude:a,fov:n},0).catch(G),!0}if(this.stateSynced=!0,a===!1&&this.emit(`state.synced`,Q(`state.synced`,{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){let t=this.currentMode;if(!(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)||this.modelScene.loaded){let e=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(let t of e)this.controller instanceof zy.Panorama&&t.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(t):t()}}return!1}ready(e={}){return new Promise(t=>{var n;this.readyCallbacks.push(Object.assign(t,{tile:(n=e.tile)==null?!1:n}))}).then(()=>this.model.initReady).then(G)}requestFullscreen(){var e;if(!yg)return;let t=(e=this.getElement())==null?void 0:e.parentNode;t&&`requestFullscreen`in t&&typeof document<`u`&&document.fullscreenElement===null&&t.requestFullscreen()}exitFullscreen(){typeof document<`u`&&document.fullscreenElement&&`exitFullscreen`in document&&document.exitFullscreen()}throwError(e){this.hasListener(`error`)?this.emit(`error`,e):console.error(e)}bindModel(e){let t=()=>{ei.shared.add(()=>{this.emit(`model.load`,Q(`model.load`,{work:e.work,model:e,error:null}))},!0)},n=t=>{let{error:n}=t;this.emit(`model.error`,Q(`model.error`,{work:e.work,model:e,error:n})),this.throwError(n)},r=()=>{this.emit(`model.changeShownFloor`,Q(`model.changeShownFloor`,{work:e.work,model:e,error:null}))},i=t=>{this.emit(`models.tileLoad`,Q(`model.tileLoad`,{work:e.work,model:e,tile:t.tile}))},a=t=>{this.emit(`models.tileUnload`,Q(`model.tileUnload`,{work:e.work,model:e,tile:t.tile}))},o=()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),e.removeEventListener(`changeShownFloor`,r),e.removeEventListener(`tileLoad`,i),e.removeEventListener(`tileUnload`,a),e.removeEventListener(`dispose`,o)};e.addEventListener(`load`,t),e.addEventListener(`error`,n),e.addEventListener(`changeShownFloor`,r),e.addEventListener(`tileLoad`,i),e.addEventListener(`tileUnload`,a),e.addEventListener(`dispose`,o),this.emit(`model.request`,Q(`model.request`,{work:e.work,model:e,error:null}))}bindWorkFetcher(e){let t=this,n=e.workCode,r=e.allowHosts,i=new lr({get networkSubscribe(){return t.networkSubscribe},requestProxy(e){return Promise.resolve(e).then(e=>t.requestProxy(e,n)).then(e=>{let t=cm(e,r);return t instanceof Error?Promise.reject(t):t})}});Kf(this.fiveId,e,i)}commonParams(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}}applyController(t,n){if(!this.renderer)throw Error(`renderer is not initialized.`);let r=zy[t];this.currentMode=t;let i=new r(n);for(let e of Vy)i.on(e,(...t)=>{if(this.emit(e,...t))return!1});{let e=zy[t].initAnimationEndState(n),r=n.initial.userAction;Eg(this.state,e)||(Tg(this.state,e),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state}))),this.emit(`currentState.change`,Q(`currentState.change`,{userAction:r,state:this.getCurrentState()}))}return i.on(`camera.update`,e=>{var t;if(this.controller){let n=this.controller.getTargetState();e.userAction&&this.syncingState===!1&&this.state.mode===n.mode&&!Eg(this.state,n)&&(Tg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:e.userAction,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}this.emit(`currentState.change`,Q(`currentState.change`,{userAction:e.userAction,state:this.getCurrentState()}))}),i.on(`initAnimation.start`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!Eg(this.state,n)&&(Tg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`initAnimation.end`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Eg(this.state,n)&&(Tg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Eg(this.state,n)&&(Tg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.arrived`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Eg(this.state,n)&&(Tg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.cancel`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!Eg(this.state,n)&&(Tg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.error`,e=>{var t;let{state:n}=e;this.state.mode===n.mode&&!Eg(this.state,n)&&(Tg(this.state,n),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{let{userAction:t}=e;this.emit(`currentState.change`,Q(`currentState.change`,{userAction:t,state:this.getCurrentState()}))}),i.on(`pano.request`,e=>{this.emit(`pano.request`,e),e.defaultPrevented||this.moveToPano(e.state,e.options,e.userAction)}),i.on(`vr.requestExit`,()=>{this.currentMode===e.Mode.VRPanorama&&(this.exitFullscreen(),this.changeMode(e.Mode.Panorama))}),i.on(`error`,e=>this.throwError(e)),i}removeEventListeners(){}get internalLightsEnabled(){let e=this.scene.children.find(e=>e.name===`internalLights`);return e?e.visible:!1}set internalLightsEnabled(e){let t=this.scene.children.find(e=>e.name===`internalLights`);t&&(t.visible=e),t=this.modelScene.children.find(e=>e.name===`internalLights`),t&&(t.visible=e)}get scissor(){return this.viewport}setScissor(e){return this.setViewport(e)}getPose(){let{longitude:e,latitude:t,fov:n,offset:r,distance:i}=this.camera.copyPose();return{longitude:e,latitude:t,fov:n,offset:r.clone(),distance:i}}getLongitudeAndLatitude(){let{longitude:e,latitude:t}=this.getPose();return{longitude:e,latitude:t}}getOffset(){return this.getPose().offset}getCameraLocal(){if(this.pano.workCode&&this.controller&&this.works){let e=this.works.getObserver(this.pano);if(e){let n=new t.Object3D;n.matrix.copy(e.matrix).premultiply(e.work.transform),n.matrix.decompose(n.position,n.quaternion,n.scale),n.matrixAutoUpdate=!1;let r=new t.Vector3(0,0,-1);r.applyQuaternion(this.camera.quaternion);let i=n.quaternion.clone().inverse();return r.applyQuaternion(i),{theta:Math.atan2(r.x,-r.z),phi:-Math.asin(r.y),lookAtVector:r}}}return null}addPass(e){this.fiveRenderer.composer.addPass(e)}removePass(e){let t=this.fiveRenderer.composer.passes.indexOf(e);t!==-1&&this.fiveRenderer.composer.passes.splice(t,1)}insertPass(e,t){this.fiveRenderer.composer.insertPass(e,t)}get renderMode(){return this.fiveRenderer.renderMode}set renderMode(e){this.fiveRenderer.renderMode=e}get enableHQ(){return this.fiveRenderer.renderMode===`point-cloud-high-quality`}set enableHQ(e){this.fiveRenderer.renderMode=e?`point-cloud-high-quality`:`default`,this.needsRender=!0}get enableEDL(){return this.eyeDomeLightingPass.enabled}set enableEDL(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0}get enableAdaptiveLuminance(){return this.adaptiveLuminancePass.enabled}set enableAdaptiveLuminance(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0}get enableIOSEDR(){return!1}set enableIOSEDR(e){}get enablePostProcessing(){return!0}set enablePostProcessing(e){}get modelSceneNeedsRender(){return this.modelScene.needsRender}set modelSceneNeedsRender(e){this.modelScene.needsRender=e}};Kb.Mode={Panorama:`Panorama`,Model:`Model`,Floorplan:`Floorplan`,Topview:`Topview`,Mapview:`Mapview`,VRPanorama:`VRPanorama`,XRPanorama:`XRPanorama`},typeof window<`u`&&Object.assign(window,{__FIVE_DEBUG__:{THREE:t,constructor:Kb,instances:Gb}});var qb=class{static createButton(e){let t=document.createElement(`button`);function n(){t.style.display=``,t.style.cursor=`pointer`,t.style.left=`calc(50% - 50px)`,t.style.width=`100px`,t.textContent=`ENTER VR`,t.onmouseenter=function(){t.style.opacity=`1.0`},t.onmouseleave=function(){t.style.opacity=`0.5`},t.onclick=function(){e&&e()}}function r(){t.style.display=``,t.style.cursor=`auto`,t.style.left=`calc(50% - 75px)`,t.style.width=`150px`,t.onmouseenter=null,t.onmouseleave=null,t.onclick=null}function i(){r(),t.textContent=`VR NOT SUPPORTED`}function a(e){e.style.position=`absolute`,e.style.bottom=`20px`,e.style.padding=`12px 6px`,e.style.border=`1px solid #fff`,e.style.borderRadius=`4px`,e.style.background=`rgba(0,0,0,0.1)`,e.style.color=`#fff`,e.style.font=`normal 13px sans-serif`,e.style.textAlign=`center`,e.style.opacity=`0.5`,e.style.outline=`none`,e.style.zIndex=`999`}if(`xr`in navigator)return t.id=`VRButton`,t.style.display=`none`,a(t),navigator.xr.isSessionSupported(`immersive-vr`).then(function(e){e?n():i()}),t;{let e=document.createElement(`a`);return window.isSecureContext===!1?(e.href=document.location.href.replace(/^http:/,`https:`),e.innerHTML=`WEBXR NEEDS HTTPS`):(e.href=`https://immersiveweb.dev/`,e.innerHTML=`WEBXR NOT AVAILABLE`),e.style.left=`calc(50% - 90px)`,e.style.width=`180px`,e.style.textDecoration=`none`,a(e),e}}};exports.AdaptiveLuminancePass=Ym,exports.AnimationFrameLoop=ei,exports.BoundingMesh=yp,exports.Camera=Yt,exports.CustomShader=an,exports.PBMCustomShader=an,exports.EffectComposer=Tm,exports.EyeDomeLightingPass=Qm,exports.Fetcher=lr,exports.Five=Kb,exports.FivePass=Dm,exports.FiveRenderer=Hh,exports.FlowingFireworks3DPass=wh,exports.FlowingLight2DPass=lh,exports.FlowingLight3DPass=mh,exports.FullScreenQuad=Em,exports.GaussianBlurPass=th,exports.Histogram=zm,exports.InternalWebGLRenderer=Uh,exports.Model=up,exports.ModelScene=xp,exports.Motion=X,exports.NetworkSubscribe=ir,exports.PBMContainer=Wn,exports.PBMGSObject=e.t,exports.PBMGroup=vt,exports.PBMMesh=mn,exports.PBMMeshMaterial=pn,exports.PBMPanoFilter=on,exports.PBMPointCloud=wn,exports.PBMPointCloudMaterial=Cn,exports.PBMSkinnedMesh=hn,exports.PBMUpdateable=rn,exports.PROXY_CONTROLLER_EVENT_NAMES=Vy,exports.PanoCircleMesh=tg,exports.PanoCircleMeshCustom=dg,exports.PanoCircleMeshSolid=og,exports.Parameter=W,exports.Scene=Xh,exports.Subscribe=nn,exports.TextureLoader=fi,exports.Tile=gu,exports.Tile3D=Uf,exports.Tile3DModel=Uf,exports.TileCache=Hd,exports.TileNode=jd,exports.TileRequestScheduler=zd,exports.Tileset=Jd,exports.Trajectory=Fd,exports.TrajectoryNode=Id,exports.Work=bm,exports.WorkResolvedObserver=Cm,exports.XRButton=qb,exports.controllersDefaultInitArgs=By,exports.coordinatesToVector=It,exports.createDebugBoundingMesh=du,exports.createWorks=wm,exports.defaultImageURLTransform=Ur,exports.draco=co,exports.getViewportScale=Ky,exports.headingToLongitude=zt,exports.imageSupport=Er,exports.isBoundingVolume=ou,exports.isPanoId=Bp,exports.ktx2=_o,exports.loadAt3d=ca,exports.loadB3dm=Ws,exports.loadDome=fa,exports.loadDomez=ya,exports.loadFbx=al,exports.loadGltf=$s,exports.loadObj=Ji,exports.loadPbm=ki,exports.loadPly=tc,exports.loadPnts=Zs,exports.loadSpz=Is,exports.loadX3p=zl,exports.longitudeToHeading=Rt,exports.makeBoundingVolume=su,exports.panoEqual=zp,exports.panoParse=Rp,exports.panoStringify=Z,exports.parseWork=xm,exports.vectorToCoordinates=Lt,exports.workToJson=Ep;
|
|
2952
|
+
\\v j ¼"\\v \\vAsAÿÿÿÿ\\x07q \\vA\\0H\\x1B"\\v6\\0 \\b \\vAÿÿqAtj" (\\0Aj6\\0 \\vAvAüÿqj"\\v \\v(\\0Aj6\\0 \\fAj!\\f\\f\\v\\v\\v\\0\\v\\v \\0A\\b\\v\`)}function v(e){return e}function y(e,t){var n,r=v(e);return n=new WebAssembly.Module(r),[new WebAssembly.Instance(n,t),n]}function b(){return{a:F}}function x(){function e(e,t){return L=e.exports,P(L),f(),L}var t=b();return r.instantiateWasm?new Promise((n,i)=>{r.instantiateWasm(t,(t,r)=>{n(e(t,r))})}):(g!=null||(g=_()),e(y(g,t)[0]))}for(var S=e=>{for(;e.length>0;)e.shift()(r)},C=[],w=e=>C.push(e),T=[],E=e=>T.push(e),D=()=>2147483648,O=(e,t)=>Math.ceil(e/t)*t,k=e=>{var t=(e-N.buffer.byteLength+65535)/65536|0;try{return N.grow(t),f(),1}catch(e){}},A=e=>{var t=u.length;e>>>=0;var n=D();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),k(Math.min(n,O(Math.max(e,i),65536))))return!0}return!1},j=new Uint8Array(123),M=25;M>=0;--M)j[48+M]=52+M,j[65+M]=M,j[97+M]=26+M;if(j[43]=62,j[47]=63,r.noExitRuntime&&r.noExitRuntime,r.print&&r.print,r.printErr&&r.printErr,r.wasmBinary&&r.wasmBinary,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.preInit)for(typeof r.preInit==\`function\`&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.shift()();var N;function P(e){r._sort=e.d,r._malloc=e.e,r._free=e.f,N=e.b,e.__indirect_function_table}var F={a:A};function I(){p();function e(){var e;r.calledRun=!0,!s&&(m(),l==null||l(r),(e=r.onRuntimeInitialized)==null||e.call(r),h())}r.setStatus?(r.setStatus(\`Running...\`),setTimeout(()=>{setTimeout(()=>r.setStatus(\`\`),1),e()},1)):e()}var L=x();return I(),t=d?r:new Promise((e,t)=>{l=e}),t}),i.apply(this,arguments)}let a;function o(){return e(this,void 0,void 0,function*(){a=yield r()})}let s,c,l,u,d,f,p,m,h,g,_=0,v=0,y=!1,b=[],x=!0,S=!0,C=!1,w=!1,T=!1;function E(e,t){if(t.length!==16)return!0;for(let n=0;n<16;n++)if(Math.abs(e[n]-t[n])>1e-7)return!0;return!1}let D=[],O=65536,k=()=>e(void 0,void 0,void 0,function*(){if(C){w=!0;return}C=!0,w=!1,a||(yield o());let e=Math.pow(2,Math.ceil(Math.log2(s.vertexCount)));_<e&&(_>0&&(a._free(c),a._free(u),a._free(d),a._free(f),a._free(p),a._free(m)),_=e,c=a._malloc(64),u=a._malloc(_*4),d=a._malloc(3*_*4),f=a._malloc(_*4),p=a._malloc(_*4),m=a._malloc(_*4)),y||(h=a._malloc(O*4),g=a._malloc(O*4),y=!0),v<s.transforms.length&&(v>0&&a._free(l),v=s.transforms.length,l=a._malloc(v*4)),C=!1,w&&(w=!1,yield k())}),A=()=>{if(C||w||!a)return;C=!0,S&&(a.HEAPF32.set(s.positions,d/4),a.HEAPF32.set(s.transforms,l/4),a.HEAPU32.set(s.transformIndices,u/4),S=!1),a.HEAPF32.set(new Float32Array(b),c/4),a._sort(c,l,u,s.vertexCount,d,f,p,m,h,g);let e=s.vertexCount,t=new Uint32Array(a.HEAPU32.buffer,p,e),n=e*4,r=D.pop();(!r||r.byteLength<n)&&(r=new ArrayBuffer(n));let i=new Uint32Array(r,0,e);i.set(t),self.postMessage({depthIndex:i,generation:s.generation},[r]),C=!1,x=!1},j=()=>{T||(T=!0,x&&A(),setTimeout(()=>{T=!1,j()}))};self.onmessage=t=>new Promise(n=>e(void 0,void 0,void 0,function*(){var e;if(t.data.warmup){yield o(),n(!0);return}if(t.data.returnBuffer){D.length<3&&D.push(t.data.returnBuffer),n(!0);return}let r=!1,i=!!t.data.sortData;if(t.data.sortData&&(s={positions:t.data.sortData.positions,transforms:t.data.sortData.transforms,transformIndices:t.data.sortData.transformIndices,vertexCount:t.data.sortData.vertexCount,generation:(e=t.data.sortData.generation)==null?0:e},x=!0,S=!0,yield k(),r=!0),t.data.viewProj){let e=t.data.viewProj;(E(e,b)||i)&&(b=e,x=!0,r=!0)}r&&x&&j(),n(!0)}))})();`,Eb=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,Tb],{type:`text/javascript;charset=utf-8`});function Db(e){let t;try{if(t=Eb&&(self.URL||self.webkitURL).createObjectURL(Eb),!t)throw``;let n=new Worker(t,{name:e==null?void 0:e.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch(t){return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(Tb),{name:e==null?void 0:e.name})}}var Ob=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}("}rpvv|{-uvtu}-sy|nH}rpvv|{-uvtu}-v{H0vsqrs-b`Rl\\_QR_laReab_R{vs|z-uvtu}-nz}yr?Q-l|qrar\x07rH{vs|z-v{-l|qrdvquH{vs|z-v{-l{z]|v{H0ryrnvor-sy|n-}ynV{qr\x07H0r{qvs{vs|z-uvtu}-nz}yr?Q-lr\x07rH{vs|z-uvtu}-nz}yr?Q-ln{s|zH{vs|z-uvtu}-nz}yr?Q-luar\x07rH{vs|z-rp?-luar\x07r`v rH{vs|z-v{-lzn\x07`uQrtrrH0vs-[bZlT`lPYV]]R_`-K-=----{vs|z-rp?-lyn\brPyv}}r_n{trh[bZlT`lYNfR_`jH----{vs|z-znA-lpyv}}rZnvprV{rrh[bZlT`lPYV]]R_`jH0r{qvs{vs|z-rp?-r|yv|{H<<-每对象渲染参数,按-n{s|zV{qr\x07-索引(与-ln{s|z-同一套索引)<<-r\x07ry-=G-h}rOyNz|{9-oyNz|{9-rrrq9-rrrqj,单位为方差-}\x07²{vs|z-uvtu}-nz}yr?Q-l|owrp]nnzH0vs-R[NOYRlT`lV[ValN[VZNaV\\[{vs|z-sy|n-lnttrtnv|{]|trH{vs|z-sy|n-lnttrtnv|{]|v{Qnv|{H{vs|z-rp@-lnttrtnv|{O|{qZv{H{vs|z-rp@-lnttrtnv|{O|{qZn\x07H0r{qvsn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bHp|{-sy|n-zn\x07`prr{`}npr`}yn`v r-J-?=AE;=H<<-}npx-阶段(qnn;p}})把-@Q-协方差整体-×A-存入-unys,因此-unqr-里的-p|?Qz<<-也是真实屏幕空间协方差的-A-倍。屏幕空间低通核以-}\x07²(方差)为单位给出,<<-加到对角线前需换算到同一量纲,即-×A。<<-这样-}rOyNz|{-<-oyNz|{-的数值语义与-`}nx-<-t}yn-完全一致(=;@-}\x07²-≈-=;BB}\x07-σ)。p|{-sy|n-P\\cl]NPXl`PNYR-J-A;=Hp|{-sy|n-`UlP>-J-=;AEEC=?B>>F=?F>FFHp|{-sy|n-`UlP?l=-J->;=F?BAEAHp|{-sy|n-`UlP?l>-J-:>;=F?BAEAHp|{-sy|n-`UlP?l?-J-=;@>B@F>CHp|{-sy|n-`UlP?l@-J-:>;=F?BAEAHp|{-sy|n-`UlP?lA-J-=;BAC?DA?Hrp?-tr`UQnnbc5v{-}ynVq\x079-v{-p|z}|{r{\\ssr9-rp?-r\x07r`v r6-\n----v{-uP|z}|{r{P|{-J-=H----vs-5lzn\x07`uQrtrr-KJ->6-uP|z}|{r{P|{-8J-FH----vs-5lzn\x07`uQrtrr-KJ-?6-uP|z}|{r{P|{-8J->BH----vs-5lzn\x07`uQrtrr-KJ-@6-uP|z}|{r{P|{-8J-?>H----v{-}nqqrqP|z}|{r{P|{-J-uP|z}|{r{P|{H----vs-5}nqqrqP|z}|{r{P|{-2-A-.J-=6-\n--------}nqqrqP|z}|{r{P|{-J-55}nqqrqP|z}|{r{P|{-<-A6-8->6-7-AH----\f----sy|n-yv{rnP|z}|{r{V{qr\x07-J-sy|n5}ynVq\x07-7-}nqqrqP|z}|{r{P|{-8-p|z}|{r{\\ssr6H----sy|n-r\x07ryV{qr\x07-J-yv{rnP|z}|{r{V{qr\x07-<-A;=H----sy|n-q-J-r\x07ryV{qr\x07-<-r\x07r`v r;\x07H----sy|n-\b-J-sy||5q6-<-r\x07r`v r;\bH----sy|n-\x07-J-snp5q6H----r{-rp?5\x079-\b6H\f|vq-znv{-56-\n0vsqrs-b`Rl\\_QR_laReab_R----<<-|qr-走纹理:用实例号从-|qrar\x07r-取本实例要画的全局点索引----vrp?-|qrP||q-J-vrp?5tylV{n{prVQ-2-l|qrdvqu9-tylV{n{prVQ-<-l|qrdvqu6H----v{-}ynV{qr\x07b-J-r\x07rySrpu5l|qrar\x07r9-|qrP||q9-=6;H----<<-r|qr-标记为-`R[aV[RY5KJ-{z]|v{6-的实例被剔除----vs-5}ynV{qr\x07b-KJ-v{5l{z]|v{66-\n--------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------r{H----\f0ryr----v{-}ynV{qr\x07b-J-v{5}ynV{qr\x07-8-=;B6H0r{qvs----v{-}ynV{qr\x07V-J-v{5}ynV{qr\x07b6H----<<-每-}yn-?-r\x07ry-5_TON@?bV6G----<<-r\x07ry-=G-h}|els@?ov9-}|fls@?ov9-}|gls@?ov9-_TONl}npxrqj----<<-r\x07ry->G-hp|==\vp|=>5unys?69-p|=?\vp|>>5unys?69-p|>?\vp|??5unys?69-n{s|zV{qr\x07II>C\vyn\brV{qr\x07j----v{-onrar\x07ry-J-}ynV{qr\x07b-7-?H----v{-r\x07dvqu-J-v{5r\x07r`v r5lr\x07r9-=6;\x076H----vrp?-p||q=-J-vrp?5onrar\x07ry-2-r\x07dvqu9-onrar\x07ry-<-r\x07dvqu6H----vrp?-p||q>-J-vrp?55onrar\x07ry-8->6-2-r\x07dvqu9-5onrar\x07ry-8->6-<-r\x07dvqu6H----rpA-=-J-r\x07rySrpu5lr\x07r9-p||q=9-=6H----rpA->-J-r\x07rySrpu5lr\x07r9-p||q>9-=6H----<<-全精度位置-5|owrp-}npr6----rp@-}ynPr{r-J-rp@5--------v{Ova|Sy|n5=;69--------v{Ova|Sy|n5=;t69--------v{Ova|Sy|n5=;o6----6H----<<-颜色----rpA-p|y|-J-rpA5--------sy|n5=;n-3-=\x07SS69--------sy|n55=;n-KK-E6-3-=\x07SS69--------sy|n55=;n-KK->C6-3-=\x07SS69--------sy|n55=;n-KK-?A6-3-=\x07SS6----6-<-?BB;=H----<<-预计算的-@Q-协方差(|owrp-}npr),对称矩阵-C-分量-5unys:}rpvv|{6----rp?-p|ln-J-{}npxUnys?\x07>C5>;6H--<<-5p|==9-p|=>6----rp?-p|lo-J-{}npxUnys?\x07>C5>;t6H--<<-5p|=?9-p|>>6----rp?-p|lp-J-{}npxUnys?\x07>C5>;o6H--<<-5p|>?9-p|??6----zn@-cx-J-zn@5--------p|ln;\x079-p|ln;\b9-p|lo;\x079--------p|ln;\b9-p|lo;\b9-p|lp;\x079--------p|lo;\x079-p|lp;\x079-p|lp;\b----6H----<<-n{s|zV{qr\x07-和-yn\brV{qr\x07-从->;n-解包----v{-n{s|zV{qr\x07-J->;n-KK->CH----v{-yn\brV{qr\x07-J->;n-3-=\x07SSSSH----znA-n{s|z-J-znA5--------r\x07rySrpu5ln{s|z9-vrp?5=9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5>9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5?9-n{s|zV{qr\x0769-=69--------r\x07rySrpu5ln{s|z9-vrp?5@9-n{s|zV{qr\x0769-=6----6H----znA-n{s|zZ|qrycvrZnv\x07-J-vrZnv\x07-7-n{s|zH----rpA-|yqPr{r-J-n{s|z-7-rpA5}ynPr{r9->;=6H0vs-R[NOYRlT`lV[ValN[VZNaV\\[----sy|n-y|pny]|tr-J-lnttrtnv|{]|trH----sy|n-pnyr]|tr-J-=;=H----o||y-v{O|{qS|Nttrtnv|{-J-snyrH----vs-5lnttrtnv|{]|tr-I->;=6-\n--------o||y-v{O|{q-J-|yqPr{r;\x07-KJ-lnttrtnv|{O|{qZv{;\x07---------------------33-|yqPr{r;\x07-IJ-lnttrtnv|{O|{qZn\x07;\x07---------------------33-|yqPr{r; -KJ-lnttrtnv|{O|{qZv{; ---------------------33-|yqPr{r; -IJ-lnttrtnv|{O|{qZn\x07; H--------vs-5v{O|{q6-\n------------v{O|{qS|Nttrtnv|{-J-rH------------sy|n-urvtu_n{tr-J-lnttrtnv|{O|{qZn\x07;\b-:-lnttrtnv|{O|{qZv{;\bH------------sy|n-{|znyv rqUrvtu-J-urvtu_n{tr-K-=;==>----------------L-pynz}55|yqPr{r;\b-:-lnttrtnv|{O|{qZv{;\b6-<-urvtu_n{tr9-=;=9->;=6----------------G-=;BH------------sy|n-}|v{Q-J-pynz}5lnttrtnv|{]|v{Qnv|{9-=;=>9->;=6H------------sy|n-navzr-J-5>;=-:-{|znyv rqUrvtu6-7-5>;=-:-}|v{Q6H------------y|pny]|tr-J-pynz}55lnttrtnv|{]|tr-:-navzr6-<-}|v{Q9-=;=9->;=6H------------sy|n-|ssr]|tr-J-z||ur}5=;=9->;=9-y|pny]|tr6H------------pnyr]|tr-J-y|pny]|tr-7-y|pny]|tr-7-y|pny]|trH------------rp@-nttrtnv|{Pr{r-J-5lnttrtnv|{O|{qZv{-8-lnttrtnv|{O|{qZn\x076-<-?;=H------------rp@-qv-J-|yqPr{r;\x07\b -:-nttrtnv|{Pr{rH------------sy|n-qv-J-yr{tu5qv6H------------sy|n-n{q`rrq-J-q|5}ynPr{r9-rp@5>?;FEFE9-DE;?@@9-AB;>CA66H------------sy|n-n{qQv-J-snp5v{5n{q`rrq6-7-A@DBE;BAB@6H------------sy|n-n{tyr-J-n{q`rrq-7->=;=H------------rp@-pnrQv-J-{|znyv r5rp@5----------------p|5n{tyr69----------------zv\x075:=;D9-=;>9-snp5v{5n{q`rrq-7->;D6-7-A@DBE;BAB@669----------------v{5n{tyr6------------66H------------sy|n-r\x07}y|v|{Snp|-J-5>;=-:-|ssr]|tr6-7-5>;=-8->;=-7-n{qQv6H------------rp@-|ssr-J-pnrQv-7-qv-7-r\x07}y|v|{Snp|H------------|yqPr{r;\x07\b -8J-|ssrH------------}ynPr{r-J-5v{rr5n{s|z6-7-|yqPr{r6;\x07\b H--------\f----\f0r{qvs----0vs-[bZlT`lPYV]]R_`-K-=----vs-5yn\brV{qr\x07-I-v{5[bZlT`lYNfR_`66-\n--------rp?-pyv}_n{tr-J-lyn\brPyv}}r_n{trhyn\brV{qr\x07jH--------v{-pyv}`n-J-v{5pyv}_n{tr;\x07-8-=;B6H--------v{-pyv}P|{-J-v{5pyv}_n{tr;\b-8-=;B6H--------v{-pyv}R{q-J-pyv}`n-8-pyv}P|{H--------s|-5v{-v-J-=H-v-I-[bZlT`lPYV]]R_`H-v886-\n----------------vs-5v-I-pyv}`n-\v\v-v-KJ-pyv}R{q6-\n--------------------p|{v{rH----------------\f----------------rpA-pyv}}r]|vv|{-J-lpyv}}rZnvprV{rrhvj-7-|yqPr{rH----------------o||y-pyv}}rq-J-pyv}}r]|vv|{;\x07-K-:=;B-33-pyv}}r]|vv|{;\x07-I-=;BH----------------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{;\b-K-:=;B-33-pyv}}r]|vv|{;\b-I-=;BH----------------pyv}}rq-J-pyv}}rq-33-pyv}}r]|vv|{; -K-:=;B-33-pyv}}r]|vv|{; -I-=;BH----------------vs-5pyv}}rq6-\n--------------------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------------------r{H----------------\f--------\f----\f----0r{qvs----rpA-vrPr{r-J-n{s|zZ|qrycvrZnv\x07-7-rpA5}ynPr{r9->;=6H----rpA-pyv}Pr{r-J-}|wrpv|{Znv\x07-7-vrPr{rH----sy|n-pyv}-J->;?-7-pyv}Pr{r;H----vs-5pyv}Pr{r; -I-:pyv}Pr{r;-\v\v-pyv}Pr{r; -K-pyv}Pr{r;-\v\v--------pyv}Pr{r;\x07-I-:pyv}-\v\v-pyv}Pr{r;\x07-K-pyv}-\v\v--------pyv}Pr{r;\b-I-:pyv}-\v\v-pyv}Pr{r;\b-K-pyv}6-\n--------tyl]|vv|{-J-rpA5=;=9-=;=9-?;=9->;=6H--------r{H----\f----rp@-{qpPr{r-J-pyv}Pr{r;\x07\b -<-pyv}Pr{r;H----]|vv|{-J-}|vv|{;\x07\bH----rp?-s|pny-J-rp?5--------}|wrpv|{Znv\x07h=jh=j-7-r|yv|{;\x07-7-=;B9--------}|wrpv|{Znv\x07h>jh>j-7-r|yv|{;\b-7-=;B----6H----o||y-v\\u|tn}uvp-J-}|wrpv|{Znv\x07h@jh@j-K-=;DH----zn@-WH----vs-5v\\u|tn}uvp6-\n--------W-J-n{}|r5zn@5------------s|pny;\x079-=;=9-=;=9------------=;=9-s|pny;\b9-=;=9------------=;=9-=;=9-=;=--------66H----\f-ryr-\n--------sy|n--J->;=-<-5vrPr{r; -7-vrPr{r; 6H--------W-J-zn@5------------s|pny;\x07-<-vrPr{r; 9-=;=9-:5s|pny;\x07-7-vrPr{r;\x076-7-9------------=;=9-s|pny;\b-<-vrPr{r; 9-:5s|pny;\b-7-vrPr{r;\b6-7-9------------=;=9-=;=9-=;=--------6H----\f----zn@-d-J-n{}|r5zn@5n{s|zZ|qrycvrZnv\x0766H----zn@-a-J-d-7-WH----<<-@Q-→-?Q-协方差投影-5nyvt{rq-vu-t}yn-_r{qr]|tnz6----zn@-p|?Qz-J-n{}|r5a6-7-cx-7-aH----<<-───-屏幕空间抗锯齿:qvynv|{-<-Zv}:`}ynv{t-?Q-zv}-───----<<-每对象参数(放在视锥<裁剪早退之后再取,避免被剔除的-}yn-白付一次采样)----<<-;\x07-J-}rOyNz|{9-;\b-J-oyNz|{,单位为方差-}\x07²----rp?-oy]nnz-J-r\x07rySrpu5l|owrp]nnz9-vrp?5=9-n{s|zV{qr\x0769-=6;\x07\bH----sy|n-}rOyNz|{-J-oy]nnz;\x07H----sy|n-oyNz|{-J-oy]nnz;\bH----<<-Σ?Q-是对称矩阵,只需-@-个分量----sy|n-p==-J-p|?Qzh=jh=jH----sy|n-p=>-J-p|?Qzh=jh>jH----sy|n-p>>-J-p|?Qzh>jh>jH----<<-①-qvynv|{(}rOyNz|{):只膨胀协方差,不动-|}npv\b。----<<----用于未经抗锯齿训练的数据,避免亚像素-}yn-因采样不到而闪烁<消失。----<<----代价是远景-}yn-会偏亮偏胖(能量没有随面积增大而摊薄)。----sy|n-}rOy-J-}rOyNz|{-7-P\\cl]NPXl`PNYRH----p==-8J-}rOyH----p>>-8J-}rOyH----<<-②-Zv}:`}ynv{t-?Q-zv}(oyNz|{):膨胀协方差-8-|}npv\b-补偿。----<<----与一个方差为-ε-的各向同性高斯做卷积:Σ4-J-Σ-8-εV,----<<----并按-ρ-J-\05qr5Σ6-<-qr5Σ466-衰减-|}npv\b,使-}yn-的积分能量守恒----<<----——面积变大、浓度变淡,于是既不闪烁也不变亮。这是-RdN-低通滤波的近似,----<<----等价于-t}yn-的-nrv rlz|qrJ/n{vnyvnrq/。----<<----<<----注意-qr-对整体缩放的齐次性:qr5x·Σ6-J-x²·qr5Σ6,----<<----只要-ε-与-Σ-同样被-×P\\cl]NPXl`PNYR,比值中的-x²-会约掉,----<<----因此-ρ-与-}npx-缩放无关,恒等于真实-}\x07²-量纲下的补偿系数。----vs-5oyNz|{-K-=;=6-\n--------sy|n-qr\\vt-J-p==-7-p>>-:-p=>-7-p=>H--------sy|n-oy-J-oyNz|{-7-P\\cl]NPXl`PNYRH--------p==-8J-oyH--------p>>-8J-oyH--------sy|n-qr-J-p==-7-p>>-:-p=>-7-p=>H--------<<-qr-单调增(εK=-时-qr5Σ8εV6-K-qr5Σ6),故-ρ-∈-5=9->j--------p|y|;n-7J-\05pynz}5qr\\vt-<-zn\x075qr9->r:F69-=;=9->;=66H----\f----sy|n-zvq-J-5p==-8-p>>6-<-?;=H----sy|n-nqv-J-yr{tu5rp?55p==-:-p>>6-<-?;=9-p=>66H----sy|n-ynzoqn>-J-zvq-8-nqvH----sy|n-ynzoqn?-J-zvq-:-nqvH----vs-5ynzoqn?-I-=;=6-\n--------r{H----\f----rp?-qvnt|{nycrp|-J-{|znyv r5rp?5p=>9-ynzoqn>-:-p==66H----<<-协方差已在-}npx-阶段-×A(与-t}yn-对齐),故用-\05?7ynzoqn6-而非-\05E7ynzoqn6----rp?-znw|N\x07v-J-zv{5\05?;=-7-ynzoqn>69-zn\x07`prr{`}npr`}yn`v r6-7-qvnt|{nycrp|H----rp?-zv{|N\x07v-J-zv{5\05?;=-7-ynzoqn?69-zn\x07`prr{`}npr`}yn`v r6-7-rp?5qvnt|{nycrp|;\b9-:qvnt|{nycrp|;\x076H----<<-\0nq-顶点为-h:?9?j,等价于-t}yn-的-}|vv|{-7-n\x07v-<-vr}|----rp?-onvcvr}|-J-rp?5>;=-<-r|yv|{;\x079->;=-<-r|yv|{;\b6H----rp?-{qp\\ssr-J-5]|vv|{;\x07-7-znw|N\x07v-8-]|vv|{;\b-7-zv{|N\x07v6-7-onvcvr}|H0vs-R[NOYRlT`lV[ValN[VZNaV\\[----sy|n-sv{ny`pnyr]|tr-J-v{O|{qS|Nttrtnv|{-L-pnyr]|tr-G-5lnttrtnv|{]|tr-7-lnttrtnv|{]|tr-7-lnttrtnv|{]|tr6H----{qp\\ssr-7J-zv\x075=;>9->;=9-sv{ny`pnyr]|tr6H0r{qvs----rpA-\0nq]|-J-rpA5{qpPr{r;\x07\b-8-{qp\\ssr9-{qpPr{r; 9->;=6H----tyl]|vv|{-J-\0nq]|H----vs-5lzn\x07`uQrtrr-KJ->6-\n--------rp@-pnzrn]|V{\\owrp-J-rp@5v{rr5n{s|z6-7-rpA5pnzrn]|vv|{9->;=66H--------rp@-|owrpcvrQv-J-{|znyv r5}ynPr{r-:-pnzrn]|V{\\owrp6H--------rpA-u=>?@-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-=9-luar\x07r`v r66H--------rpA-uABCD-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-A9-luar\x07r`v r66H--------rpA-uEF>=>>-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-E9-luar\x07r`v r66H--------rp@-u>-J-u=>?@;toH--------rp@-u?-J-rp@5u=>?@;n9-uABCD;t6H--------rp@-u@-J-rp@5uABCD;on9-uEF>=>>;6H--------sy|n-\x07-J-|owrpcvrQv;\x07H--------sy|n-\b-J-|owrpcvrQv;\bH--------sy|n- -J-|owrpcvrQv; H--------rp@-uP|y|-J-u>-7-5:=;AEEC=?B-7-\b6-8-u?-7-5=;AEEC=?B-7- 6-8-u@-7-5:=;AEEC=?B-7-\x076H--------p|y|;to-8J-uP|y|H--------vs-5lzn\x07`uQrtrr-KJ-?6-\n------------rpA-u>?>@>A>B-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9->?9-luar\x07r`v r66H------------rpA-u>C>D>E>F-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9->C9-luar\x07r`v r66H------------rpA-u?=?>???@-J-r\x07r5luar\x07r9-tr`UQnnbc5}ynV{qr\x07V9-?=9-luar\x07r`v r66H------------rp@-uA-J-uEF>=>>;tonH------------rp@-uB-J-u>?>@>A>B;toH------------rp@-uC-J-rp@5u>?>@>A>B;n9-u>C>D>E>F;t6H------------rp@-uD-J-rp@5u>C>D>E>F;on9-u?=?>???@;6H------------rp@-uElqrt?-J-u?=?>???@;tonH------------sy|n-\x07\x07-J-\x07-7-\x07H------------sy|n-\b\b-J-\b-7-\bH------------sy|n- -J- -7- H------------sy|n-\x07\b-J-\x07-7-\bH------------sy|n-\b -J-\b-7- H------------sy|n-\x07 -J-\x07-7- H------------p|y|;to-8J----------------5`UlP?l=-7-\x07\b6-7-uA-8----------------5`UlP?l>-7-\b 6-7-uB-8----------------5`UlP?l?-7-5?;=-7- -:-\x07\x07-:-\b\b66-7-uC-8----------------5`UlP?l@-7-\x07 6-7-uD-8----------------5`UlP?lA-7-5\x07\x07-:-\b\b66-7-uElqrt?H--------\f----\f----p|y|;to-J-pynz}5p|y|;to9-rp@5=;=69-rp@5>;=66H----P|y|-J-p|y|H----<<-]|vv|{-直接传-h:?9?j-的-\0nq-坐标给-sntzr{(与-t}yn-一致)----b-J-}|vv|{;\x07\bH\f"),kb=function(...e){return e[0].split(``).map(e=>e.charCodeAt(0)>126?e:String.fromCharCode((e.charCodeAt(0)+113)%126)).join(``)}(`}rpvv|{-uvtu}-sy|nH0v{pyqr-Ip|zz|{Kn\bv{t-rpA-P|y|Hn\bv{t-rp?-]|vv|{Hn\bv{t-rp?-bH|vq-znv{-56-
|
|
2953
|
+
----<<-与-t}yn-_r{qr]|tnz-一致:]|vv|{-为-h:?9?j-的-\0nq-坐标----sy|n-N-J-:q|5]|vv|{9-]|vv|{6H----vs-5N-I-:A;=6-qvpnqH----rp@-p|y|-J-P|y|;toH----sy|n-|}npv\b-J-r\x07}5N6-7-P|y|;nH----tylSntP|y|-J-rpA5p|y|;to9-|}npv\b6H\f`),Ab=new t.Vector3,jb=new t.Vector3,Mb=new t.Quaternion,Nb=new t.Quaternion,Pb=new t.Vector3,Fb=class extends t.Mesh{constructor(){super(),this.needsRender=!1,this.sortWorker=null,this.splatIndexCapacity=0,this.sortDataUploaded=!1,this.usedSHDegree=0,this.transformStore=null,this.objectParamsStore=null,this.transformsDirty=!1,this.layerRegistry=null,this.shStore=null,this.orderTexture=null,this.assembler=null,this.reorderPass=null,this.orderTarget=null,this.orderBaseSnapshot=[],this.sortGeneration=0,this.snapshotByGen=new Map,this.orderCount=0,this.orderDirty=!1,this.layoutDirty=!1,this.lastObjectsHash=``,this.lastClipperHash=``,this.prevSortCameraMatrix=null,this.sortCameraDistance=1,this.sortCameraCoorient=.99,this.sortMinIntervalMs=0,this.sortLastTime=-1/0,this.onBeforeRender=(e,n,r)=>{let i=r,a=this.collectObjects(n);if(a.length===0){this.geometry.instanceCount=0;return}let o=0,s=!1;for(let e of a)e.usedSHDegree>o&&(o=e.usedSHDegree),e.initAnimationEnabled&&(s=!0);let c=o!==this.usedSHDegree;this.usedSHDegree=o,this.updateInitAnimationDefine(s),this.isSceneChanged(a)?this.rebuild(e,a):c&&this.updateSH(a);for(let e of a)e.transformChanged&&this.transformStore.indexOf(e)!==void 0&&(this.transformStore.updateOne(e),this.transformsDirty=!0,e.transformChanged=!1,e.selectedChanged=!1),e.renderParamsChanged&&(this.objectParamsStore.updateOne(e),e.renderParamsChanged=!1,this.needsRender=!0);let l=new t.Matrix4().multiplyMatrices(i.perspectiveProjectionMatrix,i.matrixWorldInverse);this.requestSort(i,l.elements),(this.orderDirty||this.layoutDirty)&&(this.runReorder(e),this.orderDirty=!1,this.layoutDirty=!1);let u=a.map(e=>{let t=e.gsClippers.map(e=>{var t;return`${(t=e.floorIndex)==null?-1:t}:${e.clippingBoxMatrix.elements.join(`,`)}`}).join(`;`);return`${e.gsViewLayerKey}:${t}`}).join(`|`);u!==this.lastClipperHash&&(this.updateClipperUniforms(a),this.lastClipperHash=u,this.needsRender=!0),this.material.uniforms.resolution.value.set(i.resolution.x,i.resolution.y)},this.geometry=this.createGeometry(),this.material=this.createMaterial(),this.orderTexture=new sb,this.assembler=new fb,this.reorderPass=new wb,this.transformStore=new hb,this.objectParamsStore=new vb,this.layerRegistry=new yb,this.shStore=new Sb,this.material.uniforms.u_orderTexture.value=this.orderTexture.texture,this.material.uniforms.u_orderWidth.value=this.orderTexture.width,this.frustumCulled=!1,this.renderOrder=-99999999999,this.sortWorker=new Db,this.sortWorker.postMessage({warmup:!0}),this.sortWorker.onmessage=e=>{var t;if(e.data.depthIndex){let n=e.data.depthIndex;this.applyDepthIndex(n,e.data.generation);let r=n.buffer;r.byteLength>0&&((t=this.sortWorker)==null||t.postMessage({returnBuffer:r},[r]))}}}createGeometry(){let e=new t.InstancedBufferGeometry,n=new Float32Array([-2,-2,0,2,-2,0,2,2,0,-2,2,0]);e.setAttribute(`position`,new t.BufferAttribute(n,3)),e.setIndex(new t.BufferAttribute(new Uint16Array([0,1,2,0,2,3]),1)),this.splatIndexCapacity=1;let r=new Float32Array(this.splatIndexCapacity),i=new t.InstancedBufferAttribute(r,1,!1,1);return i.setUsage(t.DynamicDrawUsage),e.setAttribute(`splatIndex`,i),e._maxInstanceCount=this.splatIndexCapacity,e.instanceCount=0,e}ensureSplatIndexCapacity(e){let n=this.geometry.getAttribute(`splatIndex`);if(e<=this.splatIndexCapacity)return n;let r=Math.max(this.splatIndexCapacity,1);for(;r<e;)r*=2;let i=new Float32Array(r);i.set(n.array.subarray(0,Math.min(n.array.length,r)));let a=new t.InstancedBufferAttribute(i,1,!1,1);return a.setUsage(t.DynamicDrawUsage),this.geometry.setAttribute(`splatIndex`,a),this.splatIndexCapacity=r,this.geometry._maxInstanceCount=r,a}createMaterial(){return new t.ShaderMaterial({vertexShader:Ob,fragmentShader:kb,defines:{NUM_GS_LAYERS:0,NUM_GS_CLIPPERS:0,ENABLE_GS_INIT_ANIMATION:0,USE_ORDER_TEXTURE:1},uniforms:{u_texture:{value:null},u_transforms:{value:null},u_orderTexture:{value:null},u_orderWidth:{value:2048},u_numPoints:{value:0},u_numGsLayers:{value:0},u_numGsClippers:{value:0},u_layerClipperRanges:{value:[]},u_clipperMatricesInverse:{value:[]},u_shTexture:{value:null},u_shTextureSize:{value:new t.Vector2},u_maxShDegree:{value:0},resolution:{value:new t.Vector2},u_aggregationProgress:{value:0},u_aggregationBoundsMin:{value:new t.Vector3(0,0,0)},u_aggregationBoundsMax:{value:new t.Vector3(0,0,0)},u_aggregationPointDuration:{value:.6},u_objectParams:{value:null}},side:t.DoubleSide,transparent:!0,blending:t.NormalBlending,depthTest:!0,depthWrite:!1})}rebuildTransformsTexture(e){this.transformStore.sync(e),this.material.uniforms.u_transforms.value=this.transformStore.texture,this.transformsDirty=!0}rebuildObjectParamsTexture(e){this.objectParamsStore.sync(e,e=>this.transformStore.indexOf(e)),this.material.uniforms.u_objectParams.value=this.objectParamsStore.texture;for(let t of e)t.renderParamsChanged=!1}rebuildAssembled(e,t){this.assembler.sync(t,e=>({transformIndex:this.transformStore.indexOf(e),layerIndex:this.layerRegistry.layerIndexOf(e)})),this.assembler.assemble(e),this.material.uniforms.u_texture.value=this.assembler.texture}updateSH(e){this.shStore.sync(e,this.usedSHDegree),this.material.uniforms.u_shTexture.value=this.shStore.texture,this.material.uniforms.u_shTextureSize.value.copy(this.shStore.textureSize),this.material.uniforms.u_maxShDegree.value=this.shStore.appliedDegree}applyDepthIndex(e,t){let n=e.length,r=this.ensureSplatIndexCapacity(n);r.array.set(e,0),r.count=n,r.updateRange.offset=0,r.updateRange.count=n,r.needsUpdate=!0,this.orderTexture&&this.orderTexture.update(e);let i=this.snapshotByGen.get(t);if(i){this.orderBaseSnapshot=i;for(let e of this.snapshotByGen.keys())e<t&&this.snapshotByGen.delete(e)}this.orderCount=n,this.orderDirty=!0,this.geometry.instanceCount=n,this.needsRender=!0}snapshotLayout(){return this.assembler?this.assembler.regions.map(e=>({object:e.object,start:e.start,count:e.count})):[]}buildSegments(e,t){let n=new Map;for(let e of t)n.set(e.object,e.start);let r=[];for(let t of e){let e=n.get(t.object),i=e===void 0,a=i?0:e-t.start,o=r[r.length-1];o&&o.removed===i&&(i||o.delta===a)&&o.oldEnd===t.start?o.oldEnd=t.start+t.count:r.push({oldStart:t.start,oldEnd:t.start+t.count,delta:a,removed:i})}return r}runReorder(e){if(!this.reorderPass||!this.orderTexture||this.orderCount===0)return;let t=this.snapshotLayout(),n=this.buildSegments(this.orderBaseSnapshot,t),r=this.orderTexture.width,i=Math.max(1,Math.ceil(this.orderCount/r));this.orderTarget?(this.orderTarget.width!==r||this.orderTarget.height<i)&&this.orderTarget.setSize(r,Math.max(this.orderTarget.height,i)):this.orderTarget=wb.createOrderTarget(r,i),this.reorderPass.run(e,this.orderTexture.texture,r,this.orderTarget,n);let a=0;for(let e of t)a+=e.count;this.material.uniforms.u_orderTexture.value=this.orderTarget.texture,this.material.uniforms.u_orderWidth.value=r,this.material.uniforms.u_numPoints.value=a}postSortData(){var e;let t=++this.sortGeneration;this.snapshotByGen.set(t,this.snapshotLayout());let{positions:n,transformIndices:r,count:i}=this.assembler.extractSortInputs(),a=this.transformStore.transforms.slice(0,this.transformStore.objectCount*20);(e=this.sortWorker)==null||e.postMessage({sortData:{positions:n,transforms:a,transformIndices:r,vertexCount:i,generation:t}},[n.buffer,a.buffer,r.buffer]),this.sortDataUploaded=!0,this.transformsDirty=!1}shouldSort(e){if(this.transformsDirty||!this.sortDataUploaded||!this.prevSortCameraMatrix)return!0;this.prevSortCameraMatrix.decompose(Ab,Mb,Pb),e.matrixWorld.decompose(jb,Nb,Pb);let t=Ab.distanceTo(jb),n=Math.abs(Mb.dot(Nb));return t>this.sortCameraDistance||n<this.sortCameraCoorient}requestSort(e,n){var r;!this.assembler||this.assembler.totalPoints===0||this.shouldSort(e)&&(performance.now()-this.sortLastTime<this.sortMinIntervalMs||((this.transformsDirty||!this.sortDataUploaded)&&this.postSortData(),(r=this.sortWorker)==null||r.postMessage({viewProj:n}),this.prevSortCameraMatrix||(this.prevSortCameraMatrix=new t.Matrix4),this.prevSortCameraMatrix.copy(e.matrixWorld),this.sortLastTime=performance.now()))}collectObjects(t){let n=[];return t.traverse(t=>{t instanceof e.t&&t.visible&&n.push(t)}),n.sort((e,t)=>{let n=e.uuid+e.gsViewLayerKey,r=t.uuid+t.gsViewLayerKey;return n<r?-1:+(n>r)}),n}isSceneChanged(e){let t=e.map(e=>`${e.uuid}:${e.gsViewLayerKey}`).join(`|`);return t===this.lastObjectsHash?!1:(this.lastObjectsHash=t,!0)}rebuild(e,t){this.sortDataUploaded=!1,this.layerRegistry.sync(t),this.rebuildTransformsTexture(t),this.rebuildObjectParamsTexture(t),this.rebuildAssembled(e,t),this.material.uniforms.u_numPoints.value=this.assembler.totalPoints,this.ensureSplatIndexCapacity(this.assembler.totalPoints),this.updateSH(t),this.lastClipperHash=``,this.layoutDirty=!0,this.needsRender=!0}updateClipperUniforms(e){var n,r;let i=this.layerRegistry;if(!i||i.layerCount===0){this.material.uniforms.u_layerClipperRanges.value=[],this.material.uniforms.u_clipperMatricesInverse.value=[],this.updateClipperCounts(0,0);return}let a=new Map;for(let t of e)a.has(t.gsViewLayerKey)||a.set(t.gsViewLayerKey,t.gsClippers);let o=i.layerKeys.length,s=0;for(let e of i.layerKeys)s+=((n=a.get(e))==null?[]:n).length;let c=Array.from({length:o},()=>new t.Vector2(-1,0)),l=Array.from({length:s},()=>new t.Matrix4),u=0;for(let e of i.layerKeys){let t=i.layerKeyToIndex.get(e);if(t===void 0)continue;let n=(r=a.get(e))==null?[]:r,o=u;for(let e of n)l[u].getInverse(e.clippingBoxMatrix),u++;n.length>0&&c[t].set(o,n.length)}this.material.uniforms.u_layerClipperRanges.value=c,this.material.uniforms.u_clipperMatricesInverse.value=l,this.updateClipperCounts(o,u)}updateClipperCounts(e,t){let n=this.material.defines;(n.NUM_GS_LAYERS!==e||n.NUM_GS_CLIPPERS!==t)&&(n.NUM_GS_LAYERS=e,n.NUM_GS_CLIPPERS=t,this.material.needsUpdate=!0),this.material.uniforms.u_numGsLayers.value=e,this.material.uniforms.u_numGsClippers.value=t}updateInitAnimationDefine(e){let t=this.material.defines,n=+!!e;t.ENABLE_GS_INIT_ANIMATION!==n&&(t.ENABLE_GS_INIT_ANIMATION=n,this.material.needsUpdate=!0,this.needsRender=!0)}dispose(){this.sortWorker&&(this.sortWorker.terminate(),this.sortWorker=null),this.assembler&&(this.assembler.dispose(),this.assembler=null),this.reorderPass&&(this.reorderPass.dispose(),this.reorderPass=null),this.orderTarget&&(this.orderTarget.dispose(),this.orderTarget=null),this.transformStore&&(this.transformStore.dispose(),this.transformStore=null),this.objectParamsStore&&(this.objectParamsStore.dispose(),this.objectParamsStore=null),this.shStore&&(this.shStore.dispose(),this.shStore=null),this.layerRegistry=null,this.orderTexture&&(this.orderTexture.dispose(),this.orderTexture=null),this.geometry.dispose(),this.material.dispose()}},Ib=class extends t.Mesh{constructor(){super(),this.onBeforeRender=(e,t,n)=>{this.collectObjects(t).length>0&&console.warn(`未开启webgl2, 3dgs仅支持在开启webgl2模式后使用`)}}collectObjects(t){let n=[];return t.traverse(t=>{t instanceof e.t&&t.visible&&n.push(t)}),n}},Lb=1e3,Rb=90,zb=e=>e.replace(`//vrlab-public.ljcdn.com/`,`//vr-public.realsee-cdn.cn/`).replace(`//vrlab-image4.ljcdn.com/`,`//vr-image-4.realsee-cdn.cn/`).replace(`//vrlab-image3.ljcdn.com/`,`//vr-image-3.realsee-cdn.cn/`).replace(`//vrlab-image2.ljcdn.com/`,`//vr-image-2.realsee-cdn.cn/`).replace(`//vrlab-image1.ljcdn.com/`,`//vr-image-1.realsee-cdn.cn/`),Bb=new t.Sphere,Vb=new t.Box3,Hb=new t.Vector4,Ub=new t.Vector4,Wb=new t.Color,Gb=new t.Vector2,Kb=new WeakMap,qb=wm([xm(null)]),Jb={},Yb=class e extends nn{static get version(){return`6.9.0-alpha.3`}static get dracoPath(){return co.decoderPath}static set dracoPath(e){co.setDecoderPath(e)}static get ktx2Path(){return _o.transcoderPath}static set ktx2Path(e){_o.setTranscoderPath(e)}static get useNativeImageBitmap(){return ii()}static set useNativeImageBitmap(e){ri(e)}constructor(e={}){var n,r,i,a,o,s,c,l,u,d,f;if(super(),this.pbmGaussianSplattingRenderMesh=null,this.fiveId=Zt(),Jb[this.fiveId]=this,this.currentUpdateArgs={time:V(),args:[]},this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.needsRender=!1,this.onlyRenderIfNeeds=(n=e.onlyRenderIfNeeds)==null?!0:n,this.imageOptions=Object.assign({},(r=e.imageOptions)==null?{}:r),this.textureOptions=Object.assign({},(i=e.textureOptions)==null?{}:i),this.poweredByRealsee=(a=e.poweredByRealsee)==null?!0:a,this.backgroundColor=new t.Color((o=e.backgroundColor)==null?1579548:o),this.backgroundAlpha=(s=e.backgroundAlpha)==null?1:s,this.extraElements=[],this.controllerInits={Panorama:Object.assign({},e.panorama),Model:Object.assign({},e.model),Floorplan:Object.assign({},e.floorplan),Topview:Object.assign({},e.topview),Mapview:Object.assign({},e.mapview),VRPanorama:Object.assign({},e.vrPanorama),XRPanorama:Object.assign({},e.xrPanorama)},this.fps={testCount:0,testTime:V()},this.modeChangeDuration=(c=e.modeChangeDuration)==null?Lb:c,this.enableWheel=(l=e.enableWheel)==null?!0:l,typeof window<`u`)if(`renderer`in e)e.renderer instanceof Uh&&this.throwError(Error(`cannot render a internal renderer`)),this.renderer=e.renderer;else try{this.renderer=new Uh({preserveDrawingBuffer:e.preserveDrawingBuffer,antialias:e.antialias,webgl2:e.webgl2,logarithmicDepthBuffer:e.logarithmicDepthBuffer,precision:e.precision,powerPreference:e.powerPreference});let t=Ky();this.renderer.setPixelRatio(t===1?window.devicePixelRatio:1),this.renderer.setSize(512,512),this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha)}catch(e){let t=e instanceof Error?e:Error(String(e));this.throwError(t)}this.getPixelsRenderTarget=new t.WebGLRenderTarget(1,1,{encoding:(d=(u=this.renderer)==null?void 0:u.outputEncoding)==null?t.sRGBEncoding:d,generateMipmaps:!1}),this.viewport=Object.assign({left:0,bottom:0,width:1,height:1},e.viewport),this.camera=new Yt(Rb),this.scene=new Xh,this.xrCustomObjectsScene=new t.Scene,this.scene.add(this.xrCustomObjectsScene),this.scene.matrixAutoUpdate=!1,this.loadWorkTask=Promise.resolve(),this.requestProxy=(f=e.requestProxy)==null?zb:f,this.networkSubscribe=new ir,this.networkSubscribe.on(`network`,(e,t,n,r)=>{var i;this.emit(`network.resource`,Q(`network.resource`,{source:e,requestType:t,requestState:n,detail:r})),(i=this.analysis)==null||i.network(this.works,e,t,n,r)}),this.readyCallbacks=[],this.syncingState=!1,this.helperGroup=new t.Group,this.helperGroup.name=`helper`,this.helperGroup.matrixAutoUpdate=!1,this.scene.add(this.helperGroup),Kb.set(this,qb),this.modelScene=new xp({fiveId:this.fiveId}),this.modelScene.addEventListener(`model.create`,e=>{this.bindModel(e.model)}),this.scene.add(this.modelScene);let[p]=this.modelScene.setModels(qb,{forceReplaceImmediately:!0});B(p,`loaded`,{get(){return!1},set(e){}}),this.videoTexture=new t.VideoTexture(e.videoInstance||Uy());let m=Wy();this.scene.add(m),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.stateSynced=!1,this.destroyed=!1,this.paused=!0,typeof window<`u`&&(e.play!==!1&&this.play(),this.stopAnimationLoop=ei.shared.add((e,t,...n)=>{this.updateTime(e,t,...n)},!1,0,10));let h=()=>{typeof document<`u`&&document.fullscreenElement===null&&this.currentMode===`VRPanorama`&&this.controller.emit(`vr.requestExit`,Q(`vr.requestExit`,{}))},g=()=>{this.needsRender=!0};if(typeof document<`u`&&document.addEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.addEventListener(`webglcontextrestored`,g,!1),this.removeEventListeners=()=>{typeof document<`u`&&document.removeEventListener(`fullscreenchange`,h,!1),this.renderer&&this.renderer.domElement.removeEventListener(`webglcontextrestored`,g,!1)},this.plugins={},e.plugins&&e.plugins.length){for(let t of e.plugins)if(typeof t==`function`)t(this);else if(Array.isArray(t)){let[e,n,r]=t;if(typeof e==`function`){let t=e(this,r);typeof n==`string`&&(this.plugins[n]?this.throwError(Error(`plugin name ${n} is exists.`)):this.plugins[n]=t)}}}Hy(this),this.fiveRenderer=new Hh,this.adaptiveLuminancePass=new Ym,this.adaptiveLuminancePass.enabled=!1,this.fiveRenderer.composer.addPass(this.adaptiveLuminancePass),this.eyeDomeLightingPass=new Qm(this.camera),this.eyeDomeLightingPass.enabled=!1,this.fiveRenderer.composer.addPass(this.eyeDomeLightingPass),e.webgl2?(this.pbmGaussianSplattingRenderMesh=new Fb,this.scene.add(this.pbmGaussianSplattingRenderMesh)):this.scene.add(new Ib)}get ident(){return this.fiveId}get panoIndex(){return this.pano.panoIndex}get panoId(){return Z(this.pano)}dispose(){var e;if(this.destroyed===!0)return;delete Jb[this.fiveId],this.emit(`dispose`),this.destroyed=!0,this.pause(),this.stopAnimationLoop&&(this.stopAnimationLoop(),this.stopAnimationLoop=void 0),this.off(),this.networkSubscribe.off(),this.controller&&(this.controller.destroy(),this.controller=void 0);let n=this.getElement();n&&n.parentNode&&n.parentNode.removeChild(n);let r=this.modelScene.parameter;r.pano0&&r.pano0.map.dispose(),r.pano1&&r.pano1.map!==((e=r.pano0)==null?void 0:e.map)&&r.pano1.map.dispose(),r.reset(`pano0`,`pano1`),this.modelScene.dispose(),this.scene.dispose(),this.xrCustomObjectsScene.dispose(),Kb.set(this,qb),this.renderer&&this.renderer.render(new t.Scene,new t.Camera),this.fiveRenderer.dispose(),this.renderer instanceof Uh&&(this.renderer.forceContextLoss&&this.renderer.forceContextLoss(),this.renderer.dispose())}setViewport(e){Object.assign(this.viewport,e),this.needsRender=!0}get boundingMesh(){return this.modelScene.boundingMesh}get helperVisible(){return this.helperGroup.visible}set helperVisible(e){this.helperGroup.visible!==e&&(this.helperGroup.visible=e,this.emit(`helpers.visible`,Q(`helpers.visible`,{object:this.helperGroup})),this.needsRender=!0)}updateConfiguration(e,t=!0){let n=!1,r=!1;e.panorama&&(Object.assign(this.controllerInits.Panorama,pr(e.panorama)),this.currentMode===`Panorama`&&(n=!0)),e.model&&(Object.assign(this.controllerInits.Model,pr(e.model)),this.currentMode===`Model`&&(n=!0)),e.floorplan&&(Object.assign(this.controllerInits.Floorplan,pr(e.floorplan)),this.currentMode===`Floorplan`&&(n=!0)),e.topview&&(Object.assign(this.controllerInits.Topview,pr(e.topview)),this.currentMode===`Topview`&&(n=!0)),e.mapview&&(Object.assign(this.controllerInits.Mapview,pr(e.mapview)),this.currentMode===`Mapview`&&(n=!0)),e.vrPanorama&&(Object.assign(this.controllerInits.VRPanorama,pr(e.vrPanorama)),this.currentMode===`VRPanorama`&&(n=!0)),e.xrPanorama&&(Object.assign(this.controllerInits.XRPanorama,pr(e.xrPanorama)),this.currentMode===`XRPanorama`&&(n=!0)),e.imageOptions&&(Object.assign(this.imageOptions,e.imageOptions),(this.currentMode===`Panorama`||this.currentMode===`VRPanorama`)&&(r=!0,n=!0)),e.textureOptions&&Object.assign(this.textureOptions,e.textureOptions),t&&n&&this.controller&&this.currentMode&&(!this.controller.updateConfiguration(this.controllerInits[this.currentMode])||r)&&this.changeMode(this.currentMode,this.getCurrentState(),0,!1,!0)}appendTo(e,t={}){if(!this.renderer)return;if(!(this.renderer instanceof Uh)){this.throwError(Error(`cannot call appendTo method when render a external renderer`));return}let n=this.getElement();if(!n)return;e.appendChild(n),this.refresh(t);let r=window.getComputedStyle(e).position;r!==`relative`&&r!==`absolute`&&r!==`fixed`&&r!==`sticky`&&(e.style.position=`relative`)}refresh(e={},t){var n,r,i;if(!this.renderer)return;let a=this.renderer.domElement.parentNode,{width:o=(n=a==null?void 0:a.offsetWidth)==null?512:n,height:s=(r=a==null?void 0:a.offsetHeight)==null?512:r}=e;if(o=Math.max(1,o),s=Math.max(1,s),!t){let e=Ky(),n=typeof window<`u`?window.devicePixelRatio:1;if(t=(i=e===1?n:1)==null?1:i,t>1){let e=Math.max(o,s)*t,n=Math.min(this.renderer.capabilities.maxTextureSize,4096);e>n&&(t=Math.max(t/e*n,1),t=Math.floor(t*100)/100)}}this.renderer.setPixelRatio(t),this.renderer.setSize(o,s),this.needsRender=!0;let c=V(),l=c-this.currentUpdateArgs.time,u=this.currentUpdateArgs.args;this.updateTime(c,l,...u)}addExtraElement(e){return this.extraElements.indexOf(e)===-1&&(this.extraElements.push(e),this.controller&&this.controller.bindExtraElement(e)),()=>this.removeExtraElement(e)}removeExtraElement(e){let t=this.extraElements.indexOf(e);t!==-1&&(this.extraElements.splice(t,1),this.controller&&this.controller.unbindExtraElement(e))}getSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}getDrawingBufferSize(e){if(!this.renderer)throw Error(`renderer is not initialized`);return this.renderer.getDrawingBufferSize(e),e.x*=this.viewport.width,e.y*=this.viewport.height,e}updateCamera(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCamera(e,t,n)}updateCameraWithKeyframes(e,t,n=!0){if(!this.controller)throw Error(`controller is not initialized.`);return this.controller.updateCameraWithKeyframes(e,t,n)}get works(){return Kb.get(this)||qb}get work(){return this.works[0]}get observers(){return this.work.observers}get models(){return this.modelScene.models}get model(){return this.modelScene.models[0]}load(e,t,n,r=!0){if(!this.renderer)throw Error(`renderer is not initialized`);let i=this.loadWorkTask.then(()=>gg(e)?e.then(e=>this.load_(e,t,n,r)):this.load_(e,t,n,r));return this.loadWorkTask=i.catch(e=>{this.throwError(e)}),i}load_(n,r,i,a=!0){var o,s,c,l,u,d,f,p,m,h;let g={};typeof i==`number`?g.duration=i:typeof i==`object`&&Object.assign(g,i),this.works===qb&&(g.duration===void 0&&(g.duration=0),g.effect===void 0&&(g.effect=`instant`));let _={};Object.assign(_,g.model),!_[`3d-tiles`]&&g[`3d-tiles`]&&(_[`3d-tiles`]=g[`3d-tiles`]),!_.textureOptions&&g.textureOptions&&(_.textureOptions=g.textureOptions),!_.textureOptions&&this.textureOptions&&(_.textureOptions=this.textureOptions);let v=[];if(Array.isArray(n))for(let e of n)e instanceof bm?v.push(e):typeof e!=`string`&&`work`in e?v.push(xm(e.work,e)):v.push(xm(e));else n instanceof bm?v.push(n):v.push(xm(n));g.mode===`add`&&(v=[].concat(this.works,v));let y;try{y=wm(v)}catch(e){return this.throwError(e),Promise.reject(e)}for(let e of y)this.bindWorkFetcher(e);r===void 0&&(r=`inherit`),r===`inherit`&&this.works===qb&&(r=`initial`);let b=this.currentMode,x=y.initial,S=x.work.observers[0],C=S?{workCode:S.work.workCode,panoIndex:S.panoIndex}:{workCode:x.work.workCode,panoIndex:0},w=(o=x.mode)==null?S?`Panorama`:`Mapview`:o,T={};if(r===`inherit`){let e=this.getCurrentState(),[t]=y.filter(t=>t.workCode===e.workCode);if(t)C={workCode:e.workCode,panoIndex:e.panoIndex},w=e.mode,T={longitude:e.latitude,latitude:e.latitude,fov:e.fov,distance:e.distance,offset:e.offset.clone()};else{r={mode:b};let e=(c=(s=y[0])==null?void 0:s.observers)==null?void 0:c[this.panoIndex];e?(r.workCode=e.work.workCode,r.panoIndex=e.panoIndex):typeof y.initial.panoIndex==`number`?(r.workCode=y.initial.work.workCode,r.panoIndex=y.initial.panoIndex):(r.mode===`Panorama`||r.mode===`VRPanorama`||r.mode===`XRPanorama`)&&(r.mode=`Mapview`),r.mode===b&&(r.longitude=this.camera.pose.longitude,r.latitude=this.camera.pose.latitude,r.fov=this.camera.pose.fov)}}if(r===`initial`&&(typeof x.panoIndex==`number`&&(C={workCode:x.work.workCode,panoIndex:x.panoIndex}),x.mode&&(w=x.mode),T={longitude:x.longitude,latitude:x.latitude,fov:x.fov,distance:x.distance,offset:(l=x.offset)==null?void 0:l.clone()}),typeof r==`object`){if(w=(u=r.mode)==null?b:u,typeof r.panoIndex==`number`){let e=y.getObserver({workCode:(f=(d=r.workCode)==null?x.work.workCode:d)==null?``:f,panoIndex:r.panoIndex});e&&(C={workCode:e.work.workCode,panoIndex:e.panoIndex})}T={longitude:r.longitude,latitude:r.latitude,fov:r.fov,distance:r.distance,offset:r.offset?new t.Vector3().copy(r.offset):void 0}}let E=(p=g.duration)==null?this.modeChangeDuration:p;(w===`Floorplan`||w===`Topview`||w===`Mapview`)&&b===w&&(E=0);let D=`fly`;(w===`Panorama`||w===`VRPanorama`||w===`XRPanorama`)&&b===w&&(D=(m=g.effect)==null?`fade`:m),this.emit(`works.request`,Q(`works.request`,{input:n,works:y,userAction:a}));let O=(e,t,n)=>{let i=this.getCurrentState(),o=Object.assign(Object.assign({mode:e},t),n);r===`inherit`&&(o=this.getCurrentState()),this.pano=t;let s=Object.assign(Object.assign({initial:{state:o,currentState:i,duration:E,effect:D,userAction:a}},this.commonParams()),this.controllerInits[e]),c=zy[o.mode].initAnimationEndState(s);if(this.controller&&b===e)this.controller.updateWork(y,c,{effect:D,duration:E},a)===!1&&(this.controller.destroy(),this.controller=this.applyController(e,s));else{if(this.controller)this.controller.destroy();else{let t=zy[e].initAnimationEndState(s);this.camera.setFromPose(t),this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:a}))}this.controller=this.applyController(e,s);let t=Q(`mode.change`,{prevMode:b,mode:e,state:c,userAction:a});try{this.emit(`mode.change`,t)}catch(e){console.error(e)}}this.updateTime(this.currentUpdateArgs.time,0,...this.currentUpdateArgs.args)};Kb.set(this,y);let k=Promise.resolve();if(w===e.Mode.Floorplan||w===e.Mode.Topview||w===e.Mode.Mapview||w===e.Mode.Model){this.modelScene.loaded===!1&&(this.camera.setFromPose(T),Dg(this.state,this.camera.pose));let e=this.modelScene.setModels(y,_);k=Promise.all(e.map(e=>e.loadedReady)).then(()=>{this.needsRender=!0,O(w,C,T),this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:a}))})}else{O(w,C,T);let e=this.controller,t=!1;this.modelScene.autoRefine=!1;let n=()=>{this.works===y&&t===!1&&(this.needsRender=!0,this.emit(`camera.update`,Q(`camera.update`,{state:this.getCurrentState(),userAction:a})),t=!0,this.modelScene.autoRefine=!0),e.off(`pano.arrived`,n),e.off(`pano.cancel`,n)},r=this.modelScene.setModels(y,_);k=Promise.all(r.map(e=>e.initReady)).then(G),e.once(`pano.arrived`,n),e.once(`pano.cancel`,n),setTimeout(n,((h=g.duration)==null?this.modeChangeDuration:h)+1e3)}return this.emit(`works.load`,Q(`works.load`,{input:n,userAction:a,works:y})),k.then(()=>this.ready()).then(()=>{var e;this.emit(`works.ready`,Q(`works.ready`,{input:n,userAction:a,works:y})),(e=this.analysis)==null||e.work(y)})}reset(){let e=this.loadWorkTask.then(()=>this.reset_());return this.loadWorkTask=e.catch(e=>{this.throwError(e)}),e}reset_(){return new Promise(e=>{var n;this.controller&&(this.controller.destroy(),this.controller=void 0);let r=this.modelScene.parameter;r.pano0&&r.pano0.map.dispose(),r.pano1&&r.pano1.map!==((n=r.pano0)==null?void 0:n.map)&&r.pano1.map.dispose(),r.set({pano0:null,pano1:null,modelAlpha:1}),Kb.set(this,qb),this.modelScene.setModels(qb,{forceReplaceImmediately:!0}),this.renderer&&this.modelScene.update(this.renderer,this.camera),this.needsRender=!0,this.currentMode=`Panorama`,this.pano={workCode:``,panoIndex:0},this.camera.setFromPose({distance:0,fov:Rb,longitude:0,latitude:0,offset:new t.Vector3(0,0,0)}),this.state={mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex,longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude,fov:this.camera.pose.fov,offset:this.camera.pose.offset.clone(),distance:this.camera.pose.distance},this.camera.needsRender=!1,this.needsRender=!1,e()})}changeMode(t,n={},r,i=!0,a=!1){return new Promise((o,s)=>{var c,l,u,d;if(!this.renderer)throw Error(`renderer is not initialized.`);n=Object.assign({},n);let f=0;this.controller&&(f=typeof r==`number`?r:(c=r==null?void 0:r.duration)==null?this.modeChangeDuration:c);let p=`fly`;this.controller&&typeof r==`object`&&r.effect&&(p=r.effect);let m=typeof n.panoIndex==`number`?{workCode:(d=(l=n.workCode)==null?(u=this.work)==null?void 0:u.workCode:l)==null?``:d,panoIndex:n.panoIndex}:this.pano;if(!e.Mode.hasOwnProperty(t)){let e=Error(`mode "${t}" is not existed`);this.throwError(e),s(e);return}if((t===e.Mode.Panorama||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama)&&!this.works.getObserver(m)){let e=Error(`PanoId ${Z(m)} not existed.`);this.throwError(e),s(e);return}(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)&&this.modelScene.empty&&(f=0);let h=this.controller,g=this.currentMode,_=()=>{if(this.controller&&this.controller.stopMomentumMovement(),this.controller&&a===!1&&g===t)t===e.Mode.Panorama||t===e.Mode.Model||t===e.Mode.VRPanorama||t===e.Mode.XRPanorama?!zp(this.pano,m)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`?this.controller.moveToPano(m,Object.assign({duration:f},n),i):this.controller.updateCamera(n,f,i).catch(G):(zp(this.pano,m)||(this.pano=m),this.controller.updateCamera(n,f,i).catch(G));else{let e=Object.assign(Object.assign({},n),m),r=Object.assign(Object.assign({initial:{state:e,currentState:this.getCurrentState(),duration:f,effect:p,userAction:i}},this.commonParams()),this.controllerInits[t]),a=zy[t].initAnimationEndState(r),o=Q(`mode.change.request`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});if(this.emit(`mode.change.request`,o),!o.defaultPrevented){h&&h.destroy(),this.controller=this.applyController(t,r);let e=Q(`mode.change`,{prevMode:this.currentMode,mode:t,state:a,userAction:i});this.emit(`mode.change`,e)}}o()},v=ei.shared.getContext();v&&(typeof XRSession<`u`&&v instanceof XRSession&&v.end(),ei.shared.setContext(null)),t===e.Mode.VRPanorama?(this.requestFullscreen(),Cg().then(()=>_()).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.exitFullscreen(),this.throwError(t),s(t)})):t===e.Mode.XRPanorama?wg().then(e=>{ei.shared.setContext(e),a=!0,_()}).catch(e=>{let t=e instanceof Error?e:Error(String(e));this.throwError(t),s(t)}):_()})}getPixels(e,n,r,i,a,o,s){if(!this.renderer)throw Error(`renderer is not initialized.`);let c=V(),l=this.renderer.getPixelRatio(),u=this.renderer.getRenderTarget(),d=this.getSize(new t.Vector2),f=0,p=0,m=1,h=1,g,_,v,y,b;typeof e==`number`?(f=e,typeof n==`number`&&(p=n),typeof r==`number`&&(m=r),typeof i==`number`&&(h=i),g=a,_=o,b=s):(f=e.x,p=e.y,m=e.width,h=e.height,g=e.pixelRatio,_=e.flipY,v=e.helperVisible,y=e.skipPanorama,b=e.buffer),f=Math.floor(f),p=Math.floor(p),m=Math.floor(m),h=Math.floor(h),g=Math.floor(g==null?l:g),_=_==null?!1:_;let x=this.helperVisible,S=this.modelScene.parameter.modelAlpha;this.helperVisible=v==null?this.helperVisible:v,y&&(this.controller instanceof zy.Panorama||this.controller instanceof zy.VRPanorama||this.controller instanceof zy.XRPanorama)&&y===!0&&this.modelScene.parameter.set(`modelAlpha`,1),this.modelScene.update(this.renderer,this.camera);let C=this.getPixelsRenderTarget;C.setSize(m*g,h*g),this.renderer.setRenderTarget(C),this.camera.pixelRatio=g,this.camera.resolution.set(m,h),this.camera.setViewOffset(d.width,d.height,f,d.height-p-h,m,h),this.camera.aspect=d.width/d.height,this.camera.updateTime(c),this.scene.update(this.renderer,this.camera);let w=this.renderer.autoClear,T=this.renderer.autoClearColor,E=this.renderer.autoClearDepth,D=this.renderer.autoClearStencil,O=Wb.copy(this.renderer.getClearColor()),k=this.renderer.getClearAlpha(),A=this.renderer.getScissorTest();this.renderer.autoClear=!0,this.renderer.autoClearColor=!0,this.renderer.autoClearDepth=!0,this.renderer.autoClearStencil=!0,this.renderer.setScissorTest(!1);let j=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:j,this.renderer.render(this.scene,this.camera),this.scene.background=j,this.renderer.autoClear=w,this.renderer.autoClearColor=T,this.renderer.autoClearDepth=E,this.renderer.autoClearStencil=D,this.renderer.setClearColor(O,k),this.renderer.setScissorTest(A),this.helperVisible=x,S===void 0?this.modelScene.parameter.reset(`modelAlpha`):this.modelScene.parameter.set(`modelAlpha`,S),this.renderer.setRenderTarget(u),this.camera.clearViewOffset(),this.camera.pixelRatio=l,this.camera.resolution.copy(d),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height,this.camera.updateTime(c),this.modelScene.update(this.renderer,this.camera),this.scene.update(this.renderer,this.camera);let M=m*g,N=h*g,ee=M*N,te=ee*4;if(b){if(b.length!==te)throw Error(`buffer length is not equals pixels ${te}`)}else b=new Uint8Array(te);if(this.renderer.readRenderTargetPixels(C,0,0,m*g,h*g,b),_){let e=ee/2;for(let t=0,n=0,r=0,i=0;n<e;n++)for(i=(N-Math.floor(n/M)-1)*M+n%M,r=0;r<4;r++)t=b[n*4+r],b[n*4+r]=b[i*4+r],b[i*4+r]=t}return b}getElement(){var e;return(e=this.renderer)==null?void 0:e.domElement}render(e){let t=this.renderer;if(!t)return;let n=t.getRenderTarget();t.setRenderTarget(null);let r=t.autoClear,i=t.autoClearColor,a=t.autoClearDepth,o=t.autoClearStencil,s=Wb.copy(t.getClearColor()),c=t.getClearAlpha(),l=t.getViewport(Hb),u=t.getScissor(Ub),d=t.getScissorTest();t.autoClear=!0,t.autoClearColor=!0,t.autoClearDepth=!0,t.autoClearStencil=!0;let f=t.getSize(Gb),p=Math.floor(f.x*this.viewport.left),m=Math.floor(f.y*this.viewport.bottom),h=Math.floor(f.x*this.viewport.width),g=Math.floor(f.y*this.viewport.height);t.setClearColor(this.backgroundColor,this.backgroundAlpha),t.setViewport(p,m,h,g),t.setScissor(p,m,h,g);let _=this.viewport.bottom!==0||this.viewport.left!==0||this.viewport.width!==1||this.viewport.height!==1;t.setScissorTest(_);let v=this.scene.background;this.scene.background=this.camera.isOrthographicCamera?null:v;let y=!0;if(this.controller&&this.controller.render()&&(y=!1),y){let e=this.fiveRenderer.render(t,this.scene,this.modelScene,this.camera,this.needsRender);this.poweredByRealsee&&e&&ob(t)}this.scene.background=v,t.autoClear=r,t.autoClearColor=i,t.autoClearDepth=a,t.autoClearStencil=o,t.setClearColor(s,c),t.setViewport(l),t.setScissor(u),t.setScissorTest(d),t.setRenderTarget(n),e&&ei.shared.add(e,!0)}updateTime(e,t,...n){if(this.currentUpdateArgs={time:e,args:n},this.destroyed)return;if(this.renderer&&_o.detectSupport(this.renderer),this.syncingState=this.syncState(e,t),this.controller&&this.controller.updateTime(e,t,...n),this.renderer&&(this.camera.pixelRatio=this.renderer.getPixelRatio(),this.getSize(this.camera.resolution),this.camera.aspect=this.camera.resolution.width/this.camera.resolution.height),this.camera.controllerMode=this.currentMode,this.camera.updateTime(e),this.renderer){let e=this.modelScene.loaded,t=this.modelScene.refined;this.modelScene.update(this.renderer,this.camera),e===!1&&this.modelScene.loaded===!0&&(this.controller&&this.controller.updateModel(this.modelScene),ei.shared.add(()=>{this.emit(`models.load`,Q(`models.load`,{modelScene:this.modelScene}))},!0,0,10)),t===!1&&this.modelScene.refined===!0&&ei.shared.add(()=>{this.emit(`models.refined`,Q(`models.refined`,{modelScene:this.modelScene}))},!0,0,10)}if(this.camera.autoNearFar){Vb.makeEmpty(),Vb.expandByObject(this.modelScene.boundingMesh);let t=Vb.getBoundingSphere(Bb),n=t.radius*2;t.containsPoint(this.camera.position)||(n=this.camera.position.distanceTo(t.center)+t.radius),n=H(n,800);let r=n/1e4;r=H(r,.03,.1),this.camera.near!==r&&(this.camera.near=r),this.camera.far!==n&&(this.camera.far=n),this.camera.updateTime(e)}if(this.renderer){let e=this.modelScene.visible;this.modelScene.visible=!1,this.scene.update(this.renderer,this.camera),this.modelScene.visible=e}if(this.syncingState=!1,this.controller&&this.controller.needsRender===!0&&(this.controller.needsRender=!1,this.needsRender=!0),this.camera.needsRender===!0&&(this.camera.needsRender=!1,this.needsRender=!0),this.modelScene.needsRender===!0&&(this.modelScene.needsRender=!1,this.needsRender=!0),this.scene.needsRender===!0&&(this.scene.needsRender=!1,this.needsRender=!0),this.pbmGaussianSplattingRenderMesh&&this.pbmGaussianSplattingRenderMesh.needsRender===!0&&(this.pbmGaussianSplattingRenderMesh.needsRender=!1,this.needsRender=!0),this.onlyRenderIfNeeds!==!0&&(this.needsRender=!0),this.paused===!0)return;let r=Q(`render.prepare`,{needsRender:this.needsRender});this.emit(`render.prepare`,r),r.defaultPrevented&&(this.needsRender=!1);let i=this.needsRender;this.render(),this.needsRender=!1,this.emit(`render`,Q(`render`,{needsRender:i})),this.hasListener(`fps`)&&(this.fps.testTime&&e-this.fps.testTime<1e3?this.fps.testCount++:(this.emit(`fps`,this.fps.testCount),this.fps.testTime=e,this.fps.testCount=0))}pause(){this.paused=!0,this.renderer&&this.renderer instanceof Uh&&this.renderer.clear(!0,!0,!0)}play(){this.needsRender=!0,this.paused=!1}moveToPano(t,n={},r=!0){let{controller:i,renderer:a}=this;if(!i)return this.throwError(Error(`controller is not initialized.`)),Promise.resolve();if(!a)return this.throwError(Error(`renderer is not initialized.`)),Promise.resolve();typeof t==`number`&&this.pano.workCode&&(t={workCode:this.pano.workCode,panoIndex:t});let o=this.works.getObserver(t);if(!o)return this.throwError(Error(`pano ${JSON.stringify(t)} not existed.`)),Promise.resolve();let s={workCode:o.work.workCode,panoIndex:o.panoIndex};return`moveToPano`in i&&typeof i.moveToPano==`function`?i.moveToPano(s,n,r):o&&(this.pano=s,this.once(`initAnimation.start`,e=>{n.moveStartCallback&&n.moveStartCallback(e.state)}),this.once(`initAnimation.end`,e=>{n.moveEndCallback&&n.moveEndCallback(e.state)}),this.changeMode(e.Mode.Panorama,n,{effect:n.effect},r)),this.ready()}preloadPano(e,t=G){let n=this.works.getObserver(e);if(!n)return Promise.reject(Error(`Pano ${JSON.stringify(e)} never found`));let r=[`right`,`left`,`up`,`down`,`front`,`back`],i=V();return Promise.all(r.map(e=>{let t=Z({panoIndex:n.panoIndex,workCode:n.work.workCode}),r=Object.assign({key:`pano.${t}.${e}`},dr(this.imageOptions,[`size`,`format`,`quality`,`forceUseExifOrientation`,`mappings`])),i=n.work.getURL(n.images[e]),a=this.imageOptions.transform?this.imageOptions.transform(i,r):Ur(i,r);return Gf(this.fiveId,n.work).preload(a)})).then(()=>{let e=V()-i;return t(e),e})}project2d(e,n=!1){if(!this.renderer)return null;if(n){let n=this.camera.position,r=e.clone().sub(n),i=new t.Raycaster(n,r.clone().normalize());i.params.Points={threshold:.1};let[a]=this.modelScene.intersectRaycaster(i);if(a&&a.distance+.01<r.length())return null}let r=e.clone().project(this.camera);if(Math.abs(r.z)>1)return null;let i=this.renderer.getSize(new t.Vector2),a=i.x*this.viewport.width,o=i.y*this.viewport.height,s=i.x*this.viewport.left+(r.x+1)/2*a,c=i.y*(1-this.viewport.bottom-this.viewport.height)+(-r.y+1)/2*o;return new t.Vector2(s,c)}getCurrentState(){return Object.assign(Object.assign({},this.camera.copyPose()),{mode:this.currentMode,workCode:this.pano.workCode,panoIndex:this.pano.panoIndex})}setState(e,n=!1,r=!0){var i,a,o,s,c,l,u,d,f,p;e=dr(e,[`mode`,`workCode`,`panoIndex`,`longitude`,`latitude`,`fov`,`offset`,`distance`]),e.offset&&!(e instanceof t.Vector3)&&(e.offset=new t.Vector3(e.offset.x,e.offset.y,e.offset.z));let m;if(typeof e.panoIndex==`number`)if(e.workCode)m={workCode:e.workCode,panoIndex:e.panoIndex};else{let t=(a=(i=this.work)==null?void 0:i.workCode)==null?``:a,n=this.state.workCode;this.works.filter(e=>e.workCode===n).length>0&&(t=n),m={workCode:t,panoIndex:e.panoIndex}}let h=(o=e.mode)==null?this.state.mode:o,g,_,v,y,b;if(this.controller&&this.controller.stopMomentumMovement(),this.state.mode!==h){if(h===`VRPanorama`){this.changeMode(`VRPanorama`,void 0,void 0,!0);return}let n={workCode:m==null?void 0:m.workCode,panoIndex:m==null?void 0:m.panoIndex};typeof e.longitude==`number`&&(n.longitude=e.longitude),typeof e.latitude==`number`&&(n.latitude=e.latitude),typeof e.fov==`number`&&(n.fov=e.fov),typeof e.distance==`number`&&(n.distance=e.distance),e.offset instanceof t.Vector3&&(n.offset=e.offset);let r=Object.assign(Object.assign({initial:{state:n,currentState:this.getCurrentState(),duration:this.modeChangeDuration,effect:`fly`,userAction:!1}},this.commonParams()),this.controllerInits[h]),i=zy[h].initAnimationEndState(r);g=i.longitude,_=i.latitude,v=i.fov,y=i.offset,b=i.distance}else g=(s=e.longitude)==null?this.state.longitude:s,_=(c=e.latitude)==null?this.state.latitude:c,v=(l=e.fov)==null?this.state.fov:l,y=(u=e.offset)==null?this.state.offset:u,b=(d=e.distance)==null?this.state.distance:d;let x={workCode:(m==null?this.pano:m).workCode,panoIndex:(m==null?this.pano:m).panoIndex,mode:h,longitude:g,latitude:_,fov:v,offset:y,distance:b};this.emit(`state.set`,Q(`state.set`,{userAction:r,state:x})),Eg(this.state,x)||(this.controller&&x.mode===`VRPanorama`&&x.mode!==this.state.mode?(Tg(this.state,x),this.changeMode(`VRPanorama`)):this.controller&&x.mode===`XRPanorama`&&x.mode!==this.state.mode?(Tg(this.state,x),this.changeMode(`XRPanorama`)):(Tg(this.state,x),this.controller&&r&&(this.controller.userAction=!1),n&&this.state.mode===x.mode&&(this.syncingState=this.syncState(V(),0,n),this.syncingState&&((f=this.controller)==null||f.updateTime(V(),0),this.syncingState=!1)),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(p=this.analysis)==null||p.state(this.works,this.state)))}syncState(n,r,i=!1){let a=this.stateSynced;if(this.stateSynced=!1,!this.controller)return!1;if(this.state.mode!==this.currentMode){let e={mode:this.state.mode,workCode:this.state.workCode,panoIndex:this.state.panoIndex,longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.changeMode(this.state.mode,e,this.modeChangeDuration,this.controller.userAction),!0}if(!this.controller.isReady())return!1;if(this.controller instanceof zy.Model){if(hg(this.camera.pose.offset,this.state.offset)){let e={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset};return this.controller.moveToPosition(this.state.offset,Object.assign(Object.assign({},e),{duration:i?0:void 0}),!1),!0}}else{let e={workCode:this.state.workCode,panoIndex:this.state.panoIndex};if(!zp(e,this.pano)&&`moveToPano`in this.controller&&typeof this.controller.moveToPano==`function`){let t={longitude:this.state.longitude,latitude:this.state.latitude,fov:this.state.fov,offset:this.state.offset,distance:this.state.distance};return this.controller.moveToPano(e,t,!1),!0}}if(this.controller instanceof zy.Floorplan||this.controller instanceof zy.Topview||this.controller instanceof zy.Mapview){let e=.2,n=Math.PI/45,r=i?this.state.fov:Hm(this.camera.pose.fov,this.state.fov,1),a=Math.abs(this.camera.pose.distance-this.state.distance),o=a>e*15?a/15:.2,s=i?this.state.distance:Hm(this.camera.pose.distance,this.state.distance,o),c=this.camera.pose.offset.distanceTo(this.state.offset),l=c>e*15?c/15:e,u=i?new t.Vector3().copy(this.state.offset):Um(this.camera.pose.offset,this.state.offset,l),{longitude:d,latitude:f}=i?{longitude:this.state.longitude,latitude:this.state.latitude}:Wm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},n);if(pg(r,this.camera.pose.fov)||hg(u,this.camera.pose.offset)||pg(s,this.camera.pose.distance)||pg(d,this.camera.pose.longitude,Math.PI*2)||pg(f,this.camera.pose.latitude)){let e={x:u.x,y:u.y,z:u.z},t={fov:r};return Object.assign(e,{distance:s}),Object.assign(t,{longitude:d,latitude:f}),this.controller.stopMomentumMovement(),this.controller.cameraMotion.set(t,0).catch(G),this.controller.locationMotion.set(e,0).catch(G),!0}}else{let e=Math.PI/45,n=i?this.state.fov:Hm(this.camera.pose.fov,this.state.fov,1),{longitude:r,latitude:a}=i?{longitude:this.state.longitude,latitude:this.state.latitude}:Wm({longitude:this.camera.pose.longitude,latitude:this.camera.pose.latitude},{longitude:this.state.longitude,latitude:this.state.latitude},e),o=this.state.distance,s=new t.Vector3().copy(this.state.offset);if(pg(o,this.camera.pose.distance)&&(this.state.distance=this.camera.pose.distance),hg(s,this.camera.pose.offset)&&(this.state.offset=this.camera.pose.offset.clone()),pg(r,this.camera.pose.longitude,Math.PI*2)||pg(a,this.camera.pose.latitude)||pg(n,this.camera.pose.fov))return this.controller.stopMomentumMovement(),this.controller.cameraMotion.set({longitude:r,latitude:a,fov:n},0).catch(G),!0}if(this.stateSynced=!0,a===!1&&this.emit(`state.synced`,Q(`state.synced`,{userAction:!1,state:this.state})),this.readyCallbacks.length&&this.stateSynced){let t=this.currentMode;if(!(t===e.Mode.Floorplan||t===e.Mode.Topview||t===e.Mode.Mapview||t===e.Mode.Model)||this.modelScene.loaded){let e=this.readyCallbacks.slice();this.readyCallbacks.length=0;for(let t of e)this.controller instanceof zy.Panorama&&t.tile===!0&&!this.controller.isTileReady()?this.readyCallbacks.push(t):t()}}return!1}ready(e={}){return new Promise(t=>{var n;this.readyCallbacks.push(Object.assign(t,{tile:(n=e.tile)==null?!1:n}))}).then(()=>this.model.initReady).then(G)}requestFullscreen(){var e;if(!yg)return;let t=(e=this.getElement())==null?void 0:e.parentNode;t&&`requestFullscreen`in t&&typeof document<`u`&&document.fullscreenElement===null&&t.requestFullscreen()}exitFullscreen(){typeof document<`u`&&document.fullscreenElement&&`exitFullscreen`in document&&document.exitFullscreen()}throwError(e){this.hasListener(`error`)?this.emit(`error`,e):console.error(e)}bindModel(e){let t=()=>{ei.shared.add(()=>{this.emit(`model.load`,Q(`model.load`,{work:e.work,model:e,error:null}))},!0)},n=t=>{let{error:n}=t;this.emit(`model.error`,Q(`model.error`,{work:e.work,model:e,error:n})),this.throwError(n)},r=()=>{this.emit(`model.changeShownFloor`,Q(`model.changeShownFloor`,{work:e.work,model:e,error:null}))},i=t=>{this.emit(`models.tileLoad`,Q(`model.tileLoad`,{work:e.work,model:e,tile:t.tile}))},a=t=>{this.emit(`models.tileUnload`,Q(`model.tileUnload`,{work:e.work,model:e,tile:t.tile}))},o=()=>{e.removeEventListener(`load`,t),e.removeEventListener(`error`,n),e.removeEventListener(`changeShownFloor`,r),e.removeEventListener(`tileLoad`,i),e.removeEventListener(`tileUnload`,a),e.removeEventListener(`dispose`,o)};e.addEventListener(`load`,t),e.addEventListener(`error`,n),e.addEventListener(`changeShownFloor`,r),e.addEventListener(`tileLoad`,i),e.addEventListener(`tileUnload`,a),e.addEventListener(`dispose`,o),this.emit(`model.request`,Q(`model.request`,{work:e.work,model:e,error:null}))}bindWorkFetcher(e){let t=this,n=e.workCode,r=e.allowHosts,i=new lr({get networkSubscribe(){return t.networkSubscribe},requestProxy(e){return Promise.resolve(e).then(e=>t.requestProxy(e,n)).then(e=>{let t=cm(e,r);return t instanceof Error?Promise.reject(t):t})}});Kf(this.fiveId,e,i)}commonParams(){return{fiveId:this.fiveId,scene:this.scene,xrCustomObjectsScene:this.xrCustomObjectsScene,helper:this.helperGroup,camera:this.camera,renderer:this.renderer,viewport:this.viewport,element:this.getElement(),works:this.works,imageOptions:this.imageOptions,enableWheel:this.enableWheel,extraElements:this.extraElements,videoTexture:this.videoTexture,modelScene:this.modelScene}}applyController(t,n){if(!this.renderer)throw Error(`renderer is not initialized.`);let r=zy[t];this.currentMode=t;let i=new r(n);for(let e of Vy)i.on(e,(...t)=>{if(this.emit(e,...t))return!1});{let e=zy[t].initAnimationEndState(n),r=n.initial.userAction;Eg(this.state,e)||(Tg(this.state,e),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state}))),this.emit(`currentState.change`,Q(`currentState.change`,{userAction:r,state:this.getCurrentState()}))}return i.on(`camera.update`,e=>{var t;if(this.controller){let n=this.controller.getTargetState();e.userAction&&this.syncingState===!1&&this.state.mode===n.mode&&!Eg(this.state,n)&&(Tg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:e.userAction,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}this.emit(`currentState.change`,Q(`currentState.change`,{userAction:e.userAction,state:this.getCurrentState()}))}),i.on(`initAnimation.start`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!Eg(this.state,n)&&(Tg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`initAnimation.end`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Eg(this.state,n)&&(Tg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Eg(this.state,n)&&(Tg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.arrived`,e=>{var t;let{state:n,userAction:r}=e;this.pano={workCode:n.workCode,panoIndex:n.panoIndex},r&&this.state.mode===n.mode&&!Eg(this.state,n)&&(Tg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.cancel`,e=>{var t;let{state:n,userAction:r}=e;r&&this.state.mode===n.mode&&!Eg(this.state,n)&&(Tg(this.state,n),this.emit(`state.change`,Q(`state.change`,{userAction:r,state:this.state})),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.error`,e=>{var t;let{state:n}=e;this.state.mode===n.mode&&!Eg(this.state,n)&&(Tg(this.state,n),(t=this.analysis)==null||t.state(this.works,this.state))}),i.on(`pano.moveTo`,e=>{let{userAction:t}=e;this.emit(`currentState.change`,Q(`currentState.change`,{userAction:t,state:this.getCurrentState()}))}),i.on(`pano.request`,e=>{this.emit(`pano.request`,e),e.defaultPrevented||this.moveToPano(e.state,e.options,e.userAction)}),i.on(`vr.requestExit`,()=>{this.currentMode===e.Mode.VRPanorama&&(this.exitFullscreen(),this.changeMode(e.Mode.Panorama))}),i.on(`error`,e=>this.throwError(e)),i}removeEventListeners(){}get internalLightsEnabled(){let e=this.scene.children.find(e=>e.name===`internalLights`);return e?e.visible:!1}set internalLightsEnabled(e){let t=this.scene.children.find(e=>e.name===`internalLights`);t&&(t.visible=e),t=this.modelScene.children.find(e=>e.name===`internalLights`),t&&(t.visible=e)}get scissor(){return this.viewport}setScissor(e){return this.setViewport(e)}getPose(){let{longitude:e,latitude:t,fov:n,offset:r,distance:i}=this.camera.copyPose();return{longitude:e,latitude:t,fov:n,offset:r.clone(),distance:i}}getLongitudeAndLatitude(){let{longitude:e,latitude:t}=this.getPose();return{longitude:e,latitude:t}}getOffset(){return this.getPose().offset}getCameraLocal(){if(this.pano.workCode&&this.controller&&this.works){let e=this.works.getObserver(this.pano);if(e){let n=new t.Object3D;n.matrix.copy(e.matrix).premultiply(e.work.transform),n.matrix.decompose(n.position,n.quaternion,n.scale),n.matrixAutoUpdate=!1;let r=new t.Vector3(0,0,-1);r.applyQuaternion(this.camera.quaternion);let i=n.quaternion.clone().inverse();return r.applyQuaternion(i),{theta:Math.atan2(r.x,-r.z),phi:-Math.asin(r.y),lookAtVector:r}}}return null}addPass(e){this.fiveRenderer.composer.addPass(e)}removePass(e){let t=this.fiveRenderer.composer.passes.indexOf(e);t!==-1&&this.fiveRenderer.composer.passes.splice(t,1)}insertPass(e,t){this.fiveRenderer.composer.insertPass(e,t)}get renderMode(){return this.fiveRenderer.renderMode}set renderMode(e){this.fiveRenderer.renderMode=e}get enableHQ(){return this.fiveRenderer.renderMode===`point-cloud-high-quality`}set enableHQ(e){this.fiveRenderer.renderMode=e?`point-cloud-high-quality`:`default`,this.needsRender=!0}get enableEDL(){return this.eyeDomeLightingPass.enabled}set enableEDL(e){this.eyeDomeLightingPass.enabled=e,this.needsRender=!0}get enableAdaptiveLuminance(){return this.adaptiveLuminancePass.enabled}set enableAdaptiveLuminance(e){this.adaptiveLuminancePass.enabled=e,this.needsRender=!0}get enableIOSEDR(){return!1}set enableIOSEDR(e){}get enablePostProcessing(){return!0}set enablePostProcessing(e){}get modelSceneNeedsRender(){return this.modelScene.needsRender}set modelSceneNeedsRender(e){this.modelScene.needsRender=e}};Yb.Mode={Panorama:`Panorama`,Model:`Model`,Floorplan:`Floorplan`,Topview:`Topview`,Mapview:`Mapview`,VRPanorama:`VRPanorama`,XRPanorama:`XRPanorama`},typeof window<`u`&&Object.assign(window,{__FIVE_DEBUG__:{THREE:t,constructor:Yb,instances:Jb}});var Xb=class{static createButton(e){let t=document.createElement(`button`);function n(){t.style.display=``,t.style.cursor=`pointer`,t.style.left=`calc(50% - 50px)`,t.style.width=`100px`,t.textContent=`ENTER VR`,t.onmouseenter=function(){t.style.opacity=`1.0`},t.onmouseleave=function(){t.style.opacity=`0.5`},t.onclick=function(){e&&e()}}function r(){t.style.display=``,t.style.cursor=`auto`,t.style.left=`calc(50% - 75px)`,t.style.width=`150px`,t.onmouseenter=null,t.onmouseleave=null,t.onclick=null}function i(){r(),t.textContent=`VR NOT SUPPORTED`}function a(e){e.style.position=`absolute`,e.style.bottom=`20px`,e.style.padding=`12px 6px`,e.style.border=`1px solid #fff`,e.style.borderRadius=`4px`,e.style.background=`rgba(0,0,0,0.1)`,e.style.color=`#fff`,e.style.font=`normal 13px sans-serif`,e.style.textAlign=`center`,e.style.opacity=`0.5`,e.style.outline=`none`,e.style.zIndex=`999`}if(`xr`in navigator)return t.id=`VRButton`,t.style.display=`none`,a(t),navigator.xr.isSessionSupported(`immersive-vr`).then(function(e){e?n():i()}),t;{let e=document.createElement(`a`);return window.isSecureContext===!1?(e.href=document.location.href.replace(/^http:/,`https:`),e.innerHTML=`WEBXR NEEDS HTTPS`):(e.href=`https://immersiveweb.dev/`,e.innerHTML=`WEBXR NOT AVAILABLE`),e.style.left=`calc(50% - 90px)`,e.style.width=`180px`,e.style.textDecoration=`none`,a(e),e}}};exports.AdaptiveLuminancePass=Ym,exports.AnimationFrameLoop=ei,exports.BoundingMesh=yp,exports.Camera=Yt,exports.CustomShader=an,exports.PBMCustomShader=an,exports.EffectComposer=Tm,exports.EyeDomeLightingPass=Qm,exports.Fetcher=lr,exports.Five=Yb,exports.FivePass=Dm,exports.FiveRenderer=Hh,exports.FlowingFireworks3DPass=wh,exports.FlowingLight2DPass=lh,exports.FlowingLight3DPass=mh,exports.FullScreenQuad=Em,exports.GaussianBlurPass=th,exports.Histogram=zm,exports.InternalWebGLRenderer=Uh,exports.Model=up,exports.ModelScene=xp,exports.Motion=X,exports.NetworkSubscribe=ir,exports.PBMContainer=Wn,exports.PBMGSObject=e.t,exports.PBMGroup=vt,exports.PBMMesh=mn,exports.PBMMeshMaterial=pn,exports.PBMPanoFilter=on,exports.PBMPointCloud=wn,exports.PBMPointCloudMaterial=Cn,exports.PBMSkinnedMesh=hn,exports.PBMUpdateable=rn,exports.PROXY_CONTROLLER_EVENT_NAMES=Vy,exports.PanoCircleMesh=tg,exports.PanoCircleMeshCustom=dg,exports.PanoCircleMeshSolid=og,exports.Parameter=W,exports.Scene=Xh,exports.Subscribe=nn,exports.TextureLoader=fi,exports.Tile=gu,exports.Tile3D=Uf,exports.Tile3DModel=Uf,exports.TileCache=Hd,exports.TileNode=jd,exports.TileRequestScheduler=zd,exports.Tileset=Jd,exports.Trajectory=Fd,exports.TrajectoryNode=Id,exports.Work=bm,exports.WorkResolvedObserver=Cm,exports.XRButton=Xb,exports.controllersDefaultInitArgs=By,exports.coordinatesToVector=It,exports.createDebugBoundingMesh=du,exports.createWorks=wm,exports.defaultImageURLTransform=Ur,exports.draco=co,exports.getViewportScale=Ky,exports.headingToLongitude=zt,exports.imageSupport=Er,exports.isBoundingVolume=ou,exports.isPanoId=Bp,exports.ktx2=_o,exports.loadAt3d=ca,exports.loadB3dm=Ws,exports.loadDome=fa,exports.loadDomez=ya,exports.loadFbx=al,exports.loadGltf=$s,exports.loadObj=Ji,exports.loadPbm=ki,exports.loadPly=tc,exports.loadPnts=Zs,exports.loadSpz=Is,exports.loadX3p=zl,exports.longitudeToHeading=Rt,exports.makeBoundingVolume=su,exports.panoEqual=zp,exports.panoParse=Rp,exports.panoStringify=Z,exports.parseWork=xm,exports.vectorToCoordinates=Lt,exports.workToJson=Ep;
|